app.js 2.0 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116
  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/NoteDeleteModal.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/NoteDeleteModal.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 _Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Modal.vue */ "./resources/js/components/Modal.vue");
  2222. /* harmony import */ var _CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2223. //
  2224. //
  2225. //
  2226. //
  2227. //
  2228. //
  2229. //
  2230. //
  2231. //
  2232. //
  2233. //
  2234. //
  2235. //
  2236. //
  2237. //
  2238. //
  2239. //
  2240. /* harmony default export */ __webpack_exports__["default"] = ({
  2241. components: {
  2242. Modal: _Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2243. CircleSpinner: _CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  2244. },
  2245. props: {
  2246. modalId: {
  2247. type: String,
  2248. require: true
  2249. },
  2250. note: {
  2251. type: Object,
  2252. required: true
  2253. }
  2254. },
  2255. data: function data() {
  2256. return {
  2257. noteDeleting: false
  2258. };
  2259. },
  2260. methods: {
  2261. deleteNote: function deleteNote(note) {
  2262. var _this = this;
  2263. this.noteDeleting = true;
  2264. axios["delete"]("/api/workorders/notes/".concat(this.note.noteid)).then(function (response) {
  2265. _this.noteDeleting = false;
  2266. $("#".concat(_this.modalId)).modal('hide');
  2267. })["catch"](function (error) {
  2268. _this.noteDeleting = false;
  2269. console.log(error);
  2270. });
  2271. }
  2272. }
  2273. });
  2274. /***/ }),
  2275. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js&":
  2276. /*!************************************************************************************************************************************************************************!*\
  2277. !*** ./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& ***!
  2278. \************************************************************************************************************************************************************************/
  2279. /*! exports provided: default */
  2280. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2281. "use strict";
  2282. __webpack_require__.r(__webpack_exports__);
  2283. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  2284. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2285. //
  2286. //
  2287. //
  2288. //
  2289. //
  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. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2331. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  2332. },
  2333. props: {
  2334. populateWith: {
  2335. type: Object,
  2336. require: true
  2337. },
  2338. modalId: {
  2339. type: String,
  2340. require: true
  2341. },
  2342. noteUser: {
  2343. type: String
  2344. },
  2345. woid: {
  2346. type: Number
  2347. },
  2348. // If true, user is intending to switch the note
  2349. // from public to private or vice/versa. Modal
  2350. // Will be displayed differently, but the update
  2351. // logic is only different for one line of code.
  2352. changeType: {
  2353. type: Boolean,
  2354. "default": false
  2355. }
  2356. },
  2357. data: function data() {
  2358. return {
  2359. note: JSON.parse(JSON.stringify(this.populateWith)),
  2360. noteSaving: false
  2361. };
  2362. },
  2363. methods: {
  2364. updateNote: function updateNote() {
  2365. var _this = this;
  2366. this.noteSaving = true;
  2367. if (this.changeType) {
  2368. this.note.notetype = this.note.notetype === 1 ? 0 : 1;
  2369. }
  2370. axios.put('/api/workorders/notes/' + this.note.noteid, this.note).then(function (response) {
  2371. _this.noteSaving = false;
  2372. _this.hideModal();
  2373. });
  2374. },
  2375. hideModal: function hideModal() {
  2376. $('#' + this.modalId).modal('hide');
  2377. }
  2378. }
  2379. });
  2380. /***/ }),
  2381. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Notes.vue?vue&type=script&lang=js&":
  2382. /*!****************************************************************************************************************************************************************!*\
  2383. !*** ./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& ***!
  2384. \****************************************************************************************************************************************************************/
  2385. /*! exports provided: default */
  2386. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2387. "use strict";
  2388. __webpack_require__.r(__webpack_exports__);
  2389. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2390. /* harmony import */ var _NoteFormModal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NoteFormModal.vue */ "./resources/js/components/NoteFormModal.vue");
  2391. /* harmony import */ var _CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2392. /* harmony import */ var _NoteDeleteModal_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./NoteDeleteModal.vue */ "./resources/js/components/NoteDeleteModal.vue");
  2393. //
  2394. //
  2395. //
  2396. //
  2397. //
  2398. //
  2399. //
  2400. //
  2401. //
  2402. //
  2403. //
  2404. //
  2405. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  2437. components: {
  2438. NoteFormModal: _NoteFormModal_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  2439. CircleSpinner: _CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  2440. NoteDeleteModal: _NoteDeleteModal_vue__WEBPACK_IMPORTED_MODULE_3__["default"]
  2441. },
  2442. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2443. props: {
  2444. notes: {
  2445. type: Array,
  2446. "default": []
  2447. },
  2448. authusername: {
  2449. type: String,
  2450. required: true
  2451. },
  2452. noteType: {
  2453. type: Number,
  2454. required: true
  2455. },
  2456. woid: {
  2457. type: String,
  2458. required: true
  2459. }
  2460. },
  2461. data: function data() {
  2462. return {
  2463. newNote: {
  2464. notetype: this.noteType,
  2465. thenote: '',
  2466. noteuser: this.authusername,
  2467. woid: this.woid
  2468. },
  2469. noteSaving: false
  2470. };
  2471. },
  2472. computed: {
  2473. noteOrders: function noteOrders() {
  2474. return this.getNoteOrders(this.notes);
  2475. }
  2476. },
  2477. methods: {
  2478. createNote: function createNote() {
  2479. var _this = this;
  2480. this.noteSaving = true;
  2481. axios.post('/api/workorders/notes', this.newNote).then(function (response) {
  2482. _this.noteSaving = false;
  2483. $('#note' + _this.noteType + 'add').collapse('hide');
  2484. _this.newNote.thenote = '';
  2485. })["catch"](function (error) {
  2486. _this.noteSaving = false;
  2487. console.log(error);
  2488. });
  2489. },
  2490. getNoteOrders: function getNoteOrders(notes) {
  2491. var noteOrders = [];
  2492. notes.forEach(function (note, index) {
  2493. if (index === 0) {
  2494. noteOrders[index] = 'order-first';
  2495. } else if (note.noteuser !== notes[index - 1].noteuser) {
  2496. if (noteOrders[index - 1] === 'order-first') {
  2497. noteOrders[index] = 'order-last';
  2498. } else {
  2499. noteOrders[index] = 'order-first';
  2500. }
  2501. } else {
  2502. noteOrders[index] = noteOrders[index - 1];
  2503. }
  2504. });
  2505. return noteOrders;
  2506. }
  2507. }
  2508. });
  2509. /***/ }),
  2510. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  2511. /*!**************************************************************************************************************************************************************************!*\
  2512. !*** ./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& ***!
  2513. \**************************************************************************************************************************************************************************/
  2514. /*! exports provided: default */
  2515. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2516. "use strict";
  2517. __webpack_require__.r(__webpack_exports__);
  2518. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  2519. /* harmony import */ var _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown.vue */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  2520. /* harmony import */ var _components_ErrorList_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/ErrorList.vue */ "./resources/js/components/ErrorList.vue");
  2521. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2522. //
  2523. //
  2524. //
  2525. //
  2526. //
  2527. //
  2528. //
  2529. //
  2530. //
  2531. //
  2532. //
  2533. //
  2534. //
  2535. //
  2536. //
  2537. //
  2538. //
  2539. //
  2540. //
  2541. //
  2542. //
  2543. //
  2544. //
  2545. //
  2546. //
  2547. //
  2548. //
  2549. //
  2550. //
  2551. //
  2552. //
  2553. //
  2554. //
  2555. //
  2556. //
  2557. //
  2558. /* harmony default export */ __webpack_exports__["default"] = ({
  2559. components: {
  2560. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2561. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  2562. ErrorList: _components_ErrorList_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  2563. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_3__["default"]
  2564. },
  2565. props: {
  2566. populateWith: {
  2567. type: Object,
  2568. required: true
  2569. },
  2570. storeList: {
  2571. type: Object,
  2572. required: true
  2573. },
  2574. modalId: {
  2575. type: String,
  2576. required: true
  2577. }
  2578. },
  2579. data: function data() {
  2580. return {
  2581. // Copies object from prop, so it doesn't mutate the object
  2582. // from the parent component. Parent component will be updated via
  2583. // Websocket if updateWorkOrder is successful.
  2584. data: JSON.parse(JSON.stringify(this.populateWith)),
  2585. id: this.modalId,
  2586. store: {},
  2587. errors: [],
  2588. woInfoSaving: false
  2589. };
  2590. },
  2591. methods: {
  2592. updateWorkOrder: function updateWorkOrder() {
  2593. var _this = this;
  2594. this.woInfoSaving = true;
  2595. this.data.storeid = this.store.id;
  2596. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2597. _this.woInfoSaving = false;
  2598. $('#workordereditModal').modal('hide');
  2599. })["catch"](function (error) {
  2600. _this.woInfoSaving = false;
  2601. _this.errors = JSON.parse(error.response.request.response).errors;
  2602. });
  2603. }
  2604. },
  2605. mounted: function mounted() {
  2606. this.store = {
  2607. 'id': this.data.storeid,
  2608. 'name': this.storeList[this.data.storeid]
  2609. };
  2610. },
  2611. // This was originally here because the populateWith info would originally
  2612. // not necessarily be loaded when this component was mounted. That is no
  2613. // longer the case as I now don't render the parent component until the
  2614. // ajax request is finised. The watch statements are still here to cover
  2615. // the case where someone else updates the populateWith values while
  2616. // someone is editing, although it probably should be edited so it doesn't
  2617. // immediately overwrite the unsaved edits of the current user.
  2618. watch: {
  2619. populateWith: function populateWith(value) {
  2620. this.data = JSON.parse(JSON.stringify(this.populateWith));
  2621. this.store = {
  2622. 'id': this.data.storeid,
  2623. 'name': this.storeList[this.data.storeid]
  2624. };
  2625. },
  2626. storeList: function storeList(value) {
  2627. this.store = {
  2628. 'id': this.data.storeid,
  2629. 'name': this.storeList[this.data.storeid]
  2630. };
  2631. }
  2632. }
  2633. });
  2634. /***/ }),
  2635. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  2636. /*!************************************************************************************************************************************************************************!*\
  2637. !*** ./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& ***!
  2638. \************************************************************************************************************************************************************************/
  2639. /*! exports provided: default */
  2640. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2641. "use strict";
  2642. __webpack_require__.r(__webpack_exports__);
  2643. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2644. /* harmony import */ var _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/WoInfoEditModal */ "./resources/js/components/WoInfoEditModal.vue");
  2645. //
  2646. //
  2647. //
  2648. //
  2649. //
  2650. //
  2651. //
  2652. //
  2653. //
  2654. //
  2655. //
  2656. //
  2657. //
  2658. //
  2659. //
  2660. //
  2661. //
  2662. //
  2663. //
  2664. //
  2665. /* harmony default export */ __webpack_exports__["default"] = ({
  2666. components: {
  2667. WoInfoEditModal: _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__["default"]
  2668. },
  2669. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2670. props: ['workOrder', 'stores'],
  2671. computed: {
  2672. storeList: function storeList() {
  2673. var list = {};
  2674. Object.values(this.stores).map(function (val) {
  2675. list[val.storeid] = val.storesname;
  2676. });
  2677. return list;
  2678. }
  2679. }
  2680. });
  2681. /***/ }),
  2682. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=script&lang=js&":
  2683. /*!*********************************************************************************************************************************************************!*\
  2684. !*** ./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& ***!
  2685. \*********************************************************************************************************************************************************/
  2686. /*! exports provided: default */
  2687. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2688. "use strict";
  2689. __webpack_require__.r(__webpack_exports__);
  2690. //
  2691. //
  2692. //
  2693. //
  2694. //
  2695. //
  2696. //
  2697. //
  2698. //
  2699. //
  2700. //
  2701. //
  2702. //
  2703. //
  2704. //
  2705. //
  2706. //
  2707. //
  2708. //
  2709. //
  2710. //
  2711. //
  2712. //
  2713. //
  2714. //
  2715. //
  2716. //
  2717. //
  2718. //
  2719. //
  2720. //
  2721. //
  2722. //
  2723. //
  2724. //
  2725. //
  2726. //
  2727. //
  2728. //
  2729. //
  2730. //
  2731. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  2762. data: function data() {
  2763. return {
  2764. isLoggedIn: null,
  2765. username: null
  2766. };
  2767. },
  2768. mounted: function mounted() {
  2769. this.isLoggedIn = localStorage.getItem('jwt');
  2770. this.username = localStorage.getItem('user');
  2771. }
  2772. });
  2773. /***/ }),
  2774. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  2775. /*!***************************************************************************************************************************************************************!*\
  2776. !*** ./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& ***!
  2777. \***************************************************************************************************************************************************************/
  2778. /*! exports provided: default */
  2779. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2780. "use strict";
  2781. __webpack_require__.r(__webpack_exports__);
  2782. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2783. //
  2784. //
  2785. //
  2786. //
  2787. //
  2788. //
  2789. //
  2790. //
  2791. //
  2792. //
  2793. //
  2794. //
  2795. //
  2796. //
  2797. //
  2798. //
  2799. //
  2800. //
  2801. //
  2802. //
  2803. //
  2804. //
  2805. //
  2806. //
  2807. //
  2808. //
  2809. /* harmony default export */ __webpack_exports__["default"] = ({
  2810. components: {
  2811. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  2812. },
  2813. data: function data() {
  2814. return {
  2815. workOrders: [],
  2816. isLoading: true
  2817. };
  2818. },
  2819. mounted: function mounted() {
  2820. var _this = this;
  2821. var token = localStorage.getItem('jwt');
  2822. var user = localStorage.getItem('user');
  2823. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2824. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
  2825. axios.get('api/users/' + user + '/workorders').then(function (response) {
  2826. _this.workOrders = response.data;
  2827. _this.isLoading = false;
  2828. })["catch"](function (error) {
  2829. console.log(error);
  2830. });
  2831. },
  2832. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2833. if (!localStorage.getItem('jwt')) {
  2834. return next('login');
  2835. }
  2836. next();
  2837. }
  2838. });
  2839. /***/ }),
  2840. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&":
  2841. /*!***********************************************************************************************************************************************************!*\
  2842. !*** ./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& ***!
  2843. \***********************************************************************************************************************************************************/
  2844. /*! exports provided: default */
  2845. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2846. "use strict";
  2847. __webpack_require__.r(__webpack_exports__);
  2848. //
  2849. //
  2850. //
  2851. //
  2852. //
  2853. //
  2854. //
  2855. //
  2856. //
  2857. //
  2858. //
  2859. //
  2860. //
  2861. //
  2862. //
  2863. //
  2864. //
  2865. //
  2866. //
  2867. //
  2868. //
  2869. //
  2870. //
  2871. //
  2872. //
  2873. //
  2874. //
  2875. //
  2876. //
  2877. //
  2878. //
  2879. //
  2880. //
  2881. //
  2882. //
  2883. //
  2884. //
  2885. //
  2886. //
  2887. /* harmony default export */ __webpack_exports__["default"] = ({
  2888. data: function data() {
  2889. return {
  2890. username: "",
  2891. password: ""
  2892. };
  2893. },
  2894. methods: {
  2895. handleSubmit: function handleSubmit(e) {
  2896. var _this = this;
  2897. e.preventDefault();
  2898. if (this.password.length > 0) {
  2899. axios.post('api/login', {
  2900. username: this.username,
  2901. password: this.password
  2902. }).then(function (response) {
  2903. localStorage.setItem('user', response.data.success.username);
  2904. localStorage.setItem('jwt', response.data.success.token);
  2905. if (localStorage.getItem('jwt') != null) {
  2906. _this.$router.go('/dashboard');
  2907. }
  2908. })["catch"](function (error) {
  2909. console.error(error);
  2910. });
  2911. }
  2912. }
  2913. },
  2914. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2915. if (localStorage.getItem('jwt')) {
  2916. return next('dashboard');
  2917. }
  2918. next();
  2919. }
  2920. });
  2921. /***/ }),
  2922. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  2923. /*!*************************************************************************************************************************************************************!*\
  2924. !*** ./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& ***!
  2925. \*************************************************************************************************************************************************************/
  2926. /*! exports provided: default */
  2927. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2928. "use strict";
  2929. __webpack_require__.r(__webpack_exports__);
  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. /***/ }),
  2983. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  2984. /*!***************************************************************************************************************************************************************!*\
  2985. !*** ./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& ***!
  2986. \***************************************************************************************************************************************************************/
  2987. /*! exports provided: default */
  2988. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2989. "use strict";
  2990. __webpack_require__.r(__webpack_exports__);
  2991. /* harmony import */ var _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/WorkOrderInfo.vue */ "./resources/js/components/WorkOrderInfo.vue");
  2992. /* harmony import */ var _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AssetInfo.vue */ "./resources/js/components/AssetInfo.vue");
  2993. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2994. /* harmony import */ var _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/CredentialList.vue */ "./resources/js/components/CredentialList.vue");
  2995. /* harmony import */ var _components_Notes_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/Notes.vue */ "./resources/js/components/Notes.vue");
  2996. //
  2997. //
  2998. //
  2999. //
  3000. //
  3001. //
  3002. //
  3003. //
  3004. //
  3005. //
  3006. //
  3007. //
  3008. //
  3009. //
  3010. //
  3011. //
  3012. //
  3013. //
  3014. //
  3015. //
  3016. //
  3017. //
  3018. //
  3019. //
  3020. //
  3021. //
  3022. //
  3023. //
  3024. //
  3025. //
  3026. //
  3027. //
  3028. //
  3029. //
  3030. //
  3031. //
  3032. //
  3033. //
  3034. //
  3035. //
  3036. //
  3037. //
  3038. //
  3039. //
  3040. //
  3041. //
  3042. //
  3043. //
  3044. //
  3045. //
  3046. //
  3047. //
  3048. //
  3049. //
  3050. //
  3051. //
  3052. //
  3053. //
  3054. //
  3055. //
  3056. //
  3057. //
  3058. //
  3059. //
  3060. //
  3061. //
  3062. //
  3063. //
  3064. //
  3065. //
  3066. //
  3067. //
  3068. //
  3069. //
  3070. //
  3071. //
  3072. //
  3073. //
  3074. //
  3075. //
  3076. //
  3077. //
  3078. //
  3079. //
  3080. //
  3081. //
  3082. //
  3083. //
  3084. //
  3085. //
  3086. //
  3087. //
  3088. //
  3089. //
  3090. //
  3091. //
  3092. //
  3093. //
  3094. //
  3095. //
  3096. //
  3097. /* harmony default export */ __webpack_exports__["default"] = ({
  3098. components: {
  3099. WorkOrderInfo: _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  3100. AssetInfo: _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  3101. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  3102. CredentialList: _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
  3103. Notes: _components_Notes_vue__WEBPACK_IMPORTED_MODULE_4__["default"]
  3104. },
  3105. props: {
  3106. id: {
  3107. type: String,
  3108. required: true
  3109. }
  3110. },
  3111. data: function data() {
  3112. return {
  3113. workOrder: {},
  3114. asset: {},
  3115. stores: {},
  3116. credentials: {},
  3117. credentialDescriptions: {},
  3118. workOrderNotes: [],
  3119. woLoading: true,
  3120. assetLoading: true,
  3121. storesLoading: true,
  3122. credentialsLoading: true,
  3123. credentialDescriptionsLoading: true,
  3124. workOrderNotesLoading: true,
  3125. authUser: localStorage.getItem('user')
  3126. };
  3127. },
  3128. computed: {
  3129. publicNotes: function publicNotes() {
  3130. var notes = [];
  3131. notes = this.workOrderNotes.filter(function (note) {
  3132. return note.notetype === 0;
  3133. });
  3134. return notes;
  3135. },
  3136. privateNotes: function privateNotes() {
  3137. var notes = [];
  3138. notes = this.workOrderNotes.filter(function (note) {
  3139. return note.notetype === 1;
  3140. });
  3141. return notes;
  3142. }
  3143. },
  3144. mounted: function mounted() {
  3145. var _this = this;
  3146. // Get authentication info from current user from local storage
  3147. var token = localStorage.getItem('jwt');
  3148. var user = localStorage.getItem('user'); // Set some axios config options for Content-Type and Authentication.
  3149. axios.defaults.headers.common['Content-Type'] = 'application/json';
  3150. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token; // Get WorkOrder from API
  3151. axios.get('/api/workorders/' + this.id).then(function (response) {
  3152. _this.workOrder = response.data;
  3153. _this.woLoading = false;
  3154. })["catch"](function (error) {
  3155. console.log(error);
  3156. }); // Get list of stores from API
  3157. axios.get('/api/stores/').then(function (response) {
  3158. _this.stores = response.data;
  3159. _this.storesLoading = false;
  3160. })["catch"](function (error) {
  3161. console.log(error);
  3162. }); // Get Asset from API (will most likely be replaced with list of assets
  3163. // in the future. Current each WO can only have one but that is likely
  3164. // to change)
  3165. axios.get("/api/workorders/".concat(this.id, "/asset")).then(function (response) {
  3166. _this.asset = response.data;
  3167. _this.assetLoading = false; // Establish listener for liveupdate broadcasts.
  3168. // Must be done here or we can't guarantee this.asset
  3169. // exists by the time we execute this code.
  3170. Echo.channel('asset.' + _this.asset.pcid).listen('AssetUpdated', function (e) {
  3171. _this.asset = e.data;
  3172. }); // Get Credentials for this asset. May be relocated to be part of asset
  3173. // Component when WOs can have more than one asset.
  3174. axios.get("/api/assets/".concat(_this.asset.pcid, "/credentials")).then(function (response) {
  3175. _this.credentials = response.data;
  3176. _this.credentialsLoading = false;
  3177. })["catch"](function (error) {
  3178. console.log(error);
  3179. }); // Get default list of Credential Descriptions. May be relocated along with
  3180. // the above.
  3181. axios.get('/api/credentials/descriptions').then(function (response) {
  3182. _this.credentialDescriptions = response.data;
  3183. _this.credentialDescriptionsLoading = false;
  3184. })["catch"](function (error) {
  3185. console.log(error);
  3186. });
  3187. })["catch"](function (error) {
  3188. console.log(error);
  3189. });
  3190. axios.get("/api/workorders/".concat(this.id, "/notes")).then(function (response) {
  3191. _this.workOrderNotes = response.data;
  3192. _this.workOrderNotesLoading = false;
  3193. })["catch"](function (error) {
  3194. console.log(error);
  3195. });
  3196. Echo.channel('work-order.' + this.id).listen('WorkOrderUpdated', function (e) {
  3197. _this.workOrder = e.data;
  3198. });
  3199. Echo.channel('wonotes.' + this.id).listen('WorkOrderNoteAdded', function (e) {
  3200. _this.workOrderNotes.push(e.note);
  3201. }).listen('WorkOrderNoteUpdated', function (e) {
  3202. var index = _this.workOrderNotes.findIndex(function (note) {
  3203. return note.noteid === e.note.noteid;
  3204. }); // Sometimes when switching or deleting items from the end of a list,
  3205. // They go away before the modal can be hidden, this will hide the
  3206. // modal in case the component can't hide it itself. There may be
  3207. // a better way to do this.
  3208. $("#note".concat(e.note.noteid, "switchModal")).modal('hide'); // Note has to be edited this way, or else Vue cannot
  3209. // see it to recompute the computed values.
  3210. _this.workOrderNotes.splice(index, 1, e.note);
  3211. }).listen('WorkOrderNoteDeleted', function (e) {
  3212. var index = _this.workOrderNotes.findIndex(function (note) {
  3213. return note.noteid === e.note['noteid'];
  3214. });
  3215. $("#note".concat(e.note['noteid'], "deleteModal")).modal('hide');
  3216. _this.workOrderNotes.splice(index, 1);
  3217. });
  3218. }
  3219. });
  3220. /***/ }),
  3221. /***/ "./node_modules/base64-js/index.js":
  3222. /*!*****************************************!*\
  3223. !*** ./node_modules/base64-js/index.js ***!
  3224. \*****************************************/
  3225. /*! no static exports found */
  3226. /***/ (function(module, exports, __webpack_require__) {
  3227. "use strict";
  3228. exports.byteLength = byteLength
  3229. exports.toByteArray = toByteArray
  3230. exports.fromByteArray = fromByteArray
  3231. var lookup = []
  3232. var revLookup = []
  3233. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  3234. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  3235. for (var i = 0, len = code.length; i < len; ++i) {
  3236. lookup[i] = code[i]
  3237. revLookup[code.charCodeAt(i)] = i
  3238. }
  3239. // Support decoding URL-safe base64 strings, as Node.js does.
  3240. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  3241. revLookup['-'.charCodeAt(0)] = 62
  3242. revLookup['_'.charCodeAt(0)] = 63
  3243. function getLens (b64) {
  3244. var len = b64.length
  3245. if (len % 4 > 0) {
  3246. throw new Error('Invalid string. Length must be a multiple of 4')
  3247. }
  3248. // Trim off extra bytes after placeholder bytes are found
  3249. // See: https://github.com/beatgammit/base64-js/issues/42
  3250. var validLen = b64.indexOf('=')
  3251. if (validLen === -1) validLen = len
  3252. var placeHoldersLen = validLen === len
  3253. ? 0
  3254. : 4 - (validLen % 4)
  3255. return [validLen, placeHoldersLen]
  3256. }
  3257. // base64 is 4/3 + up to two characters of the original data
  3258. function byteLength (b64) {
  3259. var lens = getLens(b64)
  3260. var validLen = lens[0]
  3261. var placeHoldersLen = lens[1]
  3262. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  3263. }
  3264. function _byteLength (b64, validLen, placeHoldersLen) {
  3265. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  3266. }
  3267. function toByteArray (b64) {
  3268. var tmp
  3269. var lens = getLens(b64)
  3270. var validLen = lens[0]
  3271. var placeHoldersLen = lens[1]
  3272. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  3273. var curByte = 0
  3274. // if there are placeholders, only get up to the last complete 4 chars
  3275. var len = placeHoldersLen > 0
  3276. ? validLen - 4
  3277. : validLen
  3278. var i
  3279. for (i = 0; i < len; i += 4) {
  3280. tmp =
  3281. (revLookup[b64.charCodeAt(i)] << 18) |
  3282. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  3283. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  3284. revLookup[b64.charCodeAt(i + 3)]
  3285. arr[curByte++] = (tmp >> 16) & 0xFF
  3286. arr[curByte++] = (tmp >> 8) & 0xFF
  3287. arr[curByte++] = tmp & 0xFF
  3288. }
  3289. if (placeHoldersLen === 2) {
  3290. tmp =
  3291. (revLookup[b64.charCodeAt(i)] << 2) |
  3292. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  3293. arr[curByte++] = tmp & 0xFF
  3294. }
  3295. if (placeHoldersLen === 1) {
  3296. tmp =
  3297. (revLookup[b64.charCodeAt(i)] << 10) |
  3298. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  3299. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  3300. arr[curByte++] = (tmp >> 8) & 0xFF
  3301. arr[curByte++] = tmp & 0xFF
  3302. }
  3303. return arr
  3304. }
  3305. function tripletToBase64 (num) {
  3306. return lookup[num >> 18 & 0x3F] +
  3307. lookup[num >> 12 & 0x3F] +
  3308. lookup[num >> 6 & 0x3F] +
  3309. lookup[num & 0x3F]
  3310. }
  3311. function encodeChunk (uint8, start, end) {
  3312. var tmp
  3313. var output = []
  3314. for (var i = start; i < end; i += 3) {
  3315. tmp =
  3316. ((uint8[i] << 16) & 0xFF0000) +
  3317. ((uint8[i + 1] << 8) & 0xFF00) +
  3318. (uint8[i + 2] & 0xFF)
  3319. output.push(tripletToBase64(tmp))
  3320. }
  3321. return output.join('')
  3322. }
  3323. function fromByteArray (uint8) {
  3324. var tmp
  3325. var len = uint8.length
  3326. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  3327. var parts = []
  3328. var maxChunkLength = 16383 // must be multiple of 3
  3329. // go through the array every three bytes, we'll deal with trailing stuff later
  3330. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  3331. parts.push(encodeChunk(
  3332. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  3333. ))
  3334. }
  3335. // pad the end with zeros, but make sure to not forget the extra bytes
  3336. if (extraBytes === 1) {
  3337. tmp = uint8[len - 1]
  3338. parts.push(
  3339. lookup[tmp >> 2] +
  3340. lookup[(tmp << 4) & 0x3F] +
  3341. '=='
  3342. )
  3343. } else if (extraBytes === 2) {
  3344. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  3345. parts.push(
  3346. lookup[tmp >> 10] +
  3347. lookup[(tmp >> 4) & 0x3F] +
  3348. lookup[(tmp << 2) & 0x3F] +
  3349. '='
  3350. )
  3351. }
  3352. return parts.join('')
  3353. }
  3354. /***/ }),
  3355. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  3356. /*!*****************************************************!*\
  3357. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  3358. \*****************************************************/
  3359. /*! no static exports found */
  3360. /***/ (function(module, exports, __webpack_require__) {
  3361. /*!
  3362. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  3363. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  3364. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3365. */
  3366. (function (global, factory) {
  3367. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  3368. undefined;
  3369. }(this, (function (exports, $, Popper) { 'use strict';
  3370. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  3371. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  3372. function _defineProperties(target, props) {
  3373. for (var i = 0; i < props.length; i++) {
  3374. var descriptor = props[i];
  3375. descriptor.enumerable = descriptor.enumerable || false;
  3376. descriptor.configurable = true;
  3377. if ("value" in descriptor) descriptor.writable = true;
  3378. Object.defineProperty(target, descriptor.key, descriptor);
  3379. }
  3380. }
  3381. function _createClass(Constructor, protoProps, staticProps) {
  3382. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  3383. if (staticProps) _defineProperties(Constructor, staticProps);
  3384. return Constructor;
  3385. }
  3386. function _defineProperty(obj, key, value) {
  3387. if (key in obj) {
  3388. Object.defineProperty(obj, key, {
  3389. value: value,
  3390. enumerable: true,
  3391. configurable: true,
  3392. writable: true
  3393. });
  3394. } else {
  3395. obj[key] = value;
  3396. }
  3397. return obj;
  3398. }
  3399. function ownKeys(object, enumerableOnly) {
  3400. var keys = Object.keys(object);
  3401. if (Object.getOwnPropertySymbols) {
  3402. var symbols = Object.getOwnPropertySymbols(object);
  3403. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  3404. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  3405. });
  3406. keys.push.apply(keys, symbols);
  3407. }
  3408. return keys;
  3409. }
  3410. function _objectSpread2(target) {
  3411. for (var i = 1; i < arguments.length; i++) {
  3412. var source = arguments[i] != null ? arguments[i] : {};
  3413. if (i % 2) {
  3414. ownKeys(Object(source), true).forEach(function (key) {
  3415. _defineProperty(target, key, source[key]);
  3416. });
  3417. } else if (Object.getOwnPropertyDescriptors) {
  3418. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  3419. } else {
  3420. ownKeys(Object(source)).forEach(function (key) {
  3421. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  3422. });
  3423. }
  3424. }
  3425. return target;
  3426. }
  3427. function _inheritsLoose(subClass, superClass) {
  3428. subClass.prototype = Object.create(superClass.prototype);
  3429. subClass.prototype.constructor = subClass;
  3430. subClass.__proto__ = superClass;
  3431. }
  3432. /**
  3433. * --------------------------------------------------------------------------
  3434. * Bootstrap (v4.4.1): util.js
  3435. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3436. * --------------------------------------------------------------------------
  3437. */
  3438. /**
  3439. * ------------------------------------------------------------------------
  3440. * Private TransitionEnd Helpers
  3441. * ------------------------------------------------------------------------
  3442. */
  3443. var TRANSITION_END = 'transitionend';
  3444. var MAX_UID = 1000000;
  3445. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  3446. function toType(obj) {
  3447. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  3448. }
  3449. function getSpecialTransitionEndEvent() {
  3450. return {
  3451. bindType: TRANSITION_END,
  3452. delegateType: TRANSITION_END,
  3453. handle: function handle(event) {
  3454. if ($(event.target).is(this)) {
  3455. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  3456. }
  3457. return undefined; // eslint-disable-line no-undefined
  3458. }
  3459. };
  3460. }
  3461. function transitionEndEmulator(duration) {
  3462. var _this = this;
  3463. var called = false;
  3464. $(this).one(Util.TRANSITION_END, function () {
  3465. called = true;
  3466. });
  3467. setTimeout(function () {
  3468. if (!called) {
  3469. Util.triggerTransitionEnd(_this);
  3470. }
  3471. }, duration);
  3472. return this;
  3473. }
  3474. function setTransitionEndSupport() {
  3475. $.fn.emulateTransitionEnd = transitionEndEmulator;
  3476. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  3477. }
  3478. /**
  3479. * --------------------------------------------------------------------------
  3480. * Public Util Api
  3481. * --------------------------------------------------------------------------
  3482. */
  3483. var Util = {
  3484. TRANSITION_END: 'bsTransitionEnd',
  3485. getUID: function getUID(prefix) {
  3486. do {
  3487. // eslint-disable-next-line no-bitwise
  3488. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  3489. } while (document.getElementById(prefix));
  3490. return prefix;
  3491. },
  3492. getSelectorFromElement: function getSelectorFromElement(element) {
  3493. var selector = element.getAttribute('data-target');
  3494. if (!selector || selector === '#') {
  3495. var hrefAttr = element.getAttribute('href');
  3496. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  3497. }
  3498. try {
  3499. return document.querySelector(selector) ? selector : null;
  3500. } catch (err) {
  3501. return null;
  3502. }
  3503. },
  3504. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  3505. if (!element) {
  3506. return 0;
  3507. } // Get transition-duration of the element
  3508. var transitionDuration = $(element).css('transition-duration');
  3509. var transitionDelay = $(element).css('transition-delay');
  3510. var floatTransitionDuration = parseFloat(transitionDuration);
  3511. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  3512. if (!floatTransitionDuration && !floatTransitionDelay) {
  3513. return 0;
  3514. } // If multiple durations are defined, take the first
  3515. transitionDuration = transitionDuration.split(',')[0];
  3516. transitionDelay = transitionDelay.split(',')[0];
  3517. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  3518. },
  3519. reflow: function reflow(element) {
  3520. return element.offsetHeight;
  3521. },
  3522. triggerTransitionEnd: function triggerTransitionEnd(element) {
  3523. $(element).trigger(TRANSITION_END);
  3524. },
  3525. // TODO: Remove in v5
  3526. supportsTransitionEnd: function supportsTransitionEnd() {
  3527. return Boolean(TRANSITION_END);
  3528. },
  3529. isElement: function isElement(obj) {
  3530. return (obj[0] || obj).nodeType;
  3531. },
  3532. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  3533. for (var property in configTypes) {
  3534. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  3535. var expectedTypes = configTypes[property];
  3536. var value = config[property];
  3537. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  3538. if (!new RegExp(expectedTypes).test(valueType)) {
  3539. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  3540. }
  3541. }
  3542. }
  3543. },
  3544. findShadowRoot: function findShadowRoot(element) {
  3545. if (!document.documentElement.attachShadow) {
  3546. return null;
  3547. } // Can find the shadow root otherwise it'll return the document
  3548. if (typeof element.getRootNode === 'function') {
  3549. var root = element.getRootNode();
  3550. return root instanceof ShadowRoot ? root : null;
  3551. }
  3552. if (element instanceof ShadowRoot) {
  3553. return element;
  3554. } // when we don't find a shadow root
  3555. if (!element.parentNode) {
  3556. return null;
  3557. }
  3558. return Util.findShadowRoot(element.parentNode);
  3559. },
  3560. jQueryDetection: function jQueryDetection() {
  3561. if (typeof $ === 'undefined') {
  3562. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  3563. }
  3564. var version = $.fn.jquery.split(' ')[0].split('.');
  3565. var minMajor = 1;
  3566. var ltMajor = 2;
  3567. var minMinor = 9;
  3568. var minPatch = 1;
  3569. var maxMajor = 4;
  3570. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  3571. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  3572. }
  3573. }
  3574. };
  3575. Util.jQueryDetection();
  3576. setTransitionEndSupport();
  3577. /**
  3578. * ------------------------------------------------------------------------
  3579. * Constants
  3580. * ------------------------------------------------------------------------
  3581. */
  3582. var NAME = 'alert';
  3583. var VERSION = '4.4.1';
  3584. var DATA_KEY = 'bs.alert';
  3585. var EVENT_KEY = "." + DATA_KEY;
  3586. var DATA_API_KEY = '.data-api';
  3587. var JQUERY_NO_CONFLICT = $.fn[NAME];
  3588. var Selector = {
  3589. DISMISS: '[data-dismiss="alert"]'
  3590. };
  3591. var Event = {
  3592. CLOSE: "close" + EVENT_KEY,
  3593. CLOSED: "closed" + EVENT_KEY,
  3594. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  3595. };
  3596. var ClassName = {
  3597. ALERT: 'alert',
  3598. FADE: 'fade',
  3599. SHOW: 'show'
  3600. };
  3601. /**
  3602. * ------------------------------------------------------------------------
  3603. * Class Definition
  3604. * ------------------------------------------------------------------------
  3605. */
  3606. var Alert =
  3607. /*#__PURE__*/
  3608. function () {
  3609. function Alert(element) {
  3610. this._element = element;
  3611. } // Getters
  3612. var _proto = Alert.prototype;
  3613. // Public
  3614. _proto.close = function close(element) {
  3615. var rootElement = this._element;
  3616. if (element) {
  3617. rootElement = this._getRootElement(element);
  3618. }
  3619. var customEvent = this._triggerCloseEvent(rootElement);
  3620. if (customEvent.isDefaultPrevented()) {
  3621. return;
  3622. }
  3623. this._removeElement(rootElement);
  3624. };
  3625. _proto.dispose = function dispose() {
  3626. $.removeData(this._element, DATA_KEY);
  3627. this._element = null;
  3628. } // Private
  3629. ;
  3630. _proto._getRootElement = function _getRootElement(element) {
  3631. var selector = Util.getSelectorFromElement(element);
  3632. var parent = false;
  3633. if (selector) {
  3634. parent = document.querySelector(selector);
  3635. }
  3636. if (!parent) {
  3637. parent = $(element).closest("." + ClassName.ALERT)[0];
  3638. }
  3639. return parent;
  3640. };
  3641. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  3642. var closeEvent = $.Event(Event.CLOSE);
  3643. $(element).trigger(closeEvent);
  3644. return closeEvent;
  3645. };
  3646. _proto._removeElement = function _removeElement(element) {
  3647. var _this = this;
  3648. $(element).removeClass(ClassName.SHOW);
  3649. if (!$(element).hasClass(ClassName.FADE)) {
  3650. this._destroyElement(element);
  3651. return;
  3652. }
  3653. var transitionDuration = Util.getTransitionDurationFromElement(element);
  3654. $(element).one(Util.TRANSITION_END, function (event) {
  3655. return _this._destroyElement(element, event);
  3656. }).emulateTransitionEnd(transitionDuration);
  3657. };
  3658. _proto._destroyElement = function _destroyElement(element) {
  3659. $(element).detach().trigger(Event.CLOSED).remove();
  3660. } // Static
  3661. ;
  3662. Alert._jQueryInterface = function _jQueryInterface(config) {
  3663. return this.each(function () {
  3664. var $element = $(this);
  3665. var data = $element.data(DATA_KEY);
  3666. if (!data) {
  3667. data = new Alert(this);
  3668. $element.data(DATA_KEY, data);
  3669. }
  3670. if (config === 'close') {
  3671. data[config](this);
  3672. }
  3673. });
  3674. };
  3675. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  3676. return function (event) {
  3677. if (event) {
  3678. event.preventDefault();
  3679. }
  3680. alertInstance.close(this);
  3681. };
  3682. };
  3683. _createClass(Alert, null, [{
  3684. key: "VERSION",
  3685. get: function get() {
  3686. return VERSION;
  3687. }
  3688. }]);
  3689. return Alert;
  3690. }();
  3691. /**
  3692. * ------------------------------------------------------------------------
  3693. * Data Api implementation
  3694. * ------------------------------------------------------------------------
  3695. */
  3696. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  3697. /**
  3698. * ------------------------------------------------------------------------
  3699. * jQuery
  3700. * ------------------------------------------------------------------------
  3701. */
  3702. $.fn[NAME] = Alert._jQueryInterface;
  3703. $.fn[NAME].Constructor = Alert;
  3704. $.fn[NAME].noConflict = function () {
  3705. $.fn[NAME] = JQUERY_NO_CONFLICT;
  3706. return Alert._jQueryInterface;
  3707. };
  3708. /**
  3709. * ------------------------------------------------------------------------
  3710. * Constants
  3711. * ------------------------------------------------------------------------
  3712. */
  3713. var NAME$1 = 'button';
  3714. var VERSION$1 = '4.4.1';
  3715. var DATA_KEY$1 = 'bs.button';
  3716. var EVENT_KEY$1 = "." + DATA_KEY$1;
  3717. var DATA_API_KEY$1 = '.data-api';
  3718. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  3719. var ClassName$1 = {
  3720. ACTIVE: 'active',
  3721. BUTTON: 'btn',
  3722. FOCUS: 'focus'
  3723. };
  3724. var Selector$1 = {
  3725. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  3726. DATA_TOGGLES: '[data-toggle="buttons"]',
  3727. DATA_TOGGLE: '[data-toggle="button"]',
  3728. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  3729. INPUT: 'input:not([type="hidden"])',
  3730. ACTIVE: '.active',
  3731. BUTTON: '.btn'
  3732. };
  3733. var Event$1 = {
  3734. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  3735. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  3736. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  3737. };
  3738. /**
  3739. * ------------------------------------------------------------------------
  3740. * Class Definition
  3741. * ------------------------------------------------------------------------
  3742. */
  3743. var Button =
  3744. /*#__PURE__*/
  3745. function () {
  3746. function Button(element) {
  3747. this._element = element;
  3748. } // Getters
  3749. var _proto = Button.prototype;
  3750. // Public
  3751. _proto.toggle = function toggle() {
  3752. var triggerChangeEvent = true;
  3753. var addAriaPressed = true;
  3754. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  3755. if (rootElement) {
  3756. var input = this._element.querySelector(Selector$1.INPUT);
  3757. if (input) {
  3758. if (input.type === 'radio') {
  3759. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  3760. triggerChangeEvent = false;
  3761. } else {
  3762. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  3763. if (activeElement) {
  3764. $(activeElement).removeClass(ClassName$1.ACTIVE);
  3765. }
  3766. }
  3767. } else if (input.type === 'checkbox') {
  3768. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  3769. triggerChangeEvent = false;
  3770. }
  3771. } else {
  3772. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  3773. triggerChangeEvent = false;
  3774. }
  3775. if (triggerChangeEvent) {
  3776. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  3777. $(input).trigger('change');
  3778. }
  3779. input.focus();
  3780. addAriaPressed = false;
  3781. }
  3782. }
  3783. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  3784. if (addAriaPressed) {
  3785. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  3786. }
  3787. if (triggerChangeEvent) {
  3788. $(this._element).toggleClass(ClassName$1.ACTIVE);
  3789. }
  3790. }
  3791. };
  3792. _proto.dispose = function dispose() {
  3793. $.removeData(this._element, DATA_KEY$1);
  3794. this._element = null;
  3795. } // Static
  3796. ;
  3797. Button._jQueryInterface = function _jQueryInterface(config) {
  3798. return this.each(function () {
  3799. var data = $(this).data(DATA_KEY$1);
  3800. if (!data) {
  3801. data = new Button(this);
  3802. $(this).data(DATA_KEY$1, data);
  3803. }
  3804. if (config === 'toggle') {
  3805. data[config]();
  3806. }
  3807. });
  3808. };
  3809. _createClass(Button, null, [{
  3810. key: "VERSION",
  3811. get: function get() {
  3812. return VERSION$1;
  3813. }
  3814. }]);
  3815. return Button;
  3816. }();
  3817. /**
  3818. * ------------------------------------------------------------------------
  3819. * Data Api implementation
  3820. * ------------------------------------------------------------------------
  3821. */
  3822. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3823. var button = event.target;
  3824. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  3825. button = $(button).closest(Selector$1.BUTTON)[0];
  3826. }
  3827. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3828. event.preventDefault(); // work around Firefox bug #1540995
  3829. } else {
  3830. var inputBtn = button.querySelector(Selector$1.INPUT);
  3831. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3832. event.preventDefault(); // work around Firefox bug #1540995
  3833. return;
  3834. }
  3835. Button._jQueryInterface.call($(button), 'toggle');
  3836. }
  3837. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3838. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3839. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3840. });
  3841. $(window).on(Event$1.LOAD_DATA_API, function () {
  3842. // ensure correct active class is set to match the controls' actual values/states
  3843. // find all checkboxes/readio buttons inside data-toggle groups
  3844. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3845. for (var i = 0, len = buttons.length; i < len; i++) {
  3846. var button = buttons[i];
  3847. var input = button.querySelector(Selector$1.INPUT);
  3848. if (input.checked || input.hasAttribute('checked')) {
  3849. button.classList.add(ClassName$1.ACTIVE);
  3850. } else {
  3851. button.classList.remove(ClassName$1.ACTIVE);
  3852. }
  3853. } // find all button toggles
  3854. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3855. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3856. var _button = buttons[_i];
  3857. if (_button.getAttribute('aria-pressed') === 'true') {
  3858. _button.classList.add(ClassName$1.ACTIVE);
  3859. } else {
  3860. _button.classList.remove(ClassName$1.ACTIVE);
  3861. }
  3862. }
  3863. });
  3864. /**
  3865. * ------------------------------------------------------------------------
  3866. * jQuery
  3867. * ------------------------------------------------------------------------
  3868. */
  3869. $.fn[NAME$1] = Button._jQueryInterface;
  3870. $.fn[NAME$1].Constructor = Button;
  3871. $.fn[NAME$1].noConflict = function () {
  3872. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3873. return Button._jQueryInterface;
  3874. };
  3875. /**
  3876. * ------------------------------------------------------------------------
  3877. * Constants
  3878. * ------------------------------------------------------------------------
  3879. */
  3880. var NAME$2 = 'carousel';
  3881. var VERSION$2 = '4.4.1';
  3882. var DATA_KEY$2 = 'bs.carousel';
  3883. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3884. var DATA_API_KEY$2 = '.data-api';
  3885. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3886. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3887. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3888. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3889. var SWIPE_THRESHOLD = 40;
  3890. var Default = {
  3891. interval: 5000,
  3892. keyboard: true,
  3893. slide: false,
  3894. pause: 'hover',
  3895. wrap: true,
  3896. touch: true
  3897. };
  3898. var DefaultType = {
  3899. interval: '(number|boolean)',
  3900. keyboard: 'boolean',
  3901. slide: '(boolean|string)',
  3902. pause: '(string|boolean)',
  3903. wrap: 'boolean',
  3904. touch: 'boolean'
  3905. };
  3906. var Direction = {
  3907. NEXT: 'next',
  3908. PREV: 'prev',
  3909. LEFT: 'left',
  3910. RIGHT: 'right'
  3911. };
  3912. var Event$2 = {
  3913. SLIDE: "slide" + EVENT_KEY$2,
  3914. SLID: "slid" + EVENT_KEY$2,
  3915. KEYDOWN: "keydown" + EVENT_KEY$2,
  3916. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3917. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3918. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3919. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3920. TOUCHEND: "touchend" + EVENT_KEY$2,
  3921. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3922. POINTERUP: "pointerup" + EVENT_KEY$2,
  3923. DRAG_START: "dragstart" + EVENT_KEY$2,
  3924. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3925. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3926. };
  3927. var ClassName$2 = {
  3928. CAROUSEL: 'carousel',
  3929. ACTIVE: 'active',
  3930. SLIDE: 'slide',
  3931. RIGHT: 'carousel-item-right',
  3932. LEFT: 'carousel-item-left',
  3933. NEXT: 'carousel-item-next',
  3934. PREV: 'carousel-item-prev',
  3935. ITEM: 'carousel-item',
  3936. POINTER_EVENT: 'pointer-event'
  3937. };
  3938. var Selector$2 = {
  3939. ACTIVE: '.active',
  3940. ACTIVE_ITEM: '.active.carousel-item',
  3941. ITEM: '.carousel-item',
  3942. ITEM_IMG: '.carousel-item img',
  3943. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3944. INDICATORS: '.carousel-indicators',
  3945. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3946. DATA_RIDE: '[data-ride="carousel"]'
  3947. };
  3948. var PointerType = {
  3949. TOUCH: 'touch',
  3950. PEN: 'pen'
  3951. };
  3952. /**
  3953. * ------------------------------------------------------------------------
  3954. * Class Definition
  3955. * ------------------------------------------------------------------------
  3956. */
  3957. var Carousel =
  3958. /*#__PURE__*/
  3959. function () {
  3960. function Carousel(element, config) {
  3961. this._items = null;
  3962. this._interval = null;
  3963. this._activeElement = null;
  3964. this._isPaused = false;
  3965. this._isSliding = false;
  3966. this.touchTimeout = null;
  3967. this.touchStartX = 0;
  3968. this.touchDeltaX = 0;
  3969. this._config = this._getConfig(config);
  3970. this._element = element;
  3971. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3972. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3973. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3974. this._addEventListeners();
  3975. } // Getters
  3976. var _proto = Carousel.prototype;
  3977. // Public
  3978. _proto.next = function next() {
  3979. if (!this._isSliding) {
  3980. this._slide(Direction.NEXT);
  3981. }
  3982. };
  3983. _proto.nextWhenVisible = function nextWhenVisible() {
  3984. // Don't call next when the page isn't visible
  3985. // or the carousel or its parent isn't visible
  3986. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3987. this.next();
  3988. }
  3989. };
  3990. _proto.prev = function prev() {
  3991. if (!this._isSliding) {
  3992. this._slide(Direction.PREV);
  3993. }
  3994. };
  3995. _proto.pause = function pause(event) {
  3996. if (!event) {
  3997. this._isPaused = true;
  3998. }
  3999. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  4000. Util.triggerTransitionEnd(this._element);
  4001. this.cycle(true);
  4002. }
  4003. clearInterval(this._interval);
  4004. this._interval = null;
  4005. };
  4006. _proto.cycle = function cycle(event) {
  4007. if (!event) {
  4008. this._isPaused = false;
  4009. }
  4010. if (this._interval) {
  4011. clearInterval(this._interval);
  4012. this._interval = null;
  4013. }
  4014. if (this._config.interval && !this._isPaused) {
  4015. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  4016. }
  4017. };
  4018. _proto.to = function to(index) {
  4019. var _this = this;
  4020. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  4021. var activeIndex = this._getItemIndex(this._activeElement);
  4022. if (index > this._items.length - 1 || index < 0) {
  4023. return;
  4024. }
  4025. if (this._isSliding) {
  4026. $(this._element).one(Event$2.SLID, function () {
  4027. return _this.to(index);
  4028. });
  4029. return;
  4030. }
  4031. if (activeIndex === index) {
  4032. this.pause();
  4033. this.cycle();
  4034. return;
  4035. }
  4036. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  4037. this._slide(direction, this._items[index]);
  4038. };
  4039. _proto.dispose = function dispose() {
  4040. $(this._element).off(EVENT_KEY$2);
  4041. $.removeData(this._element, DATA_KEY$2);
  4042. this._items = null;
  4043. this._config = null;
  4044. this._element = null;
  4045. this._interval = null;
  4046. this._isPaused = null;
  4047. this._isSliding = null;
  4048. this._activeElement = null;
  4049. this._indicatorsElement = null;
  4050. } // Private
  4051. ;
  4052. _proto._getConfig = function _getConfig(config) {
  4053. config = _objectSpread2({}, Default, {}, config);
  4054. Util.typeCheckConfig(NAME$2, config, DefaultType);
  4055. return config;
  4056. };
  4057. _proto._handleSwipe = function _handleSwipe() {
  4058. var absDeltax = Math.abs(this.touchDeltaX);
  4059. if (absDeltax <= SWIPE_THRESHOLD) {
  4060. return;
  4061. }
  4062. var direction = absDeltax / this.touchDeltaX;
  4063. this.touchDeltaX = 0; // swipe left
  4064. if (direction > 0) {
  4065. this.prev();
  4066. } // swipe right
  4067. if (direction < 0) {
  4068. this.next();
  4069. }
  4070. };
  4071. _proto._addEventListeners = function _addEventListeners() {
  4072. var _this2 = this;
  4073. if (this._config.keyboard) {
  4074. $(this._element).on(Event$2.KEYDOWN, function (event) {
  4075. return _this2._keydown(event);
  4076. });
  4077. }
  4078. if (this._config.pause === 'hover') {
  4079. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  4080. return _this2.pause(event);
  4081. }).on(Event$2.MOUSELEAVE, function (event) {
  4082. return _this2.cycle(event);
  4083. });
  4084. }
  4085. if (this._config.touch) {
  4086. this._addTouchEventListeners();
  4087. }
  4088. };
  4089. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  4090. var _this3 = this;
  4091. if (!this._touchSupported) {
  4092. return;
  4093. }
  4094. var start = function start(event) {
  4095. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  4096. _this3.touchStartX = event.originalEvent.clientX;
  4097. } else if (!_this3._pointerEvent) {
  4098. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  4099. }
  4100. };
  4101. var move = function move(event) {
  4102. // ensure swiping with one touch and not pinching
  4103. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  4104. _this3.touchDeltaX = 0;
  4105. } else {
  4106. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  4107. }
  4108. };
  4109. var end = function end(event) {
  4110. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  4111. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  4112. }
  4113. _this3._handleSwipe();
  4114. if (_this3._config.pause === 'hover') {
  4115. // If it's a touch-enabled device, mouseenter/leave are fired as
  4116. // part of the mouse compatibility events on first tap - the carousel
  4117. // would stop cycling until user tapped out of it;
  4118. // here, we listen for touchend, explicitly pause the carousel
  4119. // (as if it's the second time we tap on it, mouseenter compat event
  4120. // is NOT fired) and after a timeout (to allow for mouse compatibility
  4121. // events to fire) we explicitly restart cycling
  4122. _this3.pause();
  4123. if (_this3.touchTimeout) {
  4124. clearTimeout(_this3.touchTimeout);
  4125. }
  4126. _this3.touchTimeout = setTimeout(function (event) {
  4127. return _this3.cycle(event);
  4128. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  4129. }
  4130. };
  4131. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  4132. return e.preventDefault();
  4133. });
  4134. if (this._pointerEvent) {
  4135. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  4136. return start(event);
  4137. });
  4138. $(this._element).on(Event$2.POINTERUP, function (event) {
  4139. return end(event);
  4140. });
  4141. this._element.classList.add(ClassName$2.POINTER_EVENT);
  4142. } else {
  4143. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  4144. return start(event);
  4145. });
  4146. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  4147. return move(event);
  4148. });
  4149. $(this._element).on(Event$2.TOUCHEND, function (event) {
  4150. return end(event);
  4151. });
  4152. }
  4153. };
  4154. _proto._keydown = function _keydown(event) {
  4155. if (/input|textarea/i.test(event.target.tagName)) {
  4156. return;
  4157. }
  4158. switch (event.which) {
  4159. case ARROW_LEFT_KEYCODE:
  4160. event.preventDefault();
  4161. this.prev();
  4162. break;
  4163. case ARROW_RIGHT_KEYCODE:
  4164. event.preventDefault();
  4165. this.next();
  4166. break;
  4167. }
  4168. };
  4169. _proto._getItemIndex = function _getItemIndex(element) {
  4170. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  4171. return this._items.indexOf(element);
  4172. };
  4173. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  4174. var isNextDirection = direction === Direction.NEXT;
  4175. var isPrevDirection = direction === Direction.PREV;
  4176. var activeIndex = this._getItemIndex(activeElement);
  4177. var lastItemIndex = this._items.length - 1;
  4178. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  4179. if (isGoingToWrap && !this._config.wrap) {
  4180. return activeElement;
  4181. }
  4182. var delta = direction === Direction.PREV ? -1 : 1;
  4183. var itemIndex = (activeIndex + delta) % this._items.length;
  4184. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  4185. };
  4186. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  4187. var targetIndex = this._getItemIndex(relatedTarget);
  4188. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  4189. var slideEvent = $.Event(Event$2.SLIDE, {
  4190. relatedTarget: relatedTarget,
  4191. direction: eventDirectionName,
  4192. from: fromIndex,
  4193. to: targetIndex
  4194. });
  4195. $(this._element).trigger(slideEvent);
  4196. return slideEvent;
  4197. };
  4198. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  4199. if (this._indicatorsElement) {
  4200. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  4201. $(indicators).removeClass(ClassName$2.ACTIVE);
  4202. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  4203. if (nextIndicator) {
  4204. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  4205. }
  4206. }
  4207. };
  4208. _proto._slide = function _slide(direction, element) {
  4209. var _this4 = this;
  4210. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  4211. var activeElementIndex = this._getItemIndex(activeElement);
  4212. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  4213. var nextElementIndex = this._getItemIndex(nextElement);
  4214. var isCycling = Boolean(this._interval);
  4215. var directionalClassName;
  4216. var orderClassName;
  4217. var eventDirectionName;
  4218. if (direction === Direction.NEXT) {
  4219. directionalClassName = ClassName$2.LEFT;
  4220. orderClassName = ClassName$2.NEXT;
  4221. eventDirectionName = Direction.LEFT;
  4222. } else {
  4223. directionalClassName = ClassName$2.RIGHT;
  4224. orderClassName = ClassName$2.PREV;
  4225. eventDirectionName = Direction.RIGHT;
  4226. }
  4227. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  4228. this._isSliding = false;
  4229. return;
  4230. }
  4231. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  4232. if (slideEvent.isDefaultPrevented()) {
  4233. return;
  4234. }
  4235. if (!activeElement || !nextElement) {
  4236. // Some weirdness is happening, so we bail
  4237. return;
  4238. }
  4239. this._isSliding = true;
  4240. if (isCycling) {
  4241. this.pause();
  4242. }
  4243. this._setActiveIndicatorElement(nextElement);
  4244. var slidEvent = $.Event(Event$2.SLID, {
  4245. relatedTarget: nextElement,
  4246. direction: eventDirectionName,
  4247. from: activeElementIndex,
  4248. to: nextElementIndex
  4249. });
  4250. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  4251. $(nextElement).addClass(orderClassName);
  4252. Util.reflow(nextElement);
  4253. $(activeElement).addClass(directionalClassName);
  4254. $(nextElement).addClass(directionalClassName);
  4255. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  4256. if (nextElementInterval) {
  4257. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  4258. this._config.interval = nextElementInterval;
  4259. } else {
  4260. this._config.interval = this._config.defaultInterval || this._config.interval;
  4261. }
  4262. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  4263. $(activeElement).one(Util.TRANSITION_END, function () {
  4264. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  4265. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  4266. _this4._isSliding = false;
  4267. setTimeout(function () {
  4268. return $(_this4._element).trigger(slidEvent);
  4269. }, 0);
  4270. }).emulateTransitionEnd(transitionDuration);
  4271. } else {
  4272. $(activeElement).removeClass(ClassName$2.ACTIVE);
  4273. $(nextElement).addClass(ClassName$2.ACTIVE);
  4274. this._isSliding = false;
  4275. $(this._element).trigger(slidEvent);
  4276. }
  4277. if (isCycling) {
  4278. this.cycle();
  4279. }
  4280. } // Static
  4281. ;
  4282. Carousel._jQueryInterface = function _jQueryInterface(config) {
  4283. return this.each(function () {
  4284. var data = $(this).data(DATA_KEY$2);
  4285. var _config = _objectSpread2({}, Default, {}, $(this).data());
  4286. if (typeof config === 'object') {
  4287. _config = _objectSpread2({}, _config, {}, config);
  4288. }
  4289. var action = typeof config === 'string' ? config : _config.slide;
  4290. if (!data) {
  4291. data = new Carousel(this, _config);
  4292. $(this).data(DATA_KEY$2, data);
  4293. }
  4294. if (typeof config === 'number') {
  4295. data.to(config);
  4296. } else if (typeof action === 'string') {
  4297. if (typeof data[action] === 'undefined') {
  4298. throw new TypeError("No method named \"" + action + "\"");
  4299. }
  4300. data[action]();
  4301. } else if (_config.interval && _config.ride) {
  4302. data.pause();
  4303. data.cycle();
  4304. }
  4305. });
  4306. };
  4307. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  4308. var selector = Util.getSelectorFromElement(this);
  4309. if (!selector) {
  4310. return;
  4311. }
  4312. var target = $(selector)[0];
  4313. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  4314. return;
  4315. }
  4316. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  4317. var slideIndex = this.getAttribute('data-slide-to');
  4318. if (slideIndex) {
  4319. config.interval = false;
  4320. }
  4321. Carousel._jQueryInterface.call($(target), config);
  4322. if (slideIndex) {
  4323. $(target).data(DATA_KEY$2).to(slideIndex);
  4324. }
  4325. event.preventDefault();
  4326. };
  4327. _createClass(Carousel, null, [{
  4328. key: "VERSION",
  4329. get: function get() {
  4330. return VERSION$2;
  4331. }
  4332. }, {
  4333. key: "Default",
  4334. get: function get() {
  4335. return Default;
  4336. }
  4337. }]);
  4338. return Carousel;
  4339. }();
  4340. /**
  4341. * ------------------------------------------------------------------------
  4342. * Data Api implementation
  4343. * ------------------------------------------------------------------------
  4344. */
  4345. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  4346. $(window).on(Event$2.LOAD_DATA_API, function () {
  4347. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  4348. for (var i = 0, len = carousels.length; i < len; i++) {
  4349. var $carousel = $(carousels[i]);
  4350. Carousel._jQueryInterface.call($carousel, $carousel.data());
  4351. }
  4352. });
  4353. /**
  4354. * ------------------------------------------------------------------------
  4355. * jQuery
  4356. * ------------------------------------------------------------------------
  4357. */
  4358. $.fn[NAME$2] = Carousel._jQueryInterface;
  4359. $.fn[NAME$2].Constructor = Carousel;
  4360. $.fn[NAME$2].noConflict = function () {
  4361. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  4362. return Carousel._jQueryInterface;
  4363. };
  4364. /**
  4365. * ------------------------------------------------------------------------
  4366. * Constants
  4367. * ------------------------------------------------------------------------
  4368. */
  4369. var NAME$3 = 'collapse';
  4370. var VERSION$3 = '4.4.1';
  4371. var DATA_KEY$3 = 'bs.collapse';
  4372. var EVENT_KEY$3 = "." + DATA_KEY$3;
  4373. var DATA_API_KEY$3 = '.data-api';
  4374. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  4375. var Default$1 = {
  4376. toggle: true,
  4377. parent: ''
  4378. };
  4379. var DefaultType$1 = {
  4380. toggle: 'boolean',
  4381. parent: '(string|element)'
  4382. };
  4383. var Event$3 = {
  4384. SHOW: "show" + EVENT_KEY$3,
  4385. SHOWN: "shown" + EVENT_KEY$3,
  4386. HIDE: "hide" + EVENT_KEY$3,
  4387. HIDDEN: "hidden" + EVENT_KEY$3,
  4388. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  4389. };
  4390. var ClassName$3 = {
  4391. SHOW: 'show',
  4392. COLLAPSE: 'collapse',
  4393. COLLAPSING: 'collapsing',
  4394. COLLAPSED: 'collapsed'
  4395. };
  4396. var Dimension = {
  4397. WIDTH: 'width',
  4398. HEIGHT: 'height'
  4399. };
  4400. var Selector$3 = {
  4401. ACTIVES: '.show, .collapsing',
  4402. DATA_TOGGLE: '[data-toggle="collapse"]'
  4403. };
  4404. /**
  4405. * ------------------------------------------------------------------------
  4406. * Class Definition
  4407. * ------------------------------------------------------------------------
  4408. */
  4409. var Collapse =
  4410. /*#__PURE__*/
  4411. function () {
  4412. function Collapse(element, config) {
  4413. this._isTransitioning = false;
  4414. this._element = element;
  4415. this._config = this._getConfig(config);
  4416. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  4417. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  4418. for (var i = 0, len = toggleList.length; i < len; i++) {
  4419. var elem = toggleList[i];
  4420. var selector = Util.getSelectorFromElement(elem);
  4421. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  4422. return foundElem === element;
  4423. });
  4424. if (selector !== null && filterElement.length > 0) {
  4425. this._selector = selector;
  4426. this._triggerArray.push(elem);
  4427. }
  4428. }
  4429. this._parent = this._config.parent ? this._getParent() : null;
  4430. if (!this._config.parent) {
  4431. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  4432. }
  4433. if (this._config.toggle) {
  4434. this.toggle();
  4435. }
  4436. } // Getters
  4437. var _proto = Collapse.prototype;
  4438. // Public
  4439. _proto.toggle = function toggle() {
  4440. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  4441. this.hide();
  4442. } else {
  4443. this.show();
  4444. }
  4445. };
  4446. _proto.show = function show() {
  4447. var _this = this;
  4448. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  4449. return;
  4450. }
  4451. var actives;
  4452. var activesData;
  4453. if (this._parent) {
  4454. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  4455. if (typeof _this._config.parent === 'string') {
  4456. return elem.getAttribute('data-parent') === _this._config.parent;
  4457. }
  4458. return elem.classList.contains(ClassName$3.COLLAPSE);
  4459. });
  4460. if (actives.length === 0) {
  4461. actives = null;
  4462. }
  4463. }
  4464. if (actives) {
  4465. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  4466. if (activesData && activesData._isTransitioning) {
  4467. return;
  4468. }
  4469. }
  4470. var startEvent = $.Event(Event$3.SHOW);
  4471. $(this._element).trigger(startEvent);
  4472. if (startEvent.isDefaultPrevented()) {
  4473. return;
  4474. }
  4475. if (actives) {
  4476. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  4477. if (!activesData) {
  4478. $(actives).data(DATA_KEY$3, null);
  4479. }
  4480. }
  4481. var dimension = this._getDimension();
  4482. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  4483. this._element.style[dimension] = 0;
  4484. if (this._triggerArray.length) {
  4485. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  4486. }
  4487. this.setTransitioning(true);
  4488. var complete = function complete() {
  4489. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  4490. _this._element.style[dimension] = '';
  4491. _this.setTransitioning(false);
  4492. $(_this._element).trigger(Event$3.SHOWN);
  4493. };
  4494. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  4495. var scrollSize = "scroll" + capitalizedDimension;
  4496. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4497. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4498. this._element.style[dimension] = this._element[scrollSize] + "px";
  4499. };
  4500. _proto.hide = function hide() {
  4501. var _this2 = this;
  4502. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  4503. return;
  4504. }
  4505. var startEvent = $.Event(Event$3.HIDE);
  4506. $(this._element).trigger(startEvent);
  4507. if (startEvent.isDefaultPrevented()) {
  4508. return;
  4509. }
  4510. var dimension = this._getDimension();
  4511. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  4512. Util.reflow(this._element);
  4513. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  4514. var triggerArrayLength = this._triggerArray.length;
  4515. if (triggerArrayLength > 0) {
  4516. for (var i = 0; i < triggerArrayLength; i++) {
  4517. var trigger = this._triggerArray[i];
  4518. var selector = Util.getSelectorFromElement(trigger);
  4519. if (selector !== null) {
  4520. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  4521. if (!$elem.hasClass(ClassName$3.SHOW)) {
  4522. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  4523. }
  4524. }
  4525. }
  4526. }
  4527. this.setTransitioning(true);
  4528. var complete = function complete() {
  4529. _this2.setTransitioning(false);
  4530. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  4531. };
  4532. this._element.style[dimension] = '';
  4533. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4534. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4535. };
  4536. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  4537. this._isTransitioning = isTransitioning;
  4538. };
  4539. _proto.dispose = function dispose() {
  4540. $.removeData(this._element, DATA_KEY$3);
  4541. this._config = null;
  4542. this._parent = null;
  4543. this._element = null;
  4544. this._triggerArray = null;
  4545. this._isTransitioning = null;
  4546. } // Private
  4547. ;
  4548. _proto._getConfig = function _getConfig(config) {
  4549. config = _objectSpread2({}, Default$1, {}, config);
  4550. config.toggle = Boolean(config.toggle); // Coerce string values
  4551. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  4552. return config;
  4553. };
  4554. _proto._getDimension = function _getDimension() {
  4555. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  4556. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  4557. };
  4558. _proto._getParent = function _getParent() {
  4559. var _this3 = this;
  4560. var parent;
  4561. if (Util.isElement(this._config.parent)) {
  4562. parent = this._config.parent; // It's a jQuery object
  4563. if (typeof this._config.parent.jquery !== 'undefined') {
  4564. parent = this._config.parent[0];
  4565. }
  4566. } else {
  4567. parent = document.querySelector(this._config.parent);
  4568. }
  4569. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  4570. var children = [].slice.call(parent.querySelectorAll(selector));
  4571. $(children).each(function (i, element) {
  4572. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  4573. });
  4574. return parent;
  4575. };
  4576. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  4577. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  4578. if (triggerArray.length) {
  4579. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  4580. }
  4581. } // Static
  4582. ;
  4583. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  4584. var selector = Util.getSelectorFromElement(element);
  4585. return selector ? document.querySelector(selector) : null;
  4586. };
  4587. Collapse._jQueryInterface = function _jQueryInterface(config) {
  4588. return this.each(function () {
  4589. var $this = $(this);
  4590. var data = $this.data(DATA_KEY$3);
  4591. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  4592. if (!data && _config.toggle && /show|hide/.test(config)) {
  4593. _config.toggle = false;
  4594. }
  4595. if (!data) {
  4596. data = new Collapse(this, _config);
  4597. $this.data(DATA_KEY$3, data);
  4598. }
  4599. if (typeof config === 'string') {
  4600. if (typeof data[config] === 'undefined') {
  4601. throw new TypeError("No method named \"" + config + "\"");
  4602. }
  4603. data[config]();
  4604. }
  4605. });
  4606. };
  4607. _createClass(Collapse, null, [{
  4608. key: "VERSION",
  4609. get: function get() {
  4610. return VERSION$3;
  4611. }
  4612. }, {
  4613. key: "Default",
  4614. get: function get() {
  4615. return Default$1;
  4616. }
  4617. }]);
  4618. return Collapse;
  4619. }();
  4620. /**
  4621. * ------------------------------------------------------------------------
  4622. * Data Api implementation
  4623. * ------------------------------------------------------------------------
  4624. */
  4625. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  4626. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  4627. if (event.currentTarget.tagName === 'A') {
  4628. event.preventDefault();
  4629. }
  4630. var $trigger = $(this);
  4631. var selector = Util.getSelectorFromElement(this);
  4632. var selectors = [].slice.call(document.querySelectorAll(selector));
  4633. $(selectors).each(function () {
  4634. var $target = $(this);
  4635. var data = $target.data(DATA_KEY$3);
  4636. var config = data ? 'toggle' : $trigger.data();
  4637. Collapse._jQueryInterface.call($target, config);
  4638. });
  4639. });
  4640. /**
  4641. * ------------------------------------------------------------------------
  4642. * jQuery
  4643. * ------------------------------------------------------------------------
  4644. */
  4645. $.fn[NAME$3] = Collapse._jQueryInterface;
  4646. $.fn[NAME$3].Constructor = Collapse;
  4647. $.fn[NAME$3].noConflict = function () {
  4648. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  4649. return Collapse._jQueryInterface;
  4650. };
  4651. /**
  4652. * ------------------------------------------------------------------------
  4653. * Constants
  4654. * ------------------------------------------------------------------------
  4655. */
  4656. var NAME$4 = 'dropdown';
  4657. var VERSION$4 = '4.4.1';
  4658. var DATA_KEY$4 = 'bs.dropdown';
  4659. var EVENT_KEY$4 = "." + DATA_KEY$4;
  4660. var DATA_API_KEY$4 = '.data-api';
  4661. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  4662. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  4663. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  4664. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  4665. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  4666. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  4667. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  4668. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  4669. var Event$4 = {
  4670. HIDE: "hide" + EVENT_KEY$4,
  4671. HIDDEN: "hidden" + EVENT_KEY$4,
  4672. SHOW: "show" + EVENT_KEY$4,
  4673. SHOWN: "shown" + EVENT_KEY$4,
  4674. CLICK: "click" + EVENT_KEY$4,
  4675. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  4676. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  4677. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  4678. };
  4679. var ClassName$4 = {
  4680. DISABLED: 'disabled',
  4681. SHOW: 'show',
  4682. DROPUP: 'dropup',
  4683. DROPRIGHT: 'dropright',
  4684. DROPLEFT: 'dropleft',
  4685. MENURIGHT: 'dropdown-menu-right',
  4686. MENULEFT: 'dropdown-menu-left',
  4687. POSITION_STATIC: 'position-static'
  4688. };
  4689. var Selector$4 = {
  4690. DATA_TOGGLE: '[data-toggle="dropdown"]',
  4691. FORM_CHILD: '.dropdown form',
  4692. MENU: '.dropdown-menu',
  4693. NAVBAR_NAV: '.navbar-nav',
  4694. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  4695. };
  4696. var AttachmentMap = {
  4697. TOP: 'top-start',
  4698. TOPEND: 'top-end',
  4699. BOTTOM: 'bottom-start',
  4700. BOTTOMEND: 'bottom-end',
  4701. RIGHT: 'right-start',
  4702. RIGHTEND: 'right-end',
  4703. LEFT: 'left-start',
  4704. LEFTEND: 'left-end'
  4705. };
  4706. var Default$2 = {
  4707. offset: 0,
  4708. flip: true,
  4709. boundary: 'scrollParent',
  4710. reference: 'toggle',
  4711. display: 'dynamic',
  4712. popperConfig: null
  4713. };
  4714. var DefaultType$2 = {
  4715. offset: '(number|string|function)',
  4716. flip: 'boolean',
  4717. boundary: '(string|element)',
  4718. reference: '(string|element)',
  4719. display: 'string',
  4720. popperConfig: '(null|object)'
  4721. };
  4722. /**
  4723. * ------------------------------------------------------------------------
  4724. * Class Definition
  4725. * ------------------------------------------------------------------------
  4726. */
  4727. var Dropdown =
  4728. /*#__PURE__*/
  4729. function () {
  4730. function Dropdown(element, config) {
  4731. this._element = element;
  4732. this._popper = null;
  4733. this._config = this._getConfig(config);
  4734. this._menu = this._getMenuElement();
  4735. this._inNavbar = this._detectNavbar();
  4736. this._addEventListeners();
  4737. } // Getters
  4738. var _proto = Dropdown.prototype;
  4739. // Public
  4740. _proto.toggle = function toggle() {
  4741. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  4742. return;
  4743. }
  4744. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  4745. Dropdown._clearMenus();
  4746. if (isActive) {
  4747. return;
  4748. }
  4749. this.show(true);
  4750. };
  4751. _proto.show = function show(usePopper) {
  4752. if (usePopper === void 0) {
  4753. usePopper = false;
  4754. }
  4755. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  4756. return;
  4757. }
  4758. var relatedTarget = {
  4759. relatedTarget: this._element
  4760. };
  4761. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  4762. var parent = Dropdown._getParentFromElement(this._element);
  4763. $(parent).trigger(showEvent);
  4764. if (showEvent.isDefaultPrevented()) {
  4765. return;
  4766. } // Disable totally Popper.js for Dropdown in Navbar
  4767. if (!this._inNavbar && usePopper) {
  4768. /**
  4769. * Check for Popper dependency
  4770. * Popper - https://popper.js.org
  4771. */
  4772. if (typeof Popper === 'undefined') {
  4773. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  4774. }
  4775. var referenceElement = this._element;
  4776. if (this._config.reference === 'parent') {
  4777. referenceElement = parent;
  4778. } else if (Util.isElement(this._config.reference)) {
  4779. referenceElement = this._config.reference; // Check if it's jQuery element
  4780. if (typeof this._config.reference.jquery !== 'undefined') {
  4781. referenceElement = this._config.reference[0];
  4782. }
  4783. } // If boundary is not `scrollParent`, then set position to `static`
  4784. // to allow the menu to "escape" the scroll parent's boundaries
  4785. // https://github.com/twbs/bootstrap/issues/24251
  4786. if (this._config.boundary !== 'scrollParent') {
  4787. $(parent).addClass(ClassName$4.POSITION_STATIC);
  4788. }
  4789. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  4790. } // If this is a touch-enabled device we add extra
  4791. // empty mouseover listeners to the body's immediate children;
  4792. // only needed because of broken event delegation on iOS
  4793. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4794. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  4795. $(document.body).children().on('mouseover', null, $.noop);
  4796. }
  4797. this._element.focus();
  4798. this._element.setAttribute('aria-expanded', true);
  4799. $(this._menu).toggleClass(ClassName$4.SHOW);
  4800. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  4801. };
  4802. _proto.hide = function hide() {
  4803. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  4804. return;
  4805. }
  4806. var relatedTarget = {
  4807. relatedTarget: this._element
  4808. };
  4809. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4810. var parent = Dropdown._getParentFromElement(this._element);
  4811. $(parent).trigger(hideEvent);
  4812. if (hideEvent.isDefaultPrevented()) {
  4813. return;
  4814. }
  4815. if (this._popper) {
  4816. this._popper.destroy();
  4817. }
  4818. $(this._menu).toggleClass(ClassName$4.SHOW);
  4819. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4820. };
  4821. _proto.dispose = function dispose() {
  4822. $.removeData(this._element, DATA_KEY$4);
  4823. $(this._element).off(EVENT_KEY$4);
  4824. this._element = null;
  4825. this._menu = null;
  4826. if (this._popper !== null) {
  4827. this._popper.destroy();
  4828. this._popper = null;
  4829. }
  4830. };
  4831. _proto.update = function update() {
  4832. this._inNavbar = this._detectNavbar();
  4833. if (this._popper !== null) {
  4834. this._popper.scheduleUpdate();
  4835. }
  4836. } // Private
  4837. ;
  4838. _proto._addEventListeners = function _addEventListeners() {
  4839. var _this = this;
  4840. $(this._element).on(Event$4.CLICK, function (event) {
  4841. event.preventDefault();
  4842. event.stopPropagation();
  4843. _this.toggle();
  4844. });
  4845. };
  4846. _proto._getConfig = function _getConfig(config) {
  4847. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4848. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4849. return config;
  4850. };
  4851. _proto._getMenuElement = function _getMenuElement() {
  4852. if (!this._menu) {
  4853. var parent = Dropdown._getParentFromElement(this._element);
  4854. if (parent) {
  4855. this._menu = parent.querySelector(Selector$4.MENU);
  4856. }
  4857. }
  4858. return this._menu;
  4859. };
  4860. _proto._getPlacement = function _getPlacement() {
  4861. var $parentDropdown = $(this._element.parentNode);
  4862. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4863. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4864. placement = AttachmentMap.TOP;
  4865. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4866. placement = AttachmentMap.TOPEND;
  4867. }
  4868. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4869. placement = AttachmentMap.RIGHT;
  4870. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4871. placement = AttachmentMap.LEFT;
  4872. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4873. placement = AttachmentMap.BOTTOMEND;
  4874. }
  4875. return placement;
  4876. };
  4877. _proto._detectNavbar = function _detectNavbar() {
  4878. return $(this._element).closest('.navbar').length > 0;
  4879. };
  4880. _proto._getOffset = function _getOffset() {
  4881. var _this2 = this;
  4882. var offset = {};
  4883. if (typeof this._config.offset === 'function') {
  4884. offset.fn = function (data) {
  4885. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4886. return data;
  4887. };
  4888. } else {
  4889. offset.offset = this._config.offset;
  4890. }
  4891. return offset;
  4892. };
  4893. _proto._getPopperConfig = function _getPopperConfig() {
  4894. var popperConfig = {
  4895. placement: this._getPlacement(),
  4896. modifiers: {
  4897. offset: this._getOffset(),
  4898. flip: {
  4899. enabled: this._config.flip
  4900. },
  4901. preventOverflow: {
  4902. boundariesElement: this._config.boundary
  4903. }
  4904. }
  4905. }; // Disable Popper.js if we have a static display
  4906. if (this._config.display === 'static') {
  4907. popperConfig.modifiers.applyStyle = {
  4908. enabled: false
  4909. };
  4910. }
  4911. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4912. } // Static
  4913. ;
  4914. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4915. return this.each(function () {
  4916. var data = $(this).data(DATA_KEY$4);
  4917. var _config = typeof config === 'object' ? config : null;
  4918. if (!data) {
  4919. data = new Dropdown(this, _config);
  4920. $(this).data(DATA_KEY$4, data);
  4921. }
  4922. if (typeof config === 'string') {
  4923. if (typeof data[config] === 'undefined') {
  4924. throw new TypeError("No method named \"" + config + "\"");
  4925. }
  4926. data[config]();
  4927. }
  4928. });
  4929. };
  4930. Dropdown._clearMenus = function _clearMenus(event) {
  4931. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4932. return;
  4933. }
  4934. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4935. for (var i = 0, len = toggles.length; i < len; i++) {
  4936. var parent = Dropdown._getParentFromElement(toggles[i]);
  4937. var context = $(toggles[i]).data(DATA_KEY$4);
  4938. var relatedTarget = {
  4939. relatedTarget: toggles[i]
  4940. };
  4941. if (event && event.type === 'click') {
  4942. relatedTarget.clickEvent = event;
  4943. }
  4944. if (!context) {
  4945. continue;
  4946. }
  4947. var dropdownMenu = context._menu;
  4948. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4949. continue;
  4950. }
  4951. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4952. continue;
  4953. }
  4954. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4955. $(parent).trigger(hideEvent);
  4956. if (hideEvent.isDefaultPrevented()) {
  4957. continue;
  4958. } // If this is a touch-enabled device we remove the extra
  4959. // empty mouseover listeners we added for iOS support
  4960. if ('ontouchstart' in document.documentElement) {
  4961. $(document.body).children().off('mouseover', null, $.noop);
  4962. }
  4963. toggles[i].setAttribute('aria-expanded', 'false');
  4964. if (context._popper) {
  4965. context._popper.destroy();
  4966. }
  4967. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4968. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4969. }
  4970. };
  4971. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4972. var parent;
  4973. var selector = Util.getSelectorFromElement(element);
  4974. if (selector) {
  4975. parent = document.querySelector(selector);
  4976. }
  4977. return parent || element.parentNode;
  4978. } // eslint-disable-next-line complexity
  4979. ;
  4980. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4981. // If not input/textarea:
  4982. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4983. // If input/textarea:
  4984. // - If space key => not a dropdown command
  4985. // - If key is other than escape
  4986. // - If key is not up or down => not a dropdown command
  4987. // - If trigger inside the menu => not a dropdown command
  4988. 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)) {
  4989. return;
  4990. }
  4991. event.preventDefault();
  4992. event.stopPropagation();
  4993. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4994. return;
  4995. }
  4996. var parent = Dropdown._getParentFromElement(this);
  4997. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4998. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4999. return;
  5000. }
  5001. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  5002. if (event.which === ESCAPE_KEYCODE) {
  5003. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  5004. $(toggle).trigger('focus');
  5005. }
  5006. $(this).trigger('click');
  5007. return;
  5008. }
  5009. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  5010. return $(item).is(':visible');
  5011. });
  5012. if (items.length === 0) {
  5013. return;
  5014. }
  5015. var index = items.indexOf(event.target);
  5016. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  5017. // Up
  5018. index--;
  5019. }
  5020. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  5021. // Down
  5022. index++;
  5023. }
  5024. if (index < 0) {
  5025. index = 0;
  5026. }
  5027. items[index].focus();
  5028. };
  5029. _createClass(Dropdown, null, [{
  5030. key: "VERSION",
  5031. get: function get() {
  5032. return VERSION$4;
  5033. }
  5034. }, {
  5035. key: "Default",
  5036. get: function get() {
  5037. return Default$2;
  5038. }
  5039. }, {
  5040. key: "DefaultType",
  5041. get: function get() {
  5042. return DefaultType$2;
  5043. }
  5044. }]);
  5045. return Dropdown;
  5046. }();
  5047. /**
  5048. * ------------------------------------------------------------------------
  5049. * Data Api implementation
  5050. * ------------------------------------------------------------------------
  5051. */
  5052. $(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) {
  5053. event.preventDefault();
  5054. event.stopPropagation();
  5055. Dropdown._jQueryInterface.call($(this), 'toggle');
  5056. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  5057. e.stopPropagation();
  5058. });
  5059. /**
  5060. * ------------------------------------------------------------------------
  5061. * jQuery
  5062. * ------------------------------------------------------------------------
  5063. */
  5064. $.fn[NAME$4] = Dropdown._jQueryInterface;
  5065. $.fn[NAME$4].Constructor = Dropdown;
  5066. $.fn[NAME$4].noConflict = function () {
  5067. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  5068. return Dropdown._jQueryInterface;
  5069. };
  5070. /**
  5071. * ------------------------------------------------------------------------
  5072. * Constants
  5073. * ------------------------------------------------------------------------
  5074. */
  5075. var NAME$5 = 'modal';
  5076. var VERSION$5 = '4.4.1';
  5077. var DATA_KEY$5 = 'bs.modal';
  5078. var EVENT_KEY$5 = "." + DATA_KEY$5;
  5079. var DATA_API_KEY$5 = '.data-api';
  5080. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  5081. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  5082. var Default$3 = {
  5083. backdrop: true,
  5084. keyboard: true,
  5085. focus: true,
  5086. show: true
  5087. };
  5088. var DefaultType$3 = {
  5089. backdrop: '(boolean|string)',
  5090. keyboard: 'boolean',
  5091. focus: 'boolean',
  5092. show: 'boolean'
  5093. };
  5094. var Event$5 = {
  5095. HIDE: "hide" + EVENT_KEY$5,
  5096. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  5097. HIDDEN: "hidden" + EVENT_KEY$5,
  5098. SHOW: "show" + EVENT_KEY$5,
  5099. SHOWN: "shown" + EVENT_KEY$5,
  5100. FOCUSIN: "focusin" + EVENT_KEY$5,
  5101. RESIZE: "resize" + EVENT_KEY$5,
  5102. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  5103. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  5104. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  5105. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  5106. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  5107. };
  5108. var ClassName$5 = {
  5109. SCROLLABLE: 'modal-dialog-scrollable',
  5110. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  5111. BACKDROP: 'modal-backdrop',
  5112. OPEN: 'modal-open',
  5113. FADE: 'fade',
  5114. SHOW: 'show',
  5115. STATIC: 'modal-static'
  5116. };
  5117. var Selector$5 = {
  5118. DIALOG: '.modal-dialog',
  5119. MODAL_BODY: '.modal-body',
  5120. DATA_TOGGLE: '[data-toggle="modal"]',
  5121. DATA_DISMISS: '[data-dismiss="modal"]',
  5122. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  5123. STICKY_CONTENT: '.sticky-top'
  5124. };
  5125. /**
  5126. * ------------------------------------------------------------------------
  5127. * Class Definition
  5128. * ------------------------------------------------------------------------
  5129. */
  5130. var Modal =
  5131. /*#__PURE__*/
  5132. function () {
  5133. function Modal(element, config) {
  5134. this._config = this._getConfig(config);
  5135. this._element = element;
  5136. this._dialog = element.querySelector(Selector$5.DIALOG);
  5137. this._backdrop = null;
  5138. this._isShown = false;
  5139. this._isBodyOverflowing = false;
  5140. this._ignoreBackdropClick = false;
  5141. this._isTransitioning = false;
  5142. this._scrollbarWidth = 0;
  5143. } // Getters
  5144. var _proto = Modal.prototype;
  5145. // Public
  5146. _proto.toggle = function toggle(relatedTarget) {
  5147. return this._isShown ? this.hide() : this.show(relatedTarget);
  5148. };
  5149. _proto.show = function show(relatedTarget) {
  5150. var _this = this;
  5151. if (this._isShown || this._isTransitioning) {
  5152. return;
  5153. }
  5154. if ($(this._element).hasClass(ClassName$5.FADE)) {
  5155. this._isTransitioning = true;
  5156. }
  5157. var showEvent = $.Event(Event$5.SHOW, {
  5158. relatedTarget: relatedTarget
  5159. });
  5160. $(this._element).trigger(showEvent);
  5161. if (this._isShown || showEvent.isDefaultPrevented()) {
  5162. return;
  5163. }
  5164. this._isShown = true;
  5165. this._checkScrollbar();
  5166. this._setScrollbar();
  5167. this._adjustDialog();
  5168. this._setEscapeEvent();
  5169. this._setResizeEvent();
  5170. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  5171. return _this.hide(event);
  5172. });
  5173. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  5174. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  5175. if ($(event.target).is(_this._element)) {
  5176. _this._ignoreBackdropClick = true;
  5177. }
  5178. });
  5179. });
  5180. this._showBackdrop(function () {
  5181. return _this._showElement(relatedTarget);
  5182. });
  5183. };
  5184. _proto.hide = function hide(event) {
  5185. var _this2 = this;
  5186. if (event) {
  5187. event.preventDefault();
  5188. }
  5189. if (!this._isShown || this._isTransitioning) {
  5190. return;
  5191. }
  5192. var hideEvent = $.Event(Event$5.HIDE);
  5193. $(this._element).trigger(hideEvent);
  5194. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  5195. return;
  5196. }
  5197. this._isShown = false;
  5198. var transition = $(this._element).hasClass(ClassName$5.FADE);
  5199. if (transition) {
  5200. this._isTransitioning = true;
  5201. }
  5202. this._setEscapeEvent();
  5203. this._setResizeEvent();
  5204. $(document).off(Event$5.FOCUSIN);
  5205. $(this._element).removeClass(ClassName$5.SHOW);
  5206. $(this._element).off(Event$5.CLICK_DISMISS);
  5207. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  5208. if (transition) {
  5209. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5210. $(this._element).one(Util.TRANSITION_END, function (event) {
  5211. return _this2._hideModal(event);
  5212. }).emulateTransitionEnd(transitionDuration);
  5213. } else {
  5214. this._hideModal();
  5215. }
  5216. };
  5217. _proto.dispose = function dispose() {
  5218. [window, this._element, this._dialog].forEach(function (htmlElement) {
  5219. return $(htmlElement).off(EVENT_KEY$5);
  5220. });
  5221. /**
  5222. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  5223. * Do not move `document` in `htmlElements` array
  5224. * It will remove `Event.CLICK_DATA_API` event that should remain
  5225. */
  5226. $(document).off(Event$5.FOCUSIN);
  5227. $.removeData(this._element, DATA_KEY$5);
  5228. this._config = null;
  5229. this._element = null;
  5230. this._dialog = null;
  5231. this._backdrop = null;
  5232. this._isShown = null;
  5233. this._isBodyOverflowing = null;
  5234. this._ignoreBackdropClick = null;
  5235. this._isTransitioning = null;
  5236. this._scrollbarWidth = null;
  5237. };
  5238. _proto.handleUpdate = function handleUpdate() {
  5239. this._adjustDialog();
  5240. } // Private
  5241. ;
  5242. _proto._getConfig = function _getConfig(config) {
  5243. config = _objectSpread2({}, Default$3, {}, config);
  5244. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  5245. return config;
  5246. };
  5247. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  5248. var _this3 = this;
  5249. if (this._config.backdrop === 'static') {
  5250. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  5251. $(this._element).trigger(hideEventPrevented);
  5252. if (hideEventPrevented.defaultPrevented) {
  5253. return;
  5254. }
  5255. this._element.classList.add(ClassName$5.STATIC);
  5256. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  5257. $(this._element).one(Util.TRANSITION_END, function () {
  5258. _this3._element.classList.remove(ClassName$5.STATIC);
  5259. }).emulateTransitionEnd(modalTransitionDuration);
  5260. this._element.focus();
  5261. } else {
  5262. this.hide();
  5263. }
  5264. };
  5265. _proto._showElement = function _showElement(relatedTarget) {
  5266. var _this4 = this;
  5267. var transition = $(this._element).hasClass(ClassName$5.FADE);
  5268. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  5269. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  5270. // Don't move modal's DOM position
  5271. document.body.appendChild(this._element);
  5272. }
  5273. this._element.style.display = 'block';
  5274. this._element.removeAttribute('aria-hidden');
  5275. this._element.setAttribute('aria-modal', true);
  5276. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  5277. modalBody.scrollTop = 0;
  5278. } else {
  5279. this._element.scrollTop = 0;
  5280. }
  5281. if (transition) {
  5282. Util.reflow(this._element);
  5283. }
  5284. $(this._element).addClass(ClassName$5.SHOW);
  5285. if (this._config.focus) {
  5286. this._enforceFocus();
  5287. }
  5288. var shownEvent = $.Event(Event$5.SHOWN, {
  5289. relatedTarget: relatedTarget
  5290. });
  5291. var transitionComplete = function transitionComplete() {
  5292. if (_this4._config.focus) {
  5293. _this4._element.focus();
  5294. }
  5295. _this4._isTransitioning = false;
  5296. $(_this4._element).trigger(shownEvent);
  5297. };
  5298. if (transition) {
  5299. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  5300. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  5301. } else {
  5302. transitionComplete();
  5303. }
  5304. };
  5305. _proto._enforceFocus = function _enforceFocus() {
  5306. var _this5 = this;
  5307. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  5308. .on(Event$5.FOCUSIN, function (event) {
  5309. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  5310. _this5._element.focus();
  5311. }
  5312. });
  5313. };
  5314. _proto._setEscapeEvent = function _setEscapeEvent() {
  5315. var _this6 = this;
  5316. if (this._isShown && this._config.keyboard) {
  5317. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  5318. if (event.which === ESCAPE_KEYCODE$1) {
  5319. _this6._triggerBackdropTransition();
  5320. }
  5321. });
  5322. } else if (!this._isShown) {
  5323. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  5324. }
  5325. };
  5326. _proto._setResizeEvent = function _setResizeEvent() {
  5327. var _this7 = this;
  5328. if (this._isShown) {
  5329. $(window).on(Event$5.RESIZE, function (event) {
  5330. return _this7.handleUpdate(event);
  5331. });
  5332. } else {
  5333. $(window).off(Event$5.RESIZE);
  5334. }
  5335. };
  5336. _proto._hideModal = function _hideModal() {
  5337. var _this8 = this;
  5338. this._element.style.display = 'none';
  5339. this._element.setAttribute('aria-hidden', true);
  5340. this._element.removeAttribute('aria-modal');
  5341. this._isTransitioning = false;
  5342. this._showBackdrop(function () {
  5343. $(document.body).removeClass(ClassName$5.OPEN);
  5344. _this8._resetAdjustments();
  5345. _this8._resetScrollbar();
  5346. $(_this8._element).trigger(Event$5.HIDDEN);
  5347. });
  5348. };
  5349. _proto._removeBackdrop = function _removeBackdrop() {
  5350. if (this._backdrop) {
  5351. $(this._backdrop).remove();
  5352. this._backdrop = null;
  5353. }
  5354. };
  5355. _proto._showBackdrop = function _showBackdrop(callback) {
  5356. var _this9 = this;
  5357. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  5358. if (this._isShown && this._config.backdrop) {
  5359. this._backdrop = document.createElement('div');
  5360. this._backdrop.className = ClassName$5.BACKDROP;
  5361. if (animate) {
  5362. this._backdrop.classList.add(animate);
  5363. }
  5364. $(this._backdrop).appendTo(document.body);
  5365. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  5366. if (_this9._ignoreBackdropClick) {
  5367. _this9._ignoreBackdropClick = false;
  5368. return;
  5369. }
  5370. if (event.target !== event.currentTarget) {
  5371. return;
  5372. }
  5373. _this9._triggerBackdropTransition();
  5374. });
  5375. if (animate) {
  5376. Util.reflow(this._backdrop);
  5377. }
  5378. $(this._backdrop).addClass(ClassName$5.SHOW);
  5379. if (!callback) {
  5380. return;
  5381. }
  5382. if (!animate) {
  5383. callback();
  5384. return;
  5385. }
  5386. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  5387. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  5388. } else if (!this._isShown && this._backdrop) {
  5389. $(this._backdrop).removeClass(ClassName$5.SHOW);
  5390. var callbackRemove = function callbackRemove() {
  5391. _this9._removeBackdrop();
  5392. if (callback) {
  5393. callback();
  5394. }
  5395. };
  5396. if ($(this._element).hasClass(ClassName$5.FADE)) {
  5397. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  5398. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  5399. } else {
  5400. callbackRemove();
  5401. }
  5402. } else if (callback) {
  5403. callback();
  5404. }
  5405. } // ----------------------------------------------------------------------
  5406. // the following methods are used to handle overflowing modals
  5407. // todo (fat): these should probably be refactored out of modal.js
  5408. // ----------------------------------------------------------------------
  5409. ;
  5410. _proto._adjustDialog = function _adjustDialog() {
  5411. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  5412. if (!this._isBodyOverflowing && isModalOverflowing) {
  5413. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  5414. }
  5415. if (this._isBodyOverflowing && !isModalOverflowing) {
  5416. this._element.style.paddingRight = this._scrollbarWidth + "px";
  5417. }
  5418. };
  5419. _proto._resetAdjustments = function _resetAdjustments() {
  5420. this._element.style.paddingLeft = '';
  5421. this._element.style.paddingRight = '';
  5422. };
  5423. _proto._checkScrollbar = function _checkScrollbar() {
  5424. var rect = document.body.getBoundingClientRect();
  5425. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  5426. this._scrollbarWidth = this._getScrollbarWidth();
  5427. };
  5428. _proto._setScrollbar = function _setScrollbar() {
  5429. var _this10 = this;
  5430. if (this._isBodyOverflowing) {
  5431. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  5432. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  5433. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  5434. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  5435. $(fixedContent).each(function (index, element) {
  5436. var actualPadding = element.style.paddingRight;
  5437. var calculatedPadding = $(element).css('padding-right');
  5438. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  5439. }); // Adjust sticky content margin
  5440. $(stickyContent).each(function (index, element) {
  5441. var actualMargin = element.style.marginRight;
  5442. var calculatedMargin = $(element).css('margin-right');
  5443. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  5444. }); // Adjust body padding
  5445. var actualPadding = document.body.style.paddingRight;
  5446. var calculatedPadding = $(document.body).css('padding-right');
  5447. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  5448. }
  5449. $(document.body).addClass(ClassName$5.OPEN);
  5450. };
  5451. _proto._resetScrollbar = function _resetScrollbar() {
  5452. // Restore fixed content padding
  5453. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  5454. $(fixedContent).each(function (index, element) {
  5455. var padding = $(element).data('padding-right');
  5456. $(element).removeData('padding-right');
  5457. element.style.paddingRight = padding ? padding : '';
  5458. }); // Restore sticky content
  5459. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  5460. $(elements).each(function (index, element) {
  5461. var margin = $(element).data('margin-right');
  5462. if (typeof margin !== 'undefined') {
  5463. $(element).css('margin-right', margin).removeData('margin-right');
  5464. }
  5465. }); // Restore body padding
  5466. var padding = $(document.body).data('padding-right');
  5467. $(document.body).removeData('padding-right');
  5468. document.body.style.paddingRight = padding ? padding : '';
  5469. };
  5470. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  5471. // thx d.walsh
  5472. var scrollDiv = document.createElement('div');
  5473. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  5474. document.body.appendChild(scrollDiv);
  5475. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  5476. document.body.removeChild(scrollDiv);
  5477. return scrollbarWidth;
  5478. } // Static
  5479. ;
  5480. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  5481. return this.each(function () {
  5482. var data = $(this).data(DATA_KEY$5);
  5483. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  5484. if (!data) {
  5485. data = new Modal(this, _config);
  5486. $(this).data(DATA_KEY$5, data);
  5487. }
  5488. if (typeof config === 'string') {
  5489. if (typeof data[config] === 'undefined') {
  5490. throw new TypeError("No method named \"" + config + "\"");
  5491. }
  5492. data[config](relatedTarget);
  5493. } else if (_config.show) {
  5494. data.show(relatedTarget);
  5495. }
  5496. });
  5497. };
  5498. _createClass(Modal, null, [{
  5499. key: "VERSION",
  5500. get: function get() {
  5501. return VERSION$5;
  5502. }
  5503. }, {
  5504. key: "Default",
  5505. get: function get() {
  5506. return Default$3;
  5507. }
  5508. }]);
  5509. return Modal;
  5510. }();
  5511. /**
  5512. * ------------------------------------------------------------------------
  5513. * Data Api implementation
  5514. * ------------------------------------------------------------------------
  5515. */
  5516. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  5517. var _this11 = this;
  5518. var target;
  5519. var selector = Util.getSelectorFromElement(this);
  5520. if (selector) {
  5521. target = document.querySelector(selector);
  5522. }
  5523. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  5524. if (this.tagName === 'A' || this.tagName === 'AREA') {
  5525. event.preventDefault();
  5526. }
  5527. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  5528. if (showEvent.isDefaultPrevented()) {
  5529. // Only register focus restorer if modal will actually get shown
  5530. return;
  5531. }
  5532. $target.one(Event$5.HIDDEN, function () {
  5533. if ($(_this11).is(':visible')) {
  5534. _this11.focus();
  5535. }
  5536. });
  5537. });
  5538. Modal._jQueryInterface.call($(target), config, this);
  5539. });
  5540. /**
  5541. * ------------------------------------------------------------------------
  5542. * jQuery
  5543. * ------------------------------------------------------------------------
  5544. */
  5545. $.fn[NAME$5] = Modal._jQueryInterface;
  5546. $.fn[NAME$5].Constructor = Modal;
  5547. $.fn[NAME$5].noConflict = function () {
  5548. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  5549. return Modal._jQueryInterface;
  5550. };
  5551. /**
  5552. * --------------------------------------------------------------------------
  5553. * Bootstrap (v4.4.1): tools/sanitizer.js
  5554. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5555. * --------------------------------------------------------------------------
  5556. */
  5557. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  5558. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  5559. var DefaultWhitelist = {
  5560. // Global attributes allowed on any supplied element below.
  5561. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  5562. a: ['target', 'href', 'title', 'rel'],
  5563. area: [],
  5564. b: [],
  5565. br: [],
  5566. col: [],
  5567. code: [],
  5568. div: [],
  5569. em: [],
  5570. hr: [],
  5571. h1: [],
  5572. h2: [],
  5573. h3: [],
  5574. h4: [],
  5575. h5: [],
  5576. h6: [],
  5577. i: [],
  5578. img: ['src', 'alt', 'title', 'width', 'height'],
  5579. li: [],
  5580. ol: [],
  5581. p: [],
  5582. pre: [],
  5583. s: [],
  5584. small: [],
  5585. span: [],
  5586. sub: [],
  5587. sup: [],
  5588. strong: [],
  5589. u: [],
  5590. ul: []
  5591. };
  5592. /**
  5593. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  5594. *
  5595. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5596. */
  5597. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  5598. /**
  5599. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  5600. *
  5601. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5602. */
  5603. 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;
  5604. function allowedAttribute(attr, allowedAttributeList) {
  5605. var attrName = attr.nodeName.toLowerCase();
  5606. if (allowedAttributeList.indexOf(attrName) !== -1) {
  5607. if (uriAttrs.indexOf(attrName) !== -1) {
  5608. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  5609. }
  5610. return true;
  5611. }
  5612. var regExp = allowedAttributeList.filter(function (attrRegex) {
  5613. return attrRegex instanceof RegExp;
  5614. }); // Check if a regular expression validates the attribute.
  5615. for (var i = 0, l = regExp.length; i < l; i++) {
  5616. if (attrName.match(regExp[i])) {
  5617. return true;
  5618. }
  5619. }
  5620. return false;
  5621. }
  5622. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  5623. if (unsafeHtml.length === 0) {
  5624. return unsafeHtml;
  5625. }
  5626. if (sanitizeFn && typeof sanitizeFn === 'function') {
  5627. return sanitizeFn(unsafeHtml);
  5628. }
  5629. var domParser = new window.DOMParser();
  5630. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  5631. var whitelistKeys = Object.keys(whiteList);
  5632. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  5633. var _loop = function _loop(i, len) {
  5634. var el = elements[i];
  5635. var elName = el.nodeName.toLowerCase();
  5636. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  5637. el.parentNode.removeChild(el);
  5638. return "continue";
  5639. }
  5640. var attributeList = [].slice.call(el.attributes);
  5641. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  5642. attributeList.forEach(function (attr) {
  5643. if (!allowedAttribute(attr, whitelistedAttributes)) {
  5644. el.removeAttribute(attr.nodeName);
  5645. }
  5646. });
  5647. };
  5648. for (var i = 0, len = elements.length; i < len; i++) {
  5649. var _ret = _loop(i);
  5650. if (_ret === "continue") continue;
  5651. }
  5652. return createdDocument.body.innerHTML;
  5653. }
  5654. /**
  5655. * ------------------------------------------------------------------------
  5656. * Constants
  5657. * ------------------------------------------------------------------------
  5658. */
  5659. var NAME$6 = 'tooltip';
  5660. var VERSION$6 = '4.4.1';
  5661. var DATA_KEY$6 = 'bs.tooltip';
  5662. var EVENT_KEY$6 = "." + DATA_KEY$6;
  5663. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  5664. var CLASS_PREFIX = 'bs-tooltip';
  5665. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  5666. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  5667. var DefaultType$4 = {
  5668. animation: 'boolean',
  5669. template: 'string',
  5670. title: '(string|element|function)',
  5671. trigger: 'string',
  5672. delay: '(number|object)',
  5673. html: 'boolean',
  5674. selector: '(string|boolean)',
  5675. placement: '(string|function)',
  5676. offset: '(number|string|function)',
  5677. container: '(string|element|boolean)',
  5678. fallbackPlacement: '(string|array)',
  5679. boundary: '(string|element)',
  5680. sanitize: 'boolean',
  5681. sanitizeFn: '(null|function)',
  5682. whiteList: 'object',
  5683. popperConfig: '(null|object)'
  5684. };
  5685. var AttachmentMap$1 = {
  5686. AUTO: 'auto',
  5687. TOP: 'top',
  5688. RIGHT: 'right',
  5689. BOTTOM: 'bottom',
  5690. LEFT: 'left'
  5691. };
  5692. var Default$4 = {
  5693. animation: true,
  5694. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  5695. trigger: 'hover focus',
  5696. title: '',
  5697. delay: 0,
  5698. html: false,
  5699. selector: false,
  5700. placement: 'top',
  5701. offset: 0,
  5702. container: false,
  5703. fallbackPlacement: 'flip',
  5704. boundary: 'scrollParent',
  5705. sanitize: true,
  5706. sanitizeFn: null,
  5707. whiteList: DefaultWhitelist,
  5708. popperConfig: null
  5709. };
  5710. var HoverState = {
  5711. SHOW: 'show',
  5712. OUT: 'out'
  5713. };
  5714. var Event$6 = {
  5715. HIDE: "hide" + EVENT_KEY$6,
  5716. HIDDEN: "hidden" + EVENT_KEY$6,
  5717. SHOW: "show" + EVENT_KEY$6,
  5718. SHOWN: "shown" + EVENT_KEY$6,
  5719. INSERTED: "inserted" + EVENT_KEY$6,
  5720. CLICK: "click" + EVENT_KEY$6,
  5721. FOCUSIN: "focusin" + EVENT_KEY$6,
  5722. FOCUSOUT: "focusout" + EVENT_KEY$6,
  5723. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  5724. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  5725. };
  5726. var ClassName$6 = {
  5727. FADE: 'fade',
  5728. SHOW: 'show'
  5729. };
  5730. var Selector$6 = {
  5731. TOOLTIP: '.tooltip',
  5732. TOOLTIP_INNER: '.tooltip-inner',
  5733. ARROW: '.arrow'
  5734. };
  5735. var Trigger = {
  5736. HOVER: 'hover',
  5737. FOCUS: 'focus',
  5738. CLICK: 'click',
  5739. MANUAL: 'manual'
  5740. };
  5741. /**
  5742. * ------------------------------------------------------------------------
  5743. * Class Definition
  5744. * ------------------------------------------------------------------------
  5745. */
  5746. var Tooltip =
  5747. /*#__PURE__*/
  5748. function () {
  5749. function Tooltip(element, config) {
  5750. if (typeof Popper === 'undefined') {
  5751. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  5752. } // private
  5753. this._isEnabled = true;
  5754. this._timeout = 0;
  5755. this._hoverState = '';
  5756. this._activeTrigger = {};
  5757. this._popper = null; // Protected
  5758. this.element = element;
  5759. this.config = this._getConfig(config);
  5760. this.tip = null;
  5761. this._setListeners();
  5762. } // Getters
  5763. var _proto = Tooltip.prototype;
  5764. // Public
  5765. _proto.enable = function enable() {
  5766. this._isEnabled = true;
  5767. };
  5768. _proto.disable = function disable() {
  5769. this._isEnabled = false;
  5770. };
  5771. _proto.toggleEnabled = function toggleEnabled() {
  5772. this._isEnabled = !this._isEnabled;
  5773. };
  5774. _proto.toggle = function toggle(event) {
  5775. if (!this._isEnabled) {
  5776. return;
  5777. }
  5778. if (event) {
  5779. var dataKey = this.constructor.DATA_KEY;
  5780. var context = $(event.currentTarget).data(dataKey);
  5781. if (!context) {
  5782. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5783. $(event.currentTarget).data(dataKey, context);
  5784. }
  5785. context._activeTrigger.click = !context._activeTrigger.click;
  5786. if (context._isWithActiveTrigger()) {
  5787. context._enter(null, context);
  5788. } else {
  5789. context._leave(null, context);
  5790. }
  5791. } else {
  5792. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  5793. this._leave(null, this);
  5794. return;
  5795. }
  5796. this._enter(null, this);
  5797. }
  5798. };
  5799. _proto.dispose = function dispose() {
  5800. clearTimeout(this._timeout);
  5801. $.removeData(this.element, this.constructor.DATA_KEY);
  5802. $(this.element).off(this.constructor.EVENT_KEY);
  5803. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  5804. if (this.tip) {
  5805. $(this.tip).remove();
  5806. }
  5807. this._isEnabled = null;
  5808. this._timeout = null;
  5809. this._hoverState = null;
  5810. this._activeTrigger = null;
  5811. if (this._popper) {
  5812. this._popper.destroy();
  5813. }
  5814. this._popper = null;
  5815. this.element = null;
  5816. this.config = null;
  5817. this.tip = null;
  5818. };
  5819. _proto.show = function show() {
  5820. var _this = this;
  5821. if ($(this.element).css('display') === 'none') {
  5822. throw new Error('Please use show on visible elements');
  5823. }
  5824. var showEvent = $.Event(this.constructor.Event.SHOW);
  5825. if (this.isWithContent() && this._isEnabled) {
  5826. $(this.element).trigger(showEvent);
  5827. var shadowRoot = Util.findShadowRoot(this.element);
  5828. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5829. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5830. return;
  5831. }
  5832. var tip = this.getTipElement();
  5833. var tipId = Util.getUID(this.constructor.NAME);
  5834. tip.setAttribute('id', tipId);
  5835. this.element.setAttribute('aria-describedby', tipId);
  5836. this.setContent();
  5837. if (this.config.animation) {
  5838. $(tip).addClass(ClassName$6.FADE);
  5839. }
  5840. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5841. var attachment = this._getAttachment(placement);
  5842. this.addAttachmentClass(attachment);
  5843. var container = this._getContainer();
  5844. $(tip).data(this.constructor.DATA_KEY, this);
  5845. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5846. $(tip).appendTo(container);
  5847. }
  5848. $(this.element).trigger(this.constructor.Event.INSERTED);
  5849. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5850. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5851. // empty mouseover listeners to the body's immediate children;
  5852. // only needed because of broken event delegation on iOS
  5853. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5854. if ('ontouchstart' in document.documentElement) {
  5855. $(document.body).children().on('mouseover', null, $.noop);
  5856. }
  5857. var complete = function complete() {
  5858. if (_this.config.animation) {
  5859. _this._fixTransition();
  5860. }
  5861. var prevHoverState = _this._hoverState;
  5862. _this._hoverState = null;
  5863. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5864. if (prevHoverState === HoverState.OUT) {
  5865. _this._leave(null, _this);
  5866. }
  5867. };
  5868. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5869. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5870. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5871. } else {
  5872. complete();
  5873. }
  5874. }
  5875. };
  5876. _proto.hide = function hide(callback) {
  5877. var _this2 = this;
  5878. var tip = this.getTipElement();
  5879. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5880. var complete = function complete() {
  5881. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5882. tip.parentNode.removeChild(tip);
  5883. }
  5884. _this2._cleanTipClass();
  5885. _this2.element.removeAttribute('aria-describedby');
  5886. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5887. if (_this2._popper !== null) {
  5888. _this2._popper.destroy();
  5889. }
  5890. if (callback) {
  5891. callback();
  5892. }
  5893. };
  5894. $(this.element).trigger(hideEvent);
  5895. if (hideEvent.isDefaultPrevented()) {
  5896. return;
  5897. }
  5898. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5899. // empty mouseover listeners we added for iOS support
  5900. if ('ontouchstart' in document.documentElement) {
  5901. $(document.body).children().off('mouseover', null, $.noop);
  5902. }
  5903. this._activeTrigger[Trigger.CLICK] = false;
  5904. this._activeTrigger[Trigger.FOCUS] = false;
  5905. this._activeTrigger[Trigger.HOVER] = false;
  5906. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5907. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5908. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5909. } else {
  5910. complete();
  5911. }
  5912. this._hoverState = '';
  5913. };
  5914. _proto.update = function update() {
  5915. if (this._popper !== null) {
  5916. this._popper.scheduleUpdate();
  5917. }
  5918. } // Protected
  5919. ;
  5920. _proto.isWithContent = function isWithContent() {
  5921. return Boolean(this.getTitle());
  5922. };
  5923. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5924. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5925. };
  5926. _proto.getTipElement = function getTipElement() {
  5927. this.tip = this.tip || $(this.config.template)[0];
  5928. return this.tip;
  5929. };
  5930. _proto.setContent = function setContent() {
  5931. var tip = this.getTipElement();
  5932. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5933. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5934. };
  5935. _proto.setElementContent = function setElementContent($element, content) {
  5936. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5937. // Content is a DOM node or a jQuery
  5938. if (this.config.html) {
  5939. if (!$(content).parent().is($element)) {
  5940. $element.empty().append(content);
  5941. }
  5942. } else {
  5943. $element.text($(content).text());
  5944. }
  5945. return;
  5946. }
  5947. if (this.config.html) {
  5948. if (this.config.sanitize) {
  5949. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5950. }
  5951. $element.html(content);
  5952. } else {
  5953. $element.text(content);
  5954. }
  5955. };
  5956. _proto.getTitle = function getTitle() {
  5957. var title = this.element.getAttribute('data-original-title');
  5958. if (!title) {
  5959. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5960. }
  5961. return title;
  5962. } // Private
  5963. ;
  5964. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5965. var _this3 = this;
  5966. var defaultBsConfig = {
  5967. placement: attachment,
  5968. modifiers: {
  5969. offset: this._getOffset(),
  5970. flip: {
  5971. behavior: this.config.fallbackPlacement
  5972. },
  5973. arrow: {
  5974. element: Selector$6.ARROW
  5975. },
  5976. preventOverflow: {
  5977. boundariesElement: this.config.boundary
  5978. }
  5979. },
  5980. onCreate: function onCreate(data) {
  5981. if (data.originalPlacement !== data.placement) {
  5982. _this3._handlePopperPlacementChange(data);
  5983. }
  5984. },
  5985. onUpdate: function onUpdate(data) {
  5986. return _this3._handlePopperPlacementChange(data);
  5987. }
  5988. };
  5989. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5990. };
  5991. _proto._getOffset = function _getOffset() {
  5992. var _this4 = this;
  5993. var offset = {};
  5994. if (typeof this.config.offset === 'function') {
  5995. offset.fn = function (data) {
  5996. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5997. return data;
  5998. };
  5999. } else {
  6000. offset.offset = this.config.offset;
  6001. }
  6002. return offset;
  6003. };
  6004. _proto._getContainer = function _getContainer() {
  6005. if (this.config.container === false) {
  6006. return document.body;
  6007. }
  6008. if (Util.isElement(this.config.container)) {
  6009. return $(this.config.container);
  6010. }
  6011. return $(document).find(this.config.container);
  6012. };
  6013. _proto._getAttachment = function _getAttachment(placement) {
  6014. return AttachmentMap$1[placement.toUpperCase()];
  6015. };
  6016. _proto._setListeners = function _setListeners() {
  6017. var _this5 = this;
  6018. var triggers = this.config.trigger.split(' ');
  6019. triggers.forEach(function (trigger) {
  6020. if (trigger === 'click') {
  6021. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  6022. return _this5.toggle(event);
  6023. });
  6024. } else if (trigger !== Trigger.MANUAL) {
  6025. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  6026. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  6027. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  6028. return _this5._enter(event);
  6029. }).on(eventOut, _this5.config.selector, function (event) {
  6030. return _this5._leave(event);
  6031. });
  6032. }
  6033. });
  6034. this._hideModalHandler = function () {
  6035. if (_this5.element) {
  6036. _this5.hide();
  6037. }
  6038. };
  6039. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  6040. if (this.config.selector) {
  6041. this.config = _objectSpread2({}, this.config, {
  6042. trigger: 'manual',
  6043. selector: ''
  6044. });
  6045. } else {
  6046. this._fixTitle();
  6047. }
  6048. };
  6049. _proto._fixTitle = function _fixTitle() {
  6050. var titleType = typeof this.element.getAttribute('data-original-title');
  6051. if (this.element.getAttribute('title') || titleType !== 'string') {
  6052. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  6053. this.element.setAttribute('title', '');
  6054. }
  6055. };
  6056. _proto._enter = function _enter(event, context) {
  6057. var dataKey = this.constructor.DATA_KEY;
  6058. context = context || $(event.currentTarget).data(dataKey);
  6059. if (!context) {
  6060. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  6061. $(event.currentTarget).data(dataKey, context);
  6062. }
  6063. if (event) {
  6064. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  6065. }
  6066. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  6067. context._hoverState = HoverState.SHOW;
  6068. return;
  6069. }
  6070. clearTimeout(context._timeout);
  6071. context._hoverState = HoverState.SHOW;
  6072. if (!context.config.delay || !context.config.delay.show) {
  6073. context.show();
  6074. return;
  6075. }
  6076. context._timeout = setTimeout(function () {
  6077. if (context._hoverState === HoverState.SHOW) {
  6078. context.show();
  6079. }
  6080. }, context.config.delay.show);
  6081. };
  6082. _proto._leave = function _leave(event, context) {
  6083. var dataKey = this.constructor.DATA_KEY;
  6084. context = context || $(event.currentTarget).data(dataKey);
  6085. if (!context) {
  6086. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  6087. $(event.currentTarget).data(dataKey, context);
  6088. }
  6089. if (event) {
  6090. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  6091. }
  6092. if (context._isWithActiveTrigger()) {
  6093. return;
  6094. }
  6095. clearTimeout(context._timeout);
  6096. context._hoverState = HoverState.OUT;
  6097. if (!context.config.delay || !context.config.delay.hide) {
  6098. context.hide();
  6099. return;
  6100. }
  6101. context._timeout = setTimeout(function () {
  6102. if (context._hoverState === HoverState.OUT) {
  6103. context.hide();
  6104. }
  6105. }, context.config.delay.hide);
  6106. };
  6107. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  6108. for (var trigger in this._activeTrigger) {
  6109. if (this._activeTrigger[trigger]) {
  6110. return true;
  6111. }
  6112. }
  6113. return false;
  6114. };
  6115. _proto._getConfig = function _getConfig(config) {
  6116. var dataAttributes = $(this.element).data();
  6117. Object.keys(dataAttributes).forEach(function (dataAttr) {
  6118. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  6119. delete dataAttributes[dataAttr];
  6120. }
  6121. });
  6122. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  6123. if (typeof config.delay === 'number') {
  6124. config.delay = {
  6125. show: config.delay,
  6126. hide: config.delay
  6127. };
  6128. }
  6129. if (typeof config.title === 'number') {
  6130. config.title = config.title.toString();
  6131. }
  6132. if (typeof config.content === 'number') {
  6133. config.content = config.content.toString();
  6134. }
  6135. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  6136. if (config.sanitize) {
  6137. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  6138. }
  6139. return config;
  6140. };
  6141. _proto._getDelegateConfig = function _getDelegateConfig() {
  6142. var config = {};
  6143. if (this.config) {
  6144. for (var key in this.config) {
  6145. if (this.constructor.Default[key] !== this.config[key]) {
  6146. config[key] = this.config[key];
  6147. }
  6148. }
  6149. }
  6150. return config;
  6151. };
  6152. _proto._cleanTipClass = function _cleanTipClass() {
  6153. var $tip = $(this.getTipElement());
  6154. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  6155. if (tabClass !== null && tabClass.length) {
  6156. $tip.removeClass(tabClass.join(''));
  6157. }
  6158. };
  6159. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  6160. var popperInstance = popperData.instance;
  6161. this.tip = popperInstance.popper;
  6162. this._cleanTipClass();
  6163. this.addAttachmentClass(this._getAttachment(popperData.placement));
  6164. };
  6165. _proto._fixTransition = function _fixTransition() {
  6166. var tip = this.getTipElement();
  6167. var initConfigAnimation = this.config.animation;
  6168. if (tip.getAttribute('x-placement') !== null) {
  6169. return;
  6170. }
  6171. $(tip).removeClass(ClassName$6.FADE);
  6172. this.config.animation = false;
  6173. this.hide();
  6174. this.show();
  6175. this.config.animation = initConfigAnimation;
  6176. } // Static
  6177. ;
  6178. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  6179. return this.each(function () {
  6180. var data = $(this).data(DATA_KEY$6);
  6181. var _config = typeof config === 'object' && config;
  6182. if (!data && /dispose|hide/.test(config)) {
  6183. return;
  6184. }
  6185. if (!data) {
  6186. data = new Tooltip(this, _config);
  6187. $(this).data(DATA_KEY$6, data);
  6188. }
  6189. if (typeof config === 'string') {
  6190. if (typeof data[config] === 'undefined') {
  6191. throw new TypeError("No method named \"" + config + "\"");
  6192. }
  6193. data[config]();
  6194. }
  6195. });
  6196. };
  6197. _createClass(Tooltip, null, [{
  6198. key: "VERSION",
  6199. get: function get() {
  6200. return VERSION$6;
  6201. }
  6202. }, {
  6203. key: "Default",
  6204. get: function get() {
  6205. return Default$4;
  6206. }
  6207. }, {
  6208. key: "NAME",
  6209. get: function get() {
  6210. return NAME$6;
  6211. }
  6212. }, {
  6213. key: "DATA_KEY",
  6214. get: function get() {
  6215. return DATA_KEY$6;
  6216. }
  6217. }, {
  6218. key: "Event",
  6219. get: function get() {
  6220. return Event$6;
  6221. }
  6222. }, {
  6223. key: "EVENT_KEY",
  6224. get: function get() {
  6225. return EVENT_KEY$6;
  6226. }
  6227. }, {
  6228. key: "DefaultType",
  6229. get: function get() {
  6230. return DefaultType$4;
  6231. }
  6232. }]);
  6233. return Tooltip;
  6234. }();
  6235. /**
  6236. * ------------------------------------------------------------------------
  6237. * jQuery
  6238. * ------------------------------------------------------------------------
  6239. */
  6240. $.fn[NAME$6] = Tooltip._jQueryInterface;
  6241. $.fn[NAME$6].Constructor = Tooltip;
  6242. $.fn[NAME$6].noConflict = function () {
  6243. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  6244. return Tooltip._jQueryInterface;
  6245. };
  6246. /**
  6247. * ------------------------------------------------------------------------
  6248. * Constants
  6249. * ------------------------------------------------------------------------
  6250. */
  6251. var NAME$7 = 'popover';
  6252. var VERSION$7 = '4.4.1';
  6253. var DATA_KEY$7 = 'bs.popover';
  6254. var EVENT_KEY$7 = "." + DATA_KEY$7;
  6255. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  6256. var CLASS_PREFIX$1 = 'bs-popover';
  6257. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  6258. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  6259. placement: 'right',
  6260. trigger: 'click',
  6261. content: '',
  6262. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  6263. });
  6264. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  6265. content: '(string|element|function)'
  6266. });
  6267. var ClassName$7 = {
  6268. FADE: 'fade',
  6269. SHOW: 'show'
  6270. };
  6271. var Selector$7 = {
  6272. TITLE: '.popover-header',
  6273. CONTENT: '.popover-body'
  6274. };
  6275. var Event$7 = {
  6276. HIDE: "hide" + EVENT_KEY$7,
  6277. HIDDEN: "hidden" + EVENT_KEY$7,
  6278. SHOW: "show" + EVENT_KEY$7,
  6279. SHOWN: "shown" + EVENT_KEY$7,
  6280. INSERTED: "inserted" + EVENT_KEY$7,
  6281. CLICK: "click" + EVENT_KEY$7,
  6282. FOCUSIN: "focusin" + EVENT_KEY$7,
  6283. FOCUSOUT: "focusout" + EVENT_KEY$7,
  6284. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  6285. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  6286. };
  6287. /**
  6288. * ------------------------------------------------------------------------
  6289. * Class Definition
  6290. * ------------------------------------------------------------------------
  6291. */
  6292. var Popover =
  6293. /*#__PURE__*/
  6294. function (_Tooltip) {
  6295. _inheritsLoose(Popover, _Tooltip);
  6296. function Popover() {
  6297. return _Tooltip.apply(this, arguments) || this;
  6298. }
  6299. var _proto = Popover.prototype;
  6300. // Overrides
  6301. _proto.isWithContent = function isWithContent() {
  6302. return this.getTitle() || this._getContent();
  6303. };
  6304. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  6305. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  6306. };
  6307. _proto.getTipElement = function getTipElement() {
  6308. this.tip = this.tip || $(this.config.template)[0];
  6309. return this.tip;
  6310. };
  6311. _proto.setContent = function setContent() {
  6312. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  6313. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  6314. var content = this._getContent();
  6315. if (typeof content === 'function') {
  6316. content = content.call(this.element);
  6317. }
  6318. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  6319. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  6320. } // Private
  6321. ;
  6322. _proto._getContent = function _getContent() {
  6323. return this.element.getAttribute('data-content') || this.config.content;
  6324. };
  6325. _proto._cleanTipClass = function _cleanTipClass() {
  6326. var $tip = $(this.getTipElement());
  6327. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  6328. if (tabClass !== null && tabClass.length > 0) {
  6329. $tip.removeClass(tabClass.join(''));
  6330. }
  6331. } // Static
  6332. ;
  6333. Popover._jQueryInterface = function _jQueryInterface(config) {
  6334. return this.each(function () {
  6335. var data = $(this).data(DATA_KEY$7);
  6336. var _config = typeof config === 'object' ? config : null;
  6337. if (!data && /dispose|hide/.test(config)) {
  6338. return;
  6339. }
  6340. if (!data) {
  6341. data = new Popover(this, _config);
  6342. $(this).data(DATA_KEY$7, data);
  6343. }
  6344. if (typeof config === 'string') {
  6345. if (typeof data[config] === 'undefined') {
  6346. throw new TypeError("No method named \"" + config + "\"");
  6347. }
  6348. data[config]();
  6349. }
  6350. });
  6351. };
  6352. _createClass(Popover, null, [{
  6353. key: "VERSION",
  6354. // Getters
  6355. get: function get() {
  6356. return VERSION$7;
  6357. }
  6358. }, {
  6359. key: "Default",
  6360. get: function get() {
  6361. return Default$5;
  6362. }
  6363. }, {
  6364. key: "NAME",
  6365. get: function get() {
  6366. return NAME$7;
  6367. }
  6368. }, {
  6369. key: "DATA_KEY",
  6370. get: function get() {
  6371. return DATA_KEY$7;
  6372. }
  6373. }, {
  6374. key: "Event",
  6375. get: function get() {
  6376. return Event$7;
  6377. }
  6378. }, {
  6379. key: "EVENT_KEY",
  6380. get: function get() {
  6381. return EVENT_KEY$7;
  6382. }
  6383. }, {
  6384. key: "DefaultType",
  6385. get: function get() {
  6386. return DefaultType$5;
  6387. }
  6388. }]);
  6389. return Popover;
  6390. }(Tooltip);
  6391. /**
  6392. * ------------------------------------------------------------------------
  6393. * jQuery
  6394. * ------------------------------------------------------------------------
  6395. */
  6396. $.fn[NAME$7] = Popover._jQueryInterface;
  6397. $.fn[NAME$7].Constructor = Popover;
  6398. $.fn[NAME$7].noConflict = function () {
  6399. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  6400. return Popover._jQueryInterface;
  6401. };
  6402. /**
  6403. * ------------------------------------------------------------------------
  6404. * Constants
  6405. * ------------------------------------------------------------------------
  6406. */
  6407. var NAME$8 = 'scrollspy';
  6408. var VERSION$8 = '4.4.1';
  6409. var DATA_KEY$8 = 'bs.scrollspy';
  6410. var EVENT_KEY$8 = "." + DATA_KEY$8;
  6411. var DATA_API_KEY$6 = '.data-api';
  6412. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  6413. var Default$6 = {
  6414. offset: 10,
  6415. method: 'auto',
  6416. target: ''
  6417. };
  6418. var DefaultType$6 = {
  6419. offset: 'number',
  6420. method: 'string',
  6421. target: '(string|element)'
  6422. };
  6423. var Event$8 = {
  6424. ACTIVATE: "activate" + EVENT_KEY$8,
  6425. SCROLL: "scroll" + EVENT_KEY$8,
  6426. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  6427. };
  6428. var ClassName$8 = {
  6429. DROPDOWN_ITEM: 'dropdown-item',
  6430. DROPDOWN_MENU: 'dropdown-menu',
  6431. ACTIVE: 'active'
  6432. };
  6433. var Selector$8 = {
  6434. DATA_SPY: '[data-spy="scroll"]',
  6435. ACTIVE: '.active',
  6436. NAV_LIST_GROUP: '.nav, .list-group',
  6437. NAV_LINKS: '.nav-link',
  6438. NAV_ITEMS: '.nav-item',
  6439. LIST_ITEMS: '.list-group-item',
  6440. DROPDOWN: '.dropdown',
  6441. DROPDOWN_ITEMS: '.dropdown-item',
  6442. DROPDOWN_TOGGLE: '.dropdown-toggle'
  6443. };
  6444. var OffsetMethod = {
  6445. OFFSET: 'offset',
  6446. POSITION: 'position'
  6447. };
  6448. /**
  6449. * ------------------------------------------------------------------------
  6450. * Class Definition
  6451. * ------------------------------------------------------------------------
  6452. */
  6453. var ScrollSpy =
  6454. /*#__PURE__*/
  6455. function () {
  6456. function ScrollSpy(element, config) {
  6457. var _this = this;
  6458. this._element = element;
  6459. this._scrollElement = element.tagName === 'BODY' ? window : element;
  6460. this._config = this._getConfig(config);
  6461. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  6462. this._offsets = [];
  6463. this._targets = [];
  6464. this._activeTarget = null;
  6465. this._scrollHeight = 0;
  6466. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  6467. return _this._process(event);
  6468. });
  6469. this.refresh();
  6470. this._process();
  6471. } // Getters
  6472. var _proto = ScrollSpy.prototype;
  6473. // Public
  6474. _proto.refresh = function refresh() {
  6475. var _this2 = this;
  6476. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  6477. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  6478. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  6479. this._offsets = [];
  6480. this._targets = [];
  6481. this._scrollHeight = this._getScrollHeight();
  6482. var targets = [].slice.call(document.querySelectorAll(this._selector));
  6483. targets.map(function (element) {
  6484. var target;
  6485. var targetSelector = Util.getSelectorFromElement(element);
  6486. if (targetSelector) {
  6487. target = document.querySelector(targetSelector);
  6488. }
  6489. if (target) {
  6490. var targetBCR = target.getBoundingClientRect();
  6491. if (targetBCR.width || targetBCR.height) {
  6492. // TODO (fat): remove sketch reliance on jQuery position/offset
  6493. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  6494. }
  6495. }
  6496. return null;
  6497. }).filter(function (item) {
  6498. return item;
  6499. }).sort(function (a, b) {
  6500. return a[0] - b[0];
  6501. }).forEach(function (item) {
  6502. _this2._offsets.push(item[0]);
  6503. _this2._targets.push(item[1]);
  6504. });
  6505. };
  6506. _proto.dispose = function dispose() {
  6507. $.removeData(this._element, DATA_KEY$8);
  6508. $(this._scrollElement).off(EVENT_KEY$8);
  6509. this._element = null;
  6510. this._scrollElement = null;
  6511. this._config = null;
  6512. this._selector = null;
  6513. this._offsets = null;
  6514. this._targets = null;
  6515. this._activeTarget = null;
  6516. this._scrollHeight = null;
  6517. } // Private
  6518. ;
  6519. _proto._getConfig = function _getConfig(config) {
  6520. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  6521. if (typeof config.target !== 'string') {
  6522. var id = $(config.target).attr('id');
  6523. if (!id) {
  6524. id = Util.getUID(NAME$8);
  6525. $(config.target).attr('id', id);
  6526. }
  6527. config.target = "#" + id;
  6528. }
  6529. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  6530. return config;
  6531. };
  6532. _proto._getScrollTop = function _getScrollTop() {
  6533. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  6534. };
  6535. _proto._getScrollHeight = function _getScrollHeight() {
  6536. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  6537. };
  6538. _proto._getOffsetHeight = function _getOffsetHeight() {
  6539. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  6540. };
  6541. _proto._process = function _process() {
  6542. var scrollTop = this._getScrollTop() + this._config.offset;
  6543. var scrollHeight = this._getScrollHeight();
  6544. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  6545. if (this._scrollHeight !== scrollHeight) {
  6546. this.refresh();
  6547. }
  6548. if (scrollTop >= maxScroll) {
  6549. var target = this._targets[this._targets.length - 1];
  6550. if (this._activeTarget !== target) {
  6551. this._activate(target);
  6552. }
  6553. return;
  6554. }
  6555. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  6556. this._activeTarget = null;
  6557. this._clear();
  6558. return;
  6559. }
  6560. var offsetLength = this._offsets.length;
  6561. for (var i = offsetLength; i--;) {
  6562. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  6563. if (isActiveTarget) {
  6564. this._activate(this._targets[i]);
  6565. }
  6566. }
  6567. };
  6568. _proto._activate = function _activate(target) {
  6569. this._activeTarget = target;
  6570. this._clear();
  6571. var queries = this._selector.split(',').map(function (selector) {
  6572. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  6573. });
  6574. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  6575. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  6576. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  6577. $link.addClass(ClassName$8.ACTIVE);
  6578. } else {
  6579. // Set triggered link as active
  6580. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  6581. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  6582. $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
  6583. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  6584. }
  6585. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  6586. relatedTarget: target
  6587. });
  6588. };
  6589. _proto._clear = function _clear() {
  6590. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  6591. return node.classList.contains(ClassName$8.ACTIVE);
  6592. }).forEach(function (node) {
  6593. return node.classList.remove(ClassName$8.ACTIVE);
  6594. });
  6595. } // Static
  6596. ;
  6597. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  6598. return this.each(function () {
  6599. var data = $(this).data(DATA_KEY$8);
  6600. var _config = typeof config === 'object' && config;
  6601. if (!data) {
  6602. data = new ScrollSpy(this, _config);
  6603. $(this).data(DATA_KEY$8, data);
  6604. }
  6605. if (typeof config === 'string') {
  6606. if (typeof data[config] === 'undefined') {
  6607. throw new TypeError("No method named \"" + config + "\"");
  6608. }
  6609. data[config]();
  6610. }
  6611. });
  6612. };
  6613. _createClass(ScrollSpy, null, [{
  6614. key: "VERSION",
  6615. get: function get() {
  6616. return VERSION$8;
  6617. }
  6618. }, {
  6619. key: "Default",
  6620. get: function get() {
  6621. return Default$6;
  6622. }
  6623. }]);
  6624. return ScrollSpy;
  6625. }();
  6626. /**
  6627. * ------------------------------------------------------------------------
  6628. * Data Api implementation
  6629. * ------------------------------------------------------------------------
  6630. */
  6631. $(window).on(Event$8.LOAD_DATA_API, function () {
  6632. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  6633. var scrollSpysLength = scrollSpys.length;
  6634. for (var i = scrollSpysLength; i--;) {
  6635. var $spy = $(scrollSpys[i]);
  6636. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  6637. }
  6638. });
  6639. /**
  6640. * ------------------------------------------------------------------------
  6641. * jQuery
  6642. * ------------------------------------------------------------------------
  6643. */
  6644. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  6645. $.fn[NAME$8].Constructor = ScrollSpy;
  6646. $.fn[NAME$8].noConflict = function () {
  6647. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  6648. return ScrollSpy._jQueryInterface;
  6649. };
  6650. /**
  6651. * ------------------------------------------------------------------------
  6652. * Constants
  6653. * ------------------------------------------------------------------------
  6654. */
  6655. var NAME$9 = 'tab';
  6656. var VERSION$9 = '4.4.1';
  6657. var DATA_KEY$9 = 'bs.tab';
  6658. var EVENT_KEY$9 = "." + DATA_KEY$9;
  6659. var DATA_API_KEY$7 = '.data-api';
  6660. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  6661. var Event$9 = {
  6662. HIDE: "hide" + EVENT_KEY$9,
  6663. HIDDEN: "hidden" + EVENT_KEY$9,
  6664. SHOW: "show" + EVENT_KEY$9,
  6665. SHOWN: "shown" + EVENT_KEY$9,
  6666. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  6667. };
  6668. var ClassName$9 = {
  6669. DROPDOWN_MENU: 'dropdown-menu',
  6670. ACTIVE: 'active',
  6671. DISABLED: 'disabled',
  6672. FADE: 'fade',
  6673. SHOW: 'show'
  6674. };
  6675. var Selector$9 = {
  6676. DROPDOWN: '.dropdown',
  6677. NAV_LIST_GROUP: '.nav, .list-group',
  6678. ACTIVE: '.active',
  6679. ACTIVE_UL: '> li > .active',
  6680. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  6681. DROPDOWN_TOGGLE: '.dropdown-toggle',
  6682. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  6683. };
  6684. /**
  6685. * ------------------------------------------------------------------------
  6686. * Class Definition
  6687. * ------------------------------------------------------------------------
  6688. */
  6689. var Tab =
  6690. /*#__PURE__*/
  6691. function () {
  6692. function Tab(element) {
  6693. this._element = element;
  6694. } // Getters
  6695. var _proto = Tab.prototype;
  6696. // Public
  6697. _proto.show = function show() {
  6698. var _this = this;
  6699. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  6700. return;
  6701. }
  6702. var target;
  6703. var previous;
  6704. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  6705. var selector = Util.getSelectorFromElement(this._element);
  6706. if (listElement) {
  6707. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  6708. previous = $.makeArray($(listElement).find(itemSelector));
  6709. previous = previous[previous.length - 1];
  6710. }
  6711. var hideEvent = $.Event(Event$9.HIDE, {
  6712. relatedTarget: this._element
  6713. });
  6714. var showEvent = $.Event(Event$9.SHOW, {
  6715. relatedTarget: previous
  6716. });
  6717. if (previous) {
  6718. $(previous).trigger(hideEvent);
  6719. }
  6720. $(this._element).trigger(showEvent);
  6721. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  6722. return;
  6723. }
  6724. if (selector) {
  6725. target = document.querySelector(selector);
  6726. }
  6727. this._activate(this._element, listElement);
  6728. var complete = function complete() {
  6729. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  6730. relatedTarget: _this._element
  6731. });
  6732. var shownEvent = $.Event(Event$9.SHOWN, {
  6733. relatedTarget: previous
  6734. });
  6735. $(previous).trigger(hiddenEvent);
  6736. $(_this._element).trigger(shownEvent);
  6737. };
  6738. if (target) {
  6739. this._activate(target, target.parentNode, complete);
  6740. } else {
  6741. complete();
  6742. }
  6743. };
  6744. _proto.dispose = function dispose() {
  6745. $.removeData(this._element, DATA_KEY$9);
  6746. this._element = null;
  6747. } // Private
  6748. ;
  6749. _proto._activate = function _activate(element, container, callback) {
  6750. var _this2 = this;
  6751. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  6752. var active = activeElements[0];
  6753. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  6754. var complete = function complete() {
  6755. return _this2._transitionComplete(element, active, callback);
  6756. };
  6757. if (active && isTransitioning) {
  6758. var transitionDuration = Util.getTransitionDurationFromElement(active);
  6759. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6760. } else {
  6761. complete();
  6762. }
  6763. };
  6764. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  6765. if (active) {
  6766. $(active).removeClass(ClassName$9.ACTIVE);
  6767. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  6768. if (dropdownChild) {
  6769. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  6770. }
  6771. if (active.getAttribute('role') === 'tab') {
  6772. active.setAttribute('aria-selected', false);
  6773. }
  6774. }
  6775. $(element).addClass(ClassName$9.ACTIVE);
  6776. if (element.getAttribute('role') === 'tab') {
  6777. element.setAttribute('aria-selected', true);
  6778. }
  6779. Util.reflow(element);
  6780. if (element.classList.contains(ClassName$9.FADE)) {
  6781. element.classList.add(ClassName$9.SHOW);
  6782. }
  6783. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  6784. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  6785. if (dropdownElement) {
  6786. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  6787. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  6788. }
  6789. element.setAttribute('aria-expanded', true);
  6790. }
  6791. if (callback) {
  6792. callback();
  6793. }
  6794. } // Static
  6795. ;
  6796. Tab._jQueryInterface = function _jQueryInterface(config) {
  6797. return this.each(function () {
  6798. var $this = $(this);
  6799. var data = $this.data(DATA_KEY$9);
  6800. if (!data) {
  6801. data = new Tab(this);
  6802. $this.data(DATA_KEY$9, data);
  6803. }
  6804. if (typeof config === 'string') {
  6805. if (typeof data[config] === 'undefined') {
  6806. throw new TypeError("No method named \"" + config + "\"");
  6807. }
  6808. data[config]();
  6809. }
  6810. });
  6811. };
  6812. _createClass(Tab, null, [{
  6813. key: "VERSION",
  6814. get: function get() {
  6815. return VERSION$9;
  6816. }
  6817. }]);
  6818. return Tab;
  6819. }();
  6820. /**
  6821. * ------------------------------------------------------------------------
  6822. * Data Api implementation
  6823. * ------------------------------------------------------------------------
  6824. */
  6825. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  6826. event.preventDefault();
  6827. Tab._jQueryInterface.call($(this), 'show');
  6828. });
  6829. /**
  6830. * ------------------------------------------------------------------------
  6831. * jQuery
  6832. * ------------------------------------------------------------------------
  6833. */
  6834. $.fn[NAME$9] = Tab._jQueryInterface;
  6835. $.fn[NAME$9].Constructor = Tab;
  6836. $.fn[NAME$9].noConflict = function () {
  6837. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6838. return Tab._jQueryInterface;
  6839. };
  6840. /**
  6841. * ------------------------------------------------------------------------
  6842. * Constants
  6843. * ------------------------------------------------------------------------
  6844. */
  6845. var NAME$a = 'toast';
  6846. var VERSION$a = '4.4.1';
  6847. var DATA_KEY$a = 'bs.toast';
  6848. var EVENT_KEY$a = "." + DATA_KEY$a;
  6849. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6850. var Event$a = {
  6851. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6852. HIDE: "hide" + EVENT_KEY$a,
  6853. HIDDEN: "hidden" + EVENT_KEY$a,
  6854. SHOW: "show" + EVENT_KEY$a,
  6855. SHOWN: "shown" + EVENT_KEY$a
  6856. };
  6857. var ClassName$a = {
  6858. FADE: 'fade',
  6859. HIDE: 'hide',
  6860. SHOW: 'show',
  6861. SHOWING: 'showing'
  6862. };
  6863. var DefaultType$7 = {
  6864. animation: 'boolean',
  6865. autohide: 'boolean',
  6866. delay: 'number'
  6867. };
  6868. var Default$7 = {
  6869. animation: true,
  6870. autohide: true,
  6871. delay: 500
  6872. };
  6873. var Selector$a = {
  6874. DATA_DISMISS: '[data-dismiss="toast"]'
  6875. };
  6876. /**
  6877. * ------------------------------------------------------------------------
  6878. * Class Definition
  6879. * ------------------------------------------------------------------------
  6880. */
  6881. var Toast =
  6882. /*#__PURE__*/
  6883. function () {
  6884. function Toast(element, config) {
  6885. this._element = element;
  6886. this._config = this._getConfig(config);
  6887. this._timeout = null;
  6888. this._setListeners();
  6889. } // Getters
  6890. var _proto = Toast.prototype;
  6891. // Public
  6892. _proto.show = function show() {
  6893. var _this = this;
  6894. var showEvent = $.Event(Event$a.SHOW);
  6895. $(this._element).trigger(showEvent);
  6896. if (showEvent.isDefaultPrevented()) {
  6897. return;
  6898. }
  6899. if (this._config.animation) {
  6900. this._element.classList.add(ClassName$a.FADE);
  6901. }
  6902. var complete = function complete() {
  6903. _this._element.classList.remove(ClassName$a.SHOWING);
  6904. _this._element.classList.add(ClassName$a.SHOW);
  6905. $(_this._element).trigger(Event$a.SHOWN);
  6906. if (_this._config.autohide) {
  6907. _this._timeout = setTimeout(function () {
  6908. _this.hide();
  6909. }, _this._config.delay);
  6910. }
  6911. };
  6912. this._element.classList.remove(ClassName$a.HIDE);
  6913. Util.reflow(this._element);
  6914. this._element.classList.add(ClassName$a.SHOWING);
  6915. if (this._config.animation) {
  6916. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6917. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6918. } else {
  6919. complete();
  6920. }
  6921. };
  6922. _proto.hide = function hide() {
  6923. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6924. return;
  6925. }
  6926. var hideEvent = $.Event(Event$a.HIDE);
  6927. $(this._element).trigger(hideEvent);
  6928. if (hideEvent.isDefaultPrevented()) {
  6929. return;
  6930. }
  6931. this._close();
  6932. };
  6933. _proto.dispose = function dispose() {
  6934. clearTimeout(this._timeout);
  6935. this._timeout = null;
  6936. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6937. this._element.classList.remove(ClassName$a.SHOW);
  6938. }
  6939. $(this._element).off(Event$a.CLICK_DISMISS);
  6940. $.removeData(this._element, DATA_KEY$a);
  6941. this._element = null;
  6942. this._config = null;
  6943. } // Private
  6944. ;
  6945. _proto._getConfig = function _getConfig(config) {
  6946. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6947. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6948. return config;
  6949. };
  6950. _proto._setListeners = function _setListeners() {
  6951. var _this2 = this;
  6952. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6953. return _this2.hide();
  6954. });
  6955. };
  6956. _proto._close = function _close() {
  6957. var _this3 = this;
  6958. var complete = function complete() {
  6959. _this3._element.classList.add(ClassName$a.HIDE);
  6960. $(_this3._element).trigger(Event$a.HIDDEN);
  6961. };
  6962. this._element.classList.remove(ClassName$a.SHOW);
  6963. if (this._config.animation) {
  6964. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6965. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6966. } else {
  6967. complete();
  6968. }
  6969. } // Static
  6970. ;
  6971. Toast._jQueryInterface = function _jQueryInterface(config) {
  6972. return this.each(function () {
  6973. var $element = $(this);
  6974. var data = $element.data(DATA_KEY$a);
  6975. var _config = typeof config === 'object' && config;
  6976. if (!data) {
  6977. data = new Toast(this, _config);
  6978. $element.data(DATA_KEY$a, data);
  6979. }
  6980. if (typeof config === 'string') {
  6981. if (typeof data[config] === 'undefined') {
  6982. throw new TypeError("No method named \"" + config + "\"");
  6983. }
  6984. data[config](this);
  6985. }
  6986. });
  6987. };
  6988. _createClass(Toast, null, [{
  6989. key: "VERSION",
  6990. get: function get() {
  6991. return VERSION$a;
  6992. }
  6993. }, {
  6994. key: "DefaultType",
  6995. get: function get() {
  6996. return DefaultType$7;
  6997. }
  6998. }, {
  6999. key: "Default",
  7000. get: function get() {
  7001. return Default$7;
  7002. }
  7003. }]);
  7004. return Toast;
  7005. }();
  7006. /**
  7007. * ------------------------------------------------------------------------
  7008. * jQuery
  7009. * ------------------------------------------------------------------------
  7010. */
  7011. $.fn[NAME$a] = Toast._jQueryInterface;
  7012. $.fn[NAME$a].Constructor = Toast;
  7013. $.fn[NAME$a].noConflict = function () {
  7014. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  7015. return Toast._jQueryInterface;
  7016. };
  7017. exports.Alert = Alert;
  7018. exports.Button = Button;
  7019. exports.Carousel = Carousel;
  7020. exports.Collapse = Collapse;
  7021. exports.Dropdown = Dropdown;
  7022. exports.Modal = Modal;
  7023. exports.Popover = Popover;
  7024. exports.Scrollspy = ScrollSpy;
  7025. exports.Tab = Tab;
  7026. exports.Toast = Toast;
  7027. exports.Tooltip = Tooltip;
  7028. exports.Util = Util;
  7029. Object.defineProperty(exports, '__esModule', { value: true });
  7030. })));
  7031. //# sourceMappingURL=bootstrap.js.map
  7032. /***/ }),
  7033. /***/ "./node_modules/buffer/index.js":
  7034. /*!**************************************!*\
  7035. !*** ./node_modules/buffer/index.js ***!
  7036. \**************************************/
  7037. /*! no static exports found */
  7038. /***/ (function(module, exports, __webpack_require__) {
  7039. "use strict";
  7040. /* WEBPACK VAR INJECTION */(function(global) {/*!
  7041. * The buffer module from node.js, for the browser.
  7042. *
  7043. * @author Feross Aboukhadijeh <http://feross.org>
  7044. * @license MIT
  7045. */
  7046. /* eslint-disable no-proto */
  7047. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  7048. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  7049. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  7050. exports.Buffer = Buffer
  7051. exports.SlowBuffer = SlowBuffer
  7052. exports.INSPECT_MAX_BYTES = 50
  7053. /**
  7054. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  7055. * === true Use Uint8Array implementation (fastest)
  7056. * === false Use Object implementation (most compatible, even IE6)
  7057. *
  7058. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  7059. * Opera 11.6+, iOS 4.2+.
  7060. *
  7061. * Due to various browser bugs, sometimes the Object implementation will be used even
  7062. * when the browser supports typed arrays.
  7063. *
  7064. * Note:
  7065. *
  7066. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  7067. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  7068. *
  7069. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  7070. *
  7071. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  7072. * incorrect length in some situations.
  7073. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  7074. * get the Object implementation, which is slower but behaves correctly.
  7075. */
  7076. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  7077. ? global.TYPED_ARRAY_SUPPORT
  7078. : typedArraySupport()
  7079. /*
  7080. * Export kMaxLength after typed array support is determined.
  7081. */
  7082. exports.kMaxLength = kMaxLength()
  7083. function typedArraySupport () {
  7084. try {
  7085. var arr = new Uint8Array(1)
  7086. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  7087. return arr.foo() === 42 && // typed array instances can be augmented
  7088. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  7089. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  7090. } catch (e) {
  7091. return false
  7092. }
  7093. }
  7094. function kMaxLength () {
  7095. return Buffer.TYPED_ARRAY_SUPPORT
  7096. ? 0x7fffffff
  7097. : 0x3fffffff
  7098. }
  7099. function createBuffer (that, length) {
  7100. if (kMaxLength() < length) {
  7101. throw new RangeError('Invalid typed array length')
  7102. }
  7103. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7104. // Return an augmented `Uint8Array` instance, for best performance
  7105. that = new Uint8Array(length)
  7106. that.__proto__ = Buffer.prototype
  7107. } else {
  7108. // Fallback: Return an object instance of the Buffer class
  7109. if (that === null) {
  7110. that = new Buffer(length)
  7111. }
  7112. that.length = length
  7113. }
  7114. return that
  7115. }
  7116. /**
  7117. * The Buffer constructor returns instances of `Uint8Array` that have their
  7118. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  7119. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  7120. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  7121. * returns a single octet.
  7122. *
  7123. * The `Uint8Array` prototype remains unmodified.
  7124. */
  7125. function Buffer (arg, encodingOrOffset, length) {
  7126. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  7127. return new Buffer(arg, encodingOrOffset, length)
  7128. }
  7129. // Common case.
  7130. if (typeof arg === 'number') {
  7131. if (typeof encodingOrOffset === 'string') {
  7132. throw new Error(
  7133. 'If encoding is specified then the first argument must be a string'
  7134. )
  7135. }
  7136. return allocUnsafe(this, arg)
  7137. }
  7138. return from(this, arg, encodingOrOffset, length)
  7139. }
  7140. Buffer.poolSize = 8192 // not used by this implementation
  7141. // TODO: Legacy, not needed anymore. Remove in next major version.
  7142. Buffer._augment = function (arr) {
  7143. arr.__proto__ = Buffer.prototype
  7144. return arr
  7145. }
  7146. function from (that, value, encodingOrOffset, length) {
  7147. if (typeof value === 'number') {
  7148. throw new TypeError('"value" argument must not be a number')
  7149. }
  7150. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  7151. return fromArrayBuffer(that, value, encodingOrOffset, length)
  7152. }
  7153. if (typeof value === 'string') {
  7154. return fromString(that, value, encodingOrOffset)
  7155. }
  7156. return fromObject(that, value)
  7157. }
  7158. /**
  7159. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  7160. * if value is a number.
  7161. * Buffer.from(str[, encoding])
  7162. * Buffer.from(array)
  7163. * Buffer.from(buffer)
  7164. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  7165. **/
  7166. Buffer.from = function (value, encodingOrOffset, length) {
  7167. return from(null, value, encodingOrOffset, length)
  7168. }
  7169. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7170. Buffer.prototype.__proto__ = Uint8Array.prototype
  7171. Buffer.__proto__ = Uint8Array
  7172. if (typeof Symbol !== 'undefined' && Symbol.species &&
  7173. Buffer[Symbol.species] === Buffer) {
  7174. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  7175. Object.defineProperty(Buffer, Symbol.species, {
  7176. value: null,
  7177. configurable: true
  7178. })
  7179. }
  7180. }
  7181. function assertSize (size) {
  7182. if (typeof size !== 'number') {
  7183. throw new TypeError('"size" argument must be a number')
  7184. } else if (size < 0) {
  7185. throw new RangeError('"size" argument must not be negative')
  7186. }
  7187. }
  7188. function alloc (that, size, fill, encoding) {
  7189. assertSize(size)
  7190. if (size <= 0) {
  7191. return createBuffer(that, size)
  7192. }
  7193. if (fill !== undefined) {
  7194. // Only pay attention to encoding if it's a string. This
  7195. // prevents accidentally sending in a number that would
  7196. // be interpretted as a start offset.
  7197. return typeof encoding === 'string'
  7198. ? createBuffer(that, size).fill(fill, encoding)
  7199. : createBuffer(that, size).fill(fill)
  7200. }
  7201. return createBuffer(that, size)
  7202. }
  7203. /**
  7204. * Creates a new filled Buffer instance.
  7205. * alloc(size[, fill[, encoding]])
  7206. **/
  7207. Buffer.alloc = function (size, fill, encoding) {
  7208. return alloc(null, size, fill, encoding)
  7209. }
  7210. function allocUnsafe (that, size) {
  7211. assertSize(size)
  7212. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  7213. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  7214. for (var i = 0; i < size; ++i) {
  7215. that[i] = 0
  7216. }
  7217. }
  7218. return that
  7219. }
  7220. /**
  7221. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  7222. * */
  7223. Buffer.allocUnsafe = function (size) {
  7224. return allocUnsafe(null, size)
  7225. }
  7226. /**
  7227. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  7228. */
  7229. Buffer.allocUnsafeSlow = function (size) {
  7230. return allocUnsafe(null, size)
  7231. }
  7232. function fromString (that, string, encoding) {
  7233. if (typeof encoding !== 'string' || encoding === '') {
  7234. encoding = 'utf8'
  7235. }
  7236. if (!Buffer.isEncoding(encoding)) {
  7237. throw new TypeError('"encoding" must be a valid string encoding')
  7238. }
  7239. var length = byteLength(string, encoding) | 0
  7240. that = createBuffer(that, length)
  7241. var actual = that.write(string, encoding)
  7242. if (actual !== length) {
  7243. // Writing a hex string, for example, that contains invalid characters will
  7244. // cause everything after the first invalid character to be ignored. (e.g.
  7245. // 'abxxcd' will be treated as 'ab')
  7246. that = that.slice(0, actual)
  7247. }
  7248. return that
  7249. }
  7250. function fromArrayLike (that, array) {
  7251. var length = array.length < 0 ? 0 : checked(array.length) | 0
  7252. that = createBuffer(that, length)
  7253. for (var i = 0; i < length; i += 1) {
  7254. that[i] = array[i] & 255
  7255. }
  7256. return that
  7257. }
  7258. function fromArrayBuffer (that, array, byteOffset, length) {
  7259. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  7260. if (byteOffset < 0 || array.byteLength < byteOffset) {
  7261. throw new RangeError('\'offset\' is out of bounds')
  7262. }
  7263. if (array.byteLength < byteOffset + (length || 0)) {
  7264. throw new RangeError('\'length\' is out of bounds')
  7265. }
  7266. if (byteOffset === undefined && length === undefined) {
  7267. array = new Uint8Array(array)
  7268. } else if (length === undefined) {
  7269. array = new Uint8Array(array, byteOffset)
  7270. } else {
  7271. array = new Uint8Array(array, byteOffset, length)
  7272. }
  7273. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7274. // Return an augmented `Uint8Array` instance, for best performance
  7275. that = array
  7276. that.__proto__ = Buffer.prototype
  7277. } else {
  7278. // Fallback: Return an object instance of the Buffer class
  7279. that = fromArrayLike(that, array)
  7280. }
  7281. return that
  7282. }
  7283. function fromObject (that, obj) {
  7284. if (Buffer.isBuffer(obj)) {
  7285. var len = checked(obj.length) | 0
  7286. that = createBuffer(that, len)
  7287. if (that.length === 0) {
  7288. return that
  7289. }
  7290. obj.copy(that, 0, 0, len)
  7291. return that
  7292. }
  7293. if (obj) {
  7294. if ((typeof ArrayBuffer !== 'undefined' &&
  7295. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  7296. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  7297. return createBuffer(that, 0)
  7298. }
  7299. return fromArrayLike(that, obj)
  7300. }
  7301. if (obj.type === 'Buffer' && isArray(obj.data)) {
  7302. return fromArrayLike(that, obj.data)
  7303. }
  7304. }
  7305. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  7306. }
  7307. function checked (length) {
  7308. // Note: cannot use `length < kMaxLength()` here because that fails when
  7309. // length is NaN (which is otherwise coerced to zero.)
  7310. if (length >= kMaxLength()) {
  7311. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  7312. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  7313. }
  7314. return length | 0
  7315. }
  7316. function SlowBuffer (length) {
  7317. if (+length != length) { // eslint-disable-line eqeqeq
  7318. length = 0
  7319. }
  7320. return Buffer.alloc(+length)
  7321. }
  7322. Buffer.isBuffer = function isBuffer (b) {
  7323. return !!(b != null && b._isBuffer)
  7324. }
  7325. Buffer.compare = function compare (a, b) {
  7326. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  7327. throw new TypeError('Arguments must be Buffers')
  7328. }
  7329. if (a === b) return 0
  7330. var x = a.length
  7331. var y = b.length
  7332. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  7333. if (a[i] !== b[i]) {
  7334. x = a[i]
  7335. y = b[i]
  7336. break
  7337. }
  7338. }
  7339. if (x < y) return -1
  7340. if (y < x) return 1
  7341. return 0
  7342. }
  7343. Buffer.isEncoding = function isEncoding (encoding) {
  7344. switch (String(encoding).toLowerCase()) {
  7345. case 'hex':
  7346. case 'utf8':
  7347. case 'utf-8':
  7348. case 'ascii':
  7349. case 'latin1':
  7350. case 'binary':
  7351. case 'base64':
  7352. case 'ucs2':
  7353. case 'ucs-2':
  7354. case 'utf16le':
  7355. case 'utf-16le':
  7356. return true
  7357. default:
  7358. return false
  7359. }
  7360. }
  7361. Buffer.concat = function concat (list, length) {
  7362. if (!isArray(list)) {
  7363. throw new TypeError('"list" argument must be an Array of Buffers')
  7364. }
  7365. if (list.length === 0) {
  7366. return Buffer.alloc(0)
  7367. }
  7368. var i
  7369. if (length === undefined) {
  7370. length = 0
  7371. for (i = 0; i < list.length; ++i) {
  7372. length += list[i].length
  7373. }
  7374. }
  7375. var buffer = Buffer.allocUnsafe(length)
  7376. var pos = 0
  7377. for (i = 0; i < list.length; ++i) {
  7378. var buf = list[i]
  7379. if (!Buffer.isBuffer(buf)) {
  7380. throw new TypeError('"list" argument must be an Array of Buffers')
  7381. }
  7382. buf.copy(buffer, pos)
  7383. pos += buf.length
  7384. }
  7385. return buffer
  7386. }
  7387. function byteLength (string, encoding) {
  7388. if (Buffer.isBuffer(string)) {
  7389. return string.length
  7390. }
  7391. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  7392. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  7393. return string.byteLength
  7394. }
  7395. if (typeof string !== 'string') {
  7396. string = '' + string
  7397. }
  7398. var len = string.length
  7399. if (len === 0) return 0
  7400. // Use a for loop to avoid recursion
  7401. var loweredCase = false
  7402. for (;;) {
  7403. switch (encoding) {
  7404. case 'ascii':
  7405. case 'latin1':
  7406. case 'binary':
  7407. return len
  7408. case 'utf8':
  7409. case 'utf-8':
  7410. case undefined:
  7411. return utf8ToBytes(string).length
  7412. case 'ucs2':
  7413. case 'ucs-2':
  7414. case 'utf16le':
  7415. case 'utf-16le':
  7416. return len * 2
  7417. case 'hex':
  7418. return len >>> 1
  7419. case 'base64':
  7420. return base64ToBytes(string).length
  7421. default:
  7422. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  7423. encoding = ('' + encoding).toLowerCase()
  7424. loweredCase = true
  7425. }
  7426. }
  7427. }
  7428. Buffer.byteLength = byteLength
  7429. function slowToString (encoding, start, end) {
  7430. var loweredCase = false
  7431. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  7432. // property of a typed array.
  7433. // This behaves neither like String nor Uint8Array in that we set start/end
  7434. // to their upper/lower bounds if the value passed is out of range.
  7435. // undefined is handled specially as per ECMA-262 6th Edition,
  7436. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  7437. if (start === undefined || start < 0) {
  7438. start = 0
  7439. }
  7440. // Return early if start > this.length. Done here to prevent potential uint32
  7441. // coercion fail below.
  7442. if (start > this.length) {
  7443. return ''
  7444. }
  7445. if (end === undefined || end > this.length) {
  7446. end = this.length
  7447. }
  7448. if (end <= 0) {
  7449. return ''
  7450. }
  7451. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  7452. end >>>= 0
  7453. start >>>= 0
  7454. if (end <= start) {
  7455. return ''
  7456. }
  7457. if (!encoding) encoding = 'utf8'
  7458. while (true) {
  7459. switch (encoding) {
  7460. case 'hex':
  7461. return hexSlice(this, start, end)
  7462. case 'utf8':
  7463. case 'utf-8':
  7464. return utf8Slice(this, start, end)
  7465. case 'ascii':
  7466. return asciiSlice(this, start, end)
  7467. case 'latin1':
  7468. case 'binary':
  7469. return latin1Slice(this, start, end)
  7470. case 'base64':
  7471. return base64Slice(this, start, end)
  7472. case 'ucs2':
  7473. case 'ucs-2':
  7474. case 'utf16le':
  7475. case 'utf-16le':
  7476. return utf16leSlice(this, start, end)
  7477. default:
  7478. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7479. encoding = (encoding + '').toLowerCase()
  7480. loweredCase = true
  7481. }
  7482. }
  7483. }
  7484. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  7485. // Buffer instances.
  7486. Buffer.prototype._isBuffer = true
  7487. function swap (b, n, m) {
  7488. var i = b[n]
  7489. b[n] = b[m]
  7490. b[m] = i
  7491. }
  7492. Buffer.prototype.swap16 = function swap16 () {
  7493. var len = this.length
  7494. if (len % 2 !== 0) {
  7495. throw new RangeError('Buffer size must be a multiple of 16-bits')
  7496. }
  7497. for (var i = 0; i < len; i += 2) {
  7498. swap(this, i, i + 1)
  7499. }
  7500. return this
  7501. }
  7502. Buffer.prototype.swap32 = function swap32 () {
  7503. var len = this.length
  7504. if (len % 4 !== 0) {
  7505. throw new RangeError('Buffer size must be a multiple of 32-bits')
  7506. }
  7507. for (var i = 0; i < len; i += 4) {
  7508. swap(this, i, i + 3)
  7509. swap(this, i + 1, i + 2)
  7510. }
  7511. return this
  7512. }
  7513. Buffer.prototype.swap64 = function swap64 () {
  7514. var len = this.length
  7515. if (len % 8 !== 0) {
  7516. throw new RangeError('Buffer size must be a multiple of 64-bits')
  7517. }
  7518. for (var i = 0; i < len; i += 8) {
  7519. swap(this, i, i + 7)
  7520. swap(this, i + 1, i + 6)
  7521. swap(this, i + 2, i + 5)
  7522. swap(this, i + 3, i + 4)
  7523. }
  7524. return this
  7525. }
  7526. Buffer.prototype.toString = function toString () {
  7527. var length = this.length | 0
  7528. if (length === 0) return ''
  7529. if (arguments.length === 0) return utf8Slice(this, 0, length)
  7530. return slowToString.apply(this, arguments)
  7531. }
  7532. Buffer.prototype.equals = function equals (b) {
  7533. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  7534. if (this === b) return true
  7535. return Buffer.compare(this, b) === 0
  7536. }
  7537. Buffer.prototype.inspect = function inspect () {
  7538. var str = ''
  7539. var max = exports.INSPECT_MAX_BYTES
  7540. if (this.length > 0) {
  7541. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  7542. if (this.length > max) str += ' ... '
  7543. }
  7544. return '<Buffer ' + str + '>'
  7545. }
  7546. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  7547. if (!Buffer.isBuffer(target)) {
  7548. throw new TypeError('Argument must be a Buffer')
  7549. }
  7550. if (start === undefined) {
  7551. start = 0
  7552. }
  7553. if (end === undefined) {
  7554. end = target ? target.length : 0
  7555. }
  7556. if (thisStart === undefined) {
  7557. thisStart = 0
  7558. }
  7559. if (thisEnd === undefined) {
  7560. thisEnd = this.length
  7561. }
  7562. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  7563. throw new RangeError('out of range index')
  7564. }
  7565. if (thisStart >= thisEnd && start >= end) {
  7566. return 0
  7567. }
  7568. if (thisStart >= thisEnd) {
  7569. return -1
  7570. }
  7571. if (start >= end) {
  7572. return 1
  7573. }
  7574. start >>>= 0
  7575. end >>>= 0
  7576. thisStart >>>= 0
  7577. thisEnd >>>= 0
  7578. if (this === target) return 0
  7579. var x = thisEnd - thisStart
  7580. var y = end - start
  7581. var len = Math.min(x, y)
  7582. var thisCopy = this.slice(thisStart, thisEnd)
  7583. var targetCopy = target.slice(start, end)
  7584. for (var i = 0; i < len; ++i) {
  7585. if (thisCopy[i] !== targetCopy[i]) {
  7586. x = thisCopy[i]
  7587. y = targetCopy[i]
  7588. break
  7589. }
  7590. }
  7591. if (x < y) return -1
  7592. if (y < x) return 1
  7593. return 0
  7594. }
  7595. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  7596. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  7597. //
  7598. // Arguments:
  7599. // - buffer - a Buffer to search
  7600. // - val - a string, Buffer, or number
  7601. // - byteOffset - an index into `buffer`; will be clamped to an int32
  7602. // - encoding - an optional encoding, relevant is val is a string
  7603. // - dir - true for indexOf, false for lastIndexOf
  7604. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  7605. // Empty buffer means no match
  7606. if (buffer.length === 0) return -1
  7607. // Normalize byteOffset
  7608. if (typeof byteOffset === 'string') {
  7609. encoding = byteOffset
  7610. byteOffset = 0
  7611. } else if (byteOffset > 0x7fffffff) {
  7612. byteOffset = 0x7fffffff
  7613. } else if (byteOffset < -0x80000000) {
  7614. byteOffset = -0x80000000
  7615. }
  7616. byteOffset = +byteOffset // Coerce to Number.
  7617. if (isNaN(byteOffset)) {
  7618. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  7619. byteOffset = dir ? 0 : (buffer.length - 1)
  7620. }
  7621. // Normalize byteOffset: negative offsets start from the end of the buffer
  7622. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  7623. if (byteOffset >= buffer.length) {
  7624. if (dir) return -1
  7625. else byteOffset = buffer.length - 1
  7626. } else if (byteOffset < 0) {
  7627. if (dir) byteOffset = 0
  7628. else return -1
  7629. }
  7630. // Normalize val
  7631. if (typeof val === 'string') {
  7632. val = Buffer.from(val, encoding)
  7633. }
  7634. // Finally, search either indexOf (if dir is true) or lastIndexOf
  7635. if (Buffer.isBuffer(val)) {
  7636. // Special case: looking for empty string/buffer always fails
  7637. if (val.length === 0) {
  7638. return -1
  7639. }
  7640. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  7641. } else if (typeof val === 'number') {
  7642. val = val & 0xFF // Search for a byte value [0-255]
  7643. if (Buffer.TYPED_ARRAY_SUPPORT &&
  7644. typeof Uint8Array.prototype.indexOf === 'function') {
  7645. if (dir) {
  7646. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  7647. } else {
  7648. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  7649. }
  7650. }
  7651. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  7652. }
  7653. throw new TypeError('val must be string, number or Buffer')
  7654. }
  7655. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  7656. var indexSize = 1
  7657. var arrLength = arr.length
  7658. var valLength = val.length
  7659. if (encoding !== undefined) {
  7660. encoding = String(encoding).toLowerCase()
  7661. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  7662. encoding === 'utf16le' || encoding === 'utf-16le') {
  7663. if (arr.length < 2 || val.length < 2) {
  7664. return -1
  7665. }
  7666. indexSize = 2
  7667. arrLength /= 2
  7668. valLength /= 2
  7669. byteOffset /= 2
  7670. }
  7671. }
  7672. function read (buf, i) {
  7673. if (indexSize === 1) {
  7674. return buf[i]
  7675. } else {
  7676. return buf.readUInt16BE(i * indexSize)
  7677. }
  7678. }
  7679. var i
  7680. if (dir) {
  7681. var foundIndex = -1
  7682. for (i = byteOffset; i < arrLength; i++) {
  7683. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  7684. if (foundIndex === -1) foundIndex = i
  7685. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  7686. } else {
  7687. if (foundIndex !== -1) i -= i - foundIndex
  7688. foundIndex = -1
  7689. }
  7690. }
  7691. } else {
  7692. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  7693. for (i = byteOffset; i >= 0; i--) {
  7694. var found = true
  7695. for (var j = 0; j < valLength; j++) {
  7696. if (read(arr, i + j) !== read(val, j)) {
  7697. found = false
  7698. break
  7699. }
  7700. }
  7701. if (found) return i
  7702. }
  7703. }
  7704. return -1
  7705. }
  7706. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  7707. return this.indexOf(val, byteOffset, encoding) !== -1
  7708. }
  7709. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  7710. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  7711. }
  7712. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  7713. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  7714. }
  7715. function hexWrite (buf, string, offset, length) {
  7716. offset = Number(offset) || 0
  7717. var remaining = buf.length - offset
  7718. if (!length) {
  7719. length = remaining
  7720. } else {
  7721. length = Number(length)
  7722. if (length > remaining) {
  7723. length = remaining
  7724. }
  7725. }
  7726. // must be an even number of digits
  7727. var strLen = string.length
  7728. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  7729. if (length > strLen / 2) {
  7730. length = strLen / 2
  7731. }
  7732. for (var i = 0; i < length; ++i) {
  7733. var parsed = parseInt(string.substr(i * 2, 2), 16)
  7734. if (isNaN(parsed)) return i
  7735. buf[offset + i] = parsed
  7736. }
  7737. return i
  7738. }
  7739. function utf8Write (buf, string, offset, length) {
  7740. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  7741. }
  7742. function asciiWrite (buf, string, offset, length) {
  7743. return blitBuffer(asciiToBytes(string), buf, offset, length)
  7744. }
  7745. function latin1Write (buf, string, offset, length) {
  7746. return asciiWrite(buf, string, offset, length)
  7747. }
  7748. function base64Write (buf, string, offset, length) {
  7749. return blitBuffer(base64ToBytes(string), buf, offset, length)
  7750. }
  7751. function ucs2Write (buf, string, offset, length) {
  7752. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  7753. }
  7754. Buffer.prototype.write = function write (string, offset, length, encoding) {
  7755. // Buffer#write(string)
  7756. if (offset === undefined) {
  7757. encoding = 'utf8'
  7758. length = this.length
  7759. offset = 0
  7760. // Buffer#write(string, encoding)
  7761. } else if (length === undefined && typeof offset === 'string') {
  7762. encoding = offset
  7763. length = this.length
  7764. offset = 0
  7765. // Buffer#write(string, offset[, length][, encoding])
  7766. } else if (isFinite(offset)) {
  7767. offset = offset | 0
  7768. if (isFinite(length)) {
  7769. length = length | 0
  7770. if (encoding === undefined) encoding = 'utf8'
  7771. } else {
  7772. encoding = length
  7773. length = undefined
  7774. }
  7775. // legacy write(string, encoding, offset, length) - remove in v0.13
  7776. } else {
  7777. throw new Error(
  7778. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  7779. )
  7780. }
  7781. var remaining = this.length - offset
  7782. if (length === undefined || length > remaining) length = remaining
  7783. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  7784. throw new RangeError('Attempt to write outside buffer bounds')
  7785. }
  7786. if (!encoding) encoding = 'utf8'
  7787. var loweredCase = false
  7788. for (;;) {
  7789. switch (encoding) {
  7790. case 'hex':
  7791. return hexWrite(this, string, offset, length)
  7792. case 'utf8':
  7793. case 'utf-8':
  7794. return utf8Write(this, string, offset, length)
  7795. case 'ascii':
  7796. return asciiWrite(this, string, offset, length)
  7797. case 'latin1':
  7798. case 'binary':
  7799. return latin1Write(this, string, offset, length)
  7800. case 'base64':
  7801. // Warning: maxLength not taken into account in base64Write
  7802. return base64Write(this, string, offset, length)
  7803. case 'ucs2':
  7804. case 'ucs-2':
  7805. case 'utf16le':
  7806. case 'utf-16le':
  7807. return ucs2Write(this, string, offset, length)
  7808. default:
  7809. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7810. encoding = ('' + encoding).toLowerCase()
  7811. loweredCase = true
  7812. }
  7813. }
  7814. }
  7815. Buffer.prototype.toJSON = function toJSON () {
  7816. return {
  7817. type: 'Buffer',
  7818. data: Array.prototype.slice.call(this._arr || this, 0)
  7819. }
  7820. }
  7821. function base64Slice (buf, start, end) {
  7822. if (start === 0 && end === buf.length) {
  7823. return base64.fromByteArray(buf)
  7824. } else {
  7825. return base64.fromByteArray(buf.slice(start, end))
  7826. }
  7827. }
  7828. function utf8Slice (buf, start, end) {
  7829. end = Math.min(buf.length, end)
  7830. var res = []
  7831. var i = start
  7832. while (i < end) {
  7833. var firstByte = buf[i]
  7834. var codePoint = null
  7835. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7836. : (firstByte > 0xDF) ? 3
  7837. : (firstByte > 0xBF) ? 2
  7838. : 1
  7839. if (i + bytesPerSequence <= end) {
  7840. var secondByte, thirdByte, fourthByte, tempCodePoint
  7841. switch (bytesPerSequence) {
  7842. case 1:
  7843. if (firstByte < 0x80) {
  7844. codePoint = firstByte
  7845. }
  7846. break
  7847. case 2:
  7848. secondByte = buf[i + 1]
  7849. if ((secondByte & 0xC0) === 0x80) {
  7850. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7851. if (tempCodePoint > 0x7F) {
  7852. codePoint = tempCodePoint
  7853. }
  7854. }
  7855. break
  7856. case 3:
  7857. secondByte = buf[i + 1]
  7858. thirdByte = buf[i + 2]
  7859. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7860. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7861. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7862. codePoint = tempCodePoint
  7863. }
  7864. }
  7865. break
  7866. case 4:
  7867. secondByte = buf[i + 1]
  7868. thirdByte = buf[i + 2]
  7869. fourthByte = buf[i + 3]
  7870. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7871. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7872. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7873. codePoint = tempCodePoint
  7874. }
  7875. }
  7876. }
  7877. }
  7878. if (codePoint === null) {
  7879. // we did not generate a valid codePoint so insert a
  7880. // replacement char (U+FFFD) and advance only 1 byte
  7881. codePoint = 0xFFFD
  7882. bytesPerSequence = 1
  7883. } else if (codePoint > 0xFFFF) {
  7884. // encode to utf16 (surrogate pair dance)
  7885. codePoint -= 0x10000
  7886. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7887. codePoint = 0xDC00 | codePoint & 0x3FF
  7888. }
  7889. res.push(codePoint)
  7890. i += bytesPerSequence
  7891. }
  7892. return decodeCodePointsArray(res)
  7893. }
  7894. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7895. // the lowest limit is Chrome, with 0x10000 args.
  7896. // We go 1 magnitude less, for safety
  7897. var MAX_ARGUMENTS_LENGTH = 0x1000
  7898. function decodeCodePointsArray (codePoints) {
  7899. var len = codePoints.length
  7900. if (len <= MAX_ARGUMENTS_LENGTH) {
  7901. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7902. }
  7903. // Decode in chunks to avoid "call stack size exceeded".
  7904. var res = ''
  7905. var i = 0
  7906. while (i < len) {
  7907. res += String.fromCharCode.apply(
  7908. String,
  7909. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7910. )
  7911. }
  7912. return res
  7913. }
  7914. function asciiSlice (buf, start, end) {
  7915. var ret = ''
  7916. end = Math.min(buf.length, end)
  7917. for (var i = start; i < end; ++i) {
  7918. ret += String.fromCharCode(buf[i] & 0x7F)
  7919. }
  7920. return ret
  7921. }
  7922. function latin1Slice (buf, start, end) {
  7923. var ret = ''
  7924. end = Math.min(buf.length, end)
  7925. for (var i = start; i < end; ++i) {
  7926. ret += String.fromCharCode(buf[i])
  7927. }
  7928. return ret
  7929. }
  7930. function hexSlice (buf, start, end) {
  7931. var len = buf.length
  7932. if (!start || start < 0) start = 0
  7933. if (!end || end < 0 || end > len) end = len
  7934. var out = ''
  7935. for (var i = start; i < end; ++i) {
  7936. out += toHex(buf[i])
  7937. }
  7938. return out
  7939. }
  7940. function utf16leSlice (buf, start, end) {
  7941. var bytes = buf.slice(start, end)
  7942. var res = ''
  7943. for (var i = 0; i < bytes.length; i += 2) {
  7944. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7945. }
  7946. return res
  7947. }
  7948. Buffer.prototype.slice = function slice (start, end) {
  7949. var len = this.length
  7950. start = ~~start
  7951. end = end === undefined ? len : ~~end
  7952. if (start < 0) {
  7953. start += len
  7954. if (start < 0) start = 0
  7955. } else if (start > len) {
  7956. start = len
  7957. }
  7958. if (end < 0) {
  7959. end += len
  7960. if (end < 0) end = 0
  7961. } else if (end > len) {
  7962. end = len
  7963. }
  7964. if (end < start) end = start
  7965. var newBuf
  7966. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7967. newBuf = this.subarray(start, end)
  7968. newBuf.__proto__ = Buffer.prototype
  7969. } else {
  7970. var sliceLen = end - start
  7971. newBuf = new Buffer(sliceLen, undefined)
  7972. for (var i = 0; i < sliceLen; ++i) {
  7973. newBuf[i] = this[i + start]
  7974. }
  7975. }
  7976. return newBuf
  7977. }
  7978. /*
  7979. * Need to make sure that buffer isn't trying to write out of bounds.
  7980. */
  7981. function checkOffset (offset, ext, length) {
  7982. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7983. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7984. }
  7985. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7986. offset = offset | 0
  7987. byteLength = byteLength | 0
  7988. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7989. var val = this[offset]
  7990. var mul = 1
  7991. var i = 0
  7992. while (++i < byteLength && (mul *= 0x100)) {
  7993. val += this[offset + i] * mul
  7994. }
  7995. return val
  7996. }
  7997. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7998. offset = offset | 0
  7999. byteLength = byteLength | 0
  8000. if (!noAssert) {
  8001. checkOffset(offset, byteLength, this.length)
  8002. }
  8003. var val = this[offset + --byteLength]
  8004. var mul = 1
  8005. while (byteLength > 0 && (mul *= 0x100)) {
  8006. val += this[offset + --byteLength] * mul
  8007. }
  8008. return val
  8009. }
  8010. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  8011. if (!noAssert) checkOffset(offset, 1, this.length)
  8012. return this[offset]
  8013. }
  8014. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  8015. if (!noAssert) checkOffset(offset, 2, this.length)
  8016. return this[offset] | (this[offset + 1] << 8)
  8017. }
  8018. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  8019. if (!noAssert) checkOffset(offset, 2, this.length)
  8020. return (this[offset] << 8) | this[offset + 1]
  8021. }
  8022. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  8023. if (!noAssert) checkOffset(offset, 4, this.length)
  8024. return ((this[offset]) |
  8025. (this[offset + 1] << 8) |
  8026. (this[offset + 2] << 16)) +
  8027. (this[offset + 3] * 0x1000000)
  8028. }
  8029. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  8030. if (!noAssert) checkOffset(offset, 4, this.length)
  8031. return (this[offset] * 0x1000000) +
  8032. ((this[offset + 1] << 16) |
  8033. (this[offset + 2] << 8) |
  8034. this[offset + 3])
  8035. }
  8036. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  8037. offset = offset | 0
  8038. byteLength = byteLength | 0
  8039. if (!noAssert) checkOffset(offset, byteLength, this.length)
  8040. var val = this[offset]
  8041. var mul = 1
  8042. var i = 0
  8043. while (++i < byteLength && (mul *= 0x100)) {
  8044. val += this[offset + i] * mul
  8045. }
  8046. mul *= 0x80
  8047. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  8048. return val
  8049. }
  8050. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  8051. offset = offset | 0
  8052. byteLength = byteLength | 0
  8053. if (!noAssert) checkOffset(offset, byteLength, this.length)
  8054. var i = byteLength
  8055. var mul = 1
  8056. var val = this[offset + --i]
  8057. while (i > 0 && (mul *= 0x100)) {
  8058. val += this[offset + --i] * mul
  8059. }
  8060. mul *= 0x80
  8061. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  8062. return val
  8063. }
  8064. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  8065. if (!noAssert) checkOffset(offset, 1, this.length)
  8066. if (!(this[offset] & 0x80)) return (this[offset])
  8067. return ((0xff - this[offset] + 1) * -1)
  8068. }
  8069. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  8070. if (!noAssert) checkOffset(offset, 2, this.length)
  8071. var val = this[offset] | (this[offset + 1] << 8)
  8072. return (val & 0x8000) ? val | 0xFFFF0000 : val
  8073. }
  8074. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  8075. if (!noAssert) checkOffset(offset, 2, this.length)
  8076. var val = this[offset + 1] | (this[offset] << 8)
  8077. return (val & 0x8000) ? val | 0xFFFF0000 : val
  8078. }
  8079. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  8080. if (!noAssert) checkOffset(offset, 4, this.length)
  8081. return (this[offset]) |
  8082. (this[offset + 1] << 8) |
  8083. (this[offset + 2] << 16) |
  8084. (this[offset + 3] << 24)
  8085. }
  8086. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  8087. if (!noAssert) checkOffset(offset, 4, this.length)
  8088. return (this[offset] << 24) |
  8089. (this[offset + 1] << 16) |
  8090. (this[offset + 2] << 8) |
  8091. (this[offset + 3])
  8092. }
  8093. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  8094. if (!noAssert) checkOffset(offset, 4, this.length)
  8095. return ieee754.read(this, offset, true, 23, 4)
  8096. }
  8097. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  8098. if (!noAssert) checkOffset(offset, 4, this.length)
  8099. return ieee754.read(this, offset, false, 23, 4)
  8100. }
  8101. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  8102. if (!noAssert) checkOffset(offset, 8, this.length)
  8103. return ieee754.read(this, offset, true, 52, 8)
  8104. }
  8105. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  8106. if (!noAssert) checkOffset(offset, 8, this.length)
  8107. return ieee754.read(this, offset, false, 52, 8)
  8108. }
  8109. function checkInt (buf, value, offset, ext, max, min) {
  8110. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  8111. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  8112. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  8113. }
  8114. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  8115. value = +value
  8116. offset = offset | 0
  8117. byteLength = byteLength | 0
  8118. if (!noAssert) {
  8119. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  8120. checkInt(this, value, offset, byteLength, maxBytes, 0)
  8121. }
  8122. var mul = 1
  8123. var i = 0
  8124. this[offset] = value & 0xFF
  8125. while (++i < byteLength && (mul *= 0x100)) {
  8126. this[offset + i] = (value / mul) & 0xFF
  8127. }
  8128. return offset + byteLength
  8129. }
  8130. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  8131. value = +value
  8132. offset = offset | 0
  8133. byteLength = byteLength | 0
  8134. if (!noAssert) {
  8135. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  8136. checkInt(this, value, offset, byteLength, maxBytes, 0)
  8137. }
  8138. var i = byteLength - 1
  8139. var mul = 1
  8140. this[offset + i] = value & 0xFF
  8141. while (--i >= 0 && (mul *= 0x100)) {
  8142. this[offset + i] = (value / mul) & 0xFF
  8143. }
  8144. return offset + byteLength
  8145. }
  8146. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  8147. value = +value
  8148. offset = offset | 0
  8149. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  8150. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  8151. this[offset] = (value & 0xff)
  8152. return offset + 1
  8153. }
  8154. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  8155. if (value < 0) value = 0xffff + value + 1
  8156. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  8157. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  8158. (littleEndian ? i : 1 - i) * 8
  8159. }
  8160. }
  8161. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  8162. value = +value
  8163. offset = offset | 0
  8164. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  8165. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8166. this[offset] = (value & 0xff)
  8167. this[offset + 1] = (value >>> 8)
  8168. } else {
  8169. objectWriteUInt16(this, value, offset, true)
  8170. }
  8171. return offset + 2
  8172. }
  8173. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  8174. value = +value
  8175. offset = offset | 0
  8176. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  8177. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8178. this[offset] = (value >>> 8)
  8179. this[offset + 1] = (value & 0xff)
  8180. } else {
  8181. objectWriteUInt16(this, value, offset, false)
  8182. }
  8183. return offset + 2
  8184. }
  8185. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  8186. if (value < 0) value = 0xffffffff + value + 1
  8187. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  8188. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  8189. }
  8190. }
  8191. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  8192. value = +value
  8193. offset = offset | 0
  8194. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8195. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8196. this[offset + 3] = (value >>> 24)
  8197. this[offset + 2] = (value >>> 16)
  8198. this[offset + 1] = (value >>> 8)
  8199. this[offset] = (value & 0xff)
  8200. } else {
  8201. objectWriteUInt32(this, value, offset, true)
  8202. }
  8203. return offset + 4
  8204. }
  8205. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  8206. value = +value
  8207. offset = offset | 0
  8208. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8209. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8210. this[offset] = (value >>> 24)
  8211. this[offset + 1] = (value >>> 16)
  8212. this[offset + 2] = (value >>> 8)
  8213. this[offset + 3] = (value & 0xff)
  8214. } else {
  8215. objectWriteUInt32(this, value, offset, false)
  8216. }
  8217. return offset + 4
  8218. }
  8219. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  8220. value = +value
  8221. offset = offset | 0
  8222. if (!noAssert) {
  8223. var limit = Math.pow(2, 8 * byteLength - 1)
  8224. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8225. }
  8226. var i = 0
  8227. var mul = 1
  8228. var sub = 0
  8229. this[offset] = value & 0xFF
  8230. while (++i < byteLength && (mul *= 0x100)) {
  8231. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  8232. sub = 1
  8233. }
  8234. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8235. }
  8236. return offset + byteLength
  8237. }
  8238. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  8239. value = +value
  8240. offset = offset | 0
  8241. if (!noAssert) {
  8242. var limit = Math.pow(2, 8 * byteLength - 1)
  8243. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8244. }
  8245. var i = byteLength - 1
  8246. var mul = 1
  8247. var sub = 0
  8248. this[offset + i] = value & 0xFF
  8249. while (--i >= 0 && (mul *= 0x100)) {
  8250. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  8251. sub = 1
  8252. }
  8253. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8254. }
  8255. return offset + byteLength
  8256. }
  8257. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  8258. value = +value
  8259. offset = offset | 0
  8260. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  8261. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  8262. if (value < 0) value = 0xff + value + 1
  8263. this[offset] = (value & 0xff)
  8264. return offset + 1
  8265. }
  8266. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  8267. value = +value
  8268. offset = offset | 0
  8269. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8270. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8271. this[offset] = (value & 0xff)
  8272. this[offset + 1] = (value >>> 8)
  8273. } else {
  8274. objectWriteUInt16(this, value, offset, true)
  8275. }
  8276. return offset + 2
  8277. }
  8278. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  8279. value = +value
  8280. offset = offset | 0
  8281. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8282. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8283. this[offset] = (value >>> 8)
  8284. this[offset + 1] = (value & 0xff)
  8285. } else {
  8286. objectWriteUInt16(this, value, offset, false)
  8287. }
  8288. return offset + 2
  8289. }
  8290. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  8291. value = +value
  8292. offset = offset | 0
  8293. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8294. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8295. this[offset] = (value & 0xff)
  8296. this[offset + 1] = (value >>> 8)
  8297. this[offset + 2] = (value >>> 16)
  8298. this[offset + 3] = (value >>> 24)
  8299. } else {
  8300. objectWriteUInt32(this, value, offset, true)
  8301. }
  8302. return offset + 4
  8303. }
  8304. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  8305. value = +value
  8306. offset = offset | 0
  8307. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8308. if (value < 0) value = 0xffffffff + value + 1
  8309. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8310. this[offset] = (value >>> 24)
  8311. this[offset + 1] = (value >>> 16)
  8312. this[offset + 2] = (value >>> 8)
  8313. this[offset + 3] = (value & 0xff)
  8314. } else {
  8315. objectWriteUInt32(this, value, offset, false)
  8316. }
  8317. return offset + 4
  8318. }
  8319. function checkIEEE754 (buf, value, offset, ext, max, min) {
  8320. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  8321. if (offset < 0) throw new RangeError('Index out of range')
  8322. }
  8323. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  8324. if (!noAssert) {
  8325. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  8326. }
  8327. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  8328. return offset + 4
  8329. }
  8330. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  8331. return writeFloat(this, value, offset, true, noAssert)
  8332. }
  8333. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  8334. return writeFloat(this, value, offset, false, noAssert)
  8335. }
  8336. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  8337. if (!noAssert) {
  8338. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  8339. }
  8340. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  8341. return offset + 8
  8342. }
  8343. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  8344. return writeDouble(this, value, offset, true, noAssert)
  8345. }
  8346. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  8347. return writeDouble(this, value, offset, false, noAssert)
  8348. }
  8349. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  8350. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  8351. if (!start) start = 0
  8352. if (!end && end !== 0) end = this.length
  8353. if (targetStart >= target.length) targetStart = target.length
  8354. if (!targetStart) targetStart = 0
  8355. if (end > 0 && end < start) end = start
  8356. // Copy 0 bytes; we're done
  8357. if (end === start) return 0
  8358. if (target.length === 0 || this.length === 0) return 0
  8359. // Fatal error conditions
  8360. if (targetStart < 0) {
  8361. throw new RangeError('targetStart out of bounds')
  8362. }
  8363. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  8364. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  8365. // Are we oob?
  8366. if (end > this.length) end = this.length
  8367. if (target.length - targetStart < end - start) {
  8368. end = target.length - targetStart + start
  8369. }
  8370. var len = end - start
  8371. var i
  8372. if (this === target && start < targetStart && targetStart < end) {
  8373. // descending copy from end
  8374. for (i = len - 1; i >= 0; --i) {
  8375. target[i + targetStart] = this[i + start]
  8376. }
  8377. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  8378. // ascending copy from start
  8379. for (i = 0; i < len; ++i) {
  8380. target[i + targetStart] = this[i + start]
  8381. }
  8382. } else {
  8383. Uint8Array.prototype.set.call(
  8384. target,
  8385. this.subarray(start, start + len),
  8386. targetStart
  8387. )
  8388. }
  8389. return len
  8390. }
  8391. // Usage:
  8392. // buffer.fill(number[, offset[, end]])
  8393. // buffer.fill(buffer[, offset[, end]])
  8394. // buffer.fill(string[, offset[, end]][, encoding])
  8395. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  8396. // Handle string cases:
  8397. if (typeof val === 'string') {
  8398. if (typeof start === 'string') {
  8399. encoding = start
  8400. start = 0
  8401. end = this.length
  8402. } else if (typeof end === 'string') {
  8403. encoding = end
  8404. end = this.length
  8405. }
  8406. if (val.length === 1) {
  8407. var code = val.charCodeAt(0)
  8408. if (code < 256) {
  8409. val = code
  8410. }
  8411. }
  8412. if (encoding !== undefined && typeof encoding !== 'string') {
  8413. throw new TypeError('encoding must be a string')
  8414. }
  8415. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  8416. throw new TypeError('Unknown encoding: ' + encoding)
  8417. }
  8418. } else if (typeof val === 'number') {
  8419. val = val & 255
  8420. }
  8421. // Invalid ranges are not set to a default, so can range check early.
  8422. if (start < 0 || this.length < start || this.length < end) {
  8423. throw new RangeError('Out of range index')
  8424. }
  8425. if (end <= start) {
  8426. return this
  8427. }
  8428. start = start >>> 0
  8429. end = end === undefined ? this.length : end >>> 0
  8430. if (!val) val = 0
  8431. var i
  8432. if (typeof val === 'number') {
  8433. for (i = start; i < end; ++i) {
  8434. this[i] = val
  8435. }
  8436. } else {
  8437. var bytes = Buffer.isBuffer(val)
  8438. ? val
  8439. : utf8ToBytes(new Buffer(val, encoding).toString())
  8440. var len = bytes.length
  8441. for (i = 0; i < end - start; ++i) {
  8442. this[i + start] = bytes[i % len]
  8443. }
  8444. }
  8445. return this
  8446. }
  8447. // HELPER FUNCTIONS
  8448. // ================
  8449. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  8450. function base64clean (str) {
  8451. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  8452. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  8453. // Node converts strings with length < 2 to ''
  8454. if (str.length < 2) return ''
  8455. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  8456. while (str.length % 4 !== 0) {
  8457. str = str + '='
  8458. }
  8459. return str
  8460. }
  8461. function stringtrim (str) {
  8462. if (str.trim) return str.trim()
  8463. return str.replace(/^\s+|\s+$/g, '')
  8464. }
  8465. function toHex (n) {
  8466. if (n < 16) return '0' + n.toString(16)
  8467. return n.toString(16)
  8468. }
  8469. function utf8ToBytes (string, units) {
  8470. units = units || Infinity
  8471. var codePoint
  8472. var length = string.length
  8473. var leadSurrogate = null
  8474. var bytes = []
  8475. for (var i = 0; i < length; ++i) {
  8476. codePoint = string.charCodeAt(i)
  8477. // is surrogate component
  8478. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  8479. // last char was a lead
  8480. if (!leadSurrogate) {
  8481. // no lead yet
  8482. if (codePoint > 0xDBFF) {
  8483. // unexpected trail
  8484. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8485. continue
  8486. } else if (i + 1 === length) {
  8487. // unpaired lead
  8488. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8489. continue
  8490. }
  8491. // valid lead
  8492. leadSurrogate = codePoint
  8493. continue
  8494. }
  8495. // 2 leads in a row
  8496. if (codePoint < 0xDC00) {
  8497. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8498. leadSurrogate = codePoint
  8499. continue
  8500. }
  8501. // valid surrogate pair
  8502. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  8503. } else if (leadSurrogate) {
  8504. // valid bmp char, but last char was a lead
  8505. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8506. }
  8507. leadSurrogate = null
  8508. // encode utf8
  8509. if (codePoint < 0x80) {
  8510. if ((units -= 1) < 0) break
  8511. bytes.push(codePoint)
  8512. } else if (codePoint < 0x800) {
  8513. if ((units -= 2) < 0) break
  8514. bytes.push(
  8515. codePoint >> 0x6 | 0xC0,
  8516. codePoint & 0x3F | 0x80
  8517. )
  8518. } else if (codePoint < 0x10000) {
  8519. if ((units -= 3) < 0) break
  8520. bytes.push(
  8521. codePoint >> 0xC | 0xE0,
  8522. codePoint >> 0x6 & 0x3F | 0x80,
  8523. codePoint & 0x3F | 0x80
  8524. )
  8525. } else if (codePoint < 0x110000) {
  8526. if ((units -= 4) < 0) break
  8527. bytes.push(
  8528. codePoint >> 0x12 | 0xF0,
  8529. codePoint >> 0xC & 0x3F | 0x80,
  8530. codePoint >> 0x6 & 0x3F | 0x80,
  8531. codePoint & 0x3F | 0x80
  8532. )
  8533. } else {
  8534. throw new Error('Invalid code point')
  8535. }
  8536. }
  8537. return bytes
  8538. }
  8539. function asciiToBytes (str) {
  8540. var byteArray = []
  8541. for (var i = 0; i < str.length; ++i) {
  8542. // Node's code seems to be doing this and not & 0x7F..
  8543. byteArray.push(str.charCodeAt(i) & 0xFF)
  8544. }
  8545. return byteArray
  8546. }
  8547. function utf16leToBytes (str, units) {
  8548. var c, hi, lo
  8549. var byteArray = []
  8550. for (var i = 0; i < str.length; ++i) {
  8551. if ((units -= 2) < 0) break
  8552. c = str.charCodeAt(i)
  8553. hi = c >> 8
  8554. lo = c % 256
  8555. byteArray.push(lo)
  8556. byteArray.push(hi)
  8557. }
  8558. return byteArray
  8559. }
  8560. function base64ToBytes (str) {
  8561. return base64.toByteArray(base64clean(str))
  8562. }
  8563. function blitBuffer (src, dst, offset, length) {
  8564. for (var i = 0; i < length; ++i) {
  8565. if ((i + offset >= dst.length) || (i >= src.length)) break
  8566. dst[i + offset] = src[i]
  8567. }
  8568. return i
  8569. }
  8570. function isnan (val) {
  8571. return val !== val // eslint-disable-line no-self-compare
  8572. }
  8573. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  8574. /***/ }),
  8575. /***/ "./node_modules/clipboard/dist/clipboard.js":
  8576. /*!**************************************************!*\
  8577. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  8578. \**************************************************/
  8579. /*! no static exports found */
  8580. /***/ (function(module, exports, __webpack_require__) {
  8581. /*!
  8582. * clipboard.js v2.0.4
  8583. * https://zenorocha.github.io/clipboard.js
  8584. *
  8585. * Licensed MIT © Zeno Rocha
  8586. */
  8587. (function webpackUniversalModuleDefinition(root, factory) {
  8588. if(true)
  8589. module.exports = factory();
  8590. else {}
  8591. })(this, function() {
  8592. return /******/ (function(modules) { // webpackBootstrap
  8593. /******/ // The module cache
  8594. /******/ var installedModules = {};
  8595. /******/
  8596. /******/ // The require function
  8597. /******/ function __webpack_require__(moduleId) {
  8598. /******/
  8599. /******/ // Check if module is in cache
  8600. /******/ if(installedModules[moduleId]) {
  8601. /******/ return installedModules[moduleId].exports;
  8602. /******/ }
  8603. /******/ // Create a new module (and put it into the cache)
  8604. /******/ var module = installedModules[moduleId] = {
  8605. /******/ i: moduleId,
  8606. /******/ l: false,
  8607. /******/ exports: {}
  8608. /******/ };
  8609. /******/
  8610. /******/ // Execute the module function
  8611. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  8612. /******/
  8613. /******/ // Flag the module as loaded
  8614. /******/ module.l = true;
  8615. /******/
  8616. /******/ // Return the exports of the module
  8617. /******/ return module.exports;
  8618. /******/ }
  8619. /******/
  8620. /******/
  8621. /******/ // expose the modules object (__webpack_modules__)
  8622. /******/ __webpack_require__.m = modules;
  8623. /******/
  8624. /******/ // expose the module cache
  8625. /******/ __webpack_require__.c = installedModules;
  8626. /******/
  8627. /******/ // define getter function for harmony exports
  8628. /******/ __webpack_require__.d = function(exports, name, getter) {
  8629. /******/ if(!__webpack_require__.o(exports, name)) {
  8630. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  8631. /******/ }
  8632. /******/ };
  8633. /******/
  8634. /******/ // define __esModule on exports
  8635. /******/ __webpack_require__.r = function(exports) {
  8636. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  8637. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  8638. /******/ }
  8639. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  8640. /******/ };
  8641. /******/
  8642. /******/ // create a fake namespace object
  8643. /******/ // mode & 1: value is a module id, require it
  8644. /******/ // mode & 2: merge all properties of value into the ns
  8645. /******/ // mode & 4: return value when already ns object
  8646. /******/ // mode & 8|1: behave like require
  8647. /******/ __webpack_require__.t = function(value, mode) {
  8648. /******/ if(mode & 1) value = __webpack_require__(value);
  8649. /******/ if(mode & 8) return value;
  8650. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  8651. /******/ var ns = Object.create(null);
  8652. /******/ __webpack_require__.r(ns);
  8653. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  8654. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  8655. /******/ return ns;
  8656. /******/ };
  8657. /******/
  8658. /******/ // getDefaultExport function for compatibility with non-harmony modules
  8659. /******/ __webpack_require__.n = function(module) {
  8660. /******/ var getter = module && module.__esModule ?
  8661. /******/ function getDefault() { return module['default']; } :
  8662. /******/ function getModuleExports() { return module; };
  8663. /******/ __webpack_require__.d(getter, 'a', getter);
  8664. /******/ return getter;
  8665. /******/ };
  8666. /******/
  8667. /******/ // Object.prototype.hasOwnProperty.call
  8668. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  8669. /******/
  8670. /******/ // __webpack_public_path__
  8671. /******/ __webpack_require__.p = "";
  8672. /******/
  8673. /******/
  8674. /******/ // Load entry module and return exports
  8675. /******/ return __webpack_require__(__webpack_require__.s = 0);
  8676. /******/ })
  8677. /************************************************************************/
  8678. /******/ ([
  8679. /* 0 */
  8680. /***/ (function(module, exports, __webpack_require__) {
  8681. "use strict";
  8682. 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; };
  8683. 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; }; }();
  8684. var _clipboardAction = __webpack_require__(1);
  8685. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  8686. var _tinyEmitter = __webpack_require__(3);
  8687. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  8688. var _goodListener = __webpack_require__(4);
  8689. var _goodListener2 = _interopRequireDefault(_goodListener);
  8690. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8691. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8692. 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; }
  8693. 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; }
  8694. /**
  8695. * Base class which takes one or more elements, adds event listeners to them,
  8696. * and instantiates a new `ClipboardAction` on each click.
  8697. */
  8698. var Clipboard = function (_Emitter) {
  8699. _inherits(Clipboard, _Emitter);
  8700. /**
  8701. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8702. * @param {Object} options
  8703. */
  8704. function Clipboard(trigger, options) {
  8705. _classCallCheck(this, Clipboard);
  8706. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  8707. _this.resolveOptions(options);
  8708. _this.listenClick(trigger);
  8709. return _this;
  8710. }
  8711. /**
  8712. * Defines if attributes would be resolved using internal setter functions
  8713. * or custom functions that were passed in the constructor.
  8714. * @param {Object} options
  8715. */
  8716. _createClass(Clipboard, [{
  8717. key: 'resolveOptions',
  8718. value: function resolveOptions() {
  8719. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8720. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  8721. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  8722. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  8723. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  8724. }
  8725. /**
  8726. * Adds a click event listener to the passed trigger.
  8727. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8728. */
  8729. }, {
  8730. key: 'listenClick',
  8731. value: function listenClick(trigger) {
  8732. var _this2 = this;
  8733. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  8734. return _this2.onClick(e);
  8735. });
  8736. }
  8737. /**
  8738. * Defines a new `ClipboardAction` on each click event.
  8739. * @param {Event} e
  8740. */
  8741. }, {
  8742. key: 'onClick',
  8743. value: function onClick(e) {
  8744. var trigger = e.delegateTarget || e.currentTarget;
  8745. if (this.clipboardAction) {
  8746. this.clipboardAction = null;
  8747. }
  8748. this.clipboardAction = new _clipboardAction2.default({
  8749. action: this.action(trigger),
  8750. target: this.target(trigger),
  8751. text: this.text(trigger),
  8752. container: this.container,
  8753. trigger: trigger,
  8754. emitter: this
  8755. });
  8756. }
  8757. /**
  8758. * Default `action` lookup function.
  8759. * @param {Element} trigger
  8760. */
  8761. }, {
  8762. key: 'defaultAction',
  8763. value: function defaultAction(trigger) {
  8764. return getAttributeValue('action', trigger);
  8765. }
  8766. /**
  8767. * Default `target` lookup function.
  8768. * @param {Element} trigger
  8769. */
  8770. }, {
  8771. key: 'defaultTarget',
  8772. value: function defaultTarget(trigger) {
  8773. var selector = getAttributeValue('target', trigger);
  8774. if (selector) {
  8775. return document.querySelector(selector);
  8776. }
  8777. }
  8778. /**
  8779. * Returns the support of the given action, or all actions if no action is
  8780. * given.
  8781. * @param {String} [action]
  8782. */
  8783. }, {
  8784. key: 'defaultText',
  8785. /**
  8786. * Default `text` lookup function.
  8787. * @param {Element} trigger
  8788. */
  8789. value: function defaultText(trigger) {
  8790. return getAttributeValue('text', trigger);
  8791. }
  8792. /**
  8793. * Destroy lifecycle.
  8794. */
  8795. }, {
  8796. key: 'destroy',
  8797. value: function destroy() {
  8798. this.listener.destroy();
  8799. if (this.clipboardAction) {
  8800. this.clipboardAction.destroy();
  8801. this.clipboardAction = null;
  8802. }
  8803. }
  8804. }], [{
  8805. key: 'isSupported',
  8806. value: function isSupported() {
  8807. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  8808. var actions = typeof action === 'string' ? [action] : action;
  8809. var support = !!document.queryCommandSupported;
  8810. actions.forEach(function (action) {
  8811. support = support && !!document.queryCommandSupported(action);
  8812. });
  8813. return support;
  8814. }
  8815. }]);
  8816. return Clipboard;
  8817. }(_tinyEmitter2.default);
  8818. /**
  8819. * Helper function to retrieve attribute value.
  8820. * @param {String} suffix
  8821. * @param {Element} element
  8822. */
  8823. function getAttributeValue(suffix, element) {
  8824. var attribute = 'data-clipboard-' + suffix;
  8825. if (!element.hasAttribute(attribute)) {
  8826. return;
  8827. }
  8828. return element.getAttribute(attribute);
  8829. }
  8830. module.exports = Clipboard;
  8831. /***/ }),
  8832. /* 1 */
  8833. /***/ (function(module, exports, __webpack_require__) {
  8834. "use strict";
  8835. 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; };
  8836. 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; }; }();
  8837. var _select = __webpack_require__(2);
  8838. var _select2 = _interopRequireDefault(_select);
  8839. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8840. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8841. /**
  8842. * Inner class which performs selection from either `text` or `target`
  8843. * properties and then executes copy or cut operations.
  8844. */
  8845. var ClipboardAction = function () {
  8846. /**
  8847. * @param {Object} options
  8848. */
  8849. function ClipboardAction(options) {
  8850. _classCallCheck(this, ClipboardAction);
  8851. this.resolveOptions(options);
  8852. this.initSelection();
  8853. }
  8854. /**
  8855. * Defines base properties passed from constructor.
  8856. * @param {Object} options
  8857. */
  8858. _createClass(ClipboardAction, [{
  8859. key: 'resolveOptions',
  8860. value: function resolveOptions() {
  8861. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8862. this.action = options.action;
  8863. this.container = options.container;
  8864. this.emitter = options.emitter;
  8865. this.target = options.target;
  8866. this.text = options.text;
  8867. this.trigger = options.trigger;
  8868. this.selectedText = '';
  8869. }
  8870. /**
  8871. * Decides which selection strategy is going to be applied based
  8872. * on the existence of `text` and `target` properties.
  8873. */
  8874. }, {
  8875. key: 'initSelection',
  8876. value: function initSelection() {
  8877. if (this.text) {
  8878. this.selectFake();
  8879. } else if (this.target) {
  8880. this.selectTarget();
  8881. }
  8882. }
  8883. /**
  8884. * Creates a fake textarea element, sets its value from `text` property,
  8885. * and makes a selection on it.
  8886. */
  8887. }, {
  8888. key: 'selectFake',
  8889. value: function selectFake() {
  8890. var _this = this;
  8891. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8892. this.removeFake();
  8893. this.fakeHandlerCallback = function () {
  8894. return _this.removeFake();
  8895. };
  8896. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8897. this.fakeElem = document.createElement('textarea');
  8898. // Prevent zooming on iOS
  8899. this.fakeElem.style.fontSize = '12pt';
  8900. // Reset box model
  8901. this.fakeElem.style.border = '0';
  8902. this.fakeElem.style.padding = '0';
  8903. this.fakeElem.style.margin = '0';
  8904. // Move element out of screen horizontally
  8905. this.fakeElem.style.position = 'absolute';
  8906. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8907. // Move element to the same position vertically
  8908. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8909. this.fakeElem.style.top = yPosition + 'px';
  8910. this.fakeElem.setAttribute('readonly', '');
  8911. this.fakeElem.value = this.text;
  8912. this.container.appendChild(this.fakeElem);
  8913. this.selectedText = (0, _select2.default)(this.fakeElem);
  8914. this.copyText();
  8915. }
  8916. /**
  8917. * Only removes the fake element after another click event, that way
  8918. * a user can hit `Ctrl+C` to copy because selection still exists.
  8919. */
  8920. }, {
  8921. key: 'removeFake',
  8922. value: function removeFake() {
  8923. if (this.fakeHandler) {
  8924. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8925. this.fakeHandler = null;
  8926. this.fakeHandlerCallback = null;
  8927. }
  8928. if (this.fakeElem) {
  8929. this.container.removeChild(this.fakeElem);
  8930. this.fakeElem = null;
  8931. }
  8932. }
  8933. /**
  8934. * Selects the content from element passed on `target` property.
  8935. */
  8936. }, {
  8937. key: 'selectTarget',
  8938. value: function selectTarget() {
  8939. this.selectedText = (0, _select2.default)(this.target);
  8940. this.copyText();
  8941. }
  8942. /**
  8943. * Executes the copy operation based on the current selection.
  8944. */
  8945. }, {
  8946. key: 'copyText',
  8947. value: function copyText() {
  8948. var succeeded = void 0;
  8949. try {
  8950. succeeded = document.execCommand(this.action);
  8951. } catch (err) {
  8952. succeeded = false;
  8953. }
  8954. this.handleResult(succeeded);
  8955. }
  8956. /**
  8957. * Fires an event based on the copy operation result.
  8958. * @param {Boolean} succeeded
  8959. */
  8960. }, {
  8961. key: 'handleResult',
  8962. value: function handleResult(succeeded) {
  8963. this.emitter.emit(succeeded ? 'success' : 'error', {
  8964. action: this.action,
  8965. text: this.selectedText,
  8966. trigger: this.trigger,
  8967. clearSelection: this.clearSelection.bind(this)
  8968. });
  8969. }
  8970. /**
  8971. * Moves focus away from `target` and back to the trigger, removes current selection.
  8972. */
  8973. }, {
  8974. key: 'clearSelection',
  8975. value: function clearSelection() {
  8976. if (this.trigger) {
  8977. this.trigger.focus();
  8978. }
  8979. window.getSelection().removeAllRanges();
  8980. }
  8981. /**
  8982. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8983. * @param {String} action
  8984. */
  8985. }, {
  8986. key: 'destroy',
  8987. /**
  8988. * Destroy lifecycle.
  8989. */
  8990. value: function destroy() {
  8991. this.removeFake();
  8992. }
  8993. }, {
  8994. key: 'action',
  8995. set: function set() {
  8996. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8997. this._action = action;
  8998. if (this._action !== 'copy' && this._action !== 'cut') {
  8999. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  9000. }
  9001. }
  9002. /**
  9003. * Gets the `action` property.
  9004. * @return {String}
  9005. */
  9006. ,
  9007. get: function get() {
  9008. return this._action;
  9009. }
  9010. /**
  9011. * Sets the `target` property using an element
  9012. * that will be have its content copied.
  9013. * @param {Element} target
  9014. */
  9015. }, {
  9016. key: 'target',
  9017. set: function set(target) {
  9018. if (target !== undefined) {
  9019. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  9020. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  9021. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  9022. }
  9023. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  9024. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  9025. }
  9026. this._target = target;
  9027. } else {
  9028. throw new Error('Invalid "target" value, use a valid Element');
  9029. }
  9030. }
  9031. }
  9032. /**
  9033. * Gets the `target` property.
  9034. * @return {String|HTMLElement}
  9035. */
  9036. ,
  9037. get: function get() {
  9038. return this._target;
  9039. }
  9040. }]);
  9041. return ClipboardAction;
  9042. }();
  9043. module.exports = ClipboardAction;
  9044. /***/ }),
  9045. /* 2 */
  9046. /***/ (function(module, exports) {
  9047. function select(element) {
  9048. var selectedText;
  9049. if (element.nodeName === 'SELECT') {
  9050. element.focus();
  9051. selectedText = element.value;
  9052. }
  9053. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  9054. var isReadOnly = element.hasAttribute('readonly');
  9055. if (!isReadOnly) {
  9056. element.setAttribute('readonly', '');
  9057. }
  9058. element.select();
  9059. element.setSelectionRange(0, element.value.length);
  9060. if (!isReadOnly) {
  9061. element.removeAttribute('readonly');
  9062. }
  9063. selectedText = element.value;
  9064. }
  9065. else {
  9066. if (element.hasAttribute('contenteditable')) {
  9067. element.focus();
  9068. }
  9069. var selection = window.getSelection();
  9070. var range = document.createRange();
  9071. range.selectNodeContents(element);
  9072. selection.removeAllRanges();
  9073. selection.addRange(range);
  9074. selectedText = selection.toString();
  9075. }
  9076. return selectedText;
  9077. }
  9078. module.exports = select;
  9079. /***/ }),
  9080. /* 3 */
  9081. /***/ (function(module, exports) {
  9082. function E () {
  9083. // Keep this empty so it's easier to inherit from
  9084. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  9085. }
  9086. E.prototype = {
  9087. on: function (name, callback, ctx) {
  9088. var e = this.e || (this.e = {});
  9089. (e[name] || (e[name] = [])).push({
  9090. fn: callback,
  9091. ctx: ctx
  9092. });
  9093. return this;
  9094. },
  9095. once: function (name, callback, ctx) {
  9096. var self = this;
  9097. function listener () {
  9098. self.off(name, listener);
  9099. callback.apply(ctx, arguments);
  9100. };
  9101. listener._ = callback
  9102. return this.on(name, listener, ctx);
  9103. },
  9104. emit: function (name) {
  9105. var data = [].slice.call(arguments, 1);
  9106. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  9107. var i = 0;
  9108. var len = evtArr.length;
  9109. for (i; i < len; i++) {
  9110. evtArr[i].fn.apply(evtArr[i].ctx, data);
  9111. }
  9112. return this;
  9113. },
  9114. off: function (name, callback) {
  9115. var e = this.e || (this.e = {});
  9116. var evts = e[name];
  9117. var liveEvents = [];
  9118. if (evts && callback) {
  9119. for (var i = 0, len = evts.length; i < len; i++) {
  9120. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  9121. liveEvents.push(evts[i]);
  9122. }
  9123. }
  9124. // Remove event from queue to prevent memory leak
  9125. // Suggested by https://github.com/lazd
  9126. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  9127. (liveEvents.length)
  9128. ? e[name] = liveEvents
  9129. : delete e[name];
  9130. return this;
  9131. }
  9132. };
  9133. module.exports = E;
  9134. /***/ }),
  9135. /* 4 */
  9136. /***/ (function(module, exports, __webpack_require__) {
  9137. var is = __webpack_require__(5);
  9138. var delegate = __webpack_require__(6);
  9139. /**
  9140. * Validates all params and calls the right
  9141. * listener function based on its target type.
  9142. *
  9143. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  9144. * @param {String} type
  9145. * @param {Function} callback
  9146. * @return {Object}
  9147. */
  9148. function listen(target, type, callback) {
  9149. if (!target && !type && !callback) {
  9150. throw new Error('Missing required arguments');
  9151. }
  9152. if (!is.string(type)) {
  9153. throw new TypeError('Second argument must be a String');
  9154. }
  9155. if (!is.fn(callback)) {
  9156. throw new TypeError('Third argument must be a Function');
  9157. }
  9158. if (is.node(target)) {
  9159. return listenNode(target, type, callback);
  9160. }
  9161. else if (is.nodeList(target)) {
  9162. return listenNodeList(target, type, callback);
  9163. }
  9164. else if (is.string(target)) {
  9165. return listenSelector(target, type, callback);
  9166. }
  9167. else {
  9168. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  9169. }
  9170. }
  9171. /**
  9172. * Adds an event listener to a HTML element
  9173. * and returns a remove listener function.
  9174. *
  9175. * @param {HTMLElement} node
  9176. * @param {String} type
  9177. * @param {Function} callback
  9178. * @return {Object}
  9179. */
  9180. function listenNode(node, type, callback) {
  9181. node.addEventListener(type, callback);
  9182. return {
  9183. destroy: function() {
  9184. node.removeEventListener(type, callback);
  9185. }
  9186. }
  9187. }
  9188. /**
  9189. * Add an event listener to a list of HTML elements
  9190. * and returns a remove listener function.
  9191. *
  9192. * @param {NodeList|HTMLCollection} nodeList
  9193. * @param {String} type
  9194. * @param {Function} callback
  9195. * @return {Object}
  9196. */
  9197. function listenNodeList(nodeList, type, callback) {
  9198. Array.prototype.forEach.call(nodeList, function(node) {
  9199. node.addEventListener(type, callback);
  9200. });
  9201. return {
  9202. destroy: function() {
  9203. Array.prototype.forEach.call(nodeList, function(node) {
  9204. node.removeEventListener(type, callback);
  9205. });
  9206. }
  9207. }
  9208. }
  9209. /**
  9210. * Add an event listener to a selector
  9211. * and returns a remove listener function.
  9212. *
  9213. * @param {String} selector
  9214. * @param {String} type
  9215. * @param {Function} callback
  9216. * @return {Object}
  9217. */
  9218. function listenSelector(selector, type, callback) {
  9219. return delegate(document.body, selector, type, callback);
  9220. }
  9221. module.exports = listen;
  9222. /***/ }),
  9223. /* 5 */
  9224. /***/ (function(module, exports) {
  9225. /**
  9226. * Check if argument is a HTML element.
  9227. *
  9228. * @param {Object} value
  9229. * @return {Boolean}
  9230. */
  9231. exports.node = function(value) {
  9232. return value !== undefined
  9233. && value instanceof HTMLElement
  9234. && value.nodeType === 1;
  9235. };
  9236. /**
  9237. * Check if argument is a list of HTML elements.
  9238. *
  9239. * @param {Object} value
  9240. * @return {Boolean}
  9241. */
  9242. exports.nodeList = function(value) {
  9243. var type = Object.prototype.toString.call(value);
  9244. return value !== undefined
  9245. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  9246. && ('length' in value)
  9247. && (value.length === 0 || exports.node(value[0]));
  9248. };
  9249. /**
  9250. * Check if argument is a string.
  9251. *
  9252. * @param {Object} value
  9253. * @return {Boolean}
  9254. */
  9255. exports.string = function(value) {
  9256. return typeof value === 'string'
  9257. || value instanceof String;
  9258. };
  9259. /**
  9260. * Check if argument is a function.
  9261. *
  9262. * @param {Object} value
  9263. * @return {Boolean}
  9264. */
  9265. exports.fn = function(value) {
  9266. var type = Object.prototype.toString.call(value);
  9267. return type === '[object Function]';
  9268. };
  9269. /***/ }),
  9270. /* 6 */
  9271. /***/ (function(module, exports, __webpack_require__) {
  9272. var closest = __webpack_require__(7);
  9273. /**
  9274. * Delegates event to a selector.
  9275. *
  9276. * @param {Element} element
  9277. * @param {String} selector
  9278. * @param {String} type
  9279. * @param {Function} callback
  9280. * @param {Boolean} useCapture
  9281. * @return {Object}
  9282. */
  9283. function _delegate(element, selector, type, callback, useCapture) {
  9284. var listenerFn = listener.apply(this, arguments);
  9285. element.addEventListener(type, listenerFn, useCapture);
  9286. return {
  9287. destroy: function() {
  9288. element.removeEventListener(type, listenerFn, useCapture);
  9289. }
  9290. }
  9291. }
  9292. /**
  9293. * Delegates event to a selector.
  9294. *
  9295. * @param {Element|String|Array} [elements]
  9296. * @param {String} selector
  9297. * @param {String} type
  9298. * @param {Function} callback
  9299. * @param {Boolean} useCapture
  9300. * @return {Object}
  9301. */
  9302. function delegate(elements, selector, type, callback, useCapture) {
  9303. // Handle the regular Element usage
  9304. if (typeof elements.addEventListener === 'function') {
  9305. return _delegate.apply(null, arguments);
  9306. }
  9307. // Handle Element-less usage, it defaults to global delegation
  9308. if (typeof type === 'function') {
  9309. // Use `document` as the first parameter, then apply arguments
  9310. // This is a short way to .unshift `arguments` without running into deoptimizations
  9311. return _delegate.bind(null, document).apply(null, arguments);
  9312. }
  9313. // Handle Selector-based usage
  9314. if (typeof elements === 'string') {
  9315. elements = document.querySelectorAll(elements);
  9316. }
  9317. // Handle Array-like based usage
  9318. return Array.prototype.map.call(elements, function (element) {
  9319. return _delegate(element, selector, type, callback, useCapture);
  9320. });
  9321. }
  9322. /**
  9323. * Finds closest match and invokes callback.
  9324. *
  9325. * @param {Element} element
  9326. * @param {String} selector
  9327. * @param {String} type
  9328. * @param {Function} callback
  9329. * @return {Function}
  9330. */
  9331. function listener(element, selector, type, callback) {
  9332. return function(e) {
  9333. e.delegateTarget = closest(e.target, selector);
  9334. if (e.delegateTarget) {
  9335. callback.call(element, e);
  9336. }
  9337. }
  9338. }
  9339. module.exports = delegate;
  9340. /***/ }),
  9341. /* 7 */
  9342. /***/ (function(module, exports) {
  9343. var DOCUMENT_NODE_TYPE = 9;
  9344. /**
  9345. * A polyfill for Element.matches()
  9346. */
  9347. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  9348. var proto = Element.prototype;
  9349. proto.matches = proto.matchesSelector ||
  9350. proto.mozMatchesSelector ||
  9351. proto.msMatchesSelector ||
  9352. proto.oMatchesSelector ||
  9353. proto.webkitMatchesSelector;
  9354. }
  9355. /**
  9356. * Finds the closest parent that matches a selector.
  9357. *
  9358. * @param {Element} element
  9359. * @param {String} selector
  9360. * @return {Function}
  9361. */
  9362. function closest (element, selector) {
  9363. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  9364. if (typeof element.matches === 'function' &&
  9365. element.matches(selector)) {
  9366. return element;
  9367. }
  9368. element = element.parentNode;
  9369. }
  9370. }
  9371. module.exports = closest;
  9372. /***/ })
  9373. /******/ ]);
  9374. });
  9375. /***/ }),
  9376. /***/ "./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&":
  9377. /*!*******************************************************************************************************************************************************************************************************************************************************************************************************!*\
  9378. !*** ./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& ***!
  9379. \*******************************************************************************************************************************************************************************************************************************************************************************************************/
  9380. /*! no static exports found */
  9381. /***/ (function(module, exports, __webpack_require__) {
  9382. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  9383. // imports
  9384. // module
  9385. 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", ""]);
  9386. // exports
  9387. /***/ }),
  9388. /***/ "./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&":
  9389. /*!********************************************************************************************************************************************************************************************************************************************************************************************!*\
  9390. !*** ./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& ***!
  9391. \********************************************************************************************************************************************************************************************************************************************************************************************/
  9392. /*! no static exports found */
  9393. /***/ (function(module, exports, __webpack_require__) {
  9394. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  9395. // imports
  9396. // module
  9397. 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", ""]);
  9398. // exports
  9399. /***/ }),
  9400. /***/ "./node_modules/css-loader/lib/css-base.js":
  9401. /*!*************************************************!*\
  9402. !*** ./node_modules/css-loader/lib/css-base.js ***!
  9403. \*************************************************/
  9404. /*! no static exports found */
  9405. /***/ (function(module, exports) {
  9406. /*
  9407. MIT License http://www.opensource.org/licenses/mit-license.php
  9408. Author Tobias Koppers @sokra
  9409. */
  9410. // css base code, injected by the css-loader
  9411. module.exports = function(useSourceMap) {
  9412. var list = [];
  9413. // return the list of modules as css string
  9414. list.toString = function toString() {
  9415. return this.map(function (item) {
  9416. var content = cssWithMappingToString(item, useSourceMap);
  9417. if(item[2]) {
  9418. return "@media " + item[2] + "{" + content + "}";
  9419. } else {
  9420. return content;
  9421. }
  9422. }).join("");
  9423. };
  9424. // import a list of modules into the list
  9425. list.i = function(modules, mediaQuery) {
  9426. if(typeof modules === "string")
  9427. modules = [[null, modules, ""]];
  9428. var alreadyImportedModules = {};
  9429. for(var i = 0; i < this.length; i++) {
  9430. var id = this[i][0];
  9431. if(typeof id === "number")
  9432. alreadyImportedModules[id] = true;
  9433. }
  9434. for(i = 0; i < modules.length; i++) {
  9435. var item = modules[i];
  9436. // skip already imported module
  9437. // this implementation is not 100% perfect for weird media query combinations
  9438. // when a module is imported multiple times with different media queries.
  9439. // I hope this will never occur (Hey this way we have smaller bundles)
  9440. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  9441. if(mediaQuery && !item[2]) {
  9442. item[2] = mediaQuery;
  9443. } else if(mediaQuery) {
  9444. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  9445. }
  9446. list.push(item);
  9447. }
  9448. }
  9449. };
  9450. return list;
  9451. };
  9452. function cssWithMappingToString(item, useSourceMap) {
  9453. var content = item[1] || '';
  9454. var cssMapping = item[3];
  9455. if (!cssMapping) {
  9456. return content;
  9457. }
  9458. if (useSourceMap && typeof btoa === 'function') {
  9459. var sourceMapping = toComment(cssMapping);
  9460. var sourceURLs = cssMapping.sources.map(function (source) {
  9461. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
  9462. });
  9463. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  9464. }
  9465. return [content].join('\n');
  9466. }
  9467. // Adapted from convert-source-map (MIT)
  9468. function toComment(sourceMap) {
  9469. // eslint-disable-next-line no-undef
  9470. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  9471. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  9472. return '/*# ' + data + ' */';
  9473. }
  9474. /***/ }),
  9475. /***/ "./node_modules/ieee754/index.js":
  9476. /*!***************************************!*\
  9477. !*** ./node_modules/ieee754/index.js ***!
  9478. \***************************************/
  9479. /*! no static exports found */
  9480. /***/ (function(module, exports) {
  9481. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  9482. var e, m
  9483. var eLen = (nBytes * 8) - mLen - 1
  9484. var eMax = (1 << eLen) - 1
  9485. var eBias = eMax >> 1
  9486. var nBits = -7
  9487. var i = isLE ? (nBytes - 1) : 0
  9488. var d = isLE ? -1 : 1
  9489. var s = buffer[offset + i]
  9490. i += d
  9491. e = s & ((1 << (-nBits)) - 1)
  9492. s >>= (-nBits)
  9493. nBits += eLen
  9494. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9495. m = e & ((1 << (-nBits)) - 1)
  9496. e >>= (-nBits)
  9497. nBits += mLen
  9498. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9499. if (e === 0) {
  9500. e = 1 - eBias
  9501. } else if (e === eMax) {
  9502. return m ? NaN : ((s ? -1 : 1) * Infinity)
  9503. } else {
  9504. m = m + Math.pow(2, mLen)
  9505. e = e - eBias
  9506. }
  9507. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  9508. }
  9509. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  9510. var e, m, c
  9511. var eLen = (nBytes * 8) - mLen - 1
  9512. var eMax = (1 << eLen) - 1
  9513. var eBias = eMax >> 1
  9514. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  9515. var i = isLE ? 0 : (nBytes - 1)
  9516. var d = isLE ? 1 : -1
  9517. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  9518. value = Math.abs(value)
  9519. if (isNaN(value) || value === Infinity) {
  9520. m = isNaN(value) ? 1 : 0
  9521. e = eMax
  9522. } else {
  9523. e = Math.floor(Math.log(value) / Math.LN2)
  9524. if (value * (c = Math.pow(2, -e)) < 1) {
  9525. e--
  9526. c *= 2
  9527. }
  9528. if (e + eBias >= 1) {
  9529. value += rt / c
  9530. } else {
  9531. value += rt * Math.pow(2, 1 - eBias)
  9532. }
  9533. if (value * c >= 2) {
  9534. e++
  9535. c /= 2
  9536. }
  9537. if (e + eBias >= eMax) {
  9538. m = 0
  9539. e = eMax
  9540. } else if (e + eBias >= 1) {
  9541. m = ((value * c) - 1) * Math.pow(2, mLen)
  9542. e = e + eBias
  9543. } else {
  9544. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  9545. e = 0
  9546. }
  9547. }
  9548. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  9549. e = (e << mLen) | m
  9550. eLen += mLen
  9551. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  9552. buffer[offset + i - d] |= s * 128
  9553. }
  9554. /***/ }),
  9555. /***/ "./node_modules/isarray/index.js":
  9556. /*!***************************************!*\
  9557. !*** ./node_modules/isarray/index.js ***!
  9558. \***************************************/
  9559. /*! no static exports found */
  9560. /***/ (function(module, exports) {
  9561. var toString = {}.toString;
  9562. module.exports = Array.isArray || function (arr) {
  9563. return toString.call(arr) == '[object Array]';
  9564. };
  9565. /***/ }),
  9566. /***/ "./node_modules/jquery/dist/jquery.js":
  9567. /*!********************************************!*\
  9568. !*** ./node_modules/jquery/dist/jquery.js ***!
  9569. \********************************************/
  9570. /*! no static exports found */
  9571. /***/ (function(module, exports, __webpack_require__) {
  9572. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  9573. * jQuery JavaScript Library v3.4.1
  9574. * https://jquery.com/
  9575. *
  9576. * Includes Sizzle.js
  9577. * https://sizzlejs.com/
  9578. *
  9579. * Copyright JS Foundation and other contributors
  9580. * Released under the MIT license
  9581. * https://jquery.org/license
  9582. *
  9583. * Date: 2019-05-01T21:04Z
  9584. */
  9585. ( function( global, factory ) {
  9586. "use strict";
  9587. if ( true && typeof module.exports === "object" ) {
  9588. // For CommonJS and CommonJS-like environments where a proper `window`
  9589. // is present, execute the factory and get jQuery.
  9590. // For environments that do not have a `window` with a `document`
  9591. // (such as Node.js), expose a factory as module.exports.
  9592. // This accentuates the need for the creation of a real `window`.
  9593. // e.g. var jQuery = require("jquery")(window);
  9594. // See ticket #14549 for more info.
  9595. module.exports = global.document ?
  9596. factory( global, true ) :
  9597. function( w ) {
  9598. if ( !w.document ) {
  9599. throw new Error( "jQuery requires a window with a document" );
  9600. }
  9601. return factory( w );
  9602. };
  9603. } else {
  9604. factory( global );
  9605. }
  9606. // Pass this if window is not defined yet
  9607. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  9608. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  9609. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  9610. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  9611. // enough that all such attempts are guarded in a try block.
  9612. "use strict";
  9613. var arr = [];
  9614. var document = window.document;
  9615. var getProto = Object.getPrototypeOf;
  9616. var slice = arr.slice;
  9617. var concat = arr.concat;
  9618. var push = arr.push;
  9619. var indexOf = arr.indexOf;
  9620. var class2type = {};
  9621. var toString = class2type.toString;
  9622. var hasOwn = class2type.hasOwnProperty;
  9623. var fnToString = hasOwn.toString;
  9624. var ObjectFunctionString = fnToString.call( Object );
  9625. var support = {};
  9626. var isFunction = function isFunction( obj ) {
  9627. // Support: Chrome <=57, Firefox <=52
  9628. // In some browsers, typeof returns "function" for HTML <object> elements
  9629. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  9630. // We don't want to classify *any* DOM node as a function.
  9631. return typeof obj === "function" && typeof obj.nodeType !== "number";
  9632. };
  9633. var isWindow = function isWindow( obj ) {
  9634. return obj != null && obj === obj.window;
  9635. };
  9636. var preservedScriptAttributes = {
  9637. type: true,
  9638. src: true,
  9639. nonce: true,
  9640. noModule: true
  9641. };
  9642. function DOMEval( code, node, doc ) {
  9643. doc = doc || document;
  9644. var i, val,
  9645. script = doc.createElement( "script" );
  9646. script.text = code;
  9647. if ( node ) {
  9648. for ( i in preservedScriptAttributes ) {
  9649. // Support: Firefox 64+, Edge 18+
  9650. // Some browsers don't support the "nonce" property on scripts.
  9651. // On the other hand, just using `getAttribute` is not enough as
  9652. // the `nonce` attribute is reset to an empty string whenever it
  9653. // becomes browsing-context connected.
  9654. // See https://github.com/whatwg/html/issues/2369
  9655. // See https://html.spec.whatwg.org/#nonce-attributes
  9656. // The `node.getAttribute` check was added for the sake of
  9657. // `jQuery.globalEval` so that it can fake a nonce-containing node
  9658. // via an object.
  9659. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  9660. if ( val ) {
  9661. script.setAttribute( i, val );
  9662. }
  9663. }
  9664. }
  9665. doc.head.appendChild( script ).parentNode.removeChild( script );
  9666. }
  9667. function toType( obj ) {
  9668. if ( obj == null ) {
  9669. return obj + "";
  9670. }
  9671. // Support: Android <=2.3 only (functionish RegExp)
  9672. return typeof obj === "object" || typeof obj === "function" ?
  9673. class2type[ toString.call( obj ) ] || "object" :
  9674. typeof obj;
  9675. }
  9676. /* global Symbol */
  9677. // Defining this global in .eslintrc.json would create a danger of using the global
  9678. // unguarded in another place, it seems safer to define global only for this module
  9679. var
  9680. version = "3.4.1",
  9681. // Define a local copy of jQuery
  9682. jQuery = function( selector, context ) {
  9683. // The jQuery object is actually just the init constructor 'enhanced'
  9684. // Need init if jQuery is called (just allow error to be thrown if not included)
  9685. return new jQuery.fn.init( selector, context );
  9686. },
  9687. // Support: Android <=4.0 only
  9688. // Make sure we trim BOM and NBSP
  9689. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  9690. jQuery.fn = jQuery.prototype = {
  9691. // The current version of jQuery being used
  9692. jquery: version,
  9693. constructor: jQuery,
  9694. // The default length of a jQuery object is 0
  9695. length: 0,
  9696. toArray: function() {
  9697. return slice.call( this );
  9698. },
  9699. // Get the Nth element in the matched element set OR
  9700. // Get the whole matched element set as a clean array
  9701. get: function( num ) {
  9702. // Return all the elements in a clean array
  9703. if ( num == null ) {
  9704. return slice.call( this );
  9705. }
  9706. // Return just the one element from the set
  9707. return num < 0 ? this[ num + this.length ] : this[ num ];
  9708. },
  9709. // Take an array of elements and push it onto the stack
  9710. // (returning the new matched element set)
  9711. pushStack: function( elems ) {
  9712. // Build a new jQuery matched element set
  9713. var ret = jQuery.merge( this.constructor(), elems );
  9714. // Add the old object onto the stack (as a reference)
  9715. ret.prevObject = this;
  9716. // Return the newly-formed element set
  9717. return ret;
  9718. },
  9719. // Execute a callback for every element in the matched set.
  9720. each: function( callback ) {
  9721. return jQuery.each( this, callback );
  9722. },
  9723. map: function( callback ) {
  9724. return this.pushStack( jQuery.map( this, function( elem, i ) {
  9725. return callback.call( elem, i, elem );
  9726. } ) );
  9727. },
  9728. slice: function() {
  9729. return this.pushStack( slice.apply( this, arguments ) );
  9730. },
  9731. first: function() {
  9732. return this.eq( 0 );
  9733. },
  9734. last: function() {
  9735. return this.eq( -1 );
  9736. },
  9737. eq: function( i ) {
  9738. var len = this.length,
  9739. j = +i + ( i < 0 ? len : 0 );
  9740. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  9741. },
  9742. end: function() {
  9743. return this.prevObject || this.constructor();
  9744. },
  9745. // For internal use only.
  9746. // Behaves like an Array's method, not like a jQuery method.
  9747. push: push,
  9748. sort: arr.sort,
  9749. splice: arr.splice
  9750. };
  9751. jQuery.extend = jQuery.fn.extend = function() {
  9752. var options, name, src, copy, copyIsArray, clone,
  9753. target = arguments[ 0 ] || {},
  9754. i = 1,
  9755. length = arguments.length,
  9756. deep = false;
  9757. // Handle a deep copy situation
  9758. if ( typeof target === "boolean" ) {
  9759. deep = target;
  9760. // Skip the boolean and the target
  9761. target = arguments[ i ] || {};
  9762. i++;
  9763. }
  9764. // Handle case when target is a string or something (possible in deep copy)
  9765. if ( typeof target !== "object" && !isFunction( target ) ) {
  9766. target = {};
  9767. }
  9768. // Extend jQuery itself if only one argument is passed
  9769. if ( i === length ) {
  9770. target = this;
  9771. i--;
  9772. }
  9773. for ( ; i < length; i++ ) {
  9774. // Only deal with non-null/undefined values
  9775. if ( ( options = arguments[ i ] ) != null ) {
  9776. // Extend the base object
  9777. for ( name in options ) {
  9778. copy = options[ name ];
  9779. // Prevent Object.prototype pollution
  9780. // Prevent never-ending loop
  9781. if ( name === "__proto__" || target === copy ) {
  9782. continue;
  9783. }
  9784. // Recurse if we're merging plain objects or arrays
  9785. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  9786. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  9787. src = target[ name ];
  9788. // Ensure proper type for the source value
  9789. if ( copyIsArray && !Array.isArray( src ) ) {
  9790. clone = [];
  9791. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  9792. clone = {};
  9793. } else {
  9794. clone = src;
  9795. }
  9796. copyIsArray = false;
  9797. // Never move original objects, clone them
  9798. target[ name ] = jQuery.extend( deep, clone, copy );
  9799. // Don't bring in undefined values
  9800. } else if ( copy !== undefined ) {
  9801. target[ name ] = copy;
  9802. }
  9803. }
  9804. }
  9805. }
  9806. // Return the modified object
  9807. return target;
  9808. };
  9809. jQuery.extend( {
  9810. // Unique for each copy of jQuery on the page
  9811. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  9812. // Assume jQuery is ready without the ready module
  9813. isReady: true,
  9814. error: function( msg ) {
  9815. throw new Error( msg );
  9816. },
  9817. noop: function() {},
  9818. isPlainObject: function( obj ) {
  9819. var proto, Ctor;
  9820. // Detect obvious negatives
  9821. // Use toString instead of jQuery.type to catch host objects
  9822. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  9823. return false;
  9824. }
  9825. proto = getProto( obj );
  9826. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  9827. if ( !proto ) {
  9828. return true;
  9829. }
  9830. // Objects with prototype are plain iff they were constructed by a global Object function
  9831. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  9832. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  9833. },
  9834. isEmptyObject: function( obj ) {
  9835. var name;
  9836. for ( name in obj ) {
  9837. return false;
  9838. }
  9839. return true;
  9840. },
  9841. // Evaluates a script in a global context
  9842. globalEval: function( code, options ) {
  9843. DOMEval( code, { nonce: options && options.nonce } );
  9844. },
  9845. each: function( obj, callback ) {
  9846. var length, i = 0;
  9847. if ( isArrayLike( obj ) ) {
  9848. length = obj.length;
  9849. for ( ; i < length; i++ ) {
  9850. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9851. break;
  9852. }
  9853. }
  9854. } else {
  9855. for ( i in obj ) {
  9856. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9857. break;
  9858. }
  9859. }
  9860. }
  9861. return obj;
  9862. },
  9863. // Support: Android <=4.0 only
  9864. trim: function( text ) {
  9865. return text == null ?
  9866. "" :
  9867. ( text + "" ).replace( rtrim, "" );
  9868. },
  9869. // results is for internal usage only
  9870. makeArray: function( arr, results ) {
  9871. var ret = results || [];
  9872. if ( arr != null ) {
  9873. if ( isArrayLike( Object( arr ) ) ) {
  9874. jQuery.merge( ret,
  9875. typeof arr === "string" ?
  9876. [ arr ] : arr
  9877. );
  9878. } else {
  9879. push.call( ret, arr );
  9880. }
  9881. }
  9882. return ret;
  9883. },
  9884. inArray: function( elem, arr, i ) {
  9885. return arr == null ? -1 : indexOf.call( arr, elem, i );
  9886. },
  9887. // Support: Android <=4.0 only, PhantomJS 1 only
  9888. // push.apply(_, arraylike) throws on ancient WebKit
  9889. merge: function( first, second ) {
  9890. var len = +second.length,
  9891. j = 0,
  9892. i = first.length;
  9893. for ( ; j < len; j++ ) {
  9894. first[ i++ ] = second[ j ];
  9895. }
  9896. first.length = i;
  9897. return first;
  9898. },
  9899. grep: function( elems, callback, invert ) {
  9900. var callbackInverse,
  9901. matches = [],
  9902. i = 0,
  9903. length = elems.length,
  9904. callbackExpect = !invert;
  9905. // Go through the array, only saving the items
  9906. // that pass the validator function
  9907. for ( ; i < length; i++ ) {
  9908. callbackInverse = !callback( elems[ i ], i );
  9909. if ( callbackInverse !== callbackExpect ) {
  9910. matches.push( elems[ i ] );
  9911. }
  9912. }
  9913. return matches;
  9914. },
  9915. // arg is for internal usage only
  9916. map: function( elems, callback, arg ) {
  9917. var length, value,
  9918. i = 0,
  9919. ret = [];
  9920. // Go through the array, translating each of the items to their new values
  9921. if ( isArrayLike( elems ) ) {
  9922. length = elems.length;
  9923. for ( ; i < length; i++ ) {
  9924. value = callback( elems[ i ], i, arg );
  9925. if ( value != null ) {
  9926. ret.push( value );
  9927. }
  9928. }
  9929. // Go through every key on the object,
  9930. } else {
  9931. for ( i in elems ) {
  9932. value = callback( elems[ i ], i, arg );
  9933. if ( value != null ) {
  9934. ret.push( value );
  9935. }
  9936. }
  9937. }
  9938. // Flatten any nested arrays
  9939. return concat.apply( [], ret );
  9940. },
  9941. // A global GUID counter for objects
  9942. guid: 1,
  9943. // jQuery.support is not used in Core but other projects attach their
  9944. // properties to it so it needs to exist.
  9945. support: support
  9946. } );
  9947. if ( typeof Symbol === "function" ) {
  9948. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9949. }
  9950. // Populate the class2type map
  9951. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9952. function( i, name ) {
  9953. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9954. } );
  9955. function isArrayLike( obj ) {
  9956. // Support: real iOS 8.2 only (not reproducible in simulator)
  9957. // `in` check used to prevent JIT error (gh-2145)
  9958. // hasOwn isn't used here due to false negatives
  9959. // regarding Nodelist length in IE
  9960. var length = !!obj && "length" in obj && obj.length,
  9961. type = toType( obj );
  9962. if ( isFunction( obj ) || isWindow( obj ) ) {
  9963. return false;
  9964. }
  9965. return type === "array" || length === 0 ||
  9966. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9967. }
  9968. var Sizzle =
  9969. /*!
  9970. * Sizzle CSS Selector Engine v2.3.4
  9971. * https://sizzlejs.com/
  9972. *
  9973. * Copyright JS Foundation and other contributors
  9974. * Released under the MIT license
  9975. * https://js.foundation/
  9976. *
  9977. * Date: 2019-04-08
  9978. */
  9979. (function( window ) {
  9980. var i,
  9981. support,
  9982. Expr,
  9983. getText,
  9984. isXML,
  9985. tokenize,
  9986. compile,
  9987. select,
  9988. outermostContext,
  9989. sortInput,
  9990. hasDuplicate,
  9991. // Local document vars
  9992. setDocument,
  9993. document,
  9994. docElem,
  9995. documentIsHTML,
  9996. rbuggyQSA,
  9997. rbuggyMatches,
  9998. matches,
  9999. contains,
  10000. // Instance-specific data
  10001. expando = "sizzle" + 1 * new Date(),
  10002. preferredDoc = window.document,
  10003. dirruns = 0,
  10004. done = 0,
  10005. classCache = createCache(),
  10006. tokenCache = createCache(),
  10007. compilerCache = createCache(),
  10008. nonnativeSelectorCache = createCache(),
  10009. sortOrder = function( a, b ) {
  10010. if ( a === b ) {
  10011. hasDuplicate = true;
  10012. }
  10013. return 0;
  10014. },
  10015. // Instance methods
  10016. hasOwn = ({}).hasOwnProperty,
  10017. arr = [],
  10018. pop = arr.pop,
  10019. push_native = arr.push,
  10020. push = arr.push,
  10021. slice = arr.slice,
  10022. // Use a stripped-down indexOf as it's faster than native
  10023. // https://jsperf.com/thor-indexof-vs-for/5
  10024. indexOf = function( list, elem ) {
  10025. var i = 0,
  10026. len = list.length;
  10027. for ( ; i < len; i++ ) {
  10028. if ( list[i] === elem ) {
  10029. return i;
  10030. }
  10031. }
  10032. return -1;
  10033. },
  10034. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  10035. // Regular expressions
  10036. // http://www.w3.org/TR/css3-selectors/#whitespace
  10037. whitespace = "[\\x20\\t\\r\\n\\f]",
  10038. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  10039. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  10040. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  10041. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  10042. // Operator (capture 2)
  10043. "*([*^$|!~]?=)" + whitespace +
  10044. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  10045. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  10046. "*\\]",
  10047. pseudos = ":(" + identifier + ")(?:\\((" +
  10048. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  10049. // 1. quoted (capture 3; capture 4 or capture 5)
  10050. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  10051. // 2. simple (capture 6)
  10052. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  10053. // 3. anything else (capture 2)
  10054. ".*" +
  10055. ")\\)|)",
  10056. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  10057. rwhitespace = new RegExp( whitespace + "+", "g" ),
  10058. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  10059. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  10060. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  10061. rdescend = new RegExp( whitespace + "|>" ),
  10062. rpseudo = new RegExp( pseudos ),
  10063. ridentifier = new RegExp( "^" + identifier + "$" ),
  10064. matchExpr = {
  10065. "ID": new RegExp( "^#(" + identifier + ")" ),
  10066. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  10067. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  10068. "ATTR": new RegExp( "^" + attributes ),
  10069. "PSEUDO": new RegExp( "^" + pseudos ),
  10070. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  10071. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  10072. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  10073. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  10074. // For use in libraries implementing .is()
  10075. // We use this for POS matching in `select`
  10076. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  10077. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  10078. },
  10079. rhtml = /HTML$/i,
  10080. rinputs = /^(?:input|select|textarea|button)$/i,
  10081. rheader = /^h\d$/i,
  10082. rnative = /^[^{]+\{\s*\[native \w/,
  10083. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  10084. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  10085. rsibling = /[+~]/,
  10086. // CSS escapes
  10087. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  10088. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  10089. funescape = function( _, escaped, escapedWhitespace ) {
  10090. var high = "0x" + escaped - 0x10000;
  10091. // NaN means non-codepoint
  10092. // Support: Firefox<24
  10093. // Workaround erroneous numeric interpretation of +"0x"
  10094. return high !== high || escapedWhitespace ?
  10095. escaped :
  10096. high < 0 ?
  10097. // BMP codepoint
  10098. String.fromCharCode( high + 0x10000 ) :
  10099. // Supplemental Plane codepoint (surrogate pair)
  10100. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  10101. },
  10102. // CSS string/identifier serialization
  10103. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  10104. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  10105. fcssescape = function( ch, asCodePoint ) {
  10106. if ( asCodePoint ) {
  10107. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  10108. if ( ch === "\0" ) {
  10109. return "\uFFFD";
  10110. }
  10111. // Control characters and (dependent upon position) numbers get escaped as code points
  10112. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  10113. }
  10114. // Other potentially-special ASCII characters get backslash-escaped
  10115. return "\\" + ch;
  10116. },
  10117. // Used for iframes
  10118. // See setDocument()
  10119. // Removing the function wrapper causes a "Permission Denied"
  10120. // error in IE
  10121. unloadHandler = function() {
  10122. setDocument();
  10123. },
  10124. inDisabledFieldset = addCombinator(
  10125. function( elem ) {
  10126. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  10127. },
  10128. { dir: "parentNode", next: "legend" }
  10129. );
  10130. // Optimize for push.apply( _, NodeList )
  10131. try {
  10132. push.apply(
  10133. (arr = slice.call( preferredDoc.childNodes )),
  10134. preferredDoc.childNodes
  10135. );
  10136. // Support: Android<4.0
  10137. // Detect silently failing push.apply
  10138. arr[ preferredDoc.childNodes.length ].nodeType;
  10139. } catch ( e ) {
  10140. push = { apply: arr.length ?
  10141. // Leverage slice if possible
  10142. function( target, els ) {
  10143. push_native.apply( target, slice.call(els) );
  10144. } :
  10145. // Support: IE<9
  10146. // Otherwise append directly
  10147. function( target, els ) {
  10148. var j = target.length,
  10149. i = 0;
  10150. // Can't trust NodeList.length
  10151. while ( (target[j++] = els[i++]) ) {}
  10152. target.length = j - 1;
  10153. }
  10154. };
  10155. }
  10156. function Sizzle( selector, context, results, seed ) {
  10157. var m, i, elem, nid, match, groups, newSelector,
  10158. newContext = context && context.ownerDocument,
  10159. // nodeType defaults to 9, since context defaults to document
  10160. nodeType = context ? context.nodeType : 9;
  10161. results = results || [];
  10162. // Return early from calls with invalid selector or context
  10163. if ( typeof selector !== "string" || !selector ||
  10164. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  10165. return results;
  10166. }
  10167. // Try to shortcut find operations (as opposed to filters) in HTML documents
  10168. if ( !seed ) {
  10169. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  10170. setDocument( context );
  10171. }
  10172. context = context || document;
  10173. if ( documentIsHTML ) {
  10174. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  10175. // (excepting DocumentFragment context, where the methods don't exist)
  10176. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  10177. // ID selector
  10178. if ( (m = match[1]) ) {
  10179. // Document context
  10180. if ( nodeType === 9 ) {
  10181. if ( (elem = context.getElementById( m )) ) {
  10182. // Support: IE, Opera, Webkit
  10183. // TODO: identify versions
  10184. // getElementById can match elements by name instead of ID
  10185. if ( elem.id === m ) {
  10186. results.push( elem );
  10187. return results;
  10188. }
  10189. } else {
  10190. return results;
  10191. }
  10192. // Element context
  10193. } else {
  10194. // Support: IE, Opera, Webkit
  10195. // TODO: identify versions
  10196. // getElementById can match elements by name instead of ID
  10197. if ( newContext && (elem = newContext.getElementById( m )) &&
  10198. contains( context, elem ) &&
  10199. elem.id === m ) {
  10200. results.push( elem );
  10201. return results;
  10202. }
  10203. }
  10204. // Type selector
  10205. } else if ( match[2] ) {
  10206. push.apply( results, context.getElementsByTagName( selector ) );
  10207. return results;
  10208. // Class selector
  10209. } else if ( (m = match[3]) && support.getElementsByClassName &&
  10210. context.getElementsByClassName ) {
  10211. push.apply( results, context.getElementsByClassName( m ) );
  10212. return results;
  10213. }
  10214. }
  10215. // Take advantage of querySelectorAll
  10216. if ( support.qsa &&
  10217. !nonnativeSelectorCache[ selector + " " ] &&
  10218. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  10219. // Support: IE 8 only
  10220. // Exclude object elements
  10221. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  10222. newSelector = selector;
  10223. newContext = context;
  10224. // qSA considers elements outside a scoping root when evaluating child or
  10225. // descendant combinators, which is not what we want.
  10226. // In such cases, we work around the behavior by prefixing every selector in the
  10227. // list with an ID selector referencing the scope context.
  10228. // Thanks to Andrew Dupont for this technique.
  10229. if ( nodeType === 1 && rdescend.test( selector ) ) {
  10230. // Capture the context ID, setting it first if necessary
  10231. if ( (nid = context.getAttribute( "id" )) ) {
  10232. nid = nid.replace( rcssescape, fcssescape );
  10233. } else {
  10234. context.setAttribute( "id", (nid = expando) );
  10235. }
  10236. // Prefix every selector in the list
  10237. groups = tokenize( selector );
  10238. i = groups.length;
  10239. while ( i-- ) {
  10240. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  10241. }
  10242. newSelector = groups.join( "," );
  10243. // Expand context for sibling selectors
  10244. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  10245. context;
  10246. }
  10247. try {
  10248. push.apply( results,
  10249. newContext.querySelectorAll( newSelector )
  10250. );
  10251. return results;
  10252. } catch ( qsaError ) {
  10253. nonnativeSelectorCache( selector, true );
  10254. } finally {
  10255. if ( nid === expando ) {
  10256. context.removeAttribute( "id" );
  10257. }
  10258. }
  10259. }
  10260. }
  10261. }
  10262. // All others
  10263. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  10264. }
  10265. /**
  10266. * Create key-value caches of limited size
  10267. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  10268. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  10269. * deleting the oldest entry
  10270. */
  10271. function createCache() {
  10272. var keys = [];
  10273. function cache( key, value ) {
  10274. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  10275. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  10276. // Only keep the most recent entries
  10277. delete cache[ keys.shift() ];
  10278. }
  10279. return (cache[ key + " " ] = value);
  10280. }
  10281. return cache;
  10282. }
  10283. /**
  10284. * Mark a function for special use by Sizzle
  10285. * @param {Function} fn The function to mark
  10286. */
  10287. function markFunction( fn ) {
  10288. fn[ expando ] = true;
  10289. return fn;
  10290. }
  10291. /**
  10292. * Support testing using an element
  10293. * @param {Function} fn Passed the created element and returns a boolean result
  10294. */
  10295. function assert( fn ) {
  10296. var el = document.createElement("fieldset");
  10297. try {
  10298. return !!fn( el );
  10299. } catch (e) {
  10300. return false;
  10301. } finally {
  10302. // Remove from its parent by default
  10303. if ( el.parentNode ) {
  10304. el.parentNode.removeChild( el );
  10305. }
  10306. // release memory in IE
  10307. el = null;
  10308. }
  10309. }
  10310. /**
  10311. * Adds the same handler for all of the specified attrs
  10312. * @param {String} attrs Pipe-separated list of attributes
  10313. * @param {Function} handler The method that will be applied
  10314. */
  10315. function addHandle( attrs, handler ) {
  10316. var arr = attrs.split("|"),
  10317. i = arr.length;
  10318. while ( i-- ) {
  10319. Expr.attrHandle[ arr[i] ] = handler;
  10320. }
  10321. }
  10322. /**
  10323. * Checks document order of two siblings
  10324. * @param {Element} a
  10325. * @param {Element} b
  10326. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  10327. */
  10328. function siblingCheck( a, b ) {
  10329. var cur = b && a,
  10330. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  10331. a.sourceIndex - b.sourceIndex;
  10332. // Use IE sourceIndex if available on both nodes
  10333. if ( diff ) {
  10334. return diff;
  10335. }
  10336. // Check if b follows a
  10337. if ( cur ) {
  10338. while ( (cur = cur.nextSibling) ) {
  10339. if ( cur === b ) {
  10340. return -1;
  10341. }
  10342. }
  10343. }
  10344. return a ? 1 : -1;
  10345. }
  10346. /**
  10347. * Returns a function to use in pseudos for input types
  10348. * @param {String} type
  10349. */
  10350. function createInputPseudo( type ) {
  10351. return function( elem ) {
  10352. var name = elem.nodeName.toLowerCase();
  10353. return name === "input" && elem.type === type;
  10354. };
  10355. }
  10356. /**
  10357. * Returns a function to use in pseudos for buttons
  10358. * @param {String} type
  10359. */
  10360. function createButtonPseudo( type ) {
  10361. return function( elem ) {
  10362. var name = elem.nodeName.toLowerCase();
  10363. return (name === "input" || name === "button") && elem.type === type;
  10364. };
  10365. }
  10366. /**
  10367. * Returns a function to use in pseudos for :enabled/:disabled
  10368. * @param {Boolean} disabled true for :disabled; false for :enabled
  10369. */
  10370. function createDisabledPseudo( disabled ) {
  10371. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  10372. return function( elem ) {
  10373. // Only certain elements can match :enabled or :disabled
  10374. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  10375. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  10376. if ( "form" in elem ) {
  10377. // Check for inherited disabledness on relevant non-disabled elements:
  10378. // * listed form-associated elements in a disabled fieldset
  10379. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  10380. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  10381. // * option elements in a disabled optgroup
  10382. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  10383. // All such elements have a "form" property.
  10384. if ( elem.parentNode && elem.disabled === false ) {
  10385. // Option elements defer to a parent optgroup if present
  10386. if ( "label" in elem ) {
  10387. if ( "label" in elem.parentNode ) {
  10388. return elem.parentNode.disabled === disabled;
  10389. } else {
  10390. return elem.disabled === disabled;
  10391. }
  10392. }
  10393. // Support: IE 6 - 11
  10394. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  10395. return elem.isDisabled === disabled ||
  10396. // Where there is no isDisabled, check manually
  10397. /* jshint -W018 */
  10398. elem.isDisabled !== !disabled &&
  10399. inDisabledFieldset( elem ) === disabled;
  10400. }
  10401. return elem.disabled === disabled;
  10402. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  10403. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  10404. // even exist on them, let alone have a boolean value.
  10405. } else if ( "label" in elem ) {
  10406. return elem.disabled === disabled;
  10407. }
  10408. // Remaining elements are neither :enabled nor :disabled
  10409. return false;
  10410. };
  10411. }
  10412. /**
  10413. * Returns a function to use in pseudos for positionals
  10414. * @param {Function} fn
  10415. */
  10416. function createPositionalPseudo( fn ) {
  10417. return markFunction(function( argument ) {
  10418. argument = +argument;
  10419. return markFunction(function( seed, matches ) {
  10420. var j,
  10421. matchIndexes = fn( [], seed.length, argument ),
  10422. i = matchIndexes.length;
  10423. // Match elements found at the specified indexes
  10424. while ( i-- ) {
  10425. if ( seed[ (j = matchIndexes[i]) ] ) {
  10426. seed[j] = !(matches[j] = seed[j]);
  10427. }
  10428. }
  10429. });
  10430. });
  10431. }
  10432. /**
  10433. * Checks a node for validity as a Sizzle context
  10434. * @param {Element|Object=} context
  10435. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  10436. */
  10437. function testContext( context ) {
  10438. return context && typeof context.getElementsByTagName !== "undefined" && context;
  10439. }
  10440. // Expose support vars for convenience
  10441. support = Sizzle.support = {};
  10442. /**
  10443. * Detects XML nodes
  10444. * @param {Element|Object} elem An element or a document
  10445. * @returns {Boolean} True iff elem is a non-HTML XML node
  10446. */
  10447. isXML = Sizzle.isXML = function( elem ) {
  10448. var namespace = elem.namespaceURI,
  10449. docElem = (elem.ownerDocument || elem).documentElement;
  10450. // Support: IE <=8
  10451. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  10452. // https://bugs.jquery.com/ticket/4833
  10453. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  10454. };
  10455. /**
  10456. * Sets document-related variables once based on the current document
  10457. * @param {Element|Object} [doc] An element or document object to use to set the document
  10458. * @returns {Object} Returns the current document
  10459. */
  10460. setDocument = Sizzle.setDocument = function( node ) {
  10461. var hasCompare, subWindow,
  10462. doc = node ? node.ownerDocument || node : preferredDoc;
  10463. // Return early if doc is invalid or already selected
  10464. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  10465. return document;
  10466. }
  10467. // Update global variables
  10468. document = doc;
  10469. docElem = document.documentElement;
  10470. documentIsHTML = !isXML( document );
  10471. // Support: IE 9-11, Edge
  10472. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  10473. if ( preferredDoc !== document &&
  10474. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  10475. // Support: IE 11, Edge
  10476. if ( subWindow.addEventListener ) {
  10477. subWindow.addEventListener( "unload", unloadHandler, false );
  10478. // Support: IE 9 - 10 only
  10479. } else if ( subWindow.attachEvent ) {
  10480. subWindow.attachEvent( "onunload", unloadHandler );
  10481. }
  10482. }
  10483. /* Attributes
  10484. ---------------------------------------------------------------------- */
  10485. // Support: IE<8
  10486. // Verify that getAttribute really returns attributes and not properties
  10487. // (excepting IE8 booleans)
  10488. support.attributes = assert(function( el ) {
  10489. el.className = "i";
  10490. return !el.getAttribute("className");
  10491. });
  10492. /* getElement(s)By*
  10493. ---------------------------------------------------------------------- */
  10494. // Check if getElementsByTagName("*") returns only elements
  10495. support.getElementsByTagName = assert(function( el ) {
  10496. el.appendChild( document.createComment("") );
  10497. return !el.getElementsByTagName("*").length;
  10498. });
  10499. // Support: IE<9
  10500. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  10501. // Support: IE<10
  10502. // Check if getElementById returns elements by name
  10503. // The broken getElementById methods don't pick up programmatically-set names,
  10504. // so use a roundabout getElementsByName test
  10505. support.getById = assert(function( el ) {
  10506. docElem.appendChild( el ).id = expando;
  10507. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  10508. });
  10509. // ID filter and find
  10510. if ( support.getById ) {
  10511. Expr.filter["ID"] = function( id ) {
  10512. var attrId = id.replace( runescape, funescape );
  10513. return function( elem ) {
  10514. return elem.getAttribute("id") === attrId;
  10515. };
  10516. };
  10517. Expr.find["ID"] = function( id, context ) {
  10518. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10519. var elem = context.getElementById( id );
  10520. return elem ? [ elem ] : [];
  10521. }
  10522. };
  10523. } else {
  10524. Expr.filter["ID"] = function( id ) {
  10525. var attrId = id.replace( runescape, funescape );
  10526. return function( elem ) {
  10527. var node = typeof elem.getAttributeNode !== "undefined" &&
  10528. elem.getAttributeNode("id");
  10529. return node && node.value === attrId;
  10530. };
  10531. };
  10532. // Support: IE 6 - 7 only
  10533. // getElementById is not reliable as a find shortcut
  10534. Expr.find["ID"] = function( id, context ) {
  10535. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10536. var node, i, elems,
  10537. elem = context.getElementById( id );
  10538. if ( elem ) {
  10539. // Verify the id attribute
  10540. node = elem.getAttributeNode("id");
  10541. if ( node && node.value === id ) {
  10542. return [ elem ];
  10543. }
  10544. // Fall back on getElementsByName
  10545. elems = context.getElementsByName( id );
  10546. i = 0;
  10547. while ( (elem = elems[i++]) ) {
  10548. node = elem.getAttributeNode("id");
  10549. if ( node && node.value === id ) {
  10550. return [ elem ];
  10551. }
  10552. }
  10553. }
  10554. return [];
  10555. }
  10556. };
  10557. }
  10558. // Tag
  10559. Expr.find["TAG"] = support.getElementsByTagName ?
  10560. function( tag, context ) {
  10561. if ( typeof context.getElementsByTagName !== "undefined" ) {
  10562. return context.getElementsByTagName( tag );
  10563. // DocumentFragment nodes don't have gEBTN
  10564. } else if ( support.qsa ) {
  10565. return context.querySelectorAll( tag );
  10566. }
  10567. } :
  10568. function( tag, context ) {
  10569. var elem,
  10570. tmp = [],
  10571. i = 0,
  10572. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  10573. results = context.getElementsByTagName( tag );
  10574. // Filter out possible comments
  10575. if ( tag === "*" ) {
  10576. while ( (elem = results[i++]) ) {
  10577. if ( elem.nodeType === 1 ) {
  10578. tmp.push( elem );
  10579. }
  10580. }
  10581. return tmp;
  10582. }
  10583. return results;
  10584. };
  10585. // Class
  10586. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  10587. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  10588. return context.getElementsByClassName( className );
  10589. }
  10590. };
  10591. /* QSA/matchesSelector
  10592. ---------------------------------------------------------------------- */
  10593. // QSA and matchesSelector support
  10594. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  10595. rbuggyMatches = [];
  10596. // qSa(:focus) reports false when true (Chrome 21)
  10597. // We allow this because of a bug in IE8/9 that throws an error
  10598. // whenever `document.activeElement` is accessed on an iframe
  10599. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  10600. // See https://bugs.jquery.com/ticket/13378
  10601. rbuggyQSA = [];
  10602. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  10603. // Build QSA regex
  10604. // Regex strategy adopted from Diego Perini
  10605. assert(function( el ) {
  10606. // Select is set to empty string on purpose
  10607. // This is to test IE's treatment of not explicitly
  10608. // setting a boolean content attribute,
  10609. // since its presence should be enough
  10610. // https://bugs.jquery.com/ticket/12359
  10611. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  10612. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  10613. "<option selected=''></option></select>";
  10614. // Support: IE8, Opera 11-12.16
  10615. // Nothing should be selected when empty strings follow ^= or $= or *=
  10616. // The test attribute must be unknown in Opera but "safe" for WinRT
  10617. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  10618. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  10619. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  10620. }
  10621. // Support: IE8
  10622. // Boolean attributes and "value" are not treated correctly
  10623. if ( !el.querySelectorAll("[selected]").length ) {
  10624. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  10625. }
  10626. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  10627. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  10628. rbuggyQSA.push("~=");
  10629. }
  10630. // Webkit/Opera - :checked should return selected option elements
  10631. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10632. // IE8 throws error here and will not see later tests
  10633. if ( !el.querySelectorAll(":checked").length ) {
  10634. rbuggyQSA.push(":checked");
  10635. }
  10636. // Support: Safari 8+, iOS 8+
  10637. // https://bugs.webkit.org/show_bug.cgi?id=136851
  10638. // In-page `selector#id sibling-combinator selector` fails
  10639. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  10640. rbuggyQSA.push(".#.+[+~]");
  10641. }
  10642. });
  10643. assert(function( el ) {
  10644. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  10645. "<select disabled='disabled'><option/></select>";
  10646. // Support: Windows 8 Native Apps
  10647. // The type and name attributes are restricted during .innerHTML assignment
  10648. var input = document.createElement("input");
  10649. input.setAttribute( "type", "hidden" );
  10650. el.appendChild( input ).setAttribute( "name", "D" );
  10651. // Support: IE8
  10652. // Enforce case-sensitivity of name attribute
  10653. if ( el.querySelectorAll("[name=d]").length ) {
  10654. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  10655. }
  10656. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  10657. // IE8 throws error here and will not see later tests
  10658. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  10659. rbuggyQSA.push( ":enabled", ":disabled" );
  10660. }
  10661. // Support: IE9-11+
  10662. // IE's :disabled selector does not pick up the children of disabled fieldsets
  10663. docElem.appendChild( el ).disabled = true;
  10664. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  10665. rbuggyQSA.push( ":enabled", ":disabled" );
  10666. }
  10667. // Opera 10-11 does not throw on post-comma invalid pseudos
  10668. el.querySelectorAll("*,:x");
  10669. rbuggyQSA.push(",.*:");
  10670. });
  10671. }
  10672. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  10673. docElem.webkitMatchesSelector ||
  10674. docElem.mozMatchesSelector ||
  10675. docElem.oMatchesSelector ||
  10676. docElem.msMatchesSelector) )) ) {
  10677. assert(function( el ) {
  10678. // Check to see if it's possible to do matchesSelector
  10679. // on a disconnected node (IE 9)
  10680. support.disconnectedMatch = matches.call( el, "*" );
  10681. // This should fail with an exception
  10682. // Gecko does not error, returns false instead
  10683. matches.call( el, "[s!='']:x" );
  10684. rbuggyMatches.push( "!=", pseudos );
  10685. });
  10686. }
  10687. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  10688. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  10689. /* Contains
  10690. ---------------------------------------------------------------------- */
  10691. hasCompare = rnative.test( docElem.compareDocumentPosition );
  10692. // Element contains another
  10693. // Purposefully self-exclusive
  10694. // As in, an element does not contain itself
  10695. contains = hasCompare || rnative.test( docElem.contains ) ?
  10696. function( a, b ) {
  10697. var adown = a.nodeType === 9 ? a.documentElement : a,
  10698. bup = b && b.parentNode;
  10699. return a === bup || !!( bup && bup.nodeType === 1 && (
  10700. adown.contains ?
  10701. adown.contains( bup ) :
  10702. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  10703. ));
  10704. } :
  10705. function( a, b ) {
  10706. if ( b ) {
  10707. while ( (b = b.parentNode) ) {
  10708. if ( b === a ) {
  10709. return true;
  10710. }
  10711. }
  10712. }
  10713. return false;
  10714. };
  10715. /* Sorting
  10716. ---------------------------------------------------------------------- */
  10717. // Document order sorting
  10718. sortOrder = hasCompare ?
  10719. function( a, b ) {
  10720. // Flag for duplicate removal
  10721. if ( a === b ) {
  10722. hasDuplicate = true;
  10723. return 0;
  10724. }
  10725. // Sort on method existence if only one input has compareDocumentPosition
  10726. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  10727. if ( compare ) {
  10728. return compare;
  10729. }
  10730. // Calculate position if both inputs belong to the same document
  10731. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  10732. a.compareDocumentPosition( b ) :
  10733. // Otherwise we know they are disconnected
  10734. 1;
  10735. // Disconnected nodes
  10736. if ( compare & 1 ||
  10737. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  10738. // Choose the first element that is related to our preferred document
  10739. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  10740. return -1;
  10741. }
  10742. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  10743. return 1;
  10744. }
  10745. // Maintain original order
  10746. return sortInput ?
  10747. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10748. 0;
  10749. }
  10750. return compare & 4 ? -1 : 1;
  10751. } :
  10752. function( a, b ) {
  10753. // Exit early if the nodes are identical
  10754. if ( a === b ) {
  10755. hasDuplicate = true;
  10756. return 0;
  10757. }
  10758. var cur,
  10759. i = 0,
  10760. aup = a.parentNode,
  10761. bup = b.parentNode,
  10762. ap = [ a ],
  10763. bp = [ b ];
  10764. // Parentless nodes are either documents or disconnected
  10765. if ( !aup || !bup ) {
  10766. return a === document ? -1 :
  10767. b === document ? 1 :
  10768. aup ? -1 :
  10769. bup ? 1 :
  10770. sortInput ?
  10771. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10772. 0;
  10773. // If the nodes are siblings, we can do a quick check
  10774. } else if ( aup === bup ) {
  10775. return siblingCheck( a, b );
  10776. }
  10777. // Otherwise we need full lists of their ancestors for comparison
  10778. cur = a;
  10779. while ( (cur = cur.parentNode) ) {
  10780. ap.unshift( cur );
  10781. }
  10782. cur = b;
  10783. while ( (cur = cur.parentNode) ) {
  10784. bp.unshift( cur );
  10785. }
  10786. // Walk down the tree looking for a discrepancy
  10787. while ( ap[i] === bp[i] ) {
  10788. i++;
  10789. }
  10790. return i ?
  10791. // Do a sibling check if the nodes have a common ancestor
  10792. siblingCheck( ap[i], bp[i] ) :
  10793. // Otherwise nodes in our document sort first
  10794. ap[i] === preferredDoc ? -1 :
  10795. bp[i] === preferredDoc ? 1 :
  10796. 0;
  10797. };
  10798. return document;
  10799. };
  10800. Sizzle.matches = function( expr, elements ) {
  10801. return Sizzle( expr, null, null, elements );
  10802. };
  10803. Sizzle.matchesSelector = function( elem, expr ) {
  10804. // Set document vars if needed
  10805. if ( ( elem.ownerDocument || elem ) !== document ) {
  10806. setDocument( elem );
  10807. }
  10808. if ( support.matchesSelector && documentIsHTML &&
  10809. !nonnativeSelectorCache[ expr + " " ] &&
  10810. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  10811. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  10812. try {
  10813. var ret = matches.call( elem, expr );
  10814. // IE 9's matchesSelector returns false on disconnected nodes
  10815. if ( ret || support.disconnectedMatch ||
  10816. // As well, disconnected nodes are said to be in a document
  10817. // fragment in IE 9
  10818. elem.document && elem.document.nodeType !== 11 ) {
  10819. return ret;
  10820. }
  10821. } catch (e) {
  10822. nonnativeSelectorCache( expr, true );
  10823. }
  10824. }
  10825. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  10826. };
  10827. Sizzle.contains = function( context, elem ) {
  10828. // Set document vars if needed
  10829. if ( ( context.ownerDocument || context ) !== document ) {
  10830. setDocument( context );
  10831. }
  10832. return contains( context, elem );
  10833. };
  10834. Sizzle.attr = function( elem, name ) {
  10835. // Set document vars if needed
  10836. if ( ( elem.ownerDocument || elem ) !== document ) {
  10837. setDocument( elem );
  10838. }
  10839. var fn = Expr.attrHandle[ name.toLowerCase() ],
  10840. // Don't get fooled by Object.prototype properties (jQuery #13807)
  10841. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  10842. fn( elem, name, !documentIsHTML ) :
  10843. undefined;
  10844. return val !== undefined ?
  10845. val :
  10846. support.attributes || !documentIsHTML ?
  10847. elem.getAttribute( name ) :
  10848. (val = elem.getAttributeNode(name)) && val.specified ?
  10849. val.value :
  10850. null;
  10851. };
  10852. Sizzle.escape = function( sel ) {
  10853. return (sel + "").replace( rcssescape, fcssescape );
  10854. };
  10855. Sizzle.error = function( msg ) {
  10856. throw new Error( "Syntax error, unrecognized expression: " + msg );
  10857. };
  10858. /**
  10859. * Document sorting and removing duplicates
  10860. * @param {ArrayLike} results
  10861. */
  10862. Sizzle.uniqueSort = function( results ) {
  10863. var elem,
  10864. duplicates = [],
  10865. j = 0,
  10866. i = 0;
  10867. // Unless we *know* we can detect duplicates, assume their presence
  10868. hasDuplicate = !support.detectDuplicates;
  10869. sortInput = !support.sortStable && results.slice( 0 );
  10870. results.sort( sortOrder );
  10871. if ( hasDuplicate ) {
  10872. while ( (elem = results[i++]) ) {
  10873. if ( elem === results[ i ] ) {
  10874. j = duplicates.push( i );
  10875. }
  10876. }
  10877. while ( j-- ) {
  10878. results.splice( duplicates[ j ], 1 );
  10879. }
  10880. }
  10881. // Clear input after sorting to release objects
  10882. // See https://github.com/jquery/sizzle/pull/225
  10883. sortInput = null;
  10884. return results;
  10885. };
  10886. /**
  10887. * Utility function for retrieving the text value of an array of DOM nodes
  10888. * @param {Array|Element} elem
  10889. */
  10890. getText = Sizzle.getText = function( elem ) {
  10891. var node,
  10892. ret = "",
  10893. i = 0,
  10894. nodeType = elem.nodeType;
  10895. if ( !nodeType ) {
  10896. // If no nodeType, this is expected to be an array
  10897. while ( (node = elem[i++]) ) {
  10898. // Do not traverse comment nodes
  10899. ret += getText( node );
  10900. }
  10901. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  10902. // Use textContent for elements
  10903. // innerText usage removed for consistency of new lines (jQuery #11153)
  10904. if ( typeof elem.textContent === "string" ) {
  10905. return elem.textContent;
  10906. } else {
  10907. // Traverse its children
  10908. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10909. ret += getText( elem );
  10910. }
  10911. }
  10912. } else if ( nodeType === 3 || nodeType === 4 ) {
  10913. return elem.nodeValue;
  10914. }
  10915. // Do not include comment or processing instruction nodes
  10916. return ret;
  10917. };
  10918. Expr = Sizzle.selectors = {
  10919. // Can be adjusted by the user
  10920. cacheLength: 50,
  10921. createPseudo: markFunction,
  10922. match: matchExpr,
  10923. attrHandle: {},
  10924. find: {},
  10925. relative: {
  10926. ">": { dir: "parentNode", first: true },
  10927. " ": { dir: "parentNode" },
  10928. "+": { dir: "previousSibling", first: true },
  10929. "~": { dir: "previousSibling" }
  10930. },
  10931. preFilter: {
  10932. "ATTR": function( match ) {
  10933. match[1] = match[1].replace( runescape, funescape );
  10934. // Move the given value to match[3] whether quoted or unquoted
  10935. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10936. if ( match[2] === "~=" ) {
  10937. match[3] = " " + match[3] + " ";
  10938. }
  10939. return match.slice( 0, 4 );
  10940. },
  10941. "CHILD": function( match ) {
  10942. /* matches from matchExpr["CHILD"]
  10943. 1 type (only|nth|...)
  10944. 2 what (child|of-type)
  10945. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10946. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10947. 5 sign of xn-component
  10948. 6 x of xn-component
  10949. 7 sign of y-component
  10950. 8 y of y-component
  10951. */
  10952. match[1] = match[1].toLowerCase();
  10953. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10954. // nth-* requires argument
  10955. if ( !match[3] ) {
  10956. Sizzle.error( match[0] );
  10957. }
  10958. // numeric x and y parameters for Expr.filter.CHILD
  10959. // remember that false/true cast respectively to 0/1
  10960. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10961. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10962. // other types prohibit arguments
  10963. } else if ( match[3] ) {
  10964. Sizzle.error( match[0] );
  10965. }
  10966. return match;
  10967. },
  10968. "PSEUDO": function( match ) {
  10969. var excess,
  10970. unquoted = !match[6] && match[2];
  10971. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10972. return null;
  10973. }
  10974. // Accept quoted arguments as-is
  10975. if ( match[3] ) {
  10976. match[2] = match[4] || match[5] || "";
  10977. // Strip excess characters from unquoted arguments
  10978. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10979. // Get excess from tokenize (recursively)
  10980. (excess = tokenize( unquoted, true )) &&
  10981. // advance to the next closing parenthesis
  10982. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10983. // excess is a negative index
  10984. match[0] = match[0].slice( 0, excess );
  10985. match[2] = unquoted.slice( 0, excess );
  10986. }
  10987. // Return only captures needed by the pseudo filter method (type and argument)
  10988. return match.slice( 0, 3 );
  10989. }
  10990. },
  10991. filter: {
  10992. "TAG": function( nodeNameSelector ) {
  10993. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10994. return nodeNameSelector === "*" ?
  10995. function() { return true; } :
  10996. function( elem ) {
  10997. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10998. };
  10999. },
  11000. "CLASS": function( className ) {
  11001. var pattern = classCache[ className + " " ];
  11002. return pattern ||
  11003. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  11004. classCache( className, function( elem ) {
  11005. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  11006. });
  11007. },
  11008. "ATTR": function( name, operator, check ) {
  11009. return function( elem ) {
  11010. var result = Sizzle.attr( elem, name );
  11011. if ( result == null ) {
  11012. return operator === "!=";
  11013. }
  11014. if ( !operator ) {
  11015. return true;
  11016. }
  11017. result += "";
  11018. return operator === "=" ? result === check :
  11019. operator === "!=" ? result !== check :
  11020. operator === "^=" ? check && result.indexOf( check ) === 0 :
  11021. operator === "*=" ? check && result.indexOf( check ) > -1 :
  11022. operator === "$=" ? check && result.slice( -check.length ) === check :
  11023. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  11024. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  11025. false;
  11026. };
  11027. },
  11028. "CHILD": function( type, what, argument, first, last ) {
  11029. var simple = type.slice( 0, 3 ) !== "nth",
  11030. forward = type.slice( -4 ) !== "last",
  11031. ofType = what === "of-type";
  11032. return first === 1 && last === 0 ?
  11033. // Shortcut for :nth-*(n)
  11034. function( elem ) {
  11035. return !!elem.parentNode;
  11036. } :
  11037. function( elem, context, xml ) {
  11038. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  11039. dir = simple !== forward ? "nextSibling" : "previousSibling",
  11040. parent = elem.parentNode,
  11041. name = ofType && elem.nodeName.toLowerCase(),
  11042. useCache = !xml && !ofType,
  11043. diff = false;
  11044. if ( parent ) {
  11045. // :(first|last|only)-(child|of-type)
  11046. if ( simple ) {
  11047. while ( dir ) {
  11048. node = elem;
  11049. while ( (node = node[ dir ]) ) {
  11050. if ( ofType ?
  11051. node.nodeName.toLowerCase() === name :
  11052. node.nodeType === 1 ) {
  11053. return false;
  11054. }
  11055. }
  11056. // Reverse direction for :only-* (if we haven't yet done so)
  11057. start = dir = type === "only" && !start && "nextSibling";
  11058. }
  11059. return true;
  11060. }
  11061. start = [ forward ? parent.firstChild : parent.lastChild ];
  11062. // non-xml :nth-child(...) stores cache data on `parent`
  11063. if ( forward && useCache ) {
  11064. // Seek `elem` from a previously-cached index
  11065. // ...in a gzip-friendly way
  11066. node = parent;
  11067. outerCache = node[ expando ] || (node[ expando ] = {});
  11068. // Support: IE <9 only
  11069. // Defend against cloned attroperties (jQuery gh-1709)
  11070. uniqueCache = outerCache[ node.uniqueID ] ||
  11071. (outerCache[ node.uniqueID ] = {});
  11072. cache = uniqueCache[ type ] || [];
  11073. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  11074. diff = nodeIndex && cache[ 2 ];
  11075. node = nodeIndex && parent.childNodes[ nodeIndex ];
  11076. while ( (node = ++nodeIndex && node && node[ dir ] ||
  11077. // Fallback to seeking `elem` from the start
  11078. (diff = nodeIndex = 0) || start.pop()) ) {
  11079. // When found, cache indexes on `parent` and break
  11080. if ( node.nodeType === 1 && ++diff && node === elem ) {
  11081. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  11082. break;
  11083. }
  11084. }
  11085. } else {
  11086. // Use previously-cached element index if available
  11087. if ( useCache ) {
  11088. // ...in a gzip-friendly way
  11089. node = elem;
  11090. outerCache = node[ expando ] || (node[ expando ] = {});
  11091. // Support: IE <9 only
  11092. // Defend against cloned attroperties (jQuery gh-1709)
  11093. uniqueCache = outerCache[ node.uniqueID ] ||
  11094. (outerCache[ node.uniqueID ] = {});
  11095. cache = uniqueCache[ type ] || [];
  11096. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  11097. diff = nodeIndex;
  11098. }
  11099. // xml :nth-child(...)
  11100. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  11101. if ( diff === false ) {
  11102. // Use the same loop as above to seek `elem` from the start
  11103. while ( (node = ++nodeIndex && node && node[ dir ] ||
  11104. (diff = nodeIndex = 0) || start.pop()) ) {
  11105. if ( ( ofType ?
  11106. node.nodeName.toLowerCase() === name :
  11107. node.nodeType === 1 ) &&
  11108. ++diff ) {
  11109. // Cache the index of each encountered element
  11110. if ( useCache ) {
  11111. outerCache = node[ expando ] || (node[ expando ] = {});
  11112. // Support: IE <9 only
  11113. // Defend against cloned attroperties (jQuery gh-1709)
  11114. uniqueCache = outerCache[ node.uniqueID ] ||
  11115. (outerCache[ node.uniqueID ] = {});
  11116. uniqueCache[ type ] = [ dirruns, diff ];
  11117. }
  11118. if ( node === elem ) {
  11119. break;
  11120. }
  11121. }
  11122. }
  11123. }
  11124. }
  11125. // Incorporate the offset, then check against cycle size
  11126. diff -= last;
  11127. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  11128. }
  11129. };
  11130. },
  11131. "PSEUDO": function( pseudo, argument ) {
  11132. // pseudo-class names are case-insensitive
  11133. // http://www.w3.org/TR/selectors/#pseudo-classes
  11134. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  11135. // Remember that setFilters inherits from pseudos
  11136. var args,
  11137. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  11138. Sizzle.error( "unsupported pseudo: " + pseudo );
  11139. // The user may use createPseudo to indicate that
  11140. // arguments are needed to create the filter function
  11141. // just as Sizzle does
  11142. if ( fn[ expando ] ) {
  11143. return fn( argument );
  11144. }
  11145. // But maintain support for old signatures
  11146. if ( fn.length > 1 ) {
  11147. args = [ pseudo, pseudo, "", argument ];
  11148. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  11149. markFunction(function( seed, matches ) {
  11150. var idx,
  11151. matched = fn( seed, argument ),
  11152. i = matched.length;
  11153. while ( i-- ) {
  11154. idx = indexOf( seed, matched[i] );
  11155. seed[ idx ] = !( matches[ idx ] = matched[i] );
  11156. }
  11157. }) :
  11158. function( elem ) {
  11159. return fn( elem, 0, args );
  11160. };
  11161. }
  11162. return fn;
  11163. }
  11164. },
  11165. pseudos: {
  11166. // Potentially complex pseudos
  11167. "not": markFunction(function( selector ) {
  11168. // Trim the selector passed to compile
  11169. // to avoid treating leading and trailing
  11170. // spaces as combinators
  11171. var input = [],
  11172. results = [],
  11173. matcher = compile( selector.replace( rtrim, "$1" ) );
  11174. return matcher[ expando ] ?
  11175. markFunction(function( seed, matches, context, xml ) {
  11176. var elem,
  11177. unmatched = matcher( seed, null, xml, [] ),
  11178. i = seed.length;
  11179. // Match elements unmatched by `matcher`
  11180. while ( i-- ) {
  11181. if ( (elem = unmatched[i]) ) {
  11182. seed[i] = !(matches[i] = elem);
  11183. }
  11184. }
  11185. }) :
  11186. function( elem, context, xml ) {
  11187. input[0] = elem;
  11188. matcher( input, null, xml, results );
  11189. // Don't keep the element (issue #299)
  11190. input[0] = null;
  11191. return !results.pop();
  11192. };
  11193. }),
  11194. "has": markFunction(function( selector ) {
  11195. return function( elem ) {
  11196. return Sizzle( selector, elem ).length > 0;
  11197. };
  11198. }),
  11199. "contains": markFunction(function( text ) {
  11200. text = text.replace( runescape, funescape );
  11201. return function( elem ) {
  11202. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  11203. };
  11204. }),
  11205. // "Whether an element is represented by a :lang() selector
  11206. // is based solely on the element's language value
  11207. // being equal to the identifier C,
  11208. // or beginning with the identifier C immediately followed by "-".
  11209. // The matching of C against the element's language value is performed case-insensitively.
  11210. // The identifier C does not have to be a valid language name."
  11211. // http://www.w3.org/TR/selectors/#lang-pseudo
  11212. "lang": markFunction( function( lang ) {
  11213. // lang value must be a valid identifier
  11214. if ( !ridentifier.test(lang || "") ) {
  11215. Sizzle.error( "unsupported lang: " + lang );
  11216. }
  11217. lang = lang.replace( runescape, funescape ).toLowerCase();
  11218. return function( elem ) {
  11219. var elemLang;
  11220. do {
  11221. if ( (elemLang = documentIsHTML ?
  11222. elem.lang :
  11223. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  11224. elemLang = elemLang.toLowerCase();
  11225. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  11226. }
  11227. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  11228. return false;
  11229. };
  11230. }),
  11231. // Miscellaneous
  11232. "target": function( elem ) {
  11233. var hash = window.location && window.location.hash;
  11234. return hash && hash.slice( 1 ) === elem.id;
  11235. },
  11236. "root": function( elem ) {
  11237. return elem === docElem;
  11238. },
  11239. "focus": function( elem ) {
  11240. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  11241. },
  11242. // Boolean properties
  11243. "enabled": createDisabledPseudo( false ),
  11244. "disabled": createDisabledPseudo( true ),
  11245. "checked": function( elem ) {
  11246. // In CSS3, :checked should return both checked and selected elements
  11247. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  11248. var nodeName = elem.nodeName.toLowerCase();
  11249. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  11250. },
  11251. "selected": function( elem ) {
  11252. // Accessing this property makes selected-by-default
  11253. // options in Safari work properly
  11254. if ( elem.parentNode ) {
  11255. elem.parentNode.selectedIndex;
  11256. }
  11257. return elem.selected === true;
  11258. },
  11259. // Contents
  11260. "empty": function( elem ) {
  11261. // http://www.w3.org/TR/selectors/#empty-pseudo
  11262. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  11263. // but not by others (comment: 8; processing instruction: 7; etc.)
  11264. // nodeType < 6 works because attributes (2) do not appear as children
  11265. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  11266. if ( elem.nodeType < 6 ) {
  11267. return false;
  11268. }
  11269. }
  11270. return true;
  11271. },
  11272. "parent": function( elem ) {
  11273. return !Expr.pseudos["empty"]( elem );
  11274. },
  11275. // Element/input types
  11276. "header": function( elem ) {
  11277. return rheader.test( elem.nodeName );
  11278. },
  11279. "input": function( elem ) {
  11280. return rinputs.test( elem.nodeName );
  11281. },
  11282. "button": function( elem ) {
  11283. var name = elem.nodeName.toLowerCase();
  11284. return name === "input" && elem.type === "button" || name === "button";
  11285. },
  11286. "text": function( elem ) {
  11287. var attr;
  11288. return elem.nodeName.toLowerCase() === "input" &&
  11289. elem.type === "text" &&
  11290. // Support: IE<8
  11291. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  11292. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  11293. },
  11294. // Position-in-collection
  11295. "first": createPositionalPseudo(function() {
  11296. return [ 0 ];
  11297. }),
  11298. "last": createPositionalPseudo(function( matchIndexes, length ) {
  11299. return [ length - 1 ];
  11300. }),
  11301. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11302. return [ argument < 0 ? argument + length : argument ];
  11303. }),
  11304. "even": createPositionalPseudo(function( matchIndexes, length ) {
  11305. var i = 0;
  11306. for ( ; i < length; i += 2 ) {
  11307. matchIndexes.push( i );
  11308. }
  11309. return matchIndexes;
  11310. }),
  11311. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  11312. var i = 1;
  11313. for ( ; i < length; i += 2 ) {
  11314. matchIndexes.push( i );
  11315. }
  11316. return matchIndexes;
  11317. }),
  11318. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11319. var i = argument < 0 ?
  11320. argument + length :
  11321. argument > length ?
  11322. length :
  11323. argument;
  11324. for ( ; --i >= 0; ) {
  11325. matchIndexes.push( i );
  11326. }
  11327. return matchIndexes;
  11328. }),
  11329. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11330. var i = argument < 0 ? argument + length : argument;
  11331. for ( ; ++i < length; ) {
  11332. matchIndexes.push( i );
  11333. }
  11334. return matchIndexes;
  11335. })
  11336. }
  11337. };
  11338. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  11339. // Add button/input type pseudos
  11340. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  11341. Expr.pseudos[ i ] = createInputPseudo( i );
  11342. }
  11343. for ( i in { submit: true, reset: true } ) {
  11344. Expr.pseudos[ i ] = createButtonPseudo( i );
  11345. }
  11346. // Easy API for creating new setFilters
  11347. function setFilters() {}
  11348. setFilters.prototype = Expr.filters = Expr.pseudos;
  11349. Expr.setFilters = new setFilters();
  11350. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  11351. var matched, match, tokens, type,
  11352. soFar, groups, preFilters,
  11353. cached = tokenCache[ selector + " " ];
  11354. if ( cached ) {
  11355. return parseOnly ? 0 : cached.slice( 0 );
  11356. }
  11357. soFar = selector;
  11358. groups = [];
  11359. preFilters = Expr.preFilter;
  11360. while ( soFar ) {
  11361. // Comma and first run
  11362. if ( !matched || (match = rcomma.exec( soFar )) ) {
  11363. if ( match ) {
  11364. // Don't consume trailing commas as valid
  11365. soFar = soFar.slice( match[0].length ) || soFar;
  11366. }
  11367. groups.push( (tokens = []) );
  11368. }
  11369. matched = false;
  11370. // Combinators
  11371. if ( (match = rcombinators.exec( soFar )) ) {
  11372. matched = match.shift();
  11373. tokens.push({
  11374. value: matched,
  11375. // Cast descendant combinators to space
  11376. type: match[0].replace( rtrim, " " )
  11377. });
  11378. soFar = soFar.slice( matched.length );
  11379. }
  11380. // Filters
  11381. for ( type in Expr.filter ) {
  11382. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  11383. (match = preFilters[ type ]( match ))) ) {
  11384. matched = match.shift();
  11385. tokens.push({
  11386. value: matched,
  11387. type: type,
  11388. matches: match
  11389. });
  11390. soFar = soFar.slice( matched.length );
  11391. }
  11392. }
  11393. if ( !matched ) {
  11394. break;
  11395. }
  11396. }
  11397. // Return the length of the invalid excess
  11398. // if we're just parsing
  11399. // Otherwise, throw an error or return tokens
  11400. return parseOnly ?
  11401. soFar.length :
  11402. soFar ?
  11403. Sizzle.error( selector ) :
  11404. // Cache the tokens
  11405. tokenCache( selector, groups ).slice( 0 );
  11406. };
  11407. function toSelector( tokens ) {
  11408. var i = 0,
  11409. len = tokens.length,
  11410. selector = "";
  11411. for ( ; i < len; i++ ) {
  11412. selector += tokens[i].value;
  11413. }
  11414. return selector;
  11415. }
  11416. function addCombinator( matcher, combinator, base ) {
  11417. var dir = combinator.dir,
  11418. skip = combinator.next,
  11419. key = skip || dir,
  11420. checkNonElements = base && key === "parentNode",
  11421. doneName = done++;
  11422. return combinator.first ?
  11423. // Check against closest ancestor/preceding element
  11424. function( elem, context, xml ) {
  11425. while ( (elem = elem[ dir ]) ) {
  11426. if ( elem.nodeType === 1 || checkNonElements ) {
  11427. return matcher( elem, context, xml );
  11428. }
  11429. }
  11430. return false;
  11431. } :
  11432. // Check against all ancestor/preceding elements
  11433. function( elem, context, xml ) {
  11434. var oldCache, uniqueCache, outerCache,
  11435. newCache = [ dirruns, doneName ];
  11436. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  11437. if ( xml ) {
  11438. while ( (elem = elem[ dir ]) ) {
  11439. if ( elem.nodeType === 1 || checkNonElements ) {
  11440. if ( matcher( elem, context, xml ) ) {
  11441. return true;
  11442. }
  11443. }
  11444. }
  11445. } else {
  11446. while ( (elem = elem[ dir ]) ) {
  11447. if ( elem.nodeType === 1 || checkNonElements ) {
  11448. outerCache = elem[ expando ] || (elem[ expando ] = {});
  11449. // Support: IE <9 only
  11450. // Defend against cloned attroperties (jQuery gh-1709)
  11451. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  11452. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  11453. elem = elem[ dir ] || elem;
  11454. } else if ( (oldCache = uniqueCache[ key ]) &&
  11455. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  11456. // Assign to newCache so results back-propagate to previous elements
  11457. return (newCache[ 2 ] = oldCache[ 2 ]);
  11458. } else {
  11459. // Reuse newcache so results back-propagate to previous elements
  11460. uniqueCache[ key ] = newCache;
  11461. // A match means we're done; a fail means we have to keep checking
  11462. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  11463. return true;
  11464. }
  11465. }
  11466. }
  11467. }
  11468. }
  11469. return false;
  11470. };
  11471. }
  11472. function elementMatcher( matchers ) {
  11473. return matchers.length > 1 ?
  11474. function( elem, context, xml ) {
  11475. var i = matchers.length;
  11476. while ( i-- ) {
  11477. if ( !matchers[i]( elem, context, xml ) ) {
  11478. return false;
  11479. }
  11480. }
  11481. return true;
  11482. } :
  11483. matchers[0];
  11484. }
  11485. function multipleContexts( selector, contexts, results ) {
  11486. var i = 0,
  11487. len = contexts.length;
  11488. for ( ; i < len; i++ ) {
  11489. Sizzle( selector, contexts[i], results );
  11490. }
  11491. return results;
  11492. }
  11493. function condense( unmatched, map, filter, context, xml ) {
  11494. var elem,
  11495. newUnmatched = [],
  11496. i = 0,
  11497. len = unmatched.length,
  11498. mapped = map != null;
  11499. for ( ; i < len; i++ ) {
  11500. if ( (elem = unmatched[i]) ) {
  11501. if ( !filter || filter( elem, context, xml ) ) {
  11502. newUnmatched.push( elem );
  11503. if ( mapped ) {
  11504. map.push( i );
  11505. }
  11506. }
  11507. }
  11508. }
  11509. return newUnmatched;
  11510. }
  11511. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  11512. if ( postFilter && !postFilter[ expando ] ) {
  11513. postFilter = setMatcher( postFilter );
  11514. }
  11515. if ( postFinder && !postFinder[ expando ] ) {
  11516. postFinder = setMatcher( postFinder, postSelector );
  11517. }
  11518. return markFunction(function( seed, results, context, xml ) {
  11519. var temp, i, elem,
  11520. preMap = [],
  11521. postMap = [],
  11522. preexisting = results.length,
  11523. // Get initial elements from seed or context
  11524. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  11525. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  11526. matcherIn = preFilter && ( seed || !selector ) ?
  11527. condense( elems, preMap, preFilter, context, xml ) :
  11528. elems,
  11529. matcherOut = matcher ?
  11530. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  11531. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  11532. // ...intermediate processing is necessary
  11533. [] :
  11534. // ...otherwise use results directly
  11535. results :
  11536. matcherIn;
  11537. // Find primary matches
  11538. if ( matcher ) {
  11539. matcher( matcherIn, matcherOut, context, xml );
  11540. }
  11541. // Apply postFilter
  11542. if ( postFilter ) {
  11543. temp = condense( matcherOut, postMap );
  11544. postFilter( temp, [], context, xml );
  11545. // Un-match failing elements by moving them back to matcherIn
  11546. i = temp.length;
  11547. while ( i-- ) {
  11548. if ( (elem = temp[i]) ) {
  11549. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  11550. }
  11551. }
  11552. }
  11553. if ( seed ) {
  11554. if ( postFinder || preFilter ) {
  11555. if ( postFinder ) {
  11556. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  11557. temp = [];
  11558. i = matcherOut.length;
  11559. while ( i-- ) {
  11560. if ( (elem = matcherOut[i]) ) {
  11561. // Restore matcherIn since elem is not yet a final match
  11562. temp.push( (matcherIn[i] = elem) );
  11563. }
  11564. }
  11565. postFinder( null, (matcherOut = []), temp, xml );
  11566. }
  11567. // Move matched elements from seed to results to keep them synchronized
  11568. i = matcherOut.length;
  11569. while ( i-- ) {
  11570. if ( (elem = matcherOut[i]) &&
  11571. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  11572. seed[temp] = !(results[temp] = elem);
  11573. }
  11574. }
  11575. }
  11576. // Add elements to results, through postFinder if defined
  11577. } else {
  11578. matcherOut = condense(
  11579. matcherOut === results ?
  11580. matcherOut.splice( preexisting, matcherOut.length ) :
  11581. matcherOut
  11582. );
  11583. if ( postFinder ) {
  11584. postFinder( null, results, matcherOut, xml );
  11585. } else {
  11586. push.apply( results, matcherOut );
  11587. }
  11588. }
  11589. });
  11590. }
  11591. function matcherFromTokens( tokens ) {
  11592. var checkContext, matcher, j,
  11593. len = tokens.length,
  11594. leadingRelative = Expr.relative[ tokens[0].type ],
  11595. implicitRelative = leadingRelative || Expr.relative[" "],
  11596. i = leadingRelative ? 1 : 0,
  11597. // The foundational matcher ensures that elements are reachable from top-level context(s)
  11598. matchContext = addCombinator( function( elem ) {
  11599. return elem === checkContext;
  11600. }, implicitRelative, true ),
  11601. matchAnyContext = addCombinator( function( elem ) {
  11602. return indexOf( checkContext, elem ) > -1;
  11603. }, implicitRelative, true ),
  11604. matchers = [ function( elem, context, xml ) {
  11605. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  11606. (checkContext = context).nodeType ?
  11607. matchContext( elem, context, xml ) :
  11608. matchAnyContext( elem, context, xml ) );
  11609. // Avoid hanging onto element (issue #299)
  11610. checkContext = null;
  11611. return ret;
  11612. } ];
  11613. for ( ; i < len; i++ ) {
  11614. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  11615. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  11616. } else {
  11617. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  11618. // Return special upon seeing a positional matcher
  11619. if ( matcher[ expando ] ) {
  11620. // Find the next relative operator (if any) for proper handling
  11621. j = ++i;
  11622. for ( ; j < len; j++ ) {
  11623. if ( Expr.relative[ tokens[j].type ] ) {
  11624. break;
  11625. }
  11626. }
  11627. return setMatcher(
  11628. i > 1 && elementMatcher( matchers ),
  11629. i > 1 && toSelector(
  11630. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  11631. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  11632. ).replace( rtrim, "$1" ),
  11633. matcher,
  11634. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  11635. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  11636. j < len && toSelector( tokens )
  11637. );
  11638. }
  11639. matchers.push( matcher );
  11640. }
  11641. }
  11642. return elementMatcher( matchers );
  11643. }
  11644. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  11645. var bySet = setMatchers.length > 0,
  11646. byElement = elementMatchers.length > 0,
  11647. superMatcher = function( seed, context, xml, results, outermost ) {
  11648. var elem, j, matcher,
  11649. matchedCount = 0,
  11650. i = "0",
  11651. unmatched = seed && [],
  11652. setMatched = [],
  11653. contextBackup = outermostContext,
  11654. // We must always have either seed elements or outermost context
  11655. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  11656. // Use integer dirruns iff this is the outermost matcher
  11657. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  11658. len = elems.length;
  11659. if ( outermost ) {
  11660. outermostContext = context === document || context || outermost;
  11661. }
  11662. // Add elements passing elementMatchers directly to results
  11663. // Support: IE<9, Safari
  11664. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  11665. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  11666. if ( byElement && elem ) {
  11667. j = 0;
  11668. if ( !context && elem.ownerDocument !== document ) {
  11669. setDocument( elem );
  11670. xml = !documentIsHTML;
  11671. }
  11672. while ( (matcher = elementMatchers[j++]) ) {
  11673. if ( matcher( elem, context || document, xml) ) {
  11674. results.push( elem );
  11675. break;
  11676. }
  11677. }
  11678. if ( outermost ) {
  11679. dirruns = dirrunsUnique;
  11680. }
  11681. }
  11682. // Track unmatched elements for set filters
  11683. if ( bySet ) {
  11684. // They will have gone through all possible matchers
  11685. if ( (elem = !matcher && elem) ) {
  11686. matchedCount--;
  11687. }
  11688. // Lengthen the array for every element, matched or not
  11689. if ( seed ) {
  11690. unmatched.push( elem );
  11691. }
  11692. }
  11693. }
  11694. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  11695. // makes the latter nonnegative.
  11696. matchedCount += i;
  11697. // Apply set filters to unmatched elements
  11698. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  11699. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  11700. // no element matchers and no seed.
  11701. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  11702. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  11703. // numerically zero.
  11704. if ( bySet && i !== matchedCount ) {
  11705. j = 0;
  11706. while ( (matcher = setMatchers[j++]) ) {
  11707. matcher( unmatched, setMatched, context, xml );
  11708. }
  11709. if ( seed ) {
  11710. // Reintegrate element matches to eliminate the need for sorting
  11711. if ( matchedCount > 0 ) {
  11712. while ( i-- ) {
  11713. if ( !(unmatched[i] || setMatched[i]) ) {
  11714. setMatched[i] = pop.call( results );
  11715. }
  11716. }
  11717. }
  11718. // Discard index placeholder values to get only actual matches
  11719. setMatched = condense( setMatched );
  11720. }
  11721. // Add matches to results
  11722. push.apply( results, setMatched );
  11723. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  11724. if ( outermost && !seed && setMatched.length > 0 &&
  11725. ( matchedCount + setMatchers.length ) > 1 ) {
  11726. Sizzle.uniqueSort( results );
  11727. }
  11728. }
  11729. // Override manipulation of globals by nested matchers
  11730. if ( outermost ) {
  11731. dirruns = dirrunsUnique;
  11732. outermostContext = contextBackup;
  11733. }
  11734. return unmatched;
  11735. };
  11736. return bySet ?
  11737. markFunction( superMatcher ) :
  11738. superMatcher;
  11739. }
  11740. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  11741. var i,
  11742. setMatchers = [],
  11743. elementMatchers = [],
  11744. cached = compilerCache[ selector + " " ];
  11745. if ( !cached ) {
  11746. // Generate a function of recursive functions that can be used to check each element
  11747. if ( !match ) {
  11748. match = tokenize( selector );
  11749. }
  11750. i = match.length;
  11751. while ( i-- ) {
  11752. cached = matcherFromTokens( match[i] );
  11753. if ( cached[ expando ] ) {
  11754. setMatchers.push( cached );
  11755. } else {
  11756. elementMatchers.push( cached );
  11757. }
  11758. }
  11759. // Cache the compiled function
  11760. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  11761. // Save selector and tokenization
  11762. cached.selector = selector;
  11763. }
  11764. return cached;
  11765. };
  11766. /**
  11767. * A low-level selection function that works with Sizzle's compiled
  11768. * selector functions
  11769. * @param {String|Function} selector A selector or a pre-compiled
  11770. * selector function built with Sizzle.compile
  11771. * @param {Element} context
  11772. * @param {Array} [results]
  11773. * @param {Array} [seed] A set of elements to match against
  11774. */
  11775. select = Sizzle.select = function( selector, context, results, seed ) {
  11776. var i, tokens, token, type, find,
  11777. compiled = typeof selector === "function" && selector,
  11778. match = !seed && tokenize( (selector = compiled.selector || selector) );
  11779. results = results || [];
  11780. // Try to minimize operations if there is only one selector in the list and no seed
  11781. // (the latter of which guarantees us context)
  11782. if ( match.length === 1 ) {
  11783. // Reduce context if the leading compound selector is an ID
  11784. tokens = match[0] = match[0].slice( 0 );
  11785. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  11786. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  11787. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  11788. if ( !context ) {
  11789. return results;
  11790. // Precompiled matchers will still verify ancestry, so step up a level
  11791. } else if ( compiled ) {
  11792. context = context.parentNode;
  11793. }
  11794. selector = selector.slice( tokens.shift().value.length );
  11795. }
  11796. // Fetch a seed set for right-to-left matching
  11797. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  11798. while ( i-- ) {
  11799. token = tokens[i];
  11800. // Abort if we hit a combinator
  11801. if ( Expr.relative[ (type = token.type) ] ) {
  11802. break;
  11803. }
  11804. if ( (find = Expr.find[ type ]) ) {
  11805. // Search, expanding context for leading sibling combinators
  11806. if ( (seed = find(
  11807. token.matches[0].replace( runescape, funescape ),
  11808. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  11809. )) ) {
  11810. // If seed is empty or no tokens remain, we can return early
  11811. tokens.splice( i, 1 );
  11812. selector = seed.length && toSelector( tokens );
  11813. if ( !selector ) {
  11814. push.apply( results, seed );
  11815. return results;
  11816. }
  11817. break;
  11818. }
  11819. }
  11820. }
  11821. }
  11822. // Compile and execute a filtering function if one is not provided
  11823. // Provide `match` to avoid retokenization if we modified the selector above
  11824. ( compiled || compile( selector, match ) )(
  11825. seed,
  11826. context,
  11827. !documentIsHTML,
  11828. results,
  11829. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  11830. );
  11831. return results;
  11832. };
  11833. // One-time assignments
  11834. // Sort stability
  11835. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  11836. // Support: Chrome 14-35+
  11837. // Always assume duplicates if they aren't passed to the comparison function
  11838. support.detectDuplicates = !!hasDuplicate;
  11839. // Initialize against the default document
  11840. setDocument();
  11841. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  11842. // Detached nodes confoundingly follow *each other*
  11843. support.sortDetached = assert(function( el ) {
  11844. // Should return 1, but returns 4 (following)
  11845. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  11846. });
  11847. // Support: IE<8
  11848. // Prevent attribute/property "interpolation"
  11849. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  11850. if ( !assert(function( el ) {
  11851. el.innerHTML = "<a href='#'></a>";
  11852. return el.firstChild.getAttribute("href") === "#" ;
  11853. }) ) {
  11854. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  11855. if ( !isXML ) {
  11856. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  11857. }
  11858. });
  11859. }
  11860. // Support: IE<9
  11861. // Use defaultValue in place of getAttribute("value")
  11862. if ( !support.attributes || !assert(function( el ) {
  11863. el.innerHTML = "<input/>";
  11864. el.firstChild.setAttribute( "value", "" );
  11865. return el.firstChild.getAttribute( "value" ) === "";
  11866. }) ) {
  11867. addHandle( "value", function( elem, name, isXML ) {
  11868. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  11869. return elem.defaultValue;
  11870. }
  11871. });
  11872. }
  11873. // Support: IE<9
  11874. // Use getAttributeNode to fetch booleans when getAttribute lies
  11875. if ( !assert(function( el ) {
  11876. return el.getAttribute("disabled") == null;
  11877. }) ) {
  11878. addHandle( booleans, function( elem, name, isXML ) {
  11879. var val;
  11880. if ( !isXML ) {
  11881. return elem[ name ] === true ? name.toLowerCase() :
  11882. (val = elem.getAttributeNode( name )) && val.specified ?
  11883. val.value :
  11884. null;
  11885. }
  11886. });
  11887. }
  11888. return Sizzle;
  11889. })( window );
  11890. jQuery.find = Sizzle;
  11891. jQuery.expr = Sizzle.selectors;
  11892. // Deprecated
  11893. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  11894. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  11895. jQuery.text = Sizzle.getText;
  11896. jQuery.isXMLDoc = Sizzle.isXML;
  11897. jQuery.contains = Sizzle.contains;
  11898. jQuery.escapeSelector = Sizzle.escape;
  11899. var dir = function( elem, dir, until ) {
  11900. var matched = [],
  11901. truncate = until !== undefined;
  11902. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  11903. if ( elem.nodeType === 1 ) {
  11904. if ( truncate && jQuery( elem ).is( until ) ) {
  11905. break;
  11906. }
  11907. matched.push( elem );
  11908. }
  11909. }
  11910. return matched;
  11911. };
  11912. var siblings = function( n, elem ) {
  11913. var matched = [];
  11914. for ( ; n; n = n.nextSibling ) {
  11915. if ( n.nodeType === 1 && n !== elem ) {
  11916. matched.push( n );
  11917. }
  11918. }
  11919. return matched;
  11920. };
  11921. var rneedsContext = jQuery.expr.match.needsContext;
  11922. function nodeName( elem, name ) {
  11923. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11924. };
  11925. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11926. // Implement the identical functionality for filter and not
  11927. function winnow( elements, qualifier, not ) {
  11928. if ( isFunction( qualifier ) ) {
  11929. return jQuery.grep( elements, function( elem, i ) {
  11930. return !!qualifier.call( elem, i, elem ) !== not;
  11931. } );
  11932. }
  11933. // Single element
  11934. if ( qualifier.nodeType ) {
  11935. return jQuery.grep( elements, function( elem ) {
  11936. return ( elem === qualifier ) !== not;
  11937. } );
  11938. }
  11939. // Arraylike of elements (jQuery, arguments, Array)
  11940. if ( typeof qualifier !== "string" ) {
  11941. return jQuery.grep( elements, function( elem ) {
  11942. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11943. } );
  11944. }
  11945. // Filtered directly for both simple and complex selectors
  11946. return jQuery.filter( qualifier, elements, not );
  11947. }
  11948. jQuery.filter = function( expr, elems, not ) {
  11949. var elem = elems[ 0 ];
  11950. if ( not ) {
  11951. expr = ":not(" + expr + ")";
  11952. }
  11953. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11954. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11955. }
  11956. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11957. return elem.nodeType === 1;
  11958. } ) );
  11959. };
  11960. jQuery.fn.extend( {
  11961. find: function( selector ) {
  11962. var i, ret,
  11963. len = this.length,
  11964. self = this;
  11965. if ( typeof selector !== "string" ) {
  11966. return this.pushStack( jQuery( selector ).filter( function() {
  11967. for ( i = 0; i < len; i++ ) {
  11968. if ( jQuery.contains( self[ i ], this ) ) {
  11969. return true;
  11970. }
  11971. }
  11972. } ) );
  11973. }
  11974. ret = this.pushStack( [] );
  11975. for ( i = 0; i < len; i++ ) {
  11976. jQuery.find( selector, self[ i ], ret );
  11977. }
  11978. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11979. },
  11980. filter: function( selector ) {
  11981. return this.pushStack( winnow( this, selector || [], false ) );
  11982. },
  11983. not: function( selector ) {
  11984. return this.pushStack( winnow( this, selector || [], true ) );
  11985. },
  11986. is: function( selector ) {
  11987. return !!winnow(
  11988. this,
  11989. // If this is a positional/relative selector, check membership in the returned set
  11990. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11991. typeof selector === "string" && rneedsContext.test( selector ) ?
  11992. jQuery( selector ) :
  11993. selector || [],
  11994. false
  11995. ).length;
  11996. }
  11997. } );
  11998. // Initialize a jQuery object
  11999. // A central reference to the root jQuery(document)
  12000. var rootjQuery,
  12001. // A simple way to check for HTML strings
  12002. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  12003. // Strict HTML recognition (#11290: must start with <)
  12004. // Shortcut simple #id case for speed
  12005. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  12006. init = jQuery.fn.init = function( selector, context, root ) {
  12007. var match, elem;
  12008. // HANDLE: $(""), $(null), $(undefined), $(false)
  12009. if ( !selector ) {
  12010. return this;
  12011. }
  12012. // Method init() accepts an alternate rootjQuery
  12013. // so migrate can support jQuery.sub (gh-2101)
  12014. root = root || rootjQuery;
  12015. // Handle HTML strings
  12016. if ( typeof selector === "string" ) {
  12017. if ( selector[ 0 ] === "<" &&
  12018. selector[ selector.length - 1 ] === ">" &&
  12019. selector.length >= 3 ) {
  12020. // Assume that strings that start and end with <> are HTML and skip the regex check
  12021. match = [ null, selector, null ];
  12022. } else {
  12023. match = rquickExpr.exec( selector );
  12024. }
  12025. // Match html or make sure no context is specified for #id
  12026. if ( match && ( match[ 1 ] || !context ) ) {
  12027. // HANDLE: $(html) -> $(array)
  12028. if ( match[ 1 ] ) {
  12029. context = context instanceof jQuery ? context[ 0 ] : context;
  12030. // Option to run scripts is true for back-compat
  12031. // Intentionally let the error be thrown if parseHTML is not present
  12032. jQuery.merge( this, jQuery.parseHTML(
  12033. match[ 1 ],
  12034. context && context.nodeType ? context.ownerDocument || context : document,
  12035. true
  12036. ) );
  12037. // HANDLE: $(html, props)
  12038. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  12039. for ( match in context ) {
  12040. // Properties of context are called as methods if possible
  12041. if ( isFunction( this[ match ] ) ) {
  12042. this[ match ]( context[ match ] );
  12043. // ...and otherwise set as attributes
  12044. } else {
  12045. this.attr( match, context[ match ] );
  12046. }
  12047. }
  12048. }
  12049. return this;
  12050. // HANDLE: $(#id)
  12051. } else {
  12052. elem = document.getElementById( match[ 2 ] );
  12053. if ( elem ) {
  12054. // Inject the element directly into the jQuery object
  12055. this[ 0 ] = elem;
  12056. this.length = 1;
  12057. }
  12058. return this;
  12059. }
  12060. // HANDLE: $(expr, $(...))
  12061. } else if ( !context || context.jquery ) {
  12062. return ( context || root ).find( selector );
  12063. // HANDLE: $(expr, context)
  12064. // (which is just equivalent to: $(context).find(expr)
  12065. } else {
  12066. return this.constructor( context ).find( selector );
  12067. }
  12068. // HANDLE: $(DOMElement)
  12069. } else if ( selector.nodeType ) {
  12070. this[ 0 ] = selector;
  12071. this.length = 1;
  12072. return this;
  12073. // HANDLE: $(function)
  12074. // Shortcut for document ready
  12075. } else if ( isFunction( selector ) ) {
  12076. return root.ready !== undefined ?
  12077. root.ready( selector ) :
  12078. // Execute immediately if ready is not present
  12079. selector( jQuery );
  12080. }
  12081. return jQuery.makeArray( selector, this );
  12082. };
  12083. // Give the init function the jQuery prototype for later instantiation
  12084. init.prototype = jQuery.fn;
  12085. // Initialize central reference
  12086. rootjQuery = jQuery( document );
  12087. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  12088. // Methods guaranteed to produce a unique set when starting from a unique set
  12089. guaranteedUnique = {
  12090. children: true,
  12091. contents: true,
  12092. next: true,
  12093. prev: true
  12094. };
  12095. jQuery.fn.extend( {
  12096. has: function( target ) {
  12097. var targets = jQuery( target, this ),
  12098. l = targets.length;
  12099. return this.filter( function() {
  12100. var i = 0;
  12101. for ( ; i < l; i++ ) {
  12102. if ( jQuery.contains( this, targets[ i ] ) ) {
  12103. return true;
  12104. }
  12105. }
  12106. } );
  12107. },
  12108. closest: function( selectors, context ) {
  12109. var cur,
  12110. i = 0,
  12111. l = this.length,
  12112. matched = [],
  12113. targets = typeof selectors !== "string" && jQuery( selectors );
  12114. // Positional selectors never match, since there's no _selection_ context
  12115. if ( !rneedsContext.test( selectors ) ) {
  12116. for ( ; i < l; i++ ) {
  12117. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  12118. // Always skip document fragments
  12119. if ( cur.nodeType < 11 && ( targets ?
  12120. targets.index( cur ) > -1 :
  12121. // Don't pass non-elements to Sizzle
  12122. cur.nodeType === 1 &&
  12123. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  12124. matched.push( cur );
  12125. break;
  12126. }
  12127. }
  12128. }
  12129. }
  12130. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  12131. },
  12132. // Determine the position of an element within the set
  12133. index: function( elem ) {
  12134. // No argument, return index in parent
  12135. if ( !elem ) {
  12136. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  12137. }
  12138. // Index in selector
  12139. if ( typeof elem === "string" ) {
  12140. return indexOf.call( jQuery( elem ), this[ 0 ] );
  12141. }
  12142. // Locate the position of the desired element
  12143. return indexOf.call( this,
  12144. // If it receives a jQuery object, the first element is used
  12145. elem.jquery ? elem[ 0 ] : elem
  12146. );
  12147. },
  12148. add: function( selector, context ) {
  12149. return this.pushStack(
  12150. jQuery.uniqueSort(
  12151. jQuery.merge( this.get(), jQuery( selector, context ) )
  12152. )
  12153. );
  12154. },
  12155. addBack: function( selector ) {
  12156. return this.add( selector == null ?
  12157. this.prevObject : this.prevObject.filter( selector )
  12158. );
  12159. }
  12160. } );
  12161. function sibling( cur, dir ) {
  12162. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  12163. return cur;
  12164. }
  12165. jQuery.each( {
  12166. parent: function( elem ) {
  12167. var parent = elem.parentNode;
  12168. return parent && parent.nodeType !== 11 ? parent : null;
  12169. },
  12170. parents: function( elem ) {
  12171. return dir( elem, "parentNode" );
  12172. },
  12173. parentsUntil: function( elem, i, until ) {
  12174. return dir( elem, "parentNode", until );
  12175. },
  12176. next: function( elem ) {
  12177. return sibling( elem, "nextSibling" );
  12178. },
  12179. prev: function( elem ) {
  12180. return sibling( elem, "previousSibling" );
  12181. },
  12182. nextAll: function( elem ) {
  12183. return dir( elem, "nextSibling" );
  12184. },
  12185. prevAll: function( elem ) {
  12186. return dir( elem, "previousSibling" );
  12187. },
  12188. nextUntil: function( elem, i, until ) {
  12189. return dir( elem, "nextSibling", until );
  12190. },
  12191. prevUntil: function( elem, i, until ) {
  12192. return dir( elem, "previousSibling", until );
  12193. },
  12194. siblings: function( elem ) {
  12195. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  12196. },
  12197. children: function( elem ) {
  12198. return siblings( elem.firstChild );
  12199. },
  12200. contents: function( elem ) {
  12201. if ( typeof elem.contentDocument !== "undefined" ) {
  12202. return elem.contentDocument;
  12203. }
  12204. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  12205. // Treat the template element as a regular one in browsers that
  12206. // don't support it.
  12207. if ( nodeName( elem, "template" ) ) {
  12208. elem = elem.content || elem;
  12209. }
  12210. return jQuery.merge( [], elem.childNodes );
  12211. }
  12212. }, function( name, fn ) {
  12213. jQuery.fn[ name ] = function( until, selector ) {
  12214. var matched = jQuery.map( this, fn, until );
  12215. if ( name.slice( -5 ) !== "Until" ) {
  12216. selector = until;
  12217. }
  12218. if ( selector && typeof selector === "string" ) {
  12219. matched = jQuery.filter( selector, matched );
  12220. }
  12221. if ( this.length > 1 ) {
  12222. // Remove duplicates
  12223. if ( !guaranteedUnique[ name ] ) {
  12224. jQuery.uniqueSort( matched );
  12225. }
  12226. // Reverse order for parents* and prev-derivatives
  12227. if ( rparentsprev.test( name ) ) {
  12228. matched.reverse();
  12229. }
  12230. }
  12231. return this.pushStack( matched );
  12232. };
  12233. } );
  12234. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  12235. // Convert String-formatted options into Object-formatted ones
  12236. function createOptions( options ) {
  12237. var object = {};
  12238. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  12239. object[ flag ] = true;
  12240. } );
  12241. return object;
  12242. }
  12243. /*
  12244. * Create a callback list using the following parameters:
  12245. *
  12246. * options: an optional list of space-separated options that will change how
  12247. * the callback list behaves or a more traditional option object
  12248. *
  12249. * By default a callback list will act like an event callback list and can be
  12250. * "fired" multiple times.
  12251. *
  12252. * Possible options:
  12253. *
  12254. * once: will ensure the callback list can only be fired once (like a Deferred)
  12255. *
  12256. * memory: will keep track of previous values and will call any callback added
  12257. * after the list has been fired right away with the latest "memorized"
  12258. * values (like a Deferred)
  12259. *
  12260. * unique: will ensure a callback can only be added once (no duplicate in the list)
  12261. *
  12262. * stopOnFalse: interrupt callings when a callback returns false
  12263. *
  12264. */
  12265. jQuery.Callbacks = function( options ) {
  12266. // Convert options from String-formatted to Object-formatted if needed
  12267. // (we check in cache first)
  12268. options = typeof options === "string" ?
  12269. createOptions( options ) :
  12270. jQuery.extend( {}, options );
  12271. var // Flag to know if list is currently firing
  12272. firing,
  12273. // Last fire value for non-forgettable lists
  12274. memory,
  12275. // Flag to know if list was already fired
  12276. fired,
  12277. // Flag to prevent firing
  12278. locked,
  12279. // Actual callback list
  12280. list = [],
  12281. // Queue of execution data for repeatable lists
  12282. queue = [],
  12283. // Index of currently firing callback (modified by add/remove as needed)
  12284. firingIndex = -1,
  12285. // Fire callbacks
  12286. fire = function() {
  12287. // Enforce single-firing
  12288. locked = locked || options.once;
  12289. // Execute callbacks for all pending executions,
  12290. // respecting firingIndex overrides and runtime changes
  12291. fired = firing = true;
  12292. for ( ; queue.length; firingIndex = -1 ) {
  12293. memory = queue.shift();
  12294. while ( ++firingIndex < list.length ) {
  12295. // Run callback and check for early termination
  12296. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  12297. options.stopOnFalse ) {
  12298. // Jump to end and forget the data so .add doesn't re-fire
  12299. firingIndex = list.length;
  12300. memory = false;
  12301. }
  12302. }
  12303. }
  12304. // Forget the data if we're done with it
  12305. if ( !options.memory ) {
  12306. memory = false;
  12307. }
  12308. firing = false;
  12309. // Clean up if we're done firing for good
  12310. if ( locked ) {
  12311. // Keep an empty list if we have data for future add calls
  12312. if ( memory ) {
  12313. list = [];
  12314. // Otherwise, this object is spent
  12315. } else {
  12316. list = "";
  12317. }
  12318. }
  12319. },
  12320. // Actual Callbacks object
  12321. self = {
  12322. // Add a callback or a collection of callbacks to the list
  12323. add: function() {
  12324. if ( list ) {
  12325. // If we have memory from a past run, we should fire after adding
  12326. if ( memory && !firing ) {
  12327. firingIndex = list.length - 1;
  12328. queue.push( memory );
  12329. }
  12330. ( function add( args ) {
  12331. jQuery.each( args, function( _, arg ) {
  12332. if ( isFunction( arg ) ) {
  12333. if ( !options.unique || !self.has( arg ) ) {
  12334. list.push( arg );
  12335. }
  12336. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  12337. // Inspect recursively
  12338. add( arg );
  12339. }
  12340. } );
  12341. } )( arguments );
  12342. if ( memory && !firing ) {
  12343. fire();
  12344. }
  12345. }
  12346. return this;
  12347. },
  12348. // Remove a callback from the list
  12349. remove: function() {
  12350. jQuery.each( arguments, function( _, arg ) {
  12351. var index;
  12352. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  12353. list.splice( index, 1 );
  12354. // Handle firing indexes
  12355. if ( index <= firingIndex ) {
  12356. firingIndex--;
  12357. }
  12358. }
  12359. } );
  12360. return this;
  12361. },
  12362. // Check if a given callback is in the list.
  12363. // If no argument is given, return whether or not list has callbacks attached.
  12364. has: function( fn ) {
  12365. return fn ?
  12366. jQuery.inArray( fn, list ) > -1 :
  12367. list.length > 0;
  12368. },
  12369. // Remove all callbacks from the list
  12370. empty: function() {
  12371. if ( list ) {
  12372. list = [];
  12373. }
  12374. return this;
  12375. },
  12376. // Disable .fire and .add
  12377. // Abort any current/pending executions
  12378. // Clear all callbacks and values
  12379. disable: function() {
  12380. locked = queue = [];
  12381. list = memory = "";
  12382. return this;
  12383. },
  12384. disabled: function() {
  12385. return !list;
  12386. },
  12387. // Disable .fire
  12388. // Also disable .add unless we have memory (since it would have no effect)
  12389. // Abort any pending executions
  12390. lock: function() {
  12391. locked = queue = [];
  12392. if ( !memory && !firing ) {
  12393. list = memory = "";
  12394. }
  12395. return this;
  12396. },
  12397. locked: function() {
  12398. return !!locked;
  12399. },
  12400. // Call all callbacks with the given context and arguments
  12401. fireWith: function( context, args ) {
  12402. if ( !locked ) {
  12403. args = args || [];
  12404. args = [ context, args.slice ? args.slice() : args ];
  12405. queue.push( args );
  12406. if ( !firing ) {
  12407. fire();
  12408. }
  12409. }
  12410. return this;
  12411. },
  12412. // Call all the callbacks with the given arguments
  12413. fire: function() {
  12414. self.fireWith( this, arguments );
  12415. return this;
  12416. },
  12417. // To know if the callbacks have already been called at least once
  12418. fired: function() {
  12419. return !!fired;
  12420. }
  12421. };
  12422. return self;
  12423. };
  12424. function Identity( v ) {
  12425. return v;
  12426. }
  12427. function Thrower( ex ) {
  12428. throw ex;
  12429. }
  12430. function adoptValue( value, resolve, reject, noValue ) {
  12431. var method;
  12432. try {
  12433. // Check for promise aspect first to privilege synchronous behavior
  12434. if ( value && isFunction( ( method = value.promise ) ) ) {
  12435. method.call( value ).done( resolve ).fail( reject );
  12436. // Other thenables
  12437. } else if ( value && isFunction( ( method = value.then ) ) ) {
  12438. method.call( value, resolve, reject );
  12439. // Other non-thenables
  12440. } else {
  12441. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  12442. // * false: [ value ].slice( 0 ) => resolve( value )
  12443. // * true: [ value ].slice( 1 ) => resolve()
  12444. resolve.apply( undefined, [ value ].slice( noValue ) );
  12445. }
  12446. // For Promises/A+, convert exceptions into rejections
  12447. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  12448. // Deferred#then to conditionally suppress rejection.
  12449. } catch ( value ) {
  12450. // Support: Android 4.0 only
  12451. // Strict mode functions invoked without .call/.apply get global-object context
  12452. reject.apply( undefined, [ value ] );
  12453. }
  12454. }
  12455. jQuery.extend( {
  12456. Deferred: function( func ) {
  12457. var tuples = [
  12458. // action, add listener, callbacks,
  12459. // ... .then handlers, argument index, [final state]
  12460. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  12461. jQuery.Callbacks( "memory" ), 2 ],
  12462. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  12463. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  12464. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  12465. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  12466. ],
  12467. state = "pending",
  12468. promise = {
  12469. state: function() {
  12470. return state;
  12471. },
  12472. always: function() {
  12473. deferred.done( arguments ).fail( arguments );
  12474. return this;
  12475. },
  12476. "catch": function( fn ) {
  12477. return promise.then( null, fn );
  12478. },
  12479. // Keep pipe for back-compat
  12480. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  12481. var fns = arguments;
  12482. return jQuery.Deferred( function( newDefer ) {
  12483. jQuery.each( tuples, function( i, tuple ) {
  12484. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  12485. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  12486. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  12487. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  12488. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  12489. deferred[ tuple[ 1 ] ]( function() {
  12490. var returned = fn && fn.apply( this, arguments );
  12491. if ( returned && isFunction( returned.promise ) ) {
  12492. returned.promise()
  12493. .progress( newDefer.notify )
  12494. .done( newDefer.resolve )
  12495. .fail( newDefer.reject );
  12496. } else {
  12497. newDefer[ tuple[ 0 ] + "With" ](
  12498. this,
  12499. fn ? [ returned ] : arguments
  12500. );
  12501. }
  12502. } );
  12503. } );
  12504. fns = null;
  12505. } ).promise();
  12506. },
  12507. then: function( onFulfilled, onRejected, onProgress ) {
  12508. var maxDepth = 0;
  12509. function resolve( depth, deferred, handler, special ) {
  12510. return function() {
  12511. var that = this,
  12512. args = arguments,
  12513. mightThrow = function() {
  12514. var returned, then;
  12515. // Support: Promises/A+ section 2.3.3.3.3
  12516. // https://promisesaplus.com/#point-59
  12517. // Ignore double-resolution attempts
  12518. if ( depth < maxDepth ) {
  12519. return;
  12520. }
  12521. returned = handler.apply( that, args );
  12522. // Support: Promises/A+ section 2.3.1
  12523. // https://promisesaplus.com/#point-48
  12524. if ( returned === deferred.promise() ) {
  12525. throw new TypeError( "Thenable self-resolution" );
  12526. }
  12527. // Support: Promises/A+ sections 2.3.3.1, 3.5
  12528. // https://promisesaplus.com/#point-54
  12529. // https://promisesaplus.com/#point-75
  12530. // Retrieve `then` only once
  12531. then = returned &&
  12532. // Support: Promises/A+ section 2.3.4
  12533. // https://promisesaplus.com/#point-64
  12534. // Only check objects and functions for thenability
  12535. ( typeof returned === "object" ||
  12536. typeof returned === "function" ) &&
  12537. returned.then;
  12538. // Handle a returned thenable
  12539. if ( isFunction( then ) ) {
  12540. // Special processors (notify) just wait for resolution
  12541. if ( special ) {
  12542. then.call(
  12543. returned,
  12544. resolve( maxDepth, deferred, Identity, special ),
  12545. resolve( maxDepth, deferred, Thrower, special )
  12546. );
  12547. // Normal processors (resolve) also hook into progress
  12548. } else {
  12549. // ...and disregard older resolution values
  12550. maxDepth++;
  12551. then.call(
  12552. returned,
  12553. resolve( maxDepth, deferred, Identity, special ),
  12554. resolve( maxDepth, deferred, Thrower, special ),
  12555. resolve( maxDepth, deferred, Identity,
  12556. deferred.notifyWith )
  12557. );
  12558. }
  12559. // Handle all other returned values
  12560. } else {
  12561. // Only substitute handlers pass on context
  12562. // and multiple values (non-spec behavior)
  12563. if ( handler !== Identity ) {
  12564. that = undefined;
  12565. args = [ returned ];
  12566. }
  12567. // Process the value(s)
  12568. // Default process is resolve
  12569. ( special || deferred.resolveWith )( that, args );
  12570. }
  12571. },
  12572. // Only normal processors (resolve) catch and reject exceptions
  12573. process = special ?
  12574. mightThrow :
  12575. function() {
  12576. try {
  12577. mightThrow();
  12578. } catch ( e ) {
  12579. if ( jQuery.Deferred.exceptionHook ) {
  12580. jQuery.Deferred.exceptionHook( e,
  12581. process.stackTrace );
  12582. }
  12583. // Support: Promises/A+ section 2.3.3.3.4.1
  12584. // https://promisesaplus.com/#point-61
  12585. // Ignore post-resolution exceptions
  12586. if ( depth + 1 >= maxDepth ) {
  12587. // Only substitute handlers pass on context
  12588. // and multiple values (non-spec behavior)
  12589. if ( handler !== Thrower ) {
  12590. that = undefined;
  12591. args = [ e ];
  12592. }
  12593. deferred.rejectWith( that, args );
  12594. }
  12595. }
  12596. };
  12597. // Support: Promises/A+ section 2.3.3.3.1
  12598. // https://promisesaplus.com/#point-57
  12599. // Re-resolve promises immediately to dodge false rejection from
  12600. // subsequent errors
  12601. if ( depth ) {
  12602. process();
  12603. } else {
  12604. // Call an optional hook to record the stack, in case of exception
  12605. // since it's otherwise lost when execution goes async
  12606. if ( jQuery.Deferred.getStackHook ) {
  12607. process.stackTrace = jQuery.Deferred.getStackHook();
  12608. }
  12609. window.setTimeout( process );
  12610. }
  12611. };
  12612. }
  12613. return jQuery.Deferred( function( newDefer ) {
  12614. // progress_handlers.add( ... )
  12615. tuples[ 0 ][ 3 ].add(
  12616. resolve(
  12617. 0,
  12618. newDefer,
  12619. isFunction( onProgress ) ?
  12620. onProgress :
  12621. Identity,
  12622. newDefer.notifyWith
  12623. )
  12624. );
  12625. // fulfilled_handlers.add( ... )
  12626. tuples[ 1 ][ 3 ].add(
  12627. resolve(
  12628. 0,
  12629. newDefer,
  12630. isFunction( onFulfilled ) ?
  12631. onFulfilled :
  12632. Identity
  12633. )
  12634. );
  12635. // rejected_handlers.add( ... )
  12636. tuples[ 2 ][ 3 ].add(
  12637. resolve(
  12638. 0,
  12639. newDefer,
  12640. isFunction( onRejected ) ?
  12641. onRejected :
  12642. Thrower
  12643. )
  12644. );
  12645. } ).promise();
  12646. },
  12647. // Get a promise for this deferred
  12648. // If obj is provided, the promise aspect is added to the object
  12649. promise: function( obj ) {
  12650. return obj != null ? jQuery.extend( obj, promise ) : promise;
  12651. }
  12652. },
  12653. deferred = {};
  12654. // Add list-specific methods
  12655. jQuery.each( tuples, function( i, tuple ) {
  12656. var list = tuple[ 2 ],
  12657. stateString = tuple[ 5 ];
  12658. // promise.progress = list.add
  12659. // promise.done = list.add
  12660. // promise.fail = list.add
  12661. promise[ tuple[ 1 ] ] = list.add;
  12662. // Handle state
  12663. if ( stateString ) {
  12664. list.add(
  12665. function() {
  12666. // state = "resolved" (i.e., fulfilled)
  12667. // state = "rejected"
  12668. state = stateString;
  12669. },
  12670. // rejected_callbacks.disable
  12671. // fulfilled_callbacks.disable
  12672. tuples[ 3 - i ][ 2 ].disable,
  12673. // rejected_handlers.disable
  12674. // fulfilled_handlers.disable
  12675. tuples[ 3 - i ][ 3 ].disable,
  12676. // progress_callbacks.lock
  12677. tuples[ 0 ][ 2 ].lock,
  12678. // progress_handlers.lock
  12679. tuples[ 0 ][ 3 ].lock
  12680. );
  12681. }
  12682. // progress_handlers.fire
  12683. // fulfilled_handlers.fire
  12684. // rejected_handlers.fire
  12685. list.add( tuple[ 3 ].fire );
  12686. // deferred.notify = function() { deferred.notifyWith(...) }
  12687. // deferred.resolve = function() { deferred.resolveWith(...) }
  12688. // deferred.reject = function() { deferred.rejectWith(...) }
  12689. deferred[ tuple[ 0 ] ] = function() {
  12690. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  12691. return this;
  12692. };
  12693. // deferred.notifyWith = list.fireWith
  12694. // deferred.resolveWith = list.fireWith
  12695. // deferred.rejectWith = list.fireWith
  12696. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  12697. } );
  12698. // Make the deferred a promise
  12699. promise.promise( deferred );
  12700. // Call given func if any
  12701. if ( func ) {
  12702. func.call( deferred, deferred );
  12703. }
  12704. // All done!
  12705. return deferred;
  12706. },
  12707. // Deferred helper
  12708. when: function( singleValue ) {
  12709. var
  12710. // count of uncompleted subordinates
  12711. remaining = arguments.length,
  12712. // count of unprocessed arguments
  12713. i = remaining,
  12714. // subordinate fulfillment data
  12715. resolveContexts = Array( i ),
  12716. resolveValues = slice.call( arguments ),
  12717. // the master Deferred
  12718. master = jQuery.Deferred(),
  12719. // subordinate callback factory
  12720. updateFunc = function( i ) {
  12721. return function( value ) {
  12722. resolveContexts[ i ] = this;
  12723. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  12724. if ( !( --remaining ) ) {
  12725. master.resolveWith( resolveContexts, resolveValues );
  12726. }
  12727. };
  12728. };
  12729. // Single- and empty arguments are adopted like Promise.resolve
  12730. if ( remaining <= 1 ) {
  12731. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  12732. !remaining );
  12733. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  12734. if ( master.state() === "pending" ||
  12735. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  12736. return master.then();
  12737. }
  12738. }
  12739. // Multiple arguments are aggregated like Promise.all array elements
  12740. while ( i-- ) {
  12741. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  12742. }
  12743. return master.promise();
  12744. }
  12745. } );
  12746. // These usually indicate a programmer mistake during development,
  12747. // warn about them ASAP rather than swallowing them by default.
  12748. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  12749. jQuery.Deferred.exceptionHook = function( error, stack ) {
  12750. // Support: IE 8 - 9 only
  12751. // Console exists when dev tools are open, which can happen at any time
  12752. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  12753. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  12754. }
  12755. };
  12756. jQuery.readyException = function( error ) {
  12757. window.setTimeout( function() {
  12758. throw error;
  12759. } );
  12760. };
  12761. // The deferred used on DOM ready
  12762. var readyList = jQuery.Deferred();
  12763. jQuery.fn.ready = function( fn ) {
  12764. readyList
  12765. .then( fn )
  12766. // Wrap jQuery.readyException in a function so that the lookup
  12767. // happens at the time of error handling instead of callback
  12768. // registration.
  12769. .catch( function( error ) {
  12770. jQuery.readyException( error );
  12771. } );
  12772. return this;
  12773. };
  12774. jQuery.extend( {
  12775. // Is the DOM ready to be used? Set to true once it occurs.
  12776. isReady: false,
  12777. // A counter to track how many items to wait for before
  12778. // the ready event fires. See #6781
  12779. readyWait: 1,
  12780. // Handle when the DOM is ready
  12781. ready: function( wait ) {
  12782. // Abort if there are pending holds or we're already ready
  12783. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  12784. return;
  12785. }
  12786. // Remember that the DOM is ready
  12787. jQuery.isReady = true;
  12788. // If a normal DOM Ready event fired, decrement, and wait if need be
  12789. if ( wait !== true && --jQuery.readyWait > 0 ) {
  12790. return;
  12791. }
  12792. // If there are functions bound, to execute
  12793. readyList.resolveWith( document, [ jQuery ] );
  12794. }
  12795. } );
  12796. jQuery.ready.then = readyList.then;
  12797. // The ready event handler and self cleanup method
  12798. function completed() {
  12799. document.removeEventListener( "DOMContentLoaded", completed );
  12800. window.removeEventListener( "load", completed );
  12801. jQuery.ready();
  12802. }
  12803. // Catch cases where $(document).ready() is called
  12804. // after the browser event has already occurred.
  12805. // Support: IE <=9 - 10 only
  12806. // Older IE sometimes signals "interactive" too soon
  12807. if ( document.readyState === "complete" ||
  12808. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  12809. // Handle it asynchronously to allow scripts the opportunity to delay ready
  12810. window.setTimeout( jQuery.ready );
  12811. } else {
  12812. // Use the handy event callback
  12813. document.addEventListener( "DOMContentLoaded", completed );
  12814. // A fallback to window.onload, that will always work
  12815. window.addEventListener( "load", completed );
  12816. }
  12817. // Multifunctional method to get and set values of a collection
  12818. // The value/s can optionally be executed if it's a function
  12819. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  12820. var i = 0,
  12821. len = elems.length,
  12822. bulk = key == null;
  12823. // Sets many values
  12824. if ( toType( key ) === "object" ) {
  12825. chainable = true;
  12826. for ( i in key ) {
  12827. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  12828. }
  12829. // Sets one value
  12830. } else if ( value !== undefined ) {
  12831. chainable = true;
  12832. if ( !isFunction( value ) ) {
  12833. raw = true;
  12834. }
  12835. if ( bulk ) {
  12836. // Bulk operations run against the entire set
  12837. if ( raw ) {
  12838. fn.call( elems, value );
  12839. fn = null;
  12840. // ...except when executing function values
  12841. } else {
  12842. bulk = fn;
  12843. fn = function( elem, key, value ) {
  12844. return bulk.call( jQuery( elem ), value );
  12845. };
  12846. }
  12847. }
  12848. if ( fn ) {
  12849. for ( ; i < len; i++ ) {
  12850. fn(
  12851. elems[ i ], key, raw ?
  12852. value :
  12853. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  12854. );
  12855. }
  12856. }
  12857. }
  12858. if ( chainable ) {
  12859. return elems;
  12860. }
  12861. // Gets
  12862. if ( bulk ) {
  12863. return fn.call( elems );
  12864. }
  12865. return len ? fn( elems[ 0 ], key ) : emptyGet;
  12866. };
  12867. // Matches dashed string for camelizing
  12868. var rmsPrefix = /^-ms-/,
  12869. rdashAlpha = /-([a-z])/g;
  12870. // Used by camelCase as callback to replace()
  12871. function fcamelCase( all, letter ) {
  12872. return letter.toUpperCase();
  12873. }
  12874. // Convert dashed to camelCase; used by the css and data modules
  12875. // Support: IE <=9 - 11, Edge 12 - 15
  12876. // Microsoft forgot to hump their vendor prefix (#9572)
  12877. function camelCase( string ) {
  12878. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  12879. }
  12880. var acceptData = function( owner ) {
  12881. // Accepts only:
  12882. // - Node
  12883. // - Node.ELEMENT_NODE
  12884. // - Node.DOCUMENT_NODE
  12885. // - Object
  12886. // - Any
  12887. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  12888. };
  12889. function Data() {
  12890. this.expando = jQuery.expando + Data.uid++;
  12891. }
  12892. Data.uid = 1;
  12893. Data.prototype = {
  12894. cache: function( owner ) {
  12895. // Check if the owner object already has a cache
  12896. var value = owner[ this.expando ];
  12897. // If not, create one
  12898. if ( !value ) {
  12899. value = {};
  12900. // We can accept data for non-element nodes in modern browsers,
  12901. // but we should not, see #8335.
  12902. // Always return an empty object.
  12903. if ( acceptData( owner ) ) {
  12904. // If it is a node unlikely to be stringify-ed or looped over
  12905. // use plain assignment
  12906. if ( owner.nodeType ) {
  12907. owner[ this.expando ] = value;
  12908. // Otherwise secure it in a non-enumerable property
  12909. // configurable must be true to allow the property to be
  12910. // deleted when data is removed
  12911. } else {
  12912. Object.defineProperty( owner, this.expando, {
  12913. value: value,
  12914. configurable: true
  12915. } );
  12916. }
  12917. }
  12918. }
  12919. return value;
  12920. },
  12921. set: function( owner, data, value ) {
  12922. var prop,
  12923. cache = this.cache( owner );
  12924. // Handle: [ owner, key, value ] args
  12925. // Always use camelCase key (gh-2257)
  12926. if ( typeof data === "string" ) {
  12927. cache[ camelCase( data ) ] = value;
  12928. // Handle: [ owner, { properties } ] args
  12929. } else {
  12930. // Copy the properties one-by-one to the cache object
  12931. for ( prop in data ) {
  12932. cache[ camelCase( prop ) ] = data[ prop ];
  12933. }
  12934. }
  12935. return cache;
  12936. },
  12937. get: function( owner, key ) {
  12938. return key === undefined ?
  12939. this.cache( owner ) :
  12940. // Always use camelCase key (gh-2257)
  12941. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12942. },
  12943. access: function( owner, key, value ) {
  12944. // In cases where either:
  12945. //
  12946. // 1. No key was specified
  12947. // 2. A string key was specified, but no value provided
  12948. //
  12949. // Take the "read" path and allow the get method to determine
  12950. // which value to return, respectively either:
  12951. //
  12952. // 1. The entire cache object
  12953. // 2. The data stored at the key
  12954. //
  12955. if ( key === undefined ||
  12956. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12957. return this.get( owner, key );
  12958. }
  12959. // When the key is not a string, or both a key and value
  12960. // are specified, set or extend (existing objects) with either:
  12961. //
  12962. // 1. An object of properties
  12963. // 2. A key and value
  12964. //
  12965. this.set( owner, key, value );
  12966. // Since the "set" path can have two possible entry points
  12967. // return the expected data based on which path was taken[*]
  12968. return value !== undefined ? value : key;
  12969. },
  12970. remove: function( owner, key ) {
  12971. var i,
  12972. cache = owner[ this.expando ];
  12973. if ( cache === undefined ) {
  12974. return;
  12975. }
  12976. if ( key !== undefined ) {
  12977. // Support array or space separated string of keys
  12978. if ( Array.isArray( key ) ) {
  12979. // If key is an array of keys...
  12980. // We always set camelCase keys, so remove that.
  12981. key = key.map( camelCase );
  12982. } else {
  12983. key = camelCase( key );
  12984. // If a key with the spaces exists, use it.
  12985. // Otherwise, create an array by matching non-whitespace
  12986. key = key in cache ?
  12987. [ key ] :
  12988. ( key.match( rnothtmlwhite ) || [] );
  12989. }
  12990. i = key.length;
  12991. while ( i-- ) {
  12992. delete cache[ key[ i ] ];
  12993. }
  12994. }
  12995. // Remove the expando if there's no more data
  12996. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12997. // Support: Chrome <=35 - 45
  12998. // Webkit & Blink performance suffers when deleting properties
  12999. // from DOM nodes, so set to undefined instead
  13000. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  13001. if ( owner.nodeType ) {
  13002. owner[ this.expando ] = undefined;
  13003. } else {
  13004. delete owner[ this.expando ];
  13005. }
  13006. }
  13007. },
  13008. hasData: function( owner ) {
  13009. var cache = owner[ this.expando ];
  13010. return cache !== undefined && !jQuery.isEmptyObject( cache );
  13011. }
  13012. };
  13013. var dataPriv = new Data();
  13014. var dataUser = new Data();
  13015. // Implementation Summary
  13016. //
  13017. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  13018. // 2. Improve the module's maintainability by reducing the storage
  13019. // paths to a single mechanism.
  13020. // 3. Use the same single mechanism to support "private" and "user" data.
  13021. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  13022. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  13023. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  13024. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  13025. rmultiDash = /[A-Z]/g;
  13026. function getData( data ) {
  13027. if ( data === "true" ) {
  13028. return true;
  13029. }
  13030. if ( data === "false" ) {
  13031. return false;
  13032. }
  13033. if ( data === "null" ) {
  13034. return null;
  13035. }
  13036. // Only convert to a number if it doesn't change the string
  13037. if ( data === +data + "" ) {
  13038. return +data;
  13039. }
  13040. if ( rbrace.test( data ) ) {
  13041. return JSON.parse( data );
  13042. }
  13043. return data;
  13044. }
  13045. function dataAttr( elem, key, data ) {
  13046. var name;
  13047. // If nothing was found internally, try to fetch any
  13048. // data from the HTML5 data-* attribute
  13049. if ( data === undefined && elem.nodeType === 1 ) {
  13050. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  13051. data = elem.getAttribute( name );
  13052. if ( typeof data === "string" ) {
  13053. try {
  13054. data = getData( data );
  13055. } catch ( e ) {}
  13056. // Make sure we set the data so it isn't changed later
  13057. dataUser.set( elem, key, data );
  13058. } else {
  13059. data = undefined;
  13060. }
  13061. }
  13062. return data;
  13063. }
  13064. jQuery.extend( {
  13065. hasData: function( elem ) {
  13066. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  13067. },
  13068. data: function( elem, name, data ) {
  13069. return dataUser.access( elem, name, data );
  13070. },
  13071. removeData: function( elem, name ) {
  13072. dataUser.remove( elem, name );
  13073. },
  13074. // TODO: Now that all calls to _data and _removeData have been replaced
  13075. // with direct calls to dataPriv methods, these can be deprecated.
  13076. _data: function( elem, name, data ) {
  13077. return dataPriv.access( elem, name, data );
  13078. },
  13079. _removeData: function( elem, name ) {
  13080. dataPriv.remove( elem, name );
  13081. }
  13082. } );
  13083. jQuery.fn.extend( {
  13084. data: function( key, value ) {
  13085. var i, name, data,
  13086. elem = this[ 0 ],
  13087. attrs = elem && elem.attributes;
  13088. // Gets all values
  13089. if ( key === undefined ) {
  13090. if ( this.length ) {
  13091. data = dataUser.get( elem );
  13092. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  13093. i = attrs.length;
  13094. while ( i-- ) {
  13095. // Support: IE 11 only
  13096. // The attrs elements can be null (#14894)
  13097. if ( attrs[ i ] ) {
  13098. name = attrs[ i ].name;
  13099. if ( name.indexOf( "data-" ) === 0 ) {
  13100. name = camelCase( name.slice( 5 ) );
  13101. dataAttr( elem, name, data[ name ] );
  13102. }
  13103. }
  13104. }
  13105. dataPriv.set( elem, "hasDataAttrs", true );
  13106. }
  13107. }
  13108. return data;
  13109. }
  13110. // Sets multiple values
  13111. if ( typeof key === "object" ) {
  13112. return this.each( function() {
  13113. dataUser.set( this, key );
  13114. } );
  13115. }
  13116. return access( this, function( value ) {
  13117. var data;
  13118. // The calling jQuery object (element matches) is not empty
  13119. // (and therefore has an element appears at this[ 0 ]) and the
  13120. // `value` parameter was not undefined. An empty jQuery object
  13121. // will result in `undefined` for elem = this[ 0 ] which will
  13122. // throw an exception if an attempt to read a data cache is made.
  13123. if ( elem && value === undefined ) {
  13124. // Attempt to get data from the cache
  13125. // The key will always be camelCased in Data
  13126. data = dataUser.get( elem, key );
  13127. if ( data !== undefined ) {
  13128. return data;
  13129. }
  13130. // Attempt to "discover" the data in
  13131. // HTML5 custom data-* attrs
  13132. data = dataAttr( elem, key );
  13133. if ( data !== undefined ) {
  13134. return data;
  13135. }
  13136. // We tried really hard, but the data doesn't exist.
  13137. return;
  13138. }
  13139. // Set the data...
  13140. this.each( function() {
  13141. // We always store the camelCased key
  13142. dataUser.set( this, key, value );
  13143. } );
  13144. }, null, value, arguments.length > 1, null, true );
  13145. },
  13146. removeData: function( key ) {
  13147. return this.each( function() {
  13148. dataUser.remove( this, key );
  13149. } );
  13150. }
  13151. } );
  13152. jQuery.extend( {
  13153. queue: function( elem, type, data ) {
  13154. var queue;
  13155. if ( elem ) {
  13156. type = ( type || "fx" ) + "queue";
  13157. queue = dataPriv.get( elem, type );
  13158. // Speed up dequeue by getting out quickly if this is just a lookup
  13159. if ( data ) {
  13160. if ( !queue || Array.isArray( data ) ) {
  13161. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  13162. } else {
  13163. queue.push( data );
  13164. }
  13165. }
  13166. return queue || [];
  13167. }
  13168. },
  13169. dequeue: function( elem, type ) {
  13170. type = type || "fx";
  13171. var queue = jQuery.queue( elem, type ),
  13172. startLength = queue.length,
  13173. fn = queue.shift(),
  13174. hooks = jQuery._queueHooks( elem, type ),
  13175. next = function() {
  13176. jQuery.dequeue( elem, type );
  13177. };
  13178. // If the fx queue is dequeued, always remove the progress sentinel
  13179. if ( fn === "inprogress" ) {
  13180. fn = queue.shift();
  13181. startLength--;
  13182. }
  13183. if ( fn ) {
  13184. // Add a progress sentinel to prevent the fx queue from being
  13185. // automatically dequeued
  13186. if ( type === "fx" ) {
  13187. queue.unshift( "inprogress" );
  13188. }
  13189. // Clear up the last queue stop function
  13190. delete hooks.stop;
  13191. fn.call( elem, next, hooks );
  13192. }
  13193. if ( !startLength && hooks ) {
  13194. hooks.empty.fire();
  13195. }
  13196. },
  13197. // Not public - generate a queueHooks object, or return the current one
  13198. _queueHooks: function( elem, type ) {
  13199. var key = type + "queueHooks";
  13200. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  13201. empty: jQuery.Callbacks( "once memory" ).add( function() {
  13202. dataPriv.remove( elem, [ type + "queue", key ] );
  13203. } )
  13204. } );
  13205. }
  13206. } );
  13207. jQuery.fn.extend( {
  13208. queue: function( type, data ) {
  13209. var setter = 2;
  13210. if ( typeof type !== "string" ) {
  13211. data = type;
  13212. type = "fx";
  13213. setter--;
  13214. }
  13215. if ( arguments.length < setter ) {
  13216. return jQuery.queue( this[ 0 ], type );
  13217. }
  13218. return data === undefined ?
  13219. this :
  13220. this.each( function() {
  13221. var queue = jQuery.queue( this, type, data );
  13222. // Ensure a hooks for this queue
  13223. jQuery._queueHooks( this, type );
  13224. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  13225. jQuery.dequeue( this, type );
  13226. }
  13227. } );
  13228. },
  13229. dequeue: function( type ) {
  13230. return this.each( function() {
  13231. jQuery.dequeue( this, type );
  13232. } );
  13233. },
  13234. clearQueue: function( type ) {
  13235. return this.queue( type || "fx", [] );
  13236. },
  13237. // Get a promise resolved when queues of a certain type
  13238. // are emptied (fx is the type by default)
  13239. promise: function( type, obj ) {
  13240. var tmp,
  13241. count = 1,
  13242. defer = jQuery.Deferred(),
  13243. elements = this,
  13244. i = this.length,
  13245. resolve = function() {
  13246. if ( !( --count ) ) {
  13247. defer.resolveWith( elements, [ elements ] );
  13248. }
  13249. };
  13250. if ( typeof type !== "string" ) {
  13251. obj = type;
  13252. type = undefined;
  13253. }
  13254. type = type || "fx";
  13255. while ( i-- ) {
  13256. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  13257. if ( tmp && tmp.empty ) {
  13258. count++;
  13259. tmp.empty.add( resolve );
  13260. }
  13261. }
  13262. resolve();
  13263. return defer.promise( obj );
  13264. }
  13265. } );
  13266. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  13267. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  13268. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  13269. var documentElement = document.documentElement;
  13270. var isAttached = function( elem ) {
  13271. return jQuery.contains( elem.ownerDocument, elem );
  13272. },
  13273. composed = { composed: true };
  13274. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  13275. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  13276. // Support: iOS 10.0-10.2 only
  13277. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  13278. // leading to errors. We need to check for `getRootNode`.
  13279. if ( documentElement.getRootNode ) {
  13280. isAttached = function( elem ) {
  13281. return jQuery.contains( elem.ownerDocument, elem ) ||
  13282. elem.getRootNode( composed ) === elem.ownerDocument;
  13283. };
  13284. }
  13285. var isHiddenWithinTree = function( elem, el ) {
  13286. // isHiddenWithinTree might be called from jQuery#filter function;
  13287. // in that case, element will be second argument
  13288. elem = el || elem;
  13289. // Inline style trumps all
  13290. return elem.style.display === "none" ||
  13291. elem.style.display === "" &&
  13292. // Otherwise, check computed style
  13293. // Support: Firefox <=43 - 45
  13294. // Disconnected elements can have computed display: none, so first confirm that elem is
  13295. // in the document.
  13296. isAttached( elem ) &&
  13297. jQuery.css( elem, "display" ) === "none";
  13298. };
  13299. var swap = function( elem, options, callback, args ) {
  13300. var ret, name,
  13301. old = {};
  13302. // Remember the old values, and insert the new ones
  13303. for ( name in options ) {
  13304. old[ name ] = elem.style[ name ];
  13305. elem.style[ name ] = options[ name ];
  13306. }
  13307. ret = callback.apply( elem, args || [] );
  13308. // Revert the old values
  13309. for ( name in options ) {
  13310. elem.style[ name ] = old[ name ];
  13311. }
  13312. return ret;
  13313. };
  13314. function adjustCSS( elem, prop, valueParts, tween ) {
  13315. var adjusted, scale,
  13316. maxIterations = 20,
  13317. currentValue = tween ?
  13318. function() {
  13319. return tween.cur();
  13320. } :
  13321. function() {
  13322. return jQuery.css( elem, prop, "" );
  13323. },
  13324. initial = currentValue(),
  13325. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  13326. // Starting value computation is required for potential unit mismatches
  13327. initialInUnit = elem.nodeType &&
  13328. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  13329. rcssNum.exec( jQuery.css( elem, prop ) );
  13330. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  13331. // Support: Firefox <=54
  13332. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  13333. initial = initial / 2;
  13334. // Trust units reported by jQuery.css
  13335. unit = unit || initialInUnit[ 3 ];
  13336. // Iteratively approximate from a nonzero starting point
  13337. initialInUnit = +initial || 1;
  13338. while ( maxIterations-- ) {
  13339. // Evaluate and update our best guess (doubling guesses that zero out).
  13340. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  13341. jQuery.style( elem, prop, initialInUnit + unit );
  13342. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  13343. maxIterations = 0;
  13344. }
  13345. initialInUnit = initialInUnit / scale;
  13346. }
  13347. initialInUnit = initialInUnit * 2;
  13348. jQuery.style( elem, prop, initialInUnit + unit );
  13349. // Make sure we update the tween properties later on
  13350. valueParts = valueParts || [];
  13351. }
  13352. if ( valueParts ) {
  13353. initialInUnit = +initialInUnit || +initial || 0;
  13354. // Apply relative offset (+=/-=) if specified
  13355. adjusted = valueParts[ 1 ] ?
  13356. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  13357. +valueParts[ 2 ];
  13358. if ( tween ) {
  13359. tween.unit = unit;
  13360. tween.start = initialInUnit;
  13361. tween.end = adjusted;
  13362. }
  13363. }
  13364. return adjusted;
  13365. }
  13366. var defaultDisplayMap = {};
  13367. function getDefaultDisplay( elem ) {
  13368. var temp,
  13369. doc = elem.ownerDocument,
  13370. nodeName = elem.nodeName,
  13371. display = defaultDisplayMap[ nodeName ];
  13372. if ( display ) {
  13373. return display;
  13374. }
  13375. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  13376. display = jQuery.css( temp, "display" );
  13377. temp.parentNode.removeChild( temp );
  13378. if ( display === "none" ) {
  13379. display = "block";
  13380. }
  13381. defaultDisplayMap[ nodeName ] = display;
  13382. return display;
  13383. }
  13384. function showHide( elements, show ) {
  13385. var display, elem,
  13386. values = [],
  13387. index = 0,
  13388. length = elements.length;
  13389. // Determine new display value for elements that need to change
  13390. for ( ; index < length; index++ ) {
  13391. elem = elements[ index ];
  13392. if ( !elem.style ) {
  13393. continue;
  13394. }
  13395. display = elem.style.display;
  13396. if ( show ) {
  13397. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  13398. // check is required in this first loop unless we have a nonempty display value (either
  13399. // inline or about-to-be-restored)
  13400. if ( display === "none" ) {
  13401. values[ index ] = dataPriv.get( elem, "display" ) || null;
  13402. if ( !values[ index ] ) {
  13403. elem.style.display = "";
  13404. }
  13405. }
  13406. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  13407. values[ index ] = getDefaultDisplay( elem );
  13408. }
  13409. } else {
  13410. if ( display !== "none" ) {
  13411. values[ index ] = "none";
  13412. // Remember what we're overwriting
  13413. dataPriv.set( elem, "display", display );
  13414. }
  13415. }
  13416. }
  13417. // Set the display of the elements in a second loop to avoid constant reflow
  13418. for ( index = 0; index < length; index++ ) {
  13419. if ( values[ index ] != null ) {
  13420. elements[ index ].style.display = values[ index ];
  13421. }
  13422. }
  13423. return elements;
  13424. }
  13425. jQuery.fn.extend( {
  13426. show: function() {
  13427. return showHide( this, true );
  13428. },
  13429. hide: function() {
  13430. return showHide( this );
  13431. },
  13432. toggle: function( state ) {
  13433. if ( typeof state === "boolean" ) {
  13434. return state ? this.show() : this.hide();
  13435. }
  13436. return this.each( function() {
  13437. if ( isHiddenWithinTree( this ) ) {
  13438. jQuery( this ).show();
  13439. } else {
  13440. jQuery( this ).hide();
  13441. }
  13442. } );
  13443. }
  13444. } );
  13445. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  13446. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  13447. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  13448. // We have to close these tags to support XHTML (#13200)
  13449. var wrapMap = {
  13450. // Support: IE <=9 only
  13451. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  13452. // XHTML parsers do not magically insert elements in the
  13453. // same way that tag soup parsers do. So we cannot shorten
  13454. // this by omitting <tbody> or other required elements.
  13455. thead: [ 1, "<table>", "</table>" ],
  13456. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  13457. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  13458. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  13459. _default: [ 0, "", "" ]
  13460. };
  13461. // Support: IE <=9 only
  13462. wrapMap.optgroup = wrapMap.option;
  13463. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  13464. wrapMap.th = wrapMap.td;
  13465. function getAll( context, tag ) {
  13466. // Support: IE <=9 - 11 only
  13467. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  13468. var ret;
  13469. if ( typeof context.getElementsByTagName !== "undefined" ) {
  13470. ret = context.getElementsByTagName( tag || "*" );
  13471. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  13472. ret = context.querySelectorAll( tag || "*" );
  13473. } else {
  13474. ret = [];
  13475. }
  13476. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  13477. return jQuery.merge( [ context ], ret );
  13478. }
  13479. return ret;
  13480. }
  13481. // Mark scripts as having already been evaluated
  13482. function setGlobalEval( elems, refElements ) {
  13483. var i = 0,
  13484. l = elems.length;
  13485. for ( ; i < l; i++ ) {
  13486. dataPriv.set(
  13487. elems[ i ],
  13488. "globalEval",
  13489. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  13490. );
  13491. }
  13492. }
  13493. var rhtml = /<|&#?\w+;/;
  13494. function buildFragment( elems, context, scripts, selection, ignored ) {
  13495. var elem, tmp, tag, wrap, attached, j,
  13496. fragment = context.createDocumentFragment(),
  13497. nodes = [],
  13498. i = 0,
  13499. l = elems.length;
  13500. for ( ; i < l; i++ ) {
  13501. elem = elems[ i ];
  13502. if ( elem || elem === 0 ) {
  13503. // Add nodes directly
  13504. if ( toType( elem ) === "object" ) {
  13505. // Support: Android <=4.0 only, PhantomJS 1 only
  13506. // push.apply(_, arraylike) throws on ancient WebKit
  13507. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  13508. // Convert non-html into a text node
  13509. } else if ( !rhtml.test( elem ) ) {
  13510. nodes.push( context.createTextNode( elem ) );
  13511. // Convert html into DOM nodes
  13512. } else {
  13513. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  13514. // Deserialize a standard representation
  13515. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  13516. wrap = wrapMap[ tag ] || wrapMap._default;
  13517. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  13518. // Descend through wrappers to the right content
  13519. j = wrap[ 0 ];
  13520. while ( j-- ) {
  13521. tmp = tmp.lastChild;
  13522. }
  13523. // Support: Android <=4.0 only, PhantomJS 1 only
  13524. // push.apply(_, arraylike) throws on ancient WebKit
  13525. jQuery.merge( nodes, tmp.childNodes );
  13526. // Remember the top-level container
  13527. tmp = fragment.firstChild;
  13528. // Ensure the created nodes are orphaned (#12392)
  13529. tmp.textContent = "";
  13530. }
  13531. }
  13532. }
  13533. // Remove wrapper from fragment
  13534. fragment.textContent = "";
  13535. i = 0;
  13536. while ( ( elem = nodes[ i++ ] ) ) {
  13537. // Skip elements already in the context collection (trac-4087)
  13538. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  13539. if ( ignored ) {
  13540. ignored.push( elem );
  13541. }
  13542. continue;
  13543. }
  13544. attached = isAttached( elem );
  13545. // Append to fragment
  13546. tmp = getAll( fragment.appendChild( elem ), "script" );
  13547. // Preserve script evaluation history
  13548. if ( attached ) {
  13549. setGlobalEval( tmp );
  13550. }
  13551. // Capture executables
  13552. if ( scripts ) {
  13553. j = 0;
  13554. while ( ( elem = tmp[ j++ ] ) ) {
  13555. if ( rscriptType.test( elem.type || "" ) ) {
  13556. scripts.push( elem );
  13557. }
  13558. }
  13559. }
  13560. }
  13561. return fragment;
  13562. }
  13563. ( function() {
  13564. var fragment = document.createDocumentFragment(),
  13565. div = fragment.appendChild( document.createElement( "div" ) ),
  13566. input = document.createElement( "input" );
  13567. // Support: Android 4.0 - 4.3 only
  13568. // Check state lost if the name is set (#11217)
  13569. // Support: Windows Web Apps (WWA)
  13570. // `name` and `type` must use .setAttribute for WWA (#14901)
  13571. input.setAttribute( "type", "radio" );
  13572. input.setAttribute( "checked", "checked" );
  13573. input.setAttribute( "name", "t" );
  13574. div.appendChild( input );
  13575. // Support: Android <=4.1 only
  13576. // Older WebKit doesn't clone checked state correctly in fragments
  13577. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  13578. // Support: IE <=11 only
  13579. // Make sure textarea (and checkbox) defaultValue is properly cloned
  13580. div.innerHTML = "<textarea>x</textarea>";
  13581. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  13582. } )();
  13583. var
  13584. rkeyEvent = /^key/,
  13585. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  13586. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  13587. function returnTrue() {
  13588. return true;
  13589. }
  13590. function returnFalse() {
  13591. return false;
  13592. }
  13593. // Support: IE <=9 - 11+
  13594. // focus() and blur() are asynchronous, except when they are no-op.
  13595. // So expect focus to be synchronous when the element is already active,
  13596. // and blur to be synchronous when the element is not already active.
  13597. // (focus and blur are always synchronous in other supported browsers,
  13598. // this just defines when we can count on it).
  13599. function expectSync( elem, type ) {
  13600. return ( elem === safeActiveElement() ) === ( type === "focus" );
  13601. }
  13602. // Support: IE <=9 only
  13603. // Accessing document.activeElement can throw unexpectedly
  13604. // https://bugs.jquery.com/ticket/13393
  13605. function safeActiveElement() {
  13606. try {
  13607. return document.activeElement;
  13608. } catch ( err ) { }
  13609. }
  13610. function on( elem, types, selector, data, fn, one ) {
  13611. var origFn, type;
  13612. // Types can be a map of types/handlers
  13613. if ( typeof types === "object" ) {
  13614. // ( types-Object, selector, data )
  13615. if ( typeof selector !== "string" ) {
  13616. // ( types-Object, data )
  13617. data = data || selector;
  13618. selector = undefined;
  13619. }
  13620. for ( type in types ) {
  13621. on( elem, type, selector, data, types[ type ], one );
  13622. }
  13623. return elem;
  13624. }
  13625. if ( data == null && fn == null ) {
  13626. // ( types, fn )
  13627. fn = selector;
  13628. data = selector = undefined;
  13629. } else if ( fn == null ) {
  13630. if ( typeof selector === "string" ) {
  13631. // ( types, selector, fn )
  13632. fn = data;
  13633. data = undefined;
  13634. } else {
  13635. // ( types, data, fn )
  13636. fn = data;
  13637. data = selector;
  13638. selector = undefined;
  13639. }
  13640. }
  13641. if ( fn === false ) {
  13642. fn = returnFalse;
  13643. } else if ( !fn ) {
  13644. return elem;
  13645. }
  13646. if ( one === 1 ) {
  13647. origFn = fn;
  13648. fn = function( event ) {
  13649. // Can use an empty set, since event contains the info
  13650. jQuery().off( event );
  13651. return origFn.apply( this, arguments );
  13652. };
  13653. // Use same guid so caller can remove using origFn
  13654. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  13655. }
  13656. return elem.each( function() {
  13657. jQuery.event.add( this, types, fn, data, selector );
  13658. } );
  13659. }
  13660. /*
  13661. * Helper functions for managing events -- not part of the public interface.
  13662. * Props to Dean Edwards' addEvent library for many of the ideas.
  13663. */
  13664. jQuery.event = {
  13665. global: {},
  13666. add: function( elem, types, handler, data, selector ) {
  13667. var handleObjIn, eventHandle, tmp,
  13668. events, t, handleObj,
  13669. special, handlers, type, namespaces, origType,
  13670. elemData = dataPriv.get( elem );
  13671. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  13672. if ( !elemData ) {
  13673. return;
  13674. }
  13675. // Caller can pass in an object of custom data in lieu of the handler
  13676. if ( handler.handler ) {
  13677. handleObjIn = handler;
  13678. handler = handleObjIn.handler;
  13679. selector = handleObjIn.selector;
  13680. }
  13681. // Ensure that invalid selectors throw exceptions at attach time
  13682. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  13683. if ( selector ) {
  13684. jQuery.find.matchesSelector( documentElement, selector );
  13685. }
  13686. // Make sure that the handler has a unique ID, used to find/remove it later
  13687. if ( !handler.guid ) {
  13688. handler.guid = jQuery.guid++;
  13689. }
  13690. // Init the element's event structure and main handler, if this is the first
  13691. if ( !( events = elemData.events ) ) {
  13692. events = elemData.events = {};
  13693. }
  13694. if ( !( eventHandle = elemData.handle ) ) {
  13695. eventHandle = elemData.handle = function( e ) {
  13696. // Discard the second event of a jQuery.event.trigger() and
  13697. // when an event is called after a page has unloaded
  13698. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  13699. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  13700. };
  13701. }
  13702. // Handle multiple events separated by a space
  13703. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13704. t = types.length;
  13705. while ( t-- ) {
  13706. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13707. type = origType = tmp[ 1 ];
  13708. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13709. // There *must* be a type, no attaching namespace-only handlers
  13710. if ( !type ) {
  13711. continue;
  13712. }
  13713. // If event changes its type, use the special event handlers for the changed type
  13714. special = jQuery.event.special[ type ] || {};
  13715. // If selector defined, determine special event api type, otherwise given type
  13716. type = ( selector ? special.delegateType : special.bindType ) || type;
  13717. // Update special based on newly reset type
  13718. special = jQuery.event.special[ type ] || {};
  13719. // handleObj is passed to all event handlers
  13720. handleObj = jQuery.extend( {
  13721. type: type,
  13722. origType: origType,
  13723. data: data,
  13724. handler: handler,
  13725. guid: handler.guid,
  13726. selector: selector,
  13727. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  13728. namespace: namespaces.join( "." )
  13729. }, handleObjIn );
  13730. // Init the event handler queue if we're the first
  13731. if ( !( handlers = events[ type ] ) ) {
  13732. handlers = events[ type ] = [];
  13733. handlers.delegateCount = 0;
  13734. // Only use addEventListener if the special events handler returns false
  13735. if ( !special.setup ||
  13736. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  13737. if ( elem.addEventListener ) {
  13738. elem.addEventListener( type, eventHandle );
  13739. }
  13740. }
  13741. }
  13742. if ( special.add ) {
  13743. special.add.call( elem, handleObj );
  13744. if ( !handleObj.handler.guid ) {
  13745. handleObj.handler.guid = handler.guid;
  13746. }
  13747. }
  13748. // Add to the element's handler list, delegates in front
  13749. if ( selector ) {
  13750. handlers.splice( handlers.delegateCount++, 0, handleObj );
  13751. } else {
  13752. handlers.push( handleObj );
  13753. }
  13754. // Keep track of which events have ever been used, for event optimization
  13755. jQuery.event.global[ type ] = true;
  13756. }
  13757. },
  13758. // Detach an event or set of events from an element
  13759. remove: function( elem, types, handler, selector, mappedTypes ) {
  13760. var j, origCount, tmp,
  13761. events, t, handleObj,
  13762. special, handlers, type, namespaces, origType,
  13763. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  13764. if ( !elemData || !( events = elemData.events ) ) {
  13765. return;
  13766. }
  13767. // Once for each type.namespace in types; type may be omitted
  13768. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13769. t = types.length;
  13770. while ( t-- ) {
  13771. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13772. type = origType = tmp[ 1 ];
  13773. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13774. // Unbind all events (on this namespace, if provided) for the element
  13775. if ( !type ) {
  13776. for ( type in events ) {
  13777. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  13778. }
  13779. continue;
  13780. }
  13781. special = jQuery.event.special[ type ] || {};
  13782. type = ( selector ? special.delegateType : special.bindType ) || type;
  13783. handlers = events[ type ] || [];
  13784. tmp = tmp[ 2 ] &&
  13785. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  13786. // Remove matching events
  13787. origCount = j = handlers.length;
  13788. while ( j-- ) {
  13789. handleObj = handlers[ j ];
  13790. if ( ( mappedTypes || origType === handleObj.origType ) &&
  13791. ( !handler || handler.guid === handleObj.guid ) &&
  13792. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  13793. ( !selector || selector === handleObj.selector ||
  13794. selector === "**" && handleObj.selector ) ) {
  13795. handlers.splice( j, 1 );
  13796. if ( handleObj.selector ) {
  13797. handlers.delegateCount--;
  13798. }
  13799. if ( special.remove ) {
  13800. special.remove.call( elem, handleObj );
  13801. }
  13802. }
  13803. }
  13804. // Remove generic event handler if we removed something and no more handlers exist
  13805. // (avoids potential for endless recursion during removal of special event handlers)
  13806. if ( origCount && !handlers.length ) {
  13807. if ( !special.teardown ||
  13808. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  13809. jQuery.removeEvent( elem, type, elemData.handle );
  13810. }
  13811. delete events[ type ];
  13812. }
  13813. }
  13814. // Remove data and the expando if it's no longer used
  13815. if ( jQuery.isEmptyObject( events ) ) {
  13816. dataPriv.remove( elem, "handle events" );
  13817. }
  13818. },
  13819. dispatch: function( nativeEvent ) {
  13820. // Make a writable jQuery.Event from the native event object
  13821. var event = jQuery.event.fix( nativeEvent );
  13822. var i, j, ret, matched, handleObj, handlerQueue,
  13823. args = new Array( arguments.length ),
  13824. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  13825. special = jQuery.event.special[ event.type ] || {};
  13826. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  13827. args[ 0 ] = event;
  13828. for ( i = 1; i < arguments.length; i++ ) {
  13829. args[ i ] = arguments[ i ];
  13830. }
  13831. event.delegateTarget = this;
  13832. // Call the preDispatch hook for the mapped type, and let it bail if desired
  13833. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  13834. return;
  13835. }
  13836. // Determine handlers
  13837. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  13838. // Run delegates first; they may want to stop propagation beneath us
  13839. i = 0;
  13840. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  13841. event.currentTarget = matched.elem;
  13842. j = 0;
  13843. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  13844. !event.isImmediatePropagationStopped() ) {
  13845. // If the event is namespaced, then each handler is only invoked if it is
  13846. // specially universal or its namespaces are a superset of the event's.
  13847. if ( !event.rnamespace || handleObj.namespace === false ||
  13848. event.rnamespace.test( handleObj.namespace ) ) {
  13849. event.handleObj = handleObj;
  13850. event.data = handleObj.data;
  13851. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  13852. handleObj.handler ).apply( matched.elem, args );
  13853. if ( ret !== undefined ) {
  13854. if ( ( event.result = ret ) === false ) {
  13855. event.preventDefault();
  13856. event.stopPropagation();
  13857. }
  13858. }
  13859. }
  13860. }
  13861. }
  13862. // Call the postDispatch hook for the mapped type
  13863. if ( special.postDispatch ) {
  13864. special.postDispatch.call( this, event );
  13865. }
  13866. return event.result;
  13867. },
  13868. handlers: function( event, handlers ) {
  13869. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  13870. handlerQueue = [],
  13871. delegateCount = handlers.delegateCount,
  13872. cur = event.target;
  13873. // Find delegate handlers
  13874. if ( delegateCount &&
  13875. // Support: IE <=9
  13876. // Black-hole SVG <use> instance trees (trac-13180)
  13877. cur.nodeType &&
  13878. // Support: Firefox <=42
  13879. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  13880. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  13881. // Support: IE 11 only
  13882. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  13883. !( event.type === "click" && event.button >= 1 ) ) {
  13884. for ( ; cur !== this; cur = cur.parentNode || this ) {
  13885. // Don't check non-elements (#13208)
  13886. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  13887. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  13888. matchedHandlers = [];
  13889. matchedSelectors = {};
  13890. for ( i = 0; i < delegateCount; i++ ) {
  13891. handleObj = handlers[ i ];
  13892. // Don't conflict with Object.prototype properties (#13203)
  13893. sel = handleObj.selector + " ";
  13894. if ( matchedSelectors[ sel ] === undefined ) {
  13895. matchedSelectors[ sel ] = handleObj.needsContext ?
  13896. jQuery( sel, this ).index( cur ) > -1 :
  13897. jQuery.find( sel, this, null, [ cur ] ).length;
  13898. }
  13899. if ( matchedSelectors[ sel ] ) {
  13900. matchedHandlers.push( handleObj );
  13901. }
  13902. }
  13903. if ( matchedHandlers.length ) {
  13904. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  13905. }
  13906. }
  13907. }
  13908. }
  13909. // Add the remaining (directly-bound) handlers
  13910. cur = this;
  13911. if ( delegateCount < handlers.length ) {
  13912. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  13913. }
  13914. return handlerQueue;
  13915. },
  13916. addProp: function( name, hook ) {
  13917. Object.defineProperty( jQuery.Event.prototype, name, {
  13918. enumerable: true,
  13919. configurable: true,
  13920. get: isFunction( hook ) ?
  13921. function() {
  13922. if ( this.originalEvent ) {
  13923. return hook( this.originalEvent );
  13924. }
  13925. } :
  13926. function() {
  13927. if ( this.originalEvent ) {
  13928. return this.originalEvent[ name ];
  13929. }
  13930. },
  13931. set: function( value ) {
  13932. Object.defineProperty( this, name, {
  13933. enumerable: true,
  13934. configurable: true,
  13935. writable: true,
  13936. value: value
  13937. } );
  13938. }
  13939. } );
  13940. },
  13941. fix: function( originalEvent ) {
  13942. return originalEvent[ jQuery.expando ] ?
  13943. originalEvent :
  13944. new jQuery.Event( originalEvent );
  13945. },
  13946. special: {
  13947. load: {
  13948. // Prevent triggered image.load events from bubbling to window.load
  13949. noBubble: true
  13950. },
  13951. click: {
  13952. // Utilize native event to ensure correct state for checkable inputs
  13953. setup: function( data ) {
  13954. // For mutual compressibility with _default, replace `this` access with a local var.
  13955. // `|| data` is dead code meant only to preserve the variable through minification.
  13956. var el = this || data;
  13957. // Claim the first handler
  13958. if ( rcheckableType.test( el.type ) &&
  13959. el.click && nodeName( el, "input" ) ) {
  13960. // dataPriv.set( el, "click", ... )
  13961. leverageNative( el, "click", returnTrue );
  13962. }
  13963. // Return false to allow normal processing in the caller
  13964. return false;
  13965. },
  13966. trigger: function( data ) {
  13967. // For mutual compressibility with _default, replace `this` access with a local var.
  13968. // `|| data` is dead code meant only to preserve the variable through minification.
  13969. var el = this || data;
  13970. // Force setup before triggering a click
  13971. if ( rcheckableType.test( el.type ) &&
  13972. el.click && nodeName( el, "input" ) ) {
  13973. leverageNative( el, "click" );
  13974. }
  13975. // Return non-false to allow normal event-path propagation
  13976. return true;
  13977. },
  13978. // For cross-browser consistency, suppress native .click() on links
  13979. // Also prevent it if we're currently inside a leveraged native-event stack
  13980. _default: function( event ) {
  13981. var target = event.target;
  13982. return rcheckableType.test( target.type ) &&
  13983. target.click && nodeName( target, "input" ) &&
  13984. dataPriv.get( target, "click" ) ||
  13985. nodeName( target, "a" );
  13986. }
  13987. },
  13988. beforeunload: {
  13989. postDispatch: function( event ) {
  13990. // Support: Firefox 20+
  13991. // Firefox doesn't alert if the returnValue field is not set.
  13992. if ( event.result !== undefined && event.originalEvent ) {
  13993. event.originalEvent.returnValue = event.result;
  13994. }
  13995. }
  13996. }
  13997. }
  13998. };
  13999. // Ensure the presence of an event listener that handles manually-triggered
  14000. // synthetic events by interrupting progress until reinvoked in response to
  14001. // *native* events that it fires directly, ensuring that state changes have
  14002. // already occurred before other listeners are invoked.
  14003. function leverageNative( el, type, expectSync ) {
  14004. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  14005. if ( !expectSync ) {
  14006. if ( dataPriv.get( el, type ) === undefined ) {
  14007. jQuery.event.add( el, type, returnTrue );
  14008. }
  14009. return;
  14010. }
  14011. // Register the controller as a special universal handler for all event namespaces
  14012. dataPriv.set( el, type, false );
  14013. jQuery.event.add( el, type, {
  14014. namespace: false,
  14015. handler: function( event ) {
  14016. var notAsync, result,
  14017. saved = dataPriv.get( this, type );
  14018. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  14019. // Interrupt processing of the outer synthetic .trigger()ed event
  14020. // Saved data should be false in such cases, but might be a leftover capture object
  14021. // from an async native handler (gh-4350)
  14022. if ( !saved.length ) {
  14023. // Store arguments for use when handling the inner native event
  14024. // There will always be at least one argument (an event object), so this array
  14025. // will not be confused with a leftover capture object.
  14026. saved = slice.call( arguments );
  14027. dataPriv.set( this, type, saved );
  14028. // Trigger the native event and capture its result
  14029. // Support: IE <=9 - 11+
  14030. // focus() and blur() are asynchronous
  14031. notAsync = expectSync( this, type );
  14032. this[ type ]();
  14033. result = dataPriv.get( this, type );
  14034. if ( saved !== result || notAsync ) {
  14035. dataPriv.set( this, type, false );
  14036. } else {
  14037. result = {};
  14038. }
  14039. if ( saved !== result ) {
  14040. // Cancel the outer synthetic event
  14041. event.stopImmediatePropagation();
  14042. event.preventDefault();
  14043. return result.value;
  14044. }
  14045. // If this is an inner synthetic event for an event with a bubbling surrogate
  14046. // (focus or blur), assume that the surrogate already propagated from triggering the
  14047. // native event and prevent that from happening again here.
  14048. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  14049. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  14050. // less bad than duplication.
  14051. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  14052. event.stopPropagation();
  14053. }
  14054. // If this is a native event triggered above, everything is now in order
  14055. // Fire an inner synthetic event with the original arguments
  14056. } else if ( saved.length ) {
  14057. // ...and capture the result
  14058. dataPriv.set( this, type, {
  14059. value: jQuery.event.trigger(
  14060. // Support: IE <=9 - 11+
  14061. // Extend with the prototype to reset the above stopImmediatePropagation()
  14062. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  14063. saved.slice( 1 ),
  14064. this
  14065. )
  14066. } );
  14067. // Abort handling of the native event
  14068. event.stopImmediatePropagation();
  14069. }
  14070. }
  14071. } );
  14072. }
  14073. jQuery.removeEvent = function( elem, type, handle ) {
  14074. // This "if" is needed for plain objects
  14075. if ( elem.removeEventListener ) {
  14076. elem.removeEventListener( type, handle );
  14077. }
  14078. };
  14079. jQuery.Event = function( src, props ) {
  14080. // Allow instantiation without the 'new' keyword
  14081. if ( !( this instanceof jQuery.Event ) ) {
  14082. return new jQuery.Event( src, props );
  14083. }
  14084. // Event object
  14085. if ( src && src.type ) {
  14086. this.originalEvent = src;
  14087. this.type = src.type;
  14088. // Events bubbling up the document may have been marked as prevented
  14089. // by a handler lower down the tree; reflect the correct value.
  14090. this.isDefaultPrevented = src.defaultPrevented ||
  14091. src.defaultPrevented === undefined &&
  14092. // Support: Android <=2.3 only
  14093. src.returnValue === false ?
  14094. returnTrue :
  14095. returnFalse;
  14096. // Create target properties
  14097. // Support: Safari <=6 - 7 only
  14098. // Target should not be a text node (#504, #13143)
  14099. this.target = ( src.target && src.target.nodeType === 3 ) ?
  14100. src.target.parentNode :
  14101. src.target;
  14102. this.currentTarget = src.currentTarget;
  14103. this.relatedTarget = src.relatedTarget;
  14104. // Event type
  14105. } else {
  14106. this.type = src;
  14107. }
  14108. // Put explicitly provided properties onto the event object
  14109. if ( props ) {
  14110. jQuery.extend( this, props );
  14111. }
  14112. // Create a timestamp if incoming event doesn't have one
  14113. this.timeStamp = src && src.timeStamp || Date.now();
  14114. // Mark it as fixed
  14115. this[ jQuery.expando ] = true;
  14116. };
  14117. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  14118. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  14119. jQuery.Event.prototype = {
  14120. constructor: jQuery.Event,
  14121. isDefaultPrevented: returnFalse,
  14122. isPropagationStopped: returnFalse,
  14123. isImmediatePropagationStopped: returnFalse,
  14124. isSimulated: false,
  14125. preventDefault: function() {
  14126. var e = this.originalEvent;
  14127. this.isDefaultPrevented = returnTrue;
  14128. if ( e && !this.isSimulated ) {
  14129. e.preventDefault();
  14130. }
  14131. },
  14132. stopPropagation: function() {
  14133. var e = this.originalEvent;
  14134. this.isPropagationStopped = returnTrue;
  14135. if ( e && !this.isSimulated ) {
  14136. e.stopPropagation();
  14137. }
  14138. },
  14139. stopImmediatePropagation: function() {
  14140. var e = this.originalEvent;
  14141. this.isImmediatePropagationStopped = returnTrue;
  14142. if ( e && !this.isSimulated ) {
  14143. e.stopImmediatePropagation();
  14144. }
  14145. this.stopPropagation();
  14146. }
  14147. };
  14148. // Includes all common event props including KeyEvent and MouseEvent specific props
  14149. jQuery.each( {
  14150. altKey: true,
  14151. bubbles: true,
  14152. cancelable: true,
  14153. changedTouches: true,
  14154. ctrlKey: true,
  14155. detail: true,
  14156. eventPhase: true,
  14157. metaKey: true,
  14158. pageX: true,
  14159. pageY: true,
  14160. shiftKey: true,
  14161. view: true,
  14162. "char": true,
  14163. code: true,
  14164. charCode: true,
  14165. key: true,
  14166. keyCode: true,
  14167. button: true,
  14168. buttons: true,
  14169. clientX: true,
  14170. clientY: true,
  14171. offsetX: true,
  14172. offsetY: true,
  14173. pointerId: true,
  14174. pointerType: true,
  14175. screenX: true,
  14176. screenY: true,
  14177. targetTouches: true,
  14178. toElement: true,
  14179. touches: true,
  14180. which: function( event ) {
  14181. var button = event.button;
  14182. // Add which for key events
  14183. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  14184. return event.charCode != null ? event.charCode : event.keyCode;
  14185. }
  14186. // Add which for click: 1 === left; 2 === middle; 3 === right
  14187. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  14188. if ( button & 1 ) {
  14189. return 1;
  14190. }
  14191. if ( button & 2 ) {
  14192. return 3;
  14193. }
  14194. if ( button & 4 ) {
  14195. return 2;
  14196. }
  14197. return 0;
  14198. }
  14199. return event.which;
  14200. }
  14201. }, jQuery.event.addProp );
  14202. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  14203. jQuery.event.special[ type ] = {
  14204. // Utilize native event if possible so blur/focus sequence is correct
  14205. setup: function() {
  14206. // Claim the first handler
  14207. // dataPriv.set( this, "focus", ... )
  14208. // dataPriv.set( this, "blur", ... )
  14209. leverageNative( this, type, expectSync );
  14210. // Return false to allow normal processing in the caller
  14211. return false;
  14212. },
  14213. trigger: function() {
  14214. // Force setup before trigger
  14215. leverageNative( this, type );
  14216. // Return non-false to allow normal event-path propagation
  14217. return true;
  14218. },
  14219. delegateType: delegateType
  14220. };
  14221. } );
  14222. // Create mouseenter/leave events using mouseover/out and event-time checks
  14223. // so that event delegation works in jQuery.
  14224. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  14225. //
  14226. // Support: Safari 7 only
  14227. // Safari sends mouseenter too often; see:
  14228. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  14229. // for the description of the bug (it existed in older Chrome versions as well).
  14230. jQuery.each( {
  14231. mouseenter: "mouseover",
  14232. mouseleave: "mouseout",
  14233. pointerenter: "pointerover",
  14234. pointerleave: "pointerout"
  14235. }, function( orig, fix ) {
  14236. jQuery.event.special[ orig ] = {
  14237. delegateType: fix,
  14238. bindType: fix,
  14239. handle: function( event ) {
  14240. var ret,
  14241. target = this,
  14242. related = event.relatedTarget,
  14243. handleObj = event.handleObj;
  14244. // For mouseenter/leave call the handler if related is outside the target.
  14245. // NB: No relatedTarget if the mouse left/entered the browser window
  14246. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  14247. event.type = handleObj.origType;
  14248. ret = handleObj.handler.apply( this, arguments );
  14249. event.type = fix;
  14250. }
  14251. return ret;
  14252. }
  14253. };
  14254. } );
  14255. jQuery.fn.extend( {
  14256. on: function( types, selector, data, fn ) {
  14257. return on( this, types, selector, data, fn );
  14258. },
  14259. one: function( types, selector, data, fn ) {
  14260. return on( this, types, selector, data, fn, 1 );
  14261. },
  14262. off: function( types, selector, fn ) {
  14263. var handleObj, type;
  14264. if ( types && types.preventDefault && types.handleObj ) {
  14265. // ( event ) dispatched jQuery.Event
  14266. handleObj = types.handleObj;
  14267. jQuery( types.delegateTarget ).off(
  14268. handleObj.namespace ?
  14269. handleObj.origType + "." + handleObj.namespace :
  14270. handleObj.origType,
  14271. handleObj.selector,
  14272. handleObj.handler
  14273. );
  14274. return this;
  14275. }
  14276. if ( typeof types === "object" ) {
  14277. // ( types-object [, selector] )
  14278. for ( type in types ) {
  14279. this.off( type, selector, types[ type ] );
  14280. }
  14281. return this;
  14282. }
  14283. if ( selector === false || typeof selector === "function" ) {
  14284. // ( types [, fn] )
  14285. fn = selector;
  14286. selector = undefined;
  14287. }
  14288. if ( fn === false ) {
  14289. fn = returnFalse;
  14290. }
  14291. return this.each( function() {
  14292. jQuery.event.remove( this, types, fn, selector );
  14293. } );
  14294. }
  14295. } );
  14296. var
  14297. /* eslint-disable max-len */
  14298. // See https://github.com/eslint/eslint/issues/3229
  14299. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  14300. /* eslint-enable */
  14301. // Support: IE <=10 - 11, Edge 12 - 13 only
  14302. // In IE/Edge using regex groups here causes severe slowdowns.
  14303. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  14304. rnoInnerhtml = /<script|<style|<link/i,
  14305. // checked="checked" or checked
  14306. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  14307. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  14308. // Prefer a tbody over its parent table for containing new rows
  14309. function manipulationTarget( elem, content ) {
  14310. if ( nodeName( elem, "table" ) &&
  14311. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  14312. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  14313. }
  14314. return elem;
  14315. }
  14316. // Replace/restore the type attribute of script elements for safe DOM manipulation
  14317. function disableScript( elem ) {
  14318. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  14319. return elem;
  14320. }
  14321. function restoreScript( elem ) {
  14322. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  14323. elem.type = elem.type.slice( 5 );
  14324. } else {
  14325. elem.removeAttribute( "type" );
  14326. }
  14327. return elem;
  14328. }
  14329. function cloneCopyEvent( src, dest ) {
  14330. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  14331. if ( dest.nodeType !== 1 ) {
  14332. return;
  14333. }
  14334. // 1. Copy private data: events, handlers, etc.
  14335. if ( dataPriv.hasData( src ) ) {
  14336. pdataOld = dataPriv.access( src );
  14337. pdataCur = dataPriv.set( dest, pdataOld );
  14338. events = pdataOld.events;
  14339. if ( events ) {
  14340. delete pdataCur.handle;
  14341. pdataCur.events = {};
  14342. for ( type in events ) {
  14343. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  14344. jQuery.event.add( dest, type, events[ type ][ i ] );
  14345. }
  14346. }
  14347. }
  14348. }
  14349. // 2. Copy user data
  14350. if ( dataUser.hasData( src ) ) {
  14351. udataOld = dataUser.access( src );
  14352. udataCur = jQuery.extend( {}, udataOld );
  14353. dataUser.set( dest, udataCur );
  14354. }
  14355. }
  14356. // Fix IE bugs, see support tests
  14357. function fixInput( src, dest ) {
  14358. var nodeName = dest.nodeName.toLowerCase();
  14359. // Fails to persist the checked state of a cloned checkbox or radio button.
  14360. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  14361. dest.checked = src.checked;
  14362. // Fails to return the selected option to the default selected state when cloning options
  14363. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  14364. dest.defaultValue = src.defaultValue;
  14365. }
  14366. }
  14367. function domManip( collection, args, callback, ignored ) {
  14368. // Flatten any nested arrays
  14369. args = concat.apply( [], args );
  14370. var fragment, first, scripts, hasScripts, node, doc,
  14371. i = 0,
  14372. l = collection.length,
  14373. iNoClone = l - 1,
  14374. value = args[ 0 ],
  14375. valueIsFunction = isFunction( value );
  14376. // We can't cloneNode fragments that contain checked, in WebKit
  14377. if ( valueIsFunction ||
  14378. ( l > 1 && typeof value === "string" &&
  14379. !support.checkClone && rchecked.test( value ) ) ) {
  14380. return collection.each( function( index ) {
  14381. var self = collection.eq( index );
  14382. if ( valueIsFunction ) {
  14383. args[ 0 ] = value.call( this, index, self.html() );
  14384. }
  14385. domManip( self, args, callback, ignored );
  14386. } );
  14387. }
  14388. if ( l ) {
  14389. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  14390. first = fragment.firstChild;
  14391. if ( fragment.childNodes.length === 1 ) {
  14392. fragment = first;
  14393. }
  14394. // Require either new content or an interest in ignored elements to invoke the callback
  14395. if ( first || ignored ) {
  14396. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  14397. hasScripts = scripts.length;
  14398. // Use the original fragment for the last item
  14399. // instead of the first because it can end up
  14400. // being emptied incorrectly in certain situations (#8070).
  14401. for ( ; i < l; i++ ) {
  14402. node = fragment;
  14403. if ( i !== iNoClone ) {
  14404. node = jQuery.clone( node, true, true );
  14405. // Keep references to cloned scripts for later restoration
  14406. if ( hasScripts ) {
  14407. // Support: Android <=4.0 only, PhantomJS 1 only
  14408. // push.apply(_, arraylike) throws on ancient WebKit
  14409. jQuery.merge( scripts, getAll( node, "script" ) );
  14410. }
  14411. }
  14412. callback.call( collection[ i ], node, i );
  14413. }
  14414. if ( hasScripts ) {
  14415. doc = scripts[ scripts.length - 1 ].ownerDocument;
  14416. // Reenable scripts
  14417. jQuery.map( scripts, restoreScript );
  14418. // Evaluate executable scripts on first document insertion
  14419. for ( i = 0; i < hasScripts; i++ ) {
  14420. node = scripts[ i ];
  14421. if ( rscriptType.test( node.type || "" ) &&
  14422. !dataPriv.access( node, "globalEval" ) &&
  14423. jQuery.contains( doc, node ) ) {
  14424. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  14425. // Optional AJAX dependency, but won't run scripts if not present
  14426. if ( jQuery._evalUrl && !node.noModule ) {
  14427. jQuery._evalUrl( node.src, {
  14428. nonce: node.nonce || node.getAttribute( "nonce" )
  14429. } );
  14430. }
  14431. } else {
  14432. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  14433. }
  14434. }
  14435. }
  14436. }
  14437. }
  14438. }
  14439. return collection;
  14440. }
  14441. function remove( elem, selector, keepData ) {
  14442. var node,
  14443. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  14444. i = 0;
  14445. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  14446. if ( !keepData && node.nodeType === 1 ) {
  14447. jQuery.cleanData( getAll( node ) );
  14448. }
  14449. if ( node.parentNode ) {
  14450. if ( keepData && isAttached( node ) ) {
  14451. setGlobalEval( getAll( node, "script" ) );
  14452. }
  14453. node.parentNode.removeChild( node );
  14454. }
  14455. }
  14456. return elem;
  14457. }
  14458. jQuery.extend( {
  14459. htmlPrefilter: function( html ) {
  14460. return html.replace( rxhtmlTag, "<$1></$2>" );
  14461. },
  14462. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  14463. var i, l, srcElements, destElements,
  14464. clone = elem.cloneNode( true ),
  14465. inPage = isAttached( elem );
  14466. // Fix IE cloning issues
  14467. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  14468. !jQuery.isXMLDoc( elem ) ) {
  14469. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  14470. destElements = getAll( clone );
  14471. srcElements = getAll( elem );
  14472. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14473. fixInput( srcElements[ i ], destElements[ i ] );
  14474. }
  14475. }
  14476. // Copy the events from the original to the clone
  14477. if ( dataAndEvents ) {
  14478. if ( deepDataAndEvents ) {
  14479. srcElements = srcElements || getAll( elem );
  14480. destElements = destElements || getAll( clone );
  14481. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14482. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  14483. }
  14484. } else {
  14485. cloneCopyEvent( elem, clone );
  14486. }
  14487. }
  14488. // Preserve script evaluation history
  14489. destElements = getAll( clone, "script" );
  14490. if ( destElements.length > 0 ) {
  14491. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  14492. }
  14493. // Return the cloned set
  14494. return clone;
  14495. },
  14496. cleanData: function( elems ) {
  14497. var data, elem, type,
  14498. special = jQuery.event.special,
  14499. i = 0;
  14500. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  14501. if ( acceptData( elem ) ) {
  14502. if ( ( data = elem[ dataPriv.expando ] ) ) {
  14503. if ( data.events ) {
  14504. for ( type in data.events ) {
  14505. if ( special[ type ] ) {
  14506. jQuery.event.remove( elem, type );
  14507. // This is a shortcut to avoid jQuery.event.remove's overhead
  14508. } else {
  14509. jQuery.removeEvent( elem, type, data.handle );
  14510. }
  14511. }
  14512. }
  14513. // Support: Chrome <=35 - 45+
  14514. // Assign undefined instead of using delete, see Data#remove
  14515. elem[ dataPriv.expando ] = undefined;
  14516. }
  14517. if ( elem[ dataUser.expando ] ) {
  14518. // Support: Chrome <=35 - 45+
  14519. // Assign undefined instead of using delete, see Data#remove
  14520. elem[ dataUser.expando ] = undefined;
  14521. }
  14522. }
  14523. }
  14524. }
  14525. } );
  14526. jQuery.fn.extend( {
  14527. detach: function( selector ) {
  14528. return remove( this, selector, true );
  14529. },
  14530. remove: function( selector ) {
  14531. return remove( this, selector );
  14532. },
  14533. text: function( value ) {
  14534. return access( this, function( value ) {
  14535. return value === undefined ?
  14536. jQuery.text( this ) :
  14537. this.empty().each( function() {
  14538. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14539. this.textContent = value;
  14540. }
  14541. } );
  14542. }, null, value, arguments.length );
  14543. },
  14544. append: function() {
  14545. return domManip( this, arguments, function( elem ) {
  14546. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14547. var target = manipulationTarget( this, elem );
  14548. target.appendChild( elem );
  14549. }
  14550. } );
  14551. },
  14552. prepend: function() {
  14553. return domManip( this, arguments, function( elem ) {
  14554. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14555. var target = manipulationTarget( this, elem );
  14556. target.insertBefore( elem, target.firstChild );
  14557. }
  14558. } );
  14559. },
  14560. before: function() {
  14561. return domManip( this, arguments, function( elem ) {
  14562. if ( this.parentNode ) {
  14563. this.parentNode.insertBefore( elem, this );
  14564. }
  14565. } );
  14566. },
  14567. after: function() {
  14568. return domManip( this, arguments, function( elem ) {
  14569. if ( this.parentNode ) {
  14570. this.parentNode.insertBefore( elem, this.nextSibling );
  14571. }
  14572. } );
  14573. },
  14574. empty: function() {
  14575. var elem,
  14576. i = 0;
  14577. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  14578. if ( elem.nodeType === 1 ) {
  14579. // Prevent memory leaks
  14580. jQuery.cleanData( getAll( elem, false ) );
  14581. // Remove any remaining nodes
  14582. elem.textContent = "";
  14583. }
  14584. }
  14585. return this;
  14586. },
  14587. clone: function( dataAndEvents, deepDataAndEvents ) {
  14588. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  14589. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  14590. return this.map( function() {
  14591. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  14592. } );
  14593. },
  14594. html: function( value ) {
  14595. return access( this, function( value ) {
  14596. var elem = this[ 0 ] || {},
  14597. i = 0,
  14598. l = this.length;
  14599. if ( value === undefined && elem.nodeType === 1 ) {
  14600. return elem.innerHTML;
  14601. }
  14602. // See if we can take a shortcut and just use innerHTML
  14603. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  14604. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  14605. value = jQuery.htmlPrefilter( value );
  14606. try {
  14607. for ( ; i < l; i++ ) {
  14608. elem = this[ i ] || {};
  14609. // Remove element nodes and prevent memory leaks
  14610. if ( elem.nodeType === 1 ) {
  14611. jQuery.cleanData( getAll( elem, false ) );
  14612. elem.innerHTML = value;
  14613. }
  14614. }
  14615. elem = 0;
  14616. // If using innerHTML throws an exception, use the fallback method
  14617. } catch ( e ) {}
  14618. }
  14619. if ( elem ) {
  14620. this.empty().append( value );
  14621. }
  14622. }, null, value, arguments.length );
  14623. },
  14624. replaceWith: function() {
  14625. var ignored = [];
  14626. // Make the changes, replacing each non-ignored context element with the new content
  14627. return domManip( this, arguments, function( elem ) {
  14628. var parent = this.parentNode;
  14629. if ( jQuery.inArray( this, ignored ) < 0 ) {
  14630. jQuery.cleanData( getAll( this ) );
  14631. if ( parent ) {
  14632. parent.replaceChild( elem, this );
  14633. }
  14634. }
  14635. // Force callback invocation
  14636. }, ignored );
  14637. }
  14638. } );
  14639. jQuery.each( {
  14640. appendTo: "append",
  14641. prependTo: "prepend",
  14642. insertBefore: "before",
  14643. insertAfter: "after",
  14644. replaceAll: "replaceWith"
  14645. }, function( name, original ) {
  14646. jQuery.fn[ name ] = function( selector ) {
  14647. var elems,
  14648. ret = [],
  14649. insert = jQuery( selector ),
  14650. last = insert.length - 1,
  14651. i = 0;
  14652. for ( ; i <= last; i++ ) {
  14653. elems = i === last ? this : this.clone( true );
  14654. jQuery( insert[ i ] )[ original ]( elems );
  14655. // Support: Android <=4.0 only, PhantomJS 1 only
  14656. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  14657. push.apply( ret, elems.get() );
  14658. }
  14659. return this.pushStack( ret );
  14660. };
  14661. } );
  14662. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  14663. var getStyles = function( elem ) {
  14664. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  14665. // IE throws on elements created in popups
  14666. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  14667. var view = elem.ownerDocument.defaultView;
  14668. if ( !view || !view.opener ) {
  14669. view = window;
  14670. }
  14671. return view.getComputedStyle( elem );
  14672. };
  14673. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  14674. ( function() {
  14675. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  14676. // so they're executed at the same time to save the second computation.
  14677. function computeStyleTests() {
  14678. // This is a singleton, we need to execute it only once
  14679. if ( !div ) {
  14680. return;
  14681. }
  14682. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  14683. "margin-top:1px;padding:0;border:0";
  14684. div.style.cssText =
  14685. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  14686. "margin:auto;border:1px;padding:1px;" +
  14687. "width:60%;top:1%";
  14688. documentElement.appendChild( container ).appendChild( div );
  14689. var divStyle = window.getComputedStyle( div );
  14690. pixelPositionVal = divStyle.top !== "1%";
  14691. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  14692. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  14693. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  14694. // Some styles come back with percentage values, even though they shouldn't
  14695. div.style.right = "60%";
  14696. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  14697. // Support: IE 9 - 11 only
  14698. // Detect misreporting of content dimensions for box-sizing:border-box elements
  14699. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  14700. // Support: IE 9 only
  14701. // Detect overflow:scroll screwiness (gh-3699)
  14702. // Support: Chrome <=64
  14703. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  14704. div.style.position = "absolute";
  14705. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  14706. documentElement.removeChild( container );
  14707. // Nullify the div so it wouldn't be stored in the memory and
  14708. // it will also be a sign that checks already performed
  14709. div = null;
  14710. }
  14711. function roundPixelMeasures( measure ) {
  14712. return Math.round( parseFloat( measure ) );
  14713. }
  14714. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  14715. reliableMarginLeftVal,
  14716. container = document.createElement( "div" ),
  14717. div = document.createElement( "div" );
  14718. // Finish early in limited (non-browser) environments
  14719. if ( !div.style ) {
  14720. return;
  14721. }
  14722. // Support: IE <=9 - 11 only
  14723. // Style of cloned element affects source element cloned (#8908)
  14724. div.style.backgroundClip = "content-box";
  14725. div.cloneNode( true ).style.backgroundClip = "";
  14726. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  14727. jQuery.extend( support, {
  14728. boxSizingReliable: function() {
  14729. computeStyleTests();
  14730. return boxSizingReliableVal;
  14731. },
  14732. pixelBoxStyles: function() {
  14733. computeStyleTests();
  14734. return pixelBoxStylesVal;
  14735. },
  14736. pixelPosition: function() {
  14737. computeStyleTests();
  14738. return pixelPositionVal;
  14739. },
  14740. reliableMarginLeft: function() {
  14741. computeStyleTests();
  14742. return reliableMarginLeftVal;
  14743. },
  14744. scrollboxSize: function() {
  14745. computeStyleTests();
  14746. return scrollboxSizeVal;
  14747. }
  14748. } );
  14749. } )();
  14750. function curCSS( elem, name, computed ) {
  14751. var width, minWidth, maxWidth, ret,
  14752. // Support: Firefox 51+
  14753. // Retrieving style before computed somehow
  14754. // fixes an issue with getting wrong values
  14755. // on detached elements
  14756. style = elem.style;
  14757. computed = computed || getStyles( elem );
  14758. // getPropertyValue is needed for:
  14759. // .css('filter') (IE 9 only, #12537)
  14760. // .css('--customProperty) (#3144)
  14761. if ( computed ) {
  14762. ret = computed.getPropertyValue( name ) || computed[ name ];
  14763. if ( ret === "" && !isAttached( elem ) ) {
  14764. ret = jQuery.style( elem, name );
  14765. }
  14766. // A tribute to the "awesome hack by Dean Edwards"
  14767. // Android Browser returns percentage for some values,
  14768. // but width seems to be reliably pixels.
  14769. // This is against the CSSOM draft spec:
  14770. // https://drafts.csswg.org/cssom/#resolved-values
  14771. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  14772. // Remember the original values
  14773. width = style.width;
  14774. minWidth = style.minWidth;
  14775. maxWidth = style.maxWidth;
  14776. // Put in the new values to get a computed value out
  14777. style.minWidth = style.maxWidth = style.width = ret;
  14778. ret = computed.width;
  14779. // Revert the changed values
  14780. style.width = width;
  14781. style.minWidth = minWidth;
  14782. style.maxWidth = maxWidth;
  14783. }
  14784. }
  14785. return ret !== undefined ?
  14786. // Support: IE <=9 - 11 only
  14787. // IE returns zIndex value as an integer.
  14788. ret + "" :
  14789. ret;
  14790. }
  14791. function addGetHookIf( conditionFn, hookFn ) {
  14792. // Define the hook, we'll check on the first run if it's really needed.
  14793. return {
  14794. get: function() {
  14795. if ( conditionFn() ) {
  14796. // Hook not needed (or it's not possible to use it due
  14797. // to missing dependency), remove it.
  14798. delete this.get;
  14799. return;
  14800. }
  14801. // Hook needed; redefine it so that the support test is not executed again.
  14802. return ( this.get = hookFn ).apply( this, arguments );
  14803. }
  14804. };
  14805. }
  14806. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  14807. emptyStyle = document.createElement( "div" ).style,
  14808. vendorProps = {};
  14809. // Return a vendor-prefixed property or undefined
  14810. function vendorPropName( name ) {
  14811. // Check for vendor prefixed names
  14812. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  14813. i = cssPrefixes.length;
  14814. while ( i-- ) {
  14815. name = cssPrefixes[ i ] + capName;
  14816. if ( name in emptyStyle ) {
  14817. return name;
  14818. }
  14819. }
  14820. }
  14821. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  14822. function finalPropName( name ) {
  14823. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  14824. if ( final ) {
  14825. return final;
  14826. }
  14827. if ( name in emptyStyle ) {
  14828. return name;
  14829. }
  14830. return vendorProps[ name ] = vendorPropName( name ) || name;
  14831. }
  14832. var
  14833. // Swappable if display is none or starts with table
  14834. // except "table", "table-cell", or "table-caption"
  14835. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  14836. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  14837. rcustomProp = /^--/,
  14838. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  14839. cssNormalTransform = {
  14840. letterSpacing: "0",
  14841. fontWeight: "400"
  14842. };
  14843. function setPositiveNumber( elem, value, subtract ) {
  14844. // Any relative (+/-) values have already been
  14845. // normalized at this point
  14846. var matches = rcssNum.exec( value );
  14847. return matches ?
  14848. // Guard against undefined "subtract", e.g., when used as in cssHooks
  14849. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  14850. value;
  14851. }
  14852. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  14853. var i = dimension === "width" ? 1 : 0,
  14854. extra = 0,
  14855. delta = 0;
  14856. // Adjustment may not be necessary
  14857. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  14858. return 0;
  14859. }
  14860. for ( ; i < 4; i += 2 ) {
  14861. // Both box models exclude margin
  14862. if ( box === "margin" ) {
  14863. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  14864. }
  14865. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  14866. if ( !isBorderBox ) {
  14867. // Add padding
  14868. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14869. // For "border" or "margin", add border
  14870. if ( box !== "padding" ) {
  14871. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14872. // But still keep track of it otherwise
  14873. } else {
  14874. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14875. }
  14876. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  14877. // "padding" or "margin"
  14878. } else {
  14879. // For "content", subtract padding
  14880. if ( box === "content" ) {
  14881. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14882. }
  14883. // For "content" or "padding", subtract border
  14884. if ( box !== "margin" ) {
  14885. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14886. }
  14887. }
  14888. }
  14889. // Account for positive content-box scroll gutter when requested by providing computedVal
  14890. if ( !isBorderBox && computedVal >= 0 ) {
  14891. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  14892. // Assuming integer scroll gutter, subtract the rest and round down
  14893. delta += Math.max( 0, Math.ceil(
  14894. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14895. computedVal -
  14896. delta -
  14897. extra -
  14898. 0.5
  14899. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  14900. // Use an explicit zero to avoid NaN (gh-3964)
  14901. ) ) || 0;
  14902. }
  14903. return delta;
  14904. }
  14905. function getWidthOrHeight( elem, dimension, extra ) {
  14906. // Start with computed style
  14907. var styles = getStyles( elem ),
  14908. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  14909. // Fake content-box until we know it's needed to know the true value.
  14910. boxSizingNeeded = !support.boxSizingReliable() || extra,
  14911. isBorderBox = boxSizingNeeded &&
  14912. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14913. valueIsBorderBox = isBorderBox,
  14914. val = curCSS( elem, dimension, styles ),
  14915. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  14916. // Support: Firefox <=54
  14917. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  14918. if ( rnumnonpx.test( val ) ) {
  14919. if ( !extra ) {
  14920. return val;
  14921. }
  14922. val = "auto";
  14923. }
  14924. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14925. // This happens for inline elements with no explicit setting (gh-3571)
  14926. // Support: Android <=4.1 - 4.3 only
  14927. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14928. // Support: IE 9-11 only
  14929. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14930. // We use getClientRects() to check for hidden/disconnected.
  14931. // In those cases, the computed value can be trusted to be border-box
  14932. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14933. val === "auto" ||
  14934. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14935. elem.getClientRects().length ) {
  14936. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14937. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14938. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14939. // retrieved value as a content box dimension.
  14940. valueIsBorderBox = offsetProp in elem;
  14941. if ( valueIsBorderBox ) {
  14942. val = elem[ offsetProp ];
  14943. }
  14944. }
  14945. // Normalize "" and auto
  14946. val = parseFloat( val ) || 0;
  14947. // Adjust for the element's box model
  14948. return ( val +
  14949. boxModelAdjustment(
  14950. elem,
  14951. dimension,
  14952. extra || ( isBorderBox ? "border" : "content" ),
  14953. valueIsBorderBox,
  14954. styles,
  14955. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14956. val
  14957. )
  14958. ) + "px";
  14959. }
  14960. jQuery.extend( {
  14961. // Add in style property hooks for overriding the default
  14962. // behavior of getting and setting a style property
  14963. cssHooks: {
  14964. opacity: {
  14965. get: function( elem, computed ) {
  14966. if ( computed ) {
  14967. // We should always get a number back from opacity
  14968. var ret = curCSS( elem, "opacity" );
  14969. return ret === "" ? "1" : ret;
  14970. }
  14971. }
  14972. }
  14973. },
  14974. // Don't automatically add "px" to these possibly-unitless properties
  14975. cssNumber: {
  14976. "animationIterationCount": true,
  14977. "columnCount": true,
  14978. "fillOpacity": true,
  14979. "flexGrow": true,
  14980. "flexShrink": true,
  14981. "fontWeight": true,
  14982. "gridArea": true,
  14983. "gridColumn": true,
  14984. "gridColumnEnd": true,
  14985. "gridColumnStart": true,
  14986. "gridRow": true,
  14987. "gridRowEnd": true,
  14988. "gridRowStart": true,
  14989. "lineHeight": true,
  14990. "opacity": true,
  14991. "order": true,
  14992. "orphans": true,
  14993. "widows": true,
  14994. "zIndex": true,
  14995. "zoom": true
  14996. },
  14997. // Add in properties whose names you wish to fix before
  14998. // setting or getting the value
  14999. cssProps: {},
  15000. // Get and set the style property on a DOM Node
  15001. style: function( elem, name, value, extra ) {
  15002. // Don't set styles on text and comment nodes
  15003. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  15004. return;
  15005. }
  15006. // Make sure that we're working with the right name
  15007. var ret, type, hooks,
  15008. origName = camelCase( name ),
  15009. isCustomProp = rcustomProp.test( name ),
  15010. style = elem.style;
  15011. // Make sure that we're working with the right name. We don't
  15012. // want to query the value if it is a CSS custom property
  15013. // since they are user-defined.
  15014. if ( !isCustomProp ) {
  15015. name = finalPropName( origName );
  15016. }
  15017. // Gets hook for the prefixed version, then unprefixed version
  15018. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  15019. // Check if we're setting a value
  15020. if ( value !== undefined ) {
  15021. type = typeof value;
  15022. // Convert "+=" or "-=" to relative numbers (#7345)
  15023. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  15024. value = adjustCSS( elem, name, ret );
  15025. // Fixes bug #9237
  15026. type = "number";
  15027. }
  15028. // Make sure that null and NaN values aren't set (#7116)
  15029. if ( value == null || value !== value ) {
  15030. return;
  15031. }
  15032. // If a number was passed in, add the unit (except for certain CSS properties)
  15033. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  15034. // "px" to a few hardcoded values.
  15035. if ( type === "number" && !isCustomProp ) {
  15036. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  15037. }
  15038. // background-* props affect original clone's values
  15039. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  15040. style[ name ] = "inherit";
  15041. }
  15042. // If a hook was provided, use that value, otherwise just set the specified value
  15043. if ( !hooks || !( "set" in hooks ) ||
  15044. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  15045. if ( isCustomProp ) {
  15046. style.setProperty( name, value );
  15047. } else {
  15048. style[ name ] = value;
  15049. }
  15050. }
  15051. } else {
  15052. // If a hook was provided get the non-computed value from there
  15053. if ( hooks && "get" in hooks &&
  15054. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  15055. return ret;
  15056. }
  15057. // Otherwise just get the value from the style object
  15058. return style[ name ];
  15059. }
  15060. },
  15061. css: function( elem, name, extra, styles ) {
  15062. var val, num, hooks,
  15063. origName = camelCase( name ),
  15064. isCustomProp = rcustomProp.test( name );
  15065. // Make sure that we're working with the right name. We don't
  15066. // want to modify the value if it is a CSS custom property
  15067. // since they are user-defined.
  15068. if ( !isCustomProp ) {
  15069. name = finalPropName( origName );
  15070. }
  15071. // Try prefixed name followed by the unprefixed name
  15072. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  15073. // If a hook was provided get the computed value from there
  15074. if ( hooks && "get" in hooks ) {
  15075. val = hooks.get( elem, true, extra );
  15076. }
  15077. // Otherwise, if a way to get the computed value exists, use that
  15078. if ( val === undefined ) {
  15079. val = curCSS( elem, name, styles );
  15080. }
  15081. // Convert "normal" to computed value
  15082. if ( val === "normal" && name in cssNormalTransform ) {
  15083. val = cssNormalTransform[ name ];
  15084. }
  15085. // Make numeric if forced or a qualifier was provided and val looks numeric
  15086. if ( extra === "" || extra ) {
  15087. num = parseFloat( val );
  15088. return extra === true || isFinite( num ) ? num || 0 : val;
  15089. }
  15090. return val;
  15091. }
  15092. } );
  15093. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  15094. jQuery.cssHooks[ dimension ] = {
  15095. get: function( elem, computed, extra ) {
  15096. if ( computed ) {
  15097. // Certain elements can have dimension info if we invisibly show them
  15098. // but it must have a current display style that would benefit
  15099. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  15100. // Support: Safari 8+
  15101. // Table columns in Safari have non-zero offsetWidth & zero
  15102. // getBoundingClientRect().width unless display is changed.
  15103. // Support: IE <=11 only
  15104. // Running getBoundingClientRect on a disconnected node
  15105. // in IE throws an error.
  15106. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  15107. swap( elem, cssShow, function() {
  15108. return getWidthOrHeight( elem, dimension, extra );
  15109. } ) :
  15110. getWidthOrHeight( elem, dimension, extra );
  15111. }
  15112. },
  15113. set: function( elem, value, extra ) {
  15114. var matches,
  15115. styles = getStyles( elem ),
  15116. // Only read styles.position if the test has a chance to fail
  15117. // to avoid forcing a reflow.
  15118. scrollboxSizeBuggy = !support.scrollboxSize() &&
  15119. styles.position === "absolute",
  15120. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  15121. boxSizingNeeded = scrollboxSizeBuggy || extra,
  15122. isBorderBox = boxSizingNeeded &&
  15123. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  15124. subtract = extra ?
  15125. boxModelAdjustment(
  15126. elem,
  15127. dimension,
  15128. extra,
  15129. isBorderBox,
  15130. styles
  15131. ) :
  15132. 0;
  15133. // Account for unreliable border-box dimensions by comparing offset* to computed and
  15134. // faking a content-box to get border and padding (gh-3699)
  15135. if ( isBorderBox && scrollboxSizeBuggy ) {
  15136. subtract -= Math.ceil(
  15137. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  15138. parseFloat( styles[ dimension ] ) -
  15139. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  15140. 0.5
  15141. );
  15142. }
  15143. // Convert to pixels if value adjustment is needed
  15144. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  15145. ( matches[ 3 ] || "px" ) !== "px" ) {
  15146. elem.style[ dimension ] = value;
  15147. value = jQuery.css( elem, dimension );
  15148. }
  15149. return setPositiveNumber( elem, value, subtract );
  15150. }
  15151. };
  15152. } );
  15153. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  15154. function( elem, computed ) {
  15155. if ( computed ) {
  15156. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  15157. elem.getBoundingClientRect().left -
  15158. swap( elem, { marginLeft: 0 }, function() {
  15159. return elem.getBoundingClientRect().left;
  15160. } )
  15161. ) + "px";
  15162. }
  15163. }
  15164. );
  15165. // These hooks are used by animate to expand properties
  15166. jQuery.each( {
  15167. margin: "",
  15168. padding: "",
  15169. border: "Width"
  15170. }, function( prefix, suffix ) {
  15171. jQuery.cssHooks[ prefix + suffix ] = {
  15172. expand: function( value ) {
  15173. var i = 0,
  15174. expanded = {},
  15175. // Assumes a single number if not a string
  15176. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  15177. for ( ; i < 4; i++ ) {
  15178. expanded[ prefix + cssExpand[ i ] + suffix ] =
  15179. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  15180. }
  15181. return expanded;
  15182. }
  15183. };
  15184. if ( prefix !== "margin" ) {
  15185. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  15186. }
  15187. } );
  15188. jQuery.fn.extend( {
  15189. css: function( name, value ) {
  15190. return access( this, function( elem, name, value ) {
  15191. var styles, len,
  15192. map = {},
  15193. i = 0;
  15194. if ( Array.isArray( name ) ) {
  15195. styles = getStyles( elem );
  15196. len = name.length;
  15197. for ( ; i < len; i++ ) {
  15198. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  15199. }
  15200. return map;
  15201. }
  15202. return value !== undefined ?
  15203. jQuery.style( elem, name, value ) :
  15204. jQuery.css( elem, name );
  15205. }, name, value, arguments.length > 1 );
  15206. }
  15207. } );
  15208. function Tween( elem, options, prop, end, easing ) {
  15209. return new Tween.prototype.init( elem, options, prop, end, easing );
  15210. }
  15211. jQuery.Tween = Tween;
  15212. Tween.prototype = {
  15213. constructor: Tween,
  15214. init: function( elem, options, prop, end, easing, unit ) {
  15215. this.elem = elem;
  15216. this.prop = prop;
  15217. this.easing = easing || jQuery.easing._default;
  15218. this.options = options;
  15219. this.start = this.now = this.cur();
  15220. this.end = end;
  15221. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  15222. },
  15223. cur: function() {
  15224. var hooks = Tween.propHooks[ this.prop ];
  15225. return hooks && hooks.get ?
  15226. hooks.get( this ) :
  15227. Tween.propHooks._default.get( this );
  15228. },
  15229. run: function( percent ) {
  15230. var eased,
  15231. hooks = Tween.propHooks[ this.prop ];
  15232. if ( this.options.duration ) {
  15233. this.pos = eased = jQuery.easing[ this.easing ](
  15234. percent, this.options.duration * percent, 0, 1, this.options.duration
  15235. );
  15236. } else {
  15237. this.pos = eased = percent;
  15238. }
  15239. this.now = ( this.end - this.start ) * eased + this.start;
  15240. if ( this.options.step ) {
  15241. this.options.step.call( this.elem, this.now, this );
  15242. }
  15243. if ( hooks && hooks.set ) {
  15244. hooks.set( this );
  15245. } else {
  15246. Tween.propHooks._default.set( this );
  15247. }
  15248. return this;
  15249. }
  15250. };
  15251. Tween.prototype.init.prototype = Tween.prototype;
  15252. Tween.propHooks = {
  15253. _default: {
  15254. get: function( tween ) {
  15255. var result;
  15256. // Use a property on the element directly when it is not a DOM element,
  15257. // or when there is no matching style property that exists.
  15258. if ( tween.elem.nodeType !== 1 ||
  15259. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  15260. return tween.elem[ tween.prop ];
  15261. }
  15262. // Passing an empty string as a 3rd parameter to .css will automatically
  15263. // attempt a parseFloat and fallback to a string if the parse fails.
  15264. // Simple values such as "10px" are parsed to Float;
  15265. // complex values such as "rotate(1rad)" are returned as-is.
  15266. result = jQuery.css( tween.elem, tween.prop, "" );
  15267. // Empty strings, null, undefined and "auto" are converted to 0.
  15268. return !result || result === "auto" ? 0 : result;
  15269. },
  15270. set: function( tween ) {
  15271. // Use step hook for back compat.
  15272. // Use cssHook if its there.
  15273. // Use .style if available and use plain properties where available.
  15274. if ( jQuery.fx.step[ tween.prop ] ) {
  15275. jQuery.fx.step[ tween.prop ]( tween );
  15276. } else if ( tween.elem.nodeType === 1 && (
  15277. jQuery.cssHooks[ tween.prop ] ||
  15278. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  15279. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  15280. } else {
  15281. tween.elem[ tween.prop ] = tween.now;
  15282. }
  15283. }
  15284. }
  15285. };
  15286. // Support: IE <=9 only
  15287. // Panic based approach to setting things on disconnected nodes
  15288. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  15289. set: function( tween ) {
  15290. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  15291. tween.elem[ tween.prop ] = tween.now;
  15292. }
  15293. }
  15294. };
  15295. jQuery.easing = {
  15296. linear: function( p ) {
  15297. return p;
  15298. },
  15299. swing: function( p ) {
  15300. return 0.5 - Math.cos( p * Math.PI ) / 2;
  15301. },
  15302. _default: "swing"
  15303. };
  15304. jQuery.fx = Tween.prototype.init;
  15305. // Back compat <1.8 extension point
  15306. jQuery.fx.step = {};
  15307. var
  15308. fxNow, inProgress,
  15309. rfxtypes = /^(?:toggle|show|hide)$/,
  15310. rrun = /queueHooks$/;
  15311. function schedule() {
  15312. if ( inProgress ) {
  15313. if ( document.hidden === false && window.requestAnimationFrame ) {
  15314. window.requestAnimationFrame( schedule );
  15315. } else {
  15316. window.setTimeout( schedule, jQuery.fx.interval );
  15317. }
  15318. jQuery.fx.tick();
  15319. }
  15320. }
  15321. // Animations created synchronously will run synchronously
  15322. function createFxNow() {
  15323. window.setTimeout( function() {
  15324. fxNow = undefined;
  15325. } );
  15326. return ( fxNow = Date.now() );
  15327. }
  15328. // Generate parameters to create a standard animation
  15329. function genFx( type, includeWidth ) {
  15330. var which,
  15331. i = 0,
  15332. attrs = { height: type };
  15333. // If we include width, step value is 1 to do all cssExpand values,
  15334. // otherwise step value is 2 to skip over Left and Right
  15335. includeWidth = includeWidth ? 1 : 0;
  15336. for ( ; i < 4; i += 2 - includeWidth ) {
  15337. which = cssExpand[ i ];
  15338. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  15339. }
  15340. if ( includeWidth ) {
  15341. attrs.opacity = attrs.width = type;
  15342. }
  15343. return attrs;
  15344. }
  15345. function createTween( value, prop, animation ) {
  15346. var tween,
  15347. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  15348. index = 0,
  15349. length = collection.length;
  15350. for ( ; index < length; index++ ) {
  15351. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  15352. // We're done with this property
  15353. return tween;
  15354. }
  15355. }
  15356. }
  15357. function defaultPrefilter( elem, props, opts ) {
  15358. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  15359. isBox = "width" in props || "height" in props,
  15360. anim = this,
  15361. orig = {},
  15362. style = elem.style,
  15363. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  15364. dataShow = dataPriv.get( elem, "fxshow" );
  15365. // Queue-skipping animations hijack the fx hooks
  15366. if ( !opts.queue ) {
  15367. hooks = jQuery._queueHooks( elem, "fx" );
  15368. if ( hooks.unqueued == null ) {
  15369. hooks.unqueued = 0;
  15370. oldfire = hooks.empty.fire;
  15371. hooks.empty.fire = function() {
  15372. if ( !hooks.unqueued ) {
  15373. oldfire();
  15374. }
  15375. };
  15376. }
  15377. hooks.unqueued++;
  15378. anim.always( function() {
  15379. // Ensure the complete handler is called before this completes
  15380. anim.always( function() {
  15381. hooks.unqueued--;
  15382. if ( !jQuery.queue( elem, "fx" ).length ) {
  15383. hooks.empty.fire();
  15384. }
  15385. } );
  15386. } );
  15387. }
  15388. // Detect show/hide animations
  15389. for ( prop in props ) {
  15390. value = props[ prop ];
  15391. if ( rfxtypes.test( value ) ) {
  15392. delete props[ prop ];
  15393. toggle = toggle || value === "toggle";
  15394. if ( value === ( hidden ? "hide" : "show" ) ) {
  15395. // Pretend to be hidden if this is a "show" and
  15396. // there is still data from a stopped show/hide
  15397. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  15398. hidden = true;
  15399. // Ignore all other no-op show/hide data
  15400. } else {
  15401. continue;
  15402. }
  15403. }
  15404. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  15405. }
  15406. }
  15407. // Bail out if this is a no-op like .hide().hide()
  15408. propTween = !jQuery.isEmptyObject( props );
  15409. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  15410. return;
  15411. }
  15412. // Restrict "overflow" and "display" styles during box animations
  15413. if ( isBox && elem.nodeType === 1 ) {
  15414. // Support: IE <=9 - 11, Edge 12 - 15
  15415. // Record all 3 overflow attributes because IE does not infer the shorthand
  15416. // from identically-valued overflowX and overflowY and Edge just mirrors
  15417. // the overflowX value there.
  15418. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  15419. // Identify a display type, preferring old show/hide data over the CSS cascade
  15420. restoreDisplay = dataShow && dataShow.display;
  15421. if ( restoreDisplay == null ) {
  15422. restoreDisplay = dataPriv.get( elem, "display" );
  15423. }
  15424. display = jQuery.css( elem, "display" );
  15425. if ( display === "none" ) {
  15426. if ( restoreDisplay ) {
  15427. display = restoreDisplay;
  15428. } else {
  15429. // Get nonempty value(s) by temporarily forcing visibility
  15430. showHide( [ elem ], true );
  15431. restoreDisplay = elem.style.display || restoreDisplay;
  15432. display = jQuery.css( elem, "display" );
  15433. showHide( [ elem ] );
  15434. }
  15435. }
  15436. // Animate inline elements as inline-block
  15437. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  15438. if ( jQuery.css( elem, "float" ) === "none" ) {
  15439. // Restore the original display value at the end of pure show/hide animations
  15440. if ( !propTween ) {
  15441. anim.done( function() {
  15442. style.display = restoreDisplay;
  15443. } );
  15444. if ( restoreDisplay == null ) {
  15445. display = style.display;
  15446. restoreDisplay = display === "none" ? "" : display;
  15447. }
  15448. }
  15449. style.display = "inline-block";
  15450. }
  15451. }
  15452. }
  15453. if ( opts.overflow ) {
  15454. style.overflow = "hidden";
  15455. anim.always( function() {
  15456. style.overflow = opts.overflow[ 0 ];
  15457. style.overflowX = opts.overflow[ 1 ];
  15458. style.overflowY = opts.overflow[ 2 ];
  15459. } );
  15460. }
  15461. // Implement show/hide animations
  15462. propTween = false;
  15463. for ( prop in orig ) {
  15464. // General show/hide setup for this element animation
  15465. if ( !propTween ) {
  15466. if ( dataShow ) {
  15467. if ( "hidden" in dataShow ) {
  15468. hidden = dataShow.hidden;
  15469. }
  15470. } else {
  15471. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  15472. }
  15473. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  15474. if ( toggle ) {
  15475. dataShow.hidden = !hidden;
  15476. }
  15477. // Show elements before animating them
  15478. if ( hidden ) {
  15479. showHide( [ elem ], true );
  15480. }
  15481. /* eslint-disable no-loop-func */
  15482. anim.done( function() {
  15483. /* eslint-enable no-loop-func */
  15484. // The final step of a "hide" animation is actually hiding the element
  15485. if ( !hidden ) {
  15486. showHide( [ elem ] );
  15487. }
  15488. dataPriv.remove( elem, "fxshow" );
  15489. for ( prop in orig ) {
  15490. jQuery.style( elem, prop, orig[ prop ] );
  15491. }
  15492. } );
  15493. }
  15494. // Per-property setup
  15495. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  15496. if ( !( prop in dataShow ) ) {
  15497. dataShow[ prop ] = propTween.start;
  15498. if ( hidden ) {
  15499. propTween.end = propTween.start;
  15500. propTween.start = 0;
  15501. }
  15502. }
  15503. }
  15504. }
  15505. function propFilter( props, specialEasing ) {
  15506. var index, name, easing, value, hooks;
  15507. // camelCase, specialEasing and expand cssHook pass
  15508. for ( index in props ) {
  15509. name = camelCase( index );
  15510. easing = specialEasing[ name ];
  15511. value = props[ index ];
  15512. if ( Array.isArray( value ) ) {
  15513. easing = value[ 1 ];
  15514. value = props[ index ] = value[ 0 ];
  15515. }
  15516. if ( index !== name ) {
  15517. props[ name ] = value;
  15518. delete props[ index ];
  15519. }
  15520. hooks = jQuery.cssHooks[ name ];
  15521. if ( hooks && "expand" in hooks ) {
  15522. value = hooks.expand( value );
  15523. delete props[ name ];
  15524. // Not quite $.extend, this won't overwrite existing keys.
  15525. // Reusing 'index' because we have the correct "name"
  15526. for ( index in value ) {
  15527. if ( !( index in props ) ) {
  15528. props[ index ] = value[ index ];
  15529. specialEasing[ index ] = easing;
  15530. }
  15531. }
  15532. } else {
  15533. specialEasing[ name ] = easing;
  15534. }
  15535. }
  15536. }
  15537. function Animation( elem, properties, options ) {
  15538. var result,
  15539. stopped,
  15540. index = 0,
  15541. length = Animation.prefilters.length,
  15542. deferred = jQuery.Deferred().always( function() {
  15543. // Don't match elem in the :animated selector
  15544. delete tick.elem;
  15545. } ),
  15546. tick = function() {
  15547. if ( stopped ) {
  15548. return false;
  15549. }
  15550. var currentTime = fxNow || createFxNow(),
  15551. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  15552. // Support: Android 2.3 only
  15553. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  15554. temp = remaining / animation.duration || 0,
  15555. percent = 1 - temp,
  15556. index = 0,
  15557. length = animation.tweens.length;
  15558. for ( ; index < length; index++ ) {
  15559. animation.tweens[ index ].run( percent );
  15560. }
  15561. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  15562. // If there's more to do, yield
  15563. if ( percent < 1 && length ) {
  15564. return remaining;
  15565. }
  15566. // If this was an empty animation, synthesize a final progress notification
  15567. if ( !length ) {
  15568. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15569. }
  15570. // Resolve the animation and report its conclusion
  15571. deferred.resolveWith( elem, [ animation ] );
  15572. return false;
  15573. },
  15574. animation = deferred.promise( {
  15575. elem: elem,
  15576. props: jQuery.extend( {}, properties ),
  15577. opts: jQuery.extend( true, {
  15578. specialEasing: {},
  15579. easing: jQuery.easing._default
  15580. }, options ),
  15581. originalProperties: properties,
  15582. originalOptions: options,
  15583. startTime: fxNow || createFxNow(),
  15584. duration: options.duration,
  15585. tweens: [],
  15586. createTween: function( prop, end ) {
  15587. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  15588. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  15589. animation.tweens.push( tween );
  15590. return tween;
  15591. },
  15592. stop: function( gotoEnd ) {
  15593. var index = 0,
  15594. // If we are going to the end, we want to run all the tweens
  15595. // otherwise we skip this part
  15596. length = gotoEnd ? animation.tweens.length : 0;
  15597. if ( stopped ) {
  15598. return this;
  15599. }
  15600. stopped = true;
  15601. for ( ; index < length; index++ ) {
  15602. animation.tweens[ index ].run( 1 );
  15603. }
  15604. // Resolve when we played the last frame; otherwise, reject
  15605. if ( gotoEnd ) {
  15606. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15607. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  15608. } else {
  15609. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  15610. }
  15611. return this;
  15612. }
  15613. } ),
  15614. props = animation.props;
  15615. propFilter( props, animation.opts.specialEasing );
  15616. for ( ; index < length; index++ ) {
  15617. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  15618. if ( result ) {
  15619. if ( isFunction( result.stop ) ) {
  15620. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  15621. result.stop.bind( result );
  15622. }
  15623. return result;
  15624. }
  15625. }
  15626. jQuery.map( props, createTween, animation );
  15627. if ( isFunction( animation.opts.start ) ) {
  15628. animation.opts.start.call( elem, animation );
  15629. }
  15630. // Attach callbacks from options
  15631. animation
  15632. .progress( animation.opts.progress )
  15633. .done( animation.opts.done, animation.opts.complete )
  15634. .fail( animation.opts.fail )
  15635. .always( animation.opts.always );
  15636. jQuery.fx.timer(
  15637. jQuery.extend( tick, {
  15638. elem: elem,
  15639. anim: animation,
  15640. queue: animation.opts.queue
  15641. } )
  15642. );
  15643. return animation;
  15644. }
  15645. jQuery.Animation = jQuery.extend( Animation, {
  15646. tweeners: {
  15647. "*": [ function( prop, value ) {
  15648. var tween = this.createTween( prop, value );
  15649. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  15650. return tween;
  15651. } ]
  15652. },
  15653. tweener: function( props, callback ) {
  15654. if ( isFunction( props ) ) {
  15655. callback = props;
  15656. props = [ "*" ];
  15657. } else {
  15658. props = props.match( rnothtmlwhite );
  15659. }
  15660. var prop,
  15661. index = 0,
  15662. length = props.length;
  15663. for ( ; index < length; index++ ) {
  15664. prop = props[ index ];
  15665. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  15666. Animation.tweeners[ prop ].unshift( callback );
  15667. }
  15668. },
  15669. prefilters: [ defaultPrefilter ],
  15670. prefilter: function( callback, prepend ) {
  15671. if ( prepend ) {
  15672. Animation.prefilters.unshift( callback );
  15673. } else {
  15674. Animation.prefilters.push( callback );
  15675. }
  15676. }
  15677. } );
  15678. jQuery.speed = function( speed, easing, fn ) {
  15679. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  15680. complete: fn || !fn && easing ||
  15681. isFunction( speed ) && speed,
  15682. duration: speed,
  15683. easing: fn && easing || easing && !isFunction( easing ) && easing
  15684. };
  15685. // Go to the end state if fx are off
  15686. if ( jQuery.fx.off ) {
  15687. opt.duration = 0;
  15688. } else {
  15689. if ( typeof opt.duration !== "number" ) {
  15690. if ( opt.duration in jQuery.fx.speeds ) {
  15691. opt.duration = jQuery.fx.speeds[ opt.duration ];
  15692. } else {
  15693. opt.duration = jQuery.fx.speeds._default;
  15694. }
  15695. }
  15696. }
  15697. // Normalize opt.queue - true/undefined/null -> "fx"
  15698. if ( opt.queue == null || opt.queue === true ) {
  15699. opt.queue = "fx";
  15700. }
  15701. // Queueing
  15702. opt.old = opt.complete;
  15703. opt.complete = function() {
  15704. if ( isFunction( opt.old ) ) {
  15705. opt.old.call( this );
  15706. }
  15707. if ( opt.queue ) {
  15708. jQuery.dequeue( this, opt.queue );
  15709. }
  15710. };
  15711. return opt;
  15712. };
  15713. jQuery.fn.extend( {
  15714. fadeTo: function( speed, to, easing, callback ) {
  15715. // Show any hidden elements after setting opacity to 0
  15716. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  15717. // Animate to the value specified
  15718. .end().animate( { opacity: to }, speed, easing, callback );
  15719. },
  15720. animate: function( prop, speed, easing, callback ) {
  15721. var empty = jQuery.isEmptyObject( prop ),
  15722. optall = jQuery.speed( speed, easing, callback ),
  15723. doAnimation = function() {
  15724. // Operate on a copy of prop so per-property easing won't be lost
  15725. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  15726. // Empty animations, or finishing resolves immediately
  15727. if ( empty || dataPriv.get( this, "finish" ) ) {
  15728. anim.stop( true );
  15729. }
  15730. };
  15731. doAnimation.finish = doAnimation;
  15732. return empty || optall.queue === false ?
  15733. this.each( doAnimation ) :
  15734. this.queue( optall.queue, doAnimation );
  15735. },
  15736. stop: function( type, clearQueue, gotoEnd ) {
  15737. var stopQueue = function( hooks ) {
  15738. var stop = hooks.stop;
  15739. delete hooks.stop;
  15740. stop( gotoEnd );
  15741. };
  15742. if ( typeof type !== "string" ) {
  15743. gotoEnd = clearQueue;
  15744. clearQueue = type;
  15745. type = undefined;
  15746. }
  15747. if ( clearQueue && type !== false ) {
  15748. this.queue( type || "fx", [] );
  15749. }
  15750. return this.each( function() {
  15751. var dequeue = true,
  15752. index = type != null && type + "queueHooks",
  15753. timers = jQuery.timers,
  15754. data = dataPriv.get( this );
  15755. if ( index ) {
  15756. if ( data[ index ] && data[ index ].stop ) {
  15757. stopQueue( data[ index ] );
  15758. }
  15759. } else {
  15760. for ( index in data ) {
  15761. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  15762. stopQueue( data[ index ] );
  15763. }
  15764. }
  15765. }
  15766. for ( index = timers.length; index--; ) {
  15767. if ( timers[ index ].elem === this &&
  15768. ( type == null || timers[ index ].queue === type ) ) {
  15769. timers[ index ].anim.stop( gotoEnd );
  15770. dequeue = false;
  15771. timers.splice( index, 1 );
  15772. }
  15773. }
  15774. // Start the next in the queue if the last step wasn't forced.
  15775. // Timers currently will call their complete callbacks, which
  15776. // will dequeue but only if they were gotoEnd.
  15777. if ( dequeue || !gotoEnd ) {
  15778. jQuery.dequeue( this, type );
  15779. }
  15780. } );
  15781. },
  15782. finish: function( type ) {
  15783. if ( type !== false ) {
  15784. type = type || "fx";
  15785. }
  15786. return this.each( function() {
  15787. var index,
  15788. data = dataPriv.get( this ),
  15789. queue = data[ type + "queue" ],
  15790. hooks = data[ type + "queueHooks" ],
  15791. timers = jQuery.timers,
  15792. length = queue ? queue.length : 0;
  15793. // Enable finishing flag on private data
  15794. data.finish = true;
  15795. // Empty the queue first
  15796. jQuery.queue( this, type, [] );
  15797. if ( hooks && hooks.stop ) {
  15798. hooks.stop.call( this, true );
  15799. }
  15800. // Look for any active animations, and finish them
  15801. for ( index = timers.length; index--; ) {
  15802. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  15803. timers[ index ].anim.stop( true );
  15804. timers.splice( index, 1 );
  15805. }
  15806. }
  15807. // Look for any animations in the old queue and finish them
  15808. for ( index = 0; index < length; index++ ) {
  15809. if ( queue[ index ] && queue[ index ].finish ) {
  15810. queue[ index ].finish.call( this );
  15811. }
  15812. }
  15813. // Turn off finishing flag
  15814. delete data.finish;
  15815. } );
  15816. }
  15817. } );
  15818. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  15819. var cssFn = jQuery.fn[ name ];
  15820. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15821. return speed == null || typeof speed === "boolean" ?
  15822. cssFn.apply( this, arguments ) :
  15823. this.animate( genFx( name, true ), speed, easing, callback );
  15824. };
  15825. } );
  15826. // Generate shortcuts for custom animations
  15827. jQuery.each( {
  15828. slideDown: genFx( "show" ),
  15829. slideUp: genFx( "hide" ),
  15830. slideToggle: genFx( "toggle" ),
  15831. fadeIn: { opacity: "show" },
  15832. fadeOut: { opacity: "hide" },
  15833. fadeToggle: { opacity: "toggle" }
  15834. }, function( name, props ) {
  15835. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15836. return this.animate( props, speed, easing, callback );
  15837. };
  15838. } );
  15839. jQuery.timers = [];
  15840. jQuery.fx.tick = function() {
  15841. var timer,
  15842. i = 0,
  15843. timers = jQuery.timers;
  15844. fxNow = Date.now();
  15845. for ( ; i < timers.length; i++ ) {
  15846. timer = timers[ i ];
  15847. // Run the timer and safely remove it when done (allowing for external removal)
  15848. if ( !timer() && timers[ i ] === timer ) {
  15849. timers.splice( i--, 1 );
  15850. }
  15851. }
  15852. if ( !timers.length ) {
  15853. jQuery.fx.stop();
  15854. }
  15855. fxNow = undefined;
  15856. };
  15857. jQuery.fx.timer = function( timer ) {
  15858. jQuery.timers.push( timer );
  15859. jQuery.fx.start();
  15860. };
  15861. jQuery.fx.interval = 13;
  15862. jQuery.fx.start = function() {
  15863. if ( inProgress ) {
  15864. return;
  15865. }
  15866. inProgress = true;
  15867. schedule();
  15868. };
  15869. jQuery.fx.stop = function() {
  15870. inProgress = null;
  15871. };
  15872. jQuery.fx.speeds = {
  15873. slow: 600,
  15874. fast: 200,
  15875. // Default speed
  15876. _default: 400
  15877. };
  15878. // Based off of the plugin by Clint Helfers, with permission.
  15879. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  15880. jQuery.fn.delay = function( time, type ) {
  15881. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  15882. type = type || "fx";
  15883. return this.queue( type, function( next, hooks ) {
  15884. var timeout = window.setTimeout( next, time );
  15885. hooks.stop = function() {
  15886. window.clearTimeout( timeout );
  15887. };
  15888. } );
  15889. };
  15890. ( function() {
  15891. var input = document.createElement( "input" ),
  15892. select = document.createElement( "select" ),
  15893. opt = select.appendChild( document.createElement( "option" ) );
  15894. input.type = "checkbox";
  15895. // Support: Android <=4.3 only
  15896. // Default value for a checkbox should be "on"
  15897. support.checkOn = input.value !== "";
  15898. // Support: IE <=11 only
  15899. // Must access selectedIndex to make default options select
  15900. support.optSelected = opt.selected;
  15901. // Support: IE <=11 only
  15902. // An input loses its value after becoming a radio
  15903. input = document.createElement( "input" );
  15904. input.value = "t";
  15905. input.type = "radio";
  15906. support.radioValue = input.value === "t";
  15907. } )();
  15908. var boolHook,
  15909. attrHandle = jQuery.expr.attrHandle;
  15910. jQuery.fn.extend( {
  15911. attr: function( name, value ) {
  15912. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  15913. },
  15914. removeAttr: function( name ) {
  15915. return this.each( function() {
  15916. jQuery.removeAttr( this, name );
  15917. } );
  15918. }
  15919. } );
  15920. jQuery.extend( {
  15921. attr: function( elem, name, value ) {
  15922. var ret, hooks,
  15923. nType = elem.nodeType;
  15924. // Don't get/set attributes on text, comment and attribute nodes
  15925. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15926. return;
  15927. }
  15928. // Fallback to prop when attributes are not supported
  15929. if ( typeof elem.getAttribute === "undefined" ) {
  15930. return jQuery.prop( elem, name, value );
  15931. }
  15932. // Attribute hooks are determined by the lowercase version
  15933. // Grab necessary hook if one is defined
  15934. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15935. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15936. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15937. }
  15938. if ( value !== undefined ) {
  15939. if ( value === null ) {
  15940. jQuery.removeAttr( elem, name );
  15941. return;
  15942. }
  15943. if ( hooks && "set" in hooks &&
  15944. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15945. return ret;
  15946. }
  15947. elem.setAttribute( name, value + "" );
  15948. return value;
  15949. }
  15950. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15951. return ret;
  15952. }
  15953. ret = jQuery.find.attr( elem, name );
  15954. // Non-existent attributes return null, we normalize to undefined
  15955. return ret == null ? undefined : ret;
  15956. },
  15957. attrHooks: {
  15958. type: {
  15959. set: function( elem, value ) {
  15960. if ( !support.radioValue && value === "radio" &&
  15961. nodeName( elem, "input" ) ) {
  15962. var val = elem.value;
  15963. elem.setAttribute( "type", value );
  15964. if ( val ) {
  15965. elem.value = val;
  15966. }
  15967. return value;
  15968. }
  15969. }
  15970. }
  15971. },
  15972. removeAttr: function( elem, value ) {
  15973. var name,
  15974. i = 0,
  15975. // Attribute names can contain non-HTML whitespace characters
  15976. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15977. attrNames = value && value.match( rnothtmlwhite );
  15978. if ( attrNames && elem.nodeType === 1 ) {
  15979. while ( ( name = attrNames[ i++ ] ) ) {
  15980. elem.removeAttribute( name );
  15981. }
  15982. }
  15983. }
  15984. } );
  15985. // Hooks for boolean attributes
  15986. boolHook = {
  15987. set: function( elem, value, name ) {
  15988. if ( value === false ) {
  15989. // Remove boolean attributes when set to false
  15990. jQuery.removeAttr( elem, name );
  15991. } else {
  15992. elem.setAttribute( name, name );
  15993. }
  15994. return name;
  15995. }
  15996. };
  15997. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15998. var getter = attrHandle[ name ] || jQuery.find.attr;
  15999. attrHandle[ name ] = function( elem, name, isXML ) {
  16000. var ret, handle,
  16001. lowercaseName = name.toLowerCase();
  16002. if ( !isXML ) {
  16003. // Avoid an infinite loop by temporarily removing this function from the getter
  16004. handle = attrHandle[ lowercaseName ];
  16005. attrHandle[ lowercaseName ] = ret;
  16006. ret = getter( elem, name, isXML ) != null ?
  16007. lowercaseName :
  16008. null;
  16009. attrHandle[ lowercaseName ] = handle;
  16010. }
  16011. return ret;
  16012. };
  16013. } );
  16014. var rfocusable = /^(?:input|select|textarea|button)$/i,
  16015. rclickable = /^(?:a|area)$/i;
  16016. jQuery.fn.extend( {
  16017. prop: function( name, value ) {
  16018. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  16019. },
  16020. removeProp: function( name ) {
  16021. return this.each( function() {
  16022. delete this[ jQuery.propFix[ name ] || name ];
  16023. } );
  16024. }
  16025. } );
  16026. jQuery.extend( {
  16027. prop: function( elem, name, value ) {
  16028. var ret, hooks,
  16029. nType = elem.nodeType;
  16030. // Don't get/set properties on text, comment and attribute nodes
  16031. if ( nType === 3 || nType === 8 || nType === 2 ) {
  16032. return;
  16033. }
  16034. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  16035. // Fix name and attach hooks
  16036. name = jQuery.propFix[ name ] || name;
  16037. hooks = jQuery.propHooks[ name ];
  16038. }
  16039. if ( value !== undefined ) {
  16040. if ( hooks && "set" in hooks &&
  16041. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  16042. return ret;
  16043. }
  16044. return ( elem[ name ] = value );
  16045. }
  16046. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  16047. return ret;
  16048. }
  16049. return elem[ name ];
  16050. },
  16051. propHooks: {
  16052. tabIndex: {
  16053. get: function( elem ) {
  16054. // Support: IE <=9 - 11 only
  16055. // elem.tabIndex doesn't always return the
  16056. // correct value when it hasn't been explicitly set
  16057. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  16058. // Use proper attribute retrieval(#12072)
  16059. var tabindex = jQuery.find.attr( elem, "tabindex" );
  16060. if ( tabindex ) {
  16061. return parseInt( tabindex, 10 );
  16062. }
  16063. if (
  16064. rfocusable.test( elem.nodeName ) ||
  16065. rclickable.test( elem.nodeName ) &&
  16066. elem.href
  16067. ) {
  16068. return 0;
  16069. }
  16070. return -1;
  16071. }
  16072. }
  16073. },
  16074. propFix: {
  16075. "for": "htmlFor",
  16076. "class": "className"
  16077. }
  16078. } );
  16079. // Support: IE <=11 only
  16080. // Accessing the selectedIndex property
  16081. // forces the browser to respect setting selected
  16082. // on the option
  16083. // The getter ensures a default option is selected
  16084. // when in an optgroup
  16085. // eslint rule "no-unused-expressions" is disabled for this code
  16086. // since it considers such accessions noop
  16087. if ( !support.optSelected ) {
  16088. jQuery.propHooks.selected = {
  16089. get: function( elem ) {
  16090. /* eslint no-unused-expressions: "off" */
  16091. var parent = elem.parentNode;
  16092. if ( parent && parent.parentNode ) {
  16093. parent.parentNode.selectedIndex;
  16094. }
  16095. return null;
  16096. },
  16097. set: function( elem ) {
  16098. /* eslint no-unused-expressions: "off" */
  16099. var parent = elem.parentNode;
  16100. if ( parent ) {
  16101. parent.selectedIndex;
  16102. if ( parent.parentNode ) {
  16103. parent.parentNode.selectedIndex;
  16104. }
  16105. }
  16106. }
  16107. };
  16108. }
  16109. jQuery.each( [
  16110. "tabIndex",
  16111. "readOnly",
  16112. "maxLength",
  16113. "cellSpacing",
  16114. "cellPadding",
  16115. "rowSpan",
  16116. "colSpan",
  16117. "useMap",
  16118. "frameBorder",
  16119. "contentEditable"
  16120. ], function() {
  16121. jQuery.propFix[ this.toLowerCase() ] = this;
  16122. } );
  16123. // Strip and collapse whitespace according to HTML spec
  16124. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  16125. function stripAndCollapse( value ) {
  16126. var tokens = value.match( rnothtmlwhite ) || [];
  16127. return tokens.join( " " );
  16128. }
  16129. function getClass( elem ) {
  16130. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  16131. }
  16132. function classesToArray( value ) {
  16133. if ( Array.isArray( value ) ) {
  16134. return value;
  16135. }
  16136. if ( typeof value === "string" ) {
  16137. return value.match( rnothtmlwhite ) || [];
  16138. }
  16139. return [];
  16140. }
  16141. jQuery.fn.extend( {
  16142. addClass: function( value ) {
  16143. var classes, elem, cur, curValue, clazz, j, finalValue,
  16144. i = 0;
  16145. if ( isFunction( value ) ) {
  16146. return this.each( function( j ) {
  16147. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  16148. } );
  16149. }
  16150. classes = classesToArray( value );
  16151. if ( classes.length ) {
  16152. while ( ( elem = this[ i++ ] ) ) {
  16153. curValue = getClass( elem );
  16154. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  16155. if ( cur ) {
  16156. j = 0;
  16157. while ( ( clazz = classes[ j++ ] ) ) {
  16158. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  16159. cur += clazz + " ";
  16160. }
  16161. }
  16162. // Only assign if different to avoid unneeded rendering.
  16163. finalValue = stripAndCollapse( cur );
  16164. if ( curValue !== finalValue ) {
  16165. elem.setAttribute( "class", finalValue );
  16166. }
  16167. }
  16168. }
  16169. }
  16170. return this;
  16171. },
  16172. removeClass: function( value ) {
  16173. var classes, elem, cur, curValue, clazz, j, finalValue,
  16174. i = 0;
  16175. if ( isFunction( value ) ) {
  16176. return this.each( function( j ) {
  16177. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  16178. } );
  16179. }
  16180. if ( !arguments.length ) {
  16181. return this.attr( "class", "" );
  16182. }
  16183. classes = classesToArray( value );
  16184. if ( classes.length ) {
  16185. while ( ( elem = this[ i++ ] ) ) {
  16186. curValue = getClass( elem );
  16187. // This expression is here for better compressibility (see addClass)
  16188. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  16189. if ( cur ) {
  16190. j = 0;
  16191. while ( ( clazz = classes[ j++ ] ) ) {
  16192. // Remove *all* instances
  16193. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  16194. cur = cur.replace( " " + clazz + " ", " " );
  16195. }
  16196. }
  16197. // Only assign if different to avoid unneeded rendering.
  16198. finalValue = stripAndCollapse( cur );
  16199. if ( curValue !== finalValue ) {
  16200. elem.setAttribute( "class", finalValue );
  16201. }
  16202. }
  16203. }
  16204. }
  16205. return this;
  16206. },
  16207. toggleClass: function( value, stateVal ) {
  16208. var type = typeof value,
  16209. isValidValue = type === "string" || Array.isArray( value );
  16210. if ( typeof stateVal === "boolean" && isValidValue ) {
  16211. return stateVal ? this.addClass( value ) : this.removeClass( value );
  16212. }
  16213. if ( isFunction( value ) ) {
  16214. return this.each( function( i ) {
  16215. jQuery( this ).toggleClass(
  16216. value.call( this, i, getClass( this ), stateVal ),
  16217. stateVal
  16218. );
  16219. } );
  16220. }
  16221. return this.each( function() {
  16222. var className, i, self, classNames;
  16223. if ( isValidValue ) {
  16224. // Toggle individual class names
  16225. i = 0;
  16226. self = jQuery( this );
  16227. classNames = classesToArray( value );
  16228. while ( ( className = classNames[ i++ ] ) ) {
  16229. // Check each className given, space separated list
  16230. if ( self.hasClass( className ) ) {
  16231. self.removeClass( className );
  16232. } else {
  16233. self.addClass( className );
  16234. }
  16235. }
  16236. // Toggle whole class name
  16237. } else if ( value === undefined || type === "boolean" ) {
  16238. className = getClass( this );
  16239. if ( className ) {
  16240. // Store className if set
  16241. dataPriv.set( this, "__className__", className );
  16242. }
  16243. // If the element has a class name or if we're passed `false`,
  16244. // then remove the whole classname (if there was one, the above saved it).
  16245. // Otherwise bring back whatever was previously saved (if anything),
  16246. // falling back to the empty string if nothing was stored.
  16247. if ( this.setAttribute ) {
  16248. this.setAttribute( "class",
  16249. className || value === false ?
  16250. "" :
  16251. dataPriv.get( this, "__className__" ) || ""
  16252. );
  16253. }
  16254. }
  16255. } );
  16256. },
  16257. hasClass: function( selector ) {
  16258. var className, elem,
  16259. i = 0;
  16260. className = " " + selector + " ";
  16261. while ( ( elem = this[ i++ ] ) ) {
  16262. if ( elem.nodeType === 1 &&
  16263. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  16264. return true;
  16265. }
  16266. }
  16267. return false;
  16268. }
  16269. } );
  16270. var rreturn = /\r/g;
  16271. jQuery.fn.extend( {
  16272. val: function( value ) {
  16273. var hooks, ret, valueIsFunction,
  16274. elem = this[ 0 ];
  16275. if ( !arguments.length ) {
  16276. if ( elem ) {
  16277. hooks = jQuery.valHooks[ elem.type ] ||
  16278. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  16279. if ( hooks &&
  16280. "get" in hooks &&
  16281. ( ret = hooks.get( elem, "value" ) ) !== undefined
  16282. ) {
  16283. return ret;
  16284. }
  16285. ret = elem.value;
  16286. // Handle most common string cases
  16287. if ( typeof ret === "string" ) {
  16288. return ret.replace( rreturn, "" );
  16289. }
  16290. // Handle cases where value is null/undef or number
  16291. return ret == null ? "" : ret;
  16292. }
  16293. return;
  16294. }
  16295. valueIsFunction = isFunction( value );
  16296. return this.each( function( i ) {
  16297. var val;
  16298. if ( this.nodeType !== 1 ) {
  16299. return;
  16300. }
  16301. if ( valueIsFunction ) {
  16302. val = value.call( this, i, jQuery( this ).val() );
  16303. } else {
  16304. val = value;
  16305. }
  16306. // Treat null/undefined as ""; convert numbers to string
  16307. if ( val == null ) {
  16308. val = "";
  16309. } else if ( typeof val === "number" ) {
  16310. val += "";
  16311. } else if ( Array.isArray( val ) ) {
  16312. val = jQuery.map( val, function( value ) {
  16313. return value == null ? "" : value + "";
  16314. } );
  16315. }
  16316. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  16317. // If set returns undefined, fall back to normal setting
  16318. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  16319. this.value = val;
  16320. }
  16321. } );
  16322. }
  16323. } );
  16324. jQuery.extend( {
  16325. valHooks: {
  16326. option: {
  16327. get: function( elem ) {
  16328. var val = jQuery.find.attr( elem, "value" );
  16329. return val != null ?
  16330. val :
  16331. // Support: IE <=10 - 11 only
  16332. // option.text throws exceptions (#14686, #14858)
  16333. // Strip and collapse whitespace
  16334. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  16335. stripAndCollapse( jQuery.text( elem ) );
  16336. }
  16337. },
  16338. select: {
  16339. get: function( elem ) {
  16340. var value, option, i,
  16341. options = elem.options,
  16342. index = elem.selectedIndex,
  16343. one = elem.type === "select-one",
  16344. values = one ? null : [],
  16345. max = one ? index + 1 : options.length;
  16346. if ( index < 0 ) {
  16347. i = max;
  16348. } else {
  16349. i = one ? index : 0;
  16350. }
  16351. // Loop through all the selected options
  16352. for ( ; i < max; i++ ) {
  16353. option = options[ i ];
  16354. // Support: IE <=9 only
  16355. // IE8-9 doesn't update selected after form reset (#2551)
  16356. if ( ( option.selected || i === index ) &&
  16357. // Don't return options that are disabled or in a disabled optgroup
  16358. !option.disabled &&
  16359. ( !option.parentNode.disabled ||
  16360. !nodeName( option.parentNode, "optgroup" ) ) ) {
  16361. // Get the specific value for the option
  16362. value = jQuery( option ).val();
  16363. // We don't need an array for one selects
  16364. if ( one ) {
  16365. return value;
  16366. }
  16367. // Multi-Selects return an array
  16368. values.push( value );
  16369. }
  16370. }
  16371. return values;
  16372. },
  16373. set: function( elem, value ) {
  16374. var optionSet, option,
  16375. options = elem.options,
  16376. values = jQuery.makeArray( value ),
  16377. i = options.length;
  16378. while ( i-- ) {
  16379. option = options[ i ];
  16380. /* eslint-disable no-cond-assign */
  16381. if ( option.selected =
  16382. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  16383. ) {
  16384. optionSet = true;
  16385. }
  16386. /* eslint-enable no-cond-assign */
  16387. }
  16388. // Force browsers to behave consistently when non-matching value is set
  16389. if ( !optionSet ) {
  16390. elem.selectedIndex = -1;
  16391. }
  16392. return values;
  16393. }
  16394. }
  16395. }
  16396. } );
  16397. // Radios and checkboxes getter/setter
  16398. jQuery.each( [ "radio", "checkbox" ], function() {
  16399. jQuery.valHooks[ this ] = {
  16400. set: function( elem, value ) {
  16401. if ( Array.isArray( value ) ) {
  16402. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  16403. }
  16404. }
  16405. };
  16406. if ( !support.checkOn ) {
  16407. jQuery.valHooks[ this ].get = function( elem ) {
  16408. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  16409. };
  16410. }
  16411. } );
  16412. // Return jQuery for attributes-only inclusion
  16413. support.focusin = "onfocusin" in window;
  16414. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  16415. stopPropagationCallback = function( e ) {
  16416. e.stopPropagation();
  16417. };
  16418. jQuery.extend( jQuery.event, {
  16419. trigger: function( event, data, elem, onlyHandlers ) {
  16420. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  16421. eventPath = [ elem || document ],
  16422. type = hasOwn.call( event, "type" ) ? event.type : event,
  16423. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  16424. cur = lastElement = tmp = elem = elem || document;
  16425. // Don't do events on text and comment nodes
  16426. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  16427. return;
  16428. }
  16429. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  16430. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  16431. return;
  16432. }
  16433. if ( type.indexOf( "." ) > -1 ) {
  16434. // Namespaced trigger; create a regexp to match event type in handle()
  16435. namespaces = type.split( "." );
  16436. type = namespaces.shift();
  16437. namespaces.sort();
  16438. }
  16439. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  16440. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  16441. event = event[ jQuery.expando ] ?
  16442. event :
  16443. new jQuery.Event( type, typeof event === "object" && event );
  16444. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  16445. event.isTrigger = onlyHandlers ? 2 : 3;
  16446. event.namespace = namespaces.join( "." );
  16447. event.rnamespace = event.namespace ?
  16448. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  16449. null;
  16450. // Clean up the event in case it is being reused
  16451. event.result = undefined;
  16452. if ( !event.target ) {
  16453. event.target = elem;
  16454. }
  16455. // Clone any incoming data and prepend the event, creating the handler arg list
  16456. data = data == null ?
  16457. [ event ] :
  16458. jQuery.makeArray( data, [ event ] );
  16459. // Allow special events to draw outside the lines
  16460. special = jQuery.event.special[ type ] || {};
  16461. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  16462. return;
  16463. }
  16464. // Determine event propagation path in advance, per W3C events spec (#9951)
  16465. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  16466. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  16467. bubbleType = special.delegateType || type;
  16468. if ( !rfocusMorph.test( bubbleType + type ) ) {
  16469. cur = cur.parentNode;
  16470. }
  16471. for ( ; cur; cur = cur.parentNode ) {
  16472. eventPath.push( cur );
  16473. tmp = cur;
  16474. }
  16475. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  16476. if ( tmp === ( elem.ownerDocument || document ) ) {
  16477. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  16478. }
  16479. }
  16480. // Fire handlers on the event path
  16481. i = 0;
  16482. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  16483. lastElement = cur;
  16484. event.type = i > 1 ?
  16485. bubbleType :
  16486. special.bindType || type;
  16487. // jQuery handler
  16488. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  16489. dataPriv.get( cur, "handle" );
  16490. if ( handle ) {
  16491. handle.apply( cur, data );
  16492. }
  16493. // Native handler
  16494. handle = ontype && cur[ ontype ];
  16495. if ( handle && handle.apply && acceptData( cur ) ) {
  16496. event.result = handle.apply( cur, data );
  16497. if ( event.result === false ) {
  16498. event.preventDefault();
  16499. }
  16500. }
  16501. }
  16502. event.type = type;
  16503. // If nobody prevented the default action, do it now
  16504. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  16505. if ( ( !special._default ||
  16506. special._default.apply( eventPath.pop(), data ) === false ) &&
  16507. acceptData( elem ) ) {
  16508. // Call a native DOM method on the target with the same name as the event.
  16509. // Don't do default actions on window, that's where global variables be (#6170)
  16510. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  16511. // Don't re-trigger an onFOO event when we call its FOO() method
  16512. tmp = elem[ ontype ];
  16513. if ( tmp ) {
  16514. elem[ ontype ] = null;
  16515. }
  16516. // Prevent re-triggering of the same event, since we already bubbled it above
  16517. jQuery.event.triggered = type;
  16518. if ( event.isPropagationStopped() ) {
  16519. lastElement.addEventListener( type, stopPropagationCallback );
  16520. }
  16521. elem[ type ]();
  16522. if ( event.isPropagationStopped() ) {
  16523. lastElement.removeEventListener( type, stopPropagationCallback );
  16524. }
  16525. jQuery.event.triggered = undefined;
  16526. if ( tmp ) {
  16527. elem[ ontype ] = tmp;
  16528. }
  16529. }
  16530. }
  16531. }
  16532. return event.result;
  16533. },
  16534. // Piggyback on a donor event to simulate a different one
  16535. // Used only for `focus(in | out)` events
  16536. simulate: function( type, elem, event ) {
  16537. var e = jQuery.extend(
  16538. new jQuery.Event(),
  16539. event,
  16540. {
  16541. type: type,
  16542. isSimulated: true
  16543. }
  16544. );
  16545. jQuery.event.trigger( e, null, elem );
  16546. }
  16547. } );
  16548. jQuery.fn.extend( {
  16549. trigger: function( type, data ) {
  16550. return this.each( function() {
  16551. jQuery.event.trigger( type, data, this );
  16552. } );
  16553. },
  16554. triggerHandler: function( type, data ) {
  16555. var elem = this[ 0 ];
  16556. if ( elem ) {
  16557. return jQuery.event.trigger( type, data, elem, true );
  16558. }
  16559. }
  16560. } );
  16561. // Support: Firefox <=44
  16562. // Firefox doesn't have focus(in | out) events
  16563. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  16564. //
  16565. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  16566. // focus(in | out) events fire after focus & blur events,
  16567. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  16568. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  16569. if ( !support.focusin ) {
  16570. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  16571. // Attach a single capturing handler on the document while someone wants focusin/focusout
  16572. var handler = function( event ) {
  16573. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  16574. };
  16575. jQuery.event.special[ fix ] = {
  16576. setup: function() {
  16577. var doc = this.ownerDocument || this,
  16578. attaches = dataPriv.access( doc, fix );
  16579. if ( !attaches ) {
  16580. doc.addEventListener( orig, handler, true );
  16581. }
  16582. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  16583. },
  16584. teardown: function() {
  16585. var doc = this.ownerDocument || this,
  16586. attaches = dataPriv.access( doc, fix ) - 1;
  16587. if ( !attaches ) {
  16588. doc.removeEventListener( orig, handler, true );
  16589. dataPriv.remove( doc, fix );
  16590. } else {
  16591. dataPriv.access( doc, fix, attaches );
  16592. }
  16593. }
  16594. };
  16595. } );
  16596. }
  16597. var location = window.location;
  16598. var nonce = Date.now();
  16599. var rquery = ( /\?/ );
  16600. // Cross-browser xml parsing
  16601. jQuery.parseXML = function( data ) {
  16602. var xml;
  16603. if ( !data || typeof data !== "string" ) {
  16604. return null;
  16605. }
  16606. // Support: IE 9 - 11 only
  16607. // IE throws on parseFromString with invalid input.
  16608. try {
  16609. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  16610. } catch ( e ) {
  16611. xml = undefined;
  16612. }
  16613. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  16614. jQuery.error( "Invalid XML: " + data );
  16615. }
  16616. return xml;
  16617. };
  16618. var
  16619. rbracket = /\[\]$/,
  16620. rCRLF = /\r?\n/g,
  16621. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  16622. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  16623. function buildParams( prefix, obj, traditional, add ) {
  16624. var name;
  16625. if ( Array.isArray( obj ) ) {
  16626. // Serialize array item.
  16627. jQuery.each( obj, function( i, v ) {
  16628. if ( traditional || rbracket.test( prefix ) ) {
  16629. // Treat each array item as a scalar.
  16630. add( prefix, v );
  16631. } else {
  16632. // Item is non-scalar (array or object), encode its numeric index.
  16633. buildParams(
  16634. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  16635. v,
  16636. traditional,
  16637. add
  16638. );
  16639. }
  16640. } );
  16641. } else if ( !traditional && toType( obj ) === "object" ) {
  16642. // Serialize object item.
  16643. for ( name in obj ) {
  16644. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  16645. }
  16646. } else {
  16647. // Serialize scalar item.
  16648. add( prefix, obj );
  16649. }
  16650. }
  16651. // Serialize an array of form elements or a set of
  16652. // key/values into a query string
  16653. jQuery.param = function( a, traditional ) {
  16654. var prefix,
  16655. s = [],
  16656. add = function( key, valueOrFunction ) {
  16657. // If value is a function, invoke it and use its return value
  16658. var value = isFunction( valueOrFunction ) ?
  16659. valueOrFunction() :
  16660. valueOrFunction;
  16661. s[ s.length ] = encodeURIComponent( key ) + "=" +
  16662. encodeURIComponent( value == null ? "" : value );
  16663. };
  16664. if ( a == null ) {
  16665. return "";
  16666. }
  16667. // If an array was passed in, assume that it is an array of form elements.
  16668. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  16669. // Serialize the form elements
  16670. jQuery.each( a, function() {
  16671. add( this.name, this.value );
  16672. } );
  16673. } else {
  16674. // If traditional, encode the "old" way (the way 1.3.2 or older
  16675. // did it), otherwise encode params recursively.
  16676. for ( prefix in a ) {
  16677. buildParams( prefix, a[ prefix ], traditional, add );
  16678. }
  16679. }
  16680. // Return the resulting serialization
  16681. return s.join( "&" );
  16682. };
  16683. jQuery.fn.extend( {
  16684. serialize: function() {
  16685. return jQuery.param( this.serializeArray() );
  16686. },
  16687. serializeArray: function() {
  16688. return this.map( function() {
  16689. // Can add propHook for "elements" to filter or add form elements
  16690. var elements = jQuery.prop( this, "elements" );
  16691. return elements ? jQuery.makeArray( elements ) : this;
  16692. } )
  16693. .filter( function() {
  16694. var type = this.type;
  16695. // Use .is( ":disabled" ) so that fieldset[disabled] works
  16696. return this.name && !jQuery( this ).is( ":disabled" ) &&
  16697. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  16698. ( this.checked || !rcheckableType.test( type ) );
  16699. } )
  16700. .map( function( i, elem ) {
  16701. var val = jQuery( this ).val();
  16702. if ( val == null ) {
  16703. return null;
  16704. }
  16705. if ( Array.isArray( val ) ) {
  16706. return jQuery.map( val, function( val ) {
  16707. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16708. } );
  16709. }
  16710. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16711. } ).get();
  16712. }
  16713. } );
  16714. var
  16715. r20 = /%20/g,
  16716. rhash = /#.*$/,
  16717. rantiCache = /([?&])_=[^&]*/,
  16718. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  16719. // #7653, #8125, #8152: local protocol detection
  16720. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  16721. rnoContent = /^(?:GET|HEAD)$/,
  16722. rprotocol = /^\/\//,
  16723. /* Prefilters
  16724. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  16725. * 2) These are called:
  16726. * - BEFORE asking for a transport
  16727. * - AFTER param serialization (s.data is a string if s.processData is true)
  16728. * 3) key is the dataType
  16729. * 4) the catchall symbol "*" can be used
  16730. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  16731. */
  16732. prefilters = {},
  16733. /* Transports bindings
  16734. * 1) key is the dataType
  16735. * 2) the catchall symbol "*" can be used
  16736. * 3) selection will start with transport dataType and THEN go to "*" if needed
  16737. */
  16738. transports = {},
  16739. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  16740. allTypes = "*/".concat( "*" ),
  16741. // Anchor tag for parsing the document origin
  16742. originAnchor = document.createElement( "a" );
  16743. originAnchor.href = location.href;
  16744. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  16745. function addToPrefiltersOrTransports( structure ) {
  16746. // dataTypeExpression is optional and defaults to "*"
  16747. return function( dataTypeExpression, func ) {
  16748. if ( typeof dataTypeExpression !== "string" ) {
  16749. func = dataTypeExpression;
  16750. dataTypeExpression = "*";
  16751. }
  16752. var dataType,
  16753. i = 0,
  16754. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  16755. if ( isFunction( func ) ) {
  16756. // For each dataType in the dataTypeExpression
  16757. while ( ( dataType = dataTypes[ i++ ] ) ) {
  16758. // Prepend if requested
  16759. if ( dataType[ 0 ] === "+" ) {
  16760. dataType = dataType.slice( 1 ) || "*";
  16761. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  16762. // Otherwise append
  16763. } else {
  16764. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  16765. }
  16766. }
  16767. }
  16768. };
  16769. }
  16770. // Base inspection function for prefilters and transports
  16771. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  16772. var inspected = {},
  16773. seekingTransport = ( structure === transports );
  16774. function inspect( dataType ) {
  16775. var selected;
  16776. inspected[ dataType ] = true;
  16777. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  16778. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  16779. if ( typeof dataTypeOrTransport === "string" &&
  16780. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  16781. options.dataTypes.unshift( dataTypeOrTransport );
  16782. inspect( dataTypeOrTransport );
  16783. return false;
  16784. } else if ( seekingTransport ) {
  16785. return !( selected = dataTypeOrTransport );
  16786. }
  16787. } );
  16788. return selected;
  16789. }
  16790. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  16791. }
  16792. // A special extend for ajax options
  16793. // that takes "flat" options (not to be deep extended)
  16794. // Fixes #9887
  16795. function ajaxExtend( target, src ) {
  16796. var key, deep,
  16797. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  16798. for ( key in src ) {
  16799. if ( src[ key ] !== undefined ) {
  16800. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  16801. }
  16802. }
  16803. if ( deep ) {
  16804. jQuery.extend( true, target, deep );
  16805. }
  16806. return target;
  16807. }
  16808. /* Handles responses to an ajax request:
  16809. * - finds the right dataType (mediates between content-type and expected dataType)
  16810. * - returns the corresponding response
  16811. */
  16812. function ajaxHandleResponses( s, jqXHR, responses ) {
  16813. var ct, type, finalDataType, firstDataType,
  16814. contents = s.contents,
  16815. dataTypes = s.dataTypes;
  16816. // Remove auto dataType and get content-type in the process
  16817. while ( dataTypes[ 0 ] === "*" ) {
  16818. dataTypes.shift();
  16819. if ( ct === undefined ) {
  16820. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  16821. }
  16822. }
  16823. // Check if we're dealing with a known content-type
  16824. if ( ct ) {
  16825. for ( type in contents ) {
  16826. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  16827. dataTypes.unshift( type );
  16828. break;
  16829. }
  16830. }
  16831. }
  16832. // Check to see if we have a response for the expected dataType
  16833. if ( dataTypes[ 0 ] in responses ) {
  16834. finalDataType = dataTypes[ 0 ];
  16835. } else {
  16836. // Try convertible dataTypes
  16837. for ( type in responses ) {
  16838. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  16839. finalDataType = type;
  16840. break;
  16841. }
  16842. if ( !firstDataType ) {
  16843. firstDataType = type;
  16844. }
  16845. }
  16846. // Or just use first one
  16847. finalDataType = finalDataType || firstDataType;
  16848. }
  16849. // If we found a dataType
  16850. // We add the dataType to the list if needed
  16851. // and return the corresponding response
  16852. if ( finalDataType ) {
  16853. if ( finalDataType !== dataTypes[ 0 ] ) {
  16854. dataTypes.unshift( finalDataType );
  16855. }
  16856. return responses[ finalDataType ];
  16857. }
  16858. }
  16859. /* Chain conversions given the request and the original response
  16860. * Also sets the responseXXX fields on the jqXHR instance
  16861. */
  16862. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  16863. var conv2, current, conv, tmp, prev,
  16864. converters = {},
  16865. // Work with a copy of dataTypes in case we need to modify it for conversion
  16866. dataTypes = s.dataTypes.slice();
  16867. // Create converters map with lowercased keys
  16868. if ( dataTypes[ 1 ] ) {
  16869. for ( conv in s.converters ) {
  16870. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  16871. }
  16872. }
  16873. current = dataTypes.shift();
  16874. // Convert to each sequential dataType
  16875. while ( current ) {
  16876. if ( s.responseFields[ current ] ) {
  16877. jqXHR[ s.responseFields[ current ] ] = response;
  16878. }
  16879. // Apply the dataFilter if provided
  16880. if ( !prev && isSuccess && s.dataFilter ) {
  16881. response = s.dataFilter( response, s.dataType );
  16882. }
  16883. prev = current;
  16884. current = dataTypes.shift();
  16885. if ( current ) {
  16886. // There's only work to do if current dataType is non-auto
  16887. if ( current === "*" ) {
  16888. current = prev;
  16889. // Convert response if prev dataType is non-auto and differs from current
  16890. } else if ( prev !== "*" && prev !== current ) {
  16891. // Seek a direct converter
  16892. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  16893. // If none found, seek a pair
  16894. if ( !conv ) {
  16895. for ( conv2 in converters ) {
  16896. // If conv2 outputs current
  16897. tmp = conv2.split( " " );
  16898. if ( tmp[ 1 ] === current ) {
  16899. // If prev can be converted to accepted input
  16900. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  16901. converters[ "* " + tmp[ 0 ] ];
  16902. if ( conv ) {
  16903. // Condense equivalence converters
  16904. if ( conv === true ) {
  16905. conv = converters[ conv2 ];
  16906. // Otherwise, insert the intermediate dataType
  16907. } else if ( converters[ conv2 ] !== true ) {
  16908. current = tmp[ 0 ];
  16909. dataTypes.unshift( tmp[ 1 ] );
  16910. }
  16911. break;
  16912. }
  16913. }
  16914. }
  16915. }
  16916. // Apply converter (if not an equivalence)
  16917. if ( conv !== true ) {
  16918. // Unless errors are allowed to bubble, catch and return them
  16919. if ( conv && s.throws ) {
  16920. response = conv( response );
  16921. } else {
  16922. try {
  16923. response = conv( response );
  16924. } catch ( e ) {
  16925. return {
  16926. state: "parsererror",
  16927. error: conv ? e : "No conversion from " + prev + " to " + current
  16928. };
  16929. }
  16930. }
  16931. }
  16932. }
  16933. }
  16934. }
  16935. return { state: "success", data: response };
  16936. }
  16937. jQuery.extend( {
  16938. // Counter for holding the number of active queries
  16939. active: 0,
  16940. // Last-Modified header cache for next request
  16941. lastModified: {},
  16942. etag: {},
  16943. ajaxSettings: {
  16944. url: location.href,
  16945. type: "GET",
  16946. isLocal: rlocalProtocol.test( location.protocol ),
  16947. global: true,
  16948. processData: true,
  16949. async: true,
  16950. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16951. /*
  16952. timeout: 0,
  16953. data: null,
  16954. dataType: null,
  16955. username: null,
  16956. password: null,
  16957. cache: null,
  16958. throws: false,
  16959. traditional: false,
  16960. headers: {},
  16961. */
  16962. accepts: {
  16963. "*": allTypes,
  16964. text: "text/plain",
  16965. html: "text/html",
  16966. xml: "application/xml, text/xml",
  16967. json: "application/json, text/javascript"
  16968. },
  16969. contents: {
  16970. xml: /\bxml\b/,
  16971. html: /\bhtml/,
  16972. json: /\bjson\b/
  16973. },
  16974. responseFields: {
  16975. xml: "responseXML",
  16976. text: "responseText",
  16977. json: "responseJSON"
  16978. },
  16979. // Data converters
  16980. // Keys separate source (or catchall "*") and destination types with a single space
  16981. converters: {
  16982. // Convert anything to text
  16983. "* text": String,
  16984. // Text to html (true = no transformation)
  16985. "text html": true,
  16986. // Evaluate text as a json expression
  16987. "text json": JSON.parse,
  16988. // Parse text as xml
  16989. "text xml": jQuery.parseXML
  16990. },
  16991. // For options that shouldn't be deep extended:
  16992. // you can add your own custom options here if
  16993. // and when you create one that shouldn't be
  16994. // deep extended (see ajaxExtend)
  16995. flatOptions: {
  16996. url: true,
  16997. context: true
  16998. }
  16999. },
  17000. // Creates a full fledged settings object into target
  17001. // with both ajaxSettings and settings fields.
  17002. // If target is omitted, writes into ajaxSettings.
  17003. ajaxSetup: function( target, settings ) {
  17004. return settings ?
  17005. // Building a settings object
  17006. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  17007. // Extending ajaxSettings
  17008. ajaxExtend( jQuery.ajaxSettings, target );
  17009. },
  17010. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  17011. ajaxTransport: addToPrefiltersOrTransports( transports ),
  17012. // Main method
  17013. ajax: function( url, options ) {
  17014. // If url is an object, simulate pre-1.5 signature
  17015. if ( typeof url === "object" ) {
  17016. options = url;
  17017. url = undefined;
  17018. }
  17019. // Force options to be an object
  17020. options = options || {};
  17021. var transport,
  17022. // URL without anti-cache param
  17023. cacheURL,
  17024. // Response headers
  17025. responseHeadersString,
  17026. responseHeaders,
  17027. // timeout handle
  17028. timeoutTimer,
  17029. // Url cleanup var
  17030. urlAnchor,
  17031. // Request state (becomes false upon send and true upon completion)
  17032. completed,
  17033. // To know if global events are to be dispatched
  17034. fireGlobals,
  17035. // Loop variable
  17036. i,
  17037. // uncached part of the url
  17038. uncached,
  17039. // Create the final options object
  17040. s = jQuery.ajaxSetup( {}, options ),
  17041. // Callbacks context
  17042. callbackContext = s.context || s,
  17043. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  17044. globalEventContext = s.context &&
  17045. ( callbackContext.nodeType || callbackContext.jquery ) ?
  17046. jQuery( callbackContext ) :
  17047. jQuery.event,
  17048. // Deferreds
  17049. deferred = jQuery.Deferred(),
  17050. completeDeferred = jQuery.Callbacks( "once memory" ),
  17051. // Status-dependent callbacks
  17052. statusCode = s.statusCode || {},
  17053. // Headers (they are sent all at once)
  17054. requestHeaders = {},
  17055. requestHeadersNames = {},
  17056. // Default abort message
  17057. strAbort = "canceled",
  17058. // Fake xhr
  17059. jqXHR = {
  17060. readyState: 0,
  17061. // Builds headers hashtable if needed
  17062. getResponseHeader: function( key ) {
  17063. var match;
  17064. if ( completed ) {
  17065. if ( !responseHeaders ) {
  17066. responseHeaders = {};
  17067. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  17068. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  17069. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  17070. .concat( match[ 2 ] );
  17071. }
  17072. }
  17073. match = responseHeaders[ key.toLowerCase() + " " ];
  17074. }
  17075. return match == null ? null : match.join( ", " );
  17076. },
  17077. // Raw string
  17078. getAllResponseHeaders: function() {
  17079. return completed ? responseHeadersString : null;
  17080. },
  17081. // Caches the header
  17082. setRequestHeader: function( name, value ) {
  17083. if ( completed == null ) {
  17084. name = requestHeadersNames[ name.toLowerCase() ] =
  17085. requestHeadersNames[ name.toLowerCase() ] || name;
  17086. requestHeaders[ name ] = value;
  17087. }
  17088. return this;
  17089. },
  17090. // Overrides response content-type header
  17091. overrideMimeType: function( type ) {
  17092. if ( completed == null ) {
  17093. s.mimeType = type;
  17094. }
  17095. return this;
  17096. },
  17097. // Status-dependent callbacks
  17098. statusCode: function( map ) {
  17099. var code;
  17100. if ( map ) {
  17101. if ( completed ) {
  17102. // Execute the appropriate callbacks
  17103. jqXHR.always( map[ jqXHR.status ] );
  17104. } else {
  17105. // Lazy-add the new callbacks in a way that preserves old ones
  17106. for ( code in map ) {
  17107. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  17108. }
  17109. }
  17110. }
  17111. return this;
  17112. },
  17113. // Cancel the request
  17114. abort: function( statusText ) {
  17115. var finalText = statusText || strAbort;
  17116. if ( transport ) {
  17117. transport.abort( finalText );
  17118. }
  17119. done( 0, finalText );
  17120. return this;
  17121. }
  17122. };
  17123. // Attach deferreds
  17124. deferred.promise( jqXHR );
  17125. // Add protocol if not provided (prefilters might expect it)
  17126. // Handle falsy url in the settings object (#10093: consistency with old signature)
  17127. // We also use the url parameter if available
  17128. s.url = ( ( url || s.url || location.href ) + "" )
  17129. .replace( rprotocol, location.protocol + "//" );
  17130. // Alias method option to type as per ticket #12004
  17131. s.type = options.method || options.type || s.method || s.type;
  17132. // Extract dataTypes list
  17133. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  17134. // A cross-domain request is in order when the origin doesn't match the current origin.
  17135. if ( s.crossDomain == null ) {
  17136. urlAnchor = document.createElement( "a" );
  17137. // Support: IE <=8 - 11, Edge 12 - 15
  17138. // IE throws exception on accessing the href property if url is malformed,
  17139. // e.g. http://example.com:80x/
  17140. try {
  17141. urlAnchor.href = s.url;
  17142. // Support: IE <=8 - 11 only
  17143. // Anchor's host property isn't correctly set when s.url is relative
  17144. urlAnchor.href = urlAnchor.href;
  17145. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  17146. urlAnchor.protocol + "//" + urlAnchor.host;
  17147. } catch ( e ) {
  17148. // If there is an error parsing the URL, assume it is crossDomain,
  17149. // it can be rejected by the transport if it is invalid
  17150. s.crossDomain = true;
  17151. }
  17152. }
  17153. // Convert data if not already a string
  17154. if ( s.data && s.processData && typeof s.data !== "string" ) {
  17155. s.data = jQuery.param( s.data, s.traditional );
  17156. }
  17157. // Apply prefilters
  17158. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  17159. // If request was aborted inside a prefilter, stop there
  17160. if ( completed ) {
  17161. return jqXHR;
  17162. }
  17163. // We can fire global events as of now if asked to
  17164. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  17165. fireGlobals = jQuery.event && s.global;
  17166. // Watch for a new set of requests
  17167. if ( fireGlobals && jQuery.active++ === 0 ) {
  17168. jQuery.event.trigger( "ajaxStart" );
  17169. }
  17170. // Uppercase the type
  17171. s.type = s.type.toUpperCase();
  17172. // Determine if request has content
  17173. s.hasContent = !rnoContent.test( s.type );
  17174. // Save the URL in case we're toying with the If-Modified-Since
  17175. // and/or If-None-Match header later on
  17176. // Remove hash to simplify url manipulation
  17177. cacheURL = s.url.replace( rhash, "" );
  17178. // More options handling for requests with no content
  17179. if ( !s.hasContent ) {
  17180. // Remember the hash so we can put it back
  17181. uncached = s.url.slice( cacheURL.length );
  17182. // If data is available and should be processed, append data to url
  17183. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  17184. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  17185. // #9682: remove data so that it's not used in an eventual retry
  17186. delete s.data;
  17187. }
  17188. // Add or update anti-cache param if needed
  17189. if ( s.cache === false ) {
  17190. cacheURL = cacheURL.replace( rantiCache, "$1" );
  17191. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  17192. }
  17193. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  17194. s.url = cacheURL + uncached;
  17195. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  17196. } else if ( s.data && s.processData &&
  17197. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  17198. s.data = s.data.replace( r20, "+" );
  17199. }
  17200. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  17201. if ( s.ifModified ) {
  17202. if ( jQuery.lastModified[ cacheURL ] ) {
  17203. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  17204. }
  17205. if ( jQuery.etag[ cacheURL ] ) {
  17206. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  17207. }
  17208. }
  17209. // Set the correct header, if data is being sent
  17210. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  17211. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  17212. }
  17213. // Set the Accepts header for the server, depending on the dataType
  17214. jqXHR.setRequestHeader(
  17215. "Accept",
  17216. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  17217. s.accepts[ s.dataTypes[ 0 ] ] +
  17218. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  17219. s.accepts[ "*" ]
  17220. );
  17221. // Check for headers option
  17222. for ( i in s.headers ) {
  17223. jqXHR.setRequestHeader( i, s.headers[ i ] );
  17224. }
  17225. // Allow custom headers/mimetypes and early abort
  17226. if ( s.beforeSend &&
  17227. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  17228. // Abort if not done already and return
  17229. return jqXHR.abort();
  17230. }
  17231. // Aborting is no longer a cancellation
  17232. strAbort = "abort";
  17233. // Install callbacks on deferreds
  17234. completeDeferred.add( s.complete );
  17235. jqXHR.done( s.success );
  17236. jqXHR.fail( s.error );
  17237. // Get transport
  17238. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  17239. // If no transport, we auto-abort
  17240. if ( !transport ) {
  17241. done( -1, "No Transport" );
  17242. } else {
  17243. jqXHR.readyState = 1;
  17244. // Send global event
  17245. if ( fireGlobals ) {
  17246. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  17247. }
  17248. // If request was aborted inside ajaxSend, stop there
  17249. if ( completed ) {
  17250. return jqXHR;
  17251. }
  17252. // Timeout
  17253. if ( s.async && s.timeout > 0 ) {
  17254. timeoutTimer = window.setTimeout( function() {
  17255. jqXHR.abort( "timeout" );
  17256. }, s.timeout );
  17257. }
  17258. try {
  17259. completed = false;
  17260. transport.send( requestHeaders, done );
  17261. } catch ( e ) {
  17262. // Rethrow post-completion exceptions
  17263. if ( completed ) {
  17264. throw e;
  17265. }
  17266. // Propagate others as results
  17267. done( -1, e );
  17268. }
  17269. }
  17270. // Callback for when everything is done
  17271. function done( status, nativeStatusText, responses, headers ) {
  17272. var isSuccess, success, error, response, modified,
  17273. statusText = nativeStatusText;
  17274. // Ignore repeat invocations
  17275. if ( completed ) {
  17276. return;
  17277. }
  17278. completed = true;
  17279. // Clear timeout if it exists
  17280. if ( timeoutTimer ) {
  17281. window.clearTimeout( timeoutTimer );
  17282. }
  17283. // Dereference transport for early garbage collection
  17284. // (no matter how long the jqXHR object will be used)
  17285. transport = undefined;
  17286. // Cache response headers
  17287. responseHeadersString = headers || "";
  17288. // Set readyState
  17289. jqXHR.readyState = status > 0 ? 4 : 0;
  17290. // Determine if successful
  17291. isSuccess = status >= 200 && status < 300 || status === 304;
  17292. // Get response data
  17293. if ( responses ) {
  17294. response = ajaxHandleResponses( s, jqXHR, responses );
  17295. }
  17296. // Convert no matter what (that way responseXXX fields are always set)
  17297. response = ajaxConvert( s, response, jqXHR, isSuccess );
  17298. // If successful, handle type chaining
  17299. if ( isSuccess ) {
  17300. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  17301. if ( s.ifModified ) {
  17302. modified = jqXHR.getResponseHeader( "Last-Modified" );
  17303. if ( modified ) {
  17304. jQuery.lastModified[ cacheURL ] = modified;
  17305. }
  17306. modified = jqXHR.getResponseHeader( "etag" );
  17307. if ( modified ) {
  17308. jQuery.etag[ cacheURL ] = modified;
  17309. }
  17310. }
  17311. // if no content
  17312. if ( status === 204 || s.type === "HEAD" ) {
  17313. statusText = "nocontent";
  17314. // if not modified
  17315. } else if ( status === 304 ) {
  17316. statusText = "notmodified";
  17317. // If we have data, let's convert it
  17318. } else {
  17319. statusText = response.state;
  17320. success = response.data;
  17321. error = response.error;
  17322. isSuccess = !error;
  17323. }
  17324. } else {
  17325. // Extract error from statusText and normalize for non-aborts
  17326. error = statusText;
  17327. if ( status || !statusText ) {
  17328. statusText = "error";
  17329. if ( status < 0 ) {
  17330. status = 0;
  17331. }
  17332. }
  17333. }
  17334. // Set data for the fake xhr object
  17335. jqXHR.status = status;
  17336. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  17337. // Success/Error
  17338. if ( isSuccess ) {
  17339. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  17340. } else {
  17341. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  17342. }
  17343. // Status-dependent callbacks
  17344. jqXHR.statusCode( statusCode );
  17345. statusCode = undefined;
  17346. if ( fireGlobals ) {
  17347. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  17348. [ jqXHR, s, isSuccess ? success : error ] );
  17349. }
  17350. // Complete
  17351. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  17352. if ( fireGlobals ) {
  17353. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  17354. // Handle the global AJAX counter
  17355. if ( !( --jQuery.active ) ) {
  17356. jQuery.event.trigger( "ajaxStop" );
  17357. }
  17358. }
  17359. }
  17360. return jqXHR;
  17361. },
  17362. getJSON: function( url, data, callback ) {
  17363. return jQuery.get( url, data, callback, "json" );
  17364. },
  17365. getScript: function( url, callback ) {
  17366. return jQuery.get( url, undefined, callback, "script" );
  17367. }
  17368. } );
  17369. jQuery.each( [ "get", "post" ], function( i, method ) {
  17370. jQuery[ method ] = function( url, data, callback, type ) {
  17371. // Shift arguments if data argument was omitted
  17372. if ( isFunction( data ) ) {
  17373. type = type || callback;
  17374. callback = data;
  17375. data = undefined;
  17376. }
  17377. // The url can be an options object (which then must have .url)
  17378. return jQuery.ajax( jQuery.extend( {
  17379. url: url,
  17380. type: method,
  17381. dataType: type,
  17382. data: data,
  17383. success: callback
  17384. }, jQuery.isPlainObject( url ) && url ) );
  17385. };
  17386. } );
  17387. jQuery._evalUrl = function( url, options ) {
  17388. return jQuery.ajax( {
  17389. url: url,
  17390. // Make this explicit, since user can override this through ajaxSetup (#11264)
  17391. type: "GET",
  17392. dataType: "script",
  17393. cache: true,
  17394. async: false,
  17395. global: false,
  17396. // Only evaluate the response if it is successful (gh-4126)
  17397. // dataFilter is not invoked for failure responses, so using it instead
  17398. // of the default converter is kludgy but it works.
  17399. converters: {
  17400. "text script": function() {}
  17401. },
  17402. dataFilter: function( response ) {
  17403. jQuery.globalEval( response, options );
  17404. }
  17405. } );
  17406. };
  17407. jQuery.fn.extend( {
  17408. wrapAll: function( html ) {
  17409. var wrap;
  17410. if ( this[ 0 ] ) {
  17411. if ( isFunction( html ) ) {
  17412. html = html.call( this[ 0 ] );
  17413. }
  17414. // The elements to wrap the target around
  17415. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  17416. if ( this[ 0 ].parentNode ) {
  17417. wrap.insertBefore( this[ 0 ] );
  17418. }
  17419. wrap.map( function() {
  17420. var elem = this;
  17421. while ( elem.firstElementChild ) {
  17422. elem = elem.firstElementChild;
  17423. }
  17424. return elem;
  17425. } ).append( this );
  17426. }
  17427. return this;
  17428. },
  17429. wrapInner: function( html ) {
  17430. if ( isFunction( html ) ) {
  17431. return this.each( function( i ) {
  17432. jQuery( this ).wrapInner( html.call( this, i ) );
  17433. } );
  17434. }
  17435. return this.each( function() {
  17436. var self = jQuery( this ),
  17437. contents = self.contents();
  17438. if ( contents.length ) {
  17439. contents.wrapAll( html );
  17440. } else {
  17441. self.append( html );
  17442. }
  17443. } );
  17444. },
  17445. wrap: function( html ) {
  17446. var htmlIsFunction = isFunction( html );
  17447. return this.each( function( i ) {
  17448. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  17449. } );
  17450. },
  17451. unwrap: function( selector ) {
  17452. this.parent( selector ).not( "body" ).each( function() {
  17453. jQuery( this ).replaceWith( this.childNodes );
  17454. } );
  17455. return this;
  17456. }
  17457. } );
  17458. jQuery.expr.pseudos.hidden = function( elem ) {
  17459. return !jQuery.expr.pseudos.visible( elem );
  17460. };
  17461. jQuery.expr.pseudos.visible = function( elem ) {
  17462. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  17463. };
  17464. jQuery.ajaxSettings.xhr = function() {
  17465. try {
  17466. return new window.XMLHttpRequest();
  17467. } catch ( e ) {}
  17468. };
  17469. var xhrSuccessStatus = {
  17470. // File protocol always yields status code 0, assume 200
  17471. 0: 200,
  17472. // Support: IE <=9 only
  17473. // #1450: sometimes IE returns 1223 when it should be 204
  17474. 1223: 204
  17475. },
  17476. xhrSupported = jQuery.ajaxSettings.xhr();
  17477. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  17478. support.ajax = xhrSupported = !!xhrSupported;
  17479. jQuery.ajaxTransport( function( options ) {
  17480. var callback, errorCallback;
  17481. // Cross domain only allowed if supported through XMLHttpRequest
  17482. if ( support.cors || xhrSupported && !options.crossDomain ) {
  17483. return {
  17484. send: function( headers, complete ) {
  17485. var i,
  17486. xhr = options.xhr();
  17487. xhr.open(
  17488. options.type,
  17489. options.url,
  17490. options.async,
  17491. options.username,
  17492. options.password
  17493. );
  17494. // Apply custom fields if provided
  17495. if ( options.xhrFields ) {
  17496. for ( i in options.xhrFields ) {
  17497. xhr[ i ] = options.xhrFields[ i ];
  17498. }
  17499. }
  17500. // Override mime type if needed
  17501. if ( options.mimeType && xhr.overrideMimeType ) {
  17502. xhr.overrideMimeType( options.mimeType );
  17503. }
  17504. // X-Requested-With header
  17505. // For cross-domain requests, seeing as conditions for a preflight are
  17506. // akin to a jigsaw puzzle, we simply never set it to be sure.
  17507. // (it can always be set on a per-request basis or even using ajaxSetup)
  17508. // For same-domain requests, won't change header if already provided.
  17509. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  17510. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  17511. }
  17512. // Set headers
  17513. for ( i in headers ) {
  17514. xhr.setRequestHeader( i, headers[ i ] );
  17515. }
  17516. // Callback
  17517. callback = function( type ) {
  17518. return function() {
  17519. if ( callback ) {
  17520. callback = errorCallback = xhr.onload =
  17521. xhr.onerror = xhr.onabort = xhr.ontimeout =
  17522. xhr.onreadystatechange = null;
  17523. if ( type === "abort" ) {
  17524. xhr.abort();
  17525. } else if ( type === "error" ) {
  17526. // Support: IE <=9 only
  17527. // On a manual native abort, IE9 throws
  17528. // errors on any property access that is not readyState
  17529. if ( typeof xhr.status !== "number" ) {
  17530. complete( 0, "error" );
  17531. } else {
  17532. complete(
  17533. // File: protocol always yields status 0; see #8605, #14207
  17534. xhr.status,
  17535. xhr.statusText
  17536. );
  17537. }
  17538. } else {
  17539. complete(
  17540. xhrSuccessStatus[ xhr.status ] || xhr.status,
  17541. xhr.statusText,
  17542. // Support: IE <=9 only
  17543. // IE9 has no XHR2 but throws on binary (trac-11426)
  17544. // For XHR2 non-text, let the caller handle it (gh-2498)
  17545. ( xhr.responseType || "text" ) !== "text" ||
  17546. typeof xhr.responseText !== "string" ?
  17547. { binary: xhr.response } :
  17548. { text: xhr.responseText },
  17549. xhr.getAllResponseHeaders()
  17550. );
  17551. }
  17552. }
  17553. };
  17554. };
  17555. // Listen to events
  17556. xhr.onload = callback();
  17557. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  17558. // Support: IE 9 only
  17559. // Use onreadystatechange to replace onabort
  17560. // to handle uncaught aborts
  17561. if ( xhr.onabort !== undefined ) {
  17562. xhr.onabort = errorCallback;
  17563. } else {
  17564. xhr.onreadystatechange = function() {
  17565. // Check readyState before timeout as it changes
  17566. if ( xhr.readyState === 4 ) {
  17567. // Allow onerror to be called first,
  17568. // but that will not handle a native abort
  17569. // Also, save errorCallback to a variable
  17570. // as xhr.onerror cannot be accessed
  17571. window.setTimeout( function() {
  17572. if ( callback ) {
  17573. errorCallback();
  17574. }
  17575. } );
  17576. }
  17577. };
  17578. }
  17579. // Create the abort callback
  17580. callback = callback( "abort" );
  17581. try {
  17582. // Do send the request (this may raise an exception)
  17583. xhr.send( options.hasContent && options.data || null );
  17584. } catch ( e ) {
  17585. // #14683: Only rethrow if this hasn't been notified as an error yet
  17586. if ( callback ) {
  17587. throw e;
  17588. }
  17589. }
  17590. },
  17591. abort: function() {
  17592. if ( callback ) {
  17593. callback();
  17594. }
  17595. }
  17596. };
  17597. }
  17598. } );
  17599. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  17600. jQuery.ajaxPrefilter( function( s ) {
  17601. if ( s.crossDomain ) {
  17602. s.contents.script = false;
  17603. }
  17604. } );
  17605. // Install script dataType
  17606. jQuery.ajaxSetup( {
  17607. accepts: {
  17608. script: "text/javascript, application/javascript, " +
  17609. "application/ecmascript, application/x-ecmascript"
  17610. },
  17611. contents: {
  17612. script: /\b(?:java|ecma)script\b/
  17613. },
  17614. converters: {
  17615. "text script": function( text ) {
  17616. jQuery.globalEval( text );
  17617. return text;
  17618. }
  17619. }
  17620. } );
  17621. // Handle cache's special case and crossDomain
  17622. jQuery.ajaxPrefilter( "script", function( s ) {
  17623. if ( s.cache === undefined ) {
  17624. s.cache = false;
  17625. }
  17626. if ( s.crossDomain ) {
  17627. s.type = "GET";
  17628. }
  17629. } );
  17630. // Bind script tag hack transport
  17631. jQuery.ajaxTransport( "script", function( s ) {
  17632. // This transport only deals with cross domain or forced-by-attrs requests
  17633. if ( s.crossDomain || s.scriptAttrs ) {
  17634. var script, callback;
  17635. return {
  17636. send: function( _, complete ) {
  17637. script = jQuery( "<script>" )
  17638. .attr( s.scriptAttrs || {} )
  17639. .prop( { charset: s.scriptCharset, src: s.url } )
  17640. .on( "load error", callback = function( evt ) {
  17641. script.remove();
  17642. callback = null;
  17643. if ( evt ) {
  17644. complete( evt.type === "error" ? 404 : 200, evt.type );
  17645. }
  17646. } );
  17647. // Use native DOM manipulation to avoid our domManip AJAX trickery
  17648. document.head.appendChild( script[ 0 ] );
  17649. },
  17650. abort: function() {
  17651. if ( callback ) {
  17652. callback();
  17653. }
  17654. }
  17655. };
  17656. }
  17657. } );
  17658. var oldCallbacks = [],
  17659. rjsonp = /(=)\?(?=&|$)|\?\?/;
  17660. // Default jsonp settings
  17661. jQuery.ajaxSetup( {
  17662. jsonp: "callback",
  17663. jsonpCallback: function() {
  17664. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  17665. this[ callback ] = true;
  17666. return callback;
  17667. }
  17668. } );
  17669. // Detect, normalize options and install callbacks for jsonp requests
  17670. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  17671. var callbackName, overwritten, responseContainer,
  17672. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  17673. "url" :
  17674. typeof s.data === "string" &&
  17675. ( s.contentType || "" )
  17676. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  17677. rjsonp.test( s.data ) && "data"
  17678. );
  17679. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  17680. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  17681. // Get callback name, remembering preexisting value associated with it
  17682. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  17683. s.jsonpCallback() :
  17684. s.jsonpCallback;
  17685. // Insert callback into url or form data
  17686. if ( jsonProp ) {
  17687. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  17688. } else if ( s.jsonp !== false ) {
  17689. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  17690. }
  17691. // Use data converter to retrieve json after script execution
  17692. s.converters[ "script json" ] = function() {
  17693. if ( !responseContainer ) {
  17694. jQuery.error( callbackName + " was not called" );
  17695. }
  17696. return responseContainer[ 0 ];
  17697. };
  17698. // Force json dataType
  17699. s.dataTypes[ 0 ] = "json";
  17700. // Install callback
  17701. overwritten = window[ callbackName ];
  17702. window[ callbackName ] = function() {
  17703. responseContainer = arguments;
  17704. };
  17705. // Clean-up function (fires after converters)
  17706. jqXHR.always( function() {
  17707. // If previous value didn't exist - remove it
  17708. if ( overwritten === undefined ) {
  17709. jQuery( window ).removeProp( callbackName );
  17710. // Otherwise restore preexisting value
  17711. } else {
  17712. window[ callbackName ] = overwritten;
  17713. }
  17714. // Save back as free
  17715. if ( s[ callbackName ] ) {
  17716. // Make sure that re-using the options doesn't screw things around
  17717. s.jsonpCallback = originalSettings.jsonpCallback;
  17718. // Save the callback name for future use
  17719. oldCallbacks.push( callbackName );
  17720. }
  17721. // Call if it was a function and we have a response
  17722. if ( responseContainer && isFunction( overwritten ) ) {
  17723. overwritten( responseContainer[ 0 ] );
  17724. }
  17725. responseContainer = overwritten = undefined;
  17726. } );
  17727. // Delegate to script
  17728. return "script";
  17729. }
  17730. } );
  17731. // Support: Safari 8 only
  17732. // In Safari 8 documents created via document.implementation.createHTMLDocument
  17733. // collapse sibling forms: the second one becomes a child of the first one.
  17734. // Because of that, this security measure has to be disabled in Safari 8.
  17735. // https://bugs.webkit.org/show_bug.cgi?id=137337
  17736. support.createHTMLDocument = ( function() {
  17737. var body = document.implementation.createHTMLDocument( "" ).body;
  17738. body.innerHTML = "<form></form><form></form>";
  17739. return body.childNodes.length === 2;
  17740. } )();
  17741. // Argument "data" should be string of html
  17742. // context (optional): If specified, the fragment will be created in this context,
  17743. // defaults to document
  17744. // keepScripts (optional): If true, will include scripts passed in the html string
  17745. jQuery.parseHTML = function( data, context, keepScripts ) {
  17746. if ( typeof data !== "string" ) {
  17747. return [];
  17748. }
  17749. if ( typeof context === "boolean" ) {
  17750. keepScripts = context;
  17751. context = false;
  17752. }
  17753. var base, parsed, scripts;
  17754. if ( !context ) {
  17755. // Stop scripts or inline event handlers from being executed immediately
  17756. // by using document.implementation
  17757. if ( support.createHTMLDocument ) {
  17758. context = document.implementation.createHTMLDocument( "" );
  17759. // Set the base href for the created document
  17760. // so any parsed elements with URLs
  17761. // are based on the document's URL (gh-2965)
  17762. base = context.createElement( "base" );
  17763. base.href = document.location.href;
  17764. context.head.appendChild( base );
  17765. } else {
  17766. context = document;
  17767. }
  17768. }
  17769. parsed = rsingleTag.exec( data );
  17770. scripts = !keepScripts && [];
  17771. // Single tag
  17772. if ( parsed ) {
  17773. return [ context.createElement( parsed[ 1 ] ) ];
  17774. }
  17775. parsed = buildFragment( [ data ], context, scripts );
  17776. if ( scripts && scripts.length ) {
  17777. jQuery( scripts ).remove();
  17778. }
  17779. return jQuery.merge( [], parsed.childNodes );
  17780. };
  17781. /**
  17782. * Load a url into a page
  17783. */
  17784. jQuery.fn.load = function( url, params, callback ) {
  17785. var selector, type, response,
  17786. self = this,
  17787. off = url.indexOf( " " );
  17788. if ( off > -1 ) {
  17789. selector = stripAndCollapse( url.slice( off ) );
  17790. url = url.slice( 0, off );
  17791. }
  17792. // If it's a function
  17793. if ( isFunction( params ) ) {
  17794. // We assume that it's the callback
  17795. callback = params;
  17796. params = undefined;
  17797. // Otherwise, build a param string
  17798. } else if ( params && typeof params === "object" ) {
  17799. type = "POST";
  17800. }
  17801. // If we have elements to modify, make the request
  17802. if ( self.length > 0 ) {
  17803. jQuery.ajax( {
  17804. url: url,
  17805. // If "type" variable is undefined, then "GET" method will be used.
  17806. // Make value of this field explicit since
  17807. // user can override it through ajaxSetup method
  17808. type: type || "GET",
  17809. dataType: "html",
  17810. data: params
  17811. } ).done( function( responseText ) {
  17812. // Save response for use in complete callback
  17813. response = arguments;
  17814. self.html( selector ?
  17815. // If a selector was specified, locate the right elements in a dummy div
  17816. // Exclude scripts to avoid IE 'Permission Denied' errors
  17817. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  17818. // Otherwise use the full result
  17819. responseText );
  17820. // If the request succeeds, this function gets "data", "status", "jqXHR"
  17821. // but they are ignored because response was set above.
  17822. // If it fails, this function gets "jqXHR", "status", "error"
  17823. } ).always( callback && function( jqXHR, status ) {
  17824. self.each( function() {
  17825. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  17826. } );
  17827. } );
  17828. }
  17829. return this;
  17830. };
  17831. // Attach a bunch of functions for handling common AJAX events
  17832. jQuery.each( [
  17833. "ajaxStart",
  17834. "ajaxStop",
  17835. "ajaxComplete",
  17836. "ajaxError",
  17837. "ajaxSuccess",
  17838. "ajaxSend"
  17839. ], function( i, type ) {
  17840. jQuery.fn[ type ] = function( fn ) {
  17841. return this.on( type, fn );
  17842. };
  17843. } );
  17844. jQuery.expr.pseudos.animated = function( elem ) {
  17845. return jQuery.grep( jQuery.timers, function( fn ) {
  17846. return elem === fn.elem;
  17847. } ).length;
  17848. };
  17849. jQuery.offset = {
  17850. setOffset: function( elem, options, i ) {
  17851. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  17852. position = jQuery.css( elem, "position" ),
  17853. curElem = jQuery( elem ),
  17854. props = {};
  17855. // Set position first, in-case top/left are set even on static elem
  17856. if ( position === "static" ) {
  17857. elem.style.position = "relative";
  17858. }
  17859. curOffset = curElem.offset();
  17860. curCSSTop = jQuery.css( elem, "top" );
  17861. curCSSLeft = jQuery.css( elem, "left" );
  17862. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  17863. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  17864. // Need to be able to calculate position if either
  17865. // top or left is auto and position is either absolute or fixed
  17866. if ( calculatePosition ) {
  17867. curPosition = curElem.position();
  17868. curTop = curPosition.top;
  17869. curLeft = curPosition.left;
  17870. } else {
  17871. curTop = parseFloat( curCSSTop ) || 0;
  17872. curLeft = parseFloat( curCSSLeft ) || 0;
  17873. }
  17874. if ( isFunction( options ) ) {
  17875. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  17876. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  17877. }
  17878. if ( options.top != null ) {
  17879. props.top = ( options.top - curOffset.top ) + curTop;
  17880. }
  17881. if ( options.left != null ) {
  17882. props.left = ( options.left - curOffset.left ) + curLeft;
  17883. }
  17884. if ( "using" in options ) {
  17885. options.using.call( elem, props );
  17886. } else {
  17887. curElem.css( props );
  17888. }
  17889. }
  17890. };
  17891. jQuery.fn.extend( {
  17892. // offset() relates an element's border box to the document origin
  17893. offset: function( options ) {
  17894. // Preserve chaining for setter
  17895. if ( arguments.length ) {
  17896. return options === undefined ?
  17897. this :
  17898. this.each( function( i ) {
  17899. jQuery.offset.setOffset( this, options, i );
  17900. } );
  17901. }
  17902. var rect, win,
  17903. elem = this[ 0 ];
  17904. if ( !elem ) {
  17905. return;
  17906. }
  17907. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  17908. // Support: IE <=11 only
  17909. // Running getBoundingClientRect on a
  17910. // disconnected node in IE throws an error
  17911. if ( !elem.getClientRects().length ) {
  17912. return { top: 0, left: 0 };
  17913. }
  17914. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  17915. rect = elem.getBoundingClientRect();
  17916. win = elem.ownerDocument.defaultView;
  17917. return {
  17918. top: rect.top + win.pageYOffset,
  17919. left: rect.left + win.pageXOffset
  17920. };
  17921. },
  17922. // position() relates an element's margin box to its offset parent's padding box
  17923. // This corresponds to the behavior of CSS absolute positioning
  17924. position: function() {
  17925. if ( !this[ 0 ] ) {
  17926. return;
  17927. }
  17928. var offsetParent, offset, doc,
  17929. elem = this[ 0 ],
  17930. parentOffset = { top: 0, left: 0 };
  17931. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17932. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17933. // Assume position:fixed implies availability of getBoundingClientRect
  17934. offset = elem.getBoundingClientRect();
  17935. } else {
  17936. offset = this.offset();
  17937. // Account for the *real* offset parent, which can be the document or its root element
  17938. // when a statically positioned element is identified
  17939. doc = elem.ownerDocument;
  17940. offsetParent = elem.offsetParent || doc.documentElement;
  17941. while ( offsetParent &&
  17942. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17943. jQuery.css( offsetParent, "position" ) === "static" ) {
  17944. offsetParent = offsetParent.parentNode;
  17945. }
  17946. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17947. // Incorporate borders into its offset, since they are outside its content origin
  17948. parentOffset = jQuery( offsetParent ).offset();
  17949. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17950. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17951. }
  17952. }
  17953. // Subtract parent offsets and element margins
  17954. return {
  17955. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17956. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17957. };
  17958. },
  17959. // This method will return documentElement in the following cases:
  17960. // 1) For the element inside the iframe without offsetParent, this method will return
  17961. // documentElement of the parent window
  17962. // 2) For the hidden or detached element
  17963. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17964. //
  17965. // but those exceptions were never presented as a real life use-cases
  17966. // and might be considered as more preferable results.
  17967. //
  17968. // This logic, however, is not guaranteed and can change at any point in the future
  17969. offsetParent: function() {
  17970. return this.map( function() {
  17971. var offsetParent = this.offsetParent;
  17972. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17973. offsetParent = offsetParent.offsetParent;
  17974. }
  17975. return offsetParent || documentElement;
  17976. } );
  17977. }
  17978. } );
  17979. // Create scrollLeft and scrollTop methods
  17980. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17981. var top = "pageYOffset" === prop;
  17982. jQuery.fn[ method ] = function( val ) {
  17983. return access( this, function( elem, method, val ) {
  17984. // Coalesce documents and windows
  17985. var win;
  17986. if ( isWindow( elem ) ) {
  17987. win = elem;
  17988. } else if ( elem.nodeType === 9 ) {
  17989. win = elem.defaultView;
  17990. }
  17991. if ( val === undefined ) {
  17992. return win ? win[ prop ] : elem[ method ];
  17993. }
  17994. if ( win ) {
  17995. win.scrollTo(
  17996. !top ? val : win.pageXOffset,
  17997. top ? val : win.pageYOffset
  17998. );
  17999. } else {
  18000. elem[ method ] = val;
  18001. }
  18002. }, method, val, arguments.length );
  18003. };
  18004. } );
  18005. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  18006. // Add the top/left cssHooks using jQuery.fn.position
  18007. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  18008. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  18009. // getComputedStyle returns percent when specified for top/left/bottom/right;
  18010. // rather than make the css module depend on the offset module, just check for it here
  18011. jQuery.each( [ "top", "left" ], function( i, prop ) {
  18012. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  18013. function( elem, computed ) {
  18014. if ( computed ) {
  18015. computed = curCSS( elem, prop );
  18016. // If curCSS returns percentage, fallback to offset
  18017. return rnumnonpx.test( computed ) ?
  18018. jQuery( elem ).position()[ prop ] + "px" :
  18019. computed;
  18020. }
  18021. }
  18022. );
  18023. } );
  18024. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  18025. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  18026. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  18027. function( defaultExtra, funcName ) {
  18028. // Margin is only for outerHeight, outerWidth
  18029. jQuery.fn[ funcName ] = function( margin, value ) {
  18030. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  18031. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  18032. return access( this, function( elem, type, value ) {
  18033. var doc;
  18034. if ( isWindow( elem ) ) {
  18035. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  18036. return funcName.indexOf( "outer" ) === 0 ?
  18037. elem[ "inner" + name ] :
  18038. elem.document.documentElement[ "client" + name ];
  18039. }
  18040. // Get document width or height
  18041. if ( elem.nodeType === 9 ) {
  18042. doc = elem.documentElement;
  18043. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  18044. // whichever is greatest
  18045. return Math.max(
  18046. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  18047. elem.body[ "offset" + name ], doc[ "offset" + name ],
  18048. doc[ "client" + name ]
  18049. );
  18050. }
  18051. return value === undefined ?
  18052. // Get width or height on the element, requesting but not forcing parseFloat
  18053. jQuery.css( elem, type, extra ) :
  18054. // Set width or height on the element
  18055. jQuery.style( elem, type, value, extra );
  18056. }, type, chainable ? margin : undefined, chainable );
  18057. };
  18058. } );
  18059. } );
  18060. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  18061. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  18062. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  18063. function( i, name ) {
  18064. // Handle event binding
  18065. jQuery.fn[ name ] = function( data, fn ) {
  18066. return arguments.length > 0 ?
  18067. this.on( name, null, data, fn ) :
  18068. this.trigger( name );
  18069. };
  18070. } );
  18071. jQuery.fn.extend( {
  18072. hover: function( fnOver, fnOut ) {
  18073. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  18074. }
  18075. } );
  18076. jQuery.fn.extend( {
  18077. bind: function( types, data, fn ) {
  18078. return this.on( types, null, data, fn );
  18079. },
  18080. unbind: function( types, fn ) {
  18081. return this.off( types, null, fn );
  18082. },
  18083. delegate: function( selector, types, data, fn ) {
  18084. return this.on( types, selector, data, fn );
  18085. },
  18086. undelegate: function( selector, types, fn ) {
  18087. // ( namespace ) or ( selector, types [, fn] )
  18088. return arguments.length === 1 ?
  18089. this.off( selector, "**" ) :
  18090. this.off( types, selector || "**", fn );
  18091. }
  18092. } );
  18093. // Bind a function to a context, optionally partially applying any
  18094. // arguments.
  18095. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  18096. // However, it is not slated for removal any time soon
  18097. jQuery.proxy = function( fn, context ) {
  18098. var tmp, args, proxy;
  18099. if ( typeof context === "string" ) {
  18100. tmp = fn[ context ];
  18101. context = fn;
  18102. fn = tmp;
  18103. }
  18104. // Quick check to determine if target is callable, in the spec
  18105. // this throws a TypeError, but we will just return undefined.
  18106. if ( !isFunction( fn ) ) {
  18107. return undefined;
  18108. }
  18109. // Simulated bind
  18110. args = slice.call( arguments, 2 );
  18111. proxy = function() {
  18112. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  18113. };
  18114. // Set the guid of unique handler to the same of original handler, so it can be removed
  18115. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  18116. return proxy;
  18117. };
  18118. jQuery.holdReady = function( hold ) {
  18119. if ( hold ) {
  18120. jQuery.readyWait++;
  18121. } else {
  18122. jQuery.ready( true );
  18123. }
  18124. };
  18125. jQuery.isArray = Array.isArray;
  18126. jQuery.parseJSON = JSON.parse;
  18127. jQuery.nodeName = nodeName;
  18128. jQuery.isFunction = isFunction;
  18129. jQuery.isWindow = isWindow;
  18130. jQuery.camelCase = camelCase;
  18131. jQuery.type = toType;
  18132. jQuery.now = Date.now;
  18133. jQuery.isNumeric = function( obj ) {
  18134. // As of jQuery 3.0, isNumeric is limited to
  18135. // strings and numbers (primitives or objects)
  18136. // that can be coerced to finite numbers (gh-2662)
  18137. var type = jQuery.type( obj );
  18138. return ( type === "number" || type === "string" ) &&
  18139. // parseFloat NaNs numeric-cast false positives ("")
  18140. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  18141. // subtraction forces infinities to NaN
  18142. !isNaN( obj - parseFloat( obj ) );
  18143. };
  18144. // Register as a named AMD module, since jQuery can be concatenated with other
  18145. // files that may use define, but not via a proper concatenation script that
  18146. // understands anonymous AMD modules. A named AMD is safest and most robust
  18147. // way to register. Lowercase jquery is used because AMD module names are
  18148. // derived from file names, and jQuery is normally delivered in a lowercase
  18149. // file name. Do this after creating the global so that if an AMD module wants
  18150. // to call noConflict to hide this version of jQuery, it will work.
  18151. // Note that for maximum portability, libraries that are not jQuery should
  18152. // declare themselves as anonymous modules, and avoid setting a global if an
  18153. // AMD loader is present. jQuery is a special case. For more information, see
  18154. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  18155. if ( true ) {
  18156. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  18157. return jQuery;
  18158. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  18159. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  18160. }
  18161. var
  18162. // Map over jQuery in case of overwrite
  18163. _jQuery = window.jQuery,
  18164. // Map over the $ in case of overwrite
  18165. _$ = window.$;
  18166. jQuery.noConflict = function( deep ) {
  18167. if ( window.$ === jQuery ) {
  18168. window.$ = _$;
  18169. }
  18170. if ( deep && window.jQuery === jQuery ) {
  18171. window.jQuery = _jQuery;
  18172. }
  18173. return jQuery;
  18174. };
  18175. // Expose jQuery and $ identifiers, even in AMD
  18176. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  18177. // and CommonJS for browser emulators (#13566)
  18178. if ( !noGlobal ) {
  18179. window.jQuery = window.$ = jQuery;
  18180. }
  18181. return jQuery;
  18182. } );
  18183. /***/ }),
  18184. /***/ "./node_modules/laravel-echo/dist/echo.js":
  18185. /*!************************************************!*\
  18186. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  18187. \************************************************/
  18188. /*! exports provided: default */
  18189. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  18190. "use strict";
  18191. __webpack_require__.r(__webpack_exports__);
  18192. var classCallCheck = function (instance, Constructor) {
  18193. if (!(instance instanceof Constructor)) {
  18194. throw new TypeError("Cannot call a class as a function");
  18195. }
  18196. };
  18197. var createClass = function () {
  18198. function defineProperties(target, props) {
  18199. for (var i = 0; i < props.length; i++) {
  18200. var descriptor = props[i];
  18201. descriptor.enumerable = descriptor.enumerable || false;
  18202. descriptor.configurable = true;
  18203. if ("value" in descriptor) descriptor.writable = true;
  18204. Object.defineProperty(target, descriptor.key, descriptor);
  18205. }
  18206. }
  18207. return function (Constructor, protoProps, staticProps) {
  18208. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  18209. if (staticProps) defineProperties(Constructor, staticProps);
  18210. return Constructor;
  18211. };
  18212. }();
  18213. var _extends = Object.assign || function (target) {
  18214. for (var i = 1; i < arguments.length; i++) {
  18215. var source = arguments[i];
  18216. for (var key in source) {
  18217. if (Object.prototype.hasOwnProperty.call(source, key)) {
  18218. target[key] = source[key];
  18219. }
  18220. }
  18221. }
  18222. return target;
  18223. };
  18224. var inherits = function (subClass, superClass) {
  18225. if (typeof superClass !== "function" && superClass !== null) {
  18226. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  18227. }
  18228. subClass.prototype = Object.create(superClass && superClass.prototype, {
  18229. constructor: {
  18230. value: subClass,
  18231. enumerable: false,
  18232. writable: true,
  18233. configurable: true
  18234. }
  18235. });
  18236. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  18237. };
  18238. var possibleConstructorReturn = function (self, call) {
  18239. if (!self) {
  18240. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  18241. }
  18242. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  18243. };
  18244. var Connector = function () {
  18245. /**
  18246. * Create a new class instance.
  18247. */
  18248. function Connector(options) {
  18249. classCallCheck(this, Connector);
  18250. /**
  18251. * Default connector options.
  18252. */
  18253. this._defaultOptions = {
  18254. auth: {
  18255. headers: {}
  18256. },
  18257. authEndpoint: '/broadcasting/auth',
  18258. broadcaster: 'pusher',
  18259. csrfToken: null,
  18260. host: null,
  18261. key: null,
  18262. namespace: 'App.Events'
  18263. };
  18264. this.setOptions(options);
  18265. this.connect();
  18266. }
  18267. /**
  18268. * Merge the custom options with the defaults.
  18269. */
  18270. createClass(Connector, [{
  18271. key: 'setOptions',
  18272. value: function setOptions(options) {
  18273. this.options = _extends(this._defaultOptions, options);
  18274. if (this.csrfToken()) {
  18275. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  18276. }
  18277. return options;
  18278. }
  18279. /**
  18280. * Extract the CSRF token from the page.
  18281. */
  18282. }, {
  18283. key: 'csrfToken',
  18284. value: function csrfToken() {
  18285. var selector = void 0;
  18286. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  18287. return window['Laravel'].csrfToken;
  18288. } else if (this.options.csrfToken) {
  18289. return this.options.csrfToken;
  18290. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  18291. return selector.getAttribute('content');
  18292. }
  18293. return null;
  18294. }
  18295. }]);
  18296. return Connector;
  18297. }();
  18298. /**
  18299. * This class represents a basic channel.
  18300. */
  18301. var Channel = function () {
  18302. function Channel() {
  18303. classCallCheck(this, Channel);
  18304. }
  18305. createClass(Channel, [{
  18306. key: 'listenForWhisper',
  18307. /**
  18308. * Listen for a whisper event on the channel instance.
  18309. */
  18310. value: function listenForWhisper(event, callback) {
  18311. return this.listen('.client-' + event, callback);
  18312. }
  18313. /**
  18314. * Listen for an event on the channel instance.
  18315. */
  18316. }, {
  18317. key: 'notification',
  18318. value: function notification(callback) {
  18319. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  18320. }
  18321. /**
  18322. * Stop listening for a whispser event on the channel instance.
  18323. */
  18324. }, {
  18325. key: 'stopListeningForWhisper',
  18326. value: function stopListeningForWhisper(event) {
  18327. return this.stopListening('.client-' + event);
  18328. }
  18329. }]);
  18330. return Channel;
  18331. }();
  18332. /**
  18333. * Event name formatter
  18334. */
  18335. var EventFormatter = function () {
  18336. /**
  18337. * Create a new class instance.
  18338. */
  18339. function EventFormatter(namespace) {
  18340. classCallCheck(this, EventFormatter);
  18341. this.setNamespace(namespace);
  18342. }
  18343. /**
  18344. * Format the given event name.
  18345. */
  18346. createClass(EventFormatter, [{
  18347. key: 'format',
  18348. value: function format(event) {
  18349. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  18350. return event.substr(1);
  18351. } else if (this.namespace) {
  18352. event = this.namespace + '.' + event;
  18353. }
  18354. return event.replace(/\./g, '\\');
  18355. }
  18356. /**
  18357. * Set the event namespace.
  18358. */
  18359. }, {
  18360. key: 'setNamespace',
  18361. value: function setNamespace(value) {
  18362. this.namespace = value;
  18363. }
  18364. }]);
  18365. return EventFormatter;
  18366. }();
  18367. /**
  18368. * This class represents a Pusher channel.
  18369. */
  18370. var PusherChannel = function (_Channel) {
  18371. inherits(PusherChannel, _Channel);
  18372. /**
  18373. * Create a new class instance.
  18374. */
  18375. function PusherChannel(pusher, name, options) {
  18376. classCallCheck(this, PusherChannel);
  18377. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  18378. _this.name = name;
  18379. _this.pusher = pusher;
  18380. _this.options = options;
  18381. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  18382. _this.subscribe();
  18383. return _this;
  18384. }
  18385. /**
  18386. * Subscribe to a Pusher channel.
  18387. */
  18388. createClass(PusherChannel, [{
  18389. key: 'subscribe',
  18390. value: function subscribe() {
  18391. this.subscription = this.pusher.subscribe(this.name);
  18392. }
  18393. /**
  18394. * Unsubscribe from a Pusher channel.
  18395. */
  18396. }, {
  18397. key: 'unsubscribe',
  18398. value: function unsubscribe() {
  18399. this.pusher.unsubscribe(this.name);
  18400. }
  18401. /**
  18402. * Listen for an event on the channel instance.
  18403. */
  18404. }, {
  18405. key: 'listen',
  18406. value: function listen(event, callback) {
  18407. this.on(this.eventFormatter.format(event), callback);
  18408. return this;
  18409. }
  18410. /**
  18411. * Stop listening for an event on the channel instance.
  18412. */
  18413. }, {
  18414. key: 'stopListening',
  18415. value: function stopListening(event) {
  18416. this.subscription.unbind(this.eventFormatter.format(event));
  18417. return this;
  18418. }
  18419. /**
  18420. * Bind a channel to an event.
  18421. */
  18422. }, {
  18423. key: 'on',
  18424. value: function on(event, callback) {
  18425. this.subscription.bind(event, callback);
  18426. return this;
  18427. }
  18428. }]);
  18429. return PusherChannel;
  18430. }(Channel);
  18431. /**
  18432. * This class represents a Pusher private channel.
  18433. */
  18434. var PusherPrivateChannel = function (_PusherChannel) {
  18435. inherits(PusherPrivateChannel, _PusherChannel);
  18436. function PusherPrivateChannel() {
  18437. classCallCheck(this, PusherPrivateChannel);
  18438. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  18439. }
  18440. createClass(PusherPrivateChannel, [{
  18441. key: 'whisper',
  18442. /**
  18443. * Trigger client event on the channel.
  18444. */
  18445. value: function whisper(eventName, data) {
  18446. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18447. return this;
  18448. }
  18449. }]);
  18450. return PusherPrivateChannel;
  18451. }(PusherChannel);
  18452. /**
  18453. * This class represents a Pusher presence channel.
  18454. */
  18455. var PusherPresenceChannel = function (_PusherChannel) {
  18456. inherits(PusherPresenceChannel, _PusherChannel);
  18457. function PusherPresenceChannel() {
  18458. classCallCheck(this, PusherPresenceChannel);
  18459. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  18460. }
  18461. createClass(PusherPresenceChannel, [{
  18462. key: 'here',
  18463. /**
  18464. * Register a callback to be called anytime the member list changes.
  18465. */
  18466. value: function here(callback) {
  18467. this.on('pusher:subscription_succeeded', function (data) {
  18468. callback(Object.keys(data.members).map(function (k) {
  18469. return data.members[k];
  18470. }));
  18471. });
  18472. return this;
  18473. }
  18474. /**
  18475. * Listen for someone joining the channel.
  18476. */
  18477. }, {
  18478. key: 'joining',
  18479. value: function joining(callback) {
  18480. this.on('pusher:member_added', function (member) {
  18481. callback(member.info);
  18482. });
  18483. return this;
  18484. }
  18485. /**
  18486. * Listen for someone leaving the channel.
  18487. */
  18488. }, {
  18489. key: 'leaving',
  18490. value: function leaving(callback) {
  18491. this.on('pusher:member_removed', function (member) {
  18492. callback(member.info);
  18493. });
  18494. return this;
  18495. }
  18496. /**
  18497. * Trigger client event on the channel.
  18498. */
  18499. }, {
  18500. key: 'whisper',
  18501. value: function whisper(eventName, data) {
  18502. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18503. return this;
  18504. }
  18505. }]);
  18506. return PusherPresenceChannel;
  18507. }(PusherChannel);
  18508. /**
  18509. * This class represents a Socket.io channel.
  18510. */
  18511. var SocketIoChannel = function (_Channel) {
  18512. inherits(SocketIoChannel, _Channel);
  18513. /**
  18514. * Create a new class instance.
  18515. */
  18516. function SocketIoChannel(socket, name, options) {
  18517. classCallCheck(this, SocketIoChannel);
  18518. /**
  18519. * The event callbacks applied to the channel.
  18520. */
  18521. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  18522. _this.events = {};
  18523. _this.name = name;
  18524. _this.socket = socket;
  18525. _this.options = options;
  18526. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  18527. _this.subscribe();
  18528. _this.configureReconnector();
  18529. return _this;
  18530. }
  18531. /**
  18532. * Subscribe to a Socket.io channel.
  18533. */
  18534. createClass(SocketIoChannel, [{
  18535. key: 'subscribe',
  18536. value: function subscribe() {
  18537. this.socket.emit('subscribe', {
  18538. channel: this.name,
  18539. auth: this.options.auth || {}
  18540. });
  18541. }
  18542. /**
  18543. * Unsubscribe from channel and ubind event callbacks.
  18544. */
  18545. }, {
  18546. key: 'unsubscribe',
  18547. value: function unsubscribe() {
  18548. this.unbind();
  18549. this.socket.emit('unsubscribe', {
  18550. channel: this.name,
  18551. auth: this.options.auth || {}
  18552. });
  18553. }
  18554. /**
  18555. * Listen for an event on the channel instance.
  18556. */
  18557. }, {
  18558. key: 'listen',
  18559. value: function listen(event, callback) {
  18560. this.on(this.eventFormatter.format(event), callback);
  18561. return this;
  18562. }
  18563. /**
  18564. * Stop listening for an event on the channel instance.
  18565. */
  18566. }, {
  18567. key: 'stopListening',
  18568. value: function stopListening(event) {
  18569. var name = this.eventFormatter.format(event);
  18570. this.socket.removeListener(name);
  18571. delete this.events[name];
  18572. return this;
  18573. }
  18574. /**
  18575. * Bind the channel's socket to an event and store the callback.
  18576. */
  18577. }, {
  18578. key: 'on',
  18579. value: function on(event, callback) {
  18580. var _this2 = this;
  18581. var listener = function listener(channel, data) {
  18582. if (_this2.name == channel) {
  18583. callback(data);
  18584. }
  18585. };
  18586. this.socket.on(event, listener);
  18587. this.bind(event, listener);
  18588. }
  18589. /**
  18590. * Attach a 'reconnect' listener and bind the event.
  18591. */
  18592. }, {
  18593. key: 'configureReconnector',
  18594. value: function configureReconnector() {
  18595. var _this3 = this;
  18596. var listener = function listener() {
  18597. _this3.subscribe();
  18598. };
  18599. this.socket.on('reconnect', listener);
  18600. this.bind('reconnect', listener);
  18601. }
  18602. /**
  18603. * Bind the channel's socket to an event and store the callback.
  18604. */
  18605. }, {
  18606. key: 'bind',
  18607. value: function bind(event, callback) {
  18608. this.events[event] = this.events[event] || [];
  18609. this.events[event].push(callback);
  18610. }
  18611. /**
  18612. * Unbind the channel's socket from all stored event callbacks.
  18613. */
  18614. }, {
  18615. key: 'unbind',
  18616. value: function unbind() {
  18617. var _this4 = this;
  18618. Object.keys(this.events).forEach(function (event) {
  18619. _this4.events[event].forEach(function (callback) {
  18620. _this4.socket.removeListener(event, callback);
  18621. });
  18622. delete _this4.events[event];
  18623. });
  18624. }
  18625. }]);
  18626. return SocketIoChannel;
  18627. }(Channel);
  18628. /**
  18629. * This class represents a Socket.io presence channel.
  18630. */
  18631. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  18632. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  18633. function SocketIoPrivateChannel() {
  18634. classCallCheck(this, SocketIoPrivateChannel);
  18635. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  18636. }
  18637. createClass(SocketIoPrivateChannel, [{
  18638. key: 'whisper',
  18639. /**
  18640. * Trigger client event on the channel.
  18641. */
  18642. value: function whisper(eventName, data) {
  18643. this.socket.emit('client event', {
  18644. channel: this.name,
  18645. event: 'client-' + eventName,
  18646. data: data
  18647. });
  18648. return this;
  18649. }
  18650. }]);
  18651. return SocketIoPrivateChannel;
  18652. }(SocketIoChannel);
  18653. /**
  18654. * This class represents a Socket.io presence channel.
  18655. */
  18656. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  18657. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  18658. function SocketIoPresenceChannel() {
  18659. classCallCheck(this, SocketIoPresenceChannel);
  18660. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  18661. }
  18662. createClass(SocketIoPresenceChannel, [{
  18663. key: 'here',
  18664. /**
  18665. * Register a callback to be called anytime the member list changes.
  18666. */
  18667. value: function here(callback) {
  18668. this.on('presence:subscribed', function (members) {
  18669. callback(members.map(function (m) {
  18670. return m.user_info;
  18671. }));
  18672. });
  18673. return this;
  18674. }
  18675. /**
  18676. * Listen for someone joining the channel.
  18677. */
  18678. }, {
  18679. key: 'joining',
  18680. value: function joining(callback) {
  18681. this.on('presence:joining', function (member) {
  18682. return callback(member.user_info);
  18683. });
  18684. return this;
  18685. }
  18686. /**
  18687. * Listen for someone leaving the channel.
  18688. */
  18689. }, {
  18690. key: 'leaving',
  18691. value: function leaving(callback) {
  18692. this.on('presence:leaving', function (member) {
  18693. return callback(member.user_info);
  18694. });
  18695. return this;
  18696. }
  18697. }]);
  18698. return SocketIoPresenceChannel;
  18699. }(SocketIoPrivateChannel);
  18700. /**
  18701. * This class represents a null channel.
  18702. */
  18703. var NullChannel = function (_Channel) {
  18704. inherits(NullChannel, _Channel);
  18705. function NullChannel() {
  18706. classCallCheck(this, NullChannel);
  18707. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  18708. }
  18709. createClass(NullChannel, [{
  18710. key: 'subscribe',
  18711. /**
  18712. * Subscribe to a channel.
  18713. */
  18714. value: function subscribe() {}
  18715. //
  18716. /**
  18717. * Unsubscribe from a channel.
  18718. */
  18719. }, {
  18720. key: 'unsubscribe',
  18721. value: function unsubscribe() {}
  18722. //
  18723. /**
  18724. * Listen for an event on the channel instance.
  18725. */
  18726. }, {
  18727. key: 'listen',
  18728. value: function listen(event, callback) {
  18729. return this;
  18730. }
  18731. /**
  18732. * Stop listening for an event on the channel instance.
  18733. */
  18734. }, {
  18735. key: 'stopListening',
  18736. value: function stopListening(event) {
  18737. return this;
  18738. }
  18739. /**
  18740. * Bind a channel to an event.
  18741. */
  18742. }, {
  18743. key: 'on',
  18744. value: function on(event, callback) {
  18745. return this;
  18746. }
  18747. }]);
  18748. return NullChannel;
  18749. }(Channel);
  18750. /**
  18751. * This class represents a null private channel.
  18752. */
  18753. var NullPrivateChannel = function (_NullChannel) {
  18754. inherits(NullPrivateChannel, _NullChannel);
  18755. function NullPrivateChannel() {
  18756. classCallCheck(this, NullPrivateChannel);
  18757. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  18758. }
  18759. createClass(NullPrivateChannel, [{
  18760. key: 'whisper',
  18761. /**
  18762. * Trigger client event on the channel.
  18763. */
  18764. value: function whisper(eventName, data) {
  18765. return this;
  18766. }
  18767. }]);
  18768. return NullPrivateChannel;
  18769. }(NullChannel);
  18770. /**
  18771. * This class represents a null presence channel.
  18772. */
  18773. var NullPresenceChannel = function (_NullChannel) {
  18774. inherits(NullPresenceChannel, _NullChannel);
  18775. function NullPresenceChannel() {
  18776. classCallCheck(this, NullPresenceChannel);
  18777. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  18778. }
  18779. createClass(NullPresenceChannel, [{
  18780. key: 'here',
  18781. /**
  18782. * Register a callback to be called anytime the member list changes.
  18783. */
  18784. value: function here(callback) {
  18785. return this;
  18786. }
  18787. /**
  18788. * Listen for someone joining the channel.
  18789. */
  18790. }, {
  18791. key: 'joining',
  18792. value: function joining(callback) {
  18793. return this;
  18794. }
  18795. /**
  18796. * Listen for someone leaving the channel.
  18797. */
  18798. }, {
  18799. key: 'leaving',
  18800. value: function leaving(callback) {
  18801. return this;
  18802. }
  18803. /**
  18804. * Trigger client event on the channel.
  18805. */
  18806. }, {
  18807. key: 'whisper',
  18808. value: function whisper(eventName, data) {
  18809. return this;
  18810. }
  18811. }]);
  18812. return NullPresenceChannel;
  18813. }(NullChannel);
  18814. /**
  18815. * This class creates a connector to Pusher.
  18816. */
  18817. var PusherConnector = function (_Connector) {
  18818. inherits(PusherConnector, _Connector);
  18819. function PusherConnector() {
  18820. classCallCheck(this, PusherConnector);
  18821. /**
  18822. * All of the subscribed channel names.
  18823. */
  18824. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  18825. _this.channels = {};
  18826. return _this;
  18827. }
  18828. /**
  18829. * Create a fresh Pusher connection.
  18830. */
  18831. createClass(PusherConnector, [{
  18832. key: 'connect',
  18833. value: function connect() {
  18834. if (typeof this.options.client !== 'undefined') {
  18835. this.pusher = this.options.client;
  18836. } else {
  18837. this.pusher = new Pusher(this.options.key, this.options);
  18838. }
  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 PusherChannel(this.pusher, 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 PusherPrivateChannel(this.pusher, '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 PusherPresenceChannel(this.pusher, '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, index) {
  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.pusher.connection.socket_id;
  18911. }
  18912. /**
  18913. * Disconnect Pusher connection.
  18914. */
  18915. }, {
  18916. key: 'disconnect',
  18917. value: function disconnect() {
  18918. this.pusher.disconnect();
  18919. }
  18920. }]);
  18921. return PusherConnector;
  18922. }(Connector);
  18923. /**
  18924. * This class creates a connnector to a Socket.io server.
  18925. */
  18926. var SocketIoConnector = function (_Connector) {
  18927. inherits(SocketIoConnector, _Connector);
  18928. function SocketIoConnector() {
  18929. classCallCheck(this, SocketIoConnector);
  18930. /**
  18931. * All of the subscribed channel names.
  18932. */
  18933. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18934. _this.channels = {};
  18935. return _this;
  18936. }
  18937. /**
  18938. * Create a fresh Socket.io connection.
  18939. */
  18940. createClass(SocketIoConnector, [{
  18941. key: 'connect',
  18942. value: function connect() {
  18943. var io = this.getSocketIO();
  18944. this.socket = io(this.options.host, this.options);
  18945. return this.socket;
  18946. }
  18947. /**
  18948. * Get socket.io module from global scope or options.
  18949. */
  18950. }, {
  18951. key: 'getSocketIO',
  18952. value: function getSocketIO() {
  18953. if (typeof this.options.client !== 'undefined') {
  18954. return this.options.client;
  18955. }
  18956. if (typeof io !== 'undefined') {
  18957. return io;
  18958. }
  18959. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18960. }
  18961. /**
  18962. * Listen for an event on a channel instance.
  18963. */
  18964. }, {
  18965. key: 'listen',
  18966. value: function listen(name, event, callback) {
  18967. return this.channel(name).listen(event, callback);
  18968. }
  18969. /**
  18970. * Get a channel instance by name.
  18971. */
  18972. }, {
  18973. key: 'channel',
  18974. value: function channel(name) {
  18975. if (!this.channels[name]) {
  18976. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18977. }
  18978. return this.channels[name];
  18979. }
  18980. /**
  18981. * Get a private channel instance by name.
  18982. */
  18983. }, {
  18984. key: 'privateChannel',
  18985. value: function privateChannel(name) {
  18986. if (!this.channels['private-' + name]) {
  18987. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18988. }
  18989. return this.channels['private-' + name];
  18990. }
  18991. /**
  18992. * Get a presence channel instance by name.
  18993. */
  18994. }, {
  18995. key: 'presenceChannel',
  18996. value: function presenceChannel(name) {
  18997. if (!this.channels['presence-' + name]) {
  18998. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18999. }
  19000. return this.channels['presence-' + name];
  19001. }
  19002. /**
  19003. * Leave the given channel, as well as its private and presence variants.
  19004. */
  19005. }, {
  19006. key: 'leave',
  19007. value: function leave(name) {
  19008. var _this2 = this;
  19009. var channels = [name, 'private-' + name, 'presence-' + name];
  19010. channels.forEach(function (name) {
  19011. _this2.leaveChannel(name);
  19012. });
  19013. }
  19014. /**
  19015. * Leave the given channel.
  19016. */
  19017. }, {
  19018. key: 'leaveChannel',
  19019. value: function leaveChannel(name) {
  19020. if (this.channels[name]) {
  19021. this.channels[name].unsubscribe();
  19022. delete this.channels[name];
  19023. }
  19024. }
  19025. /**
  19026. * Get the socket ID for the connection.
  19027. */
  19028. }, {
  19029. key: 'socketId',
  19030. value: function socketId() {
  19031. return this.socket.id;
  19032. }
  19033. /**
  19034. * Disconnect Socketio connection.
  19035. */
  19036. }, {
  19037. key: 'disconnect',
  19038. value: function disconnect() {
  19039. this.socket.disconnect();
  19040. }
  19041. }]);
  19042. return SocketIoConnector;
  19043. }(Connector);
  19044. /**
  19045. * This class creates a null connector.
  19046. */
  19047. var NullConnector = function (_Connector) {
  19048. inherits(NullConnector, _Connector);
  19049. function NullConnector() {
  19050. classCallCheck(this, NullConnector);
  19051. /**
  19052. * All of the subscribed channel names.
  19053. */
  19054. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  19055. _this.channels = {};
  19056. return _this;
  19057. }
  19058. /**
  19059. * Create a fresh connection.
  19060. */
  19061. createClass(NullConnector, [{
  19062. key: 'connect',
  19063. value: function connect() {}
  19064. //
  19065. /**
  19066. * Listen for an event on a channel instance.
  19067. */
  19068. }, {
  19069. key: 'listen',
  19070. value: function listen(name, event, callback) {
  19071. return new NullChannel();
  19072. }
  19073. /**
  19074. * Get a channel instance by name.
  19075. */
  19076. }, {
  19077. key: 'channel',
  19078. value: function channel(name) {
  19079. return new NullChannel();
  19080. }
  19081. /**
  19082. * Get a private channel instance by name.
  19083. */
  19084. }, {
  19085. key: 'privateChannel',
  19086. value: function privateChannel(name) {
  19087. return new NullPrivateChannel();
  19088. }
  19089. /**
  19090. * Get a presence channel instance by name.
  19091. */
  19092. }, {
  19093. key: 'presenceChannel',
  19094. value: function presenceChannel(name) {
  19095. return new NullPresenceChannel();
  19096. }
  19097. /**
  19098. * Leave the given channel, as well as its private and presence variants.
  19099. */
  19100. }, {
  19101. key: 'leave',
  19102. value: function leave(name) {}
  19103. //
  19104. /**
  19105. * Leave the given channel.
  19106. */
  19107. }, {
  19108. key: 'leaveChannel',
  19109. value: function leaveChannel(name) {}
  19110. //
  19111. /**
  19112. * Get the socket ID for the connection.
  19113. */
  19114. }, {
  19115. key: 'socketId',
  19116. value: function socketId() {
  19117. return 'fake-socket-id';
  19118. }
  19119. /**
  19120. * Disconnect the connection.
  19121. */
  19122. }, {
  19123. key: 'disconnect',
  19124. value: function disconnect() {
  19125. //
  19126. }
  19127. }]);
  19128. return NullConnector;
  19129. }(Connector);
  19130. /**
  19131. * This class is the primary API for interacting with broadcasting.
  19132. */
  19133. var Echo = function () {
  19134. /**
  19135. * Create a new class instance.
  19136. */
  19137. function Echo(options) {
  19138. classCallCheck(this, Echo);
  19139. this.options = options;
  19140. this.connect();
  19141. if (!this.options.withoutInterceptors) {
  19142. this.registerInterceptors();
  19143. }
  19144. }
  19145. /**
  19146. * Get a channel instance by name.
  19147. */
  19148. createClass(Echo, [{
  19149. key: 'channel',
  19150. value: function channel(_channel) {
  19151. return this.connector.channel(_channel);
  19152. }
  19153. /**
  19154. * Create a new connection.
  19155. */
  19156. }, {
  19157. key: 'connect',
  19158. value: function connect() {
  19159. if (this.options.broadcaster == 'pusher') {
  19160. this.connector = new PusherConnector(this.options);
  19161. } else if (this.options.broadcaster == 'socket.io') {
  19162. this.connector = new SocketIoConnector(this.options);
  19163. } else if (this.options.broadcaster == 'null') {
  19164. this.connector = new NullConnector(this.options);
  19165. } else if (typeof this.options.broadcaster == 'function') {
  19166. this.connector = new this.options.broadcaster(this.options);
  19167. }
  19168. }
  19169. /**
  19170. * Disconnect from the Echo server.
  19171. */
  19172. }, {
  19173. key: 'disconnect',
  19174. value: function disconnect() {
  19175. this.connector.disconnect();
  19176. }
  19177. /**
  19178. * Get a presence channel instance by name.
  19179. */
  19180. }, {
  19181. key: 'join',
  19182. value: function join(channel) {
  19183. return this.connector.presenceChannel(channel);
  19184. }
  19185. /**
  19186. * Leave the given channel, as well as its private and presence variants.
  19187. */
  19188. }, {
  19189. key: 'leave',
  19190. value: function leave(channel) {
  19191. this.connector.leave(channel);
  19192. }
  19193. /**
  19194. * Leave the given channel.
  19195. */
  19196. }, {
  19197. key: 'leaveChannel',
  19198. value: function leaveChannel(channel) {
  19199. this.connector.leaveChannel(channel);
  19200. }
  19201. /**
  19202. * Listen for an event on a channel instance.
  19203. */
  19204. }, {
  19205. key: 'listen',
  19206. value: function listen(channel, event, callback) {
  19207. return this.connector.listen(channel, event, callback);
  19208. }
  19209. /**
  19210. * Get a private channel instance by name.
  19211. */
  19212. }, {
  19213. key: 'private',
  19214. value: function _private(channel) {
  19215. return this.connector.privateChannel(channel);
  19216. }
  19217. /**
  19218. * Get the Socket ID for the connection.
  19219. */
  19220. }, {
  19221. key: 'socketId',
  19222. value: function socketId() {
  19223. return this.connector.socketId();
  19224. }
  19225. /**
  19226. * Register 3rd party request interceptiors. These are used to automatically
  19227. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  19228. */
  19229. }, {
  19230. key: 'registerInterceptors',
  19231. value: function registerInterceptors() {
  19232. if (typeof Vue === 'function' && Vue.http) {
  19233. this.registerVueRequestInterceptor();
  19234. }
  19235. if (typeof axios === 'function') {
  19236. this.registerAxiosRequestInterceptor();
  19237. }
  19238. if (typeof jQuery === 'function') {
  19239. this.registerjQueryAjaxSetup();
  19240. }
  19241. }
  19242. /**
  19243. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  19244. */
  19245. }, {
  19246. key: 'registerVueRequestInterceptor',
  19247. value: function registerVueRequestInterceptor() {
  19248. var _this = this;
  19249. Vue.http.interceptors.push(function (request, next) {
  19250. if (_this.socketId()) {
  19251. request.headers.set('X-Socket-ID', _this.socketId());
  19252. }
  19253. next();
  19254. });
  19255. }
  19256. /**
  19257. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  19258. */
  19259. }, {
  19260. key: 'registerAxiosRequestInterceptor',
  19261. value: function registerAxiosRequestInterceptor() {
  19262. var _this2 = this;
  19263. axios.interceptors.request.use(function (config) {
  19264. if (_this2.socketId()) {
  19265. config.headers['X-Socket-Id'] = _this2.socketId();
  19266. }
  19267. return config;
  19268. });
  19269. }
  19270. /**
  19271. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  19272. */
  19273. }, {
  19274. key: 'registerjQueryAjaxSetup',
  19275. value: function registerjQueryAjaxSetup() {
  19276. var _this3 = this;
  19277. if (typeof jQuery.ajax != 'undefined') {
  19278. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  19279. if (_this3.socketId()) {
  19280. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  19281. }
  19282. });
  19283. }
  19284. }
  19285. }]);
  19286. return Echo;
  19287. }();
  19288. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  19289. /***/ }),
  19290. /***/ "./node_modules/lodash/lodash.js":
  19291. /*!***************************************!*\
  19292. !*** ./node_modules/lodash/lodash.js ***!
  19293. \***************************************/
  19294. /*! no static exports found */
  19295. /***/ (function(module, exports, __webpack_require__) {
  19296. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  19297. * @license
  19298. * Lodash <https://lodash.com/>
  19299. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  19300. * Released under MIT license <https://lodash.com/license>
  19301. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  19302. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  19303. */
  19304. ;(function() {
  19305. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  19306. var undefined;
  19307. /** Used as the semantic version number. */
  19308. var VERSION = '4.17.15';
  19309. /** Used as the size to enable large array optimizations. */
  19310. var LARGE_ARRAY_SIZE = 200;
  19311. /** Error message constants. */
  19312. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  19313. FUNC_ERROR_TEXT = 'Expected a function';
  19314. /** Used to stand-in for `undefined` hash values. */
  19315. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  19316. /** Used as the maximum memoize cache size. */
  19317. var MAX_MEMOIZE_SIZE = 500;
  19318. /** Used as the internal argument placeholder. */
  19319. var PLACEHOLDER = '__lodash_placeholder__';
  19320. /** Used to compose bitmasks for cloning. */
  19321. var CLONE_DEEP_FLAG = 1,
  19322. CLONE_FLAT_FLAG = 2,
  19323. CLONE_SYMBOLS_FLAG = 4;
  19324. /** Used to compose bitmasks for value comparisons. */
  19325. var COMPARE_PARTIAL_FLAG = 1,
  19326. COMPARE_UNORDERED_FLAG = 2;
  19327. /** Used to compose bitmasks for function metadata. */
  19328. var WRAP_BIND_FLAG = 1,
  19329. WRAP_BIND_KEY_FLAG = 2,
  19330. WRAP_CURRY_BOUND_FLAG = 4,
  19331. WRAP_CURRY_FLAG = 8,
  19332. WRAP_CURRY_RIGHT_FLAG = 16,
  19333. WRAP_PARTIAL_FLAG = 32,
  19334. WRAP_PARTIAL_RIGHT_FLAG = 64,
  19335. WRAP_ARY_FLAG = 128,
  19336. WRAP_REARG_FLAG = 256,
  19337. WRAP_FLIP_FLAG = 512;
  19338. /** Used as default options for `_.truncate`. */
  19339. var DEFAULT_TRUNC_LENGTH = 30,
  19340. DEFAULT_TRUNC_OMISSION = '...';
  19341. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  19342. var HOT_COUNT = 800,
  19343. HOT_SPAN = 16;
  19344. /** Used to indicate the type of lazy iteratees. */
  19345. var LAZY_FILTER_FLAG = 1,
  19346. LAZY_MAP_FLAG = 2,
  19347. LAZY_WHILE_FLAG = 3;
  19348. /** Used as references for various `Number` constants. */
  19349. var INFINITY = 1 / 0,
  19350. MAX_SAFE_INTEGER = 9007199254740991,
  19351. MAX_INTEGER = 1.7976931348623157e+308,
  19352. NAN = 0 / 0;
  19353. /** Used as references for the maximum length and index of an array. */
  19354. var MAX_ARRAY_LENGTH = 4294967295,
  19355. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  19356. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  19357. /** Used to associate wrap methods with their bit flags. */
  19358. var wrapFlags = [
  19359. ['ary', WRAP_ARY_FLAG],
  19360. ['bind', WRAP_BIND_FLAG],
  19361. ['bindKey', WRAP_BIND_KEY_FLAG],
  19362. ['curry', WRAP_CURRY_FLAG],
  19363. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  19364. ['flip', WRAP_FLIP_FLAG],
  19365. ['partial', WRAP_PARTIAL_FLAG],
  19366. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  19367. ['rearg', WRAP_REARG_FLAG]
  19368. ];
  19369. /** `Object#toString` result references. */
  19370. var argsTag = '[object Arguments]',
  19371. arrayTag = '[object Array]',
  19372. asyncTag = '[object AsyncFunction]',
  19373. boolTag = '[object Boolean]',
  19374. dateTag = '[object Date]',
  19375. domExcTag = '[object DOMException]',
  19376. errorTag = '[object Error]',
  19377. funcTag = '[object Function]',
  19378. genTag = '[object GeneratorFunction]',
  19379. mapTag = '[object Map]',
  19380. numberTag = '[object Number]',
  19381. nullTag = '[object Null]',
  19382. objectTag = '[object Object]',
  19383. promiseTag = '[object Promise]',
  19384. proxyTag = '[object Proxy]',
  19385. regexpTag = '[object RegExp]',
  19386. setTag = '[object Set]',
  19387. stringTag = '[object String]',
  19388. symbolTag = '[object Symbol]',
  19389. undefinedTag = '[object Undefined]',
  19390. weakMapTag = '[object WeakMap]',
  19391. weakSetTag = '[object WeakSet]';
  19392. var arrayBufferTag = '[object ArrayBuffer]',
  19393. dataViewTag = '[object DataView]',
  19394. float32Tag = '[object Float32Array]',
  19395. float64Tag = '[object Float64Array]',
  19396. int8Tag = '[object Int8Array]',
  19397. int16Tag = '[object Int16Array]',
  19398. int32Tag = '[object Int32Array]',
  19399. uint8Tag = '[object Uint8Array]',
  19400. uint8ClampedTag = '[object Uint8ClampedArray]',
  19401. uint16Tag = '[object Uint16Array]',
  19402. uint32Tag = '[object Uint32Array]';
  19403. /** Used to match empty string literals in compiled template source. */
  19404. var reEmptyStringLeading = /\b__p \+= '';/g,
  19405. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  19406. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  19407. /** Used to match HTML entities and HTML characters. */
  19408. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  19409. reUnescapedHtml = /[&<>"']/g,
  19410. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  19411. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  19412. /** Used to match template delimiters. */
  19413. var reEscape = /<%-([\s\S]+?)%>/g,
  19414. reEvaluate = /<%([\s\S]+?)%>/g,
  19415. reInterpolate = /<%=([\s\S]+?)%>/g;
  19416. /** Used to match property names within property paths. */
  19417. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  19418. reIsPlainProp = /^\w*$/,
  19419. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  19420. /**
  19421. * Used to match `RegExp`
  19422. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  19423. */
  19424. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  19425. reHasRegExpChar = RegExp(reRegExpChar.source);
  19426. /** Used to match leading and trailing whitespace. */
  19427. var reTrim = /^\s+|\s+$/g,
  19428. reTrimStart = /^\s+/,
  19429. reTrimEnd = /\s+$/;
  19430. /** Used to match wrap detail comments. */
  19431. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  19432. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  19433. reSplitDetails = /,? & /;
  19434. /** Used to match words composed of alphanumeric characters. */
  19435. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  19436. /** Used to match backslashes in property paths. */
  19437. var reEscapeChar = /\\(\\)?/g;
  19438. /**
  19439. * Used to match
  19440. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  19441. */
  19442. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  19443. /** Used to match `RegExp` flags from their coerced string values. */
  19444. var reFlags = /\w*$/;
  19445. /** Used to detect bad signed hexadecimal string values. */
  19446. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  19447. /** Used to detect binary string values. */
  19448. var reIsBinary = /^0b[01]+$/i;
  19449. /** Used to detect host constructors (Safari). */
  19450. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  19451. /** Used to detect octal string values. */
  19452. var reIsOctal = /^0o[0-7]+$/i;
  19453. /** Used to detect unsigned integer values. */
  19454. var reIsUint = /^(?:0|[1-9]\d*)$/;
  19455. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  19456. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  19457. /** Used to ensure capturing order of template delimiters. */
  19458. var reNoMatch = /($^)/;
  19459. /** Used to match unescaped characters in compiled string literals. */
  19460. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  19461. /** Used to compose unicode character classes. */
  19462. var rsAstralRange = '\\ud800-\\udfff',
  19463. rsComboMarksRange = '\\u0300-\\u036f',
  19464. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  19465. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  19466. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  19467. rsDingbatRange = '\\u2700-\\u27bf',
  19468. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  19469. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  19470. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  19471. rsPunctuationRange = '\\u2000-\\u206f',
  19472. 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',
  19473. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  19474. rsVarRange = '\\ufe0e\\ufe0f',
  19475. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  19476. /** Used to compose unicode capture groups. */
  19477. var rsApos = "['\u2019]",
  19478. rsAstral = '[' + rsAstralRange + ']',
  19479. rsBreak = '[' + rsBreakRange + ']',
  19480. rsCombo = '[' + rsComboRange + ']',
  19481. rsDigits = '\\d+',
  19482. rsDingbat = '[' + rsDingbatRange + ']',
  19483. rsLower = '[' + rsLowerRange + ']',
  19484. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  19485. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  19486. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  19487. rsNonAstral = '[^' + rsAstralRange + ']',
  19488. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  19489. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  19490. rsUpper = '[' + rsUpperRange + ']',
  19491. rsZWJ = '\\u200d';
  19492. /** Used to compose unicode regexes. */
  19493. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  19494. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  19495. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  19496. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  19497. reOptMod = rsModifier + '?',
  19498. rsOptVar = '[' + rsVarRange + ']?',
  19499. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  19500. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  19501. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  19502. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  19503. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  19504. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  19505. /** Used to match apostrophes. */
  19506. var reApos = RegExp(rsApos, 'g');
  19507. /**
  19508. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  19509. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  19510. */
  19511. var reComboMark = RegExp(rsCombo, 'g');
  19512. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  19513. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  19514. /** Used to match complex or compound words. */
  19515. var reUnicodeWord = RegExp([
  19516. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  19517. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  19518. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  19519. rsUpper + '+' + rsOptContrUpper,
  19520. rsOrdUpper,
  19521. rsOrdLower,
  19522. rsDigits,
  19523. rsEmoji
  19524. ].join('|'), 'g');
  19525. /** 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/). */
  19526. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  19527. /** Used to detect strings that need a more robust regexp to match words. */
  19528. 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 ]/;
  19529. /** Used to assign default `context` object properties. */
  19530. var contextProps = [
  19531. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  19532. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  19533. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  19534. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  19535. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  19536. ];
  19537. /** Used to make template sourceURLs easier to identify. */
  19538. var templateCounter = -1;
  19539. /** Used to identify `toStringTag` values of typed arrays. */
  19540. var typedArrayTags = {};
  19541. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  19542. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  19543. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  19544. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  19545. typedArrayTags[uint32Tag] = true;
  19546. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  19547. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  19548. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  19549. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  19550. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  19551. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  19552. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  19553. typedArrayTags[weakMapTag] = false;
  19554. /** Used to identify `toStringTag` values supported by `_.clone`. */
  19555. var cloneableTags = {};
  19556. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  19557. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  19558. cloneableTags[boolTag] = cloneableTags[dateTag] =
  19559. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  19560. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  19561. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  19562. cloneableTags[numberTag] = cloneableTags[objectTag] =
  19563. cloneableTags[regexpTag] = cloneableTags[setTag] =
  19564. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  19565. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  19566. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  19567. cloneableTags[errorTag] = cloneableTags[funcTag] =
  19568. cloneableTags[weakMapTag] = false;
  19569. /** Used to map Latin Unicode letters to basic Latin letters. */
  19570. var deburredLetters = {
  19571. // Latin-1 Supplement block.
  19572. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  19573. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  19574. '\xc7': 'C', '\xe7': 'c',
  19575. '\xd0': 'D', '\xf0': 'd',
  19576. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  19577. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  19578. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  19579. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  19580. '\xd1': 'N', '\xf1': 'n',
  19581. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  19582. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  19583. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  19584. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  19585. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  19586. '\xc6': 'Ae', '\xe6': 'ae',
  19587. '\xde': 'Th', '\xfe': 'th',
  19588. '\xdf': 'ss',
  19589. // Latin Extended-A block.
  19590. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  19591. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  19592. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  19593. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  19594. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  19595. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  19596. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  19597. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  19598. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  19599. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  19600. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  19601. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  19602. '\u0134': 'J', '\u0135': 'j',
  19603. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  19604. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  19605. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  19606. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  19607. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  19608. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  19609. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  19610. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  19611. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  19612. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  19613. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  19614. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  19615. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  19616. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  19617. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  19618. '\u0174': 'W', '\u0175': 'w',
  19619. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  19620. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  19621. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  19622. '\u0132': 'IJ', '\u0133': 'ij',
  19623. '\u0152': 'Oe', '\u0153': 'oe',
  19624. '\u0149': "'n", '\u017f': 's'
  19625. };
  19626. /** Used to map characters to HTML entities. */
  19627. var htmlEscapes = {
  19628. '&': '&amp;',
  19629. '<': '&lt;',
  19630. '>': '&gt;',
  19631. '"': '&quot;',
  19632. "'": '&#39;'
  19633. };
  19634. /** Used to map HTML entities to characters. */
  19635. var htmlUnescapes = {
  19636. '&amp;': '&',
  19637. '&lt;': '<',
  19638. '&gt;': '>',
  19639. '&quot;': '"',
  19640. '&#39;': "'"
  19641. };
  19642. /** Used to escape characters for inclusion in compiled string literals. */
  19643. var stringEscapes = {
  19644. '\\': '\\',
  19645. "'": "'",
  19646. '\n': 'n',
  19647. '\r': 'r',
  19648. '\u2028': 'u2028',
  19649. '\u2029': 'u2029'
  19650. };
  19651. /** Built-in method references without a dependency on `root`. */
  19652. var freeParseFloat = parseFloat,
  19653. freeParseInt = parseInt;
  19654. /** Detect free variable `global` from Node.js. */
  19655. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  19656. /** Detect free variable `self`. */
  19657. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  19658. /** Used as a reference to the global object. */
  19659. var root = freeGlobal || freeSelf || Function('return this')();
  19660. /** Detect free variable `exports`. */
  19661. var freeExports = true && exports && !exports.nodeType && exports;
  19662. /** Detect free variable `module`. */
  19663. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  19664. /** Detect the popular CommonJS extension `module.exports`. */
  19665. var moduleExports = freeModule && freeModule.exports === freeExports;
  19666. /** Detect free variable `process` from Node.js. */
  19667. var freeProcess = moduleExports && freeGlobal.process;
  19668. /** Used to access faster Node.js helpers. */
  19669. var nodeUtil = (function() {
  19670. try {
  19671. // Use `util.types` for Node.js 10+.
  19672. var types = freeModule && freeModule.require && freeModule.require('util').types;
  19673. if (types) {
  19674. return types;
  19675. }
  19676. // Legacy `process.binding('util')` for Node.js < 10.
  19677. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  19678. } catch (e) {}
  19679. }());
  19680. /* Node.js helper references. */
  19681. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  19682. nodeIsDate = nodeUtil && nodeUtil.isDate,
  19683. nodeIsMap = nodeUtil && nodeUtil.isMap,
  19684. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  19685. nodeIsSet = nodeUtil && nodeUtil.isSet,
  19686. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  19687. /*--------------------------------------------------------------------------*/
  19688. /**
  19689. * A faster alternative to `Function#apply`, this function invokes `func`
  19690. * with the `this` binding of `thisArg` and the arguments of `args`.
  19691. *
  19692. * @private
  19693. * @param {Function} func The function to invoke.
  19694. * @param {*} thisArg The `this` binding of `func`.
  19695. * @param {Array} args The arguments to invoke `func` with.
  19696. * @returns {*} Returns the result of `func`.
  19697. */
  19698. function apply(func, thisArg, args) {
  19699. switch (args.length) {
  19700. case 0: return func.call(thisArg);
  19701. case 1: return func.call(thisArg, args[0]);
  19702. case 2: return func.call(thisArg, args[0], args[1]);
  19703. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  19704. }
  19705. return func.apply(thisArg, args);
  19706. }
  19707. /**
  19708. * A specialized version of `baseAggregator` for arrays.
  19709. *
  19710. * @private
  19711. * @param {Array} [array] The array to iterate over.
  19712. * @param {Function} setter The function to set `accumulator` values.
  19713. * @param {Function} iteratee The iteratee to transform keys.
  19714. * @param {Object} accumulator The initial aggregated object.
  19715. * @returns {Function} Returns `accumulator`.
  19716. */
  19717. function arrayAggregator(array, setter, iteratee, accumulator) {
  19718. var index = -1,
  19719. length = array == null ? 0 : array.length;
  19720. while (++index < length) {
  19721. var value = array[index];
  19722. setter(accumulator, value, iteratee(value), array);
  19723. }
  19724. return accumulator;
  19725. }
  19726. /**
  19727. * A specialized version of `_.forEach` for arrays without support for
  19728. * iteratee shorthands.
  19729. *
  19730. * @private
  19731. * @param {Array} [array] The array to iterate over.
  19732. * @param {Function} iteratee The function invoked per iteration.
  19733. * @returns {Array} Returns `array`.
  19734. */
  19735. function arrayEach(array, iteratee) {
  19736. var index = -1,
  19737. length = array == null ? 0 : array.length;
  19738. while (++index < length) {
  19739. if (iteratee(array[index], index, array) === false) {
  19740. break;
  19741. }
  19742. }
  19743. return array;
  19744. }
  19745. /**
  19746. * A specialized version of `_.forEachRight` for arrays without support for
  19747. * iteratee shorthands.
  19748. *
  19749. * @private
  19750. * @param {Array} [array] The array to iterate over.
  19751. * @param {Function} iteratee The function invoked per iteration.
  19752. * @returns {Array} Returns `array`.
  19753. */
  19754. function arrayEachRight(array, iteratee) {
  19755. var length = array == null ? 0 : array.length;
  19756. while (length--) {
  19757. if (iteratee(array[length], length, array) === false) {
  19758. break;
  19759. }
  19760. }
  19761. return array;
  19762. }
  19763. /**
  19764. * A specialized version of `_.every` for arrays without support for
  19765. * iteratee shorthands.
  19766. *
  19767. * @private
  19768. * @param {Array} [array] The array to iterate over.
  19769. * @param {Function} predicate The function invoked per iteration.
  19770. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  19771. * else `false`.
  19772. */
  19773. function arrayEvery(array, predicate) {
  19774. var index = -1,
  19775. length = array == null ? 0 : array.length;
  19776. while (++index < length) {
  19777. if (!predicate(array[index], index, array)) {
  19778. return false;
  19779. }
  19780. }
  19781. return true;
  19782. }
  19783. /**
  19784. * A specialized version of `_.filter` for arrays without support for
  19785. * iteratee shorthands.
  19786. *
  19787. * @private
  19788. * @param {Array} [array] The array to iterate over.
  19789. * @param {Function} predicate The function invoked per iteration.
  19790. * @returns {Array} Returns the new filtered array.
  19791. */
  19792. function arrayFilter(array, predicate) {
  19793. var index = -1,
  19794. length = array == null ? 0 : array.length,
  19795. resIndex = 0,
  19796. result = [];
  19797. while (++index < length) {
  19798. var value = array[index];
  19799. if (predicate(value, index, array)) {
  19800. result[resIndex++] = value;
  19801. }
  19802. }
  19803. return result;
  19804. }
  19805. /**
  19806. * A specialized version of `_.includes` for arrays without support for
  19807. * specifying an index to search from.
  19808. *
  19809. * @private
  19810. * @param {Array} [array] The array to inspect.
  19811. * @param {*} target The value to search for.
  19812. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19813. */
  19814. function arrayIncludes(array, value) {
  19815. var length = array == null ? 0 : array.length;
  19816. return !!length && baseIndexOf(array, value, 0) > -1;
  19817. }
  19818. /**
  19819. * This function is like `arrayIncludes` except that it accepts a comparator.
  19820. *
  19821. * @private
  19822. * @param {Array} [array] The array to inspect.
  19823. * @param {*} target The value to search for.
  19824. * @param {Function} comparator The comparator invoked per element.
  19825. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19826. */
  19827. function arrayIncludesWith(array, value, comparator) {
  19828. var index = -1,
  19829. length = array == null ? 0 : array.length;
  19830. while (++index < length) {
  19831. if (comparator(value, array[index])) {
  19832. return true;
  19833. }
  19834. }
  19835. return false;
  19836. }
  19837. /**
  19838. * A specialized version of `_.map` for arrays without support for iteratee
  19839. * shorthands.
  19840. *
  19841. * @private
  19842. * @param {Array} [array] The array to iterate over.
  19843. * @param {Function} iteratee The function invoked per iteration.
  19844. * @returns {Array} Returns the new mapped array.
  19845. */
  19846. function arrayMap(array, iteratee) {
  19847. var index = -1,
  19848. length = array == null ? 0 : array.length,
  19849. result = Array(length);
  19850. while (++index < length) {
  19851. result[index] = iteratee(array[index], index, array);
  19852. }
  19853. return result;
  19854. }
  19855. /**
  19856. * Appends the elements of `values` to `array`.
  19857. *
  19858. * @private
  19859. * @param {Array} array The array to modify.
  19860. * @param {Array} values The values to append.
  19861. * @returns {Array} Returns `array`.
  19862. */
  19863. function arrayPush(array, values) {
  19864. var index = -1,
  19865. length = values.length,
  19866. offset = array.length;
  19867. while (++index < length) {
  19868. array[offset + index] = values[index];
  19869. }
  19870. return array;
  19871. }
  19872. /**
  19873. * A specialized version of `_.reduce` for arrays without support for
  19874. * iteratee shorthands.
  19875. *
  19876. * @private
  19877. * @param {Array} [array] The array to iterate over.
  19878. * @param {Function} iteratee The function invoked per iteration.
  19879. * @param {*} [accumulator] The initial value.
  19880. * @param {boolean} [initAccum] Specify using the first element of `array` as
  19881. * the initial value.
  19882. * @returns {*} Returns the accumulated value.
  19883. */
  19884. function arrayReduce(array, iteratee, accumulator, initAccum) {
  19885. var index = -1,
  19886. length = array == null ? 0 : array.length;
  19887. if (initAccum && length) {
  19888. accumulator = array[++index];
  19889. }
  19890. while (++index < length) {
  19891. accumulator = iteratee(accumulator, array[index], index, array);
  19892. }
  19893. return accumulator;
  19894. }
  19895. /**
  19896. * A specialized version of `_.reduceRight` for arrays without support for
  19897. * iteratee shorthands.
  19898. *
  19899. * @private
  19900. * @param {Array} [array] The array to iterate over.
  19901. * @param {Function} iteratee The function invoked per iteration.
  19902. * @param {*} [accumulator] The initial value.
  19903. * @param {boolean} [initAccum] Specify using the last element of `array` as
  19904. * the initial value.
  19905. * @returns {*} Returns the accumulated value.
  19906. */
  19907. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  19908. var length = array == null ? 0 : array.length;
  19909. if (initAccum && length) {
  19910. accumulator = array[--length];
  19911. }
  19912. while (length--) {
  19913. accumulator = iteratee(accumulator, array[length], length, array);
  19914. }
  19915. return accumulator;
  19916. }
  19917. /**
  19918. * A specialized version of `_.some` for arrays without support for iteratee
  19919. * shorthands.
  19920. *
  19921. * @private
  19922. * @param {Array} [array] The array to iterate over.
  19923. * @param {Function} predicate The function invoked per iteration.
  19924. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19925. * else `false`.
  19926. */
  19927. function arraySome(array, predicate) {
  19928. var index = -1,
  19929. length = array == null ? 0 : array.length;
  19930. while (++index < length) {
  19931. if (predicate(array[index], index, array)) {
  19932. return true;
  19933. }
  19934. }
  19935. return false;
  19936. }
  19937. /**
  19938. * Gets the size of an ASCII `string`.
  19939. *
  19940. * @private
  19941. * @param {string} string The string inspect.
  19942. * @returns {number} Returns the string size.
  19943. */
  19944. var asciiSize = baseProperty('length');
  19945. /**
  19946. * Converts an ASCII `string` to an array.
  19947. *
  19948. * @private
  19949. * @param {string} string The string to convert.
  19950. * @returns {Array} Returns the converted array.
  19951. */
  19952. function asciiToArray(string) {
  19953. return string.split('');
  19954. }
  19955. /**
  19956. * Splits an ASCII `string` into an array of its words.
  19957. *
  19958. * @private
  19959. * @param {string} The string to inspect.
  19960. * @returns {Array} Returns the words of `string`.
  19961. */
  19962. function asciiWords(string) {
  19963. return string.match(reAsciiWord) || [];
  19964. }
  19965. /**
  19966. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19967. * without support for iteratee shorthands, which iterates over `collection`
  19968. * using `eachFunc`.
  19969. *
  19970. * @private
  19971. * @param {Array|Object} collection The collection to inspect.
  19972. * @param {Function} predicate The function invoked per iteration.
  19973. * @param {Function} eachFunc The function to iterate over `collection`.
  19974. * @returns {*} Returns the found element or its key, else `undefined`.
  19975. */
  19976. function baseFindKey(collection, predicate, eachFunc) {
  19977. var result;
  19978. eachFunc(collection, function(value, key, collection) {
  19979. if (predicate(value, key, collection)) {
  19980. result = key;
  19981. return false;
  19982. }
  19983. });
  19984. return result;
  19985. }
  19986. /**
  19987. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19988. * support for iteratee shorthands.
  19989. *
  19990. * @private
  19991. * @param {Array} array The array to inspect.
  19992. * @param {Function} predicate The function invoked per iteration.
  19993. * @param {number} fromIndex The index to search from.
  19994. * @param {boolean} [fromRight] Specify iterating from right to left.
  19995. * @returns {number} Returns the index of the matched value, else `-1`.
  19996. */
  19997. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19998. var length = array.length,
  19999. index = fromIndex + (fromRight ? 1 : -1);
  20000. while ((fromRight ? index-- : ++index < length)) {
  20001. if (predicate(array[index], index, array)) {
  20002. return index;
  20003. }
  20004. }
  20005. return -1;
  20006. }
  20007. /**
  20008. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  20009. *
  20010. * @private
  20011. * @param {Array} array The array to inspect.
  20012. * @param {*} value The value to search for.
  20013. * @param {number} fromIndex The index to search from.
  20014. * @returns {number} Returns the index of the matched value, else `-1`.
  20015. */
  20016. function baseIndexOf(array, value, fromIndex) {
  20017. return value === value
  20018. ? strictIndexOf(array, value, fromIndex)
  20019. : baseFindIndex(array, baseIsNaN, fromIndex);
  20020. }
  20021. /**
  20022. * This function is like `baseIndexOf` except that it accepts a comparator.
  20023. *
  20024. * @private
  20025. * @param {Array} array The array to inspect.
  20026. * @param {*} value The value to search for.
  20027. * @param {number} fromIndex The index to search from.
  20028. * @param {Function} comparator The comparator invoked per element.
  20029. * @returns {number} Returns the index of the matched value, else `-1`.
  20030. */
  20031. function baseIndexOfWith(array, value, fromIndex, comparator) {
  20032. var index = fromIndex - 1,
  20033. length = array.length;
  20034. while (++index < length) {
  20035. if (comparator(array[index], value)) {
  20036. return index;
  20037. }
  20038. }
  20039. return -1;
  20040. }
  20041. /**
  20042. * The base implementation of `_.isNaN` without support for number objects.
  20043. *
  20044. * @private
  20045. * @param {*} value The value to check.
  20046. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  20047. */
  20048. function baseIsNaN(value) {
  20049. return value !== value;
  20050. }
  20051. /**
  20052. * The base implementation of `_.mean` and `_.meanBy` without support for
  20053. * iteratee shorthands.
  20054. *
  20055. * @private
  20056. * @param {Array} array The array to iterate over.
  20057. * @param {Function} iteratee The function invoked per iteration.
  20058. * @returns {number} Returns the mean.
  20059. */
  20060. function baseMean(array, iteratee) {
  20061. var length = array == null ? 0 : array.length;
  20062. return length ? (baseSum(array, iteratee) / length) : NAN;
  20063. }
  20064. /**
  20065. * The base implementation of `_.property` without support for deep paths.
  20066. *
  20067. * @private
  20068. * @param {string} key The key of the property to get.
  20069. * @returns {Function} Returns the new accessor function.
  20070. */
  20071. function baseProperty(key) {
  20072. return function(object) {
  20073. return object == null ? undefined : object[key];
  20074. };
  20075. }
  20076. /**
  20077. * The base implementation of `_.propertyOf` without support for deep paths.
  20078. *
  20079. * @private
  20080. * @param {Object} object The object to query.
  20081. * @returns {Function} Returns the new accessor function.
  20082. */
  20083. function basePropertyOf(object) {
  20084. return function(key) {
  20085. return object == null ? undefined : object[key];
  20086. };
  20087. }
  20088. /**
  20089. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  20090. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  20091. *
  20092. * @private
  20093. * @param {Array|Object} collection The collection to iterate over.
  20094. * @param {Function} iteratee The function invoked per iteration.
  20095. * @param {*} accumulator The initial value.
  20096. * @param {boolean} initAccum Specify using the first or last element of
  20097. * `collection` as the initial value.
  20098. * @param {Function} eachFunc The function to iterate over `collection`.
  20099. * @returns {*} Returns the accumulated value.
  20100. */
  20101. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  20102. eachFunc(collection, function(value, index, collection) {
  20103. accumulator = initAccum
  20104. ? (initAccum = false, value)
  20105. : iteratee(accumulator, value, index, collection);
  20106. });
  20107. return accumulator;
  20108. }
  20109. /**
  20110. * The base implementation of `_.sortBy` which uses `comparer` to define the
  20111. * sort order of `array` and replaces criteria objects with their corresponding
  20112. * values.
  20113. *
  20114. * @private
  20115. * @param {Array} array The array to sort.
  20116. * @param {Function} comparer The function to define sort order.
  20117. * @returns {Array} Returns `array`.
  20118. */
  20119. function baseSortBy(array, comparer) {
  20120. var length = array.length;
  20121. array.sort(comparer);
  20122. while (length--) {
  20123. array[length] = array[length].value;
  20124. }
  20125. return array;
  20126. }
  20127. /**
  20128. * The base implementation of `_.sum` and `_.sumBy` without support for
  20129. * iteratee shorthands.
  20130. *
  20131. * @private
  20132. * @param {Array} array The array to iterate over.
  20133. * @param {Function} iteratee The function invoked per iteration.
  20134. * @returns {number} Returns the sum.
  20135. */
  20136. function baseSum(array, iteratee) {
  20137. var result,
  20138. index = -1,
  20139. length = array.length;
  20140. while (++index < length) {
  20141. var current = iteratee(array[index]);
  20142. if (current !== undefined) {
  20143. result = result === undefined ? current : (result + current);
  20144. }
  20145. }
  20146. return result;
  20147. }
  20148. /**
  20149. * The base implementation of `_.times` without support for iteratee shorthands
  20150. * or max array length checks.
  20151. *
  20152. * @private
  20153. * @param {number} n The number of times to invoke `iteratee`.
  20154. * @param {Function} iteratee The function invoked per iteration.
  20155. * @returns {Array} Returns the array of results.
  20156. */
  20157. function baseTimes(n, iteratee) {
  20158. var index = -1,
  20159. result = Array(n);
  20160. while (++index < n) {
  20161. result[index] = iteratee(index);
  20162. }
  20163. return result;
  20164. }
  20165. /**
  20166. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  20167. * of key-value pairs for `object` corresponding to the property names of `props`.
  20168. *
  20169. * @private
  20170. * @param {Object} object The object to query.
  20171. * @param {Array} props The property names to get values for.
  20172. * @returns {Object} Returns the key-value pairs.
  20173. */
  20174. function baseToPairs(object, props) {
  20175. return arrayMap(props, function(key) {
  20176. return [key, object[key]];
  20177. });
  20178. }
  20179. /**
  20180. * The base implementation of `_.unary` without support for storing metadata.
  20181. *
  20182. * @private
  20183. * @param {Function} func The function to cap arguments for.
  20184. * @returns {Function} Returns the new capped function.
  20185. */
  20186. function baseUnary(func) {
  20187. return function(value) {
  20188. return func(value);
  20189. };
  20190. }
  20191. /**
  20192. * The base implementation of `_.values` and `_.valuesIn` which creates an
  20193. * array of `object` property values corresponding to the property names
  20194. * of `props`.
  20195. *
  20196. * @private
  20197. * @param {Object} object The object to query.
  20198. * @param {Array} props The property names to get values for.
  20199. * @returns {Object} Returns the array of property values.
  20200. */
  20201. function baseValues(object, props) {
  20202. return arrayMap(props, function(key) {
  20203. return object[key];
  20204. });
  20205. }
  20206. /**
  20207. * Checks if a `cache` value for `key` exists.
  20208. *
  20209. * @private
  20210. * @param {Object} cache The cache to query.
  20211. * @param {string} key The key of the entry to check.
  20212. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20213. */
  20214. function cacheHas(cache, key) {
  20215. return cache.has(key);
  20216. }
  20217. /**
  20218. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  20219. * that is not found in the character symbols.
  20220. *
  20221. * @private
  20222. * @param {Array} strSymbols The string symbols to inspect.
  20223. * @param {Array} chrSymbols The character symbols to find.
  20224. * @returns {number} Returns the index of the first unmatched string symbol.
  20225. */
  20226. function charsStartIndex(strSymbols, chrSymbols) {
  20227. var index = -1,
  20228. length = strSymbols.length;
  20229. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  20230. return index;
  20231. }
  20232. /**
  20233. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  20234. * that is not found in the character symbols.
  20235. *
  20236. * @private
  20237. * @param {Array} strSymbols The string symbols to inspect.
  20238. * @param {Array} chrSymbols The character symbols to find.
  20239. * @returns {number} Returns the index of the last unmatched string symbol.
  20240. */
  20241. function charsEndIndex(strSymbols, chrSymbols) {
  20242. var index = strSymbols.length;
  20243. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  20244. return index;
  20245. }
  20246. /**
  20247. * Gets the number of `placeholder` occurrences in `array`.
  20248. *
  20249. * @private
  20250. * @param {Array} array The array to inspect.
  20251. * @param {*} placeholder The placeholder to search for.
  20252. * @returns {number} Returns the placeholder count.
  20253. */
  20254. function countHolders(array, placeholder) {
  20255. var length = array.length,
  20256. result = 0;
  20257. while (length--) {
  20258. if (array[length] === placeholder) {
  20259. ++result;
  20260. }
  20261. }
  20262. return result;
  20263. }
  20264. /**
  20265. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  20266. * letters to basic Latin letters.
  20267. *
  20268. * @private
  20269. * @param {string} letter The matched letter to deburr.
  20270. * @returns {string} Returns the deburred letter.
  20271. */
  20272. var deburrLetter = basePropertyOf(deburredLetters);
  20273. /**
  20274. * Used by `_.escape` to convert characters to HTML entities.
  20275. *
  20276. * @private
  20277. * @param {string} chr The matched character to escape.
  20278. * @returns {string} Returns the escaped character.
  20279. */
  20280. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  20281. /**
  20282. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  20283. *
  20284. * @private
  20285. * @param {string} chr The matched character to escape.
  20286. * @returns {string} Returns the escaped character.
  20287. */
  20288. function escapeStringChar(chr) {
  20289. return '\\' + stringEscapes[chr];
  20290. }
  20291. /**
  20292. * Gets the value at `key` of `object`.
  20293. *
  20294. * @private
  20295. * @param {Object} [object] The object to query.
  20296. * @param {string} key The key of the property to get.
  20297. * @returns {*} Returns the property value.
  20298. */
  20299. function getValue(object, key) {
  20300. return object == null ? undefined : object[key];
  20301. }
  20302. /**
  20303. * Checks if `string` contains Unicode symbols.
  20304. *
  20305. * @private
  20306. * @param {string} string The string to inspect.
  20307. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  20308. */
  20309. function hasUnicode(string) {
  20310. return reHasUnicode.test(string);
  20311. }
  20312. /**
  20313. * Checks if `string` contains a word composed of Unicode symbols.
  20314. *
  20315. * @private
  20316. * @param {string} string The string to inspect.
  20317. * @returns {boolean} Returns `true` if a word is found, else `false`.
  20318. */
  20319. function hasUnicodeWord(string) {
  20320. return reHasUnicodeWord.test(string);
  20321. }
  20322. /**
  20323. * Converts `iterator` to an array.
  20324. *
  20325. * @private
  20326. * @param {Object} iterator The iterator to convert.
  20327. * @returns {Array} Returns the converted array.
  20328. */
  20329. function iteratorToArray(iterator) {
  20330. var data,
  20331. result = [];
  20332. while (!(data = iterator.next()).done) {
  20333. result.push(data.value);
  20334. }
  20335. return result;
  20336. }
  20337. /**
  20338. * Converts `map` to its key-value pairs.
  20339. *
  20340. * @private
  20341. * @param {Object} map The map to convert.
  20342. * @returns {Array} Returns the key-value pairs.
  20343. */
  20344. function mapToArray(map) {
  20345. var index = -1,
  20346. result = Array(map.size);
  20347. map.forEach(function(value, key) {
  20348. result[++index] = [key, value];
  20349. });
  20350. return result;
  20351. }
  20352. /**
  20353. * Creates a unary function that invokes `func` with its argument transformed.
  20354. *
  20355. * @private
  20356. * @param {Function} func The function to wrap.
  20357. * @param {Function} transform The argument transform.
  20358. * @returns {Function} Returns the new function.
  20359. */
  20360. function overArg(func, transform) {
  20361. return function(arg) {
  20362. return func(transform(arg));
  20363. };
  20364. }
  20365. /**
  20366. * Replaces all `placeholder` elements in `array` with an internal placeholder
  20367. * and returns an array of their indexes.
  20368. *
  20369. * @private
  20370. * @param {Array} array The array to modify.
  20371. * @param {*} placeholder The placeholder to replace.
  20372. * @returns {Array} Returns the new array of placeholder indexes.
  20373. */
  20374. function replaceHolders(array, placeholder) {
  20375. var index = -1,
  20376. length = array.length,
  20377. resIndex = 0,
  20378. result = [];
  20379. while (++index < length) {
  20380. var value = array[index];
  20381. if (value === placeholder || value === PLACEHOLDER) {
  20382. array[index] = PLACEHOLDER;
  20383. result[resIndex++] = index;
  20384. }
  20385. }
  20386. return result;
  20387. }
  20388. /**
  20389. * Converts `set` to an array of its values.
  20390. *
  20391. * @private
  20392. * @param {Object} set The set to convert.
  20393. * @returns {Array} Returns the values.
  20394. */
  20395. function setToArray(set) {
  20396. var index = -1,
  20397. result = Array(set.size);
  20398. set.forEach(function(value) {
  20399. result[++index] = value;
  20400. });
  20401. return result;
  20402. }
  20403. /**
  20404. * Converts `set` to its value-value pairs.
  20405. *
  20406. * @private
  20407. * @param {Object} set The set to convert.
  20408. * @returns {Array} Returns the value-value pairs.
  20409. */
  20410. function setToPairs(set) {
  20411. var index = -1,
  20412. result = Array(set.size);
  20413. set.forEach(function(value) {
  20414. result[++index] = [value, value];
  20415. });
  20416. return result;
  20417. }
  20418. /**
  20419. * A specialized version of `_.indexOf` which performs strict equality
  20420. * comparisons of values, i.e. `===`.
  20421. *
  20422. * @private
  20423. * @param {Array} array The array to inspect.
  20424. * @param {*} value The value to search for.
  20425. * @param {number} fromIndex The index to search from.
  20426. * @returns {number} Returns the index of the matched value, else `-1`.
  20427. */
  20428. function strictIndexOf(array, value, fromIndex) {
  20429. var index = fromIndex - 1,
  20430. length = array.length;
  20431. while (++index < length) {
  20432. if (array[index] === value) {
  20433. return index;
  20434. }
  20435. }
  20436. return -1;
  20437. }
  20438. /**
  20439. * A specialized version of `_.lastIndexOf` which performs strict equality
  20440. * comparisons of values, i.e. `===`.
  20441. *
  20442. * @private
  20443. * @param {Array} array The array to inspect.
  20444. * @param {*} value The value to search for.
  20445. * @param {number} fromIndex The index to search from.
  20446. * @returns {number} Returns the index of the matched value, else `-1`.
  20447. */
  20448. function strictLastIndexOf(array, value, fromIndex) {
  20449. var index = fromIndex + 1;
  20450. while (index--) {
  20451. if (array[index] === value) {
  20452. return index;
  20453. }
  20454. }
  20455. return index;
  20456. }
  20457. /**
  20458. * Gets the number of symbols in `string`.
  20459. *
  20460. * @private
  20461. * @param {string} string The string to inspect.
  20462. * @returns {number} Returns the string size.
  20463. */
  20464. function stringSize(string) {
  20465. return hasUnicode(string)
  20466. ? unicodeSize(string)
  20467. : asciiSize(string);
  20468. }
  20469. /**
  20470. * Converts `string` to an array.
  20471. *
  20472. * @private
  20473. * @param {string} string The string to convert.
  20474. * @returns {Array} Returns the converted array.
  20475. */
  20476. function stringToArray(string) {
  20477. return hasUnicode(string)
  20478. ? unicodeToArray(string)
  20479. : asciiToArray(string);
  20480. }
  20481. /**
  20482. * Used by `_.unescape` to convert HTML entities to characters.
  20483. *
  20484. * @private
  20485. * @param {string} chr The matched character to unescape.
  20486. * @returns {string} Returns the unescaped character.
  20487. */
  20488. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  20489. /**
  20490. * Gets the size of a Unicode `string`.
  20491. *
  20492. * @private
  20493. * @param {string} string The string inspect.
  20494. * @returns {number} Returns the string size.
  20495. */
  20496. function unicodeSize(string) {
  20497. var result = reUnicode.lastIndex = 0;
  20498. while (reUnicode.test(string)) {
  20499. ++result;
  20500. }
  20501. return result;
  20502. }
  20503. /**
  20504. * Converts a Unicode `string` to an array.
  20505. *
  20506. * @private
  20507. * @param {string} string The string to convert.
  20508. * @returns {Array} Returns the converted array.
  20509. */
  20510. function unicodeToArray(string) {
  20511. return string.match(reUnicode) || [];
  20512. }
  20513. /**
  20514. * Splits a Unicode `string` into an array of its words.
  20515. *
  20516. * @private
  20517. * @param {string} The string to inspect.
  20518. * @returns {Array} Returns the words of `string`.
  20519. */
  20520. function unicodeWords(string) {
  20521. return string.match(reUnicodeWord) || [];
  20522. }
  20523. /*--------------------------------------------------------------------------*/
  20524. /**
  20525. * Create a new pristine `lodash` function using the `context` object.
  20526. *
  20527. * @static
  20528. * @memberOf _
  20529. * @since 1.1.0
  20530. * @category Util
  20531. * @param {Object} [context=root] The context object.
  20532. * @returns {Function} Returns a new `lodash` function.
  20533. * @example
  20534. *
  20535. * _.mixin({ 'foo': _.constant('foo') });
  20536. *
  20537. * var lodash = _.runInContext();
  20538. * lodash.mixin({ 'bar': lodash.constant('bar') });
  20539. *
  20540. * _.isFunction(_.foo);
  20541. * // => true
  20542. * _.isFunction(_.bar);
  20543. * // => false
  20544. *
  20545. * lodash.isFunction(lodash.foo);
  20546. * // => false
  20547. * lodash.isFunction(lodash.bar);
  20548. * // => true
  20549. *
  20550. * // Create a suped-up `defer` in Node.js.
  20551. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  20552. */
  20553. var runInContext = (function runInContext(context) {
  20554. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  20555. /** Built-in constructor references. */
  20556. var Array = context.Array,
  20557. Date = context.Date,
  20558. Error = context.Error,
  20559. Function = context.Function,
  20560. Math = context.Math,
  20561. Object = context.Object,
  20562. RegExp = context.RegExp,
  20563. String = context.String,
  20564. TypeError = context.TypeError;
  20565. /** Used for built-in method references. */
  20566. var arrayProto = Array.prototype,
  20567. funcProto = Function.prototype,
  20568. objectProto = Object.prototype;
  20569. /** Used to detect overreaching core-js shims. */
  20570. var coreJsData = context['__core-js_shared__'];
  20571. /** Used to resolve the decompiled source of functions. */
  20572. var funcToString = funcProto.toString;
  20573. /** Used to check objects for own properties. */
  20574. var hasOwnProperty = objectProto.hasOwnProperty;
  20575. /** Used to generate unique IDs. */
  20576. var idCounter = 0;
  20577. /** Used to detect methods masquerading as native. */
  20578. var maskSrcKey = (function() {
  20579. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  20580. return uid ? ('Symbol(src)_1.' + uid) : '';
  20581. }());
  20582. /**
  20583. * Used to resolve the
  20584. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  20585. * of values.
  20586. */
  20587. var nativeObjectToString = objectProto.toString;
  20588. /** Used to infer the `Object` constructor. */
  20589. var objectCtorString = funcToString.call(Object);
  20590. /** Used to restore the original `_` reference in `_.noConflict`. */
  20591. var oldDash = root._;
  20592. /** Used to detect if a method is native. */
  20593. var reIsNative = RegExp('^' +
  20594. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  20595. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  20596. );
  20597. /** Built-in value references. */
  20598. var Buffer = moduleExports ? context.Buffer : undefined,
  20599. Symbol = context.Symbol,
  20600. Uint8Array = context.Uint8Array,
  20601. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  20602. getPrototype = overArg(Object.getPrototypeOf, Object),
  20603. objectCreate = Object.create,
  20604. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  20605. splice = arrayProto.splice,
  20606. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  20607. symIterator = Symbol ? Symbol.iterator : undefined,
  20608. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  20609. var defineProperty = (function() {
  20610. try {
  20611. var func = getNative(Object, 'defineProperty');
  20612. func({}, '', {});
  20613. return func;
  20614. } catch (e) {}
  20615. }());
  20616. /** Mocked built-ins. */
  20617. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  20618. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  20619. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  20620. /* Built-in method references for those with the same name as other `lodash` methods. */
  20621. var nativeCeil = Math.ceil,
  20622. nativeFloor = Math.floor,
  20623. nativeGetSymbols = Object.getOwnPropertySymbols,
  20624. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  20625. nativeIsFinite = context.isFinite,
  20626. nativeJoin = arrayProto.join,
  20627. nativeKeys = overArg(Object.keys, Object),
  20628. nativeMax = Math.max,
  20629. nativeMin = Math.min,
  20630. nativeNow = Date.now,
  20631. nativeParseInt = context.parseInt,
  20632. nativeRandom = Math.random,
  20633. nativeReverse = arrayProto.reverse;
  20634. /* Built-in method references that are verified to be native. */
  20635. var DataView = getNative(context, 'DataView'),
  20636. Map = getNative(context, 'Map'),
  20637. Promise = getNative(context, 'Promise'),
  20638. Set = getNative(context, 'Set'),
  20639. WeakMap = getNative(context, 'WeakMap'),
  20640. nativeCreate = getNative(Object, 'create');
  20641. /** Used to store function metadata. */
  20642. var metaMap = WeakMap && new WeakMap;
  20643. /** Used to lookup unminified function names. */
  20644. var realNames = {};
  20645. /** Used to detect maps, sets, and weakmaps. */
  20646. var dataViewCtorString = toSource(DataView),
  20647. mapCtorString = toSource(Map),
  20648. promiseCtorString = toSource(Promise),
  20649. setCtorString = toSource(Set),
  20650. weakMapCtorString = toSource(WeakMap);
  20651. /** Used to convert symbols to primitives and strings. */
  20652. var symbolProto = Symbol ? Symbol.prototype : undefined,
  20653. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  20654. symbolToString = symbolProto ? symbolProto.toString : undefined;
  20655. /*------------------------------------------------------------------------*/
  20656. /**
  20657. * Creates a `lodash` object which wraps `value` to enable implicit method
  20658. * chain sequences. Methods that operate on and return arrays, collections,
  20659. * and functions can be chained together. Methods that retrieve a single value
  20660. * or may return a primitive value will automatically end the chain sequence
  20661. * and return the unwrapped value. Otherwise, the value must be unwrapped
  20662. * with `_#value`.
  20663. *
  20664. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  20665. * enabled using `_.chain`.
  20666. *
  20667. * The execution of chained methods is lazy, that is, it's deferred until
  20668. * `_#value` is implicitly or explicitly called.
  20669. *
  20670. * Lazy evaluation allows several methods to support shortcut fusion.
  20671. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  20672. * the creation of intermediate arrays and can greatly reduce the number of
  20673. * iteratee executions. Sections of a chain sequence qualify for shortcut
  20674. * fusion if the section is applied to an array and iteratees accept only
  20675. * one argument. The heuristic for whether a section qualifies for shortcut
  20676. * fusion is subject to change.
  20677. *
  20678. * Chaining is supported in custom builds as long as the `_#value` method is
  20679. * directly or indirectly included in the build.
  20680. *
  20681. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  20682. *
  20683. * The wrapper `Array` methods are:
  20684. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  20685. *
  20686. * The wrapper `String` methods are:
  20687. * `replace` and `split`
  20688. *
  20689. * The wrapper methods that support shortcut fusion are:
  20690. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  20691. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  20692. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  20693. *
  20694. * The chainable wrapper methods are:
  20695. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  20696. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  20697. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  20698. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  20699. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  20700. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  20701. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  20702. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  20703. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  20704. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  20705. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  20706. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  20707. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  20708. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  20709. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  20710. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  20711. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  20712. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  20713. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  20714. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  20715. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  20716. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  20717. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  20718. * `zipObject`, `zipObjectDeep`, and `zipWith`
  20719. *
  20720. * The wrapper methods that are **not** chainable by default are:
  20721. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  20722. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  20723. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  20724. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  20725. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  20726. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  20727. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  20728. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  20729. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  20730. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  20731. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  20732. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  20733. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  20734. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  20735. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  20736. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  20737. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  20738. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  20739. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  20740. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  20741. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  20742. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  20743. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  20744. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  20745. * `upperFirst`, `value`, and `words`
  20746. *
  20747. * @name _
  20748. * @constructor
  20749. * @category Seq
  20750. * @param {*} value The value to wrap in a `lodash` instance.
  20751. * @returns {Object} Returns the new `lodash` wrapper instance.
  20752. * @example
  20753. *
  20754. * function square(n) {
  20755. * return n * n;
  20756. * }
  20757. *
  20758. * var wrapped = _([1, 2, 3]);
  20759. *
  20760. * // Returns an unwrapped value.
  20761. * wrapped.reduce(_.add);
  20762. * // => 6
  20763. *
  20764. * // Returns a wrapped value.
  20765. * var squares = wrapped.map(square);
  20766. *
  20767. * _.isArray(squares);
  20768. * // => false
  20769. *
  20770. * _.isArray(squares.value());
  20771. * // => true
  20772. */
  20773. function lodash(value) {
  20774. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  20775. if (value instanceof LodashWrapper) {
  20776. return value;
  20777. }
  20778. if (hasOwnProperty.call(value, '__wrapped__')) {
  20779. return wrapperClone(value);
  20780. }
  20781. }
  20782. return new LodashWrapper(value);
  20783. }
  20784. /**
  20785. * The base implementation of `_.create` without support for assigning
  20786. * properties to the created object.
  20787. *
  20788. * @private
  20789. * @param {Object} proto The object to inherit from.
  20790. * @returns {Object} Returns the new object.
  20791. */
  20792. var baseCreate = (function() {
  20793. function object() {}
  20794. return function(proto) {
  20795. if (!isObject(proto)) {
  20796. return {};
  20797. }
  20798. if (objectCreate) {
  20799. return objectCreate(proto);
  20800. }
  20801. object.prototype = proto;
  20802. var result = new object;
  20803. object.prototype = undefined;
  20804. return result;
  20805. };
  20806. }());
  20807. /**
  20808. * The function whose prototype chain sequence wrappers inherit from.
  20809. *
  20810. * @private
  20811. */
  20812. function baseLodash() {
  20813. // No operation performed.
  20814. }
  20815. /**
  20816. * The base constructor for creating `lodash` wrapper objects.
  20817. *
  20818. * @private
  20819. * @param {*} value The value to wrap.
  20820. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  20821. */
  20822. function LodashWrapper(value, chainAll) {
  20823. this.__wrapped__ = value;
  20824. this.__actions__ = [];
  20825. this.__chain__ = !!chainAll;
  20826. this.__index__ = 0;
  20827. this.__values__ = undefined;
  20828. }
  20829. /**
  20830. * By default, the template delimiters used by lodash are like those in
  20831. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  20832. * following template settings to use alternative delimiters.
  20833. *
  20834. * @static
  20835. * @memberOf _
  20836. * @type {Object}
  20837. */
  20838. lodash.templateSettings = {
  20839. /**
  20840. * Used to detect `data` property values to be HTML-escaped.
  20841. *
  20842. * @memberOf _.templateSettings
  20843. * @type {RegExp}
  20844. */
  20845. 'escape': reEscape,
  20846. /**
  20847. * Used to detect code to be evaluated.
  20848. *
  20849. * @memberOf _.templateSettings
  20850. * @type {RegExp}
  20851. */
  20852. 'evaluate': reEvaluate,
  20853. /**
  20854. * Used to detect `data` property values to inject.
  20855. *
  20856. * @memberOf _.templateSettings
  20857. * @type {RegExp}
  20858. */
  20859. 'interpolate': reInterpolate,
  20860. /**
  20861. * Used to reference the data object in the template text.
  20862. *
  20863. * @memberOf _.templateSettings
  20864. * @type {string}
  20865. */
  20866. 'variable': '',
  20867. /**
  20868. * Used to import variables into the compiled template.
  20869. *
  20870. * @memberOf _.templateSettings
  20871. * @type {Object}
  20872. */
  20873. 'imports': {
  20874. /**
  20875. * A reference to the `lodash` function.
  20876. *
  20877. * @memberOf _.templateSettings.imports
  20878. * @type {Function}
  20879. */
  20880. '_': lodash
  20881. }
  20882. };
  20883. // Ensure wrappers are instances of `baseLodash`.
  20884. lodash.prototype = baseLodash.prototype;
  20885. lodash.prototype.constructor = lodash;
  20886. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  20887. LodashWrapper.prototype.constructor = LodashWrapper;
  20888. /*------------------------------------------------------------------------*/
  20889. /**
  20890. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  20891. *
  20892. * @private
  20893. * @constructor
  20894. * @param {*} value The value to wrap.
  20895. */
  20896. function LazyWrapper(value) {
  20897. this.__wrapped__ = value;
  20898. this.__actions__ = [];
  20899. this.__dir__ = 1;
  20900. this.__filtered__ = false;
  20901. this.__iteratees__ = [];
  20902. this.__takeCount__ = MAX_ARRAY_LENGTH;
  20903. this.__views__ = [];
  20904. }
  20905. /**
  20906. * Creates a clone of the lazy wrapper object.
  20907. *
  20908. * @private
  20909. * @name clone
  20910. * @memberOf LazyWrapper
  20911. * @returns {Object} Returns the cloned `LazyWrapper` object.
  20912. */
  20913. function lazyClone() {
  20914. var result = new LazyWrapper(this.__wrapped__);
  20915. result.__actions__ = copyArray(this.__actions__);
  20916. result.__dir__ = this.__dir__;
  20917. result.__filtered__ = this.__filtered__;
  20918. result.__iteratees__ = copyArray(this.__iteratees__);
  20919. result.__takeCount__ = this.__takeCount__;
  20920. result.__views__ = copyArray(this.__views__);
  20921. return result;
  20922. }
  20923. /**
  20924. * Reverses the direction of lazy iteration.
  20925. *
  20926. * @private
  20927. * @name reverse
  20928. * @memberOf LazyWrapper
  20929. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20930. */
  20931. function lazyReverse() {
  20932. if (this.__filtered__) {
  20933. var result = new LazyWrapper(this);
  20934. result.__dir__ = -1;
  20935. result.__filtered__ = true;
  20936. } else {
  20937. result = this.clone();
  20938. result.__dir__ *= -1;
  20939. }
  20940. return result;
  20941. }
  20942. /**
  20943. * Extracts the unwrapped value from its lazy wrapper.
  20944. *
  20945. * @private
  20946. * @name value
  20947. * @memberOf LazyWrapper
  20948. * @returns {*} Returns the unwrapped value.
  20949. */
  20950. function lazyValue() {
  20951. var array = this.__wrapped__.value(),
  20952. dir = this.__dir__,
  20953. isArr = isArray(array),
  20954. isRight = dir < 0,
  20955. arrLength = isArr ? array.length : 0,
  20956. view = getView(0, arrLength, this.__views__),
  20957. start = view.start,
  20958. end = view.end,
  20959. length = end - start,
  20960. index = isRight ? end : (start - 1),
  20961. iteratees = this.__iteratees__,
  20962. iterLength = iteratees.length,
  20963. resIndex = 0,
  20964. takeCount = nativeMin(length, this.__takeCount__);
  20965. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20966. return baseWrapperValue(array, this.__actions__);
  20967. }
  20968. var result = [];
  20969. outer:
  20970. while (length-- && resIndex < takeCount) {
  20971. index += dir;
  20972. var iterIndex = -1,
  20973. value = array[index];
  20974. while (++iterIndex < iterLength) {
  20975. var data = iteratees[iterIndex],
  20976. iteratee = data.iteratee,
  20977. type = data.type,
  20978. computed = iteratee(value);
  20979. if (type == LAZY_MAP_FLAG) {
  20980. value = computed;
  20981. } else if (!computed) {
  20982. if (type == LAZY_FILTER_FLAG) {
  20983. continue outer;
  20984. } else {
  20985. break outer;
  20986. }
  20987. }
  20988. }
  20989. result[resIndex++] = value;
  20990. }
  20991. return result;
  20992. }
  20993. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20994. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20995. LazyWrapper.prototype.constructor = LazyWrapper;
  20996. /*------------------------------------------------------------------------*/
  20997. /**
  20998. * Creates a hash object.
  20999. *
  21000. * @private
  21001. * @constructor
  21002. * @param {Array} [entries] The key-value pairs to cache.
  21003. */
  21004. function Hash(entries) {
  21005. var index = -1,
  21006. length = entries == null ? 0 : entries.length;
  21007. this.clear();
  21008. while (++index < length) {
  21009. var entry = entries[index];
  21010. this.set(entry[0], entry[1]);
  21011. }
  21012. }
  21013. /**
  21014. * Removes all key-value entries from the hash.
  21015. *
  21016. * @private
  21017. * @name clear
  21018. * @memberOf Hash
  21019. */
  21020. function hashClear() {
  21021. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  21022. this.size = 0;
  21023. }
  21024. /**
  21025. * Removes `key` and its value from the hash.
  21026. *
  21027. * @private
  21028. * @name delete
  21029. * @memberOf Hash
  21030. * @param {Object} hash The hash to modify.
  21031. * @param {string} key The key of the value to remove.
  21032. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21033. */
  21034. function hashDelete(key) {
  21035. var result = this.has(key) && delete this.__data__[key];
  21036. this.size -= result ? 1 : 0;
  21037. return result;
  21038. }
  21039. /**
  21040. * Gets the hash value for `key`.
  21041. *
  21042. * @private
  21043. * @name get
  21044. * @memberOf Hash
  21045. * @param {string} key The key of the value to get.
  21046. * @returns {*} Returns the entry value.
  21047. */
  21048. function hashGet(key) {
  21049. var data = this.__data__;
  21050. if (nativeCreate) {
  21051. var result = data[key];
  21052. return result === HASH_UNDEFINED ? undefined : result;
  21053. }
  21054. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  21055. }
  21056. /**
  21057. * Checks if a hash value for `key` exists.
  21058. *
  21059. * @private
  21060. * @name has
  21061. * @memberOf Hash
  21062. * @param {string} key The key of the entry to check.
  21063. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21064. */
  21065. function hashHas(key) {
  21066. var data = this.__data__;
  21067. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  21068. }
  21069. /**
  21070. * Sets the hash `key` to `value`.
  21071. *
  21072. * @private
  21073. * @name set
  21074. * @memberOf Hash
  21075. * @param {string} key The key of the value to set.
  21076. * @param {*} value The value to set.
  21077. * @returns {Object} Returns the hash instance.
  21078. */
  21079. function hashSet(key, value) {
  21080. var data = this.__data__;
  21081. this.size += this.has(key) ? 0 : 1;
  21082. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  21083. return this;
  21084. }
  21085. // Add methods to `Hash`.
  21086. Hash.prototype.clear = hashClear;
  21087. Hash.prototype['delete'] = hashDelete;
  21088. Hash.prototype.get = hashGet;
  21089. Hash.prototype.has = hashHas;
  21090. Hash.prototype.set = hashSet;
  21091. /*------------------------------------------------------------------------*/
  21092. /**
  21093. * Creates an list cache object.
  21094. *
  21095. * @private
  21096. * @constructor
  21097. * @param {Array} [entries] The key-value pairs to cache.
  21098. */
  21099. function ListCache(entries) {
  21100. var index = -1,
  21101. length = entries == null ? 0 : entries.length;
  21102. this.clear();
  21103. while (++index < length) {
  21104. var entry = entries[index];
  21105. this.set(entry[0], entry[1]);
  21106. }
  21107. }
  21108. /**
  21109. * Removes all key-value entries from the list cache.
  21110. *
  21111. * @private
  21112. * @name clear
  21113. * @memberOf ListCache
  21114. */
  21115. function listCacheClear() {
  21116. this.__data__ = [];
  21117. this.size = 0;
  21118. }
  21119. /**
  21120. * Removes `key` and its value from the list cache.
  21121. *
  21122. * @private
  21123. * @name delete
  21124. * @memberOf ListCache
  21125. * @param {string} key The key of the value to remove.
  21126. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21127. */
  21128. function listCacheDelete(key) {
  21129. var data = this.__data__,
  21130. index = assocIndexOf(data, key);
  21131. if (index < 0) {
  21132. return false;
  21133. }
  21134. var lastIndex = data.length - 1;
  21135. if (index == lastIndex) {
  21136. data.pop();
  21137. } else {
  21138. splice.call(data, index, 1);
  21139. }
  21140. --this.size;
  21141. return true;
  21142. }
  21143. /**
  21144. * Gets the list cache value for `key`.
  21145. *
  21146. * @private
  21147. * @name get
  21148. * @memberOf ListCache
  21149. * @param {string} key The key of the value to get.
  21150. * @returns {*} Returns the entry value.
  21151. */
  21152. function listCacheGet(key) {
  21153. var data = this.__data__,
  21154. index = assocIndexOf(data, key);
  21155. return index < 0 ? undefined : data[index][1];
  21156. }
  21157. /**
  21158. * Checks if a list cache value for `key` exists.
  21159. *
  21160. * @private
  21161. * @name has
  21162. * @memberOf ListCache
  21163. * @param {string} key The key of the entry to check.
  21164. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21165. */
  21166. function listCacheHas(key) {
  21167. return assocIndexOf(this.__data__, key) > -1;
  21168. }
  21169. /**
  21170. * Sets the list cache `key` to `value`.
  21171. *
  21172. * @private
  21173. * @name set
  21174. * @memberOf ListCache
  21175. * @param {string} key The key of the value to set.
  21176. * @param {*} value The value to set.
  21177. * @returns {Object} Returns the list cache instance.
  21178. */
  21179. function listCacheSet(key, value) {
  21180. var data = this.__data__,
  21181. index = assocIndexOf(data, key);
  21182. if (index < 0) {
  21183. ++this.size;
  21184. data.push([key, value]);
  21185. } else {
  21186. data[index][1] = value;
  21187. }
  21188. return this;
  21189. }
  21190. // Add methods to `ListCache`.
  21191. ListCache.prototype.clear = listCacheClear;
  21192. ListCache.prototype['delete'] = listCacheDelete;
  21193. ListCache.prototype.get = listCacheGet;
  21194. ListCache.prototype.has = listCacheHas;
  21195. ListCache.prototype.set = listCacheSet;
  21196. /*------------------------------------------------------------------------*/
  21197. /**
  21198. * Creates a map cache object to store key-value pairs.
  21199. *
  21200. * @private
  21201. * @constructor
  21202. * @param {Array} [entries] The key-value pairs to cache.
  21203. */
  21204. function MapCache(entries) {
  21205. var index = -1,
  21206. length = entries == null ? 0 : entries.length;
  21207. this.clear();
  21208. while (++index < length) {
  21209. var entry = entries[index];
  21210. this.set(entry[0], entry[1]);
  21211. }
  21212. }
  21213. /**
  21214. * Removes all key-value entries from the map.
  21215. *
  21216. * @private
  21217. * @name clear
  21218. * @memberOf MapCache
  21219. */
  21220. function mapCacheClear() {
  21221. this.size = 0;
  21222. this.__data__ = {
  21223. 'hash': new Hash,
  21224. 'map': new (Map || ListCache),
  21225. 'string': new Hash
  21226. };
  21227. }
  21228. /**
  21229. * Removes `key` and its value from the map.
  21230. *
  21231. * @private
  21232. * @name delete
  21233. * @memberOf MapCache
  21234. * @param {string} key The key of the value to remove.
  21235. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21236. */
  21237. function mapCacheDelete(key) {
  21238. var result = getMapData(this, key)['delete'](key);
  21239. this.size -= result ? 1 : 0;
  21240. return result;
  21241. }
  21242. /**
  21243. * Gets the map value for `key`.
  21244. *
  21245. * @private
  21246. * @name get
  21247. * @memberOf MapCache
  21248. * @param {string} key The key of the value to get.
  21249. * @returns {*} Returns the entry value.
  21250. */
  21251. function mapCacheGet(key) {
  21252. return getMapData(this, key).get(key);
  21253. }
  21254. /**
  21255. * Checks if a map value for `key` exists.
  21256. *
  21257. * @private
  21258. * @name has
  21259. * @memberOf MapCache
  21260. * @param {string} key The key of the entry to check.
  21261. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21262. */
  21263. function mapCacheHas(key) {
  21264. return getMapData(this, key).has(key);
  21265. }
  21266. /**
  21267. * Sets the map `key` to `value`.
  21268. *
  21269. * @private
  21270. * @name set
  21271. * @memberOf MapCache
  21272. * @param {string} key The key of the value to set.
  21273. * @param {*} value The value to set.
  21274. * @returns {Object} Returns the map cache instance.
  21275. */
  21276. function mapCacheSet(key, value) {
  21277. var data = getMapData(this, key),
  21278. size = data.size;
  21279. data.set(key, value);
  21280. this.size += data.size == size ? 0 : 1;
  21281. return this;
  21282. }
  21283. // Add methods to `MapCache`.
  21284. MapCache.prototype.clear = mapCacheClear;
  21285. MapCache.prototype['delete'] = mapCacheDelete;
  21286. MapCache.prototype.get = mapCacheGet;
  21287. MapCache.prototype.has = mapCacheHas;
  21288. MapCache.prototype.set = mapCacheSet;
  21289. /*------------------------------------------------------------------------*/
  21290. /**
  21291. *
  21292. * Creates an array cache object to store unique values.
  21293. *
  21294. * @private
  21295. * @constructor
  21296. * @param {Array} [values] The values to cache.
  21297. */
  21298. function SetCache(values) {
  21299. var index = -1,
  21300. length = values == null ? 0 : values.length;
  21301. this.__data__ = new MapCache;
  21302. while (++index < length) {
  21303. this.add(values[index]);
  21304. }
  21305. }
  21306. /**
  21307. * Adds `value` to the array cache.
  21308. *
  21309. * @private
  21310. * @name add
  21311. * @memberOf SetCache
  21312. * @alias push
  21313. * @param {*} value The value to cache.
  21314. * @returns {Object} Returns the cache instance.
  21315. */
  21316. function setCacheAdd(value) {
  21317. this.__data__.set(value, HASH_UNDEFINED);
  21318. return this;
  21319. }
  21320. /**
  21321. * Checks if `value` is in the array cache.
  21322. *
  21323. * @private
  21324. * @name has
  21325. * @memberOf SetCache
  21326. * @param {*} value The value to search for.
  21327. * @returns {number} Returns `true` if `value` is found, else `false`.
  21328. */
  21329. function setCacheHas(value) {
  21330. return this.__data__.has(value);
  21331. }
  21332. // Add methods to `SetCache`.
  21333. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  21334. SetCache.prototype.has = setCacheHas;
  21335. /*------------------------------------------------------------------------*/
  21336. /**
  21337. * Creates a stack cache object to store key-value pairs.
  21338. *
  21339. * @private
  21340. * @constructor
  21341. * @param {Array} [entries] The key-value pairs to cache.
  21342. */
  21343. function Stack(entries) {
  21344. var data = this.__data__ = new ListCache(entries);
  21345. this.size = data.size;
  21346. }
  21347. /**
  21348. * Removes all key-value entries from the stack.
  21349. *
  21350. * @private
  21351. * @name clear
  21352. * @memberOf Stack
  21353. */
  21354. function stackClear() {
  21355. this.__data__ = new ListCache;
  21356. this.size = 0;
  21357. }
  21358. /**
  21359. * Removes `key` and its value from the stack.
  21360. *
  21361. * @private
  21362. * @name delete
  21363. * @memberOf Stack
  21364. * @param {string} key The key of the value to remove.
  21365. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21366. */
  21367. function stackDelete(key) {
  21368. var data = this.__data__,
  21369. result = data['delete'](key);
  21370. this.size = data.size;
  21371. return result;
  21372. }
  21373. /**
  21374. * Gets the stack value for `key`.
  21375. *
  21376. * @private
  21377. * @name get
  21378. * @memberOf Stack
  21379. * @param {string} key The key of the value to get.
  21380. * @returns {*} Returns the entry value.
  21381. */
  21382. function stackGet(key) {
  21383. return this.__data__.get(key);
  21384. }
  21385. /**
  21386. * Checks if a stack value for `key` exists.
  21387. *
  21388. * @private
  21389. * @name has
  21390. * @memberOf Stack
  21391. * @param {string} key The key of the entry to check.
  21392. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21393. */
  21394. function stackHas(key) {
  21395. return this.__data__.has(key);
  21396. }
  21397. /**
  21398. * Sets the stack `key` to `value`.
  21399. *
  21400. * @private
  21401. * @name set
  21402. * @memberOf Stack
  21403. * @param {string} key The key of the value to set.
  21404. * @param {*} value The value to set.
  21405. * @returns {Object} Returns the stack cache instance.
  21406. */
  21407. function stackSet(key, value) {
  21408. var data = this.__data__;
  21409. if (data instanceof ListCache) {
  21410. var pairs = data.__data__;
  21411. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  21412. pairs.push([key, value]);
  21413. this.size = ++data.size;
  21414. return this;
  21415. }
  21416. data = this.__data__ = new MapCache(pairs);
  21417. }
  21418. data.set(key, value);
  21419. this.size = data.size;
  21420. return this;
  21421. }
  21422. // Add methods to `Stack`.
  21423. Stack.prototype.clear = stackClear;
  21424. Stack.prototype['delete'] = stackDelete;
  21425. Stack.prototype.get = stackGet;
  21426. Stack.prototype.has = stackHas;
  21427. Stack.prototype.set = stackSet;
  21428. /*------------------------------------------------------------------------*/
  21429. /**
  21430. * Creates an array of the enumerable property names of the array-like `value`.
  21431. *
  21432. * @private
  21433. * @param {*} value The value to query.
  21434. * @param {boolean} inherited Specify returning inherited property names.
  21435. * @returns {Array} Returns the array of property names.
  21436. */
  21437. function arrayLikeKeys(value, inherited) {
  21438. var isArr = isArray(value),
  21439. isArg = !isArr && isArguments(value),
  21440. isBuff = !isArr && !isArg && isBuffer(value),
  21441. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  21442. skipIndexes = isArr || isArg || isBuff || isType,
  21443. result = skipIndexes ? baseTimes(value.length, String) : [],
  21444. length = result.length;
  21445. for (var key in value) {
  21446. if ((inherited || hasOwnProperty.call(value, key)) &&
  21447. !(skipIndexes && (
  21448. // Safari 9 has enumerable `arguments.length` in strict mode.
  21449. key == 'length' ||
  21450. // Node.js 0.10 has enumerable non-index properties on buffers.
  21451. (isBuff && (key == 'offset' || key == 'parent')) ||
  21452. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  21453. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  21454. // Skip index properties.
  21455. isIndex(key, length)
  21456. ))) {
  21457. result.push(key);
  21458. }
  21459. }
  21460. return result;
  21461. }
  21462. /**
  21463. * A specialized version of `_.sample` for arrays.
  21464. *
  21465. * @private
  21466. * @param {Array} array The array to sample.
  21467. * @returns {*} Returns the random element.
  21468. */
  21469. function arraySample(array) {
  21470. var length = array.length;
  21471. return length ? array[baseRandom(0, length - 1)] : undefined;
  21472. }
  21473. /**
  21474. * A specialized version of `_.sampleSize` for arrays.
  21475. *
  21476. * @private
  21477. * @param {Array} array The array to sample.
  21478. * @param {number} n The number of elements to sample.
  21479. * @returns {Array} Returns the random elements.
  21480. */
  21481. function arraySampleSize(array, n) {
  21482. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  21483. }
  21484. /**
  21485. * A specialized version of `_.shuffle` for arrays.
  21486. *
  21487. * @private
  21488. * @param {Array} array The array to shuffle.
  21489. * @returns {Array} Returns the new shuffled array.
  21490. */
  21491. function arrayShuffle(array) {
  21492. return shuffleSelf(copyArray(array));
  21493. }
  21494. /**
  21495. * This function is like `assignValue` except that it doesn't assign
  21496. * `undefined` values.
  21497. *
  21498. * @private
  21499. * @param {Object} object The object to modify.
  21500. * @param {string} key The key of the property to assign.
  21501. * @param {*} value The value to assign.
  21502. */
  21503. function assignMergeValue(object, key, value) {
  21504. if ((value !== undefined && !eq(object[key], value)) ||
  21505. (value === undefined && !(key in object))) {
  21506. baseAssignValue(object, key, value);
  21507. }
  21508. }
  21509. /**
  21510. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  21511. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21512. * for equality comparisons.
  21513. *
  21514. * @private
  21515. * @param {Object} object The object to modify.
  21516. * @param {string} key The key of the property to assign.
  21517. * @param {*} value The value to assign.
  21518. */
  21519. function assignValue(object, key, value) {
  21520. var objValue = object[key];
  21521. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  21522. (value === undefined && !(key in object))) {
  21523. baseAssignValue(object, key, value);
  21524. }
  21525. }
  21526. /**
  21527. * Gets the index at which the `key` is found in `array` of key-value pairs.
  21528. *
  21529. * @private
  21530. * @param {Array} array The array to inspect.
  21531. * @param {*} key The key to search for.
  21532. * @returns {number} Returns the index of the matched value, else `-1`.
  21533. */
  21534. function assocIndexOf(array, key) {
  21535. var length = array.length;
  21536. while (length--) {
  21537. if (eq(array[length][0], key)) {
  21538. return length;
  21539. }
  21540. }
  21541. return -1;
  21542. }
  21543. /**
  21544. * Aggregates elements of `collection` on `accumulator` with keys transformed
  21545. * by `iteratee` and values set by `setter`.
  21546. *
  21547. * @private
  21548. * @param {Array|Object} collection The collection to iterate over.
  21549. * @param {Function} setter The function to set `accumulator` values.
  21550. * @param {Function} iteratee The iteratee to transform keys.
  21551. * @param {Object} accumulator The initial aggregated object.
  21552. * @returns {Function} Returns `accumulator`.
  21553. */
  21554. function baseAggregator(collection, setter, iteratee, accumulator) {
  21555. baseEach(collection, function(value, key, collection) {
  21556. setter(accumulator, value, iteratee(value), collection);
  21557. });
  21558. return accumulator;
  21559. }
  21560. /**
  21561. * The base implementation of `_.assign` without support for multiple sources
  21562. * or `customizer` functions.
  21563. *
  21564. * @private
  21565. * @param {Object} object The destination object.
  21566. * @param {Object} source The source object.
  21567. * @returns {Object} Returns `object`.
  21568. */
  21569. function baseAssign(object, source) {
  21570. return object && copyObject(source, keys(source), object);
  21571. }
  21572. /**
  21573. * The base implementation of `_.assignIn` without support for multiple sources
  21574. * or `customizer` functions.
  21575. *
  21576. * @private
  21577. * @param {Object} object The destination object.
  21578. * @param {Object} source The source object.
  21579. * @returns {Object} Returns `object`.
  21580. */
  21581. function baseAssignIn(object, source) {
  21582. return object && copyObject(source, keysIn(source), object);
  21583. }
  21584. /**
  21585. * The base implementation of `assignValue` and `assignMergeValue` without
  21586. * value checks.
  21587. *
  21588. * @private
  21589. * @param {Object} object The object to modify.
  21590. * @param {string} key The key of the property to assign.
  21591. * @param {*} value The value to assign.
  21592. */
  21593. function baseAssignValue(object, key, value) {
  21594. if (key == '__proto__' && defineProperty) {
  21595. defineProperty(object, key, {
  21596. 'configurable': true,
  21597. 'enumerable': true,
  21598. 'value': value,
  21599. 'writable': true
  21600. });
  21601. } else {
  21602. object[key] = value;
  21603. }
  21604. }
  21605. /**
  21606. * The base implementation of `_.at` without support for individual paths.
  21607. *
  21608. * @private
  21609. * @param {Object} object The object to iterate over.
  21610. * @param {string[]} paths The property paths to pick.
  21611. * @returns {Array} Returns the picked elements.
  21612. */
  21613. function baseAt(object, paths) {
  21614. var index = -1,
  21615. length = paths.length,
  21616. result = Array(length),
  21617. skip = object == null;
  21618. while (++index < length) {
  21619. result[index] = skip ? undefined : get(object, paths[index]);
  21620. }
  21621. return result;
  21622. }
  21623. /**
  21624. * The base implementation of `_.clamp` which doesn't coerce arguments.
  21625. *
  21626. * @private
  21627. * @param {number} number The number to clamp.
  21628. * @param {number} [lower] The lower bound.
  21629. * @param {number} upper The upper bound.
  21630. * @returns {number} Returns the clamped number.
  21631. */
  21632. function baseClamp(number, lower, upper) {
  21633. if (number === number) {
  21634. if (upper !== undefined) {
  21635. number = number <= upper ? number : upper;
  21636. }
  21637. if (lower !== undefined) {
  21638. number = number >= lower ? number : lower;
  21639. }
  21640. }
  21641. return number;
  21642. }
  21643. /**
  21644. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  21645. * traversed objects.
  21646. *
  21647. * @private
  21648. * @param {*} value The value to clone.
  21649. * @param {boolean} bitmask The bitmask flags.
  21650. * 1 - Deep clone
  21651. * 2 - Flatten inherited properties
  21652. * 4 - Clone symbols
  21653. * @param {Function} [customizer] The function to customize cloning.
  21654. * @param {string} [key] The key of `value`.
  21655. * @param {Object} [object] The parent object of `value`.
  21656. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  21657. * @returns {*} Returns the cloned value.
  21658. */
  21659. function baseClone(value, bitmask, customizer, key, object, stack) {
  21660. var result,
  21661. isDeep = bitmask & CLONE_DEEP_FLAG,
  21662. isFlat = bitmask & CLONE_FLAT_FLAG,
  21663. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  21664. if (customizer) {
  21665. result = object ? customizer(value, key, object, stack) : customizer(value);
  21666. }
  21667. if (result !== undefined) {
  21668. return result;
  21669. }
  21670. if (!isObject(value)) {
  21671. return value;
  21672. }
  21673. var isArr = isArray(value);
  21674. if (isArr) {
  21675. result = initCloneArray(value);
  21676. if (!isDeep) {
  21677. return copyArray(value, result);
  21678. }
  21679. } else {
  21680. var tag = getTag(value),
  21681. isFunc = tag == funcTag || tag == genTag;
  21682. if (isBuffer(value)) {
  21683. return cloneBuffer(value, isDeep);
  21684. }
  21685. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  21686. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  21687. if (!isDeep) {
  21688. return isFlat
  21689. ? copySymbolsIn(value, baseAssignIn(result, value))
  21690. : copySymbols(value, baseAssign(result, value));
  21691. }
  21692. } else {
  21693. if (!cloneableTags[tag]) {
  21694. return object ? value : {};
  21695. }
  21696. result = initCloneByTag(value, tag, isDeep);
  21697. }
  21698. }
  21699. // Check for circular references and return its corresponding clone.
  21700. stack || (stack = new Stack);
  21701. var stacked = stack.get(value);
  21702. if (stacked) {
  21703. return stacked;
  21704. }
  21705. stack.set(value, result);
  21706. if (isSet(value)) {
  21707. value.forEach(function(subValue) {
  21708. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  21709. });
  21710. } else if (isMap(value)) {
  21711. value.forEach(function(subValue, key) {
  21712. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21713. });
  21714. }
  21715. var keysFunc = isFull
  21716. ? (isFlat ? getAllKeysIn : getAllKeys)
  21717. : (isFlat ? keysIn : keys);
  21718. var props = isArr ? undefined : keysFunc(value);
  21719. arrayEach(props || value, function(subValue, key) {
  21720. if (props) {
  21721. key = subValue;
  21722. subValue = value[key];
  21723. }
  21724. // Recursively populate clone (susceptible to call stack limits).
  21725. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21726. });
  21727. return result;
  21728. }
  21729. /**
  21730. * The base implementation of `_.conforms` which doesn't clone `source`.
  21731. *
  21732. * @private
  21733. * @param {Object} source The object of property predicates to conform to.
  21734. * @returns {Function} Returns the new spec function.
  21735. */
  21736. function baseConforms(source) {
  21737. var props = keys(source);
  21738. return function(object) {
  21739. return baseConformsTo(object, source, props);
  21740. };
  21741. }
  21742. /**
  21743. * The base implementation of `_.conformsTo` which accepts `props` to check.
  21744. *
  21745. * @private
  21746. * @param {Object} object The object to inspect.
  21747. * @param {Object} source The object of property predicates to conform to.
  21748. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  21749. */
  21750. function baseConformsTo(object, source, props) {
  21751. var length = props.length;
  21752. if (object == null) {
  21753. return !length;
  21754. }
  21755. object = Object(object);
  21756. while (length--) {
  21757. var key = props[length],
  21758. predicate = source[key],
  21759. value = object[key];
  21760. if ((value === undefined && !(key in object)) || !predicate(value)) {
  21761. return false;
  21762. }
  21763. }
  21764. return true;
  21765. }
  21766. /**
  21767. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  21768. * to provide to `func`.
  21769. *
  21770. * @private
  21771. * @param {Function} func The function to delay.
  21772. * @param {number} wait The number of milliseconds to delay invocation.
  21773. * @param {Array} args The arguments to provide to `func`.
  21774. * @returns {number|Object} Returns the timer id or timeout object.
  21775. */
  21776. function baseDelay(func, wait, args) {
  21777. if (typeof func != 'function') {
  21778. throw new TypeError(FUNC_ERROR_TEXT);
  21779. }
  21780. return setTimeout(function() { func.apply(undefined, args); }, wait);
  21781. }
  21782. /**
  21783. * The base implementation of methods like `_.difference` without support
  21784. * for excluding multiple arrays or iteratee shorthands.
  21785. *
  21786. * @private
  21787. * @param {Array} array The array to inspect.
  21788. * @param {Array} values The values to exclude.
  21789. * @param {Function} [iteratee] The iteratee invoked per element.
  21790. * @param {Function} [comparator] The comparator invoked per element.
  21791. * @returns {Array} Returns the new array of filtered values.
  21792. */
  21793. function baseDifference(array, values, iteratee, comparator) {
  21794. var index = -1,
  21795. includes = arrayIncludes,
  21796. isCommon = true,
  21797. length = array.length,
  21798. result = [],
  21799. valuesLength = values.length;
  21800. if (!length) {
  21801. return result;
  21802. }
  21803. if (iteratee) {
  21804. values = arrayMap(values, baseUnary(iteratee));
  21805. }
  21806. if (comparator) {
  21807. includes = arrayIncludesWith;
  21808. isCommon = false;
  21809. }
  21810. else if (values.length >= LARGE_ARRAY_SIZE) {
  21811. includes = cacheHas;
  21812. isCommon = false;
  21813. values = new SetCache(values);
  21814. }
  21815. outer:
  21816. while (++index < length) {
  21817. var value = array[index],
  21818. computed = iteratee == null ? value : iteratee(value);
  21819. value = (comparator || value !== 0) ? value : 0;
  21820. if (isCommon && computed === computed) {
  21821. var valuesIndex = valuesLength;
  21822. while (valuesIndex--) {
  21823. if (values[valuesIndex] === computed) {
  21824. continue outer;
  21825. }
  21826. }
  21827. result.push(value);
  21828. }
  21829. else if (!includes(values, computed, comparator)) {
  21830. result.push(value);
  21831. }
  21832. }
  21833. return result;
  21834. }
  21835. /**
  21836. * The base implementation of `_.forEach` without support for iteratee shorthands.
  21837. *
  21838. * @private
  21839. * @param {Array|Object} collection The collection to iterate over.
  21840. * @param {Function} iteratee The function invoked per iteration.
  21841. * @returns {Array|Object} Returns `collection`.
  21842. */
  21843. var baseEach = createBaseEach(baseForOwn);
  21844. /**
  21845. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  21846. *
  21847. * @private
  21848. * @param {Array|Object} collection The collection to iterate over.
  21849. * @param {Function} iteratee The function invoked per iteration.
  21850. * @returns {Array|Object} Returns `collection`.
  21851. */
  21852. var baseEachRight = createBaseEach(baseForOwnRight, true);
  21853. /**
  21854. * The base implementation of `_.every` without support for iteratee shorthands.
  21855. *
  21856. * @private
  21857. * @param {Array|Object} collection The collection to iterate over.
  21858. * @param {Function} predicate The function invoked per iteration.
  21859. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  21860. * else `false`
  21861. */
  21862. function baseEvery(collection, predicate) {
  21863. var result = true;
  21864. baseEach(collection, function(value, index, collection) {
  21865. result = !!predicate(value, index, collection);
  21866. return result;
  21867. });
  21868. return result;
  21869. }
  21870. /**
  21871. * The base implementation of methods like `_.max` and `_.min` which accepts a
  21872. * `comparator` to determine the extremum value.
  21873. *
  21874. * @private
  21875. * @param {Array} array The array to iterate over.
  21876. * @param {Function} iteratee The iteratee invoked per iteration.
  21877. * @param {Function} comparator The comparator used to compare values.
  21878. * @returns {*} Returns the extremum value.
  21879. */
  21880. function baseExtremum(array, iteratee, comparator) {
  21881. var index = -1,
  21882. length = array.length;
  21883. while (++index < length) {
  21884. var value = array[index],
  21885. current = iteratee(value);
  21886. if (current != null && (computed === undefined
  21887. ? (current === current && !isSymbol(current))
  21888. : comparator(current, computed)
  21889. )) {
  21890. var computed = current,
  21891. result = value;
  21892. }
  21893. }
  21894. return result;
  21895. }
  21896. /**
  21897. * The base implementation of `_.fill` without an iteratee call guard.
  21898. *
  21899. * @private
  21900. * @param {Array} array The array to fill.
  21901. * @param {*} value The value to fill `array` with.
  21902. * @param {number} [start=0] The start position.
  21903. * @param {number} [end=array.length] The end position.
  21904. * @returns {Array} Returns `array`.
  21905. */
  21906. function baseFill(array, value, start, end) {
  21907. var length = array.length;
  21908. start = toInteger(start);
  21909. if (start < 0) {
  21910. start = -start > length ? 0 : (length + start);
  21911. }
  21912. end = (end === undefined || end > length) ? length : toInteger(end);
  21913. if (end < 0) {
  21914. end += length;
  21915. }
  21916. end = start > end ? 0 : toLength(end);
  21917. while (start < end) {
  21918. array[start++] = value;
  21919. }
  21920. return array;
  21921. }
  21922. /**
  21923. * The base implementation of `_.filter` without support for iteratee shorthands.
  21924. *
  21925. * @private
  21926. * @param {Array|Object} collection The collection to iterate over.
  21927. * @param {Function} predicate The function invoked per iteration.
  21928. * @returns {Array} Returns the new filtered array.
  21929. */
  21930. function baseFilter(collection, predicate) {
  21931. var result = [];
  21932. baseEach(collection, function(value, index, collection) {
  21933. if (predicate(value, index, collection)) {
  21934. result.push(value);
  21935. }
  21936. });
  21937. return result;
  21938. }
  21939. /**
  21940. * The base implementation of `_.flatten` with support for restricting flattening.
  21941. *
  21942. * @private
  21943. * @param {Array} array The array to flatten.
  21944. * @param {number} depth The maximum recursion depth.
  21945. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21946. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21947. * @param {Array} [result=[]] The initial result value.
  21948. * @returns {Array} Returns the new flattened array.
  21949. */
  21950. function baseFlatten(array, depth, predicate, isStrict, result) {
  21951. var index = -1,
  21952. length = array.length;
  21953. predicate || (predicate = isFlattenable);
  21954. result || (result = []);
  21955. while (++index < length) {
  21956. var value = array[index];
  21957. if (depth > 0 && predicate(value)) {
  21958. if (depth > 1) {
  21959. // Recursively flatten arrays (susceptible to call stack limits).
  21960. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21961. } else {
  21962. arrayPush(result, value);
  21963. }
  21964. } else if (!isStrict) {
  21965. result[result.length] = value;
  21966. }
  21967. }
  21968. return result;
  21969. }
  21970. /**
  21971. * The base implementation of `baseForOwn` which iterates over `object`
  21972. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21973. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21974. *
  21975. * @private
  21976. * @param {Object} object The object to iterate over.
  21977. * @param {Function} iteratee The function invoked per iteration.
  21978. * @param {Function} keysFunc The function to get the keys of `object`.
  21979. * @returns {Object} Returns `object`.
  21980. */
  21981. var baseFor = createBaseFor();
  21982. /**
  21983. * This function is like `baseFor` except that it iterates over properties
  21984. * in the opposite order.
  21985. *
  21986. * @private
  21987. * @param {Object} object The object to iterate over.
  21988. * @param {Function} iteratee The function invoked per iteration.
  21989. * @param {Function} keysFunc The function to get the keys of `object`.
  21990. * @returns {Object} Returns `object`.
  21991. */
  21992. var baseForRight = createBaseFor(true);
  21993. /**
  21994. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21995. *
  21996. * @private
  21997. * @param {Object} object The object to iterate over.
  21998. * @param {Function} iteratee The function invoked per iteration.
  21999. * @returns {Object} Returns `object`.
  22000. */
  22001. function baseForOwn(object, iteratee) {
  22002. return object && baseFor(object, iteratee, keys);
  22003. }
  22004. /**
  22005. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  22006. *
  22007. * @private
  22008. * @param {Object} object The object to iterate over.
  22009. * @param {Function} iteratee The function invoked per iteration.
  22010. * @returns {Object} Returns `object`.
  22011. */
  22012. function baseForOwnRight(object, iteratee) {
  22013. return object && baseForRight(object, iteratee, keys);
  22014. }
  22015. /**
  22016. * The base implementation of `_.functions` which creates an array of
  22017. * `object` function property names filtered from `props`.
  22018. *
  22019. * @private
  22020. * @param {Object} object The object to inspect.
  22021. * @param {Array} props The property names to filter.
  22022. * @returns {Array} Returns the function names.
  22023. */
  22024. function baseFunctions(object, props) {
  22025. return arrayFilter(props, function(key) {
  22026. return isFunction(object[key]);
  22027. });
  22028. }
  22029. /**
  22030. * The base implementation of `_.get` without support for default values.
  22031. *
  22032. * @private
  22033. * @param {Object} object The object to query.
  22034. * @param {Array|string} path The path of the property to get.
  22035. * @returns {*} Returns the resolved value.
  22036. */
  22037. function baseGet(object, path) {
  22038. path = castPath(path, object);
  22039. var index = 0,
  22040. length = path.length;
  22041. while (object != null && index < length) {
  22042. object = object[toKey(path[index++])];
  22043. }
  22044. return (index && index == length) ? object : undefined;
  22045. }
  22046. /**
  22047. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  22048. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  22049. * symbols of `object`.
  22050. *
  22051. * @private
  22052. * @param {Object} object The object to query.
  22053. * @param {Function} keysFunc The function to get the keys of `object`.
  22054. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  22055. * @returns {Array} Returns the array of property names and symbols.
  22056. */
  22057. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  22058. var result = keysFunc(object);
  22059. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  22060. }
  22061. /**
  22062. * The base implementation of `getTag` without fallbacks for buggy environments.
  22063. *
  22064. * @private
  22065. * @param {*} value The value to query.
  22066. * @returns {string} Returns the `toStringTag`.
  22067. */
  22068. function baseGetTag(value) {
  22069. if (value == null) {
  22070. return value === undefined ? undefinedTag : nullTag;
  22071. }
  22072. return (symToStringTag && symToStringTag in Object(value))
  22073. ? getRawTag(value)
  22074. : objectToString(value);
  22075. }
  22076. /**
  22077. * The base implementation of `_.gt` which doesn't coerce arguments.
  22078. *
  22079. * @private
  22080. * @param {*} value The value to compare.
  22081. * @param {*} other The other value to compare.
  22082. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  22083. * else `false`.
  22084. */
  22085. function baseGt(value, other) {
  22086. return value > other;
  22087. }
  22088. /**
  22089. * The base implementation of `_.has` without support for deep paths.
  22090. *
  22091. * @private
  22092. * @param {Object} [object] The object to query.
  22093. * @param {Array|string} key The key to check.
  22094. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  22095. */
  22096. function baseHas(object, key) {
  22097. return object != null && hasOwnProperty.call(object, key);
  22098. }
  22099. /**
  22100. * The base implementation of `_.hasIn` without support for deep paths.
  22101. *
  22102. * @private
  22103. * @param {Object} [object] The object to query.
  22104. * @param {Array|string} key The key to check.
  22105. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  22106. */
  22107. function baseHasIn(object, key) {
  22108. return object != null && key in Object(object);
  22109. }
  22110. /**
  22111. * The base implementation of `_.inRange` which doesn't coerce arguments.
  22112. *
  22113. * @private
  22114. * @param {number} number The number to check.
  22115. * @param {number} start The start of the range.
  22116. * @param {number} end The end of the range.
  22117. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  22118. */
  22119. function baseInRange(number, start, end) {
  22120. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  22121. }
  22122. /**
  22123. * The base implementation of methods like `_.intersection`, without support
  22124. * for iteratee shorthands, that accepts an array of arrays to inspect.
  22125. *
  22126. * @private
  22127. * @param {Array} arrays The arrays to inspect.
  22128. * @param {Function} [iteratee] The iteratee invoked per element.
  22129. * @param {Function} [comparator] The comparator invoked per element.
  22130. * @returns {Array} Returns the new array of shared values.
  22131. */
  22132. function baseIntersection(arrays, iteratee, comparator) {
  22133. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  22134. length = arrays[0].length,
  22135. othLength = arrays.length,
  22136. othIndex = othLength,
  22137. caches = Array(othLength),
  22138. maxLength = Infinity,
  22139. result = [];
  22140. while (othIndex--) {
  22141. var array = arrays[othIndex];
  22142. if (othIndex && iteratee) {
  22143. array = arrayMap(array, baseUnary(iteratee));
  22144. }
  22145. maxLength = nativeMin(array.length, maxLength);
  22146. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  22147. ? new SetCache(othIndex && array)
  22148. : undefined;
  22149. }
  22150. array = arrays[0];
  22151. var index = -1,
  22152. seen = caches[0];
  22153. outer:
  22154. while (++index < length && result.length < maxLength) {
  22155. var value = array[index],
  22156. computed = iteratee ? iteratee(value) : value;
  22157. value = (comparator || value !== 0) ? value : 0;
  22158. if (!(seen
  22159. ? cacheHas(seen, computed)
  22160. : includes(result, computed, comparator)
  22161. )) {
  22162. othIndex = othLength;
  22163. while (--othIndex) {
  22164. var cache = caches[othIndex];
  22165. if (!(cache
  22166. ? cacheHas(cache, computed)
  22167. : includes(arrays[othIndex], computed, comparator))
  22168. ) {
  22169. continue outer;
  22170. }
  22171. }
  22172. if (seen) {
  22173. seen.push(computed);
  22174. }
  22175. result.push(value);
  22176. }
  22177. }
  22178. return result;
  22179. }
  22180. /**
  22181. * The base implementation of `_.invert` and `_.invertBy` which inverts
  22182. * `object` with values transformed by `iteratee` and set by `setter`.
  22183. *
  22184. * @private
  22185. * @param {Object} object The object to iterate over.
  22186. * @param {Function} setter The function to set `accumulator` values.
  22187. * @param {Function} iteratee The iteratee to transform values.
  22188. * @param {Object} accumulator The initial inverted object.
  22189. * @returns {Function} Returns `accumulator`.
  22190. */
  22191. function baseInverter(object, setter, iteratee, accumulator) {
  22192. baseForOwn(object, function(value, key, object) {
  22193. setter(accumulator, iteratee(value), key, object);
  22194. });
  22195. return accumulator;
  22196. }
  22197. /**
  22198. * The base implementation of `_.invoke` without support for individual
  22199. * method arguments.
  22200. *
  22201. * @private
  22202. * @param {Object} object The object to query.
  22203. * @param {Array|string} path The path of the method to invoke.
  22204. * @param {Array} args The arguments to invoke the method with.
  22205. * @returns {*} Returns the result of the invoked method.
  22206. */
  22207. function baseInvoke(object, path, args) {
  22208. path = castPath(path, object);
  22209. object = parent(object, path);
  22210. var func = object == null ? object : object[toKey(last(path))];
  22211. return func == null ? undefined : apply(func, object, args);
  22212. }
  22213. /**
  22214. * The base implementation of `_.isArguments`.
  22215. *
  22216. * @private
  22217. * @param {*} value The value to check.
  22218. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  22219. */
  22220. function baseIsArguments(value) {
  22221. return isObjectLike(value) && baseGetTag(value) == argsTag;
  22222. }
  22223. /**
  22224. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  22225. *
  22226. * @private
  22227. * @param {*} value The value to check.
  22228. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  22229. */
  22230. function baseIsArrayBuffer(value) {
  22231. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  22232. }
  22233. /**
  22234. * The base implementation of `_.isDate` without Node.js optimizations.
  22235. *
  22236. * @private
  22237. * @param {*} value The value to check.
  22238. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  22239. */
  22240. function baseIsDate(value) {
  22241. return isObjectLike(value) && baseGetTag(value) == dateTag;
  22242. }
  22243. /**
  22244. * The base implementation of `_.isEqual` which supports partial comparisons
  22245. * and tracks traversed objects.
  22246. *
  22247. * @private
  22248. * @param {*} value The value to compare.
  22249. * @param {*} other The other value to compare.
  22250. * @param {boolean} bitmask The bitmask flags.
  22251. * 1 - Unordered comparison
  22252. * 2 - Partial comparison
  22253. * @param {Function} [customizer] The function to customize comparisons.
  22254. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  22255. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  22256. */
  22257. function baseIsEqual(value, other, bitmask, customizer, stack) {
  22258. if (value === other) {
  22259. return true;
  22260. }
  22261. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  22262. return value !== value && other !== other;
  22263. }
  22264. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  22265. }
  22266. /**
  22267. * A specialized version of `baseIsEqual` for arrays and objects which performs
  22268. * deep comparisons and tracks traversed objects enabling objects with circular
  22269. * references to be compared.
  22270. *
  22271. * @private
  22272. * @param {Object} object The object to compare.
  22273. * @param {Object} other The other object to compare.
  22274. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  22275. * @param {Function} customizer The function to customize comparisons.
  22276. * @param {Function} equalFunc The function to determine equivalents of values.
  22277. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  22278. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  22279. */
  22280. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  22281. var objIsArr = isArray(object),
  22282. othIsArr = isArray(other),
  22283. objTag = objIsArr ? arrayTag : getTag(object),
  22284. othTag = othIsArr ? arrayTag : getTag(other);
  22285. objTag = objTag == argsTag ? objectTag : objTag;
  22286. othTag = othTag == argsTag ? objectTag : othTag;
  22287. var objIsObj = objTag == objectTag,
  22288. othIsObj = othTag == objectTag,
  22289. isSameTag = objTag == othTag;
  22290. if (isSameTag && isBuffer(object)) {
  22291. if (!isBuffer(other)) {
  22292. return false;
  22293. }
  22294. objIsArr = true;
  22295. objIsObj = false;
  22296. }
  22297. if (isSameTag && !objIsObj) {
  22298. stack || (stack = new Stack);
  22299. return (objIsArr || isTypedArray(object))
  22300. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  22301. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  22302. }
  22303. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  22304. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  22305. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  22306. if (objIsWrapped || othIsWrapped) {
  22307. var objUnwrapped = objIsWrapped ? object.value() : object,
  22308. othUnwrapped = othIsWrapped ? other.value() : other;
  22309. stack || (stack = new Stack);
  22310. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  22311. }
  22312. }
  22313. if (!isSameTag) {
  22314. return false;
  22315. }
  22316. stack || (stack = new Stack);
  22317. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  22318. }
  22319. /**
  22320. * The base implementation of `_.isMap` without Node.js optimizations.
  22321. *
  22322. * @private
  22323. * @param {*} value The value to check.
  22324. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  22325. */
  22326. function baseIsMap(value) {
  22327. return isObjectLike(value) && getTag(value) == mapTag;
  22328. }
  22329. /**
  22330. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  22331. *
  22332. * @private
  22333. * @param {Object} object The object to inspect.
  22334. * @param {Object} source The object of property values to match.
  22335. * @param {Array} matchData The property names, values, and compare flags to match.
  22336. * @param {Function} [customizer] The function to customize comparisons.
  22337. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  22338. */
  22339. function baseIsMatch(object, source, matchData, customizer) {
  22340. var index = matchData.length,
  22341. length = index,
  22342. noCustomizer = !customizer;
  22343. if (object == null) {
  22344. return !length;
  22345. }
  22346. object = Object(object);
  22347. while (index--) {
  22348. var data = matchData[index];
  22349. if ((noCustomizer && data[2])
  22350. ? data[1] !== object[data[0]]
  22351. : !(data[0] in object)
  22352. ) {
  22353. return false;
  22354. }
  22355. }
  22356. while (++index < length) {
  22357. data = matchData[index];
  22358. var key = data[0],
  22359. objValue = object[key],
  22360. srcValue = data[1];
  22361. if (noCustomizer && data[2]) {
  22362. if (objValue === undefined && !(key in object)) {
  22363. return false;
  22364. }
  22365. } else {
  22366. var stack = new Stack;
  22367. if (customizer) {
  22368. var result = customizer(objValue, srcValue, key, object, source, stack);
  22369. }
  22370. if (!(result === undefined
  22371. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  22372. : result
  22373. )) {
  22374. return false;
  22375. }
  22376. }
  22377. }
  22378. return true;
  22379. }
  22380. /**
  22381. * The base implementation of `_.isNative` without bad shim checks.
  22382. *
  22383. * @private
  22384. * @param {*} value The value to check.
  22385. * @returns {boolean} Returns `true` if `value` is a native function,
  22386. * else `false`.
  22387. */
  22388. function baseIsNative(value) {
  22389. if (!isObject(value) || isMasked(value)) {
  22390. return false;
  22391. }
  22392. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  22393. return pattern.test(toSource(value));
  22394. }
  22395. /**
  22396. * The base implementation of `_.isRegExp` without Node.js optimizations.
  22397. *
  22398. * @private
  22399. * @param {*} value The value to check.
  22400. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  22401. */
  22402. function baseIsRegExp(value) {
  22403. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  22404. }
  22405. /**
  22406. * The base implementation of `_.isSet` without Node.js optimizations.
  22407. *
  22408. * @private
  22409. * @param {*} value The value to check.
  22410. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  22411. */
  22412. function baseIsSet(value) {
  22413. return isObjectLike(value) && getTag(value) == setTag;
  22414. }
  22415. /**
  22416. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  22417. *
  22418. * @private
  22419. * @param {*} value The value to check.
  22420. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  22421. */
  22422. function baseIsTypedArray(value) {
  22423. return isObjectLike(value) &&
  22424. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  22425. }
  22426. /**
  22427. * The base implementation of `_.iteratee`.
  22428. *
  22429. * @private
  22430. * @param {*} [value=_.identity] The value to convert to an iteratee.
  22431. * @returns {Function} Returns the iteratee.
  22432. */
  22433. function baseIteratee(value) {
  22434. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  22435. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  22436. if (typeof value == 'function') {
  22437. return value;
  22438. }
  22439. if (value == null) {
  22440. return identity;
  22441. }
  22442. if (typeof value == 'object') {
  22443. return isArray(value)
  22444. ? baseMatchesProperty(value[0], value[1])
  22445. : baseMatches(value);
  22446. }
  22447. return property(value);
  22448. }
  22449. /**
  22450. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  22451. *
  22452. * @private
  22453. * @param {Object} object The object to query.
  22454. * @returns {Array} Returns the array of property names.
  22455. */
  22456. function baseKeys(object) {
  22457. if (!isPrototype(object)) {
  22458. return nativeKeys(object);
  22459. }
  22460. var result = [];
  22461. for (var key in Object(object)) {
  22462. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  22463. result.push(key);
  22464. }
  22465. }
  22466. return result;
  22467. }
  22468. /**
  22469. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  22470. *
  22471. * @private
  22472. * @param {Object} object The object to query.
  22473. * @returns {Array} Returns the array of property names.
  22474. */
  22475. function baseKeysIn(object) {
  22476. if (!isObject(object)) {
  22477. return nativeKeysIn(object);
  22478. }
  22479. var isProto = isPrototype(object),
  22480. result = [];
  22481. for (var key in object) {
  22482. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  22483. result.push(key);
  22484. }
  22485. }
  22486. return result;
  22487. }
  22488. /**
  22489. * The base implementation of `_.lt` which doesn't coerce arguments.
  22490. *
  22491. * @private
  22492. * @param {*} value The value to compare.
  22493. * @param {*} other The other value to compare.
  22494. * @returns {boolean} Returns `true` if `value` is less than `other`,
  22495. * else `false`.
  22496. */
  22497. function baseLt(value, other) {
  22498. return value < other;
  22499. }
  22500. /**
  22501. * The base implementation of `_.map` without support for iteratee shorthands.
  22502. *
  22503. * @private
  22504. * @param {Array|Object} collection The collection to iterate over.
  22505. * @param {Function} iteratee The function invoked per iteration.
  22506. * @returns {Array} Returns the new mapped array.
  22507. */
  22508. function baseMap(collection, iteratee) {
  22509. var index = -1,
  22510. result = isArrayLike(collection) ? Array(collection.length) : [];
  22511. baseEach(collection, function(value, key, collection) {
  22512. result[++index] = iteratee(value, key, collection);
  22513. });
  22514. return result;
  22515. }
  22516. /**
  22517. * The base implementation of `_.matches` which doesn't clone `source`.
  22518. *
  22519. * @private
  22520. * @param {Object} source The object of property values to match.
  22521. * @returns {Function} Returns the new spec function.
  22522. */
  22523. function baseMatches(source) {
  22524. var matchData = getMatchData(source);
  22525. if (matchData.length == 1 && matchData[0][2]) {
  22526. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  22527. }
  22528. return function(object) {
  22529. return object === source || baseIsMatch(object, source, matchData);
  22530. };
  22531. }
  22532. /**
  22533. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  22534. *
  22535. * @private
  22536. * @param {string} path The path of the property to get.
  22537. * @param {*} srcValue The value to match.
  22538. * @returns {Function} Returns the new spec function.
  22539. */
  22540. function baseMatchesProperty(path, srcValue) {
  22541. if (isKey(path) && isStrictComparable(srcValue)) {
  22542. return matchesStrictComparable(toKey(path), srcValue);
  22543. }
  22544. return function(object) {
  22545. var objValue = get(object, path);
  22546. return (objValue === undefined && objValue === srcValue)
  22547. ? hasIn(object, path)
  22548. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  22549. };
  22550. }
  22551. /**
  22552. * The base implementation of `_.merge` without support for multiple sources.
  22553. *
  22554. * @private
  22555. * @param {Object} object The destination object.
  22556. * @param {Object} source The source object.
  22557. * @param {number} srcIndex The index of `source`.
  22558. * @param {Function} [customizer] The function to customize merged values.
  22559. * @param {Object} [stack] Tracks traversed source values and their merged
  22560. * counterparts.
  22561. */
  22562. function baseMerge(object, source, srcIndex, customizer, stack) {
  22563. if (object === source) {
  22564. return;
  22565. }
  22566. baseFor(source, function(srcValue, key) {
  22567. stack || (stack = new Stack);
  22568. if (isObject(srcValue)) {
  22569. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  22570. }
  22571. else {
  22572. var newValue = customizer
  22573. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  22574. : undefined;
  22575. if (newValue === undefined) {
  22576. newValue = srcValue;
  22577. }
  22578. assignMergeValue(object, key, newValue);
  22579. }
  22580. }, keysIn);
  22581. }
  22582. /**
  22583. * A specialized version of `baseMerge` for arrays and objects which performs
  22584. * deep merges and tracks traversed objects enabling objects with circular
  22585. * references to be merged.
  22586. *
  22587. * @private
  22588. * @param {Object} object The destination object.
  22589. * @param {Object} source The source object.
  22590. * @param {string} key The key of the value to merge.
  22591. * @param {number} srcIndex The index of `source`.
  22592. * @param {Function} mergeFunc The function to merge values.
  22593. * @param {Function} [customizer] The function to customize assigned values.
  22594. * @param {Object} [stack] Tracks traversed source values and their merged
  22595. * counterparts.
  22596. */
  22597. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  22598. var objValue = safeGet(object, key),
  22599. srcValue = safeGet(source, key),
  22600. stacked = stack.get(srcValue);
  22601. if (stacked) {
  22602. assignMergeValue(object, key, stacked);
  22603. return;
  22604. }
  22605. var newValue = customizer
  22606. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  22607. : undefined;
  22608. var isCommon = newValue === undefined;
  22609. if (isCommon) {
  22610. var isArr = isArray(srcValue),
  22611. isBuff = !isArr && isBuffer(srcValue),
  22612. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  22613. newValue = srcValue;
  22614. if (isArr || isBuff || isTyped) {
  22615. if (isArray(objValue)) {
  22616. newValue = objValue;
  22617. }
  22618. else if (isArrayLikeObject(objValue)) {
  22619. newValue = copyArray(objValue);
  22620. }
  22621. else if (isBuff) {
  22622. isCommon = false;
  22623. newValue = cloneBuffer(srcValue, true);
  22624. }
  22625. else if (isTyped) {
  22626. isCommon = false;
  22627. newValue = cloneTypedArray(srcValue, true);
  22628. }
  22629. else {
  22630. newValue = [];
  22631. }
  22632. }
  22633. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  22634. newValue = objValue;
  22635. if (isArguments(objValue)) {
  22636. newValue = toPlainObject(objValue);
  22637. }
  22638. else if (!isObject(objValue) || isFunction(objValue)) {
  22639. newValue = initCloneObject(srcValue);
  22640. }
  22641. }
  22642. else {
  22643. isCommon = false;
  22644. }
  22645. }
  22646. if (isCommon) {
  22647. // Recursively merge objects and arrays (susceptible to call stack limits).
  22648. stack.set(srcValue, newValue);
  22649. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  22650. stack['delete'](srcValue);
  22651. }
  22652. assignMergeValue(object, key, newValue);
  22653. }
  22654. /**
  22655. * The base implementation of `_.nth` which doesn't coerce arguments.
  22656. *
  22657. * @private
  22658. * @param {Array} array The array to query.
  22659. * @param {number} n The index of the element to return.
  22660. * @returns {*} Returns the nth element of `array`.
  22661. */
  22662. function baseNth(array, n) {
  22663. var length = array.length;
  22664. if (!length) {
  22665. return;
  22666. }
  22667. n += n < 0 ? length : 0;
  22668. return isIndex(n, length) ? array[n] : undefined;
  22669. }
  22670. /**
  22671. * The base implementation of `_.orderBy` without param guards.
  22672. *
  22673. * @private
  22674. * @param {Array|Object} collection The collection to iterate over.
  22675. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  22676. * @param {string[]} orders The sort orders of `iteratees`.
  22677. * @returns {Array} Returns the new sorted array.
  22678. */
  22679. function baseOrderBy(collection, iteratees, orders) {
  22680. var index = -1;
  22681. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  22682. var result = baseMap(collection, function(value, key, collection) {
  22683. var criteria = arrayMap(iteratees, function(iteratee) {
  22684. return iteratee(value);
  22685. });
  22686. return { 'criteria': criteria, 'index': ++index, 'value': value };
  22687. });
  22688. return baseSortBy(result, function(object, other) {
  22689. return compareMultiple(object, other, orders);
  22690. });
  22691. }
  22692. /**
  22693. * The base implementation of `_.pick` without support for individual
  22694. * property identifiers.
  22695. *
  22696. * @private
  22697. * @param {Object} object The source object.
  22698. * @param {string[]} paths The property paths to pick.
  22699. * @returns {Object} Returns the new object.
  22700. */
  22701. function basePick(object, paths) {
  22702. return basePickBy(object, paths, function(value, path) {
  22703. return hasIn(object, path);
  22704. });
  22705. }
  22706. /**
  22707. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  22708. *
  22709. * @private
  22710. * @param {Object} object The source object.
  22711. * @param {string[]} paths The property paths to pick.
  22712. * @param {Function} predicate The function invoked per property.
  22713. * @returns {Object} Returns the new object.
  22714. */
  22715. function basePickBy(object, paths, predicate) {
  22716. var index = -1,
  22717. length = paths.length,
  22718. result = {};
  22719. while (++index < length) {
  22720. var path = paths[index],
  22721. value = baseGet(object, path);
  22722. if (predicate(value, path)) {
  22723. baseSet(result, castPath(path, object), value);
  22724. }
  22725. }
  22726. return result;
  22727. }
  22728. /**
  22729. * A specialized version of `baseProperty` which supports deep paths.
  22730. *
  22731. * @private
  22732. * @param {Array|string} path The path of the property to get.
  22733. * @returns {Function} Returns the new accessor function.
  22734. */
  22735. function basePropertyDeep(path) {
  22736. return function(object) {
  22737. return baseGet(object, path);
  22738. };
  22739. }
  22740. /**
  22741. * The base implementation of `_.pullAllBy` without support for iteratee
  22742. * shorthands.
  22743. *
  22744. * @private
  22745. * @param {Array} array The array to modify.
  22746. * @param {Array} values The values to remove.
  22747. * @param {Function} [iteratee] The iteratee invoked per element.
  22748. * @param {Function} [comparator] The comparator invoked per element.
  22749. * @returns {Array} Returns `array`.
  22750. */
  22751. function basePullAll(array, values, iteratee, comparator) {
  22752. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  22753. index = -1,
  22754. length = values.length,
  22755. seen = array;
  22756. if (array === values) {
  22757. values = copyArray(values);
  22758. }
  22759. if (iteratee) {
  22760. seen = arrayMap(array, baseUnary(iteratee));
  22761. }
  22762. while (++index < length) {
  22763. var fromIndex = 0,
  22764. value = values[index],
  22765. computed = iteratee ? iteratee(value) : value;
  22766. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  22767. if (seen !== array) {
  22768. splice.call(seen, fromIndex, 1);
  22769. }
  22770. splice.call(array, fromIndex, 1);
  22771. }
  22772. }
  22773. return array;
  22774. }
  22775. /**
  22776. * The base implementation of `_.pullAt` without support for individual
  22777. * indexes or capturing the removed elements.
  22778. *
  22779. * @private
  22780. * @param {Array} array The array to modify.
  22781. * @param {number[]} indexes The indexes of elements to remove.
  22782. * @returns {Array} Returns `array`.
  22783. */
  22784. function basePullAt(array, indexes) {
  22785. var length = array ? indexes.length : 0,
  22786. lastIndex = length - 1;
  22787. while (length--) {
  22788. var index = indexes[length];
  22789. if (length == lastIndex || index !== previous) {
  22790. var previous = index;
  22791. if (isIndex(index)) {
  22792. splice.call(array, index, 1);
  22793. } else {
  22794. baseUnset(array, index);
  22795. }
  22796. }
  22797. }
  22798. return array;
  22799. }
  22800. /**
  22801. * The base implementation of `_.random` without support for returning
  22802. * floating-point numbers.
  22803. *
  22804. * @private
  22805. * @param {number} lower The lower bound.
  22806. * @param {number} upper The upper bound.
  22807. * @returns {number} Returns the random number.
  22808. */
  22809. function baseRandom(lower, upper) {
  22810. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  22811. }
  22812. /**
  22813. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  22814. * coerce arguments.
  22815. *
  22816. * @private
  22817. * @param {number} start The start of the range.
  22818. * @param {number} end The end of the range.
  22819. * @param {number} step The value to increment or decrement by.
  22820. * @param {boolean} [fromRight] Specify iterating from right to left.
  22821. * @returns {Array} Returns the range of numbers.
  22822. */
  22823. function baseRange(start, end, step, fromRight) {
  22824. var index = -1,
  22825. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  22826. result = Array(length);
  22827. while (length--) {
  22828. result[fromRight ? length : ++index] = start;
  22829. start += step;
  22830. }
  22831. return result;
  22832. }
  22833. /**
  22834. * The base implementation of `_.repeat` which doesn't coerce arguments.
  22835. *
  22836. * @private
  22837. * @param {string} string The string to repeat.
  22838. * @param {number} n The number of times to repeat the string.
  22839. * @returns {string} Returns the repeated string.
  22840. */
  22841. function baseRepeat(string, n) {
  22842. var result = '';
  22843. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  22844. return result;
  22845. }
  22846. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  22847. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  22848. do {
  22849. if (n % 2) {
  22850. result += string;
  22851. }
  22852. n = nativeFloor(n / 2);
  22853. if (n) {
  22854. string += string;
  22855. }
  22856. } while (n);
  22857. return result;
  22858. }
  22859. /**
  22860. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  22861. *
  22862. * @private
  22863. * @param {Function} func The function to apply a rest parameter to.
  22864. * @param {number} [start=func.length-1] The start position of the rest parameter.
  22865. * @returns {Function} Returns the new function.
  22866. */
  22867. function baseRest(func, start) {
  22868. return setToString(overRest(func, start, identity), func + '');
  22869. }
  22870. /**
  22871. * The base implementation of `_.sample`.
  22872. *
  22873. * @private
  22874. * @param {Array|Object} collection The collection to sample.
  22875. * @returns {*} Returns the random element.
  22876. */
  22877. function baseSample(collection) {
  22878. return arraySample(values(collection));
  22879. }
  22880. /**
  22881. * The base implementation of `_.sampleSize` without param guards.
  22882. *
  22883. * @private
  22884. * @param {Array|Object} collection The collection to sample.
  22885. * @param {number} n The number of elements to sample.
  22886. * @returns {Array} Returns the random elements.
  22887. */
  22888. function baseSampleSize(collection, n) {
  22889. var array = values(collection);
  22890. return shuffleSelf(array, baseClamp(n, 0, array.length));
  22891. }
  22892. /**
  22893. * The base implementation of `_.set`.
  22894. *
  22895. * @private
  22896. * @param {Object} object The object to modify.
  22897. * @param {Array|string} path The path of the property to set.
  22898. * @param {*} value The value to set.
  22899. * @param {Function} [customizer] The function to customize path creation.
  22900. * @returns {Object} Returns `object`.
  22901. */
  22902. function baseSet(object, path, value, customizer) {
  22903. if (!isObject(object)) {
  22904. return object;
  22905. }
  22906. path = castPath(path, object);
  22907. var index = -1,
  22908. length = path.length,
  22909. lastIndex = length - 1,
  22910. nested = object;
  22911. while (nested != null && ++index < length) {
  22912. var key = toKey(path[index]),
  22913. newValue = value;
  22914. if (index != lastIndex) {
  22915. var objValue = nested[key];
  22916. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  22917. if (newValue === undefined) {
  22918. newValue = isObject(objValue)
  22919. ? objValue
  22920. : (isIndex(path[index + 1]) ? [] : {});
  22921. }
  22922. }
  22923. assignValue(nested, key, newValue);
  22924. nested = nested[key];
  22925. }
  22926. return object;
  22927. }
  22928. /**
  22929. * The base implementation of `setData` without support for hot loop shorting.
  22930. *
  22931. * @private
  22932. * @param {Function} func The function to associate metadata with.
  22933. * @param {*} data The metadata.
  22934. * @returns {Function} Returns `func`.
  22935. */
  22936. var baseSetData = !metaMap ? identity : function(func, data) {
  22937. metaMap.set(func, data);
  22938. return func;
  22939. };
  22940. /**
  22941. * The base implementation of `setToString` without support for hot loop shorting.
  22942. *
  22943. * @private
  22944. * @param {Function} func The function to modify.
  22945. * @param {Function} string The `toString` result.
  22946. * @returns {Function} Returns `func`.
  22947. */
  22948. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22949. return defineProperty(func, 'toString', {
  22950. 'configurable': true,
  22951. 'enumerable': false,
  22952. 'value': constant(string),
  22953. 'writable': true
  22954. });
  22955. };
  22956. /**
  22957. * The base implementation of `_.shuffle`.
  22958. *
  22959. * @private
  22960. * @param {Array|Object} collection The collection to shuffle.
  22961. * @returns {Array} Returns the new shuffled array.
  22962. */
  22963. function baseShuffle(collection) {
  22964. return shuffleSelf(values(collection));
  22965. }
  22966. /**
  22967. * The base implementation of `_.slice` without an iteratee call guard.
  22968. *
  22969. * @private
  22970. * @param {Array} array The array to slice.
  22971. * @param {number} [start=0] The start position.
  22972. * @param {number} [end=array.length] The end position.
  22973. * @returns {Array} Returns the slice of `array`.
  22974. */
  22975. function baseSlice(array, start, end) {
  22976. var index = -1,
  22977. length = array.length;
  22978. if (start < 0) {
  22979. start = -start > length ? 0 : (length + start);
  22980. }
  22981. end = end > length ? length : end;
  22982. if (end < 0) {
  22983. end += length;
  22984. }
  22985. length = start > end ? 0 : ((end - start) >>> 0);
  22986. start >>>= 0;
  22987. var result = Array(length);
  22988. while (++index < length) {
  22989. result[index] = array[index + start];
  22990. }
  22991. return result;
  22992. }
  22993. /**
  22994. * The base implementation of `_.some` without support for iteratee shorthands.
  22995. *
  22996. * @private
  22997. * @param {Array|Object} collection The collection to iterate over.
  22998. * @param {Function} predicate The function invoked per iteration.
  22999. * @returns {boolean} Returns `true` if any element passes the predicate check,
  23000. * else `false`.
  23001. */
  23002. function baseSome(collection, predicate) {
  23003. var result;
  23004. baseEach(collection, function(value, index, collection) {
  23005. result = predicate(value, index, collection);
  23006. return !result;
  23007. });
  23008. return !!result;
  23009. }
  23010. /**
  23011. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  23012. * performs a binary search of `array` to determine the index at which `value`
  23013. * should be inserted into `array` in order to maintain its sort order.
  23014. *
  23015. * @private
  23016. * @param {Array} array The sorted array to inspect.
  23017. * @param {*} value The value to evaluate.
  23018. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  23019. * @returns {number} Returns the index at which `value` should be inserted
  23020. * into `array`.
  23021. */
  23022. function baseSortedIndex(array, value, retHighest) {
  23023. var low = 0,
  23024. high = array == null ? low : array.length;
  23025. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  23026. while (low < high) {
  23027. var mid = (low + high) >>> 1,
  23028. computed = array[mid];
  23029. if (computed !== null && !isSymbol(computed) &&
  23030. (retHighest ? (computed <= value) : (computed < value))) {
  23031. low = mid + 1;
  23032. } else {
  23033. high = mid;
  23034. }
  23035. }
  23036. return high;
  23037. }
  23038. return baseSortedIndexBy(array, value, identity, retHighest);
  23039. }
  23040. /**
  23041. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  23042. * which invokes `iteratee` for `value` and each element of `array` to compute
  23043. * their sort ranking. The iteratee is invoked with one argument; (value).
  23044. *
  23045. * @private
  23046. * @param {Array} array The sorted array to inspect.
  23047. * @param {*} value The value to evaluate.
  23048. * @param {Function} iteratee The iteratee invoked per element.
  23049. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  23050. * @returns {number} Returns the index at which `value` should be inserted
  23051. * into `array`.
  23052. */
  23053. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  23054. value = iteratee(value);
  23055. var low = 0,
  23056. high = array == null ? 0 : array.length,
  23057. valIsNaN = value !== value,
  23058. valIsNull = value === null,
  23059. valIsSymbol = isSymbol(value),
  23060. valIsUndefined = value === undefined;
  23061. while (low < high) {
  23062. var mid = nativeFloor((low + high) / 2),
  23063. computed = iteratee(array[mid]),
  23064. othIsDefined = computed !== undefined,
  23065. othIsNull = computed === null,
  23066. othIsReflexive = computed === computed,
  23067. othIsSymbol = isSymbol(computed);
  23068. if (valIsNaN) {
  23069. var setLow = retHighest || othIsReflexive;
  23070. } else if (valIsUndefined) {
  23071. setLow = othIsReflexive && (retHighest || othIsDefined);
  23072. } else if (valIsNull) {
  23073. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  23074. } else if (valIsSymbol) {
  23075. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  23076. } else if (othIsNull || othIsSymbol) {
  23077. setLow = false;
  23078. } else {
  23079. setLow = retHighest ? (computed <= value) : (computed < value);
  23080. }
  23081. if (setLow) {
  23082. low = mid + 1;
  23083. } else {
  23084. high = mid;
  23085. }
  23086. }
  23087. return nativeMin(high, MAX_ARRAY_INDEX);
  23088. }
  23089. /**
  23090. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  23091. * support for iteratee shorthands.
  23092. *
  23093. * @private
  23094. * @param {Array} array The array to inspect.
  23095. * @param {Function} [iteratee] The iteratee invoked per element.
  23096. * @returns {Array} Returns the new duplicate free array.
  23097. */
  23098. function baseSortedUniq(array, iteratee) {
  23099. var index = -1,
  23100. length = array.length,
  23101. resIndex = 0,
  23102. result = [];
  23103. while (++index < length) {
  23104. var value = array[index],
  23105. computed = iteratee ? iteratee(value) : value;
  23106. if (!index || !eq(computed, seen)) {
  23107. var seen = computed;
  23108. result[resIndex++] = value === 0 ? 0 : value;
  23109. }
  23110. }
  23111. return result;
  23112. }
  23113. /**
  23114. * The base implementation of `_.toNumber` which doesn't ensure correct
  23115. * conversions of binary, hexadecimal, or octal string values.
  23116. *
  23117. * @private
  23118. * @param {*} value The value to process.
  23119. * @returns {number} Returns the number.
  23120. */
  23121. function baseToNumber(value) {
  23122. if (typeof value == 'number') {
  23123. return value;
  23124. }
  23125. if (isSymbol(value)) {
  23126. return NAN;
  23127. }
  23128. return +value;
  23129. }
  23130. /**
  23131. * The base implementation of `_.toString` which doesn't convert nullish
  23132. * values to empty strings.
  23133. *
  23134. * @private
  23135. * @param {*} value The value to process.
  23136. * @returns {string} Returns the string.
  23137. */
  23138. function baseToString(value) {
  23139. // Exit early for strings to avoid a performance hit in some environments.
  23140. if (typeof value == 'string') {
  23141. return value;
  23142. }
  23143. if (isArray(value)) {
  23144. // Recursively convert values (susceptible to call stack limits).
  23145. return arrayMap(value, baseToString) + '';
  23146. }
  23147. if (isSymbol(value)) {
  23148. return symbolToString ? symbolToString.call(value) : '';
  23149. }
  23150. var result = (value + '');
  23151. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  23152. }
  23153. /**
  23154. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  23155. *
  23156. * @private
  23157. * @param {Array} array The array to inspect.
  23158. * @param {Function} [iteratee] The iteratee invoked per element.
  23159. * @param {Function} [comparator] The comparator invoked per element.
  23160. * @returns {Array} Returns the new duplicate free array.
  23161. */
  23162. function baseUniq(array, iteratee, comparator) {
  23163. var index = -1,
  23164. includes = arrayIncludes,
  23165. length = array.length,
  23166. isCommon = true,
  23167. result = [],
  23168. seen = result;
  23169. if (comparator) {
  23170. isCommon = false;
  23171. includes = arrayIncludesWith;
  23172. }
  23173. else if (length >= LARGE_ARRAY_SIZE) {
  23174. var set = iteratee ? null : createSet(array);
  23175. if (set) {
  23176. return setToArray(set);
  23177. }
  23178. isCommon = false;
  23179. includes = cacheHas;
  23180. seen = new SetCache;
  23181. }
  23182. else {
  23183. seen = iteratee ? [] : result;
  23184. }
  23185. outer:
  23186. while (++index < length) {
  23187. var value = array[index],
  23188. computed = iteratee ? iteratee(value) : value;
  23189. value = (comparator || value !== 0) ? value : 0;
  23190. if (isCommon && computed === computed) {
  23191. var seenIndex = seen.length;
  23192. while (seenIndex--) {
  23193. if (seen[seenIndex] === computed) {
  23194. continue outer;
  23195. }
  23196. }
  23197. if (iteratee) {
  23198. seen.push(computed);
  23199. }
  23200. result.push(value);
  23201. }
  23202. else if (!includes(seen, computed, comparator)) {
  23203. if (seen !== result) {
  23204. seen.push(computed);
  23205. }
  23206. result.push(value);
  23207. }
  23208. }
  23209. return result;
  23210. }
  23211. /**
  23212. * The base implementation of `_.unset`.
  23213. *
  23214. * @private
  23215. * @param {Object} object The object to modify.
  23216. * @param {Array|string} path The property path to unset.
  23217. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  23218. */
  23219. function baseUnset(object, path) {
  23220. path = castPath(path, object);
  23221. object = parent(object, path);
  23222. return object == null || delete object[toKey(last(path))];
  23223. }
  23224. /**
  23225. * The base implementation of `_.update`.
  23226. *
  23227. * @private
  23228. * @param {Object} object The object to modify.
  23229. * @param {Array|string} path The path of the property to update.
  23230. * @param {Function} updater The function to produce the updated value.
  23231. * @param {Function} [customizer] The function to customize path creation.
  23232. * @returns {Object} Returns `object`.
  23233. */
  23234. function baseUpdate(object, path, updater, customizer) {
  23235. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  23236. }
  23237. /**
  23238. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  23239. * without support for iteratee shorthands.
  23240. *
  23241. * @private
  23242. * @param {Array} array The array to query.
  23243. * @param {Function} predicate The function invoked per iteration.
  23244. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  23245. * @param {boolean} [fromRight] Specify iterating from right to left.
  23246. * @returns {Array} Returns the slice of `array`.
  23247. */
  23248. function baseWhile(array, predicate, isDrop, fromRight) {
  23249. var length = array.length,
  23250. index = fromRight ? length : -1;
  23251. while ((fromRight ? index-- : ++index < length) &&
  23252. predicate(array[index], index, array)) {}
  23253. return isDrop
  23254. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  23255. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  23256. }
  23257. /**
  23258. * The base implementation of `wrapperValue` which returns the result of
  23259. * performing a sequence of actions on the unwrapped `value`, where each
  23260. * successive action is supplied the return value of the previous.
  23261. *
  23262. * @private
  23263. * @param {*} value The unwrapped value.
  23264. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  23265. * @returns {*} Returns the resolved value.
  23266. */
  23267. function baseWrapperValue(value, actions) {
  23268. var result = value;
  23269. if (result instanceof LazyWrapper) {
  23270. result = result.value();
  23271. }
  23272. return arrayReduce(actions, function(result, action) {
  23273. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  23274. }, result);
  23275. }
  23276. /**
  23277. * The base implementation of methods like `_.xor`, without support for
  23278. * iteratee shorthands, that accepts an array of arrays to inspect.
  23279. *
  23280. * @private
  23281. * @param {Array} arrays The arrays to inspect.
  23282. * @param {Function} [iteratee] The iteratee invoked per element.
  23283. * @param {Function} [comparator] The comparator invoked per element.
  23284. * @returns {Array} Returns the new array of values.
  23285. */
  23286. function baseXor(arrays, iteratee, comparator) {
  23287. var length = arrays.length;
  23288. if (length < 2) {
  23289. return length ? baseUniq(arrays[0]) : [];
  23290. }
  23291. var index = -1,
  23292. result = Array(length);
  23293. while (++index < length) {
  23294. var array = arrays[index],
  23295. othIndex = -1;
  23296. while (++othIndex < length) {
  23297. if (othIndex != index) {
  23298. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  23299. }
  23300. }
  23301. }
  23302. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  23303. }
  23304. /**
  23305. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  23306. *
  23307. * @private
  23308. * @param {Array} props The property identifiers.
  23309. * @param {Array} values The property values.
  23310. * @param {Function} assignFunc The function to assign values.
  23311. * @returns {Object} Returns the new object.
  23312. */
  23313. function baseZipObject(props, values, assignFunc) {
  23314. var index = -1,
  23315. length = props.length,
  23316. valsLength = values.length,
  23317. result = {};
  23318. while (++index < length) {
  23319. var value = index < valsLength ? values[index] : undefined;
  23320. assignFunc(result, props[index], value);
  23321. }
  23322. return result;
  23323. }
  23324. /**
  23325. * Casts `value` to an empty array if it's not an array like object.
  23326. *
  23327. * @private
  23328. * @param {*} value The value to inspect.
  23329. * @returns {Array|Object} Returns the cast array-like object.
  23330. */
  23331. function castArrayLikeObject(value) {
  23332. return isArrayLikeObject(value) ? value : [];
  23333. }
  23334. /**
  23335. * Casts `value` to `identity` if it's not a function.
  23336. *
  23337. * @private
  23338. * @param {*} value The value to inspect.
  23339. * @returns {Function} Returns cast function.
  23340. */
  23341. function castFunction(value) {
  23342. return typeof value == 'function' ? value : identity;
  23343. }
  23344. /**
  23345. * Casts `value` to a path array if it's not one.
  23346. *
  23347. * @private
  23348. * @param {*} value The value to inspect.
  23349. * @param {Object} [object] The object to query keys on.
  23350. * @returns {Array} Returns the cast property path array.
  23351. */
  23352. function castPath(value, object) {
  23353. if (isArray(value)) {
  23354. return value;
  23355. }
  23356. return isKey(value, object) ? [value] : stringToPath(toString(value));
  23357. }
  23358. /**
  23359. * A `baseRest` alias which can be replaced with `identity` by module
  23360. * replacement plugins.
  23361. *
  23362. * @private
  23363. * @type {Function}
  23364. * @param {Function} func The function to apply a rest parameter to.
  23365. * @returns {Function} Returns the new function.
  23366. */
  23367. var castRest = baseRest;
  23368. /**
  23369. * Casts `array` to a slice if it's needed.
  23370. *
  23371. * @private
  23372. * @param {Array} array The array to inspect.
  23373. * @param {number} start The start position.
  23374. * @param {number} [end=array.length] The end position.
  23375. * @returns {Array} Returns the cast slice.
  23376. */
  23377. function castSlice(array, start, end) {
  23378. var length = array.length;
  23379. end = end === undefined ? length : end;
  23380. return (!start && end >= length) ? array : baseSlice(array, start, end);
  23381. }
  23382. /**
  23383. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  23384. *
  23385. * @private
  23386. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  23387. */
  23388. var clearTimeout = ctxClearTimeout || function(id) {
  23389. return root.clearTimeout(id);
  23390. };
  23391. /**
  23392. * Creates a clone of `buffer`.
  23393. *
  23394. * @private
  23395. * @param {Buffer} buffer The buffer to clone.
  23396. * @param {boolean} [isDeep] Specify a deep clone.
  23397. * @returns {Buffer} Returns the cloned buffer.
  23398. */
  23399. function cloneBuffer(buffer, isDeep) {
  23400. if (isDeep) {
  23401. return buffer.slice();
  23402. }
  23403. var length = buffer.length,
  23404. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  23405. buffer.copy(result);
  23406. return result;
  23407. }
  23408. /**
  23409. * Creates a clone of `arrayBuffer`.
  23410. *
  23411. * @private
  23412. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  23413. * @returns {ArrayBuffer} Returns the cloned array buffer.
  23414. */
  23415. function cloneArrayBuffer(arrayBuffer) {
  23416. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  23417. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  23418. return result;
  23419. }
  23420. /**
  23421. * Creates a clone of `dataView`.
  23422. *
  23423. * @private
  23424. * @param {Object} dataView The data view to clone.
  23425. * @param {boolean} [isDeep] Specify a deep clone.
  23426. * @returns {Object} Returns the cloned data view.
  23427. */
  23428. function cloneDataView(dataView, isDeep) {
  23429. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  23430. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  23431. }
  23432. /**
  23433. * Creates a clone of `regexp`.
  23434. *
  23435. * @private
  23436. * @param {Object} regexp The regexp to clone.
  23437. * @returns {Object} Returns the cloned regexp.
  23438. */
  23439. function cloneRegExp(regexp) {
  23440. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  23441. result.lastIndex = regexp.lastIndex;
  23442. return result;
  23443. }
  23444. /**
  23445. * Creates a clone of the `symbol` object.
  23446. *
  23447. * @private
  23448. * @param {Object} symbol The symbol object to clone.
  23449. * @returns {Object} Returns the cloned symbol object.
  23450. */
  23451. function cloneSymbol(symbol) {
  23452. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  23453. }
  23454. /**
  23455. * Creates a clone of `typedArray`.
  23456. *
  23457. * @private
  23458. * @param {Object} typedArray The typed array to clone.
  23459. * @param {boolean} [isDeep] Specify a deep clone.
  23460. * @returns {Object} Returns the cloned typed array.
  23461. */
  23462. function cloneTypedArray(typedArray, isDeep) {
  23463. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  23464. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  23465. }
  23466. /**
  23467. * Compares values to sort them in ascending order.
  23468. *
  23469. * @private
  23470. * @param {*} value The value to compare.
  23471. * @param {*} other The other value to compare.
  23472. * @returns {number} Returns the sort order indicator for `value`.
  23473. */
  23474. function compareAscending(value, other) {
  23475. if (value !== other) {
  23476. var valIsDefined = value !== undefined,
  23477. valIsNull = value === null,
  23478. valIsReflexive = value === value,
  23479. valIsSymbol = isSymbol(value);
  23480. var othIsDefined = other !== undefined,
  23481. othIsNull = other === null,
  23482. othIsReflexive = other === other,
  23483. othIsSymbol = isSymbol(other);
  23484. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  23485. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  23486. (valIsNull && othIsDefined && othIsReflexive) ||
  23487. (!valIsDefined && othIsReflexive) ||
  23488. !valIsReflexive) {
  23489. return 1;
  23490. }
  23491. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  23492. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  23493. (othIsNull && valIsDefined && valIsReflexive) ||
  23494. (!othIsDefined && valIsReflexive) ||
  23495. !othIsReflexive) {
  23496. return -1;
  23497. }
  23498. }
  23499. return 0;
  23500. }
  23501. /**
  23502. * Used by `_.orderBy` to compare multiple properties of a value to another
  23503. * and stable sort them.
  23504. *
  23505. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  23506. * specify an order of "desc" for descending or "asc" for ascending sort order
  23507. * of corresponding values.
  23508. *
  23509. * @private
  23510. * @param {Object} object The object to compare.
  23511. * @param {Object} other The other object to compare.
  23512. * @param {boolean[]|string[]} orders The order to sort by for each property.
  23513. * @returns {number} Returns the sort order indicator for `object`.
  23514. */
  23515. function compareMultiple(object, other, orders) {
  23516. var index = -1,
  23517. objCriteria = object.criteria,
  23518. othCriteria = other.criteria,
  23519. length = objCriteria.length,
  23520. ordersLength = orders.length;
  23521. while (++index < length) {
  23522. var result = compareAscending(objCriteria[index], othCriteria[index]);
  23523. if (result) {
  23524. if (index >= ordersLength) {
  23525. return result;
  23526. }
  23527. var order = orders[index];
  23528. return result * (order == 'desc' ? -1 : 1);
  23529. }
  23530. }
  23531. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  23532. // that causes it, under certain circumstances, to provide the same value for
  23533. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  23534. // for more details.
  23535. //
  23536. // This also ensures a stable sort in V8 and other engines.
  23537. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  23538. return object.index - other.index;
  23539. }
  23540. /**
  23541. * Creates an array that is the composition of partially applied arguments,
  23542. * placeholders, and provided arguments into a single array of arguments.
  23543. *
  23544. * @private
  23545. * @param {Array} args The provided arguments.
  23546. * @param {Array} partials The arguments to prepend to those provided.
  23547. * @param {Array} holders The `partials` placeholder indexes.
  23548. * @params {boolean} [isCurried] Specify composing for a curried function.
  23549. * @returns {Array} Returns the new array of composed arguments.
  23550. */
  23551. function composeArgs(args, partials, holders, isCurried) {
  23552. var argsIndex = -1,
  23553. argsLength = args.length,
  23554. holdersLength = holders.length,
  23555. leftIndex = -1,
  23556. leftLength = partials.length,
  23557. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23558. result = Array(leftLength + rangeLength),
  23559. isUncurried = !isCurried;
  23560. while (++leftIndex < leftLength) {
  23561. result[leftIndex] = partials[leftIndex];
  23562. }
  23563. while (++argsIndex < holdersLength) {
  23564. if (isUncurried || argsIndex < argsLength) {
  23565. result[holders[argsIndex]] = args[argsIndex];
  23566. }
  23567. }
  23568. while (rangeLength--) {
  23569. result[leftIndex++] = args[argsIndex++];
  23570. }
  23571. return result;
  23572. }
  23573. /**
  23574. * This function is like `composeArgs` except that the arguments composition
  23575. * is tailored for `_.partialRight`.
  23576. *
  23577. * @private
  23578. * @param {Array} args The provided arguments.
  23579. * @param {Array} partials The arguments to append to those provided.
  23580. * @param {Array} holders The `partials` placeholder indexes.
  23581. * @params {boolean} [isCurried] Specify composing for a curried function.
  23582. * @returns {Array} Returns the new array of composed arguments.
  23583. */
  23584. function composeArgsRight(args, partials, holders, isCurried) {
  23585. var argsIndex = -1,
  23586. argsLength = args.length,
  23587. holdersIndex = -1,
  23588. holdersLength = holders.length,
  23589. rightIndex = -1,
  23590. rightLength = partials.length,
  23591. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23592. result = Array(rangeLength + rightLength),
  23593. isUncurried = !isCurried;
  23594. while (++argsIndex < rangeLength) {
  23595. result[argsIndex] = args[argsIndex];
  23596. }
  23597. var offset = argsIndex;
  23598. while (++rightIndex < rightLength) {
  23599. result[offset + rightIndex] = partials[rightIndex];
  23600. }
  23601. while (++holdersIndex < holdersLength) {
  23602. if (isUncurried || argsIndex < argsLength) {
  23603. result[offset + holders[holdersIndex]] = args[argsIndex++];
  23604. }
  23605. }
  23606. return result;
  23607. }
  23608. /**
  23609. * Copies the values of `source` to `array`.
  23610. *
  23611. * @private
  23612. * @param {Array} source The array to copy values from.
  23613. * @param {Array} [array=[]] The array to copy values to.
  23614. * @returns {Array} Returns `array`.
  23615. */
  23616. function copyArray(source, array) {
  23617. var index = -1,
  23618. length = source.length;
  23619. array || (array = Array(length));
  23620. while (++index < length) {
  23621. array[index] = source[index];
  23622. }
  23623. return array;
  23624. }
  23625. /**
  23626. * Copies properties of `source` to `object`.
  23627. *
  23628. * @private
  23629. * @param {Object} source The object to copy properties from.
  23630. * @param {Array} props The property identifiers to copy.
  23631. * @param {Object} [object={}] The object to copy properties to.
  23632. * @param {Function} [customizer] The function to customize copied values.
  23633. * @returns {Object} Returns `object`.
  23634. */
  23635. function copyObject(source, props, object, customizer) {
  23636. var isNew = !object;
  23637. object || (object = {});
  23638. var index = -1,
  23639. length = props.length;
  23640. while (++index < length) {
  23641. var key = props[index];
  23642. var newValue = customizer
  23643. ? customizer(object[key], source[key], key, object, source)
  23644. : undefined;
  23645. if (newValue === undefined) {
  23646. newValue = source[key];
  23647. }
  23648. if (isNew) {
  23649. baseAssignValue(object, key, newValue);
  23650. } else {
  23651. assignValue(object, key, newValue);
  23652. }
  23653. }
  23654. return object;
  23655. }
  23656. /**
  23657. * Copies own symbols of `source` to `object`.
  23658. *
  23659. * @private
  23660. * @param {Object} source The object to copy symbols from.
  23661. * @param {Object} [object={}] The object to copy symbols to.
  23662. * @returns {Object} Returns `object`.
  23663. */
  23664. function copySymbols(source, object) {
  23665. return copyObject(source, getSymbols(source), object);
  23666. }
  23667. /**
  23668. * Copies own and inherited symbols of `source` to `object`.
  23669. *
  23670. * @private
  23671. * @param {Object} source The object to copy symbols from.
  23672. * @param {Object} [object={}] The object to copy symbols to.
  23673. * @returns {Object} Returns `object`.
  23674. */
  23675. function copySymbolsIn(source, object) {
  23676. return copyObject(source, getSymbolsIn(source), object);
  23677. }
  23678. /**
  23679. * Creates a function like `_.groupBy`.
  23680. *
  23681. * @private
  23682. * @param {Function} setter The function to set accumulator values.
  23683. * @param {Function} [initializer] The accumulator object initializer.
  23684. * @returns {Function} Returns the new aggregator function.
  23685. */
  23686. function createAggregator(setter, initializer) {
  23687. return function(collection, iteratee) {
  23688. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  23689. accumulator = initializer ? initializer() : {};
  23690. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  23691. };
  23692. }
  23693. /**
  23694. * Creates a function like `_.assign`.
  23695. *
  23696. * @private
  23697. * @param {Function} assigner The function to assign values.
  23698. * @returns {Function} Returns the new assigner function.
  23699. */
  23700. function createAssigner(assigner) {
  23701. return baseRest(function(object, sources) {
  23702. var index = -1,
  23703. length = sources.length,
  23704. customizer = length > 1 ? sources[length - 1] : undefined,
  23705. guard = length > 2 ? sources[2] : undefined;
  23706. customizer = (assigner.length > 3 && typeof customizer == 'function')
  23707. ? (length--, customizer)
  23708. : undefined;
  23709. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  23710. customizer = length < 3 ? undefined : customizer;
  23711. length = 1;
  23712. }
  23713. object = Object(object);
  23714. while (++index < length) {
  23715. var source = sources[index];
  23716. if (source) {
  23717. assigner(object, source, index, customizer);
  23718. }
  23719. }
  23720. return object;
  23721. });
  23722. }
  23723. /**
  23724. * Creates a `baseEach` or `baseEachRight` function.
  23725. *
  23726. * @private
  23727. * @param {Function} eachFunc The function to iterate over a collection.
  23728. * @param {boolean} [fromRight] Specify iterating from right to left.
  23729. * @returns {Function} Returns the new base function.
  23730. */
  23731. function createBaseEach(eachFunc, fromRight) {
  23732. return function(collection, iteratee) {
  23733. if (collection == null) {
  23734. return collection;
  23735. }
  23736. if (!isArrayLike(collection)) {
  23737. return eachFunc(collection, iteratee);
  23738. }
  23739. var length = collection.length,
  23740. index = fromRight ? length : -1,
  23741. iterable = Object(collection);
  23742. while ((fromRight ? index-- : ++index < length)) {
  23743. if (iteratee(iterable[index], index, iterable) === false) {
  23744. break;
  23745. }
  23746. }
  23747. return collection;
  23748. };
  23749. }
  23750. /**
  23751. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  23752. *
  23753. * @private
  23754. * @param {boolean} [fromRight] Specify iterating from right to left.
  23755. * @returns {Function} Returns the new base function.
  23756. */
  23757. function createBaseFor(fromRight) {
  23758. return function(object, iteratee, keysFunc) {
  23759. var index = -1,
  23760. iterable = Object(object),
  23761. props = keysFunc(object),
  23762. length = props.length;
  23763. while (length--) {
  23764. var key = props[fromRight ? length : ++index];
  23765. if (iteratee(iterable[key], key, iterable) === false) {
  23766. break;
  23767. }
  23768. }
  23769. return object;
  23770. };
  23771. }
  23772. /**
  23773. * Creates a function that wraps `func` to invoke it with the optional `this`
  23774. * binding of `thisArg`.
  23775. *
  23776. * @private
  23777. * @param {Function} func The function to wrap.
  23778. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23779. * @param {*} [thisArg] The `this` binding of `func`.
  23780. * @returns {Function} Returns the new wrapped function.
  23781. */
  23782. function createBind(func, bitmask, thisArg) {
  23783. var isBind = bitmask & WRAP_BIND_FLAG,
  23784. Ctor = createCtor(func);
  23785. function wrapper() {
  23786. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23787. return fn.apply(isBind ? thisArg : this, arguments);
  23788. }
  23789. return wrapper;
  23790. }
  23791. /**
  23792. * Creates a function like `_.lowerFirst`.
  23793. *
  23794. * @private
  23795. * @param {string} methodName The name of the `String` case method to use.
  23796. * @returns {Function} Returns the new case function.
  23797. */
  23798. function createCaseFirst(methodName) {
  23799. return function(string) {
  23800. string = toString(string);
  23801. var strSymbols = hasUnicode(string)
  23802. ? stringToArray(string)
  23803. : undefined;
  23804. var chr = strSymbols
  23805. ? strSymbols[0]
  23806. : string.charAt(0);
  23807. var trailing = strSymbols
  23808. ? castSlice(strSymbols, 1).join('')
  23809. : string.slice(1);
  23810. return chr[methodName]() + trailing;
  23811. };
  23812. }
  23813. /**
  23814. * Creates a function like `_.camelCase`.
  23815. *
  23816. * @private
  23817. * @param {Function} callback The function to combine each word.
  23818. * @returns {Function} Returns the new compounder function.
  23819. */
  23820. function createCompounder(callback) {
  23821. return function(string) {
  23822. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  23823. };
  23824. }
  23825. /**
  23826. * Creates a function that produces an instance of `Ctor` regardless of
  23827. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  23828. *
  23829. * @private
  23830. * @param {Function} Ctor The constructor to wrap.
  23831. * @returns {Function} Returns the new wrapped function.
  23832. */
  23833. function createCtor(Ctor) {
  23834. return function() {
  23835. // Use a `switch` statement to work with class constructors. See
  23836. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  23837. // for more details.
  23838. var args = arguments;
  23839. switch (args.length) {
  23840. case 0: return new Ctor;
  23841. case 1: return new Ctor(args[0]);
  23842. case 2: return new Ctor(args[0], args[1]);
  23843. case 3: return new Ctor(args[0], args[1], args[2]);
  23844. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  23845. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  23846. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  23847. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  23848. }
  23849. var thisBinding = baseCreate(Ctor.prototype),
  23850. result = Ctor.apply(thisBinding, args);
  23851. // Mimic the constructor's `return` behavior.
  23852. // See https://es5.github.io/#x13.2.2 for more details.
  23853. return isObject(result) ? result : thisBinding;
  23854. };
  23855. }
  23856. /**
  23857. * Creates a function that wraps `func` to enable currying.
  23858. *
  23859. * @private
  23860. * @param {Function} func The function to wrap.
  23861. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23862. * @param {number} arity The arity of `func`.
  23863. * @returns {Function} Returns the new wrapped function.
  23864. */
  23865. function createCurry(func, bitmask, arity) {
  23866. var Ctor = createCtor(func);
  23867. function wrapper() {
  23868. var length = arguments.length,
  23869. args = Array(length),
  23870. index = length,
  23871. placeholder = getHolder(wrapper);
  23872. while (index--) {
  23873. args[index] = arguments[index];
  23874. }
  23875. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  23876. ? []
  23877. : replaceHolders(args, placeholder);
  23878. length -= holders.length;
  23879. if (length < arity) {
  23880. return createRecurry(
  23881. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  23882. args, holders, undefined, undefined, arity - length);
  23883. }
  23884. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23885. return apply(fn, this, args);
  23886. }
  23887. return wrapper;
  23888. }
  23889. /**
  23890. * Creates a `_.find` or `_.findLast` function.
  23891. *
  23892. * @private
  23893. * @param {Function} findIndexFunc The function to find the collection index.
  23894. * @returns {Function} Returns the new find function.
  23895. */
  23896. function createFind(findIndexFunc) {
  23897. return function(collection, predicate, fromIndex) {
  23898. var iterable = Object(collection);
  23899. if (!isArrayLike(collection)) {
  23900. var iteratee = getIteratee(predicate, 3);
  23901. collection = keys(collection);
  23902. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  23903. }
  23904. var index = findIndexFunc(collection, predicate, fromIndex);
  23905. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  23906. };
  23907. }
  23908. /**
  23909. * Creates a `_.flow` or `_.flowRight` function.
  23910. *
  23911. * @private
  23912. * @param {boolean} [fromRight] Specify iterating from right to left.
  23913. * @returns {Function} Returns the new flow function.
  23914. */
  23915. function createFlow(fromRight) {
  23916. return flatRest(function(funcs) {
  23917. var length = funcs.length,
  23918. index = length,
  23919. prereq = LodashWrapper.prototype.thru;
  23920. if (fromRight) {
  23921. funcs.reverse();
  23922. }
  23923. while (index--) {
  23924. var func = funcs[index];
  23925. if (typeof func != 'function') {
  23926. throw new TypeError(FUNC_ERROR_TEXT);
  23927. }
  23928. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23929. var wrapper = new LodashWrapper([], true);
  23930. }
  23931. }
  23932. index = wrapper ? index : length;
  23933. while (++index < length) {
  23934. func = funcs[index];
  23935. var funcName = getFuncName(func),
  23936. data = funcName == 'wrapper' ? getData(func) : undefined;
  23937. if (data && isLaziable(data[0]) &&
  23938. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23939. !data[4].length && data[9] == 1
  23940. ) {
  23941. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23942. } else {
  23943. wrapper = (func.length == 1 && isLaziable(func))
  23944. ? wrapper[funcName]()
  23945. : wrapper.thru(func);
  23946. }
  23947. }
  23948. return function() {
  23949. var args = arguments,
  23950. value = args[0];
  23951. if (wrapper && args.length == 1 && isArray(value)) {
  23952. return wrapper.plant(value).value();
  23953. }
  23954. var index = 0,
  23955. result = length ? funcs[index].apply(this, args) : value;
  23956. while (++index < length) {
  23957. result = funcs[index].call(this, result);
  23958. }
  23959. return result;
  23960. };
  23961. });
  23962. }
  23963. /**
  23964. * Creates a function that wraps `func` to invoke it with optional `this`
  23965. * binding of `thisArg`, partial application, and currying.
  23966. *
  23967. * @private
  23968. * @param {Function|string} func The function or method name to wrap.
  23969. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23970. * @param {*} [thisArg] The `this` binding of `func`.
  23971. * @param {Array} [partials] The arguments to prepend to those provided to
  23972. * the new function.
  23973. * @param {Array} [holders] The `partials` placeholder indexes.
  23974. * @param {Array} [partialsRight] The arguments to append to those provided
  23975. * to the new function.
  23976. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23977. * @param {Array} [argPos] The argument positions of the new function.
  23978. * @param {number} [ary] The arity cap of `func`.
  23979. * @param {number} [arity] The arity of `func`.
  23980. * @returns {Function} Returns the new wrapped function.
  23981. */
  23982. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23983. var isAry = bitmask & WRAP_ARY_FLAG,
  23984. isBind = bitmask & WRAP_BIND_FLAG,
  23985. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23986. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23987. isFlip = bitmask & WRAP_FLIP_FLAG,
  23988. Ctor = isBindKey ? undefined : createCtor(func);
  23989. function wrapper() {
  23990. var length = arguments.length,
  23991. args = Array(length),
  23992. index = length;
  23993. while (index--) {
  23994. args[index] = arguments[index];
  23995. }
  23996. if (isCurried) {
  23997. var placeholder = getHolder(wrapper),
  23998. holdersCount = countHolders(args, placeholder);
  23999. }
  24000. if (partials) {
  24001. args = composeArgs(args, partials, holders, isCurried);
  24002. }
  24003. if (partialsRight) {
  24004. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  24005. }
  24006. length -= holdersCount;
  24007. if (isCurried && length < arity) {
  24008. var newHolders = replaceHolders(args, placeholder);
  24009. return createRecurry(
  24010. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  24011. args, newHolders, argPos, ary, arity - length
  24012. );
  24013. }
  24014. var thisBinding = isBind ? thisArg : this,
  24015. fn = isBindKey ? thisBinding[func] : func;
  24016. length = args.length;
  24017. if (argPos) {
  24018. args = reorder(args, argPos);
  24019. } else if (isFlip && length > 1) {
  24020. args.reverse();
  24021. }
  24022. if (isAry && ary < length) {
  24023. args.length = ary;
  24024. }
  24025. if (this && this !== root && this instanceof wrapper) {
  24026. fn = Ctor || createCtor(fn);
  24027. }
  24028. return fn.apply(thisBinding, args);
  24029. }
  24030. return wrapper;
  24031. }
  24032. /**
  24033. * Creates a function like `_.invertBy`.
  24034. *
  24035. * @private
  24036. * @param {Function} setter The function to set accumulator values.
  24037. * @param {Function} toIteratee The function to resolve iteratees.
  24038. * @returns {Function} Returns the new inverter function.
  24039. */
  24040. function createInverter(setter, toIteratee) {
  24041. return function(object, iteratee) {
  24042. return baseInverter(object, setter, toIteratee(iteratee), {});
  24043. };
  24044. }
  24045. /**
  24046. * Creates a function that performs a mathematical operation on two values.
  24047. *
  24048. * @private
  24049. * @param {Function} operator The function to perform the operation.
  24050. * @param {number} [defaultValue] The value used for `undefined` arguments.
  24051. * @returns {Function} Returns the new mathematical operation function.
  24052. */
  24053. function createMathOperation(operator, defaultValue) {
  24054. return function(value, other) {
  24055. var result;
  24056. if (value === undefined && other === undefined) {
  24057. return defaultValue;
  24058. }
  24059. if (value !== undefined) {
  24060. result = value;
  24061. }
  24062. if (other !== undefined) {
  24063. if (result === undefined) {
  24064. return other;
  24065. }
  24066. if (typeof value == 'string' || typeof other == 'string') {
  24067. value = baseToString(value);
  24068. other = baseToString(other);
  24069. } else {
  24070. value = baseToNumber(value);
  24071. other = baseToNumber(other);
  24072. }
  24073. result = operator(value, other);
  24074. }
  24075. return result;
  24076. };
  24077. }
  24078. /**
  24079. * Creates a function like `_.over`.
  24080. *
  24081. * @private
  24082. * @param {Function} arrayFunc The function to iterate over iteratees.
  24083. * @returns {Function} Returns the new over function.
  24084. */
  24085. function createOver(arrayFunc) {
  24086. return flatRest(function(iteratees) {
  24087. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  24088. return baseRest(function(args) {
  24089. var thisArg = this;
  24090. return arrayFunc(iteratees, function(iteratee) {
  24091. return apply(iteratee, thisArg, args);
  24092. });
  24093. });
  24094. });
  24095. }
  24096. /**
  24097. * Creates the padding for `string` based on `length`. The `chars` string
  24098. * is truncated if the number of characters exceeds `length`.
  24099. *
  24100. * @private
  24101. * @param {number} length The padding length.
  24102. * @param {string} [chars=' '] The string used as padding.
  24103. * @returns {string} Returns the padding for `string`.
  24104. */
  24105. function createPadding(length, chars) {
  24106. chars = chars === undefined ? ' ' : baseToString(chars);
  24107. var charsLength = chars.length;
  24108. if (charsLength < 2) {
  24109. return charsLength ? baseRepeat(chars, length) : chars;
  24110. }
  24111. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  24112. return hasUnicode(chars)
  24113. ? castSlice(stringToArray(result), 0, length).join('')
  24114. : result.slice(0, length);
  24115. }
  24116. /**
  24117. * Creates a function that wraps `func` to invoke it with the `this` binding
  24118. * of `thisArg` and `partials` prepended to the arguments it receives.
  24119. *
  24120. * @private
  24121. * @param {Function} func The function to wrap.
  24122. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24123. * @param {*} thisArg The `this` binding of `func`.
  24124. * @param {Array} partials The arguments to prepend to those provided to
  24125. * the new function.
  24126. * @returns {Function} Returns the new wrapped function.
  24127. */
  24128. function createPartial(func, bitmask, thisArg, partials) {
  24129. var isBind = bitmask & WRAP_BIND_FLAG,
  24130. Ctor = createCtor(func);
  24131. function wrapper() {
  24132. var argsIndex = -1,
  24133. argsLength = arguments.length,
  24134. leftIndex = -1,
  24135. leftLength = partials.length,
  24136. args = Array(leftLength + argsLength),
  24137. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  24138. while (++leftIndex < leftLength) {
  24139. args[leftIndex] = partials[leftIndex];
  24140. }
  24141. while (argsLength--) {
  24142. args[leftIndex++] = arguments[++argsIndex];
  24143. }
  24144. return apply(fn, isBind ? thisArg : this, args);
  24145. }
  24146. return wrapper;
  24147. }
  24148. /**
  24149. * Creates a `_.range` or `_.rangeRight` function.
  24150. *
  24151. * @private
  24152. * @param {boolean} [fromRight] Specify iterating from right to left.
  24153. * @returns {Function} Returns the new range function.
  24154. */
  24155. function createRange(fromRight) {
  24156. return function(start, end, step) {
  24157. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  24158. end = step = undefined;
  24159. }
  24160. // Ensure the sign of `-0` is preserved.
  24161. start = toFinite(start);
  24162. if (end === undefined) {
  24163. end = start;
  24164. start = 0;
  24165. } else {
  24166. end = toFinite(end);
  24167. }
  24168. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  24169. return baseRange(start, end, step, fromRight);
  24170. };
  24171. }
  24172. /**
  24173. * Creates a function that performs a relational operation on two values.
  24174. *
  24175. * @private
  24176. * @param {Function} operator The function to perform the operation.
  24177. * @returns {Function} Returns the new relational operation function.
  24178. */
  24179. function createRelationalOperation(operator) {
  24180. return function(value, other) {
  24181. if (!(typeof value == 'string' && typeof other == 'string')) {
  24182. value = toNumber(value);
  24183. other = toNumber(other);
  24184. }
  24185. return operator(value, other);
  24186. };
  24187. }
  24188. /**
  24189. * Creates a function that wraps `func` to continue currying.
  24190. *
  24191. * @private
  24192. * @param {Function} func The function to wrap.
  24193. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24194. * @param {Function} wrapFunc The function to create the `func` wrapper.
  24195. * @param {*} placeholder The placeholder value.
  24196. * @param {*} [thisArg] The `this` binding of `func`.
  24197. * @param {Array} [partials] The arguments to prepend to those provided to
  24198. * the new function.
  24199. * @param {Array} [holders] The `partials` placeholder indexes.
  24200. * @param {Array} [argPos] The argument positions of the new function.
  24201. * @param {number} [ary] The arity cap of `func`.
  24202. * @param {number} [arity] The arity of `func`.
  24203. * @returns {Function} Returns the new wrapped function.
  24204. */
  24205. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  24206. var isCurry = bitmask & WRAP_CURRY_FLAG,
  24207. newHolders = isCurry ? holders : undefined,
  24208. newHoldersRight = isCurry ? undefined : holders,
  24209. newPartials = isCurry ? partials : undefined,
  24210. newPartialsRight = isCurry ? undefined : partials;
  24211. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  24212. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  24213. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  24214. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  24215. }
  24216. var newData = [
  24217. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  24218. newHoldersRight, argPos, ary, arity
  24219. ];
  24220. var result = wrapFunc.apply(undefined, newData);
  24221. if (isLaziable(func)) {
  24222. setData(result, newData);
  24223. }
  24224. result.placeholder = placeholder;
  24225. return setWrapToString(result, func, bitmask);
  24226. }
  24227. /**
  24228. * Creates a function like `_.round`.
  24229. *
  24230. * @private
  24231. * @param {string} methodName The name of the `Math` method to use when rounding.
  24232. * @returns {Function} Returns the new round function.
  24233. */
  24234. function createRound(methodName) {
  24235. var func = Math[methodName];
  24236. return function(number, precision) {
  24237. number = toNumber(number);
  24238. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  24239. if (precision && nativeIsFinite(number)) {
  24240. // Shift with exponential notation to avoid floating-point issues.
  24241. // See [MDN](https://mdn.io/round#Examples) for more details.
  24242. var pair = (toString(number) + 'e').split('e'),
  24243. value = func(pair[0] + 'e' + (+pair[1] + precision));
  24244. pair = (toString(value) + 'e').split('e');
  24245. return +(pair[0] + 'e' + (+pair[1] - precision));
  24246. }
  24247. return func(number);
  24248. };
  24249. }
  24250. /**
  24251. * Creates a set object of `values`.
  24252. *
  24253. * @private
  24254. * @param {Array} values The values to add to the set.
  24255. * @returns {Object} Returns the new set.
  24256. */
  24257. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  24258. return new Set(values);
  24259. };
  24260. /**
  24261. * Creates a `_.toPairs` or `_.toPairsIn` function.
  24262. *
  24263. * @private
  24264. * @param {Function} keysFunc The function to get the keys of a given object.
  24265. * @returns {Function} Returns the new pairs function.
  24266. */
  24267. function createToPairs(keysFunc) {
  24268. return function(object) {
  24269. var tag = getTag(object);
  24270. if (tag == mapTag) {
  24271. return mapToArray(object);
  24272. }
  24273. if (tag == setTag) {
  24274. return setToPairs(object);
  24275. }
  24276. return baseToPairs(object, keysFunc(object));
  24277. };
  24278. }
  24279. /**
  24280. * Creates a function that either curries or invokes `func` with optional
  24281. * `this` binding and partially applied arguments.
  24282. *
  24283. * @private
  24284. * @param {Function|string} func The function or method name to wrap.
  24285. * @param {number} bitmask The bitmask flags.
  24286. * 1 - `_.bind`
  24287. * 2 - `_.bindKey`
  24288. * 4 - `_.curry` or `_.curryRight` of a bound function
  24289. * 8 - `_.curry`
  24290. * 16 - `_.curryRight`
  24291. * 32 - `_.partial`
  24292. * 64 - `_.partialRight`
  24293. * 128 - `_.rearg`
  24294. * 256 - `_.ary`
  24295. * 512 - `_.flip`
  24296. * @param {*} [thisArg] The `this` binding of `func`.
  24297. * @param {Array} [partials] The arguments to be partially applied.
  24298. * @param {Array} [holders] The `partials` placeholder indexes.
  24299. * @param {Array} [argPos] The argument positions of the new function.
  24300. * @param {number} [ary] The arity cap of `func`.
  24301. * @param {number} [arity] The arity of `func`.
  24302. * @returns {Function} Returns the new wrapped function.
  24303. */
  24304. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  24305. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  24306. if (!isBindKey && typeof func != 'function') {
  24307. throw new TypeError(FUNC_ERROR_TEXT);
  24308. }
  24309. var length = partials ? partials.length : 0;
  24310. if (!length) {
  24311. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  24312. partials = holders = undefined;
  24313. }
  24314. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  24315. arity = arity === undefined ? arity : toInteger(arity);
  24316. length -= holders ? holders.length : 0;
  24317. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  24318. var partialsRight = partials,
  24319. holdersRight = holders;
  24320. partials = holders = undefined;
  24321. }
  24322. var data = isBindKey ? undefined : getData(func);
  24323. var newData = [
  24324. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  24325. argPos, ary, arity
  24326. ];
  24327. if (data) {
  24328. mergeData(newData, data);
  24329. }
  24330. func = newData[0];
  24331. bitmask = newData[1];
  24332. thisArg = newData[2];
  24333. partials = newData[3];
  24334. holders = newData[4];
  24335. arity = newData[9] = newData[9] === undefined
  24336. ? (isBindKey ? 0 : func.length)
  24337. : nativeMax(newData[9] - length, 0);
  24338. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  24339. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  24340. }
  24341. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  24342. var result = createBind(func, bitmask, thisArg);
  24343. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  24344. result = createCurry(func, bitmask, arity);
  24345. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  24346. result = createPartial(func, bitmask, thisArg, partials);
  24347. } else {
  24348. result = createHybrid.apply(undefined, newData);
  24349. }
  24350. var setter = data ? baseSetData : setData;
  24351. return setWrapToString(setter(result, newData), func, bitmask);
  24352. }
  24353. /**
  24354. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  24355. * of source objects to the destination object for all destination properties
  24356. * that resolve to `undefined`.
  24357. *
  24358. * @private
  24359. * @param {*} objValue The destination value.
  24360. * @param {*} srcValue The source value.
  24361. * @param {string} key The key of the property to assign.
  24362. * @param {Object} object The parent object of `objValue`.
  24363. * @returns {*} Returns the value to assign.
  24364. */
  24365. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  24366. if (objValue === undefined ||
  24367. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  24368. return srcValue;
  24369. }
  24370. return objValue;
  24371. }
  24372. /**
  24373. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  24374. * objects into destination objects that are passed thru.
  24375. *
  24376. * @private
  24377. * @param {*} objValue The destination value.
  24378. * @param {*} srcValue The source value.
  24379. * @param {string} key The key of the property to merge.
  24380. * @param {Object} object The parent object of `objValue`.
  24381. * @param {Object} source The parent object of `srcValue`.
  24382. * @param {Object} [stack] Tracks traversed source values and their merged
  24383. * counterparts.
  24384. * @returns {*} Returns the value to assign.
  24385. */
  24386. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  24387. if (isObject(objValue) && isObject(srcValue)) {
  24388. // Recursively merge objects and arrays (susceptible to call stack limits).
  24389. stack.set(srcValue, objValue);
  24390. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  24391. stack['delete'](srcValue);
  24392. }
  24393. return objValue;
  24394. }
  24395. /**
  24396. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  24397. * objects.
  24398. *
  24399. * @private
  24400. * @param {*} value The value to inspect.
  24401. * @param {string} key The key of the property to inspect.
  24402. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  24403. */
  24404. function customOmitClone(value) {
  24405. return isPlainObject(value) ? undefined : value;
  24406. }
  24407. /**
  24408. * A specialized version of `baseIsEqualDeep` for arrays with support for
  24409. * partial deep comparisons.
  24410. *
  24411. * @private
  24412. * @param {Array} array The array to compare.
  24413. * @param {Array} other The other array to compare.
  24414. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24415. * @param {Function} customizer The function to customize comparisons.
  24416. * @param {Function} equalFunc The function to determine equivalents of values.
  24417. * @param {Object} stack Tracks traversed `array` and `other` objects.
  24418. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  24419. */
  24420. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  24421. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  24422. arrLength = array.length,
  24423. othLength = other.length;
  24424. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  24425. return false;
  24426. }
  24427. // Assume cyclic values are equal.
  24428. var stacked = stack.get(array);
  24429. if (stacked && stack.get(other)) {
  24430. return stacked == other;
  24431. }
  24432. var index = -1,
  24433. result = true,
  24434. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  24435. stack.set(array, other);
  24436. stack.set(other, array);
  24437. // Ignore non-index properties.
  24438. while (++index < arrLength) {
  24439. var arrValue = array[index],
  24440. othValue = other[index];
  24441. if (customizer) {
  24442. var compared = isPartial
  24443. ? customizer(othValue, arrValue, index, other, array, stack)
  24444. : customizer(arrValue, othValue, index, array, other, stack);
  24445. }
  24446. if (compared !== undefined) {
  24447. if (compared) {
  24448. continue;
  24449. }
  24450. result = false;
  24451. break;
  24452. }
  24453. // Recursively compare arrays (susceptible to call stack limits).
  24454. if (seen) {
  24455. if (!arraySome(other, function(othValue, othIndex) {
  24456. if (!cacheHas(seen, othIndex) &&
  24457. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  24458. return seen.push(othIndex);
  24459. }
  24460. })) {
  24461. result = false;
  24462. break;
  24463. }
  24464. } else if (!(
  24465. arrValue === othValue ||
  24466. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  24467. )) {
  24468. result = false;
  24469. break;
  24470. }
  24471. }
  24472. stack['delete'](array);
  24473. stack['delete'](other);
  24474. return result;
  24475. }
  24476. /**
  24477. * A specialized version of `baseIsEqualDeep` for comparing objects of
  24478. * the same `toStringTag`.
  24479. *
  24480. * **Note:** This function only supports comparing values with tags of
  24481. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  24482. *
  24483. * @private
  24484. * @param {Object} object The object to compare.
  24485. * @param {Object} other The other object to compare.
  24486. * @param {string} tag The `toStringTag` of the objects to compare.
  24487. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24488. * @param {Function} customizer The function to customize comparisons.
  24489. * @param {Function} equalFunc The function to determine equivalents of values.
  24490. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24491. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24492. */
  24493. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  24494. switch (tag) {
  24495. case dataViewTag:
  24496. if ((object.byteLength != other.byteLength) ||
  24497. (object.byteOffset != other.byteOffset)) {
  24498. return false;
  24499. }
  24500. object = object.buffer;
  24501. other = other.buffer;
  24502. case arrayBufferTag:
  24503. if ((object.byteLength != other.byteLength) ||
  24504. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  24505. return false;
  24506. }
  24507. return true;
  24508. case boolTag:
  24509. case dateTag:
  24510. case numberTag:
  24511. // Coerce booleans to `1` or `0` and dates to milliseconds.
  24512. // Invalid dates are coerced to `NaN`.
  24513. return eq(+object, +other);
  24514. case errorTag:
  24515. return object.name == other.name && object.message == other.message;
  24516. case regexpTag:
  24517. case stringTag:
  24518. // Coerce regexes to strings and treat strings, primitives and objects,
  24519. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  24520. // for more details.
  24521. return object == (other + '');
  24522. case mapTag:
  24523. var convert = mapToArray;
  24524. case setTag:
  24525. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  24526. convert || (convert = setToArray);
  24527. if (object.size != other.size && !isPartial) {
  24528. return false;
  24529. }
  24530. // Assume cyclic values are equal.
  24531. var stacked = stack.get(object);
  24532. if (stacked) {
  24533. return stacked == other;
  24534. }
  24535. bitmask |= COMPARE_UNORDERED_FLAG;
  24536. // Recursively compare objects (susceptible to call stack limits).
  24537. stack.set(object, other);
  24538. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  24539. stack['delete'](object);
  24540. return result;
  24541. case symbolTag:
  24542. if (symbolValueOf) {
  24543. return symbolValueOf.call(object) == symbolValueOf.call(other);
  24544. }
  24545. }
  24546. return false;
  24547. }
  24548. /**
  24549. * A specialized version of `baseIsEqualDeep` for objects with support for
  24550. * partial deep comparisons.
  24551. *
  24552. * @private
  24553. * @param {Object} object The object to compare.
  24554. * @param {Object} other The other object to compare.
  24555. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24556. * @param {Function} customizer The function to customize comparisons.
  24557. * @param {Function} equalFunc The function to determine equivalents of values.
  24558. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24559. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24560. */
  24561. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  24562. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  24563. objProps = getAllKeys(object),
  24564. objLength = objProps.length,
  24565. othProps = getAllKeys(other),
  24566. othLength = othProps.length;
  24567. if (objLength != othLength && !isPartial) {
  24568. return false;
  24569. }
  24570. var index = objLength;
  24571. while (index--) {
  24572. var key = objProps[index];
  24573. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  24574. return false;
  24575. }
  24576. }
  24577. // Assume cyclic values are equal.
  24578. var stacked = stack.get(object);
  24579. if (stacked && stack.get(other)) {
  24580. return stacked == other;
  24581. }
  24582. var result = true;
  24583. stack.set(object, other);
  24584. stack.set(other, object);
  24585. var skipCtor = isPartial;
  24586. while (++index < objLength) {
  24587. key = objProps[index];
  24588. var objValue = object[key],
  24589. othValue = other[key];
  24590. if (customizer) {
  24591. var compared = isPartial
  24592. ? customizer(othValue, objValue, key, other, object, stack)
  24593. : customizer(objValue, othValue, key, object, other, stack);
  24594. }
  24595. // Recursively compare objects (susceptible to call stack limits).
  24596. if (!(compared === undefined
  24597. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  24598. : compared
  24599. )) {
  24600. result = false;
  24601. break;
  24602. }
  24603. skipCtor || (skipCtor = key == 'constructor');
  24604. }
  24605. if (result && !skipCtor) {
  24606. var objCtor = object.constructor,
  24607. othCtor = other.constructor;
  24608. // Non `Object` object instances with different constructors are not equal.
  24609. if (objCtor != othCtor &&
  24610. ('constructor' in object && 'constructor' in other) &&
  24611. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  24612. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  24613. result = false;
  24614. }
  24615. }
  24616. stack['delete'](object);
  24617. stack['delete'](other);
  24618. return result;
  24619. }
  24620. /**
  24621. * A specialized version of `baseRest` which flattens the rest array.
  24622. *
  24623. * @private
  24624. * @param {Function} func The function to apply a rest parameter to.
  24625. * @returns {Function} Returns the new function.
  24626. */
  24627. function flatRest(func) {
  24628. return setToString(overRest(func, undefined, flatten), func + '');
  24629. }
  24630. /**
  24631. * Creates an array of own enumerable property names and symbols of `object`.
  24632. *
  24633. * @private
  24634. * @param {Object} object The object to query.
  24635. * @returns {Array} Returns the array of property names and symbols.
  24636. */
  24637. function getAllKeys(object) {
  24638. return baseGetAllKeys(object, keys, getSymbols);
  24639. }
  24640. /**
  24641. * Creates an array of own and inherited enumerable property names and
  24642. * symbols of `object`.
  24643. *
  24644. * @private
  24645. * @param {Object} object The object to query.
  24646. * @returns {Array} Returns the array of property names and symbols.
  24647. */
  24648. function getAllKeysIn(object) {
  24649. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  24650. }
  24651. /**
  24652. * Gets metadata for `func`.
  24653. *
  24654. * @private
  24655. * @param {Function} func The function to query.
  24656. * @returns {*} Returns the metadata for `func`.
  24657. */
  24658. var getData = !metaMap ? noop : function(func) {
  24659. return metaMap.get(func);
  24660. };
  24661. /**
  24662. * Gets the name of `func`.
  24663. *
  24664. * @private
  24665. * @param {Function} func The function to query.
  24666. * @returns {string} Returns the function name.
  24667. */
  24668. function getFuncName(func) {
  24669. var result = (func.name + ''),
  24670. array = realNames[result],
  24671. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  24672. while (length--) {
  24673. var data = array[length],
  24674. otherFunc = data.func;
  24675. if (otherFunc == null || otherFunc == func) {
  24676. return data.name;
  24677. }
  24678. }
  24679. return result;
  24680. }
  24681. /**
  24682. * Gets the argument placeholder value for `func`.
  24683. *
  24684. * @private
  24685. * @param {Function} func The function to inspect.
  24686. * @returns {*} Returns the placeholder value.
  24687. */
  24688. function getHolder(func) {
  24689. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  24690. return object.placeholder;
  24691. }
  24692. /**
  24693. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  24694. * this function returns the custom method, otherwise it returns `baseIteratee`.
  24695. * If arguments are provided, the chosen function is invoked with them and
  24696. * its result is returned.
  24697. *
  24698. * @private
  24699. * @param {*} [value] The value to convert to an iteratee.
  24700. * @param {number} [arity] The arity of the created iteratee.
  24701. * @returns {Function} Returns the chosen function or its result.
  24702. */
  24703. function getIteratee() {
  24704. var result = lodash.iteratee || iteratee;
  24705. result = result === iteratee ? baseIteratee : result;
  24706. return arguments.length ? result(arguments[0], arguments[1]) : result;
  24707. }
  24708. /**
  24709. * Gets the data for `map`.
  24710. *
  24711. * @private
  24712. * @param {Object} map The map to query.
  24713. * @param {string} key The reference key.
  24714. * @returns {*} Returns the map data.
  24715. */
  24716. function getMapData(map, key) {
  24717. var data = map.__data__;
  24718. return isKeyable(key)
  24719. ? data[typeof key == 'string' ? 'string' : 'hash']
  24720. : data.map;
  24721. }
  24722. /**
  24723. * Gets the property names, values, and compare flags of `object`.
  24724. *
  24725. * @private
  24726. * @param {Object} object The object to query.
  24727. * @returns {Array} Returns the match data of `object`.
  24728. */
  24729. function getMatchData(object) {
  24730. var result = keys(object),
  24731. length = result.length;
  24732. while (length--) {
  24733. var key = result[length],
  24734. value = object[key];
  24735. result[length] = [key, value, isStrictComparable(value)];
  24736. }
  24737. return result;
  24738. }
  24739. /**
  24740. * Gets the native function at `key` of `object`.
  24741. *
  24742. * @private
  24743. * @param {Object} object The object to query.
  24744. * @param {string} key The key of the method to get.
  24745. * @returns {*} Returns the function if it's native, else `undefined`.
  24746. */
  24747. function getNative(object, key) {
  24748. var value = getValue(object, key);
  24749. return baseIsNative(value) ? value : undefined;
  24750. }
  24751. /**
  24752. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  24753. *
  24754. * @private
  24755. * @param {*} value The value to query.
  24756. * @returns {string} Returns the raw `toStringTag`.
  24757. */
  24758. function getRawTag(value) {
  24759. var isOwn = hasOwnProperty.call(value, symToStringTag),
  24760. tag = value[symToStringTag];
  24761. try {
  24762. value[symToStringTag] = undefined;
  24763. var unmasked = true;
  24764. } catch (e) {}
  24765. var result = nativeObjectToString.call(value);
  24766. if (unmasked) {
  24767. if (isOwn) {
  24768. value[symToStringTag] = tag;
  24769. } else {
  24770. delete value[symToStringTag];
  24771. }
  24772. }
  24773. return result;
  24774. }
  24775. /**
  24776. * Creates an array of the own enumerable symbols of `object`.
  24777. *
  24778. * @private
  24779. * @param {Object} object The object to query.
  24780. * @returns {Array} Returns the array of symbols.
  24781. */
  24782. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  24783. if (object == null) {
  24784. return [];
  24785. }
  24786. object = Object(object);
  24787. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  24788. return propertyIsEnumerable.call(object, symbol);
  24789. });
  24790. };
  24791. /**
  24792. * Creates an array of the own and inherited enumerable symbols of `object`.
  24793. *
  24794. * @private
  24795. * @param {Object} object The object to query.
  24796. * @returns {Array} Returns the array of symbols.
  24797. */
  24798. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  24799. var result = [];
  24800. while (object) {
  24801. arrayPush(result, getSymbols(object));
  24802. object = getPrototype(object);
  24803. }
  24804. return result;
  24805. };
  24806. /**
  24807. * Gets the `toStringTag` of `value`.
  24808. *
  24809. * @private
  24810. * @param {*} value The value to query.
  24811. * @returns {string} Returns the `toStringTag`.
  24812. */
  24813. var getTag = baseGetTag;
  24814. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  24815. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  24816. (Map && getTag(new Map) != mapTag) ||
  24817. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  24818. (Set && getTag(new Set) != setTag) ||
  24819. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  24820. getTag = function(value) {
  24821. var result = baseGetTag(value),
  24822. Ctor = result == objectTag ? value.constructor : undefined,
  24823. ctorString = Ctor ? toSource(Ctor) : '';
  24824. if (ctorString) {
  24825. switch (ctorString) {
  24826. case dataViewCtorString: return dataViewTag;
  24827. case mapCtorString: return mapTag;
  24828. case promiseCtorString: return promiseTag;
  24829. case setCtorString: return setTag;
  24830. case weakMapCtorString: return weakMapTag;
  24831. }
  24832. }
  24833. return result;
  24834. };
  24835. }
  24836. /**
  24837. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  24838. *
  24839. * @private
  24840. * @param {number} start The start of the view.
  24841. * @param {number} end The end of the view.
  24842. * @param {Array} transforms The transformations to apply to the view.
  24843. * @returns {Object} Returns an object containing the `start` and `end`
  24844. * positions of the view.
  24845. */
  24846. function getView(start, end, transforms) {
  24847. var index = -1,
  24848. length = transforms.length;
  24849. while (++index < length) {
  24850. var data = transforms[index],
  24851. size = data.size;
  24852. switch (data.type) {
  24853. case 'drop': start += size; break;
  24854. case 'dropRight': end -= size; break;
  24855. case 'take': end = nativeMin(end, start + size); break;
  24856. case 'takeRight': start = nativeMax(start, end - size); break;
  24857. }
  24858. }
  24859. return { 'start': start, 'end': end };
  24860. }
  24861. /**
  24862. * Extracts wrapper details from the `source` body comment.
  24863. *
  24864. * @private
  24865. * @param {string} source The source to inspect.
  24866. * @returns {Array} Returns the wrapper details.
  24867. */
  24868. function getWrapDetails(source) {
  24869. var match = source.match(reWrapDetails);
  24870. return match ? match[1].split(reSplitDetails) : [];
  24871. }
  24872. /**
  24873. * Checks if `path` exists on `object`.
  24874. *
  24875. * @private
  24876. * @param {Object} object The object to query.
  24877. * @param {Array|string} path The path to check.
  24878. * @param {Function} hasFunc The function to check properties.
  24879. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  24880. */
  24881. function hasPath(object, path, hasFunc) {
  24882. path = castPath(path, object);
  24883. var index = -1,
  24884. length = path.length,
  24885. result = false;
  24886. while (++index < length) {
  24887. var key = toKey(path[index]);
  24888. if (!(result = object != null && hasFunc(object, key))) {
  24889. break;
  24890. }
  24891. object = object[key];
  24892. }
  24893. if (result || ++index != length) {
  24894. return result;
  24895. }
  24896. length = object == null ? 0 : object.length;
  24897. return !!length && isLength(length) && isIndex(key, length) &&
  24898. (isArray(object) || isArguments(object));
  24899. }
  24900. /**
  24901. * Initializes an array clone.
  24902. *
  24903. * @private
  24904. * @param {Array} array The array to clone.
  24905. * @returns {Array} Returns the initialized clone.
  24906. */
  24907. function initCloneArray(array) {
  24908. var length = array.length,
  24909. result = new array.constructor(length);
  24910. // Add properties assigned by `RegExp#exec`.
  24911. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  24912. result.index = array.index;
  24913. result.input = array.input;
  24914. }
  24915. return result;
  24916. }
  24917. /**
  24918. * Initializes an object clone.
  24919. *
  24920. * @private
  24921. * @param {Object} object The object to clone.
  24922. * @returns {Object} Returns the initialized clone.
  24923. */
  24924. function initCloneObject(object) {
  24925. return (typeof object.constructor == 'function' && !isPrototype(object))
  24926. ? baseCreate(getPrototype(object))
  24927. : {};
  24928. }
  24929. /**
  24930. * Initializes an object clone based on its `toStringTag`.
  24931. *
  24932. * **Note:** This function only supports cloning values with tags of
  24933. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24934. *
  24935. * @private
  24936. * @param {Object} object The object to clone.
  24937. * @param {string} tag The `toStringTag` of the object to clone.
  24938. * @param {boolean} [isDeep] Specify a deep clone.
  24939. * @returns {Object} Returns the initialized clone.
  24940. */
  24941. function initCloneByTag(object, tag, isDeep) {
  24942. var Ctor = object.constructor;
  24943. switch (tag) {
  24944. case arrayBufferTag:
  24945. return cloneArrayBuffer(object);
  24946. case boolTag:
  24947. case dateTag:
  24948. return new Ctor(+object);
  24949. case dataViewTag:
  24950. return cloneDataView(object, isDeep);
  24951. case float32Tag: case float64Tag:
  24952. case int8Tag: case int16Tag: case int32Tag:
  24953. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24954. return cloneTypedArray(object, isDeep);
  24955. case mapTag:
  24956. return new Ctor;
  24957. case numberTag:
  24958. case stringTag:
  24959. return new Ctor(object);
  24960. case regexpTag:
  24961. return cloneRegExp(object);
  24962. case setTag:
  24963. return new Ctor;
  24964. case symbolTag:
  24965. return cloneSymbol(object);
  24966. }
  24967. }
  24968. /**
  24969. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24970. *
  24971. * @private
  24972. * @param {string} source The source to modify.
  24973. * @returns {Array} details The details to insert.
  24974. * @returns {string} Returns the modified source.
  24975. */
  24976. function insertWrapDetails(source, details) {
  24977. var length = details.length;
  24978. if (!length) {
  24979. return source;
  24980. }
  24981. var lastIndex = length - 1;
  24982. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24983. details = details.join(length > 2 ? ', ' : ' ');
  24984. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24985. }
  24986. /**
  24987. * Checks if `value` is a flattenable `arguments` object or array.
  24988. *
  24989. * @private
  24990. * @param {*} value The value to check.
  24991. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24992. */
  24993. function isFlattenable(value) {
  24994. return isArray(value) || isArguments(value) ||
  24995. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24996. }
  24997. /**
  24998. * Checks if `value` is a valid array-like index.
  24999. *
  25000. * @private
  25001. * @param {*} value The value to check.
  25002. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  25003. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  25004. */
  25005. function isIndex(value, length) {
  25006. var type = typeof value;
  25007. length = length == null ? MAX_SAFE_INTEGER : length;
  25008. return !!length &&
  25009. (type == 'number' ||
  25010. (type != 'symbol' && reIsUint.test(value))) &&
  25011. (value > -1 && value % 1 == 0 && value < length);
  25012. }
  25013. /**
  25014. * Checks if the given arguments are from an iteratee call.
  25015. *
  25016. * @private
  25017. * @param {*} value The potential iteratee value argument.
  25018. * @param {*} index The potential iteratee index or key argument.
  25019. * @param {*} object The potential iteratee object argument.
  25020. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  25021. * else `false`.
  25022. */
  25023. function isIterateeCall(value, index, object) {
  25024. if (!isObject(object)) {
  25025. return false;
  25026. }
  25027. var type = typeof index;
  25028. if (type == 'number'
  25029. ? (isArrayLike(object) && isIndex(index, object.length))
  25030. : (type == 'string' && index in object)
  25031. ) {
  25032. return eq(object[index], value);
  25033. }
  25034. return false;
  25035. }
  25036. /**
  25037. * Checks if `value` is a property name and not a property path.
  25038. *
  25039. * @private
  25040. * @param {*} value The value to check.
  25041. * @param {Object} [object] The object to query keys on.
  25042. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  25043. */
  25044. function isKey(value, object) {
  25045. if (isArray(value)) {
  25046. return false;
  25047. }
  25048. var type = typeof value;
  25049. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  25050. value == null || isSymbol(value)) {
  25051. return true;
  25052. }
  25053. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  25054. (object != null && value in Object(object));
  25055. }
  25056. /**
  25057. * Checks if `value` is suitable for use as unique object key.
  25058. *
  25059. * @private
  25060. * @param {*} value The value to check.
  25061. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  25062. */
  25063. function isKeyable(value) {
  25064. var type = typeof value;
  25065. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  25066. ? (value !== '__proto__')
  25067. : (value === null);
  25068. }
  25069. /**
  25070. * Checks if `func` has a lazy counterpart.
  25071. *
  25072. * @private
  25073. * @param {Function} func The function to check.
  25074. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  25075. * else `false`.
  25076. */
  25077. function isLaziable(func) {
  25078. var funcName = getFuncName(func),
  25079. other = lodash[funcName];
  25080. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  25081. return false;
  25082. }
  25083. if (func === other) {
  25084. return true;
  25085. }
  25086. var data = getData(other);
  25087. return !!data && func === data[0];
  25088. }
  25089. /**
  25090. * Checks if `func` has its source masked.
  25091. *
  25092. * @private
  25093. * @param {Function} func The function to check.
  25094. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  25095. */
  25096. function isMasked(func) {
  25097. return !!maskSrcKey && (maskSrcKey in func);
  25098. }
  25099. /**
  25100. * Checks if `func` is capable of being masked.
  25101. *
  25102. * @private
  25103. * @param {*} value The value to check.
  25104. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  25105. */
  25106. var isMaskable = coreJsData ? isFunction : stubFalse;
  25107. /**
  25108. * Checks if `value` is likely a prototype object.
  25109. *
  25110. * @private
  25111. * @param {*} value The value to check.
  25112. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  25113. */
  25114. function isPrototype(value) {
  25115. var Ctor = value && value.constructor,
  25116. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  25117. return value === proto;
  25118. }
  25119. /**
  25120. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  25121. *
  25122. * @private
  25123. * @param {*} value The value to check.
  25124. * @returns {boolean} Returns `true` if `value` if suitable for strict
  25125. * equality comparisons, else `false`.
  25126. */
  25127. function isStrictComparable(value) {
  25128. return value === value && !isObject(value);
  25129. }
  25130. /**
  25131. * A specialized version of `matchesProperty` for source values suitable
  25132. * for strict equality comparisons, i.e. `===`.
  25133. *
  25134. * @private
  25135. * @param {string} key The key of the property to get.
  25136. * @param {*} srcValue The value to match.
  25137. * @returns {Function} Returns the new spec function.
  25138. */
  25139. function matchesStrictComparable(key, srcValue) {
  25140. return function(object) {
  25141. if (object == null) {
  25142. return false;
  25143. }
  25144. return object[key] === srcValue &&
  25145. (srcValue !== undefined || (key in Object(object)));
  25146. };
  25147. }
  25148. /**
  25149. * A specialized version of `_.memoize` which clears the memoized function's
  25150. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  25151. *
  25152. * @private
  25153. * @param {Function} func The function to have its output memoized.
  25154. * @returns {Function} Returns the new memoized function.
  25155. */
  25156. function memoizeCapped(func) {
  25157. var result = memoize(func, function(key) {
  25158. if (cache.size === MAX_MEMOIZE_SIZE) {
  25159. cache.clear();
  25160. }
  25161. return key;
  25162. });
  25163. var cache = result.cache;
  25164. return result;
  25165. }
  25166. /**
  25167. * Merges the function metadata of `source` into `data`.
  25168. *
  25169. * Merging metadata reduces the number of wrappers used to invoke a function.
  25170. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  25171. * may be applied regardless of execution order. Methods like `_.ary` and
  25172. * `_.rearg` modify function arguments, making the order in which they are
  25173. * executed important, preventing the merging of metadata. However, we make
  25174. * an exception for a safe combined case where curried functions have `_.ary`
  25175. * and or `_.rearg` applied.
  25176. *
  25177. * @private
  25178. * @param {Array} data The destination metadata.
  25179. * @param {Array} source The source metadata.
  25180. * @returns {Array} Returns `data`.
  25181. */
  25182. function mergeData(data, source) {
  25183. var bitmask = data[1],
  25184. srcBitmask = source[1],
  25185. newBitmask = bitmask | srcBitmask,
  25186. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  25187. var isCombo =
  25188. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  25189. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  25190. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  25191. // Exit early if metadata can't be merged.
  25192. if (!(isCommon || isCombo)) {
  25193. return data;
  25194. }
  25195. // Use source `thisArg` if available.
  25196. if (srcBitmask & WRAP_BIND_FLAG) {
  25197. data[2] = source[2];
  25198. // Set when currying a bound function.
  25199. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  25200. }
  25201. // Compose partial arguments.
  25202. var value = source[3];
  25203. if (value) {
  25204. var partials = data[3];
  25205. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  25206. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  25207. }
  25208. // Compose partial right arguments.
  25209. value = source[5];
  25210. if (value) {
  25211. partials = data[5];
  25212. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  25213. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  25214. }
  25215. // Use source `argPos` if available.
  25216. value = source[7];
  25217. if (value) {
  25218. data[7] = value;
  25219. }
  25220. // Use source `ary` if it's smaller.
  25221. if (srcBitmask & WRAP_ARY_FLAG) {
  25222. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  25223. }
  25224. // Use source `arity` if one is not provided.
  25225. if (data[9] == null) {
  25226. data[9] = source[9];
  25227. }
  25228. // Use source `func` and merge bitmasks.
  25229. data[0] = source[0];
  25230. data[1] = newBitmask;
  25231. return data;
  25232. }
  25233. /**
  25234. * This function is like
  25235. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  25236. * except that it includes inherited enumerable properties.
  25237. *
  25238. * @private
  25239. * @param {Object} object The object to query.
  25240. * @returns {Array} Returns the array of property names.
  25241. */
  25242. function nativeKeysIn(object) {
  25243. var result = [];
  25244. if (object != null) {
  25245. for (var key in Object(object)) {
  25246. result.push(key);
  25247. }
  25248. }
  25249. return result;
  25250. }
  25251. /**
  25252. * Converts `value` to a string using `Object.prototype.toString`.
  25253. *
  25254. * @private
  25255. * @param {*} value The value to convert.
  25256. * @returns {string} Returns the converted string.
  25257. */
  25258. function objectToString(value) {
  25259. return nativeObjectToString.call(value);
  25260. }
  25261. /**
  25262. * A specialized version of `baseRest` which transforms the rest array.
  25263. *
  25264. * @private
  25265. * @param {Function} func The function to apply a rest parameter to.
  25266. * @param {number} [start=func.length-1] The start position of the rest parameter.
  25267. * @param {Function} transform The rest array transform.
  25268. * @returns {Function} Returns the new function.
  25269. */
  25270. function overRest(func, start, transform) {
  25271. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  25272. return function() {
  25273. var args = arguments,
  25274. index = -1,
  25275. length = nativeMax(args.length - start, 0),
  25276. array = Array(length);
  25277. while (++index < length) {
  25278. array[index] = args[start + index];
  25279. }
  25280. index = -1;
  25281. var otherArgs = Array(start + 1);
  25282. while (++index < start) {
  25283. otherArgs[index] = args[index];
  25284. }
  25285. otherArgs[start] = transform(array);
  25286. return apply(func, this, otherArgs);
  25287. };
  25288. }
  25289. /**
  25290. * Gets the parent value at `path` of `object`.
  25291. *
  25292. * @private
  25293. * @param {Object} object The object to query.
  25294. * @param {Array} path The path to get the parent value of.
  25295. * @returns {*} Returns the parent value.
  25296. */
  25297. function parent(object, path) {
  25298. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  25299. }
  25300. /**
  25301. * Reorder `array` according to the specified indexes where the element at
  25302. * the first index is assigned as the first element, the element at
  25303. * the second index is assigned as the second element, and so on.
  25304. *
  25305. * @private
  25306. * @param {Array} array The array to reorder.
  25307. * @param {Array} indexes The arranged array indexes.
  25308. * @returns {Array} Returns `array`.
  25309. */
  25310. function reorder(array, indexes) {
  25311. var arrLength = array.length,
  25312. length = nativeMin(indexes.length, arrLength),
  25313. oldArray = copyArray(array);
  25314. while (length--) {
  25315. var index = indexes[length];
  25316. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  25317. }
  25318. return array;
  25319. }
  25320. /**
  25321. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  25322. *
  25323. * @private
  25324. * @param {Object} object The object to query.
  25325. * @param {string} key The key of the property to get.
  25326. * @returns {*} Returns the property value.
  25327. */
  25328. function safeGet(object, key) {
  25329. if (key === 'constructor' && typeof object[key] === 'function') {
  25330. return;
  25331. }
  25332. if (key == '__proto__') {
  25333. return;
  25334. }
  25335. return object[key];
  25336. }
  25337. /**
  25338. * Sets metadata for `func`.
  25339. *
  25340. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  25341. * period of time, it will trip its breaker and transition to an identity
  25342. * function to avoid garbage collection pauses in V8. See
  25343. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  25344. * for more details.
  25345. *
  25346. * @private
  25347. * @param {Function} func The function to associate metadata with.
  25348. * @param {*} data The metadata.
  25349. * @returns {Function} Returns `func`.
  25350. */
  25351. var setData = shortOut(baseSetData);
  25352. /**
  25353. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  25354. *
  25355. * @private
  25356. * @param {Function} func The function to delay.
  25357. * @param {number} wait The number of milliseconds to delay invocation.
  25358. * @returns {number|Object} Returns the timer id or timeout object.
  25359. */
  25360. var setTimeout = ctxSetTimeout || function(func, wait) {
  25361. return root.setTimeout(func, wait);
  25362. };
  25363. /**
  25364. * Sets the `toString` method of `func` to return `string`.
  25365. *
  25366. * @private
  25367. * @param {Function} func The function to modify.
  25368. * @param {Function} string The `toString` result.
  25369. * @returns {Function} Returns `func`.
  25370. */
  25371. var setToString = shortOut(baseSetToString);
  25372. /**
  25373. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  25374. * with wrapper details in a comment at the top of the source body.
  25375. *
  25376. * @private
  25377. * @param {Function} wrapper The function to modify.
  25378. * @param {Function} reference The reference function.
  25379. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25380. * @returns {Function} Returns `wrapper`.
  25381. */
  25382. function setWrapToString(wrapper, reference, bitmask) {
  25383. var source = (reference + '');
  25384. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  25385. }
  25386. /**
  25387. * Creates a function that'll short out and invoke `identity` instead
  25388. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  25389. * milliseconds.
  25390. *
  25391. * @private
  25392. * @param {Function} func The function to restrict.
  25393. * @returns {Function} Returns the new shortable function.
  25394. */
  25395. function shortOut(func) {
  25396. var count = 0,
  25397. lastCalled = 0;
  25398. return function() {
  25399. var stamp = nativeNow(),
  25400. remaining = HOT_SPAN - (stamp - lastCalled);
  25401. lastCalled = stamp;
  25402. if (remaining > 0) {
  25403. if (++count >= HOT_COUNT) {
  25404. return arguments[0];
  25405. }
  25406. } else {
  25407. count = 0;
  25408. }
  25409. return func.apply(undefined, arguments);
  25410. };
  25411. }
  25412. /**
  25413. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  25414. *
  25415. * @private
  25416. * @param {Array} array The array to shuffle.
  25417. * @param {number} [size=array.length] The size of `array`.
  25418. * @returns {Array} Returns `array`.
  25419. */
  25420. function shuffleSelf(array, size) {
  25421. var index = -1,
  25422. length = array.length,
  25423. lastIndex = length - 1;
  25424. size = size === undefined ? length : size;
  25425. while (++index < size) {
  25426. var rand = baseRandom(index, lastIndex),
  25427. value = array[rand];
  25428. array[rand] = array[index];
  25429. array[index] = value;
  25430. }
  25431. array.length = size;
  25432. return array;
  25433. }
  25434. /**
  25435. * Converts `string` to a property path array.
  25436. *
  25437. * @private
  25438. * @param {string} string The string to convert.
  25439. * @returns {Array} Returns the property path array.
  25440. */
  25441. var stringToPath = memoizeCapped(function(string) {
  25442. var result = [];
  25443. if (string.charCodeAt(0) === 46 /* . */) {
  25444. result.push('');
  25445. }
  25446. string.replace(rePropName, function(match, number, quote, subString) {
  25447. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  25448. });
  25449. return result;
  25450. });
  25451. /**
  25452. * Converts `value` to a string key if it's not a string or symbol.
  25453. *
  25454. * @private
  25455. * @param {*} value The value to inspect.
  25456. * @returns {string|symbol} Returns the key.
  25457. */
  25458. function toKey(value) {
  25459. if (typeof value == 'string' || isSymbol(value)) {
  25460. return value;
  25461. }
  25462. var result = (value + '');
  25463. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  25464. }
  25465. /**
  25466. * Converts `func` to its source code.
  25467. *
  25468. * @private
  25469. * @param {Function} func The function to convert.
  25470. * @returns {string} Returns the source code.
  25471. */
  25472. function toSource(func) {
  25473. if (func != null) {
  25474. try {
  25475. return funcToString.call(func);
  25476. } catch (e) {}
  25477. try {
  25478. return (func + '');
  25479. } catch (e) {}
  25480. }
  25481. return '';
  25482. }
  25483. /**
  25484. * Updates wrapper `details` based on `bitmask` flags.
  25485. *
  25486. * @private
  25487. * @returns {Array} details The details to modify.
  25488. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25489. * @returns {Array} Returns `details`.
  25490. */
  25491. function updateWrapDetails(details, bitmask) {
  25492. arrayEach(wrapFlags, function(pair) {
  25493. var value = '_.' + pair[0];
  25494. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  25495. details.push(value);
  25496. }
  25497. });
  25498. return details.sort();
  25499. }
  25500. /**
  25501. * Creates a clone of `wrapper`.
  25502. *
  25503. * @private
  25504. * @param {Object} wrapper The wrapper to clone.
  25505. * @returns {Object} Returns the cloned wrapper.
  25506. */
  25507. function wrapperClone(wrapper) {
  25508. if (wrapper instanceof LazyWrapper) {
  25509. return wrapper.clone();
  25510. }
  25511. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  25512. result.__actions__ = copyArray(wrapper.__actions__);
  25513. result.__index__ = wrapper.__index__;
  25514. result.__values__ = wrapper.__values__;
  25515. return result;
  25516. }
  25517. /*------------------------------------------------------------------------*/
  25518. /**
  25519. * Creates an array of elements split into groups the length of `size`.
  25520. * If `array` can't be split evenly, the final chunk will be the remaining
  25521. * elements.
  25522. *
  25523. * @static
  25524. * @memberOf _
  25525. * @since 3.0.0
  25526. * @category Array
  25527. * @param {Array} array The array to process.
  25528. * @param {number} [size=1] The length of each chunk
  25529. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25530. * @returns {Array} Returns the new array of chunks.
  25531. * @example
  25532. *
  25533. * _.chunk(['a', 'b', 'c', 'd'], 2);
  25534. * // => [['a', 'b'], ['c', 'd']]
  25535. *
  25536. * _.chunk(['a', 'b', 'c', 'd'], 3);
  25537. * // => [['a', 'b', 'c'], ['d']]
  25538. */
  25539. function chunk(array, size, guard) {
  25540. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  25541. size = 1;
  25542. } else {
  25543. size = nativeMax(toInteger(size), 0);
  25544. }
  25545. var length = array == null ? 0 : array.length;
  25546. if (!length || size < 1) {
  25547. return [];
  25548. }
  25549. var index = 0,
  25550. resIndex = 0,
  25551. result = Array(nativeCeil(length / size));
  25552. while (index < length) {
  25553. result[resIndex++] = baseSlice(array, index, (index += size));
  25554. }
  25555. return result;
  25556. }
  25557. /**
  25558. * Creates an array with all falsey values removed. The values `false`, `null`,
  25559. * `0`, `""`, `undefined`, and `NaN` are falsey.
  25560. *
  25561. * @static
  25562. * @memberOf _
  25563. * @since 0.1.0
  25564. * @category Array
  25565. * @param {Array} array The array to compact.
  25566. * @returns {Array} Returns the new array of filtered values.
  25567. * @example
  25568. *
  25569. * _.compact([0, 1, false, 2, '', 3]);
  25570. * // => [1, 2, 3]
  25571. */
  25572. function compact(array) {
  25573. var index = -1,
  25574. length = array == null ? 0 : array.length,
  25575. resIndex = 0,
  25576. result = [];
  25577. while (++index < length) {
  25578. var value = array[index];
  25579. if (value) {
  25580. result[resIndex++] = value;
  25581. }
  25582. }
  25583. return result;
  25584. }
  25585. /**
  25586. * Creates a new array concatenating `array` with any additional arrays
  25587. * and/or values.
  25588. *
  25589. * @static
  25590. * @memberOf _
  25591. * @since 4.0.0
  25592. * @category Array
  25593. * @param {Array} array The array to concatenate.
  25594. * @param {...*} [values] The values to concatenate.
  25595. * @returns {Array} Returns the new concatenated array.
  25596. * @example
  25597. *
  25598. * var array = [1];
  25599. * var other = _.concat(array, 2, [3], [[4]]);
  25600. *
  25601. * console.log(other);
  25602. * // => [1, 2, 3, [4]]
  25603. *
  25604. * console.log(array);
  25605. * // => [1]
  25606. */
  25607. function concat() {
  25608. var length = arguments.length;
  25609. if (!length) {
  25610. return [];
  25611. }
  25612. var args = Array(length - 1),
  25613. array = arguments[0],
  25614. index = length;
  25615. while (index--) {
  25616. args[index - 1] = arguments[index];
  25617. }
  25618. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  25619. }
  25620. /**
  25621. * Creates an array of `array` values not included in the other given arrays
  25622. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25623. * for equality comparisons. The order and references of result values are
  25624. * determined by the first array.
  25625. *
  25626. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  25627. *
  25628. * @static
  25629. * @memberOf _
  25630. * @since 0.1.0
  25631. * @category Array
  25632. * @param {Array} array The array to inspect.
  25633. * @param {...Array} [values] The values to exclude.
  25634. * @returns {Array} Returns the new array of filtered values.
  25635. * @see _.without, _.xor
  25636. * @example
  25637. *
  25638. * _.difference([2, 1], [2, 3]);
  25639. * // => [1]
  25640. */
  25641. var difference = baseRest(function(array, values) {
  25642. return isArrayLikeObject(array)
  25643. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  25644. : [];
  25645. });
  25646. /**
  25647. * This method is like `_.difference` except that it accepts `iteratee` which
  25648. * is invoked for each element of `array` and `values` to generate the criterion
  25649. * by which they're compared. The order and references of result values are
  25650. * determined by the first array. The iteratee is invoked with one argument:
  25651. * (value).
  25652. *
  25653. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  25654. *
  25655. * @static
  25656. * @memberOf _
  25657. * @since 4.0.0
  25658. * @category Array
  25659. * @param {Array} array The array to inspect.
  25660. * @param {...Array} [values] The values to exclude.
  25661. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25662. * @returns {Array} Returns the new array of filtered values.
  25663. * @example
  25664. *
  25665. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25666. * // => [1.2]
  25667. *
  25668. * // The `_.property` iteratee shorthand.
  25669. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  25670. * // => [{ 'x': 2 }]
  25671. */
  25672. var differenceBy = baseRest(function(array, values) {
  25673. var iteratee = last(values);
  25674. if (isArrayLikeObject(iteratee)) {
  25675. iteratee = undefined;
  25676. }
  25677. return isArrayLikeObject(array)
  25678. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  25679. : [];
  25680. });
  25681. /**
  25682. * This method is like `_.difference` except that it accepts `comparator`
  25683. * which is invoked to compare elements of `array` to `values`. The order and
  25684. * references of result values are determined by the first array. The comparator
  25685. * is invoked with two arguments: (arrVal, othVal).
  25686. *
  25687. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  25688. *
  25689. * @static
  25690. * @memberOf _
  25691. * @since 4.0.0
  25692. * @category Array
  25693. * @param {Array} array The array to inspect.
  25694. * @param {...Array} [values] The values to exclude.
  25695. * @param {Function} [comparator] The comparator invoked per element.
  25696. * @returns {Array} Returns the new array of filtered values.
  25697. * @example
  25698. *
  25699. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25700. *
  25701. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  25702. * // => [{ 'x': 2, 'y': 1 }]
  25703. */
  25704. var differenceWith = baseRest(function(array, values) {
  25705. var comparator = last(values);
  25706. if (isArrayLikeObject(comparator)) {
  25707. comparator = undefined;
  25708. }
  25709. return isArrayLikeObject(array)
  25710. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  25711. : [];
  25712. });
  25713. /**
  25714. * Creates a slice of `array` with `n` elements dropped from the beginning.
  25715. *
  25716. * @static
  25717. * @memberOf _
  25718. * @since 0.5.0
  25719. * @category Array
  25720. * @param {Array} array The array to query.
  25721. * @param {number} [n=1] The number of elements to drop.
  25722. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25723. * @returns {Array} Returns the slice of `array`.
  25724. * @example
  25725. *
  25726. * _.drop([1, 2, 3]);
  25727. * // => [2, 3]
  25728. *
  25729. * _.drop([1, 2, 3], 2);
  25730. * // => [3]
  25731. *
  25732. * _.drop([1, 2, 3], 5);
  25733. * // => []
  25734. *
  25735. * _.drop([1, 2, 3], 0);
  25736. * // => [1, 2, 3]
  25737. */
  25738. function drop(array, n, guard) {
  25739. var length = array == null ? 0 : array.length;
  25740. if (!length) {
  25741. return [];
  25742. }
  25743. n = (guard || n === undefined) ? 1 : toInteger(n);
  25744. return baseSlice(array, n < 0 ? 0 : n, length);
  25745. }
  25746. /**
  25747. * Creates a slice of `array` with `n` elements dropped from the end.
  25748. *
  25749. * @static
  25750. * @memberOf _
  25751. * @since 3.0.0
  25752. * @category Array
  25753. * @param {Array} array The array to query.
  25754. * @param {number} [n=1] The number of elements to drop.
  25755. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25756. * @returns {Array} Returns the slice of `array`.
  25757. * @example
  25758. *
  25759. * _.dropRight([1, 2, 3]);
  25760. * // => [1, 2]
  25761. *
  25762. * _.dropRight([1, 2, 3], 2);
  25763. * // => [1]
  25764. *
  25765. * _.dropRight([1, 2, 3], 5);
  25766. * // => []
  25767. *
  25768. * _.dropRight([1, 2, 3], 0);
  25769. * // => [1, 2, 3]
  25770. */
  25771. function dropRight(array, n, guard) {
  25772. var length = array == null ? 0 : array.length;
  25773. if (!length) {
  25774. return [];
  25775. }
  25776. n = (guard || n === undefined) ? 1 : toInteger(n);
  25777. n = length - n;
  25778. return baseSlice(array, 0, n < 0 ? 0 : n);
  25779. }
  25780. /**
  25781. * Creates a slice of `array` excluding elements dropped from the end.
  25782. * Elements are dropped until `predicate` returns falsey. The predicate is
  25783. * invoked with three arguments: (value, index, array).
  25784. *
  25785. * @static
  25786. * @memberOf _
  25787. * @since 3.0.0
  25788. * @category Array
  25789. * @param {Array} array The array to query.
  25790. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25791. * @returns {Array} Returns the slice of `array`.
  25792. * @example
  25793. *
  25794. * var users = [
  25795. * { 'user': 'barney', 'active': true },
  25796. * { 'user': 'fred', 'active': false },
  25797. * { 'user': 'pebbles', 'active': false }
  25798. * ];
  25799. *
  25800. * _.dropRightWhile(users, function(o) { return !o.active; });
  25801. * // => objects for ['barney']
  25802. *
  25803. * // The `_.matches` iteratee shorthand.
  25804. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  25805. * // => objects for ['barney', 'fred']
  25806. *
  25807. * // The `_.matchesProperty` iteratee shorthand.
  25808. * _.dropRightWhile(users, ['active', false]);
  25809. * // => objects for ['barney']
  25810. *
  25811. * // The `_.property` iteratee shorthand.
  25812. * _.dropRightWhile(users, 'active');
  25813. * // => objects for ['barney', 'fred', 'pebbles']
  25814. */
  25815. function dropRightWhile(array, predicate) {
  25816. return (array && array.length)
  25817. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  25818. : [];
  25819. }
  25820. /**
  25821. * Creates a slice of `array` excluding elements dropped from the beginning.
  25822. * Elements are dropped until `predicate` returns falsey. The predicate is
  25823. * invoked with three arguments: (value, index, array).
  25824. *
  25825. * @static
  25826. * @memberOf _
  25827. * @since 3.0.0
  25828. * @category Array
  25829. * @param {Array} array The array to query.
  25830. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25831. * @returns {Array} Returns the slice of `array`.
  25832. * @example
  25833. *
  25834. * var users = [
  25835. * { 'user': 'barney', 'active': false },
  25836. * { 'user': 'fred', 'active': false },
  25837. * { 'user': 'pebbles', 'active': true }
  25838. * ];
  25839. *
  25840. * _.dropWhile(users, function(o) { return !o.active; });
  25841. * // => objects for ['pebbles']
  25842. *
  25843. * // The `_.matches` iteratee shorthand.
  25844. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  25845. * // => objects for ['fred', 'pebbles']
  25846. *
  25847. * // The `_.matchesProperty` iteratee shorthand.
  25848. * _.dropWhile(users, ['active', false]);
  25849. * // => objects for ['pebbles']
  25850. *
  25851. * // The `_.property` iteratee shorthand.
  25852. * _.dropWhile(users, 'active');
  25853. * // => objects for ['barney', 'fred', 'pebbles']
  25854. */
  25855. function dropWhile(array, predicate) {
  25856. return (array && array.length)
  25857. ? baseWhile(array, getIteratee(predicate, 3), true)
  25858. : [];
  25859. }
  25860. /**
  25861. * Fills elements of `array` with `value` from `start` up to, but not
  25862. * including, `end`.
  25863. *
  25864. * **Note:** This method mutates `array`.
  25865. *
  25866. * @static
  25867. * @memberOf _
  25868. * @since 3.2.0
  25869. * @category Array
  25870. * @param {Array} array The array to fill.
  25871. * @param {*} value The value to fill `array` with.
  25872. * @param {number} [start=0] The start position.
  25873. * @param {number} [end=array.length] The end position.
  25874. * @returns {Array} Returns `array`.
  25875. * @example
  25876. *
  25877. * var array = [1, 2, 3];
  25878. *
  25879. * _.fill(array, 'a');
  25880. * console.log(array);
  25881. * // => ['a', 'a', 'a']
  25882. *
  25883. * _.fill(Array(3), 2);
  25884. * // => [2, 2, 2]
  25885. *
  25886. * _.fill([4, 6, 8, 10], '*', 1, 3);
  25887. * // => [4, '*', '*', 10]
  25888. */
  25889. function fill(array, value, start, end) {
  25890. var length = array == null ? 0 : array.length;
  25891. if (!length) {
  25892. return [];
  25893. }
  25894. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  25895. start = 0;
  25896. end = length;
  25897. }
  25898. return baseFill(array, value, start, end);
  25899. }
  25900. /**
  25901. * This method is like `_.find` except that it returns the index of the first
  25902. * element `predicate` returns truthy for instead of the element itself.
  25903. *
  25904. * @static
  25905. * @memberOf _
  25906. * @since 1.1.0
  25907. * @category Array
  25908. * @param {Array} array The array to inspect.
  25909. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25910. * @param {number} [fromIndex=0] The index to search from.
  25911. * @returns {number} Returns the index of the found element, else `-1`.
  25912. * @example
  25913. *
  25914. * var users = [
  25915. * { 'user': 'barney', 'active': false },
  25916. * { 'user': 'fred', 'active': false },
  25917. * { 'user': 'pebbles', 'active': true }
  25918. * ];
  25919. *
  25920. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  25921. * // => 0
  25922. *
  25923. * // The `_.matches` iteratee shorthand.
  25924. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25925. * // => 1
  25926. *
  25927. * // The `_.matchesProperty` iteratee shorthand.
  25928. * _.findIndex(users, ['active', false]);
  25929. * // => 0
  25930. *
  25931. * // The `_.property` iteratee shorthand.
  25932. * _.findIndex(users, 'active');
  25933. * // => 2
  25934. */
  25935. function findIndex(array, predicate, fromIndex) {
  25936. var length = array == null ? 0 : array.length;
  25937. if (!length) {
  25938. return -1;
  25939. }
  25940. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25941. if (index < 0) {
  25942. index = nativeMax(length + index, 0);
  25943. }
  25944. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25945. }
  25946. /**
  25947. * This method is like `_.findIndex` except that it iterates over elements
  25948. * of `collection` from right to left.
  25949. *
  25950. * @static
  25951. * @memberOf _
  25952. * @since 2.0.0
  25953. * @category Array
  25954. * @param {Array} array The array to inspect.
  25955. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25956. * @param {number} [fromIndex=array.length-1] The index to search from.
  25957. * @returns {number} Returns the index of the found element, else `-1`.
  25958. * @example
  25959. *
  25960. * var users = [
  25961. * { 'user': 'barney', 'active': true },
  25962. * { 'user': 'fred', 'active': false },
  25963. * { 'user': 'pebbles', 'active': false }
  25964. * ];
  25965. *
  25966. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25967. * // => 2
  25968. *
  25969. * // The `_.matches` iteratee shorthand.
  25970. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25971. * // => 0
  25972. *
  25973. * // The `_.matchesProperty` iteratee shorthand.
  25974. * _.findLastIndex(users, ['active', false]);
  25975. * // => 2
  25976. *
  25977. * // The `_.property` iteratee shorthand.
  25978. * _.findLastIndex(users, 'active');
  25979. * // => 0
  25980. */
  25981. function findLastIndex(array, predicate, fromIndex) {
  25982. var length = array == null ? 0 : array.length;
  25983. if (!length) {
  25984. return -1;
  25985. }
  25986. var index = length - 1;
  25987. if (fromIndex !== undefined) {
  25988. index = toInteger(fromIndex);
  25989. index = fromIndex < 0
  25990. ? nativeMax(length + index, 0)
  25991. : nativeMin(index, length - 1);
  25992. }
  25993. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25994. }
  25995. /**
  25996. * Flattens `array` a single level deep.
  25997. *
  25998. * @static
  25999. * @memberOf _
  26000. * @since 0.1.0
  26001. * @category Array
  26002. * @param {Array} array The array to flatten.
  26003. * @returns {Array} Returns the new flattened array.
  26004. * @example
  26005. *
  26006. * _.flatten([1, [2, [3, [4]], 5]]);
  26007. * // => [1, 2, [3, [4]], 5]
  26008. */
  26009. function flatten(array) {
  26010. var length = array == null ? 0 : array.length;
  26011. return length ? baseFlatten(array, 1) : [];
  26012. }
  26013. /**
  26014. * Recursively flattens `array`.
  26015. *
  26016. * @static
  26017. * @memberOf _
  26018. * @since 3.0.0
  26019. * @category Array
  26020. * @param {Array} array The array to flatten.
  26021. * @returns {Array} Returns the new flattened array.
  26022. * @example
  26023. *
  26024. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  26025. * // => [1, 2, 3, 4, 5]
  26026. */
  26027. function flattenDeep(array) {
  26028. var length = array == null ? 0 : array.length;
  26029. return length ? baseFlatten(array, INFINITY) : [];
  26030. }
  26031. /**
  26032. * Recursively flatten `array` up to `depth` times.
  26033. *
  26034. * @static
  26035. * @memberOf _
  26036. * @since 4.4.0
  26037. * @category Array
  26038. * @param {Array} array The array to flatten.
  26039. * @param {number} [depth=1] The maximum recursion depth.
  26040. * @returns {Array} Returns the new flattened array.
  26041. * @example
  26042. *
  26043. * var array = [1, [2, [3, [4]], 5]];
  26044. *
  26045. * _.flattenDepth(array, 1);
  26046. * // => [1, 2, [3, [4]], 5]
  26047. *
  26048. * _.flattenDepth(array, 2);
  26049. * // => [1, 2, 3, [4], 5]
  26050. */
  26051. function flattenDepth(array, depth) {
  26052. var length = array == null ? 0 : array.length;
  26053. if (!length) {
  26054. return [];
  26055. }
  26056. depth = depth === undefined ? 1 : toInteger(depth);
  26057. return baseFlatten(array, depth);
  26058. }
  26059. /**
  26060. * The inverse of `_.toPairs`; this method returns an object composed
  26061. * from key-value `pairs`.
  26062. *
  26063. * @static
  26064. * @memberOf _
  26065. * @since 4.0.0
  26066. * @category Array
  26067. * @param {Array} pairs The key-value pairs.
  26068. * @returns {Object} Returns the new object.
  26069. * @example
  26070. *
  26071. * _.fromPairs([['a', 1], ['b', 2]]);
  26072. * // => { 'a': 1, 'b': 2 }
  26073. */
  26074. function fromPairs(pairs) {
  26075. var index = -1,
  26076. length = pairs == null ? 0 : pairs.length,
  26077. result = {};
  26078. while (++index < length) {
  26079. var pair = pairs[index];
  26080. result[pair[0]] = pair[1];
  26081. }
  26082. return result;
  26083. }
  26084. /**
  26085. * Gets the first element of `array`.
  26086. *
  26087. * @static
  26088. * @memberOf _
  26089. * @since 0.1.0
  26090. * @alias first
  26091. * @category Array
  26092. * @param {Array} array The array to query.
  26093. * @returns {*} Returns the first element of `array`.
  26094. * @example
  26095. *
  26096. * _.head([1, 2, 3]);
  26097. * // => 1
  26098. *
  26099. * _.head([]);
  26100. * // => undefined
  26101. */
  26102. function head(array) {
  26103. return (array && array.length) ? array[0] : undefined;
  26104. }
  26105. /**
  26106. * Gets the index at which the first occurrence of `value` is found in `array`
  26107. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26108. * for equality comparisons. If `fromIndex` is negative, it's used as the
  26109. * offset from the end of `array`.
  26110. *
  26111. * @static
  26112. * @memberOf _
  26113. * @since 0.1.0
  26114. * @category Array
  26115. * @param {Array} array The array to inspect.
  26116. * @param {*} value The value to search for.
  26117. * @param {number} [fromIndex=0] The index to search from.
  26118. * @returns {number} Returns the index of the matched value, else `-1`.
  26119. * @example
  26120. *
  26121. * _.indexOf([1, 2, 1, 2], 2);
  26122. * // => 1
  26123. *
  26124. * // Search from the `fromIndex`.
  26125. * _.indexOf([1, 2, 1, 2], 2, 2);
  26126. * // => 3
  26127. */
  26128. function indexOf(array, value, fromIndex) {
  26129. var length = array == null ? 0 : array.length;
  26130. if (!length) {
  26131. return -1;
  26132. }
  26133. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  26134. if (index < 0) {
  26135. index = nativeMax(length + index, 0);
  26136. }
  26137. return baseIndexOf(array, value, index);
  26138. }
  26139. /**
  26140. * Gets all but the last element of `array`.
  26141. *
  26142. * @static
  26143. * @memberOf _
  26144. * @since 0.1.0
  26145. * @category Array
  26146. * @param {Array} array The array to query.
  26147. * @returns {Array} Returns the slice of `array`.
  26148. * @example
  26149. *
  26150. * _.initial([1, 2, 3]);
  26151. * // => [1, 2]
  26152. */
  26153. function initial(array) {
  26154. var length = array == null ? 0 : array.length;
  26155. return length ? baseSlice(array, 0, -1) : [];
  26156. }
  26157. /**
  26158. * Creates an array of unique values that are included in all given arrays
  26159. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26160. * for equality comparisons. The order and references of result values are
  26161. * determined by the first array.
  26162. *
  26163. * @static
  26164. * @memberOf _
  26165. * @since 0.1.0
  26166. * @category Array
  26167. * @param {...Array} [arrays] The arrays to inspect.
  26168. * @returns {Array} Returns the new array of intersecting values.
  26169. * @example
  26170. *
  26171. * _.intersection([2, 1], [2, 3]);
  26172. * // => [2]
  26173. */
  26174. var intersection = baseRest(function(arrays) {
  26175. var mapped = arrayMap(arrays, castArrayLikeObject);
  26176. return (mapped.length && mapped[0] === arrays[0])
  26177. ? baseIntersection(mapped)
  26178. : [];
  26179. });
  26180. /**
  26181. * This method is like `_.intersection` except that it accepts `iteratee`
  26182. * which is invoked for each element of each `arrays` to generate the criterion
  26183. * by which they're compared. The order and references of result values are
  26184. * determined by the first array. The iteratee is invoked with one argument:
  26185. * (value).
  26186. *
  26187. * @static
  26188. * @memberOf _
  26189. * @since 4.0.0
  26190. * @category Array
  26191. * @param {...Array} [arrays] The arrays to inspect.
  26192. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26193. * @returns {Array} Returns the new array of intersecting values.
  26194. * @example
  26195. *
  26196. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26197. * // => [2.1]
  26198. *
  26199. * // The `_.property` iteratee shorthand.
  26200. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26201. * // => [{ 'x': 1 }]
  26202. */
  26203. var intersectionBy = baseRest(function(arrays) {
  26204. var iteratee = last(arrays),
  26205. mapped = arrayMap(arrays, castArrayLikeObject);
  26206. if (iteratee === last(mapped)) {
  26207. iteratee = undefined;
  26208. } else {
  26209. mapped.pop();
  26210. }
  26211. return (mapped.length && mapped[0] === arrays[0])
  26212. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  26213. : [];
  26214. });
  26215. /**
  26216. * This method is like `_.intersection` except that it accepts `comparator`
  26217. * which is invoked to compare elements of `arrays`. The order and references
  26218. * of result values are determined by the first array. The comparator is
  26219. * invoked with two arguments: (arrVal, othVal).
  26220. *
  26221. * @static
  26222. * @memberOf _
  26223. * @since 4.0.0
  26224. * @category Array
  26225. * @param {...Array} [arrays] The arrays to inspect.
  26226. * @param {Function} [comparator] The comparator invoked per element.
  26227. * @returns {Array} Returns the new array of intersecting values.
  26228. * @example
  26229. *
  26230. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26231. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26232. *
  26233. * _.intersectionWith(objects, others, _.isEqual);
  26234. * // => [{ 'x': 1, 'y': 2 }]
  26235. */
  26236. var intersectionWith = baseRest(function(arrays) {
  26237. var comparator = last(arrays),
  26238. mapped = arrayMap(arrays, castArrayLikeObject);
  26239. comparator = typeof comparator == 'function' ? comparator : undefined;
  26240. if (comparator) {
  26241. mapped.pop();
  26242. }
  26243. return (mapped.length && mapped[0] === arrays[0])
  26244. ? baseIntersection(mapped, undefined, comparator)
  26245. : [];
  26246. });
  26247. /**
  26248. * Converts all elements in `array` into a string separated by `separator`.
  26249. *
  26250. * @static
  26251. * @memberOf _
  26252. * @since 4.0.0
  26253. * @category Array
  26254. * @param {Array} array The array to convert.
  26255. * @param {string} [separator=','] The element separator.
  26256. * @returns {string} Returns the joined string.
  26257. * @example
  26258. *
  26259. * _.join(['a', 'b', 'c'], '~');
  26260. * // => 'a~b~c'
  26261. */
  26262. function join(array, separator) {
  26263. return array == null ? '' : nativeJoin.call(array, separator);
  26264. }
  26265. /**
  26266. * Gets the last element of `array`.
  26267. *
  26268. * @static
  26269. * @memberOf _
  26270. * @since 0.1.0
  26271. * @category Array
  26272. * @param {Array} array The array to query.
  26273. * @returns {*} Returns the last element of `array`.
  26274. * @example
  26275. *
  26276. * _.last([1, 2, 3]);
  26277. * // => 3
  26278. */
  26279. function last(array) {
  26280. var length = array == null ? 0 : array.length;
  26281. return length ? array[length - 1] : undefined;
  26282. }
  26283. /**
  26284. * This method is like `_.indexOf` except that it iterates over elements of
  26285. * `array` from right to left.
  26286. *
  26287. * @static
  26288. * @memberOf _
  26289. * @since 0.1.0
  26290. * @category Array
  26291. * @param {Array} array The array to inspect.
  26292. * @param {*} value The value to search for.
  26293. * @param {number} [fromIndex=array.length-1] The index to search from.
  26294. * @returns {number} Returns the index of the matched value, else `-1`.
  26295. * @example
  26296. *
  26297. * _.lastIndexOf([1, 2, 1, 2], 2);
  26298. * // => 3
  26299. *
  26300. * // Search from the `fromIndex`.
  26301. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  26302. * // => 1
  26303. */
  26304. function lastIndexOf(array, value, fromIndex) {
  26305. var length = array == null ? 0 : array.length;
  26306. if (!length) {
  26307. return -1;
  26308. }
  26309. var index = length;
  26310. if (fromIndex !== undefined) {
  26311. index = toInteger(fromIndex);
  26312. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  26313. }
  26314. return value === value
  26315. ? strictLastIndexOf(array, value, index)
  26316. : baseFindIndex(array, baseIsNaN, index, true);
  26317. }
  26318. /**
  26319. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  26320. * element from the end is returned.
  26321. *
  26322. * @static
  26323. * @memberOf _
  26324. * @since 4.11.0
  26325. * @category Array
  26326. * @param {Array} array The array to query.
  26327. * @param {number} [n=0] The index of the element to return.
  26328. * @returns {*} Returns the nth element of `array`.
  26329. * @example
  26330. *
  26331. * var array = ['a', 'b', 'c', 'd'];
  26332. *
  26333. * _.nth(array, 1);
  26334. * // => 'b'
  26335. *
  26336. * _.nth(array, -2);
  26337. * // => 'c';
  26338. */
  26339. function nth(array, n) {
  26340. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  26341. }
  26342. /**
  26343. * Removes all given values from `array` using
  26344. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26345. * for equality comparisons.
  26346. *
  26347. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  26348. * to remove elements from an array by predicate.
  26349. *
  26350. * @static
  26351. * @memberOf _
  26352. * @since 2.0.0
  26353. * @category Array
  26354. * @param {Array} array The array to modify.
  26355. * @param {...*} [values] The values to remove.
  26356. * @returns {Array} Returns `array`.
  26357. * @example
  26358. *
  26359. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  26360. *
  26361. * _.pull(array, 'a', 'c');
  26362. * console.log(array);
  26363. * // => ['b', 'b']
  26364. */
  26365. var pull = baseRest(pullAll);
  26366. /**
  26367. * This method is like `_.pull` except that it accepts an array of values to remove.
  26368. *
  26369. * **Note:** Unlike `_.difference`, this method mutates `array`.
  26370. *
  26371. * @static
  26372. * @memberOf _
  26373. * @since 4.0.0
  26374. * @category Array
  26375. * @param {Array} array The array to modify.
  26376. * @param {Array} values The values to remove.
  26377. * @returns {Array} Returns `array`.
  26378. * @example
  26379. *
  26380. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  26381. *
  26382. * _.pullAll(array, ['a', 'c']);
  26383. * console.log(array);
  26384. * // => ['b', 'b']
  26385. */
  26386. function pullAll(array, values) {
  26387. return (array && array.length && values && values.length)
  26388. ? basePullAll(array, values)
  26389. : array;
  26390. }
  26391. /**
  26392. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  26393. * invoked for each element of `array` and `values` to generate the criterion
  26394. * by which they're compared. The iteratee is invoked with one argument: (value).
  26395. *
  26396. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  26397. *
  26398. * @static
  26399. * @memberOf _
  26400. * @since 4.0.0
  26401. * @category Array
  26402. * @param {Array} array The array to modify.
  26403. * @param {Array} values The values to remove.
  26404. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26405. * @returns {Array} Returns `array`.
  26406. * @example
  26407. *
  26408. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  26409. *
  26410. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  26411. * console.log(array);
  26412. * // => [{ 'x': 2 }]
  26413. */
  26414. function pullAllBy(array, values, iteratee) {
  26415. return (array && array.length && values && values.length)
  26416. ? basePullAll(array, values, getIteratee(iteratee, 2))
  26417. : array;
  26418. }
  26419. /**
  26420. * This method is like `_.pullAll` except that it accepts `comparator` which
  26421. * is invoked to compare elements of `array` to `values`. The comparator is
  26422. * invoked with two arguments: (arrVal, othVal).
  26423. *
  26424. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  26425. *
  26426. * @static
  26427. * @memberOf _
  26428. * @since 4.6.0
  26429. * @category Array
  26430. * @param {Array} array The array to modify.
  26431. * @param {Array} values The values to remove.
  26432. * @param {Function} [comparator] The comparator invoked per element.
  26433. * @returns {Array} Returns `array`.
  26434. * @example
  26435. *
  26436. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  26437. *
  26438. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  26439. * console.log(array);
  26440. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  26441. */
  26442. function pullAllWith(array, values, comparator) {
  26443. return (array && array.length && values && values.length)
  26444. ? basePullAll(array, values, undefined, comparator)
  26445. : array;
  26446. }
  26447. /**
  26448. * Removes elements from `array` corresponding to `indexes` and returns an
  26449. * array of removed elements.
  26450. *
  26451. * **Note:** Unlike `_.at`, this method mutates `array`.
  26452. *
  26453. * @static
  26454. * @memberOf _
  26455. * @since 3.0.0
  26456. * @category Array
  26457. * @param {Array} array The array to modify.
  26458. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  26459. * @returns {Array} Returns the new array of removed elements.
  26460. * @example
  26461. *
  26462. * var array = ['a', 'b', 'c', 'd'];
  26463. * var pulled = _.pullAt(array, [1, 3]);
  26464. *
  26465. * console.log(array);
  26466. * // => ['a', 'c']
  26467. *
  26468. * console.log(pulled);
  26469. * // => ['b', 'd']
  26470. */
  26471. var pullAt = flatRest(function(array, indexes) {
  26472. var length = array == null ? 0 : array.length,
  26473. result = baseAt(array, indexes);
  26474. basePullAt(array, arrayMap(indexes, function(index) {
  26475. return isIndex(index, length) ? +index : index;
  26476. }).sort(compareAscending));
  26477. return result;
  26478. });
  26479. /**
  26480. * Removes all elements from `array` that `predicate` returns truthy for
  26481. * and returns an array of the removed elements. The predicate is invoked
  26482. * with three arguments: (value, index, array).
  26483. *
  26484. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  26485. * to pull elements from an array by value.
  26486. *
  26487. * @static
  26488. * @memberOf _
  26489. * @since 2.0.0
  26490. * @category Array
  26491. * @param {Array} array The array to modify.
  26492. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26493. * @returns {Array} Returns the new array of removed elements.
  26494. * @example
  26495. *
  26496. * var array = [1, 2, 3, 4];
  26497. * var evens = _.remove(array, function(n) {
  26498. * return n % 2 == 0;
  26499. * });
  26500. *
  26501. * console.log(array);
  26502. * // => [1, 3]
  26503. *
  26504. * console.log(evens);
  26505. * // => [2, 4]
  26506. */
  26507. function remove(array, predicate) {
  26508. var result = [];
  26509. if (!(array && array.length)) {
  26510. return result;
  26511. }
  26512. var index = -1,
  26513. indexes = [],
  26514. length = array.length;
  26515. predicate = getIteratee(predicate, 3);
  26516. while (++index < length) {
  26517. var value = array[index];
  26518. if (predicate(value, index, array)) {
  26519. result.push(value);
  26520. indexes.push(index);
  26521. }
  26522. }
  26523. basePullAt(array, indexes);
  26524. return result;
  26525. }
  26526. /**
  26527. * Reverses `array` so that the first element becomes the last, the second
  26528. * element becomes the second to last, and so on.
  26529. *
  26530. * **Note:** This method mutates `array` and is based on
  26531. * [`Array#reverse`](https://mdn.io/Array/reverse).
  26532. *
  26533. * @static
  26534. * @memberOf _
  26535. * @since 4.0.0
  26536. * @category Array
  26537. * @param {Array} array The array to modify.
  26538. * @returns {Array} Returns `array`.
  26539. * @example
  26540. *
  26541. * var array = [1, 2, 3];
  26542. *
  26543. * _.reverse(array);
  26544. * // => [3, 2, 1]
  26545. *
  26546. * console.log(array);
  26547. * // => [3, 2, 1]
  26548. */
  26549. function reverse(array) {
  26550. return array == null ? array : nativeReverse.call(array);
  26551. }
  26552. /**
  26553. * Creates a slice of `array` from `start` up to, but not including, `end`.
  26554. *
  26555. * **Note:** This method is used instead of
  26556. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  26557. * returned.
  26558. *
  26559. * @static
  26560. * @memberOf _
  26561. * @since 3.0.0
  26562. * @category Array
  26563. * @param {Array} array The array to slice.
  26564. * @param {number} [start=0] The start position.
  26565. * @param {number} [end=array.length] The end position.
  26566. * @returns {Array} Returns the slice of `array`.
  26567. */
  26568. function slice(array, start, end) {
  26569. var length = array == null ? 0 : array.length;
  26570. if (!length) {
  26571. return [];
  26572. }
  26573. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  26574. start = 0;
  26575. end = length;
  26576. }
  26577. else {
  26578. start = start == null ? 0 : toInteger(start);
  26579. end = end === undefined ? length : toInteger(end);
  26580. }
  26581. return baseSlice(array, start, end);
  26582. }
  26583. /**
  26584. * Uses a binary search to determine the lowest index at which `value`
  26585. * should be inserted into `array` in order to maintain its sort order.
  26586. *
  26587. * @static
  26588. * @memberOf _
  26589. * @since 0.1.0
  26590. * @category Array
  26591. * @param {Array} array The sorted array to inspect.
  26592. * @param {*} value The value to evaluate.
  26593. * @returns {number} Returns the index at which `value` should be inserted
  26594. * into `array`.
  26595. * @example
  26596. *
  26597. * _.sortedIndex([30, 50], 40);
  26598. * // => 1
  26599. */
  26600. function sortedIndex(array, value) {
  26601. return baseSortedIndex(array, value);
  26602. }
  26603. /**
  26604. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  26605. * which is invoked for `value` and each element of `array` to compute their
  26606. * sort ranking. The iteratee is invoked with one argument: (value).
  26607. *
  26608. * @static
  26609. * @memberOf _
  26610. * @since 4.0.0
  26611. * @category Array
  26612. * @param {Array} array The sorted array to inspect.
  26613. * @param {*} value The value to evaluate.
  26614. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26615. * @returns {number} Returns the index at which `value` should be inserted
  26616. * into `array`.
  26617. * @example
  26618. *
  26619. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26620. *
  26621. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26622. * // => 0
  26623. *
  26624. * // The `_.property` iteratee shorthand.
  26625. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  26626. * // => 0
  26627. */
  26628. function sortedIndexBy(array, value, iteratee) {
  26629. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  26630. }
  26631. /**
  26632. * This method is like `_.indexOf` except that it performs a binary
  26633. * search on a sorted `array`.
  26634. *
  26635. * @static
  26636. * @memberOf _
  26637. * @since 4.0.0
  26638. * @category Array
  26639. * @param {Array} array The array to inspect.
  26640. * @param {*} value The value to search for.
  26641. * @returns {number} Returns the index of the matched value, else `-1`.
  26642. * @example
  26643. *
  26644. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  26645. * // => 1
  26646. */
  26647. function sortedIndexOf(array, value) {
  26648. var length = array == null ? 0 : array.length;
  26649. if (length) {
  26650. var index = baseSortedIndex(array, value);
  26651. if (index < length && eq(array[index], value)) {
  26652. return index;
  26653. }
  26654. }
  26655. return -1;
  26656. }
  26657. /**
  26658. * This method is like `_.sortedIndex` except that it returns the highest
  26659. * index at which `value` should be inserted into `array` in order to
  26660. * maintain its sort order.
  26661. *
  26662. * @static
  26663. * @memberOf _
  26664. * @since 3.0.0
  26665. * @category Array
  26666. * @param {Array} array The sorted array to inspect.
  26667. * @param {*} value The value to evaluate.
  26668. * @returns {number} Returns the index at which `value` should be inserted
  26669. * into `array`.
  26670. * @example
  26671. *
  26672. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  26673. * // => 4
  26674. */
  26675. function sortedLastIndex(array, value) {
  26676. return baseSortedIndex(array, value, true);
  26677. }
  26678. /**
  26679. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  26680. * which is invoked for `value` and each element of `array` to compute their
  26681. * sort ranking. The iteratee is invoked with one argument: (value).
  26682. *
  26683. * @static
  26684. * @memberOf _
  26685. * @since 4.0.0
  26686. * @category Array
  26687. * @param {Array} array The sorted array to inspect.
  26688. * @param {*} value The value to evaluate.
  26689. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26690. * @returns {number} Returns the index at which `value` should be inserted
  26691. * into `array`.
  26692. * @example
  26693. *
  26694. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26695. *
  26696. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26697. * // => 1
  26698. *
  26699. * // The `_.property` iteratee shorthand.
  26700. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  26701. * // => 1
  26702. */
  26703. function sortedLastIndexBy(array, value, iteratee) {
  26704. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  26705. }
  26706. /**
  26707. * This method is like `_.lastIndexOf` except that it performs a binary
  26708. * search on a sorted `array`.
  26709. *
  26710. * @static
  26711. * @memberOf _
  26712. * @since 4.0.0
  26713. * @category Array
  26714. * @param {Array} array The array to inspect.
  26715. * @param {*} value The value to search for.
  26716. * @returns {number} Returns the index of the matched value, else `-1`.
  26717. * @example
  26718. *
  26719. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  26720. * // => 3
  26721. */
  26722. function sortedLastIndexOf(array, value) {
  26723. var length = array == null ? 0 : array.length;
  26724. if (length) {
  26725. var index = baseSortedIndex(array, value, true) - 1;
  26726. if (eq(array[index], value)) {
  26727. return index;
  26728. }
  26729. }
  26730. return -1;
  26731. }
  26732. /**
  26733. * This method is like `_.uniq` except that it's designed and optimized
  26734. * for sorted arrays.
  26735. *
  26736. * @static
  26737. * @memberOf _
  26738. * @since 4.0.0
  26739. * @category Array
  26740. * @param {Array} array The array to inspect.
  26741. * @returns {Array} Returns the new duplicate free array.
  26742. * @example
  26743. *
  26744. * _.sortedUniq([1, 1, 2]);
  26745. * // => [1, 2]
  26746. */
  26747. function sortedUniq(array) {
  26748. return (array && array.length)
  26749. ? baseSortedUniq(array)
  26750. : [];
  26751. }
  26752. /**
  26753. * This method is like `_.uniqBy` except that it's designed and optimized
  26754. * for sorted arrays.
  26755. *
  26756. * @static
  26757. * @memberOf _
  26758. * @since 4.0.0
  26759. * @category Array
  26760. * @param {Array} array The array to inspect.
  26761. * @param {Function} [iteratee] The iteratee invoked per element.
  26762. * @returns {Array} Returns the new duplicate free array.
  26763. * @example
  26764. *
  26765. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  26766. * // => [1.1, 2.3]
  26767. */
  26768. function sortedUniqBy(array, iteratee) {
  26769. return (array && array.length)
  26770. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  26771. : [];
  26772. }
  26773. /**
  26774. * Gets all but the first element of `array`.
  26775. *
  26776. * @static
  26777. * @memberOf _
  26778. * @since 4.0.0
  26779. * @category Array
  26780. * @param {Array} array The array to query.
  26781. * @returns {Array} Returns the slice of `array`.
  26782. * @example
  26783. *
  26784. * _.tail([1, 2, 3]);
  26785. * // => [2, 3]
  26786. */
  26787. function tail(array) {
  26788. var length = array == null ? 0 : array.length;
  26789. return length ? baseSlice(array, 1, length) : [];
  26790. }
  26791. /**
  26792. * Creates a slice of `array` with `n` elements taken from the beginning.
  26793. *
  26794. * @static
  26795. * @memberOf _
  26796. * @since 0.1.0
  26797. * @category Array
  26798. * @param {Array} array The array to query.
  26799. * @param {number} [n=1] The number of elements to take.
  26800. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26801. * @returns {Array} Returns the slice of `array`.
  26802. * @example
  26803. *
  26804. * _.take([1, 2, 3]);
  26805. * // => [1]
  26806. *
  26807. * _.take([1, 2, 3], 2);
  26808. * // => [1, 2]
  26809. *
  26810. * _.take([1, 2, 3], 5);
  26811. * // => [1, 2, 3]
  26812. *
  26813. * _.take([1, 2, 3], 0);
  26814. * // => []
  26815. */
  26816. function take(array, n, guard) {
  26817. if (!(array && array.length)) {
  26818. return [];
  26819. }
  26820. n = (guard || n === undefined) ? 1 : toInteger(n);
  26821. return baseSlice(array, 0, n < 0 ? 0 : n);
  26822. }
  26823. /**
  26824. * Creates a slice of `array` with `n` elements taken from the end.
  26825. *
  26826. * @static
  26827. * @memberOf _
  26828. * @since 3.0.0
  26829. * @category Array
  26830. * @param {Array} array The array to query.
  26831. * @param {number} [n=1] The number of elements to take.
  26832. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26833. * @returns {Array} Returns the slice of `array`.
  26834. * @example
  26835. *
  26836. * _.takeRight([1, 2, 3]);
  26837. * // => [3]
  26838. *
  26839. * _.takeRight([1, 2, 3], 2);
  26840. * // => [2, 3]
  26841. *
  26842. * _.takeRight([1, 2, 3], 5);
  26843. * // => [1, 2, 3]
  26844. *
  26845. * _.takeRight([1, 2, 3], 0);
  26846. * // => []
  26847. */
  26848. function takeRight(array, n, guard) {
  26849. var length = array == null ? 0 : array.length;
  26850. if (!length) {
  26851. return [];
  26852. }
  26853. n = (guard || n === undefined) ? 1 : toInteger(n);
  26854. n = length - n;
  26855. return baseSlice(array, n < 0 ? 0 : n, length);
  26856. }
  26857. /**
  26858. * Creates a slice of `array` with elements taken from the end. Elements are
  26859. * taken until `predicate` returns falsey. The predicate is invoked with
  26860. * three arguments: (value, index, array).
  26861. *
  26862. * @static
  26863. * @memberOf _
  26864. * @since 3.0.0
  26865. * @category Array
  26866. * @param {Array} array The array to query.
  26867. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26868. * @returns {Array} Returns the slice of `array`.
  26869. * @example
  26870. *
  26871. * var users = [
  26872. * { 'user': 'barney', 'active': true },
  26873. * { 'user': 'fred', 'active': false },
  26874. * { 'user': 'pebbles', 'active': false }
  26875. * ];
  26876. *
  26877. * _.takeRightWhile(users, function(o) { return !o.active; });
  26878. * // => objects for ['fred', 'pebbles']
  26879. *
  26880. * // The `_.matches` iteratee shorthand.
  26881. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  26882. * // => objects for ['pebbles']
  26883. *
  26884. * // The `_.matchesProperty` iteratee shorthand.
  26885. * _.takeRightWhile(users, ['active', false]);
  26886. * // => objects for ['fred', 'pebbles']
  26887. *
  26888. * // The `_.property` iteratee shorthand.
  26889. * _.takeRightWhile(users, 'active');
  26890. * // => []
  26891. */
  26892. function takeRightWhile(array, predicate) {
  26893. return (array && array.length)
  26894. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  26895. : [];
  26896. }
  26897. /**
  26898. * Creates a slice of `array` with elements taken from the beginning. Elements
  26899. * are taken until `predicate` returns falsey. The predicate is invoked with
  26900. * three arguments: (value, index, array).
  26901. *
  26902. * @static
  26903. * @memberOf _
  26904. * @since 3.0.0
  26905. * @category Array
  26906. * @param {Array} array The array to query.
  26907. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26908. * @returns {Array} Returns the slice of `array`.
  26909. * @example
  26910. *
  26911. * var users = [
  26912. * { 'user': 'barney', 'active': false },
  26913. * { 'user': 'fred', 'active': false },
  26914. * { 'user': 'pebbles', 'active': true }
  26915. * ];
  26916. *
  26917. * _.takeWhile(users, function(o) { return !o.active; });
  26918. * // => objects for ['barney', 'fred']
  26919. *
  26920. * // The `_.matches` iteratee shorthand.
  26921. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26922. * // => objects for ['barney']
  26923. *
  26924. * // The `_.matchesProperty` iteratee shorthand.
  26925. * _.takeWhile(users, ['active', false]);
  26926. * // => objects for ['barney', 'fred']
  26927. *
  26928. * // The `_.property` iteratee shorthand.
  26929. * _.takeWhile(users, 'active');
  26930. * // => []
  26931. */
  26932. function takeWhile(array, predicate) {
  26933. return (array && array.length)
  26934. ? baseWhile(array, getIteratee(predicate, 3))
  26935. : [];
  26936. }
  26937. /**
  26938. * Creates an array of unique values, in order, from all given arrays using
  26939. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26940. * for equality comparisons.
  26941. *
  26942. * @static
  26943. * @memberOf _
  26944. * @since 0.1.0
  26945. * @category Array
  26946. * @param {...Array} [arrays] The arrays to inspect.
  26947. * @returns {Array} Returns the new array of combined values.
  26948. * @example
  26949. *
  26950. * _.union([2], [1, 2]);
  26951. * // => [2, 1]
  26952. */
  26953. var union = baseRest(function(arrays) {
  26954. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26955. });
  26956. /**
  26957. * This method is like `_.union` except that it accepts `iteratee` which is
  26958. * invoked for each element of each `arrays` to generate the criterion by
  26959. * which uniqueness is computed. Result values are chosen from the first
  26960. * array in which the value occurs. The iteratee is invoked with one argument:
  26961. * (value).
  26962. *
  26963. * @static
  26964. * @memberOf _
  26965. * @since 4.0.0
  26966. * @category Array
  26967. * @param {...Array} [arrays] The arrays to inspect.
  26968. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26969. * @returns {Array} Returns the new array of combined values.
  26970. * @example
  26971. *
  26972. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26973. * // => [2.1, 1.2]
  26974. *
  26975. * // The `_.property` iteratee shorthand.
  26976. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26977. * // => [{ 'x': 1 }, { 'x': 2 }]
  26978. */
  26979. var unionBy = baseRest(function(arrays) {
  26980. var iteratee = last(arrays);
  26981. if (isArrayLikeObject(iteratee)) {
  26982. iteratee = undefined;
  26983. }
  26984. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26985. });
  26986. /**
  26987. * This method is like `_.union` except that it accepts `comparator` which
  26988. * is invoked to compare elements of `arrays`. Result values are chosen from
  26989. * the first array in which the value occurs. The comparator is invoked
  26990. * with two arguments: (arrVal, othVal).
  26991. *
  26992. * @static
  26993. * @memberOf _
  26994. * @since 4.0.0
  26995. * @category Array
  26996. * @param {...Array} [arrays] The arrays to inspect.
  26997. * @param {Function} [comparator] The comparator invoked per element.
  26998. * @returns {Array} Returns the new array of combined values.
  26999. * @example
  27000. *
  27001. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  27002. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  27003. *
  27004. * _.unionWith(objects, others, _.isEqual);
  27005. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  27006. */
  27007. var unionWith = baseRest(function(arrays) {
  27008. var comparator = last(arrays);
  27009. comparator = typeof comparator == 'function' ? comparator : undefined;
  27010. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  27011. });
  27012. /**
  27013. * Creates a duplicate-free version of an array, using
  27014. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27015. * for equality comparisons, in which only the first occurrence of each element
  27016. * is kept. The order of result values is determined by the order they occur
  27017. * in the array.
  27018. *
  27019. * @static
  27020. * @memberOf _
  27021. * @since 0.1.0
  27022. * @category Array
  27023. * @param {Array} array The array to inspect.
  27024. * @returns {Array} Returns the new duplicate free array.
  27025. * @example
  27026. *
  27027. * _.uniq([2, 1, 2]);
  27028. * // => [2, 1]
  27029. */
  27030. function uniq(array) {
  27031. return (array && array.length) ? baseUniq(array) : [];
  27032. }
  27033. /**
  27034. * This method is like `_.uniq` except that it accepts `iteratee` which is
  27035. * invoked for each element in `array` to generate the criterion by which
  27036. * uniqueness is computed. The order of result values is determined by the
  27037. * order they occur in the array. The iteratee is invoked with one argument:
  27038. * (value).
  27039. *
  27040. * @static
  27041. * @memberOf _
  27042. * @since 4.0.0
  27043. * @category Array
  27044. * @param {Array} array The array to inspect.
  27045. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27046. * @returns {Array} Returns the new duplicate free array.
  27047. * @example
  27048. *
  27049. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  27050. * // => [2.1, 1.2]
  27051. *
  27052. * // The `_.property` iteratee shorthand.
  27053. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  27054. * // => [{ 'x': 1 }, { 'x': 2 }]
  27055. */
  27056. function uniqBy(array, iteratee) {
  27057. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  27058. }
  27059. /**
  27060. * This method is like `_.uniq` except that it accepts `comparator` which
  27061. * is invoked to compare elements of `array`. The order of result values is
  27062. * determined by the order they occur in the array.The comparator is invoked
  27063. * with two arguments: (arrVal, othVal).
  27064. *
  27065. * @static
  27066. * @memberOf _
  27067. * @since 4.0.0
  27068. * @category Array
  27069. * @param {Array} array The array to inspect.
  27070. * @param {Function} [comparator] The comparator invoked per element.
  27071. * @returns {Array} Returns the new duplicate free array.
  27072. * @example
  27073. *
  27074. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  27075. *
  27076. * _.uniqWith(objects, _.isEqual);
  27077. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  27078. */
  27079. function uniqWith(array, comparator) {
  27080. comparator = typeof comparator == 'function' ? comparator : undefined;
  27081. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  27082. }
  27083. /**
  27084. * This method is like `_.zip` except that it accepts an array of grouped
  27085. * elements and creates an array regrouping the elements to their pre-zip
  27086. * configuration.
  27087. *
  27088. * @static
  27089. * @memberOf _
  27090. * @since 1.2.0
  27091. * @category Array
  27092. * @param {Array} array The array of grouped elements to process.
  27093. * @returns {Array} Returns the new array of regrouped elements.
  27094. * @example
  27095. *
  27096. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  27097. * // => [['a', 1, true], ['b', 2, false]]
  27098. *
  27099. * _.unzip(zipped);
  27100. * // => [['a', 'b'], [1, 2], [true, false]]
  27101. */
  27102. function unzip(array) {
  27103. if (!(array && array.length)) {
  27104. return [];
  27105. }
  27106. var length = 0;
  27107. array = arrayFilter(array, function(group) {
  27108. if (isArrayLikeObject(group)) {
  27109. length = nativeMax(group.length, length);
  27110. return true;
  27111. }
  27112. });
  27113. return baseTimes(length, function(index) {
  27114. return arrayMap(array, baseProperty(index));
  27115. });
  27116. }
  27117. /**
  27118. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  27119. * how regrouped values should be combined. The iteratee is invoked with the
  27120. * elements of each group: (...group).
  27121. *
  27122. * @static
  27123. * @memberOf _
  27124. * @since 3.8.0
  27125. * @category Array
  27126. * @param {Array} array The array of grouped elements to process.
  27127. * @param {Function} [iteratee=_.identity] The function to combine
  27128. * regrouped values.
  27129. * @returns {Array} Returns the new array of regrouped elements.
  27130. * @example
  27131. *
  27132. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  27133. * // => [[1, 10, 100], [2, 20, 200]]
  27134. *
  27135. * _.unzipWith(zipped, _.add);
  27136. * // => [3, 30, 300]
  27137. */
  27138. function unzipWith(array, iteratee) {
  27139. if (!(array && array.length)) {
  27140. return [];
  27141. }
  27142. var result = unzip(array);
  27143. if (iteratee == null) {
  27144. return result;
  27145. }
  27146. return arrayMap(result, function(group) {
  27147. return apply(iteratee, undefined, group);
  27148. });
  27149. }
  27150. /**
  27151. * Creates an array excluding all given values using
  27152. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27153. * for equality comparisons.
  27154. *
  27155. * **Note:** Unlike `_.pull`, this method returns a new array.
  27156. *
  27157. * @static
  27158. * @memberOf _
  27159. * @since 0.1.0
  27160. * @category Array
  27161. * @param {Array} array The array to inspect.
  27162. * @param {...*} [values] The values to exclude.
  27163. * @returns {Array} Returns the new array of filtered values.
  27164. * @see _.difference, _.xor
  27165. * @example
  27166. *
  27167. * _.without([2, 1, 2, 3], 1, 2);
  27168. * // => [3]
  27169. */
  27170. var without = baseRest(function(array, values) {
  27171. return isArrayLikeObject(array)
  27172. ? baseDifference(array, values)
  27173. : [];
  27174. });
  27175. /**
  27176. * Creates an array of unique values that is the
  27177. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  27178. * of the given arrays. The order of result values is determined by the order
  27179. * they occur in the arrays.
  27180. *
  27181. * @static
  27182. * @memberOf _
  27183. * @since 2.4.0
  27184. * @category Array
  27185. * @param {...Array} [arrays] The arrays to inspect.
  27186. * @returns {Array} Returns the new array of filtered values.
  27187. * @see _.difference, _.without
  27188. * @example
  27189. *
  27190. * _.xor([2, 1], [2, 3]);
  27191. * // => [1, 3]
  27192. */
  27193. var xor = baseRest(function(arrays) {
  27194. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  27195. });
  27196. /**
  27197. * This method is like `_.xor` except that it accepts `iteratee` which is
  27198. * invoked for each element of each `arrays` to generate the criterion by
  27199. * which by which they're compared. The order of result values is determined
  27200. * by the order they occur in the arrays. The iteratee is invoked with one
  27201. * argument: (value).
  27202. *
  27203. * @static
  27204. * @memberOf _
  27205. * @since 4.0.0
  27206. * @category Array
  27207. * @param {...Array} [arrays] The arrays to inspect.
  27208. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27209. * @returns {Array} Returns the new array of filtered values.
  27210. * @example
  27211. *
  27212. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  27213. * // => [1.2, 3.4]
  27214. *
  27215. * // The `_.property` iteratee shorthand.
  27216. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  27217. * // => [{ 'x': 2 }]
  27218. */
  27219. var xorBy = baseRest(function(arrays) {
  27220. var iteratee = last(arrays);
  27221. if (isArrayLikeObject(iteratee)) {
  27222. iteratee = undefined;
  27223. }
  27224. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  27225. });
  27226. /**
  27227. * This method is like `_.xor` except that it accepts `comparator` which is
  27228. * invoked to compare elements of `arrays`. The order of result values is
  27229. * determined by the order they occur in the arrays. The comparator is invoked
  27230. * with two arguments: (arrVal, othVal).
  27231. *
  27232. * @static
  27233. * @memberOf _
  27234. * @since 4.0.0
  27235. * @category Array
  27236. * @param {...Array} [arrays] The arrays to inspect.
  27237. * @param {Function} [comparator] The comparator invoked per element.
  27238. * @returns {Array} Returns the new array of filtered values.
  27239. * @example
  27240. *
  27241. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  27242. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  27243. *
  27244. * _.xorWith(objects, others, _.isEqual);
  27245. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  27246. */
  27247. var xorWith = baseRest(function(arrays) {
  27248. var comparator = last(arrays);
  27249. comparator = typeof comparator == 'function' ? comparator : undefined;
  27250. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  27251. });
  27252. /**
  27253. * Creates an array of grouped elements, the first of which contains the
  27254. * first elements of the given arrays, the second of which contains the
  27255. * second elements of the given arrays, and so on.
  27256. *
  27257. * @static
  27258. * @memberOf _
  27259. * @since 0.1.0
  27260. * @category Array
  27261. * @param {...Array} [arrays] The arrays to process.
  27262. * @returns {Array} Returns the new array of grouped elements.
  27263. * @example
  27264. *
  27265. * _.zip(['a', 'b'], [1, 2], [true, false]);
  27266. * // => [['a', 1, true], ['b', 2, false]]
  27267. */
  27268. var zip = baseRest(unzip);
  27269. /**
  27270. * This method is like `_.fromPairs` except that it accepts two arrays,
  27271. * one of property identifiers and one of corresponding values.
  27272. *
  27273. * @static
  27274. * @memberOf _
  27275. * @since 0.4.0
  27276. * @category Array
  27277. * @param {Array} [props=[]] The property identifiers.
  27278. * @param {Array} [values=[]] The property values.
  27279. * @returns {Object} Returns the new object.
  27280. * @example
  27281. *
  27282. * _.zipObject(['a', 'b'], [1, 2]);
  27283. * // => { 'a': 1, 'b': 2 }
  27284. */
  27285. function zipObject(props, values) {
  27286. return baseZipObject(props || [], values || [], assignValue);
  27287. }
  27288. /**
  27289. * This method is like `_.zipObject` except that it supports property paths.
  27290. *
  27291. * @static
  27292. * @memberOf _
  27293. * @since 4.1.0
  27294. * @category Array
  27295. * @param {Array} [props=[]] The property identifiers.
  27296. * @param {Array} [values=[]] The property values.
  27297. * @returns {Object} Returns the new object.
  27298. * @example
  27299. *
  27300. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  27301. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  27302. */
  27303. function zipObjectDeep(props, values) {
  27304. return baseZipObject(props || [], values || [], baseSet);
  27305. }
  27306. /**
  27307. * This method is like `_.zip` except that it accepts `iteratee` to specify
  27308. * how grouped values should be combined. The iteratee is invoked with the
  27309. * elements of each group: (...group).
  27310. *
  27311. * @static
  27312. * @memberOf _
  27313. * @since 3.8.0
  27314. * @category Array
  27315. * @param {...Array} [arrays] The arrays to process.
  27316. * @param {Function} [iteratee=_.identity] The function to combine
  27317. * grouped values.
  27318. * @returns {Array} Returns the new array of grouped elements.
  27319. * @example
  27320. *
  27321. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  27322. * return a + b + c;
  27323. * });
  27324. * // => [111, 222]
  27325. */
  27326. var zipWith = baseRest(function(arrays) {
  27327. var length = arrays.length,
  27328. iteratee = length > 1 ? arrays[length - 1] : undefined;
  27329. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  27330. return unzipWith(arrays, iteratee);
  27331. });
  27332. /*------------------------------------------------------------------------*/
  27333. /**
  27334. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  27335. * chain sequences enabled. The result of such sequences must be unwrapped
  27336. * with `_#value`.
  27337. *
  27338. * @static
  27339. * @memberOf _
  27340. * @since 1.3.0
  27341. * @category Seq
  27342. * @param {*} value The value to wrap.
  27343. * @returns {Object} Returns the new `lodash` wrapper instance.
  27344. * @example
  27345. *
  27346. * var users = [
  27347. * { 'user': 'barney', 'age': 36 },
  27348. * { 'user': 'fred', 'age': 40 },
  27349. * { 'user': 'pebbles', 'age': 1 }
  27350. * ];
  27351. *
  27352. * var youngest = _
  27353. * .chain(users)
  27354. * .sortBy('age')
  27355. * .map(function(o) {
  27356. * return o.user + ' is ' + o.age;
  27357. * })
  27358. * .head()
  27359. * .value();
  27360. * // => 'pebbles is 1'
  27361. */
  27362. function chain(value) {
  27363. var result = lodash(value);
  27364. result.__chain__ = true;
  27365. return result;
  27366. }
  27367. /**
  27368. * This method invokes `interceptor` and returns `value`. The interceptor
  27369. * is invoked with one argument; (value). The purpose of this method is to
  27370. * "tap into" a method chain sequence in order to modify intermediate results.
  27371. *
  27372. * @static
  27373. * @memberOf _
  27374. * @since 0.1.0
  27375. * @category Seq
  27376. * @param {*} value The value to provide to `interceptor`.
  27377. * @param {Function} interceptor The function to invoke.
  27378. * @returns {*} Returns `value`.
  27379. * @example
  27380. *
  27381. * _([1, 2, 3])
  27382. * .tap(function(array) {
  27383. * // Mutate input array.
  27384. * array.pop();
  27385. * })
  27386. * .reverse()
  27387. * .value();
  27388. * // => [2, 1]
  27389. */
  27390. function tap(value, interceptor) {
  27391. interceptor(value);
  27392. return value;
  27393. }
  27394. /**
  27395. * This method is like `_.tap` except that it returns the result of `interceptor`.
  27396. * The purpose of this method is to "pass thru" values replacing intermediate
  27397. * results in a method chain sequence.
  27398. *
  27399. * @static
  27400. * @memberOf _
  27401. * @since 3.0.0
  27402. * @category Seq
  27403. * @param {*} value The value to provide to `interceptor`.
  27404. * @param {Function} interceptor The function to invoke.
  27405. * @returns {*} Returns the result of `interceptor`.
  27406. * @example
  27407. *
  27408. * _(' abc ')
  27409. * .chain()
  27410. * .trim()
  27411. * .thru(function(value) {
  27412. * return [value];
  27413. * })
  27414. * .value();
  27415. * // => ['abc']
  27416. */
  27417. function thru(value, interceptor) {
  27418. return interceptor(value);
  27419. }
  27420. /**
  27421. * This method is the wrapper version of `_.at`.
  27422. *
  27423. * @name at
  27424. * @memberOf _
  27425. * @since 1.0.0
  27426. * @category Seq
  27427. * @param {...(string|string[])} [paths] The property paths to pick.
  27428. * @returns {Object} Returns the new `lodash` wrapper instance.
  27429. * @example
  27430. *
  27431. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  27432. *
  27433. * _(object).at(['a[0].b.c', 'a[1]']).value();
  27434. * // => [3, 4]
  27435. */
  27436. var wrapperAt = flatRest(function(paths) {
  27437. var length = paths.length,
  27438. start = length ? paths[0] : 0,
  27439. value = this.__wrapped__,
  27440. interceptor = function(object) { return baseAt(object, paths); };
  27441. if (length > 1 || this.__actions__.length ||
  27442. !(value instanceof LazyWrapper) || !isIndex(start)) {
  27443. return this.thru(interceptor);
  27444. }
  27445. value = value.slice(start, +start + (length ? 1 : 0));
  27446. value.__actions__.push({
  27447. 'func': thru,
  27448. 'args': [interceptor],
  27449. 'thisArg': undefined
  27450. });
  27451. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  27452. if (length && !array.length) {
  27453. array.push(undefined);
  27454. }
  27455. return array;
  27456. });
  27457. });
  27458. /**
  27459. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  27460. *
  27461. * @name chain
  27462. * @memberOf _
  27463. * @since 0.1.0
  27464. * @category Seq
  27465. * @returns {Object} Returns the new `lodash` wrapper instance.
  27466. * @example
  27467. *
  27468. * var users = [
  27469. * { 'user': 'barney', 'age': 36 },
  27470. * { 'user': 'fred', 'age': 40 }
  27471. * ];
  27472. *
  27473. * // A sequence without explicit chaining.
  27474. * _(users).head();
  27475. * // => { 'user': 'barney', 'age': 36 }
  27476. *
  27477. * // A sequence with explicit chaining.
  27478. * _(users)
  27479. * .chain()
  27480. * .head()
  27481. * .pick('user')
  27482. * .value();
  27483. * // => { 'user': 'barney' }
  27484. */
  27485. function wrapperChain() {
  27486. return chain(this);
  27487. }
  27488. /**
  27489. * Executes the chain sequence and returns the wrapped result.
  27490. *
  27491. * @name commit
  27492. * @memberOf _
  27493. * @since 3.2.0
  27494. * @category Seq
  27495. * @returns {Object} Returns the new `lodash` wrapper instance.
  27496. * @example
  27497. *
  27498. * var array = [1, 2];
  27499. * var wrapped = _(array).push(3);
  27500. *
  27501. * console.log(array);
  27502. * // => [1, 2]
  27503. *
  27504. * wrapped = wrapped.commit();
  27505. * console.log(array);
  27506. * // => [1, 2, 3]
  27507. *
  27508. * wrapped.last();
  27509. * // => 3
  27510. *
  27511. * console.log(array);
  27512. * // => [1, 2, 3]
  27513. */
  27514. function wrapperCommit() {
  27515. return new LodashWrapper(this.value(), this.__chain__);
  27516. }
  27517. /**
  27518. * Gets the next value on a wrapped object following the
  27519. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  27520. *
  27521. * @name next
  27522. * @memberOf _
  27523. * @since 4.0.0
  27524. * @category Seq
  27525. * @returns {Object} Returns the next iterator value.
  27526. * @example
  27527. *
  27528. * var wrapped = _([1, 2]);
  27529. *
  27530. * wrapped.next();
  27531. * // => { 'done': false, 'value': 1 }
  27532. *
  27533. * wrapped.next();
  27534. * // => { 'done': false, 'value': 2 }
  27535. *
  27536. * wrapped.next();
  27537. * // => { 'done': true, 'value': undefined }
  27538. */
  27539. function wrapperNext() {
  27540. if (this.__values__ === undefined) {
  27541. this.__values__ = toArray(this.value());
  27542. }
  27543. var done = this.__index__ >= this.__values__.length,
  27544. value = done ? undefined : this.__values__[this.__index__++];
  27545. return { 'done': done, 'value': value };
  27546. }
  27547. /**
  27548. * Enables the wrapper to be iterable.
  27549. *
  27550. * @name Symbol.iterator
  27551. * @memberOf _
  27552. * @since 4.0.0
  27553. * @category Seq
  27554. * @returns {Object} Returns the wrapper object.
  27555. * @example
  27556. *
  27557. * var wrapped = _([1, 2]);
  27558. *
  27559. * wrapped[Symbol.iterator]() === wrapped;
  27560. * // => true
  27561. *
  27562. * Array.from(wrapped);
  27563. * // => [1, 2]
  27564. */
  27565. function wrapperToIterator() {
  27566. return this;
  27567. }
  27568. /**
  27569. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  27570. *
  27571. * @name plant
  27572. * @memberOf _
  27573. * @since 3.2.0
  27574. * @category Seq
  27575. * @param {*} value The value to plant.
  27576. * @returns {Object} Returns the new `lodash` wrapper instance.
  27577. * @example
  27578. *
  27579. * function square(n) {
  27580. * return n * n;
  27581. * }
  27582. *
  27583. * var wrapped = _([1, 2]).map(square);
  27584. * var other = wrapped.plant([3, 4]);
  27585. *
  27586. * other.value();
  27587. * // => [9, 16]
  27588. *
  27589. * wrapped.value();
  27590. * // => [1, 4]
  27591. */
  27592. function wrapperPlant(value) {
  27593. var result,
  27594. parent = this;
  27595. while (parent instanceof baseLodash) {
  27596. var clone = wrapperClone(parent);
  27597. clone.__index__ = 0;
  27598. clone.__values__ = undefined;
  27599. if (result) {
  27600. previous.__wrapped__ = clone;
  27601. } else {
  27602. result = clone;
  27603. }
  27604. var previous = clone;
  27605. parent = parent.__wrapped__;
  27606. }
  27607. previous.__wrapped__ = value;
  27608. return result;
  27609. }
  27610. /**
  27611. * This method is the wrapper version of `_.reverse`.
  27612. *
  27613. * **Note:** This method mutates the wrapped array.
  27614. *
  27615. * @name reverse
  27616. * @memberOf _
  27617. * @since 0.1.0
  27618. * @category Seq
  27619. * @returns {Object} Returns the new `lodash` wrapper instance.
  27620. * @example
  27621. *
  27622. * var array = [1, 2, 3];
  27623. *
  27624. * _(array).reverse().value()
  27625. * // => [3, 2, 1]
  27626. *
  27627. * console.log(array);
  27628. * // => [3, 2, 1]
  27629. */
  27630. function wrapperReverse() {
  27631. var value = this.__wrapped__;
  27632. if (value instanceof LazyWrapper) {
  27633. var wrapped = value;
  27634. if (this.__actions__.length) {
  27635. wrapped = new LazyWrapper(this);
  27636. }
  27637. wrapped = wrapped.reverse();
  27638. wrapped.__actions__.push({
  27639. 'func': thru,
  27640. 'args': [reverse],
  27641. 'thisArg': undefined
  27642. });
  27643. return new LodashWrapper(wrapped, this.__chain__);
  27644. }
  27645. return this.thru(reverse);
  27646. }
  27647. /**
  27648. * Executes the chain sequence to resolve the unwrapped value.
  27649. *
  27650. * @name value
  27651. * @memberOf _
  27652. * @since 0.1.0
  27653. * @alias toJSON, valueOf
  27654. * @category Seq
  27655. * @returns {*} Returns the resolved unwrapped value.
  27656. * @example
  27657. *
  27658. * _([1, 2, 3]).value();
  27659. * // => [1, 2, 3]
  27660. */
  27661. function wrapperValue() {
  27662. return baseWrapperValue(this.__wrapped__, this.__actions__);
  27663. }
  27664. /*------------------------------------------------------------------------*/
  27665. /**
  27666. * Creates an object composed of keys generated from the results of running
  27667. * each element of `collection` thru `iteratee`. The corresponding value of
  27668. * each key is the number of times the key was returned by `iteratee`. The
  27669. * iteratee is invoked with one argument: (value).
  27670. *
  27671. * @static
  27672. * @memberOf _
  27673. * @since 0.5.0
  27674. * @category Collection
  27675. * @param {Array|Object} collection The collection to iterate over.
  27676. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27677. * @returns {Object} Returns the composed aggregate object.
  27678. * @example
  27679. *
  27680. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  27681. * // => { '4': 1, '6': 2 }
  27682. *
  27683. * // The `_.property` iteratee shorthand.
  27684. * _.countBy(['one', 'two', 'three'], 'length');
  27685. * // => { '3': 2, '5': 1 }
  27686. */
  27687. var countBy = createAggregator(function(result, value, key) {
  27688. if (hasOwnProperty.call(result, key)) {
  27689. ++result[key];
  27690. } else {
  27691. baseAssignValue(result, key, 1);
  27692. }
  27693. });
  27694. /**
  27695. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  27696. * Iteration is stopped once `predicate` returns falsey. The predicate is
  27697. * invoked with three arguments: (value, index|key, collection).
  27698. *
  27699. * **Note:** This method returns `true` for
  27700. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  27701. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  27702. * elements of empty collections.
  27703. *
  27704. * @static
  27705. * @memberOf _
  27706. * @since 0.1.0
  27707. * @category Collection
  27708. * @param {Array|Object} collection The collection to iterate over.
  27709. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27710. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27711. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  27712. * else `false`.
  27713. * @example
  27714. *
  27715. * _.every([true, 1, null, 'yes'], Boolean);
  27716. * // => false
  27717. *
  27718. * var users = [
  27719. * { 'user': 'barney', 'age': 36, 'active': false },
  27720. * { 'user': 'fred', 'age': 40, 'active': false }
  27721. * ];
  27722. *
  27723. * // The `_.matches` iteratee shorthand.
  27724. * _.every(users, { 'user': 'barney', 'active': false });
  27725. * // => false
  27726. *
  27727. * // The `_.matchesProperty` iteratee shorthand.
  27728. * _.every(users, ['active', false]);
  27729. * // => true
  27730. *
  27731. * // The `_.property` iteratee shorthand.
  27732. * _.every(users, 'active');
  27733. * // => false
  27734. */
  27735. function every(collection, predicate, guard) {
  27736. var func = isArray(collection) ? arrayEvery : baseEvery;
  27737. if (guard && isIterateeCall(collection, predicate, guard)) {
  27738. predicate = undefined;
  27739. }
  27740. return func(collection, getIteratee(predicate, 3));
  27741. }
  27742. /**
  27743. * Iterates over elements of `collection`, returning an array of all elements
  27744. * `predicate` returns truthy for. The predicate is invoked with three
  27745. * arguments: (value, index|key, collection).
  27746. *
  27747. * **Note:** Unlike `_.remove`, this method returns a new array.
  27748. *
  27749. * @static
  27750. * @memberOf _
  27751. * @since 0.1.0
  27752. * @category Collection
  27753. * @param {Array|Object} collection The collection to iterate over.
  27754. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27755. * @returns {Array} Returns the new filtered array.
  27756. * @see _.reject
  27757. * @example
  27758. *
  27759. * var users = [
  27760. * { 'user': 'barney', 'age': 36, 'active': true },
  27761. * { 'user': 'fred', 'age': 40, 'active': false }
  27762. * ];
  27763. *
  27764. * _.filter(users, function(o) { return !o.active; });
  27765. * // => objects for ['fred']
  27766. *
  27767. * // The `_.matches` iteratee shorthand.
  27768. * _.filter(users, { 'age': 36, 'active': true });
  27769. * // => objects for ['barney']
  27770. *
  27771. * // The `_.matchesProperty` iteratee shorthand.
  27772. * _.filter(users, ['active', false]);
  27773. * // => objects for ['fred']
  27774. *
  27775. * // The `_.property` iteratee shorthand.
  27776. * _.filter(users, 'active');
  27777. * // => objects for ['barney']
  27778. */
  27779. function filter(collection, predicate) {
  27780. var func = isArray(collection) ? arrayFilter : baseFilter;
  27781. return func(collection, getIteratee(predicate, 3));
  27782. }
  27783. /**
  27784. * Iterates over elements of `collection`, returning the first element
  27785. * `predicate` returns truthy for. The predicate is invoked with three
  27786. * arguments: (value, index|key, collection).
  27787. *
  27788. * @static
  27789. * @memberOf _
  27790. * @since 0.1.0
  27791. * @category Collection
  27792. * @param {Array|Object} collection The collection to inspect.
  27793. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27794. * @param {number} [fromIndex=0] The index to search from.
  27795. * @returns {*} Returns the matched element, else `undefined`.
  27796. * @example
  27797. *
  27798. * var users = [
  27799. * { 'user': 'barney', 'age': 36, 'active': true },
  27800. * { 'user': 'fred', 'age': 40, 'active': false },
  27801. * { 'user': 'pebbles', 'age': 1, 'active': true }
  27802. * ];
  27803. *
  27804. * _.find(users, function(o) { return o.age < 40; });
  27805. * // => object for 'barney'
  27806. *
  27807. * // The `_.matches` iteratee shorthand.
  27808. * _.find(users, { 'age': 1, 'active': true });
  27809. * // => object for 'pebbles'
  27810. *
  27811. * // The `_.matchesProperty` iteratee shorthand.
  27812. * _.find(users, ['active', false]);
  27813. * // => object for 'fred'
  27814. *
  27815. * // The `_.property` iteratee shorthand.
  27816. * _.find(users, 'active');
  27817. * // => object for 'barney'
  27818. */
  27819. var find = createFind(findIndex);
  27820. /**
  27821. * This method is like `_.find` except that it iterates over elements of
  27822. * `collection` from right to left.
  27823. *
  27824. * @static
  27825. * @memberOf _
  27826. * @since 2.0.0
  27827. * @category Collection
  27828. * @param {Array|Object} collection The collection to inspect.
  27829. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27830. * @param {number} [fromIndex=collection.length-1] The index to search from.
  27831. * @returns {*} Returns the matched element, else `undefined`.
  27832. * @example
  27833. *
  27834. * _.findLast([1, 2, 3, 4], function(n) {
  27835. * return n % 2 == 1;
  27836. * });
  27837. * // => 3
  27838. */
  27839. var findLast = createFind(findLastIndex);
  27840. /**
  27841. * Creates a flattened array of values by running each element in `collection`
  27842. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  27843. * with three arguments: (value, index|key, collection).
  27844. *
  27845. * @static
  27846. * @memberOf _
  27847. * @since 4.0.0
  27848. * @category Collection
  27849. * @param {Array|Object} collection The collection to iterate over.
  27850. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27851. * @returns {Array} Returns the new flattened array.
  27852. * @example
  27853. *
  27854. * function duplicate(n) {
  27855. * return [n, n];
  27856. * }
  27857. *
  27858. * _.flatMap([1, 2], duplicate);
  27859. * // => [1, 1, 2, 2]
  27860. */
  27861. function flatMap(collection, iteratee) {
  27862. return baseFlatten(map(collection, iteratee), 1);
  27863. }
  27864. /**
  27865. * This method is like `_.flatMap` except that it recursively flattens the
  27866. * mapped results.
  27867. *
  27868. * @static
  27869. * @memberOf _
  27870. * @since 4.7.0
  27871. * @category Collection
  27872. * @param {Array|Object} collection The collection to iterate over.
  27873. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27874. * @returns {Array} Returns the new flattened array.
  27875. * @example
  27876. *
  27877. * function duplicate(n) {
  27878. * return [[[n, n]]];
  27879. * }
  27880. *
  27881. * _.flatMapDeep([1, 2], duplicate);
  27882. * // => [1, 1, 2, 2]
  27883. */
  27884. function flatMapDeep(collection, iteratee) {
  27885. return baseFlatten(map(collection, iteratee), INFINITY);
  27886. }
  27887. /**
  27888. * This method is like `_.flatMap` except that it recursively flattens the
  27889. * mapped results up to `depth` times.
  27890. *
  27891. * @static
  27892. * @memberOf _
  27893. * @since 4.7.0
  27894. * @category Collection
  27895. * @param {Array|Object} collection The collection to iterate over.
  27896. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27897. * @param {number} [depth=1] The maximum recursion depth.
  27898. * @returns {Array} Returns the new flattened array.
  27899. * @example
  27900. *
  27901. * function duplicate(n) {
  27902. * return [[[n, n]]];
  27903. * }
  27904. *
  27905. * _.flatMapDepth([1, 2], duplicate, 2);
  27906. * // => [[1, 1], [2, 2]]
  27907. */
  27908. function flatMapDepth(collection, iteratee, depth) {
  27909. depth = depth === undefined ? 1 : toInteger(depth);
  27910. return baseFlatten(map(collection, iteratee), depth);
  27911. }
  27912. /**
  27913. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  27914. * The iteratee is invoked with three arguments: (value, index|key, collection).
  27915. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27916. *
  27917. * **Note:** As with other "Collections" methods, objects with a "length"
  27918. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  27919. * or `_.forOwn` for object iteration.
  27920. *
  27921. * @static
  27922. * @memberOf _
  27923. * @since 0.1.0
  27924. * @alias each
  27925. * @category Collection
  27926. * @param {Array|Object} collection The collection to iterate over.
  27927. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27928. * @returns {Array|Object} Returns `collection`.
  27929. * @see _.forEachRight
  27930. * @example
  27931. *
  27932. * _.forEach([1, 2], function(value) {
  27933. * console.log(value);
  27934. * });
  27935. * // => Logs `1` then `2`.
  27936. *
  27937. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27938. * console.log(key);
  27939. * });
  27940. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27941. */
  27942. function forEach(collection, iteratee) {
  27943. var func = isArray(collection) ? arrayEach : baseEach;
  27944. return func(collection, getIteratee(iteratee, 3));
  27945. }
  27946. /**
  27947. * This method is like `_.forEach` except that it iterates over elements of
  27948. * `collection` from right to left.
  27949. *
  27950. * @static
  27951. * @memberOf _
  27952. * @since 2.0.0
  27953. * @alias eachRight
  27954. * @category Collection
  27955. * @param {Array|Object} collection The collection to iterate over.
  27956. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27957. * @returns {Array|Object} Returns `collection`.
  27958. * @see _.forEach
  27959. * @example
  27960. *
  27961. * _.forEachRight([1, 2], function(value) {
  27962. * console.log(value);
  27963. * });
  27964. * // => Logs `2` then `1`.
  27965. */
  27966. function forEachRight(collection, iteratee) {
  27967. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27968. return func(collection, getIteratee(iteratee, 3));
  27969. }
  27970. /**
  27971. * Creates an object composed of keys generated from the results of running
  27972. * each element of `collection` thru `iteratee`. The order of grouped values
  27973. * is determined by the order they occur in `collection`. The corresponding
  27974. * value of each key is an array of elements responsible for generating the
  27975. * key. The iteratee is invoked with one argument: (value).
  27976. *
  27977. * @static
  27978. * @memberOf _
  27979. * @since 0.1.0
  27980. * @category Collection
  27981. * @param {Array|Object} collection The collection to iterate over.
  27982. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27983. * @returns {Object} Returns the composed aggregate object.
  27984. * @example
  27985. *
  27986. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27987. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27988. *
  27989. * // The `_.property` iteratee shorthand.
  27990. * _.groupBy(['one', 'two', 'three'], 'length');
  27991. * // => { '3': ['one', 'two'], '5': ['three'] }
  27992. */
  27993. var groupBy = createAggregator(function(result, value, key) {
  27994. if (hasOwnProperty.call(result, key)) {
  27995. result[key].push(value);
  27996. } else {
  27997. baseAssignValue(result, key, [value]);
  27998. }
  27999. });
  28000. /**
  28001. * Checks if `value` is in `collection`. If `collection` is a string, it's
  28002. * checked for a substring of `value`, otherwise
  28003. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28004. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  28005. * the offset from the end of `collection`.
  28006. *
  28007. * @static
  28008. * @memberOf _
  28009. * @since 0.1.0
  28010. * @category Collection
  28011. * @param {Array|Object|string} collection The collection to inspect.
  28012. * @param {*} value The value to search for.
  28013. * @param {number} [fromIndex=0] The index to search from.
  28014. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  28015. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  28016. * @example
  28017. *
  28018. * _.includes([1, 2, 3], 1);
  28019. * // => true
  28020. *
  28021. * _.includes([1, 2, 3], 1, 2);
  28022. * // => false
  28023. *
  28024. * _.includes({ 'a': 1, 'b': 2 }, 1);
  28025. * // => true
  28026. *
  28027. * _.includes('abcd', 'bc');
  28028. * // => true
  28029. */
  28030. function includes(collection, value, fromIndex, guard) {
  28031. collection = isArrayLike(collection) ? collection : values(collection);
  28032. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  28033. var length = collection.length;
  28034. if (fromIndex < 0) {
  28035. fromIndex = nativeMax(length + fromIndex, 0);
  28036. }
  28037. return isString(collection)
  28038. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  28039. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  28040. }
  28041. /**
  28042. * Invokes the method at `path` of each element in `collection`, returning
  28043. * an array of the results of each invoked method. Any additional arguments
  28044. * are provided to each invoked method. If `path` is a function, it's invoked
  28045. * for, and `this` bound to, each element in `collection`.
  28046. *
  28047. * @static
  28048. * @memberOf _
  28049. * @since 4.0.0
  28050. * @category Collection
  28051. * @param {Array|Object} collection The collection to iterate over.
  28052. * @param {Array|Function|string} path The path of the method to invoke or
  28053. * the function invoked per iteration.
  28054. * @param {...*} [args] The arguments to invoke each method with.
  28055. * @returns {Array} Returns the array of results.
  28056. * @example
  28057. *
  28058. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  28059. * // => [[1, 5, 7], [1, 2, 3]]
  28060. *
  28061. * _.invokeMap([123, 456], String.prototype.split, '');
  28062. * // => [['1', '2', '3'], ['4', '5', '6']]
  28063. */
  28064. var invokeMap = baseRest(function(collection, path, args) {
  28065. var index = -1,
  28066. isFunc = typeof path == 'function',
  28067. result = isArrayLike(collection) ? Array(collection.length) : [];
  28068. baseEach(collection, function(value) {
  28069. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  28070. });
  28071. return result;
  28072. });
  28073. /**
  28074. * Creates an object composed of keys generated from the results of running
  28075. * each element of `collection` thru `iteratee`. The corresponding value of
  28076. * each key is the last element responsible for generating the key. The
  28077. * iteratee is invoked with one argument: (value).
  28078. *
  28079. * @static
  28080. * @memberOf _
  28081. * @since 4.0.0
  28082. * @category Collection
  28083. * @param {Array|Object} collection The collection to iterate over.
  28084. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  28085. * @returns {Object} Returns the composed aggregate object.
  28086. * @example
  28087. *
  28088. * var array = [
  28089. * { 'dir': 'left', 'code': 97 },
  28090. * { 'dir': 'right', 'code': 100 }
  28091. * ];
  28092. *
  28093. * _.keyBy(array, function(o) {
  28094. * return String.fromCharCode(o.code);
  28095. * });
  28096. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  28097. *
  28098. * _.keyBy(array, 'dir');
  28099. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  28100. */
  28101. var keyBy = createAggregator(function(result, value, key) {
  28102. baseAssignValue(result, key, value);
  28103. });
  28104. /**
  28105. * Creates an array of values by running each element in `collection` thru
  28106. * `iteratee`. The iteratee is invoked with three arguments:
  28107. * (value, index|key, collection).
  28108. *
  28109. * Many lodash methods are guarded to work as iteratees for methods like
  28110. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  28111. *
  28112. * The guarded methods are:
  28113. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  28114. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  28115. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  28116. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  28117. *
  28118. * @static
  28119. * @memberOf _
  28120. * @since 0.1.0
  28121. * @category Collection
  28122. * @param {Array|Object} collection The collection to iterate over.
  28123. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28124. * @returns {Array} Returns the new mapped array.
  28125. * @example
  28126. *
  28127. * function square(n) {
  28128. * return n * n;
  28129. * }
  28130. *
  28131. * _.map([4, 8], square);
  28132. * // => [16, 64]
  28133. *
  28134. * _.map({ 'a': 4, 'b': 8 }, square);
  28135. * // => [16, 64] (iteration order is not guaranteed)
  28136. *
  28137. * var users = [
  28138. * { 'user': 'barney' },
  28139. * { 'user': 'fred' }
  28140. * ];
  28141. *
  28142. * // The `_.property` iteratee shorthand.
  28143. * _.map(users, 'user');
  28144. * // => ['barney', 'fred']
  28145. */
  28146. function map(collection, iteratee) {
  28147. var func = isArray(collection) ? arrayMap : baseMap;
  28148. return func(collection, getIteratee(iteratee, 3));
  28149. }
  28150. /**
  28151. * This method is like `_.sortBy` except that it allows specifying the sort
  28152. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  28153. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  28154. * descending or "asc" for ascending sort order of corresponding values.
  28155. *
  28156. * @static
  28157. * @memberOf _
  28158. * @since 4.0.0
  28159. * @category Collection
  28160. * @param {Array|Object} collection The collection to iterate over.
  28161. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  28162. * The iteratees to sort by.
  28163. * @param {string[]} [orders] The sort orders of `iteratees`.
  28164. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  28165. * @returns {Array} Returns the new sorted array.
  28166. * @example
  28167. *
  28168. * var users = [
  28169. * { 'user': 'fred', 'age': 48 },
  28170. * { 'user': 'barney', 'age': 34 },
  28171. * { 'user': 'fred', 'age': 40 },
  28172. * { 'user': 'barney', 'age': 36 }
  28173. * ];
  28174. *
  28175. * // Sort by `user` in ascending order and by `age` in descending order.
  28176. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  28177. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  28178. */
  28179. function orderBy(collection, iteratees, orders, guard) {
  28180. if (collection == null) {
  28181. return [];
  28182. }
  28183. if (!isArray(iteratees)) {
  28184. iteratees = iteratees == null ? [] : [iteratees];
  28185. }
  28186. orders = guard ? undefined : orders;
  28187. if (!isArray(orders)) {
  28188. orders = orders == null ? [] : [orders];
  28189. }
  28190. return baseOrderBy(collection, iteratees, orders);
  28191. }
  28192. /**
  28193. * Creates an array of elements split into two groups, the first of which
  28194. * contains elements `predicate` returns truthy for, the second of which
  28195. * contains elements `predicate` returns falsey for. The predicate is
  28196. * invoked with one argument: (value).
  28197. *
  28198. * @static
  28199. * @memberOf _
  28200. * @since 3.0.0
  28201. * @category Collection
  28202. * @param {Array|Object} collection The collection to iterate over.
  28203. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28204. * @returns {Array} Returns the array of grouped elements.
  28205. * @example
  28206. *
  28207. * var users = [
  28208. * { 'user': 'barney', 'age': 36, 'active': false },
  28209. * { 'user': 'fred', 'age': 40, 'active': true },
  28210. * { 'user': 'pebbles', 'age': 1, 'active': false }
  28211. * ];
  28212. *
  28213. * _.partition(users, function(o) { return o.active; });
  28214. * // => objects for [['fred'], ['barney', 'pebbles']]
  28215. *
  28216. * // The `_.matches` iteratee shorthand.
  28217. * _.partition(users, { 'age': 1, 'active': false });
  28218. * // => objects for [['pebbles'], ['barney', 'fred']]
  28219. *
  28220. * // The `_.matchesProperty` iteratee shorthand.
  28221. * _.partition(users, ['active', false]);
  28222. * // => objects for [['barney', 'pebbles'], ['fred']]
  28223. *
  28224. * // The `_.property` iteratee shorthand.
  28225. * _.partition(users, 'active');
  28226. * // => objects for [['fred'], ['barney', 'pebbles']]
  28227. */
  28228. var partition = createAggregator(function(result, value, key) {
  28229. result[key ? 0 : 1].push(value);
  28230. }, function() { return [[], []]; });
  28231. /**
  28232. * Reduces `collection` to a value which is the accumulated result of running
  28233. * each element in `collection` thru `iteratee`, where each successive
  28234. * invocation is supplied the return value of the previous. If `accumulator`
  28235. * is not given, the first element of `collection` is used as the initial
  28236. * value. The iteratee is invoked with four arguments:
  28237. * (accumulator, value, index|key, collection).
  28238. *
  28239. * Many lodash methods are guarded to work as iteratees for methods like
  28240. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  28241. *
  28242. * The guarded methods are:
  28243. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  28244. * and `sortBy`
  28245. *
  28246. * @static
  28247. * @memberOf _
  28248. * @since 0.1.0
  28249. * @category Collection
  28250. * @param {Array|Object} collection The collection to iterate over.
  28251. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28252. * @param {*} [accumulator] The initial value.
  28253. * @returns {*} Returns the accumulated value.
  28254. * @see _.reduceRight
  28255. * @example
  28256. *
  28257. * _.reduce([1, 2], function(sum, n) {
  28258. * return sum + n;
  28259. * }, 0);
  28260. * // => 3
  28261. *
  28262. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  28263. * (result[value] || (result[value] = [])).push(key);
  28264. * return result;
  28265. * }, {});
  28266. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  28267. */
  28268. function reduce(collection, iteratee, accumulator) {
  28269. var func = isArray(collection) ? arrayReduce : baseReduce,
  28270. initAccum = arguments.length < 3;
  28271. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  28272. }
  28273. /**
  28274. * This method is like `_.reduce` except that it iterates over elements of
  28275. * `collection` from right to left.
  28276. *
  28277. * @static
  28278. * @memberOf _
  28279. * @since 0.1.0
  28280. * @category Collection
  28281. * @param {Array|Object} collection The collection to iterate over.
  28282. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28283. * @param {*} [accumulator] The initial value.
  28284. * @returns {*} Returns the accumulated value.
  28285. * @see _.reduce
  28286. * @example
  28287. *
  28288. * var array = [[0, 1], [2, 3], [4, 5]];
  28289. *
  28290. * _.reduceRight(array, function(flattened, other) {
  28291. * return flattened.concat(other);
  28292. * }, []);
  28293. * // => [4, 5, 2, 3, 0, 1]
  28294. */
  28295. function reduceRight(collection, iteratee, accumulator) {
  28296. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  28297. initAccum = arguments.length < 3;
  28298. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  28299. }
  28300. /**
  28301. * The opposite of `_.filter`; this method returns the elements of `collection`
  28302. * that `predicate` does **not** return truthy for.
  28303. *
  28304. * @static
  28305. * @memberOf _
  28306. * @since 0.1.0
  28307. * @category Collection
  28308. * @param {Array|Object} collection The collection to iterate over.
  28309. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28310. * @returns {Array} Returns the new filtered array.
  28311. * @see _.filter
  28312. * @example
  28313. *
  28314. * var users = [
  28315. * { 'user': 'barney', 'age': 36, 'active': false },
  28316. * { 'user': 'fred', 'age': 40, 'active': true }
  28317. * ];
  28318. *
  28319. * _.reject(users, function(o) { return !o.active; });
  28320. * // => objects for ['fred']
  28321. *
  28322. * // The `_.matches` iteratee shorthand.
  28323. * _.reject(users, { 'age': 40, 'active': true });
  28324. * // => objects for ['barney']
  28325. *
  28326. * // The `_.matchesProperty` iteratee shorthand.
  28327. * _.reject(users, ['active', false]);
  28328. * // => objects for ['fred']
  28329. *
  28330. * // The `_.property` iteratee shorthand.
  28331. * _.reject(users, 'active');
  28332. * // => objects for ['barney']
  28333. */
  28334. function reject(collection, predicate) {
  28335. var func = isArray(collection) ? arrayFilter : baseFilter;
  28336. return func(collection, negate(getIteratee(predicate, 3)));
  28337. }
  28338. /**
  28339. * Gets a random element from `collection`.
  28340. *
  28341. * @static
  28342. * @memberOf _
  28343. * @since 2.0.0
  28344. * @category Collection
  28345. * @param {Array|Object} collection The collection to sample.
  28346. * @returns {*} Returns the random element.
  28347. * @example
  28348. *
  28349. * _.sample([1, 2, 3, 4]);
  28350. * // => 2
  28351. */
  28352. function sample(collection) {
  28353. var func = isArray(collection) ? arraySample : baseSample;
  28354. return func(collection);
  28355. }
  28356. /**
  28357. * Gets `n` random elements at unique keys from `collection` up to the
  28358. * size of `collection`.
  28359. *
  28360. * @static
  28361. * @memberOf _
  28362. * @since 4.0.0
  28363. * @category Collection
  28364. * @param {Array|Object} collection The collection to sample.
  28365. * @param {number} [n=1] The number of elements to sample.
  28366. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28367. * @returns {Array} Returns the random elements.
  28368. * @example
  28369. *
  28370. * _.sampleSize([1, 2, 3], 2);
  28371. * // => [3, 1]
  28372. *
  28373. * _.sampleSize([1, 2, 3], 4);
  28374. * // => [2, 3, 1]
  28375. */
  28376. function sampleSize(collection, n, guard) {
  28377. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  28378. n = 1;
  28379. } else {
  28380. n = toInteger(n);
  28381. }
  28382. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  28383. return func(collection, n);
  28384. }
  28385. /**
  28386. * Creates an array of shuffled values, using a version of the
  28387. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  28388. *
  28389. * @static
  28390. * @memberOf _
  28391. * @since 0.1.0
  28392. * @category Collection
  28393. * @param {Array|Object} collection The collection to shuffle.
  28394. * @returns {Array} Returns the new shuffled array.
  28395. * @example
  28396. *
  28397. * _.shuffle([1, 2, 3, 4]);
  28398. * // => [4, 1, 3, 2]
  28399. */
  28400. function shuffle(collection) {
  28401. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  28402. return func(collection);
  28403. }
  28404. /**
  28405. * Gets the size of `collection` by returning its length for array-like
  28406. * values or the number of own enumerable string keyed properties for objects.
  28407. *
  28408. * @static
  28409. * @memberOf _
  28410. * @since 0.1.0
  28411. * @category Collection
  28412. * @param {Array|Object|string} collection The collection to inspect.
  28413. * @returns {number} Returns the collection size.
  28414. * @example
  28415. *
  28416. * _.size([1, 2, 3]);
  28417. * // => 3
  28418. *
  28419. * _.size({ 'a': 1, 'b': 2 });
  28420. * // => 2
  28421. *
  28422. * _.size('pebbles');
  28423. * // => 7
  28424. */
  28425. function size(collection) {
  28426. if (collection == null) {
  28427. return 0;
  28428. }
  28429. if (isArrayLike(collection)) {
  28430. return isString(collection) ? stringSize(collection) : collection.length;
  28431. }
  28432. var tag = getTag(collection);
  28433. if (tag == mapTag || tag == setTag) {
  28434. return collection.size;
  28435. }
  28436. return baseKeys(collection).length;
  28437. }
  28438. /**
  28439. * Checks if `predicate` returns truthy for **any** element of `collection`.
  28440. * Iteration is stopped once `predicate` returns truthy. The predicate is
  28441. * invoked with three arguments: (value, index|key, collection).
  28442. *
  28443. * @static
  28444. * @memberOf _
  28445. * @since 0.1.0
  28446. * @category Collection
  28447. * @param {Array|Object} collection The collection to iterate over.
  28448. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28449. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28450. * @returns {boolean} Returns `true` if any element passes the predicate check,
  28451. * else `false`.
  28452. * @example
  28453. *
  28454. * _.some([null, 0, 'yes', false], Boolean);
  28455. * // => true
  28456. *
  28457. * var users = [
  28458. * { 'user': 'barney', 'active': true },
  28459. * { 'user': 'fred', 'active': false }
  28460. * ];
  28461. *
  28462. * // The `_.matches` iteratee shorthand.
  28463. * _.some(users, { 'user': 'barney', 'active': false });
  28464. * // => false
  28465. *
  28466. * // The `_.matchesProperty` iteratee shorthand.
  28467. * _.some(users, ['active', false]);
  28468. * // => true
  28469. *
  28470. * // The `_.property` iteratee shorthand.
  28471. * _.some(users, 'active');
  28472. * // => true
  28473. */
  28474. function some(collection, predicate, guard) {
  28475. var func = isArray(collection) ? arraySome : baseSome;
  28476. if (guard && isIterateeCall(collection, predicate, guard)) {
  28477. predicate = undefined;
  28478. }
  28479. return func(collection, getIteratee(predicate, 3));
  28480. }
  28481. /**
  28482. * Creates an array of elements, sorted in ascending order by the results of
  28483. * running each element in a collection thru each iteratee. This method
  28484. * performs a stable sort, that is, it preserves the original sort order of
  28485. * equal elements. The iteratees are invoked with one argument: (value).
  28486. *
  28487. * @static
  28488. * @memberOf _
  28489. * @since 0.1.0
  28490. * @category Collection
  28491. * @param {Array|Object} collection The collection to iterate over.
  28492. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  28493. * The iteratees to sort by.
  28494. * @returns {Array} Returns the new sorted array.
  28495. * @example
  28496. *
  28497. * var users = [
  28498. * { 'user': 'fred', 'age': 48 },
  28499. * { 'user': 'barney', 'age': 36 },
  28500. * { 'user': 'fred', 'age': 40 },
  28501. * { 'user': 'barney', 'age': 34 }
  28502. * ];
  28503. *
  28504. * _.sortBy(users, [function(o) { return o.user; }]);
  28505. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  28506. *
  28507. * _.sortBy(users, ['user', 'age']);
  28508. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  28509. */
  28510. var sortBy = baseRest(function(collection, iteratees) {
  28511. if (collection == null) {
  28512. return [];
  28513. }
  28514. var length = iteratees.length;
  28515. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  28516. iteratees = [];
  28517. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  28518. iteratees = [iteratees[0]];
  28519. }
  28520. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  28521. });
  28522. /*------------------------------------------------------------------------*/
  28523. /**
  28524. * Gets the timestamp of the number of milliseconds that have elapsed since
  28525. * the Unix epoch (1 January 1970 00:00:00 UTC).
  28526. *
  28527. * @static
  28528. * @memberOf _
  28529. * @since 2.4.0
  28530. * @category Date
  28531. * @returns {number} Returns the timestamp.
  28532. * @example
  28533. *
  28534. * _.defer(function(stamp) {
  28535. * console.log(_.now() - stamp);
  28536. * }, _.now());
  28537. * // => Logs the number of milliseconds it took for the deferred invocation.
  28538. */
  28539. var now = ctxNow || function() {
  28540. return root.Date.now();
  28541. };
  28542. /*------------------------------------------------------------------------*/
  28543. /**
  28544. * The opposite of `_.before`; this method creates a function that invokes
  28545. * `func` once it's called `n` or more times.
  28546. *
  28547. * @static
  28548. * @memberOf _
  28549. * @since 0.1.0
  28550. * @category Function
  28551. * @param {number} n The number of calls before `func` is invoked.
  28552. * @param {Function} func The function to restrict.
  28553. * @returns {Function} Returns the new restricted function.
  28554. * @example
  28555. *
  28556. * var saves = ['profile', 'settings'];
  28557. *
  28558. * var done = _.after(saves.length, function() {
  28559. * console.log('done saving!');
  28560. * });
  28561. *
  28562. * _.forEach(saves, function(type) {
  28563. * asyncSave({ 'type': type, 'complete': done });
  28564. * });
  28565. * // => Logs 'done saving!' after the two async saves have completed.
  28566. */
  28567. function after(n, func) {
  28568. if (typeof func != 'function') {
  28569. throw new TypeError(FUNC_ERROR_TEXT);
  28570. }
  28571. n = toInteger(n);
  28572. return function() {
  28573. if (--n < 1) {
  28574. return func.apply(this, arguments);
  28575. }
  28576. };
  28577. }
  28578. /**
  28579. * Creates a function that invokes `func`, with up to `n` arguments,
  28580. * ignoring any additional arguments.
  28581. *
  28582. * @static
  28583. * @memberOf _
  28584. * @since 3.0.0
  28585. * @category Function
  28586. * @param {Function} func The function to cap arguments for.
  28587. * @param {number} [n=func.length] The arity cap.
  28588. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28589. * @returns {Function} Returns the new capped function.
  28590. * @example
  28591. *
  28592. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  28593. * // => [6, 8, 10]
  28594. */
  28595. function ary(func, n, guard) {
  28596. n = guard ? undefined : n;
  28597. n = (func && n == null) ? func.length : n;
  28598. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  28599. }
  28600. /**
  28601. * Creates a function that invokes `func`, with the `this` binding and arguments
  28602. * of the created function, while it's called less than `n` times. Subsequent
  28603. * calls to the created function return the result of the last `func` invocation.
  28604. *
  28605. * @static
  28606. * @memberOf _
  28607. * @since 3.0.0
  28608. * @category Function
  28609. * @param {number} n The number of calls at which `func` is no longer invoked.
  28610. * @param {Function} func The function to restrict.
  28611. * @returns {Function} Returns the new restricted function.
  28612. * @example
  28613. *
  28614. * jQuery(element).on('click', _.before(5, addContactToList));
  28615. * // => Allows adding up to 4 contacts to the list.
  28616. */
  28617. function before(n, func) {
  28618. var result;
  28619. if (typeof func != 'function') {
  28620. throw new TypeError(FUNC_ERROR_TEXT);
  28621. }
  28622. n = toInteger(n);
  28623. return function() {
  28624. if (--n > 0) {
  28625. result = func.apply(this, arguments);
  28626. }
  28627. if (n <= 1) {
  28628. func = undefined;
  28629. }
  28630. return result;
  28631. };
  28632. }
  28633. /**
  28634. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  28635. * and `partials` prepended to the arguments it receives.
  28636. *
  28637. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  28638. * may be used as a placeholder for partially applied arguments.
  28639. *
  28640. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  28641. * property of bound functions.
  28642. *
  28643. * @static
  28644. * @memberOf _
  28645. * @since 0.1.0
  28646. * @category Function
  28647. * @param {Function} func The function to bind.
  28648. * @param {*} thisArg The `this` binding of `func`.
  28649. * @param {...*} [partials] The arguments to be partially applied.
  28650. * @returns {Function} Returns the new bound function.
  28651. * @example
  28652. *
  28653. * function greet(greeting, punctuation) {
  28654. * return greeting + ' ' + this.user + punctuation;
  28655. * }
  28656. *
  28657. * var object = { 'user': 'fred' };
  28658. *
  28659. * var bound = _.bind(greet, object, 'hi');
  28660. * bound('!');
  28661. * // => 'hi fred!'
  28662. *
  28663. * // Bound with placeholders.
  28664. * var bound = _.bind(greet, object, _, '!');
  28665. * bound('hi');
  28666. * // => 'hi fred!'
  28667. */
  28668. var bind = baseRest(function(func, thisArg, partials) {
  28669. var bitmask = WRAP_BIND_FLAG;
  28670. if (partials.length) {
  28671. var holders = replaceHolders(partials, getHolder(bind));
  28672. bitmask |= WRAP_PARTIAL_FLAG;
  28673. }
  28674. return createWrap(func, bitmask, thisArg, partials, holders);
  28675. });
  28676. /**
  28677. * Creates a function that invokes the method at `object[key]` with `partials`
  28678. * prepended to the arguments it receives.
  28679. *
  28680. * This method differs from `_.bind` by allowing bound functions to reference
  28681. * methods that may be redefined or don't yet exist. See
  28682. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  28683. * for more details.
  28684. *
  28685. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  28686. * builds, may be used as a placeholder for partially applied arguments.
  28687. *
  28688. * @static
  28689. * @memberOf _
  28690. * @since 0.10.0
  28691. * @category Function
  28692. * @param {Object} object The object to invoke the method on.
  28693. * @param {string} key The key of the method.
  28694. * @param {...*} [partials] The arguments to be partially applied.
  28695. * @returns {Function} Returns the new bound function.
  28696. * @example
  28697. *
  28698. * var object = {
  28699. * 'user': 'fred',
  28700. * 'greet': function(greeting, punctuation) {
  28701. * return greeting + ' ' + this.user + punctuation;
  28702. * }
  28703. * };
  28704. *
  28705. * var bound = _.bindKey(object, 'greet', 'hi');
  28706. * bound('!');
  28707. * // => 'hi fred!'
  28708. *
  28709. * object.greet = function(greeting, punctuation) {
  28710. * return greeting + 'ya ' + this.user + punctuation;
  28711. * };
  28712. *
  28713. * bound('!');
  28714. * // => 'hiya fred!'
  28715. *
  28716. * // Bound with placeholders.
  28717. * var bound = _.bindKey(object, 'greet', _, '!');
  28718. * bound('hi');
  28719. * // => 'hiya fred!'
  28720. */
  28721. var bindKey = baseRest(function(object, key, partials) {
  28722. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  28723. if (partials.length) {
  28724. var holders = replaceHolders(partials, getHolder(bindKey));
  28725. bitmask |= WRAP_PARTIAL_FLAG;
  28726. }
  28727. return createWrap(key, bitmask, object, partials, holders);
  28728. });
  28729. /**
  28730. * Creates a function that accepts arguments of `func` and either invokes
  28731. * `func` returning its result, if at least `arity` number of arguments have
  28732. * been provided, or returns a function that accepts the remaining `func`
  28733. * arguments, and so on. The arity of `func` may be specified if `func.length`
  28734. * is not sufficient.
  28735. *
  28736. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  28737. * may be used as a placeholder for provided arguments.
  28738. *
  28739. * **Note:** This method doesn't set the "length" property of curried functions.
  28740. *
  28741. * @static
  28742. * @memberOf _
  28743. * @since 2.0.0
  28744. * @category Function
  28745. * @param {Function} func The function to curry.
  28746. * @param {number} [arity=func.length] The arity of `func`.
  28747. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28748. * @returns {Function} Returns the new curried function.
  28749. * @example
  28750. *
  28751. * var abc = function(a, b, c) {
  28752. * return [a, b, c];
  28753. * };
  28754. *
  28755. * var curried = _.curry(abc);
  28756. *
  28757. * curried(1)(2)(3);
  28758. * // => [1, 2, 3]
  28759. *
  28760. * curried(1, 2)(3);
  28761. * // => [1, 2, 3]
  28762. *
  28763. * curried(1, 2, 3);
  28764. * // => [1, 2, 3]
  28765. *
  28766. * // Curried with placeholders.
  28767. * curried(1)(_, 3)(2);
  28768. * // => [1, 2, 3]
  28769. */
  28770. function curry(func, arity, guard) {
  28771. arity = guard ? undefined : arity;
  28772. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28773. result.placeholder = curry.placeholder;
  28774. return result;
  28775. }
  28776. /**
  28777. * This method is like `_.curry` except that arguments are applied to `func`
  28778. * in the manner of `_.partialRight` instead of `_.partial`.
  28779. *
  28780. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  28781. * builds, may be used as a placeholder for provided arguments.
  28782. *
  28783. * **Note:** This method doesn't set the "length" property of curried functions.
  28784. *
  28785. * @static
  28786. * @memberOf _
  28787. * @since 3.0.0
  28788. * @category Function
  28789. * @param {Function} func The function to curry.
  28790. * @param {number} [arity=func.length] The arity of `func`.
  28791. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28792. * @returns {Function} Returns the new curried function.
  28793. * @example
  28794. *
  28795. * var abc = function(a, b, c) {
  28796. * return [a, b, c];
  28797. * };
  28798. *
  28799. * var curried = _.curryRight(abc);
  28800. *
  28801. * curried(3)(2)(1);
  28802. * // => [1, 2, 3]
  28803. *
  28804. * curried(2, 3)(1);
  28805. * // => [1, 2, 3]
  28806. *
  28807. * curried(1, 2, 3);
  28808. * // => [1, 2, 3]
  28809. *
  28810. * // Curried with placeholders.
  28811. * curried(3)(1, _)(2);
  28812. * // => [1, 2, 3]
  28813. */
  28814. function curryRight(func, arity, guard) {
  28815. arity = guard ? undefined : arity;
  28816. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28817. result.placeholder = curryRight.placeholder;
  28818. return result;
  28819. }
  28820. /**
  28821. * Creates a debounced function that delays invoking `func` until after `wait`
  28822. * milliseconds have elapsed since the last time the debounced function was
  28823. * invoked. The debounced function comes with a `cancel` method to cancel
  28824. * delayed `func` invocations and a `flush` method to immediately invoke them.
  28825. * Provide `options` to indicate whether `func` should be invoked on the
  28826. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  28827. * with the last arguments provided to the debounced function. Subsequent
  28828. * calls to the debounced function return the result of the last `func`
  28829. * invocation.
  28830. *
  28831. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28832. * invoked on the trailing edge of the timeout only if the debounced function
  28833. * is invoked more than once during the `wait` timeout.
  28834. *
  28835. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28836. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28837. *
  28838. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28839. * for details over the differences between `_.debounce` and `_.throttle`.
  28840. *
  28841. * @static
  28842. * @memberOf _
  28843. * @since 0.1.0
  28844. * @category Function
  28845. * @param {Function} func The function to debounce.
  28846. * @param {number} [wait=0] The number of milliseconds to delay.
  28847. * @param {Object} [options={}] The options object.
  28848. * @param {boolean} [options.leading=false]
  28849. * Specify invoking on the leading edge of the timeout.
  28850. * @param {number} [options.maxWait]
  28851. * The maximum time `func` is allowed to be delayed before it's invoked.
  28852. * @param {boolean} [options.trailing=true]
  28853. * Specify invoking on the trailing edge of the timeout.
  28854. * @returns {Function} Returns the new debounced function.
  28855. * @example
  28856. *
  28857. * // Avoid costly calculations while the window size is in flux.
  28858. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  28859. *
  28860. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  28861. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  28862. * 'leading': true,
  28863. * 'trailing': false
  28864. * }));
  28865. *
  28866. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  28867. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  28868. * var source = new EventSource('/stream');
  28869. * jQuery(source).on('message', debounced);
  28870. *
  28871. * // Cancel the trailing debounced invocation.
  28872. * jQuery(window).on('popstate', debounced.cancel);
  28873. */
  28874. function debounce(func, wait, options) {
  28875. var lastArgs,
  28876. lastThis,
  28877. maxWait,
  28878. result,
  28879. timerId,
  28880. lastCallTime,
  28881. lastInvokeTime = 0,
  28882. leading = false,
  28883. maxing = false,
  28884. trailing = true;
  28885. if (typeof func != 'function') {
  28886. throw new TypeError(FUNC_ERROR_TEXT);
  28887. }
  28888. wait = toNumber(wait) || 0;
  28889. if (isObject(options)) {
  28890. leading = !!options.leading;
  28891. maxing = 'maxWait' in options;
  28892. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  28893. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28894. }
  28895. function invokeFunc(time) {
  28896. var args = lastArgs,
  28897. thisArg = lastThis;
  28898. lastArgs = lastThis = undefined;
  28899. lastInvokeTime = time;
  28900. result = func.apply(thisArg, args);
  28901. return result;
  28902. }
  28903. function leadingEdge(time) {
  28904. // Reset any `maxWait` timer.
  28905. lastInvokeTime = time;
  28906. // Start the timer for the trailing edge.
  28907. timerId = setTimeout(timerExpired, wait);
  28908. // Invoke the leading edge.
  28909. return leading ? invokeFunc(time) : result;
  28910. }
  28911. function remainingWait(time) {
  28912. var timeSinceLastCall = time - lastCallTime,
  28913. timeSinceLastInvoke = time - lastInvokeTime,
  28914. timeWaiting = wait - timeSinceLastCall;
  28915. return maxing
  28916. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  28917. : timeWaiting;
  28918. }
  28919. function shouldInvoke(time) {
  28920. var timeSinceLastCall = time - lastCallTime,
  28921. timeSinceLastInvoke = time - lastInvokeTime;
  28922. // Either this is the first call, activity has stopped and we're at the
  28923. // trailing edge, the system time has gone backwards and we're treating
  28924. // it as the trailing edge, or we've hit the `maxWait` limit.
  28925. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28926. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28927. }
  28928. function timerExpired() {
  28929. var time = now();
  28930. if (shouldInvoke(time)) {
  28931. return trailingEdge(time);
  28932. }
  28933. // Restart the timer.
  28934. timerId = setTimeout(timerExpired, remainingWait(time));
  28935. }
  28936. function trailingEdge(time) {
  28937. timerId = undefined;
  28938. // Only invoke if we have `lastArgs` which means `func` has been
  28939. // debounced at least once.
  28940. if (trailing && lastArgs) {
  28941. return invokeFunc(time);
  28942. }
  28943. lastArgs = lastThis = undefined;
  28944. return result;
  28945. }
  28946. function cancel() {
  28947. if (timerId !== undefined) {
  28948. clearTimeout(timerId);
  28949. }
  28950. lastInvokeTime = 0;
  28951. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28952. }
  28953. function flush() {
  28954. return timerId === undefined ? result : trailingEdge(now());
  28955. }
  28956. function debounced() {
  28957. var time = now(),
  28958. isInvoking = shouldInvoke(time);
  28959. lastArgs = arguments;
  28960. lastThis = this;
  28961. lastCallTime = time;
  28962. if (isInvoking) {
  28963. if (timerId === undefined) {
  28964. return leadingEdge(lastCallTime);
  28965. }
  28966. if (maxing) {
  28967. // Handle invocations in a tight loop.
  28968. clearTimeout(timerId);
  28969. timerId = setTimeout(timerExpired, wait);
  28970. return invokeFunc(lastCallTime);
  28971. }
  28972. }
  28973. if (timerId === undefined) {
  28974. timerId = setTimeout(timerExpired, wait);
  28975. }
  28976. return result;
  28977. }
  28978. debounced.cancel = cancel;
  28979. debounced.flush = flush;
  28980. return debounced;
  28981. }
  28982. /**
  28983. * Defers invoking the `func` until the current call stack has cleared. Any
  28984. * additional arguments are provided to `func` when it's invoked.
  28985. *
  28986. * @static
  28987. * @memberOf _
  28988. * @since 0.1.0
  28989. * @category Function
  28990. * @param {Function} func The function to defer.
  28991. * @param {...*} [args] The arguments to invoke `func` with.
  28992. * @returns {number} Returns the timer id.
  28993. * @example
  28994. *
  28995. * _.defer(function(text) {
  28996. * console.log(text);
  28997. * }, 'deferred');
  28998. * // => Logs 'deferred' after one millisecond.
  28999. */
  29000. var defer = baseRest(function(func, args) {
  29001. return baseDelay(func, 1, args);
  29002. });
  29003. /**
  29004. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  29005. * provided to `func` when it's invoked.
  29006. *
  29007. * @static
  29008. * @memberOf _
  29009. * @since 0.1.0
  29010. * @category Function
  29011. * @param {Function} func The function to delay.
  29012. * @param {number} wait The number of milliseconds to delay invocation.
  29013. * @param {...*} [args] The arguments to invoke `func` with.
  29014. * @returns {number} Returns the timer id.
  29015. * @example
  29016. *
  29017. * _.delay(function(text) {
  29018. * console.log(text);
  29019. * }, 1000, 'later');
  29020. * // => Logs 'later' after one second.
  29021. */
  29022. var delay = baseRest(function(func, wait, args) {
  29023. return baseDelay(func, toNumber(wait) || 0, args);
  29024. });
  29025. /**
  29026. * Creates a function that invokes `func` with arguments reversed.
  29027. *
  29028. * @static
  29029. * @memberOf _
  29030. * @since 4.0.0
  29031. * @category Function
  29032. * @param {Function} func The function to flip arguments for.
  29033. * @returns {Function} Returns the new flipped function.
  29034. * @example
  29035. *
  29036. * var flipped = _.flip(function() {
  29037. * return _.toArray(arguments);
  29038. * });
  29039. *
  29040. * flipped('a', 'b', 'c', 'd');
  29041. * // => ['d', 'c', 'b', 'a']
  29042. */
  29043. function flip(func) {
  29044. return createWrap(func, WRAP_FLIP_FLAG);
  29045. }
  29046. /**
  29047. * Creates a function that memoizes the result of `func`. If `resolver` is
  29048. * provided, it determines the cache key for storing the result based on the
  29049. * arguments provided to the memoized function. By default, the first argument
  29050. * provided to the memoized function is used as the map cache key. The `func`
  29051. * is invoked with the `this` binding of the memoized function.
  29052. *
  29053. * **Note:** The cache is exposed as the `cache` property on the memoized
  29054. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  29055. * constructor with one whose instances implement the
  29056. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  29057. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  29058. *
  29059. * @static
  29060. * @memberOf _
  29061. * @since 0.1.0
  29062. * @category Function
  29063. * @param {Function} func The function to have its output memoized.
  29064. * @param {Function} [resolver] The function to resolve the cache key.
  29065. * @returns {Function} Returns the new memoized function.
  29066. * @example
  29067. *
  29068. * var object = { 'a': 1, 'b': 2 };
  29069. * var other = { 'c': 3, 'd': 4 };
  29070. *
  29071. * var values = _.memoize(_.values);
  29072. * values(object);
  29073. * // => [1, 2]
  29074. *
  29075. * values(other);
  29076. * // => [3, 4]
  29077. *
  29078. * object.a = 2;
  29079. * values(object);
  29080. * // => [1, 2]
  29081. *
  29082. * // Modify the result cache.
  29083. * values.cache.set(object, ['a', 'b']);
  29084. * values(object);
  29085. * // => ['a', 'b']
  29086. *
  29087. * // Replace `_.memoize.Cache`.
  29088. * _.memoize.Cache = WeakMap;
  29089. */
  29090. function memoize(func, resolver) {
  29091. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  29092. throw new TypeError(FUNC_ERROR_TEXT);
  29093. }
  29094. var memoized = function() {
  29095. var args = arguments,
  29096. key = resolver ? resolver.apply(this, args) : args[0],
  29097. cache = memoized.cache;
  29098. if (cache.has(key)) {
  29099. return cache.get(key);
  29100. }
  29101. var result = func.apply(this, args);
  29102. memoized.cache = cache.set(key, result) || cache;
  29103. return result;
  29104. };
  29105. memoized.cache = new (memoize.Cache || MapCache);
  29106. return memoized;
  29107. }
  29108. // Expose `MapCache`.
  29109. memoize.Cache = MapCache;
  29110. /**
  29111. * Creates a function that negates the result of the predicate `func`. The
  29112. * `func` predicate is invoked with the `this` binding and arguments of the
  29113. * created function.
  29114. *
  29115. * @static
  29116. * @memberOf _
  29117. * @since 3.0.0
  29118. * @category Function
  29119. * @param {Function} predicate The predicate to negate.
  29120. * @returns {Function} Returns the new negated function.
  29121. * @example
  29122. *
  29123. * function isEven(n) {
  29124. * return n % 2 == 0;
  29125. * }
  29126. *
  29127. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  29128. * // => [1, 3, 5]
  29129. */
  29130. function negate(predicate) {
  29131. if (typeof predicate != 'function') {
  29132. throw new TypeError(FUNC_ERROR_TEXT);
  29133. }
  29134. return function() {
  29135. var args = arguments;
  29136. switch (args.length) {
  29137. case 0: return !predicate.call(this);
  29138. case 1: return !predicate.call(this, args[0]);
  29139. case 2: return !predicate.call(this, args[0], args[1]);
  29140. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  29141. }
  29142. return !predicate.apply(this, args);
  29143. };
  29144. }
  29145. /**
  29146. * Creates a function that is restricted to invoking `func` once. Repeat calls
  29147. * to the function return the value of the first invocation. The `func` is
  29148. * invoked with the `this` binding and arguments of the created function.
  29149. *
  29150. * @static
  29151. * @memberOf _
  29152. * @since 0.1.0
  29153. * @category Function
  29154. * @param {Function} func The function to restrict.
  29155. * @returns {Function} Returns the new restricted function.
  29156. * @example
  29157. *
  29158. * var initialize = _.once(createApplication);
  29159. * initialize();
  29160. * initialize();
  29161. * // => `createApplication` is invoked once
  29162. */
  29163. function once(func) {
  29164. return before(2, func);
  29165. }
  29166. /**
  29167. * Creates a function that invokes `func` with its arguments transformed.
  29168. *
  29169. * @static
  29170. * @since 4.0.0
  29171. * @memberOf _
  29172. * @category Function
  29173. * @param {Function} func The function to wrap.
  29174. * @param {...(Function|Function[])} [transforms=[_.identity]]
  29175. * The argument transforms.
  29176. * @returns {Function} Returns the new function.
  29177. * @example
  29178. *
  29179. * function doubled(n) {
  29180. * return n * 2;
  29181. * }
  29182. *
  29183. * function square(n) {
  29184. * return n * n;
  29185. * }
  29186. *
  29187. * var func = _.overArgs(function(x, y) {
  29188. * return [x, y];
  29189. * }, [square, doubled]);
  29190. *
  29191. * func(9, 3);
  29192. * // => [81, 6]
  29193. *
  29194. * func(10, 5);
  29195. * // => [100, 10]
  29196. */
  29197. var overArgs = castRest(function(func, transforms) {
  29198. transforms = (transforms.length == 1 && isArray(transforms[0]))
  29199. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  29200. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  29201. var funcsLength = transforms.length;
  29202. return baseRest(function(args) {
  29203. var index = -1,
  29204. length = nativeMin(args.length, funcsLength);
  29205. while (++index < length) {
  29206. args[index] = transforms[index].call(this, args[index]);
  29207. }
  29208. return apply(func, this, args);
  29209. });
  29210. });
  29211. /**
  29212. * Creates a function that invokes `func` with `partials` prepended to the
  29213. * arguments it receives. This method is like `_.bind` except it does **not**
  29214. * alter the `this` binding.
  29215. *
  29216. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  29217. * builds, may be used as a placeholder for partially applied arguments.
  29218. *
  29219. * **Note:** This method doesn't set the "length" property of partially
  29220. * applied functions.
  29221. *
  29222. * @static
  29223. * @memberOf _
  29224. * @since 0.2.0
  29225. * @category Function
  29226. * @param {Function} func The function to partially apply arguments to.
  29227. * @param {...*} [partials] The arguments to be partially applied.
  29228. * @returns {Function} Returns the new partially applied function.
  29229. * @example
  29230. *
  29231. * function greet(greeting, name) {
  29232. * return greeting + ' ' + name;
  29233. * }
  29234. *
  29235. * var sayHelloTo = _.partial(greet, 'hello');
  29236. * sayHelloTo('fred');
  29237. * // => 'hello fred'
  29238. *
  29239. * // Partially applied with placeholders.
  29240. * var greetFred = _.partial(greet, _, 'fred');
  29241. * greetFred('hi');
  29242. * // => 'hi fred'
  29243. */
  29244. var partial = baseRest(function(func, partials) {
  29245. var holders = replaceHolders(partials, getHolder(partial));
  29246. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  29247. });
  29248. /**
  29249. * This method is like `_.partial` except that partially applied arguments
  29250. * are appended to the arguments it receives.
  29251. *
  29252. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  29253. * builds, may be used as a placeholder for partially applied arguments.
  29254. *
  29255. * **Note:** This method doesn't set the "length" property of partially
  29256. * applied functions.
  29257. *
  29258. * @static
  29259. * @memberOf _
  29260. * @since 1.0.0
  29261. * @category Function
  29262. * @param {Function} func The function to partially apply arguments to.
  29263. * @param {...*} [partials] The arguments to be partially applied.
  29264. * @returns {Function} Returns the new partially applied function.
  29265. * @example
  29266. *
  29267. * function greet(greeting, name) {
  29268. * return greeting + ' ' + name;
  29269. * }
  29270. *
  29271. * var greetFred = _.partialRight(greet, 'fred');
  29272. * greetFred('hi');
  29273. * // => 'hi fred'
  29274. *
  29275. * // Partially applied with placeholders.
  29276. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  29277. * sayHelloTo('fred');
  29278. * // => 'hello fred'
  29279. */
  29280. var partialRight = baseRest(function(func, partials) {
  29281. var holders = replaceHolders(partials, getHolder(partialRight));
  29282. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  29283. });
  29284. /**
  29285. * Creates a function that invokes `func` with arguments arranged according
  29286. * to the specified `indexes` where the argument value at the first index is
  29287. * provided as the first argument, the argument value at the second index is
  29288. * provided as the second argument, and so on.
  29289. *
  29290. * @static
  29291. * @memberOf _
  29292. * @since 3.0.0
  29293. * @category Function
  29294. * @param {Function} func The function to rearrange arguments for.
  29295. * @param {...(number|number[])} indexes The arranged argument indexes.
  29296. * @returns {Function} Returns the new function.
  29297. * @example
  29298. *
  29299. * var rearged = _.rearg(function(a, b, c) {
  29300. * return [a, b, c];
  29301. * }, [2, 0, 1]);
  29302. *
  29303. * rearged('b', 'c', 'a')
  29304. * // => ['a', 'b', 'c']
  29305. */
  29306. var rearg = flatRest(function(func, indexes) {
  29307. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  29308. });
  29309. /**
  29310. * Creates a function that invokes `func` with the `this` binding of the
  29311. * created function and arguments from `start` and beyond provided as
  29312. * an array.
  29313. *
  29314. * **Note:** This method is based on the
  29315. * [rest parameter](https://mdn.io/rest_parameters).
  29316. *
  29317. * @static
  29318. * @memberOf _
  29319. * @since 4.0.0
  29320. * @category Function
  29321. * @param {Function} func The function to apply a rest parameter to.
  29322. * @param {number} [start=func.length-1] The start position of the rest parameter.
  29323. * @returns {Function} Returns the new function.
  29324. * @example
  29325. *
  29326. * var say = _.rest(function(what, names) {
  29327. * return what + ' ' + _.initial(names).join(', ') +
  29328. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  29329. * });
  29330. *
  29331. * say('hello', 'fred', 'barney', 'pebbles');
  29332. * // => 'hello fred, barney, & pebbles'
  29333. */
  29334. function rest(func, start) {
  29335. if (typeof func != 'function') {
  29336. throw new TypeError(FUNC_ERROR_TEXT);
  29337. }
  29338. start = start === undefined ? start : toInteger(start);
  29339. return baseRest(func, start);
  29340. }
  29341. /**
  29342. * Creates a function that invokes `func` with the `this` binding of the
  29343. * create function and an array of arguments much like
  29344. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  29345. *
  29346. * **Note:** This method is based on the
  29347. * [spread operator](https://mdn.io/spread_operator).
  29348. *
  29349. * @static
  29350. * @memberOf _
  29351. * @since 3.2.0
  29352. * @category Function
  29353. * @param {Function} func The function to spread arguments over.
  29354. * @param {number} [start=0] The start position of the spread.
  29355. * @returns {Function} Returns the new function.
  29356. * @example
  29357. *
  29358. * var say = _.spread(function(who, what) {
  29359. * return who + ' says ' + what;
  29360. * });
  29361. *
  29362. * say(['fred', 'hello']);
  29363. * // => 'fred says hello'
  29364. *
  29365. * var numbers = Promise.all([
  29366. * Promise.resolve(40),
  29367. * Promise.resolve(36)
  29368. * ]);
  29369. *
  29370. * numbers.then(_.spread(function(x, y) {
  29371. * return x + y;
  29372. * }));
  29373. * // => a Promise of 76
  29374. */
  29375. function spread(func, start) {
  29376. if (typeof func != 'function') {
  29377. throw new TypeError(FUNC_ERROR_TEXT);
  29378. }
  29379. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  29380. return baseRest(function(args) {
  29381. var array = args[start],
  29382. otherArgs = castSlice(args, 0, start);
  29383. if (array) {
  29384. arrayPush(otherArgs, array);
  29385. }
  29386. return apply(func, this, otherArgs);
  29387. });
  29388. }
  29389. /**
  29390. * Creates a throttled function that only invokes `func` at most once per
  29391. * every `wait` milliseconds. The throttled function comes with a `cancel`
  29392. * method to cancel delayed `func` invocations and a `flush` method to
  29393. * immediately invoke them. Provide `options` to indicate whether `func`
  29394. * should be invoked on the leading and/or trailing edge of the `wait`
  29395. * timeout. The `func` is invoked with the last arguments provided to the
  29396. * throttled function. Subsequent calls to the throttled function return the
  29397. * result of the last `func` invocation.
  29398. *
  29399. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  29400. * invoked on the trailing edge of the timeout only if the throttled function
  29401. * is invoked more than once during the `wait` timeout.
  29402. *
  29403. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  29404. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  29405. *
  29406. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  29407. * for details over the differences between `_.throttle` and `_.debounce`.
  29408. *
  29409. * @static
  29410. * @memberOf _
  29411. * @since 0.1.0
  29412. * @category Function
  29413. * @param {Function} func The function to throttle.
  29414. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  29415. * @param {Object} [options={}] The options object.
  29416. * @param {boolean} [options.leading=true]
  29417. * Specify invoking on the leading edge of the timeout.
  29418. * @param {boolean} [options.trailing=true]
  29419. * Specify invoking on the trailing edge of the timeout.
  29420. * @returns {Function} Returns the new throttled function.
  29421. * @example
  29422. *
  29423. * // Avoid excessively updating the position while scrolling.
  29424. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  29425. *
  29426. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  29427. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  29428. * jQuery(element).on('click', throttled);
  29429. *
  29430. * // Cancel the trailing throttled invocation.
  29431. * jQuery(window).on('popstate', throttled.cancel);
  29432. */
  29433. function throttle(func, wait, options) {
  29434. var leading = true,
  29435. trailing = true;
  29436. if (typeof func != 'function') {
  29437. throw new TypeError(FUNC_ERROR_TEXT);
  29438. }
  29439. if (isObject(options)) {
  29440. leading = 'leading' in options ? !!options.leading : leading;
  29441. trailing = 'trailing' in options ? !!options.trailing : trailing;
  29442. }
  29443. return debounce(func, wait, {
  29444. 'leading': leading,
  29445. 'maxWait': wait,
  29446. 'trailing': trailing
  29447. });
  29448. }
  29449. /**
  29450. * Creates a function that accepts up to one argument, ignoring any
  29451. * additional arguments.
  29452. *
  29453. * @static
  29454. * @memberOf _
  29455. * @since 4.0.0
  29456. * @category Function
  29457. * @param {Function} func The function to cap arguments for.
  29458. * @returns {Function} Returns the new capped function.
  29459. * @example
  29460. *
  29461. * _.map(['6', '8', '10'], _.unary(parseInt));
  29462. * // => [6, 8, 10]
  29463. */
  29464. function unary(func) {
  29465. return ary(func, 1);
  29466. }
  29467. /**
  29468. * Creates a function that provides `value` to `wrapper` as its first
  29469. * argument. Any additional arguments provided to the function are appended
  29470. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  29471. * binding of the created function.
  29472. *
  29473. * @static
  29474. * @memberOf _
  29475. * @since 0.1.0
  29476. * @category Function
  29477. * @param {*} value The value to wrap.
  29478. * @param {Function} [wrapper=identity] The wrapper function.
  29479. * @returns {Function} Returns the new function.
  29480. * @example
  29481. *
  29482. * var p = _.wrap(_.escape, function(func, text) {
  29483. * return '<p>' + func(text) + '</p>';
  29484. * });
  29485. *
  29486. * p('fred, barney, & pebbles');
  29487. * // => '<p>fred, barney, &amp; pebbles</p>'
  29488. */
  29489. function wrap(value, wrapper) {
  29490. return partial(castFunction(wrapper), value);
  29491. }
  29492. /*------------------------------------------------------------------------*/
  29493. /**
  29494. * Casts `value` as an array if it's not one.
  29495. *
  29496. * @static
  29497. * @memberOf _
  29498. * @since 4.4.0
  29499. * @category Lang
  29500. * @param {*} value The value to inspect.
  29501. * @returns {Array} Returns the cast array.
  29502. * @example
  29503. *
  29504. * _.castArray(1);
  29505. * // => [1]
  29506. *
  29507. * _.castArray({ 'a': 1 });
  29508. * // => [{ 'a': 1 }]
  29509. *
  29510. * _.castArray('abc');
  29511. * // => ['abc']
  29512. *
  29513. * _.castArray(null);
  29514. * // => [null]
  29515. *
  29516. * _.castArray(undefined);
  29517. * // => [undefined]
  29518. *
  29519. * _.castArray();
  29520. * // => []
  29521. *
  29522. * var array = [1, 2, 3];
  29523. * console.log(_.castArray(array) === array);
  29524. * // => true
  29525. */
  29526. function castArray() {
  29527. if (!arguments.length) {
  29528. return [];
  29529. }
  29530. var value = arguments[0];
  29531. return isArray(value) ? value : [value];
  29532. }
  29533. /**
  29534. * Creates a shallow clone of `value`.
  29535. *
  29536. * **Note:** This method is loosely based on the
  29537. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  29538. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  29539. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  29540. * arrays. The own enumerable properties of `arguments` objects are cloned
  29541. * as plain objects. An empty object is returned for uncloneable values such
  29542. * as error objects, functions, DOM nodes, and WeakMaps.
  29543. *
  29544. * @static
  29545. * @memberOf _
  29546. * @since 0.1.0
  29547. * @category Lang
  29548. * @param {*} value The value to clone.
  29549. * @returns {*} Returns the cloned value.
  29550. * @see _.cloneDeep
  29551. * @example
  29552. *
  29553. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29554. *
  29555. * var shallow = _.clone(objects);
  29556. * console.log(shallow[0] === objects[0]);
  29557. * // => true
  29558. */
  29559. function clone(value) {
  29560. return baseClone(value, CLONE_SYMBOLS_FLAG);
  29561. }
  29562. /**
  29563. * This method is like `_.clone` except that it accepts `customizer` which
  29564. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  29565. * cloning is handled by the method instead. The `customizer` is invoked with
  29566. * up to four arguments; (value [, index|key, object, stack]).
  29567. *
  29568. * @static
  29569. * @memberOf _
  29570. * @since 4.0.0
  29571. * @category Lang
  29572. * @param {*} value The value to clone.
  29573. * @param {Function} [customizer] The function to customize cloning.
  29574. * @returns {*} Returns the cloned value.
  29575. * @see _.cloneDeepWith
  29576. * @example
  29577. *
  29578. * function customizer(value) {
  29579. * if (_.isElement(value)) {
  29580. * return value.cloneNode(false);
  29581. * }
  29582. * }
  29583. *
  29584. * var el = _.cloneWith(document.body, customizer);
  29585. *
  29586. * console.log(el === document.body);
  29587. * // => false
  29588. * console.log(el.nodeName);
  29589. * // => 'BODY'
  29590. * console.log(el.childNodes.length);
  29591. * // => 0
  29592. */
  29593. function cloneWith(value, customizer) {
  29594. customizer = typeof customizer == 'function' ? customizer : undefined;
  29595. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  29596. }
  29597. /**
  29598. * This method is like `_.clone` except that it recursively clones `value`.
  29599. *
  29600. * @static
  29601. * @memberOf _
  29602. * @since 1.0.0
  29603. * @category Lang
  29604. * @param {*} value The value to recursively clone.
  29605. * @returns {*} Returns the deep cloned value.
  29606. * @see _.clone
  29607. * @example
  29608. *
  29609. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29610. *
  29611. * var deep = _.cloneDeep(objects);
  29612. * console.log(deep[0] === objects[0]);
  29613. * // => false
  29614. */
  29615. function cloneDeep(value) {
  29616. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  29617. }
  29618. /**
  29619. * This method is like `_.cloneWith` except that it recursively clones `value`.
  29620. *
  29621. * @static
  29622. * @memberOf _
  29623. * @since 4.0.0
  29624. * @category Lang
  29625. * @param {*} value The value to recursively clone.
  29626. * @param {Function} [customizer] The function to customize cloning.
  29627. * @returns {*} Returns the deep cloned value.
  29628. * @see _.cloneWith
  29629. * @example
  29630. *
  29631. * function customizer(value) {
  29632. * if (_.isElement(value)) {
  29633. * return value.cloneNode(true);
  29634. * }
  29635. * }
  29636. *
  29637. * var el = _.cloneDeepWith(document.body, customizer);
  29638. *
  29639. * console.log(el === document.body);
  29640. * // => false
  29641. * console.log(el.nodeName);
  29642. * // => 'BODY'
  29643. * console.log(el.childNodes.length);
  29644. * // => 20
  29645. */
  29646. function cloneDeepWith(value, customizer) {
  29647. customizer = typeof customizer == 'function' ? customizer : undefined;
  29648. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  29649. }
  29650. /**
  29651. * Checks if `object` conforms to `source` by invoking the predicate
  29652. * properties of `source` with the corresponding property values of `object`.
  29653. *
  29654. * **Note:** This method is equivalent to `_.conforms` when `source` is
  29655. * partially applied.
  29656. *
  29657. * @static
  29658. * @memberOf _
  29659. * @since 4.14.0
  29660. * @category Lang
  29661. * @param {Object} object The object to inspect.
  29662. * @param {Object} source The object of property predicates to conform to.
  29663. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  29664. * @example
  29665. *
  29666. * var object = { 'a': 1, 'b': 2 };
  29667. *
  29668. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  29669. * // => true
  29670. *
  29671. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  29672. * // => false
  29673. */
  29674. function conformsTo(object, source) {
  29675. return source == null || baseConformsTo(object, source, keys(source));
  29676. }
  29677. /**
  29678. * Performs a
  29679. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  29680. * comparison between two values to determine if they are equivalent.
  29681. *
  29682. * @static
  29683. * @memberOf _
  29684. * @since 4.0.0
  29685. * @category Lang
  29686. * @param {*} value The value to compare.
  29687. * @param {*} other The other value to compare.
  29688. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29689. * @example
  29690. *
  29691. * var object = { 'a': 1 };
  29692. * var other = { 'a': 1 };
  29693. *
  29694. * _.eq(object, object);
  29695. * // => true
  29696. *
  29697. * _.eq(object, other);
  29698. * // => false
  29699. *
  29700. * _.eq('a', 'a');
  29701. * // => true
  29702. *
  29703. * _.eq('a', Object('a'));
  29704. * // => false
  29705. *
  29706. * _.eq(NaN, NaN);
  29707. * // => true
  29708. */
  29709. function eq(value, other) {
  29710. return value === other || (value !== value && other !== other);
  29711. }
  29712. /**
  29713. * Checks if `value` is greater than `other`.
  29714. *
  29715. * @static
  29716. * @memberOf _
  29717. * @since 3.9.0
  29718. * @category Lang
  29719. * @param {*} value The value to compare.
  29720. * @param {*} other The other value to compare.
  29721. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  29722. * else `false`.
  29723. * @see _.lt
  29724. * @example
  29725. *
  29726. * _.gt(3, 1);
  29727. * // => true
  29728. *
  29729. * _.gt(3, 3);
  29730. * // => false
  29731. *
  29732. * _.gt(1, 3);
  29733. * // => false
  29734. */
  29735. var gt = createRelationalOperation(baseGt);
  29736. /**
  29737. * Checks if `value` is greater than or equal to `other`.
  29738. *
  29739. * @static
  29740. * @memberOf _
  29741. * @since 3.9.0
  29742. * @category Lang
  29743. * @param {*} value The value to compare.
  29744. * @param {*} other The other value to compare.
  29745. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  29746. * `other`, else `false`.
  29747. * @see _.lte
  29748. * @example
  29749. *
  29750. * _.gte(3, 1);
  29751. * // => true
  29752. *
  29753. * _.gte(3, 3);
  29754. * // => true
  29755. *
  29756. * _.gte(1, 3);
  29757. * // => false
  29758. */
  29759. var gte = createRelationalOperation(function(value, other) {
  29760. return value >= other;
  29761. });
  29762. /**
  29763. * Checks if `value` is likely an `arguments` object.
  29764. *
  29765. * @static
  29766. * @memberOf _
  29767. * @since 0.1.0
  29768. * @category Lang
  29769. * @param {*} value The value to check.
  29770. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  29771. * else `false`.
  29772. * @example
  29773. *
  29774. * _.isArguments(function() { return arguments; }());
  29775. * // => true
  29776. *
  29777. * _.isArguments([1, 2, 3]);
  29778. * // => false
  29779. */
  29780. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  29781. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  29782. !propertyIsEnumerable.call(value, 'callee');
  29783. };
  29784. /**
  29785. * Checks if `value` is classified as an `Array` object.
  29786. *
  29787. * @static
  29788. * @memberOf _
  29789. * @since 0.1.0
  29790. * @category Lang
  29791. * @param {*} value The value to check.
  29792. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  29793. * @example
  29794. *
  29795. * _.isArray([1, 2, 3]);
  29796. * // => true
  29797. *
  29798. * _.isArray(document.body.children);
  29799. * // => false
  29800. *
  29801. * _.isArray('abc');
  29802. * // => false
  29803. *
  29804. * _.isArray(_.noop);
  29805. * // => false
  29806. */
  29807. var isArray = Array.isArray;
  29808. /**
  29809. * Checks if `value` is classified as an `ArrayBuffer` object.
  29810. *
  29811. * @static
  29812. * @memberOf _
  29813. * @since 4.3.0
  29814. * @category Lang
  29815. * @param {*} value The value to check.
  29816. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  29817. * @example
  29818. *
  29819. * _.isArrayBuffer(new ArrayBuffer(2));
  29820. * // => true
  29821. *
  29822. * _.isArrayBuffer(new Array(2));
  29823. * // => false
  29824. */
  29825. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  29826. /**
  29827. * Checks if `value` is array-like. A value is considered array-like if it's
  29828. * not a function and has a `value.length` that's an integer greater than or
  29829. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  29830. *
  29831. * @static
  29832. * @memberOf _
  29833. * @since 4.0.0
  29834. * @category Lang
  29835. * @param {*} value The value to check.
  29836. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  29837. * @example
  29838. *
  29839. * _.isArrayLike([1, 2, 3]);
  29840. * // => true
  29841. *
  29842. * _.isArrayLike(document.body.children);
  29843. * // => true
  29844. *
  29845. * _.isArrayLike('abc');
  29846. * // => true
  29847. *
  29848. * _.isArrayLike(_.noop);
  29849. * // => false
  29850. */
  29851. function isArrayLike(value) {
  29852. return value != null && isLength(value.length) && !isFunction(value);
  29853. }
  29854. /**
  29855. * This method is like `_.isArrayLike` except that it also checks if `value`
  29856. * is an object.
  29857. *
  29858. * @static
  29859. * @memberOf _
  29860. * @since 4.0.0
  29861. * @category Lang
  29862. * @param {*} value The value to check.
  29863. * @returns {boolean} Returns `true` if `value` is an array-like object,
  29864. * else `false`.
  29865. * @example
  29866. *
  29867. * _.isArrayLikeObject([1, 2, 3]);
  29868. * // => true
  29869. *
  29870. * _.isArrayLikeObject(document.body.children);
  29871. * // => true
  29872. *
  29873. * _.isArrayLikeObject('abc');
  29874. * // => false
  29875. *
  29876. * _.isArrayLikeObject(_.noop);
  29877. * // => false
  29878. */
  29879. function isArrayLikeObject(value) {
  29880. return isObjectLike(value) && isArrayLike(value);
  29881. }
  29882. /**
  29883. * Checks if `value` is classified as a boolean primitive or object.
  29884. *
  29885. * @static
  29886. * @memberOf _
  29887. * @since 0.1.0
  29888. * @category Lang
  29889. * @param {*} value The value to check.
  29890. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  29891. * @example
  29892. *
  29893. * _.isBoolean(false);
  29894. * // => true
  29895. *
  29896. * _.isBoolean(null);
  29897. * // => false
  29898. */
  29899. function isBoolean(value) {
  29900. return value === true || value === false ||
  29901. (isObjectLike(value) && baseGetTag(value) == boolTag);
  29902. }
  29903. /**
  29904. * Checks if `value` is a buffer.
  29905. *
  29906. * @static
  29907. * @memberOf _
  29908. * @since 4.3.0
  29909. * @category Lang
  29910. * @param {*} value The value to check.
  29911. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  29912. * @example
  29913. *
  29914. * _.isBuffer(new Buffer(2));
  29915. * // => true
  29916. *
  29917. * _.isBuffer(new Uint8Array(2));
  29918. * // => false
  29919. */
  29920. var isBuffer = nativeIsBuffer || stubFalse;
  29921. /**
  29922. * Checks if `value` is classified as a `Date` object.
  29923. *
  29924. * @static
  29925. * @memberOf _
  29926. * @since 0.1.0
  29927. * @category Lang
  29928. * @param {*} value The value to check.
  29929. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29930. * @example
  29931. *
  29932. * _.isDate(new Date);
  29933. * // => true
  29934. *
  29935. * _.isDate('Mon April 23 2012');
  29936. * // => false
  29937. */
  29938. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29939. /**
  29940. * Checks if `value` is likely a DOM element.
  29941. *
  29942. * @static
  29943. * @memberOf _
  29944. * @since 0.1.0
  29945. * @category Lang
  29946. * @param {*} value The value to check.
  29947. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29948. * @example
  29949. *
  29950. * _.isElement(document.body);
  29951. * // => true
  29952. *
  29953. * _.isElement('<body>');
  29954. * // => false
  29955. */
  29956. function isElement(value) {
  29957. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29958. }
  29959. /**
  29960. * Checks if `value` is an empty object, collection, map, or set.
  29961. *
  29962. * Objects are considered empty if they have no own enumerable string keyed
  29963. * properties.
  29964. *
  29965. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29966. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29967. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29968. *
  29969. * @static
  29970. * @memberOf _
  29971. * @since 0.1.0
  29972. * @category Lang
  29973. * @param {*} value The value to check.
  29974. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29975. * @example
  29976. *
  29977. * _.isEmpty(null);
  29978. * // => true
  29979. *
  29980. * _.isEmpty(true);
  29981. * // => true
  29982. *
  29983. * _.isEmpty(1);
  29984. * // => true
  29985. *
  29986. * _.isEmpty([1, 2, 3]);
  29987. * // => false
  29988. *
  29989. * _.isEmpty({ 'a': 1 });
  29990. * // => false
  29991. */
  29992. function isEmpty(value) {
  29993. if (value == null) {
  29994. return true;
  29995. }
  29996. if (isArrayLike(value) &&
  29997. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29998. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29999. return !value.length;
  30000. }
  30001. var tag = getTag(value);
  30002. if (tag == mapTag || tag == setTag) {
  30003. return !value.size;
  30004. }
  30005. if (isPrototype(value)) {
  30006. return !baseKeys(value).length;
  30007. }
  30008. for (var key in value) {
  30009. if (hasOwnProperty.call(value, key)) {
  30010. return false;
  30011. }
  30012. }
  30013. return true;
  30014. }
  30015. /**
  30016. * Performs a deep comparison between two values to determine if they are
  30017. * equivalent.
  30018. *
  30019. * **Note:** This method supports comparing arrays, array buffers, booleans,
  30020. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  30021. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  30022. * by their own, not inherited, enumerable properties. Functions and DOM
  30023. * nodes are compared by strict equality, i.e. `===`.
  30024. *
  30025. * @static
  30026. * @memberOf _
  30027. * @since 0.1.0
  30028. * @category Lang
  30029. * @param {*} value The value to compare.
  30030. * @param {*} other The other value to compare.
  30031. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  30032. * @example
  30033. *
  30034. * var object = { 'a': 1 };
  30035. * var other = { 'a': 1 };
  30036. *
  30037. * _.isEqual(object, other);
  30038. * // => true
  30039. *
  30040. * object === other;
  30041. * // => false
  30042. */
  30043. function isEqual(value, other) {
  30044. return baseIsEqual(value, other);
  30045. }
  30046. /**
  30047. * This method is like `_.isEqual` except that it accepts `customizer` which
  30048. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  30049. * are handled by the method instead. The `customizer` is invoked with up to
  30050. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  30051. *
  30052. * @static
  30053. * @memberOf _
  30054. * @since 4.0.0
  30055. * @category Lang
  30056. * @param {*} value The value to compare.
  30057. * @param {*} other The other value to compare.
  30058. * @param {Function} [customizer] The function to customize comparisons.
  30059. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  30060. * @example
  30061. *
  30062. * function isGreeting(value) {
  30063. * return /^h(?:i|ello)$/.test(value);
  30064. * }
  30065. *
  30066. * function customizer(objValue, othValue) {
  30067. * if (isGreeting(objValue) && isGreeting(othValue)) {
  30068. * return true;
  30069. * }
  30070. * }
  30071. *
  30072. * var array = ['hello', 'goodbye'];
  30073. * var other = ['hi', 'goodbye'];
  30074. *
  30075. * _.isEqualWith(array, other, customizer);
  30076. * // => true
  30077. */
  30078. function isEqualWith(value, other, customizer) {
  30079. customizer = typeof customizer == 'function' ? customizer : undefined;
  30080. var result = customizer ? customizer(value, other) : undefined;
  30081. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  30082. }
  30083. /**
  30084. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  30085. * `SyntaxError`, `TypeError`, or `URIError` object.
  30086. *
  30087. * @static
  30088. * @memberOf _
  30089. * @since 3.0.0
  30090. * @category Lang
  30091. * @param {*} value The value to check.
  30092. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  30093. * @example
  30094. *
  30095. * _.isError(new Error);
  30096. * // => true
  30097. *
  30098. * _.isError(Error);
  30099. * // => false
  30100. */
  30101. function isError(value) {
  30102. if (!isObjectLike(value)) {
  30103. return false;
  30104. }
  30105. var tag = baseGetTag(value);
  30106. return tag == errorTag || tag == domExcTag ||
  30107. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  30108. }
  30109. /**
  30110. * Checks if `value` is a finite primitive number.
  30111. *
  30112. * **Note:** This method is based on
  30113. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  30114. *
  30115. * @static
  30116. * @memberOf _
  30117. * @since 0.1.0
  30118. * @category Lang
  30119. * @param {*} value The value to check.
  30120. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  30121. * @example
  30122. *
  30123. * _.isFinite(3);
  30124. * // => true
  30125. *
  30126. * _.isFinite(Number.MIN_VALUE);
  30127. * // => true
  30128. *
  30129. * _.isFinite(Infinity);
  30130. * // => false
  30131. *
  30132. * _.isFinite('3');
  30133. * // => false
  30134. */
  30135. function isFinite(value) {
  30136. return typeof value == 'number' && nativeIsFinite(value);
  30137. }
  30138. /**
  30139. * Checks if `value` is classified as a `Function` object.
  30140. *
  30141. * @static
  30142. * @memberOf _
  30143. * @since 0.1.0
  30144. * @category Lang
  30145. * @param {*} value The value to check.
  30146. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  30147. * @example
  30148. *
  30149. * _.isFunction(_);
  30150. * // => true
  30151. *
  30152. * _.isFunction(/abc/);
  30153. * // => false
  30154. */
  30155. function isFunction(value) {
  30156. if (!isObject(value)) {
  30157. return false;
  30158. }
  30159. // The use of `Object#toString` avoids issues with the `typeof` operator
  30160. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  30161. var tag = baseGetTag(value);
  30162. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  30163. }
  30164. /**
  30165. * Checks if `value` is an integer.
  30166. *
  30167. * **Note:** This method is based on
  30168. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  30169. *
  30170. * @static
  30171. * @memberOf _
  30172. * @since 4.0.0
  30173. * @category Lang
  30174. * @param {*} value The value to check.
  30175. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  30176. * @example
  30177. *
  30178. * _.isInteger(3);
  30179. * // => true
  30180. *
  30181. * _.isInteger(Number.MIN_VALUE);
  30182. * // => false
  30183. *
  30184. * _.isInteger(Infinity);
  30185. * // => false
  30186. *
  30187. * _.isInteger('3');
  30188. * // => false
  30189. */
  30190. function isInteger(value) {
  30191. return typeof value == 'number' && value == toInteger(value);
  30192. }
  30193. /**
  30194. * Checks if `value` is a valid array-like length.
  30195. *
  30196. * **Note:** This method is loosely based on
  30197. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30198. *
  30199. * @static
  30200. * @memberOf _
  30201. * @since 4.0.0
  30202. * @category Lang
  30203. * @param {*} value The value to check.
  30204. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  30205. * @example
  30206. *
  30207. * _.isLength(3);
  30208. * // => true
  30209. *
  30210. * _.isLength(Number.MIN_VALUE);
  30211. * // => false
  30212. *
  30213. * _.isLength(Infinity);
  30214. * // => false
  30215. *
  30216. * _.isLength('3');
  30217. * // => false
  30218. */
  30219. function isLength(value) {
  30220. return typeof value == 'number' &&
  30221. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  30222. }
  30223. /**
  30224. * Checks if `value` is the
  30225. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  30226. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  30227. *
  30228. * @static
  30229. * @memberOf _
  30230. * @since 0.1.0
  30231. * @category Lang
  30232. * @param {*} value The value to check.
  30233. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  30234. * @example
  30235. *
  30236. * _.isObject({});
  30237. * // => true
  30238. *
  30239. * _.isObject([1, 2, 3]);
  30240. * // => true
  30241. *
  30242. * _.isObject(_.noop);
  30243. * // => true
  30244. *
  30245. * _.isObject(null);
  30246. * // => false
  30247. */
  30248. function isObject(value) {
  30249. var type = typeof value;
  30250. return value != null && (type == 'object' || type == 'function');
  30251. }
  30252. /**
  30253. * Checks if `value` is object-like. A value is object-like if it's not `null`
  30254. * and has a `typeof` result of "object".
  30255. *
  30256. * @static
  30257. * @memberOf _
  30258. * @since 4.0.0
  30259. * @category Lang
  30260. * @param {*} value The value to check.
  30261. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  30262. * @example
  30263. *
  30264. * _.isObjectLike({});
  30265. * // => true
  30266. *
  30267. * _.isObjectLike([1, 2, 3]);
  30268. * // => true
  30269. *
  30270. * _.isObjectLike(_.noop);
  30271. * // => false
  30272. *
  30273. * _.isObjectLike(null);
  30274. * // => false
  30275. */
  30276. function isObjectLike(value) {
  30277. return value != null && typeof value == 'object';
  30278. }
  30279. /**
  30280. * Checks if `value` is classified as a `Map` object.
  30281. *
  30282. * @static
  30283. * @memberOf _
  30284. * @since 4.3.0
  30285. * @category Lang
  30286. * @param {*} value The value to check.
  30287. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  30288. * @example
  30289. *
  30290. * _.isMap(new Map);
  30291. * // => true
  30292. *
  30293. * _.isMap(new WeakMap);
  30294. * // => false
  30295. */
  30296. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  30297. /**
  30298. * Performs a partial deep comparison between `object` and `source` to
  30299. * determine if `object` contains equivalent property values.
  30300. *
  30301. * **Note:** This method is equivalent to `_.matches` when `source` is
  30302. * partially applied.
  30303. *
  30304. * Partial comparisons will match empty array and empty object `source`
  30305. * values against any array or object value, respectively. See `_.isEqual`
  30306. * for a list of supported value comparisons.
  30307. *
  30308. * @static
  30309. * @memberOf _
  30310. * @since 3.0.0
  30311. * @category Lang
  30312. * @param {Object} object The object to inspect.
  30313. * @param {Object} source The object of property values to match.
  30314. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  30315. * @example
  30316. *
  30317. * var object = { 'a': 1, 'b': 2 };
  30318. *
  30319. * _.isMatch(object, { 'b': 2 });
  30320. * // => true
  30321. *
  30322. * _.isMatch(object, { 'b': 1 });
  30323. * // => false
  30324. */
  30325. function isMatch(object, source) {
  30326. return object === source || baseIsMatch(object, source, getMatchData(source));
  30327. }
  30328. /**
  30329. * This method is like `_.isMatch` except that it accepts `customizer` which
  30330. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  30331. * are handled by the method instead. The `customizer` is invoked with five
  30332. * arguments: (objValue, srcValue, index|key, object, source).
  30333. *
  30334. * @static
  30335. * @memberOf _
  30336. * @since 4.0.0
  30337. * @category Lang
  30338. * @param {Object} object The object to inspect.
  30339. * @param {Object} source The object of property values to match.
  30340. * @param {Function} [customizer] The function to customize comparisons.
  30341. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  30342. * @example
  30343. *
  30344. * function isGreeting(value) {
  30345. * return /^h(?:i|ello)$/.test(value);
  30346. * }
  30347. *
  30348. * function customizer(objValue, srcValue) {
  30349. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  30350. * return true;
  30351. * }
  30352. * }
  30353. *
  30354. * var object = { 'greeting': 'hello' };
  30355. * var source = { 'greeting': 'hi' };
  30356. *
  30357. * _.isMatchWith(object, source, customizer);
  30358. * // => true
  30359. */
  30360. function isMatchWith(object, source, customizer) {
  30361. customizer = typeof customizer == 'function' ? customizer : undefined;
  30362. return baseIsMatch(object, source, getMatchData(source), customizer);
  30363. }
  30364. /**
  30365. * Checks if `value` is `NaN`.
  30366. *
  30367. * **Note:** This method is based on
  30368. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  30369. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  30370. * `undefined` and other non-number values.
  30371. *
  30372. * @static
  30373. * @memberOf _
  30374. * @since 0.1.0
  30375. * @category Lang
  30376. * @param {*} value The value to check.
  30377. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  30378. * @example
  30379. *
  30380. * _.isNaN(NaN);
  30381. * // => true
  30382. *
  30383. * _.isNaN(new Number(NaN));
  30384. * // => true
  30385. *
  30386. * isNaN(undefined);
  30387. * // => true
  30388. *
  30389. * _.isNaN(undefined);
  30390. * // => false
  30391. */
  30392. function isNaN(value) {
  30393. // An `NaN` primitive is the only value that is not equal to itself.
  30394. // Perform the `toStringTag` check first to avoid errors with some
  30395. // ActiveX objects in IE.
  30396. return isNumber(value) && value != +value;
  30397. }
  30398. /**
  30399. * Checks if `value` is a pristine native function.
  30400. *
  30401. * **Note:** This method can't reliably detect native functions in the presence
  30402. * of the core-js package because core-js circumvents this kind of detection.
  30403. * Despite multiple requests, the core-js maintainer has made it clear: any
  30404. * attempt to fix the detection will be obstructed. As a result, we're left
  30405. * with little choice but to throw an error. Unfortunately, this also affects
  30406. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  30407. * which rely on core-js.
  30408. *
  30409. * @static
  30410. * @memberOf _
  30411. * @since 3.0.0
  30412. * @category Lang
  30413. * @param {*} value The value to check.
  30414. * @returns {boolean} Returns `true` if `value` is a native function,
  30415. * else `false`.
  30416. * @example
  30417. *
  30418. * _.isNative(Array.prototype.push);
  30419. * // => true
  30420. *
  30421. * _.isNative(_);
  30422. * // => false
  30423. */
  30424. function isNative(value) {
  30425. if (isMaskable(value)) {
  30426. throw new Error(CORE_ERROR_TEXT);
  30427. }
  30428. return baseIsNative(value);
  30429. }
  30430. /**
  30431. * Checks if `value` is `null`.
  30432. *
  30433. * @static
  30434. * @memberOf _
  30435. * @since 0.1.0
  30436. * @category Lang
  30437. * @param {*} value The value to check.
  30438. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  30439. * @example
  30440. *
  30441. * _.isNull(null);
  30442. * // => true
  30443. *
  30444. * _.isNull(void 0);
  30445. * // => false
  30446. */
  30447. function isNull(value) {
  30448. return value === null;
  30449. }
  30450. /**
  30451. * Checks if `value` is `null` or `undefined`.
  30452. *
  30453. * @static
  30454. * @memberOf _
  30455. * @since 4.0.0
  30456. * @category Lang
  30457. * @param {*} value The value to check.
  30458. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  30459. * @example
  30460. *
  30461. * _.isNil(null);
  30462. * // => true
  30463. *
  30464. * _.isNil(void 0);
  30465. * // => true
  30466. *
  30467. * _.isNil(NaN);
  30468. * // => false
  30469. */
  30470. function isNil(value) {
  30471. return value == null;
  30472. }
  30473. /**
  30474. * Checks if `value` is classified as a `Number` primitive or object.
  30475. *
  30476. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  30477. * classified as numbers, use the `_.isFinite` method.
  30478. *
  30479. * @static
  30480. * @memberOf _
  30481. * @since 0.1.0
  30482. * @category Lang
  30483. * @param {*} value The value to check.
  30484. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  30485. * @example
  30486. *
  30487. * _.isNumber(3);
  30488. * // => true
  30489. *
  30490. * _.isNumber(Number.MIN_VALUE);
  30491. * // => true
  30492. *
  30493. * _.isNumber(Infinity);
  30494. * // => true
  30495. *
  30496. * _.isNumber('3');
  30497. * // => false
  30498. */
  30499. function isNumber(value) {
  30500. return typeof value == 'number' ||
  30501. (isObjectLike(value) && baseGetTag(value) == numberTag);
  30502. }
  30503. /**
  30504. * Checks if `value` is a plain object, that is, an object created by the
  30505. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  30506. *
  30507. * @static
  30508. * @memberOf _
  30509. * @since 0.8.0
  30510. * @category Lang
  30511. * @param {*} value The value to check.
  30512. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  30513. * @example
  30514. *
  30515. * function Foo() {
  30516. * this.a = 1;
  30517. * }
  30518. *
  30519. * _.isPlainObject(new Foo);
  30520. * // => false
  30521. *
  30522. * _.isPlainObject([1, 2, 3]);
  30523. * // => false
  30524. *
  30525. * _.isPlainObject({ 'x': 0, 'y': 0 });
  30526. * // => true
  30527. *
  30528. * _.isPlainObject(Object.create(null));
  30529. * // => true
  30530. */
  30531. function isPlainObject(value) {
  30532. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  30533. return false;
  30534. }
  30535. var proto = getPrototype(value);
  30536. if (proto === null) {
  30537. return true;
  30538. }
  30539. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  30540. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  30541. funcToString.call(Ctor) == objectCtorString;
  30542. }
  30543. /**
  30544. * Checks if `value` is classified as a `RegExp` object.
  30545. *
  30546. * @static
  30547. * @memberOf _
  30548. * @since 0.1.0
  30549. * @category Lang
  30550. * @param {*} value The value to check.
  30551. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  30552. * @example
  30553. *
  30554. * _.isRegExp(/abc/);
  30555. * // => true
  30556. *
  30557. * _.isRegExp('/abc/');
  30558. * // => false
  30559. */
  30560. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  30561. /**
  30562. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  30563. * double precision number which isn't the result of a rounded unsafe integer.
  30564. *
  30565. * **Note:** This method is based on
  30566. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  30567. *
  30568. * @static
  30569. * @memberOf _
  30570. * @since 4.0.0
  30571. * @category Lang
  30572. * @param {*} value The value to check.
  30573. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  30574. * @example
  30575. *
  30576. * _.isSafeInteger(3);
  30577. * // => true
  30578. *
  30579. * _.isSafeInteger(Number.MIN_VALUE);
  30580. * // => false
  30581. *
  30582. * _.isSafeInteger(Infinity);
  30583. * // => false
  30584. *
  30585. * _.isSafeInteger('3');
  30586. * // => false
  30587. */
  30588. function isSafeInteger(value) {
  30589. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  30590. }
  30591. /**
  30592. * Checks if `value` is classified as a `Set` object.
  30593. *
  30594. * @static
  30595. * @memberOf _
  30596. * @since 4.3.0
  30597. * @category Lang
  30598. * @param {*} value The value to check.
  30599. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  30600. * @example
  30601. *
  30602. * _.isSet(new Set);
  30603. * // => true
  30604. *
  30605. * _.isSet(new WeakSet);
  30606. * // => false
  30607. */
  30608. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  30609. /**
  30610. * Checks if `value` is classified as a `String` primitive or object.
  30611. *
  30612. * @static
  30613. * @since 0.1.0
  30614. * @memberOf _
  30615. * @category Lang
  30616. * @param {*} value The value to check.
  30617. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  30618. * @example
  30619. *
  30620. * _.isString('abc');
  30621. * // => true
  30622. *
  30623. * _.isString(1);
  30624. * // => false
  30625. */
  30626. function isString(value) {
  30627. return typeof value == 'string' ||
  30628. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  30629. }
  30630. /**
  30631. * Checks if `value` is classified as a `Symbol` primitive or object.
  30632. *
  30633. * @static
  30634. * @memberOf _
  30635. * @since 4.0.0
  30636. * @category Lang
  30637. * @param {*} value The value to check.
  30638. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  30639. * @example
  30640. *
  30641. * _.isSymbol(Symbol.iterator);
  30642. * // => true
  30643. *
  30644. * _.isSymbol('abc');
  30645. * // => false
  30646. */
  30647. function isSymbol(value) {
  30648. return typeof value == 'symbol' ||
  30649. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  30650. }
  30651. /**
  30652. * Checks if `value` is classified as a typed array.
  30653. *
  30654. * @static
  30655. * @memberOf _
  30656. * @since 3.0.0
  30657. * @category Lang
  30658. * @param {*} value The value to check.
  30659. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  30660. * @example
  30661. *
  30662. * _.isTypedArray(new Uint8Array);
  30663. * // => true
  30664. *
  30665. * _.isTypedArray([]);
  30666. * // => false
  30667. */
  30668. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  30669. /**
  30670. * Checks if `value` is `undefined`.
  30671. *
  30672. * @static
  30673. * @since 0.1.0
  30674. * @memberOf _
  30675. * @category Lang
  30676. * @param {*} value The value to check.
  30677. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  30678. * @example
  30679. *
  30680. * _.isUndefined(void 0);
  30681. * // => true
  30682. *
  30683. * _.isUndefined(null);
  30684. * // => false
  30685. */
  30686. function isUndefined(value) {
  30687. return value === undefined;
  30688. }
  30689. /**
  30690. * Checks if `value` is classified as a `WeakMap` object.
  30691. *
  30692. * @static
  30693. * @memberOf _
  30694. * @since 4.3.0
  30695. * @category Lang
  30696. * @param {*} value The value to check.
  30697. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  30698. * @example
  30699. *
  30700. * _.isWeakMap(new WeakMap);
  30701. * // => true
  30702. *
  30703. * _.isWeakMap(new Map);
  30704. * // => false
  30705. */
  30706. function isWeakMap(value) {
  30707. return isObjectLike(value) && getTag(value) == weakMapTag;
  30708. }
  30709. /**
  30710. * Checks if `value` is classified as a `WeakSet` object.
  30711. *
  30712. * @static
  30713. * @memberOf _
  30714. * @since 4.3.0
  30715. * @category Lang
  30716. * @param {*} value The value to check.
  30717. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  30718. * @example
  30719. *
  30720. * _.isWeakSet(new WeakSet);
  30721. * // => true
  30722. *
  30723. * _.isWeakSet(new Set);
  30724. * // => false
  30725. */
  30726. function isWeakSet(value) {
  30727. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  30728. }
  30729. /**
  30730. * Checks if `value` is less than `other`.
  30731. *
  30732. * @static
  30733. * @memberOf _
  30734. * @since 3.9.0
  30735. * @category Lang
  30736. * @param {*} value The value to compare.
  30737. * @param {*} other The other value to compare.
  30738. * @returns {boolean} Returns `true` if `value` is less than `other`,
  30739. * else `false`.
  30740. * @see _.gt
  30741. * @example
  30742. *
  30743. * _.lt(1, 3);
  30744. * // => true
  30745. *
  30746. * _.lt(3, 3);
  30747. * // => false
  30748. *
  30749. * _.lt(3, 1);
  30750. * // => false
  30751. */
  30752. var lt = createRelationalOperation(baseLt);
  30753. /**
  30754. * Checks if `value` is less than or equal to `other`.
  30755. *
  30756. * @static
  30757. * @memberOf _
  30758. * @since 3.9.0
  30759. * @category Lang
  30760. * @param {*} value The value to compare.
  30761. * @param {*} other The other value to compare.
  30762. * @returns {boolean} Returns `true` if `value` is less than or equal to
  30763. * `other`, else `false`.
  30764. * @see _.gte
  30765. * @example
  30766. *
  30767. * _.lte(1, 3);
  30768. * // => true
  30769. *
  30770. * _.lte(3, 3);
  30771. * // => true
  30772. *
  30773. * _.lte(3, 1);
  30774. * // => false
  30775. */
  30776. var lte = createRelationalOperation(function(value, other) {
  30777. return value <= other;
  30778. });
  30779. /**
  30780. * Converts `value` to an array.
  30781. *
  30782. * @static
  30783. * @since 0.1.0
  30784. * @memberOf _
  30785. * @category Lang
  30786. * @param {*} value The value to convert.
  30787. * @returns {Array} Returns the converted array.
  30788. * @example
  30789. *
  30790. * _.toArray({ 'a': 1, 'b': 2 });
  30791. * // => [1, 2]
  30792. *
  30793. * _.toArray('abc');
  30794. * // => ['a', 'b', 'c']
  30795. *
  30796. * _.toArray(1);
  30797. * // => []
  30798. *
  30799. * _.toArray(null);
  30800. * // => []
  30801. */
  30802. function toArray(value) {
  30803. if (!value) {
  30804. return [];
  30805. }
  30806. if (isArrayLike(value)) {
  30807. return isString(value) ? stringToArray(value) : copyArray(value);
  30808. }
  30809. if (symIterator && value[symIterator]) {
  30810. return iteratorToArray(value[symIterator]());
  30811. }
  30812. var tag = getTag(value),
  30813. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  30814. return func(value);
  30815. }
  30816. /**
  30817. * Converts `value` to a finite number.
  30818. *
  30819. * @static
  30820. * @memberOf _
  30821. * @since 4.12.0
  30822. * @category Lang
  30823. * @param {*} value The value to convert.
  30824. * @returns {number} Returns the converted number.
  30825. * @example
  30826. *
  30827. * _.toFinite(3.2);
  30828. * // => 3.2
  30829. *
  30830. * _.toFinite(Number.MIN_VALUE);
  30831. * // => 5e-324
  30832. *
  30833. * _.toFinite(Infinity);
  30834. * // => 1.7976931348623157e+308
  30835. *
  30836. * _.toFinite('3.2');
  30837. * // => 3.2
  30838. */
  30839. function toFinite(value) {
  30840. if (!value) {
  30841. return value === 0 ? value : 0;
  30842. }
  30843. value = toNumber(value);
  30844. if (value === INFINITY || value === -INFINITY) {
  30845. var sign = (value < 0 ? -1 : 1);
  30846. return sign * MAX_INTEGER;
  30847. }
  30848. return value === value ? value : 0;
  30849. }
  30850. /**
  30851. * Converts `value` to an integer.
  30852. *
  30853. * **Note:** This method is loosely based on
  30854. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  30855. *
  30856. * @static
  30857. * @memberOf _
  30858. * @since 4.0.0
  30859. * @category Lang
  30860. * @param {*} value The value to convert.
  30861. * @returns {number} Returns the converted integer.
  30862. * @example
  30863. *
  30864. * _.toInteger(3.2);
  30865. * // => 3
  30866. *
  30867. * _.toInteger(Number.MIN_VALUE);
  30868. * // => 0
  30869. *
  30870. * _.toInteger(Infinity);
  30871. * // => 1.7976931348623157e+308
  30872. *
  30873. * _.toInteger('3.2');
  30874. * // => 3
  30875. */
  30876. function toInteger(value) {
  30877. var result = toFinite(value),
  30878. remainder = result % 1;
  30879. return result === result ? (remainder ? result - remainder : result) : 0;
  30880. }
  30881. /**
  30882. * Converts `value` to an integer suitable for use as the length of an
  30883. * array-like object.
  30884. *
  30885. * **Note:** This method is based on
  30886. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30887. *
  30888. * @static
  30889. * @memberOf _
  30890. * @since 4.0.0
  30891. * @category Lang
  30892. * @param {*} value The value to convert.
  30893. * @returns {number} Returns the converted integer.
  30894. * @example
  30895. *
  30896. * _.toLength(3.2);
  30897. * // => 3
  30898. *
  30899. * _.toLength(Number.MIN_VALUE);
  30900. * // => 0
  30901. *
  30902. * _.toLength(Infinity);
  30903. * // => 4294967295
  30904. *
  30905. * _.toLength('3.2');
  30906. * // => 3
  30907. */
  30908. function toLength(value) {
  30909. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  30910. }
  30911. /**
  30912. * Converts `value` to a number.
  30913. *
  30914. * @static
  30915. * @memberOf _
  30916. * @since 4.0.0
  30917. * @category Lang
  30918. * @param {*} value The value to process.
  30919. * @returns {number} Returns the number.
  30920. * @example
  30921. *
  30922. * _.toNumber(3.2);
  30923. * // => 3.2
  30924. *
  30925. * _.toNumber(Number.MIN_VALUE);
  30926. * // => 5e-324
  30927. *
  30928. * _.toNumber(Infinity);
  30929. * // => Infinity
  30930. *
  30931. * _.toNumber('3.2');
  30932. * // => 3.2
  30933. */
  30934. function toNumber(value) {
  30935. if (typeof value == 'number') {
  30936. return value;
  30937. }
  30938. if (isSymbol(value)) {
  30939. return NAN;
  30940. }
  30941. if (isObject(value)) {
  30942. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30943. value = isObject(other) ? (other + '') : other;
  30944. }
  30945. if (typeof value != 'string') {
  30946. return value === 0 ? value : +value;
  30947. }
  30948. value = value.replace(reTrim, '');
  30949. var isBinary = reIsBinary.test(value);
  30950. return (isBinary || reIsOctal.test(value))
  30951. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30952. : (reIsBadHex.test(value) ? NAN : +value);
  30953. }
  30954. /**
  30955. * Converts `value` to a plain object flattening inherited enumerable string
  30956. * keyed properties of `value` to own properties of the plain object.
  30957. *
  30958. * @static
  30959. * @memberOf _
  30960. * @since 3.0.0
  30961. * @category Lang
  30962. * @param {*} value The value to convert.
  30963. * @returns {Object} Returns the converted plain object.
  30964. * @example
  30965. *
  30966. * function Foo() {
  30967. * this.b = 2;
  30968. * }
  30969. *
  30970. * Foo.prototype.c = 3;
  30971. *
  30972. * _.assign({ 'a': 1 }, new Foo);
  30973. * // => { 'a': 1, 'b': 2 }
  30974. *
  30975. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30976. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30977. */
  30978. function toPlainObject(value) {
  30979. return copyObject(value, keysIn(value));
  30980. }
  30981. /**
  30982. * Converts `value` to a safe integer. A safe integer can be compared and
  30983. * represented correctly.
  30984. *
  30985. * @static
  30986. * @memberOf _
  30987. * @since 4.0.0
  30988. * @category Lang
  30989. * @param {*} value The value to convert.
  30990. * @returns {number} Returns the converted integer.
  30991. * @example
  30992. *
  30993. * _.toSafeInteger(3.2);
  30994. * // => 3
  30995. *
  30996. * _.toSafeInteger(Number.MIN_VALUE);
  30997. * // => 0
  30998. *
  30999. * _.toSafeInteger(Infinity);
  31000. * // => 9007199254740991
  31001. *
  31002. * _.toSafeInteger('3.2');
  31003. * // => 3
  31004. */
  31005. function toSafeInteger(value) {
  31006. return value
  31007. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  31008. : (value === 0 ? value : 0);
  31009. }
  31010. /**
  31011. * Converts `value` to a string. An empty string is returned for `null`
  31012. * and `undefined` values. The sign of `-0` is preserved.
  31013. *
  31014. * @static
  31015. * @memberOf _
  31016. * @since 4.0.0
  31017. * @category Lang
  31018. * @param {*} value The value to convert.
  31019. * @returns {string} Returns the converted string.
  31020. * @example
  31021. *
  31022. * _.toString(null);
  31023. * // => ''
  31024. *
  31025. * _.toString(-0);
  31026. * // => '-0'
  31027. *
  31028. * _.toString([1, 2, 3]);
  31029. * // => '1,2,3'
  31030. */
  31031. function toString(value) {
  31032. return value == null ? '' : baseToString(value);
  31033. }
  31034. /*------------------------------------------------------------------------*/
  31035. /**
  31036. * Assigns own enumerable string keyed properties of source objects to the
  31037. * destination object. Source objects are applied from left to right.
  31038. * Subsequent sources overwrite property assignments of previous sources.
  31039. *
  31040. * **Note:** This method mutates `object` and is loosely based on
  31041. * [`Object.assign`](https://mdn.io/Object/assign).
  31042. *
  31043. * @static
  31044. * @memberOf _
  31045. * @since 0.10.0
  31046. * @category Object
  31047. * @param {Object} object The destination object.
  31048. * @param {...Object} [sources] The source objects.
  31049. * @returns {Object} Returns `object`.
  31050. * @see _.assignIn
  31051. * @example
  31052. *
  31053. * function Foo() {
  31054. * this.a = 1;
  31055. * }
  31056. *
  31057. * function Bar() {
  31058. * this.c = 3;
  31059. * }
  31060. *
  31061. * Foo.prototype.b = 2;
  31062. * Bar.prototype.d = 4;
  31063. *
  31064. * _.assign({ 'a': 0 }, new Foo, new Bar);
  31065. * // => { 'a': 1, 'c': 3 }
  31066. */
  31067. var assign = createAssigner(function(object, source) {
  31068. if (isPrototype(source) || isArrayLike(source)) {
  31069. copyObject(source, keys(source), object);
  31070. return;
  31071. }
  31072. for (var key in source) {
  31073. if (hasOwnProperty.call(source, key)) {
  31074. assignValue(object, key, source[key]);
  31075. }
  31076. }
  31077. });
  31078. /**
  31079. * This method is like `_.assign` except that it iterates over own and
  31080. * inherited source properties.
  31081. *
  31082. * **Note:** This method mutates `object`.
  31083. *
  31084. * @static
  31085. * @memberOf _
  31086. * @since 4.0.0
  31087. * @alias extend
  31088. * @category Object
  31089. * @param {Object} object The destination object.
  31090. * @param {...Object} [sources] The source objects.
  31091. * @returns {Object} Returns `object`.
  31092. * @see _.assign
  31093. * @example
  31094. *
  31095. * function Foo() {
  31096. * this.a = 1;
  31097. * }
  31098. *
  31099. * function Bar() {
  31100. * this.c = 3;
  31101. * }
  31102. *
  31103. * Foo.prototype.b = 2;
  31104. * Bar.prototype.d = 4;
  31105. *
  31106. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  31107. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  31108. */
  31109. var assignIn = createAssigner(function(object, source) {
  31110. copyObject(source, keysIn(source), object);
  31111. });
  31112. /**
  31113. * This method is like `_.assignIn` except that it accepts `customizer`
  31114. * which is invoked to produce the assigned values. If `customizer` returns
  31115. * `undefined`, assignment is handled by the method instead. The `customizer`
  31116. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  31117. *
  31118. * **Note:** This method mutates `object`.
  31119. *
  31120. * @static
  31121. * @memberOf _
  31122. * @since 4.0.0
  31123. * @alias extendWith
  31124. * @category Object
  31125. * @param {Object} object The destination object.
  31126. * @param {...Object} sources The source objects.
  31127. * @param {Function} [customizer] The function to customize assigned values.
  31128. * @returns {Object} Returns `object`.
  31129. * @see _.assignWith
  31130. * @example
  31131. *
  31132. * function customizer(objValue, srcValue) {
  31133. * return _.isUndefined(objValue) ? srcValue : objValue;
  31134. * }
  31135. *
  31136. * var defaults = _.partialRight(_.assignInWith, customizer);
  31137. *
  31138. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31139. * // => { 'a': 1, 'b': 2 }
  31140. */
  31141. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  31142. copyObject(source, keysIn(source), object, customizer);
  31143. });
  31144. /**
  31145. * This method is like `_.assign` except that it accepts `customizer`
  31146. * which is invoked to produce the assigned values. If `customizer` returns
  31147. * `undefined`, assignment is handled by the method instead. The `customizer`
  31148. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  31149. *
  31150. * **Note:** This method mutates `object`.
  31151. *
  31152. * @static
  31153. * @memberOf _
  31154. * @since 4.0.0
  31155. * @category Object
  31156. * @param {Object} object The destination object.
  31157. * @param {...Object} sources The source objects.
  31158. * @param {Function} [customizer] The function to customize assigned values.
  31159. * @returns {Object} Returns `object`.
  31160. * @see _.assignInWith
  31161. * @example
  31162. *
  31163. * function customizer(objValue, srcValue) {
  31164. * return _.isUndefined(objValue) ? srcValue : objValue;
  31165. * }
  31166. *
  31167. * var defaults = _.partialRight(_.assignWith, customizer);
  31168. *
  31169. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31170. * // => { 'a': 1, 'b': 2 }
  31171. */
  31172. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  31173. copyObject(source, keys(source), object, customizer);
  31174. });
  31175. /**
  31176. * Creates an array of values corresponding to `paths` of `object`.
  31177. *
  31178. * @static
  31179. * @memberOf _
  31180. * @since 1.0.0
  31181. * @category Object
  31182. * @param {Object} object The object to iterate over.
  31183. * @param {...(string|string[])} [paths] The property paths to pick.
  31184. * @returns {Array} Returns the picked values.
  31185. * @example
  31186. *
  31187. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  31188. *
  31189. * _.at(object, ['a[0].b.c', 'a[1]']);
  31190. * // => [3, 4]
  31191. */
  31192. var at = flatRest(baseAt);
  31193. /**
  31194. * Creates an object that inherits from the `prototype` object. If a
  31195. * `properties` object is given, its own enumerable string keyed properties
  31196. * are assigned to the created object.
  31197. *
  31198. * @static
  31199. * @memberOf _
  31200. * @since 2.3.0
  31201. * @category Object
  31202. * @param {Object} prototype The object to inherit from.
  31203. * @param {Object} [properties] The properties to assign to the object.
  31204. * @returns {Object} Returns the new object.
  31205. * @example
  31206. *
  31207. * function Shape() {
  31208. * this.x = 0;
  31209. * this.y = 0;
  31210. * }
  31211. *
  31212. * function Circle() {
  31213. * Shape.call(this);
  31214. * }
  31215. *
  31216. * Circle.prototype = _.create(Shape.prototype, {
  31217. * 'constructor': Circle
  31218. * });
  31219. *
  31220. * var circle = new Circle;
  31221. * circle instanceof Circle;
  31222. * // => true
  31223. *
  31224. * circle instanceof Shape;
  31225. * // => true
  31226. */
  31227. function create(prototype, properties) {
  31228. var result = baseCreate(prototype);
  31229. return properties == null ? result : baseAssign(result, properties);
  31230. }
  31231. /**
  31232. * Assigns own and inherited enumerable string keyed properties of source
  31233. * objects to the destination object for all destination properties that
  31234. * resolve to `undefined`. Source objects are applied from left to right.
  31235. * Once a property is set, additional values of the same property are ignored.
  31236. *
  31237. * **Note:** This method mutates `object`.
  31238. *
  31239. * @static
  31240. * @since 0.1.0
  31241. * @memberOf _
  31242. * @category Object
  31243. * @param {Object} object The destination object.
  31244. * @param {...Object} [sources] The source objects.
  31245. * @returns {Object} Returns `object`.
  31246. * @see _.defaultsDeep
  31247. * @example
  31248. *
  31249. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31250. * // => { 'a': 1, 'b': 2 }
  31251. */
  31252. var defaults = baseRest(function(object, sources) {
  31253. object = Object(object);
  31254. var index = -1;
  31255. var length = sources.length;
  31256. var guard = length > 2 ? sources[2] : undefined;
  31257. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  31258. length = 1;
  31259. }
  31260. while (++index < length) {
  31261. var source = sources[index];
  31262. var props = keysIn(source);
  31263. var propsIndex = -1;
  31264. var propsLength = props.length;
  31265. while (++propsIndex < propsLength) {
  31266. var key = props[propsIndex];
  31267. var value = object[key];
  31268. if (value === undefined ||
  31269. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  31270. object[key] = source[key];
  31271. }
  31272. }
  31273. }
  31274. return object;
  31275. });
  31276. /**
  31277. * This method is like `_.defaults` except that it recursively assigns
  31278. * default properties.
  31279. *
  31280. * **Note:** This method mutates `object`.
  31281. *
  31282. * @static
  31283. * @memberOf _
  31284. * @since 3.10.0
  31285. * @category Object
  31286. * @param {Object} object The destination object.
  31287. * @param {...Object} [sources] The source objects.
  31288. * @returns {Object} Returns `object`.
  31289. * @see _.defaults
  31290. * @example
  31291. *
  31292. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  31293. * // => { 'a': { 'b': 2, 'c': 3 } }
  31294. */
  31295. var defaultsDeep = baseRest(function(args) {
  31296. args.push(undefined, customDefaultsMerge);
  31297. return apply(mergeWith, undefined, args);
  31298. });
  31299. /**
  31300. * This method is like `_.find` except that it returns the key of the first
  31301. * element `predicate` returns truthy for instead of the element itself.
  31302. *
  31303. * @static
  31304. * @memberOf _
  31305. * @since 1.1.0
  31306. * @category Object
  31307. * @param {Object} object The object to inspect.
  31308. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  31309. * @returns {string|undefined} Returns the key of the matched element,
  31310. * else `undefined`.
  31311. * @example
  31312. *
  31313. * var users = {
  31314. * 'barney': { 'age': 36, 'active': true },
  31315. * 'fred': { 'age': 40, 'active': false },
  31316. * 'pebbles': { 'age': 1, 'active': true }
  31317. * };
  31318. *
  31319. * _.findKey(users, function(o) { return o.age < 40; });
  31320. * // => 'barney' (iteration order is not guaranteed)
  31321. *
  31322. * // The `_.matches` iteratee shorthand.
  31323. * _.findKey(users, { 'age': 1, 'active': true });
  31324. * // => 'pebbles'
  31325. *
  31326. * // The `_.matchesProperty` iteratee shorthand.
  31327. * _.findKey(users, ['active', false]);
  31328. * // => 'fred'
  31329. *
  31330. * // The `_.property` iteratee shorthand.
  31331. * _.findKey(users, 'active');
  31332. * // => 'barney'
  31333. */
  31334. function findKey(object, predicate) {
  31335. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  31336. }
  31337. /**
  31338. * This method is like `_.findKey` except that it iterates over elements of
  31339. * a collection in the opposite order.
  31340. *
  31341. * @static
  31342. * @memberOf _
  31343. * @since 2.0.0
  31344. * @category Object
  31345. * @param {Object} object The object to inspect.
  31346. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  31347. * @returns {string|undefined} Returns the key of the matched element,
  31348. * else `undefined`.
  31349. * @example
  31350. *
  31351. * var users = {
  31352. * 'barney': { 'age': 36, 'active': true },
  31353. * 'fred': { 'age': 40, 'active': false },
  31354. * 'pebbles': { 'age': 1, 'active': true }
  31355. * };
  31356. *
  31357. * _.findLastKey(users, function(o) { return o.age < 40; });
  31358. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  31359. *
  31360. * // The `_.matches` iteratee shorthand.
  31361. * _.findLastKey(users, { 'age': 36, 'active': true });
  31362. * // => 'barney'
  31363. *
  31364. * // The `_.matchesProperty` iteratee shorthand.
  31365. * _.findLastKey(users, ['active', false]);
  31366. * // => 'fred'
  31367. *
  31368. * // The `_.property` iteratee shorthand.
  31369. * _.findLastKey(users, 'active');
  31370. * // => 'pebbles'
  31371. */
  31372. function findLastKey(object, predicate) {
  31373. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  31374. }
  31375. /**
  31376. * Iterates over own and inherited enumerable string keyed properties of an
  31377. * object and invokes `iteratee` for each property. The iteratee is invoked
  31378. * with three arguments: (value, key, object). Iteratee functions may exit
  31379. * iteration early by explicitly returning `false`.
  31380. *
  31381. * @static
  31382. * @memberOf _
  31383. * @since 0.3.0
  31384. * @category Object
  31385. * @param {Object} object The object to iterate over.
  31386. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31387. * @returns {Object} Returns `object`.
  31388. * @see _.forInRight
  31389. * @example
  31390. *
  31391. * function Foo() {
  31392. * this.a = 1;
  31393. * this.b = 2;
  31394. * }
  31395. *
  31396. * Foo.prototype.c = 3;
  31397. *
  31398. * _.forIn(new Foo, function(value, key) {
  31399. * console.log(key);
  31400. * });
  31401. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  31402. */
  31403. function forIn(object, iteratee) {
  31404. return object == null
  31405. ? object
  31406. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  31407. }
  31408. /**
  31409. * This method is like `_.forIn` except that it iterates over properties of
  31410. * `object` in the opposite order.
  31411. *
  31412. * @static
  31413. * @memberOf _
  31414. * @since 2.0.0
  31415. * @category Object
  31416. * @param {Object} object The object to iterate over.
  31417. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31418. * @returns {Object} Returns `object`.
  31419. * @see _.forIn
  31420. * @example
  31421. *
  31422. * function Foo() {
  31423. * this.a = 1;
  31424. * this.b = 2;
  31425. * }
  31426. *
  31427. * Foo.prototype.c = 3;
  31428. *
  31429. * _.forInRight(new Foo, function(value, key) {
  31430. * console.log(key);
  31431. * });
  31432. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  31433. */
  31434. function forInRight(object, iteratee) {
  31435. return object == null
  31436. ? object
  31437. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  31438. }
  31439. /**
  31440. * Iterates over own enumerable string keyed properties of an object and
  31441. * invokes `iteratee` for each property. The iteratee is invoked with three
  31442. * arguments: (value, key, object). Iteratee functions may exit iteration
  31443. * early by explicitly returning `false`.
  31444. *
  31445. * @static
  31446. * @memberOf _
  31447. * @since 0.3.0
  31448. * @category Object
  31449. * @param {Object} object The object to iterate over.
  31450. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31451. * @returns {Object} Returns `object`.
  31452. * @see _.forOwnRight
  31453. * @example
  31454. *
  31455. * function Foo() {
  31456. * this.a = 1;
  31457. * this.b = 2;
  31458. * }
  31459. *
  31460. * Foo.prototype.c = 3;
  31461. *
  31462. * _.forOwn(new Foo, function(value, key) {
  31463. * console.log(key);
  31464. * });
  31465. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  31466. */
  31467. function forOwn(object, iteratee) {
  31468. return object && baseForOwn(object, getIteratee(iteratee, 3));
  31469. }
  31470. /**
  31471. * This method is like `_.forOwn` except that it iterates over properties of
  31472. * `object` in the opposite order.
  31473. *
  31474. * @static
  31475. * @memberOf _
  31476. * @since 2.0.0
  31477. * @category Object
  31478. * @param {Object} object The object to iterate over.
  31479. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31480. * @returns {Object} Returns `object`.
  31481. * @see _.forOwn
  31482. * @example
  31483. *
  31484. * function Foo() {
  31485. * this.a = 1;
  31486. * this.b = 2;
  31487. * }
  31488. *
  31489. * Foo.prototype.c = 3;
  31490. *
  31491. * _.forOwnRight(new Foo, function(value, key) {
  31492. * console.log(key);
  31493. * });
  31494. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  31495. */
  31496. function forOwnRight(object, iteratee) {
  31497. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  31498. }
  31499. /**
  31500. * Creates an array of function property names from own enumerable properties
  31501. * of `object`.
  31502. *
  31503. * @static
  31504. * @since 0.1.0
  31505. * @memberOf _
  31506. * @category Object
  31507. * @param {Object} object The object to inspect.
  31508. * @returns {Array} Returns the function names.
  31509. * @see _.functionsIn
  31510. * @example
  31511. *
  31512. * function Foo() {
  31513. * this.a = _.constant('a');
  31514. * this.b = _.constant('b');
  31515. * }
  31516. *
  31517. * Foo.prototype.c = _.constant('c');
  31518. *
  31519. * _.functions(new Foo);
  31520. * // => ['a', 'b']
  31521. */
  31522. function functions(object) {
  31523. return object == null ? [] : baseFunctions(object, keys(object));
  31524. }
  31525. /**
  31526. * Creates an array of function property names from own and inherited
  31527. * enumerable properties of `object`.
  31528. *
  31529. * @static
  31530. * @memberOf _
  31531. * @since 4.0.0
  31532. * @category Object
  31533. * @param {Object} object The object to inspect.
  31534. * @returns {Array} Returns the function names.
  31535. * @see _.functions
  31536. * @example
  31537. *
  31538. * function Foo() {
  31539. * this.a = _.constant('a');
  31540. * this.b = _.constant('b');
  31541. * }
  31542. *
  31543. * Foo.prototype.c = _.constant('c');
  31544. *
  31545. * _.functionsIn(new Foo);
  31546. * // => ['a', 'b', 'c']
  31547. */
  31548. function functionsIn(object) {
  31549. return object == null ? [] : baseFunctions(object, keysIn(object));
  31550. }
  31551. /**
  31552. * Gets the value at `path` of `object`. If the resolved value is
  31553. * `undefined`, the `defaultValue` is returned in its place.
  31554. *
  31555. * @static
  31556. * @memberOf _
  31557. * @since 3.7.0
  31558. * @category Object
  31559. * @param {Object} object The object to query.
  31560. * @param {Array|string} path The path of the property to get.
  31561. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31562. * @returns {*} Returns the resolved value.
  31563. * @example
  31564. *
  31565. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31566. *
  31567. * _.get(object, 'a[0].b.c');
  31568. * // => 3
  31569. *
  31570. * _.get(object, ['a', '0', 'b', 'c']);
  31571. * // => 3
  31572. *
  31573. * _.get(object, 'a.b.c', 'default');
  31574. * // => 'default'
  31575. */
  31576. function get(object, path, defaultValue) {
  31577. var result = object == null ? undefined : baseGet(object, path);
  31578. return result === undefined ? defaultValue : result;
  31579. }
  31580. /**
  31581. * Checks if `path` is a direct property of `object`.
  31582. *
  31583. * @static
  31584. * @since 0.1.0
  31585. * @memberOf _
  31586. * @category Object
  31587. * @param {Object} object The object to query.
  31588. * @param {Array|string} path The path to check.
  31589. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31590. * @example
  31591. *
  31592. * var object = { 'a': { 'b': 2 } };
  31593. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  31594. *
  31595. * _.has(object, 'a');
  31596. * // => true
  31597. *
  31598. * _.has(object, 'a.b');
  31599. * // => true
  31600. *
  31601. * _.has(object, ['a', 'b']);
  31602. * // => true
  31603. *
  31604. * _.has(other, 'a');
  31605. * // => false
  31606. */
  31607. function has(object, path) {
  31608. return object != null && hasPath(object, path, baseHas);
  31609. }
  31610. /**
  31611. * Checks if `path` is a direct or inherited property of `object`.
  31612. *
  31613. * @static
  31614. * @memberOf _
  31615. * @since 4.0.0
  31616. * @category Object
  31617. * @param {Object} object The object to query.
  31618. * @param {Array|string} path The path to check.
  31619. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31620. * @example
  31621. *
  31622. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  31623. *
  31624. * _.hasIn(object, 'a');
  31625. * // => true
  31626. *
  31627. * _.hasIn(object, 'a.b');
  31628. * // => true
  31629. *
  31630. * _.hasIn(object, ['a', 'b']);
  31631. * // => true
  31632. *
  31633. * _.hasIn(object, 'b');
  31634. * // => false
  31635. */
  31636. function hasIn(object, path) {
  31637. return object != null && hasPath(object, path, baseHasIn);
  31638. }
  31639. /**
  31640. * Creates an object composed of the inverted keys and values of `object`.
  31641. * If `object` contains duplicate values, subsequent values overwrite
  31642. * property assignments of previous values.
  31643. *
  31644. * @static
  31645. * @memberOf _
  31646. * @since 0.7.0
  31647. * @category Object
  31648. * @param {Object} object The object to invert.
  31649. * @returns {Object} Returns the new inverted object.
  31650. * @example
  31651. *
  31652. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31653. *
  31654. * _.invert(object);
  31655. * // => { '1': 'c', '2': 'b' }
  31656. */
  31657. var invert = createInverter(function(result, value, key) {
  31658. if (value != null &&
  31659. typeof value.toString != 'function') {
  31660. value = nativeObjectToString.call(value);
  31661. }
  31662. result[value] = key;
  31663. }, constant(identity));
  31664. /**
  31665. * This method is like `_.invert` except that the inverted object is generated
  31666. * from the results of running each element of `object` thru `iteratee`. The
  31667. * corresponding inverted value of each inverted key is an array of keys
  31668. * responsible for generating the inverted value. The iteratee is invoked
  31669. * with one argument: (value).
  31670. *
  31671. * @static
  31672. * @memberOf _
  31673. * @since 4.1.0
  31674. * @category Object
  31675. * @param {Object} object The object to invert.
  31676. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  31677. * @returns {Object} Returns the new inverted object.
  31678. * @example
  31679. *
  31680. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31681. *
  31682. * _.invertBy(object);
  31683. * // => { '1': ['a', 'c'], '2': ['b'] }
  31684. *
  31685. * _.invertBy(object, function(value) {
  31686. * return 'group' + value;
  31687. * });
  31688. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  31689. */
  31690. var invertBy = createInverter(function(result, value, key) {
  31691. if (value != null &&
  31692. typeof value.toString != 'function') {
  31693. value = nativeObjectToString.call(value);
  31694. }
  31695. if (hasOwnProperty.call(result, value)) {
  31696. result[value].push(key);
  31697. } else {
  31698. result[value] = [key];
  31699. }
  31700. }, getIteratee);
  31701. /**
  31702. * Invokes the method at `path` of `object`.
  31703. *
  31704. * @static
  31705. * @memberOf _
  31706. * @since 4.0.0
  31707. * @category Object
  31708. * @param {Object} object The object to query.
  31709. * @param {Array|string} path The path of the method to invoke.
  31710. * @param {...*} [args] The arguments to invoke the method with.
  31711. * @returns {*} Returns the result of the invoked method.
  31712. * @example
  31713. *
  31714. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  31715. *
  31716. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  31717. * // => [2, 3]
  31718. */
  31719. var invoke = baseRest(baseInvoke);
  31720. /**
  31721. * Creates an array of the own enumerable property names of `object`.
  31722. *
  31723. * **Note:** Non-object values are coerced to objects. See the
  31724. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  31725. * for more details.
  31726. *
  31727. * @static
  31728. * @since 0.1.0
  31729. * @memberOf _
  31730. * @category Object
  31731. * @param {Object} object The object to query.
  31732. * @returns {Array} Returns the array of property names.
  31733. * @example
  31734. *
  31735. * function Foo() {
  31736. * this.a = 1;
  31737. * this.b = 2;
  31738. * }
  31739. *
  31740. * Foo.prototype.c = 3;
  31741. *
  31742. * _.keys(new Foo);
  31743. * // => ['a', 'b'] (iteration order is not guaranteed)
  31744. *
  31745. * _.keys('hi');
  31746. * // => ['0', '1']
  31747. */
  31748. function keys(object) {
  31749. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  31750. }
  31751. /**
  31752. * Creates an array of the own and inherited enumerable property names of `object`.
  31753. *
  31754. * **Note:** Non-object values are coerced to objects.
  31755. *
  31756. * @static
  31757. * @memberOf _
  31758. * @since 3.0.0
  31759. * @category Object
  31760. * @param {Object} object The object to query.
  31761. * @returns {Array} Returns the array of property names.
  31762. * @example
  31763. *
  31764. * function Foo() {
  31765. * this.a = 1;
  31766. * this.b = 2;
  31767. * }
  31768. *
  31769. * Foo.prototype.c = 3;
  31770. *
  31771. * _.keysIn(new Foo);
  31772. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  31773. */
  31774. function keysIn(object) {
  31775. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  31776. }
  31777. /**
  31778. * The opposite of `_.mapValues`; this method creates an object with the
  31779. * same values as `object` and keys generated by running each own enumerable
  31780. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  31781. * with three arguments: (value, key, object).
  31782. *
  31783. * @static
  31784. * @memberOf _
  31785. * @since 3.8.0
  31786. * @category Object
  31787. * @param {Object} object The object to iterate over.
  31788. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31789. * @returns {Object} Returns the new mapped object.
  31790. * @see _.mapValues
  31791. * @example
  31792. *
  31793. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  31794. * return key + value;
  31795. * });
  31796. * // => { 'a1': 1, 'b2': 2 }
  31797. */
  31798. function mapKeys(object, iteratee) {
  31799. var result = {};
  31800. iteratee = getIteratee(iteratee, 3);
  31801. baseForOwn(object, function(value, key, object) {
  31802. baseAssignValue(result, iteratee(value, key, object), value);
  31803. });
  31804. return result;
  31805. }
  31806. /**
  31807. * Creates an object with the same keys as `object` and values generated
  31808. * by running each own enumerable string keyed property of `object` thru
  31809. * `iteratee`. The iteratee is invoked with three arguments:
  31810. * (value, key, object).
  31811. *
  31812. * @static
  31813. * @memberOf _
  31814. * @since 2.4.0
  31815. * @category Object
  31816. * @param {Object} object The object to iterate over.
  31817. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31818. * @returns {Object} Returns the new mapped object.
  31819. * @see _.mapKeys
  31820. * @example
  31821. *
  31822. * var users = {
  31823. * 'fred': { 'user': 'fred', 'age': 40 },
  31824. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  31825. * };
  31826. *
  31827. * _.mapValues(users, function(o) { return o.age; });
  31828. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31829. *
  31830. * // The `_.property` iteratee shorthand.
  31831. * _.mapValues(users, 'age');
  31832. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31833. */
  31834. function mapValues(object, iteratee) {
  31835. var result = {};
  31836. iteratee = getIteratee(iteratee, 3);
  31837. baseForOwn(object, function(value, key, object) {
  31838. baseAssignValue(result, key, iteratee(value, key, object));
  31839. });
  31840. return result;
  31841. }
  31842. /**
  31843. * This method is like `_.assign` except that it recursively merges own and
  31844. * inherited enumerable string keyed properties of source objects into the
  31845. * destination object. Source properties that resolve to `undefined` are
  31846. * skipped if a destination value exists. Array and plain object properties
  31847. * are merged recursively. Other objects and value types are overridden by
  31848. * assignment. Source objects are applied from left to right. Subsequent
  31849. * sources overwrite property assignments of previous sources.
  31850. *
  31851. * **Note:** This method mutates `object`.
  31852. *
  31853. * @static
  31854. * @memberOf _
  31855. * @since 0.5.0
  31856. * @category Object
  31857. * @param {Object} object The destination object.
  31858. * @param {...Object} [sources] The source objects.
  31859. * @returns {Object} Returns `object`.
  31860. * @example
  31861. *
  31862. * var object = {
  31863. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  31864. * };
  31865. *
  31866. * var other = {
  31867. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  31868. * };
  31869. *
  31870. * _.merge(object, other);
  31871. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  31872. */
  31873. var merge = createAssigner(function(object, source, srcIndex) {
  31874. baseMerge(object, source, srcIndex);
  31875. });
  31876. /**
  31877. * This method is like `_.merge` except that it accepts `customizer` which
  31878. * is invoked to produce the merged values of the destination and source
  31879. * properties. If `customizer` returns `undefined`, merging is handled by the
  31880. * method instead. The `customizer` is invoked with six arguments:
  31881. * (objValue, srcValue, key, object, source, stack).
  31882. *
  31883. * **Note:** This method mutates `object`.
  31884. *
  31885. * @static
  31886. * @memberOf _
  31887. * @since 4.0.0
  31888. * @category Object
  31889. * @param {Object} object The destination object.
  31890. * @param {...Object} sources The source objects.
  31891. * @param {Function} customizer The function to customize assigned values.
  31892. * @returns {Object} Returns `object`.
  31893. * @example
  31894. *
  31895. * function customizer(objValue, srcValue) {
  31896. * if (_.isArray(objValue)) {
  31897. * return objValue.concat(srcValue);
  31898. * }
  31899. * }
  31900. *
  31901. * var object = { 'a': [1], 'b': [2] };
  31902. * var other = { 'a': [3], 'b': [4] };
  31903. *
  31904. * _.mergeWith(object, other, customizer);
  31905. * // => { 'a': [1, 3], 'b': [2, 4] }
  31906. */
  31907. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  31908. baseMerge(object, source, srcIndex, customizer);
  31909. });
  31910. /**
  31911. * The opposite of `_.pick`; this method creates an object composed of the
  31912. * own and inherited enumerable property paths of `object` that are not omitted.
  31913. *
  31914. * **Note:** This method is considerably slower than `_.pick`.
  31915. *
  31916. * @static
  31917. * @since 0.1.0
  31918. * @memberOf _
  31919. * @category Object
  31920. * @param {Object} object The source object.
  31921. * @param {...(string|string[])} [paths] The property paths to omit.
  31922. * @returns {Object} Returns the new object.
  31923. * @example
  31924. *
  31925. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31926. *
  31927. * _.omit(object, ['a', 'c']);
  31928. * // => { 'b': '2' }
  31929. */
  31930. var omit = flatRest(function(object, paths) {
  31931. var result = {};
  31932. if (object == null) {
  31933. return result;
  31934. }
  31935. var isDeep = false;
  31936. paths = arrayMap(paths, function(path) {
  31937. path = castPath(path, object);
  31938. isDeep || (isDeep = path.length > 1);
  31939. return path;
  31940. });
  31941. copyObject(object, getAllKeysIn(object), result);
  31942. if (isDeep) {
  31943. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31944. }
  31945. var length = paths.length;
  31946. while (length--) {
  31947. baseUnset(result, paths[length]);
  31948. }
  31949. return result;
  31950. });
  31951. /**
  31952. * The opposite of `_.pickBy`; this method creates an object composed of
  31953. * the own and inherited enumerable string keyed properties of `object` that
  31954. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31955. * arguments: (value, key).
  31956. *
  31957. * @static
  31958. * @memberOf _
  31959. * @since 4.0.0
  31960. * @category Object
  31961. * @param {Object} object The source object.
  31962. * @param {Function} [predicate=_.identity] The function invoked per property.
  31963. * @returns {Object} Returns the new object.
  31964. * @example
  31965. *
  31966. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31967. *
  31968. * _.omitBy(object, _.isNumber);
  31969. * // => { 'b': '2' }
  31970. */
  31971. function omitBy(object, predicate) {
  31972. return pickBy(object, negate(getIteratee(predicate)));
  31973. }
  31974. /**
  31975. * Creates an object composed of the picked `object` properties.
  31976. *
  31977. * @static
  31978. * @since 0.1.0
  31979. * @memberOf _
  31980. * @category Object
  31981. * @param {Object} object The source object.
  31982. * @param {...(string|string[])} [paths] The property paths to pick.
  31983. * @returns {Object} Returns the new object.
  31984. * @example
  31985. *
  31986. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31987. *
  31988. * _.pick(object, ['a', 'c']);
  31989. * // => { 'a': 1, 'c': 3 }
  31990. */
  31991. var pick = flatRest(function(object, paths) {
  31992. return object == null ? {} : basePick(object, paths);
  31993. });
  31994. /**
  31995. * Creates an object composed of the `object` properties `predicate` returns
  31996. * truthy for. The predicate is invoked with two arguments: (value, key).
  31997. *
  31998. * @static
  31999. * @memberOf _
  32000. * @since 4.0.0
  32001. * @category Object
  32002. * @param {Object} object The source object.
  32003. * @param {Function} [predicate=_.identity] The function invoked per property.
  32004. * @returns {Object} Returns the new object.
  32005. * @example
  32006. *
  32007. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  32008. *
  32009. * _.pickBy(object, _.isNumber);
  32010. * // => { 'a': 1, 'c': 3 }
  32011. */
  32012. function pickBy(object, predicate) {
  32013. if (object == null) {
  32014. return {};
  32015. }
  32016. var props = arrayMap(getAllKeysIn(object), function(prop) {
  32017. return [prop];
  32018. });
  32019. predicate = getIteratee(predicate);
  32020. return basePickBy(object, props, function(value, path) {
  32021. return predicate(value, path[0]);
  32022. });
  32023. }
  32024. /**
  32025. * This method is like `_.get` except that if the resolved value is a
  32026. * function it's invoked with the `this` binding of its parent object and
  32027. * its result is returned.
  32028. *
  32029. * @static
  32030. * @since 0.1.0
  32031. * @memberOf _
  32032. * @category Object
  32033. * @param {Object} object The object to query.
  32034. * @param {Array|string} path The path of the property to resolve.
  32035. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  32036. * @returns {*} Returns the resolved value.
  32037. * @example
  32038. *
  32039. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  32040. *
  32041. * _.result(object, 'a[0].b.c1');
  32042. * // => 3
  32043. *
  32044. * _.result(object, 'a[0].b.c2');
  32045. * // => 4
  32046. *
  32047. * _.result(object, 'a[0].b.c3', 'default');
  32048. * // => 'default'
  32049. *
  32050. * _.result(object, 'a[0].b.c3', _.constant('default'));
  32051. * // => 'default'
  32052. */
  32053. function result(object, path, defaultValue) {
  32054. path = castPath(path, object);
  32055. var index = -1,
  32056. length = path.length;
  32057. // Ensure the loop is entered when path is empty.
  32058. if (!length) {
  32059. length = 1;
  32060. object = undefined;
  32061. }
  32062. while (++index < length) {
  32063. var value = object == null ? undefined : object[toKey(path[index])];
  32064. if (value === undefined) {
  32065. index = length;
  32066. value = defaultValue;
  32067. }
  32068. object = isFunction(value) ? value.call(object) : value;
  32069. }
  32070. return object;
  32071. }
  32072. /**
  32073. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  32074. * it's created. Arrays are created for missing index properties while objects
  32075. * are created for all other missing properties. Use `_.setWith` to customize
  32076. * `path` creation.
  32077. *
  32078. * **Note:** This method mutates `object`.
  32079. *
  32080. * @static
  32081. * @memberOf _
  32082. * @since 3.7.0
  32083. * @category Object
  32084. * @param {Object} object The object to modify.
  32085. * @param {Array|string} path The path of the property to set.
  32086. * @param {*} value The value to set.
  32087. * @returns {Object} Returns `object`.
  32088. * @example
  32089. *
  32090. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  32091. *
  32092. * _.set(object, 'a[0].b.c', 4);
  32093. * console.log(object.a[0].b.c);
  32094. * // => 4
  32095. *
  32096. * _.set(object, ['x', '0', 'y', 'z'], 5);
  32097. * console.log(object.x[0].y.z);
  32098. * // => 5
  32099. */
  32100. function set(object, path, value) {
  32101. return object == null ? object : baseSet(object, path, value);
  32102. }
  32103. /**
  32104. * This method is like `_.set` except that it accepts `customizer` which is
  32105. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  32106. * path creation is handled by the method instead. The `customizer` is invoked
  32107. * with three arguments: (nsValue, key, nsObject).
  32108. *
  32109. * **Note:** This method mutates `object`.
  32110. *
  32111. * @static
  32112. * @memberOf _
  32113. * @since 4.0.0
  32114. * @category Object
  32115. * @param {Object} object The object to modify.
  32116. * @param {Array|string} path The path of the property to set.
  32117. * @param {*} value The value to set.
  32118. * @param {Function} [customizer] The function to customize assigned values.
  32119. * @returns {Object} Returns `object`.
  32120. * @example
  32121. *
  32122. * var object = {};
  32123. *
  32124. * _.setWith(object, '[0][1]', 'a', Object);
  32125. * // => { '0': { '1': 'a' } }
  32126. */
  32127. function setWith(object, path, value, customizer) {
  32128. customizer = typeof customizer == 'function' ? customizer : undefined;
  32129. return object == null ? object : baseSet(object, path, value, customizer);
  32130. }
  32131. /**
  32132. * Creates an array of own enumerable string keyed-value pairs for `object`
  32133. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  32134. * entries are returned.
  32135. *
  32136. * @static
  32137. * @memberOf _
  32138. * @since 4.0.0
  32139. * @alias entries
  32140. * @category Object
  32141. * @param {Object} object The object to query.
  32142. * @returns {Array} Returns the key-value pairs.
  32143. * @example
  32144. *
  32145. * function Foo() {
  32146. * this.a = 1;
  32147. * this.b = 2;
  32148. * }
  32149. *
  32150. * Foo.prototype.c = 3;
  32151. *
  32152. * _.toPairs(new Foo);
  32153. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  32154. */
  32155. var toPairs = createToPairs(keys);
  32156. /**
  32157. * Creates an array of own and inherited enumerable string keyed-value pairs
  32158. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  32159. * or set, its entries are returned.
  32160. *
  32161. * @static
  32162. * @memberOf _
  32163. * @since 4.0.0
  32164. * @alias entriesIn
  32165. * @category Object
  32166. * @param {Object} object The object to query.
  32167. * @returns {Array} Returns the key-value pairs.
  32168. * @example
  32169. *
  32170. * function Foo() {
  32171. * this.a = 1;
  32172. * this.b = 2;
  32173. * }
  32174. *
  32175. * Foo.prototype.c = 3;
  32176. *
  32177. * _.toPairsIn(new Foo);
  32178. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  32179. */
  32180. var toPairsIn = createToPairs(keysIn);
  32181. /**
  32182. * An alternative to `_.reduce`; this method transforms `object` to a new
  32183. * `accumulator` object which is the result of running each of its own
  32184. * enumerable string keyed properties thru `iteratee`, with each invocation
  32185. * potentially mutating the `accumulator` object. If `accumulator` is not
  32186. * provided, a new object with the same `[[Prototype]]` will be used. The
  32187. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  32188. * Iteratee functions may exit iteration early by explicitly returning `false`.
  32189. *
  32190. * @static
  32191. * @memberOf _
  32192. * @since 1.3.0
  32193. * @category Object
  32194. * @param {Object} object The object to iterate over.
  32195. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  32196. * @param {*} [accumulator] The custom accumulator value.
  32197. * @returns {*} Returns the accumulated value.
  32198. * @example
  32199. *
  32200. * _.transform([2, 3, 4], function(result, n) {
  32201. * result.push(n *= n);
  32202. * return n % 2 == 0;
  32203. * }, []);
  32204. * // => [4, 9]
  32205. *
  32206. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  32207. * (result[value] || (result[value] = [])).push(key);
  32208. * }, {});
  32209. * // => { '1': ['a', 'c'], '2': ['b'] }
  32210. */
  32211. function transform(object, iteratee, accumulator) {
  32212. var isArr = isArray(object),
  32213. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  32214. iteratee = getIteratee(iteratee, 4);
  32215. if (accumulator == null) {
  32216. var Ctor = object && object.constructor;
  32217. if (isArrLike) {
  32218. accumulator = isArr ? new Ctor : [];
  32219. }
  32220. else if (isObject(object)) {
  32221. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  32222. }
  32223. else {
  32224. accumulator = {};
  32225. }
  32226. }
  32227. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  32228. return iteratee(accumulator, value, index, object);
  32229. });
  32230. return accumulator;
  32231. }
  32232. /**
  32233. * Removes the property at `path` of `object`.
  32234. *
  32235. * **Note:** This method mutates `object`.
  32236. *
  32237. * @static
  32238. * @memberOf _
  32239. * @since 4.0.0
  32240. * @category Object
  32241. * @param {Object} object The object to modify.
  32242. * @param {Array|string} path The path of the property to unset.
  32243. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  32244. * @example
  32245. *
  32246. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  32247. * _.unset(object, 'a[0].b.c');
  32248. * // => true
  32249. *
  32250. * console.log(object);
  32251. * // => { 'a': [{ 'b': {} }] };
  32252. *
  32253. * _.unset(object, ['a', '0', 'b', 'c']);
  32254. * // => true
  32255. *
  32256. * console.log(object);
  32257. * // => { 'a': [{ 'b': {} }] };
  32258. */
  32259. function unset(object, path) {
  32260. return object == null ? true : baseUnset(object, path);
  32261. }
  32262. /**
  32263. * This method is like `_.set` except that accepts `updater` to produce the
  32264. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  32265. * is invoked with one argument: (value).
  32266. *
  32267. * **Note:** This method mutates `object`.
  32268. *
  32269. * @static
  32270. * @memberOf _
  32271. * @since 4.6.0
  32272. * @category Object
  32273. * @param {Object} object The object to modify.
  32274. * @param {Array|string} path The path of the property to set.
  32275. * @param {Function} updater The function to produce the updated value.
  32276. * @returns {Object} Returns `object`.
  32277. * @example
  32278. *
  32279. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  32280. *
  32281. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  32282. * console.log(object.a[0].b.c);
  32283. * // => 9
  32284. *
  32285. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  32286. * console.log(object.x[0].y.z);
  32287. * // => 0
  32288. */
  32289. function update(object, path, updater) {
  32290. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  32291. }
  32292. /**
  32293. * This method is like `_.update` except that it accepts `customizer` which is
  32294. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  32295. * path creation is handled by the method instead. The `customizer` is invoked
  32296. * with three arguments: (nsValue, key, nsObject).
  32297. *
  32298. * **Note:** This method mutates `object`.
  32299. *
  32300. * @static
  32301. * @memberOf _
  32302. * @since 4.6.0
  32303. * @category Object
  32304. * @param {Object} object The object to modify.
  32305. * @param {Array|string} path The path of the property to set.
  32306. * @param {Function} updater The function to produce the updated value.
  32307. * @param {Function} [customizer] The function to customize assigned values.
  32308. * @returns {Object} Returns `object`.
  32309. * @example
  32310. *
  32311. * var object = {};
  32312. *
  32313. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  32314. * // => { '0': { '1': 'a' } }
  32315. */
  32316. function updateWith(object, path, updater, customizer) {
  32317. customizer = typeof customizer == 'function' ? customizer : undefined;
  32318. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  32319. }
  32320. /**
  32321. * Creates an array of the own enumerable string keyed property values of `object`.
  32322. *
  32323. * **Note:** Non-object values are coerced to objects.
  32324. *
  32325. * @static
  32326. * @since 0.1.0
  32327. * @memberOf _
  32328. * @category Object
  32329. * @param {Object} object The object to query.
  32330. * @returns {Array} Returns the array of property values.
  32331. * @example
  32332. *
  32333. * function Foo() {
  32334. * this.a = 1;
  32335. * this.b = 2;
  32336. * }
  32337. *
  32338. * Foo.prototype.c = 3;
  32339. *
  32340. * _.values(new Foo);
  32341. * // => [1, 2] (iteration order is not guaranteed)
  32342. *
  32343. * _.values('hi');
  32344. * // => ['h', 'i']
  32345. */
  32346. function values(object) {
  32347. return object == null ? [] : baseValues(object, keys(object));
  32348. }
  32349. /**
  32350. * Creates an array of the own and inherited enumerable string keyed property
  32351. * values of `object`.
  32352. *
  32353. * **Note:** Non-object values are coerced to objects.
  32354. *
  32355. * @static
  32356. * @memberOf _
  32357. * @since 3.0.0
  32358. * @category Object
  32359. * @param {Object} object The object to query.
  32360. * @returns {Array} Returns the array of property values.
  32361. * @example
  32362. *
  32363. * function Foo() {
  32364. * this.a = 1;
  32365. * this.b = 2;
  32366. * }
  32367. *
  32368. * Foo.prototype.c = 3;
  32369. *
  32370. * _.valuesIn(new Foo);
  32371. * // => [1, 2, 3] (iteration order is not guaranteed)
  32372. */
  32373. function valuesIn(object) {
  32374. return object == null ? [] : baseValues(object, keysIn(object));
  32375. }
  32376. /*------------------------------------------------------------------------*/
  32377. /**
  32378. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  32379. *
  32380. * @static
  32381. * @memberOf _
  32382. * @since 4.0.0
  32383. * @category Number
  32384. * @param {number} number The number to clamp.
  32385. * @param {number} [lower] The lower bound.
  32386. * @param {number} upper The upper bound.
  32387. * @returns {number} Returns the clamped number.
  32388. * @example
  32389. *
  32390. * _.clamp(-10, -5, 5);
  32391. * // => -5
  32392. *
  32393. * _.clamp(10, -5, 5);
  32394. * // => 5
  32395. */
  32396. function clamp(number, lower, upper) {
  32397. if (upper === undefined) {
  32398. upper = lower;
  32399. lower = undefined;
  32400. }
  32401. if (upper !== undefined) {
  32402. upper = toNumber(upper);
  32403. upper = upper === upper ? upper : 0;
  32404. }
  32405. if (lower !== undefined) {
  32406. lower = toNumber(lower);
  32407. lower = lower === lower ? lower : 0;
  32408. }
  32409. return baseClamp(toNumber(number), lower, upper);
  32410. }
  32411. /**
  32412. * Checks if `n` is between `start` and up to, but not including, `end`. If
  32413. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  32414. * If `start` is greater than `end` the params are swapped to support
  32415. * negative ranges.
  32416. *
  32417. * @static
  32418. * @memberOf _
  32419. * @since 3.3.0
  32420. * @category Number
  32421. * @param {number} number The number to check.
  32422. * @param {number} [start=0] The start of the range.
  32423. * @param {number} end The end of the range.
  32424. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  32425. * @see _.range, _.rangeRight
  32426. * @example
  32427. *
  32428. * _.inRange(3, 2, 4);
  32429. * // => true
  32430. *
  32431. * _.inRange(4, 8);
  32432. * // => true
  32433. *
  32434. * _.inRange(4, 2);
  32435. * // => false
  32436. *
  32437. * _.inRange(2, 2);
  32438. * // => false
  32439. *
  32440. * _.inRange(1.2, 2);
  32441. * // => true
  32442. *
  32443. * _.inRange(5.2, 4);
  32444. * // => false
  32445. *
  32446. * _.inRange(-3, -2, -6);
  32447. * // => true
  32448. */
  32449. function inRange(number, start, end) {
  32450. start = toFinite(start);
  32451. if (end === undefined) {
  32452. end = start;
  32453. start = 0;
  32454. } else {
  32455. end = toFinite(end);
  32456. }
  32457. number = toNumber(number);
  32458. return baseInRange(number, start, end);
  32459. }
  32460. /**
  32461. * Produces a random number between the inclusive `lower` and `upper` bounds.
  32462. * If only one argument is provided a number between `0` and the given number
  32463. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  32464. * floats, a floating-point number is returned instead of an integer.
  32465. *
  32466. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32467. * floating-point values which can produce unexpected results.
  32468. *
  32469. * @static
  32470. * @memberOf _
  32471. * @since 0.7.0
  32472. * @category Number
  32473. * @param {number} [lower=0] The lower bound.
  32474. * @param {number} [upper=1] The upper bound.
  32475. * @param {boolean} [floating] Specify returning a floating-point number.
  32476. * @returns {number} Returns the random number.
  32477. * @example
  32478. *
  32479. * _.random(0, 5);
  32480. * // => an integer between 0 and 5
  32481. *
  32482. * _.random(5);
  32483. * // => also an integer between 0 and 5
  32484. *
  32485. * _.random(5, true);
  32486. * // => a floating-point number between 0 and 5
  32487. *
  32488. * _.random(1.2, 5.2);
  32489. * // => a floating-point number between 1.2 and 5.2
  32490. */
  32491. function random(lower, upper, floating) {
  32492. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  32493. upper = floating = undefined;
  32494. }
  32495. if (floating === undefined) {
  32496. if (typeof upper == 'boolean') {
  32497. floating = upper;
  32498. upper = undefined;
  32499. }
  32500. else if (typeof lower == 'boolean') {
  32501. floating = lower;
  32502. lower = undefined;
  32503. }
  32504. }
  32505. if (lower === undefined && upper === undefined) {
  32506. lower = 0;
  32507. upper = 1;
  32508. }
  32509. else {
  32510. lower = toFinite(lower);
  32511. if (upper === undefined) {
  32512. upper = lower;
  32513. lower = 0;
  32514. } else {
  32515. upper = toFinite(upper);
  32516. }
  32517. }
  32518. if (lower > upper) {
  32519. var temp = lower;
  32520. lower = upper;
  32521. upper = temp;
  32522. }
  32523. if (floating || lower % 1 || upper % 1) {
  32524. var rand = nativeRandom();
  32525. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  32526. }
  32527. return baseRandom(lower, upper);
  32528. }
  32529. /*------------------------------------------------------------------------*/
  32530. /**
  32531. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  32532. *
  32533. * @static
  32534. * @memberOf _
  32535. * @since 3.0.0
  32536. * @category String
  32537. * @param {string} [string=''] The string to convert.
  32538. * @returns {string} Returns the camel cased string.
  32539. * @example
  32540. *
  32541. * _.camelCase('Foo Bar');
  32542. * // => 'fooBar'
  32543. *
  32544. * _.camelCase('--foo-bar--');
  32545. * // => 'fooBar'
  32546. *
  32547. * _.camelCase('__FOO_BAR__');
  32548. * // => 'fooBar'
  32549. */
  32550. var camelCase = createCompounder(function(result, word, index) {
  32551. word = word.toLowerCase();
  32552. return result + (index ? capitalize(word) : word);
  32553. });
  32554. /**
  32555. * Converts the first character of `string` to upper case and the remaining
  32556. * to lower case.
  32557. *
  32558. * @static
  32559. * @memberOf _
  32560. * @since 3.0.0
  32561. * @category String
  32562. * @param {string} [string=''] The string to capitalize.
  32563. * @returns {string} Returns the capitalized string.
  32564. * @example
  32565. *
  32566. * _.capitalize('FRED');
  32567. * // => 'Fred'
  32568. */
  32569. function capitalize(string) {
  32570. return upperFirst(toString(string).toLowerCase());
  32571. }
  32572. /**
  32573. * Deburrs `string` by converting
  32574. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  32575. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  32576. * letters to basic Latin letters and removing
  32577. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  32578. *
  32579. * @static
  32580. * @memberOf _
  32581. * @since 3.0.0
  32582. * @category String
  32583. * @param {string} [string=''] The string to deburr.
  32584. * @returns {string} Returns the deburred string.
  32585. * @example
  32586. *
  32587. * _.deburr('déjà vu');
  32588. * // => 'deja vu'
  32589. */
  32590. function deburr(string) {
  32591. string = toString(string);
  32592. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  32593. }
  32594. /**
  32595. * Checks if `string` ends with the given target string.
  32596. *
  32597. * @static
  32598. * @memberOf _
  32599. * @since 3.0.0
  32600. * @category String
  32601. * @param {string} [string=''] The string to inspect.
  32602. * @param {string} [target] The string to search for.
  32603. * @param {number} [position=string.length] The position to search up to.
  32604. * @returns {boolean} Returns `true` if `string` ends with `target`,
  32605. * else `false`.
  32606. * @example
  32607. *
  32608. * _.endsWith('abc', 'c');
  32609. * // => true
  32610. *
  32611. * _.endsWith('abc', 'b');
  32612. * // => false
  32613. *
  32614. * _.endsWith('abc', 'b', 2);
  32615. * // => true
  32616. */
  32617. function endsWith(string, target, position) {
  32618. string = toString(string);
  32619. target = baseToString(target);
  32620. var length = string.length;
  32621. position = position === undefined
  32622. ? length
  32623. : baseClamp(toInteger(position), 0, length);
  32624. var end = position;
  32625. position -= target.length;
  32626. return position >= 0 && string.slice(position, end) == target;
  32627. }
  32628. /**
  32629. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  32630. * corresponding HTML entities.
  32631. *
  32632. * **Note:** No other characters are escaped. To escape additional
  32633. * characters use a third-party library like [_he_](https://mths.be/he).
  32634. *
  32635. * Though the ">" character is escaped for symmetry, characters like
  32636. * ">" and "/" don't need escaping in HTML and have no special meaning
  32637. * unless they're part of a tag or unquoted attribute value. See
  32638. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  32639. * (under "semi-related fun fact") for more details.
  32640. *
  32641. * When working with HTML you should always
  32642. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  32643. * XSS vectors.
  32644. *
  32645. * @static
  32646. * @since 0.1.0
  32647. * @memberOf _
  32648. * @category String
  32649. * @param {string} [string=''] The string to escape.
  32650. * @returns {string} Returns the escaped string.
  32651. * @example
  32652. *
  32653. * _.escape('fred, barney, & pebbles');
  32654. * // => 'fred, barney, &amp; pebbles'
  32655. */
  32656. function escape(string) {
  32657. string = toString(string);
  32658. return (string && reHasUnescapedHtml.test(string))
  32659. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  32660. : string;
  32661. }
  32662. /**
  32663. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  32664. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  32665. *
  32666. * @static
  32667. * @memberOf _
  32668. * @since 3.0.0
  32669. * @category String
  32670. * @param {string} [string=''] The string to escape.
  32671. * @returns {string} Returns the escaped string.
  32672. * @example
  32673. *
  32674. * _.escapeRegExp('[lodash](https://lodash.com/)');
  32675. * // => '\[lodash\]\(https://lodash\.com/\)'
  32676. */
  32677. function escapeRegExp(string) {
  32678. string = toString(string);
  32679. return (string && reHasRegExpChar.test(string))
  32680. ? string.replace(reRegExpChar, '\\$&')
  32681. : string;
  32682. }
  32683. /**
  32684. * Converts `string` to
  32685. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  32686. *
  32687. * @static
  32688. * @memberOf _
  32689. * @since 3.0.0
  32690. * @category String
  32691. * @param {string} [string=''] The string to convert.
  32692. * @returns {string} Returns the kebab cased string.
  32693. * @example
  32694. *
  32695. * _.kebabCase('Foo Bar');
  32696. * // => 'foo-bar'
  32697. *
  32698. * _.kebabCase('fooBar');
  32699. * // => 'foo-bar'
  32700. *
  32701. * _.kebabCase('__FOO_BAR__');
  32702. * // => 'foo-bar'
  32703. */
  32704. var kebabCase = createCompounder(function(result, word, index) {
  32705. return result + (index ? '-' : '') + word.toLowerCase();
  32706. });
  32707. /**
  32708. * Converts `string`, as space separated words, to lower case.
  32709. *
  32710. * @static
  32711. * @memberOf _
  32712. * @since 4.0.0
  32713. * @category String
  32714. * @param {string} [string=''] The string to convert.
  32715. * @returns {string} Returns the lower cased string.
  32716. * @example
  32717. *
  32718. * _.lowerCase('--Foo-Bar--');
  32719. * // => 'foo bar'
  32720. *
  32721. * _.lowerCase('fooBar');
  32722. * // => 'foo bar'
  32723. *
  32724. * _.lowerCase('__FOO_BAR__');
  32725. * // => 'foo bar'
  32726. */
  32727. var lowerCase = createCompounder(function(result, word, index) {
  32728. return result + (index ? ' ' : '') + word.toLowerCase();
  32729. });
  32730. /**
  32731. * Converts the first character of `string` to lower case.
  32732. *
  32733. * @static
  32734. * @memberOf _
  32735. * @since 4.0.0
  32736. * @category String
  32737. * @param {string} [string=''] The string to convert.
  32738. * @returns {string} Returns the converted string.
  32739. * @example
  32740. *
  32741. * _.lowerFirst('Fred');
  32742. * // => 'fred'
  32743. *
  32744. * _.lowerFirst('FRED');
  32745. * // => 'fRED'
  32746. */
  32747. var lowerFirst = createCaseFirst('toLowerCase');
  32748. /**
  32749. * Pads `string` on the left and right sides if it's shorter than `length`.
  32750. * Padding characters are truncated if they can't be evenly divided by `length`.
  32751. *
  32752. * @static
  32753. * @memberOf _
  32754. * @since 3.0.0
  32755. * @category String
  32756. * @param {string} [string=''] The string to pad.
  32757. * @param {number} [length=0] The padding length.
  32758. * @param {string} [chars=' '] The string used as padding.
  32759. * @returns {string} Returns the padded string.
  32760. * @example
  32761. *
  32762. * _.pad('abc', 8);
  32763. * // => ' abc '
  32764. *
  32765. * _.pad('abc', 8, '_-');
  32766. * // => '_-abc_-_'
  32767. *
  32768. * _.pad('abc', 3);
  32769. * // => 'abc'
  32770. */
  32771. function pad(string, length, chars) {
  32772. string = toString(string);
  32773. length = toInteger(length);
  32774. var strLength = length ? stringSize(string) : 0;
  32775. if (!length || strLength >= length) {
  32776. return string;
  32777. }
  32778. var mid = (length - strLength) / 2;
  32779. return (
  32780. createPadding(nativeFloor(mid), chars) +
  32781. string +
  32782. createPadding(nativeCeil(mid), chars)
  32783. );
  32784. }
  32785. /**
  32786. * Pads `string` on the right side if it's shorter than `length`. Padding
  32787. * characters are truncated if they exceed `length`.
  32788. *
  32789. * @static
  32790. * @memberOf _
  32791. * @since 4.0.0
  32792. * @category String
  32793. * @param {string} [string=''] The string to pad.
  32794. * @param {number} [length=0] The padding length.
  32795. * @param {string} [chars=' '] The string used as padding.
  32796. * @returns {string} Returns the padded string.
  32797. * @example
  32798. *
  32799. * _.padEnd('abc', 6);
  32800. * // => 'abc '
  32801. *
  32802. * _.padEnd('abc', 6, '_-');
  32803. * // => 'abc_-_'
  32804. *
  32805. * _.padEnd('abc', 3);
  32806. * // => 'abc'
  32807. */
  32808. function padEnd(string, length, chars) {
  32809. string = toString(string);
  32810. length = toInteger(length);
  32811. var strLength = length ? stringSize(string) : 0;
  32812. return (length && strLength < length)
  32813. ? (string + createPadding(length - strLength, chars))
  32814. : string;
  32815. }
  32816. /**
  32817. * Pads `string` on the left side if it's shorter than `length`. Padding
  32818. * characters are truncated if they exceed `length`.
  32819. *
  32820. * @static
  32821. * @memberOf _
  32822. * @since 4.0.0
  32823. * @category String
  32824. * @param {string} [string=''] The string to pad.
  32825. * @param {number} [length=0] The padding length.
  32826. * @param {string} [chars=' '] The string used as padding.
  32827. * @returns {string} Returns the padded string.
  32828. * @example
  32829. *
  32830. * _.padStart('abc', 6);
  32831. * // => ' abc'
  32832. *
  32833. * _.padStart('abc', 6, '_-');
  32834. * // => '_-_abc'
  32835. *
  32836. * _.padStart('abc', 3);
  32837. * // => 'abc'
  32838. */
  32839. function padStart(string, length, chars) {
  32840. string = toString(string);
  32841. length = toInteger(length);
  32842. var strLength = length ? stringSize(string) : 0;
  32843. return (length && strLength < length)
  32844. ? (createPadding(length - strLength, chars) + string)
  32845. : string;
  32846. }
  32847. /**
  32848. * Converts `string` to an integer of the specified radix. If `radix` is
  32849. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  32850. * hexadecimal, in which case a `radix` of `16` is used.
  32851. *
  32852. * **Note:** This method aligns with the
  32853. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  32854. *
  32855. * @static
  32856. * @memberOf _
  32857. * @since 1.1.0
  32858. * @category String
  32859. * @param {string} string The string to convert.
  32860. * @param {number} [radix=10] The radix to interpret `value` by.
  32861. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32862. * @returns {number} Returns the converted integer.
  32863. * @example
  32864. *
  32865. * _.parseInt('08');
  32866. * // => 8
  32867. *
  32868. * _.map(['6', '08', '10'], _.parseInt);
  32869. * // => [6, 8, 10]
  32870. */
  32871. function parseInt(string, radix, guard) {
  32872. if (guard || radix == null) {
  32873. radix = 0;
  32874. } else if (radix) {
  32875. radix = +radix;
  32876. }
  32877. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  32878. }
  32879. /**
  32880. * Repeats the given string `n` times.
  32881. *
  32882. * @static
  32883. * @memberOf _
  32884. * @since 3.0.0
  32885. * @category String
  32886. * @param {string} [string=''] The string to repeat.
  32887. * @param {number} [n=1] The number of times to repeat the string.
  32888. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32889. * @returns {string} Returns the repeated string.
  32890. * @example
  32891. *
  32892. * _.repeat('*', 3);
  32893. * // => '***'
  32894. *
  32895. * _.repeat('abc', 2);
  32896. * // => 'abcabc'
  32897. *
  32898. * _.repeat('abc', 0);
  32899. * // => ''
  32900. */
  32901. function repeat(string, n, guard) {
  32902. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  32903. n = 1;
  32904. } else {
  32905. n = toInteger(n);
  32906. }
  32907. return baseRepeat(toString(string), n);
  32908. }
  32909. /**
  32910. * Replaces matches for `pattern` in `string` with `replacement`.
  32911. *
  32912. * **Note:** This method is based on
  32913. * [`String#replace`](https://mdn.io/String/replace).
  32914. *
  32915. * @static
  32916. * @memberOf _
  32917. * @since 4.0.0
  32918. * @category String
  32919. * @param {string} [string=''] The string to modify.
  32920. * @param {RegExp|string} pattern The pattern to replace.
  32921. * @param {Function|string} replacement The match replacement.
  32922. * @returns {string} Returns the modified string.
  32923. * @example
  32924. *
  32925. * _.replace('Hi Fred', 'Fred', 'Barney');
  32926. * // => 'Hi Barney'
  32927. */
  32928. function replace() {
  32929. var args = arguments,
  32930. string = toString(args[0]);
  32931. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32932. }
  32933. /**
  32934. * Converts `string` to
  32935. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32936. *
  32937. * @static
  32938. * @memberOf _
  32939. * @since 3.0.0
  32940. * @category String
  32941. * @param {string} [string=''] The string to convert.
  32942. * @returns {string} Returns the snake cased string.
  32943. * @example
  32944. *
  32945. * _.snakeCase('Foo Bar');
  32946. * // => 'foo_bar'
  32947. *
  32948. * _.snakeCase('fooBar');
  32949. * // => 'foo_bar'
  32950. *
  32951. * _.snakeCase('--FOO-BAR--');
  32952. * // => 'foo_bar'
  32953. */
  32954. var snakeCase = createCompounder(function(result, word, index) {
  32955. return result + (index ? '_' : '') + word.toLowerCase();
  32956. });
  32957. /**
  32958. * Splits `string` by `separator`.
  32959. *
  32960. * **Note:** This method is based on
  32961. * [`String#split`](https://mdn.io/String/split).
  32962. *
  32963. * @static
  32964. * @memberOf _
  32965. * @since 4.0.0
  32966. * @category String
  32967. * @param {string} [string=''] The string to split.
  32968. * @param {RegExp|string} separator The separator pattern to split by.
  32969. * @param {number} [limit] The length to truncate results to.
  32970. * @returns {Array} Returns the string segments.
  32971. * @example
  32972. *
  32973. * _.split('a-b-c', '-', 2);
  32974. * // => ['a', 'b']
  32975. */
  32976. function split(string, separator, limit) {
  32977. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32978. separator = limit = undefined;
  32979. }
  32980. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32981. if (!limit) {
  32982. return [];
  32983. }
  32984. string = toString(string);
  32985. if (string && (
  32986. typeof separator == 'string' ||
  32987. (separator != null && !isRegExp(separator))
  32988. )) {
  32989. separator = baseToString(separator);
  32990. if (!separator && hasUnicode(string)) {
  32991. return castSlice(stringToArray(string), 0, limit);
  32992. }
  32993. }
  32994. return string.split(separator, limit);
  32995. }
  32996. /**
  32997. * Converts `string` to
  32998. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32999. *
  33000. * @static
  33001. * @memberOf _
  33002. * @since 3.1.0
  33003. * @category String
  33004. * @param {string} [string=''] The string to convert.
  33005. * @returns {string} Returns the start cased string.
  33006. * @example
  33007. *
  33008. * _.startCase('--foo-bar--');
  33009. * // => 'Foo Bar'
  33010. *
  33011. * _.startCase('fooBar');
  33012. * // => 'Foo Bar'
  33013. *
  33014. * _.startCase('__FOO_BAR__');
  33015. * // => 'FOO BAR'
  33016. */
  33017. var startCase = createCompounder(function(result, word, index) {
  33018. return result + (index ? ' ' : '') + upperFirst(word);
  33019. });
  33020. /**
  33021. * Checks if `string` starts with the given target string.
  33022. *
  33023. * @static
  33024. * @memberOf _
  33025. * @since 3.0.0
  33026. * @category String
  33027. * @param {string} [string=''] The string to inspect.
  33028. * @param {string} [target] The string to search for.
  33029. * @param {number} [position=0] The position to search from.
  33030. * @returns {boolean} Returns `true` if `string` starts with `target`,
  33031. * else `false`.
  33032. * @example
  33033. *
  33034. * _.startsWith('abc', 'a');
  33035. * // => true
  33036. *
  33037. * _.startsWith('abc', 'b');
  33038. * // => false
  33039. *
  33040. * _.startsWith('abc', 'b', 1);
  33041. * // => true
  33042. */
  33043. function startsWith(string, target, position) {
  33044. string = toString(string);
  33045. position = position == null
  33046. ? 0
  33047. : baseClamp(toInteger(position), 0, string.length);
  33048. target = baseToString(target);
  33049. return string.slice(position, position + target.length) == target;
  33050. }
  33051. /**
  33052. * Creates a compiled template function that can interpolate data properties
  33053. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  33054. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  33055. * properties may be accessed as free variables in the template. If a setting
  33056. * object is given, it takes precedence over `_.templateSettings` values.
  33057. *
  33058. * **Note:** In the development build `_.template` utilizes
  33059. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  33060. * for easier debugging.
  33061. *
  33062. * For more information on precompiling templates see
  33063. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  33064. *
  33065. * For more information on Chrome extension sandboxes see
  33066. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  33067. *
  33068. * @static
  33069. * @since 0.1.0
  33070. * @memberOf _
  33071. * @category String
  33072. * @param {string} [string=''] The template string.
  33073. * @param {Object} [options={}] The options object.
  33074. * @param {RegExp} [options.escape=_.templateSettings.escape]
  33075. * The HTML "escape" delimiter.
  33076. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  33077. * The "evaluate" delimiter.
  33078. * @param {Object} [options.imports=_.templateSettings.imports]
  33079. * An object to import into the template as free variables.
  33080. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  33081. * The "interpolate" delimiter.
  33082. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  33083. * The sourceURL of the compiled template.
  33084. * @param {string} [options.variable='obj']
  33085. * The data object variable name.
  33086. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33087. * @returns {Function} Returns the compiled template function.
  33088. * @example
  33089. *
  33090. * // Use the "interpolate" delimiter to create a compiled template.
  33091. * var compiled = _.template('hello <%= user %>!');
  33092. * compiled({ 'user': 'fred' });
  33093. * // => 'hello fred!'
  33094. *
  33095. * // Use the HTML "escape" delimiter to escape data property values.
  33096. * var compiled = _.template('<b><%- value %></b>');
  33097. * compiled({ 'value': '<script>' });
  33098. * // => '<b>&lt;script&gt;</b>'
  33099. *
  33100. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  33101. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  33102. * compiled({ 'users': ['fred', 'barney'] });
  33103. * // => '<li>fred</li><li>barney</li>'
  33104. *
  33105. * // Use the internal `print` function in "evaluate" delimiters.
  33106. * var compiled = _.template('<% print("hello " + user); %>!');
  33107. * compiled({ 'user': 'barney' });
  33108. * // => 'hello barney!'
  33109. *
  33110. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  33111. * // Disable support by replacing the "interpolate" delimiter.
  33112. * var compiled = _.template('hello ${ user }!');
  33113. * compiled({ 'user': 'pebbles' });
  33114. * // => 'hello pebbles!'
  33115. *
  33116. * // Use backslashes to treat delimiters as plain text.
  33117. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  33118. * compiled({ 'value': 'ignored' });
  33119. * // => '<%- value %>'
  33120. *
  33121. * // Use the `imports` option to import `jQuery` as `jq`.
  33122. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  33123. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  33124. * compiled({ 'users': ['fred', 'barney'] });
  33125. * // => '<li>fred</li><li>barney</li>'
  33126. *
  33127. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  33128. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  33129. * compiled(data);
  33130. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  33131. *
  33132. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  33133. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  33134. * compiled.source;
  33135. * // => function(data) {
  33136. * // var __t, __p = '';
  33137. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  33138. * // return __p;
  33139. * // }
  33140. *
  33141. * // Use custom template delimiters.
  33142. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  33143. * var compiled = _.template('hello {{ user }}!');
  33144. * compiled({ 'user': 'mustache' });
  33145. * // => 'hello mustache!'
  33146. *
  33147. * // Use the `source` property to inline compiled templates for meaningful
  33148. * // line numbers in error messages and stack traces.
  33149. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  33150. * var JST = {\
  33151. * "main": ' + _.template(mainText).source + '\
  33152. * };\
  33153. * ');
  33154. */
  33155. function template(string, options, guard) {
  33156. // Based on John Resig's `tmpl` implementation
  33157. // (http://ejohn.org/blog/javascript-micro-templating/)
  33158. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  33159. var settings = lodash.templateSettings;
  33160. if (guard && isIterateeCall(string, options, guard)) {
  33161. options = undefined;
  33162. }
  33163. string = toString(string);
  33164. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  33165. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  33166. importsKeys = keys(imports),
  33167. importsValues = baseValues(imports, importsKeys);
  33168. var isEscaping,
  33169. isEvaluating,
  33170. index = 0,
  33171. interpolate = options.interpolate || reNoMatch,
  33172. source = "__p += '";
  33173. // Compile the regexp to match each delimiter.
  33174. var reDelimiters = RegExp(
  33175. (options.escape || reNoMatch).source + '|' +
  33176. interpolate.source + '|' +
  33177. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  33178. (options.evaluate || reNoMatch).source + '|$'
  33179. , 'g');
  33180. // Use a sourceURL for easier debugging.
  33181. // The sourceURL gets injected into the source that's eval-ed, so be careful
  33182. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  33183. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  33184. var sourceURL = '//# sourceURL=' +
  33185. (hasOwnProperty.call(options, 'sourceURL')
  33186. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  33187. : ('lodash.templateSources[' + (++templateCounter) + ']')
  33188. ) + '\n';
  33189. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  33190. interpolateValue || (interpolateValue = esTemplateValue);
  33191. // Escape characters that can't be included in string literals.
  33192. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  33193. // Replace delimiters with snippets.
  33194. if (escapeValue) {
  33195. isEscaping = true;
  33196. source += "' +\n__e(" + escapeValue + ") +\n'";
  33197. }
  33198. if (evaluateValue) {
  33199. isEvaluating = true;
  33200. source += "';\n" + evaluateValue + ";\n__p += '";
  33201. }
  33202. if (interpolateValue) {
  33203. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  33204. }
  33205. index = offset + match.length;
  33206. // The JS engine embedded in Adobe products needs `match` returned in
  33207. // order to produce the correct `offset` value.
  33208. return match;
  33209. });
  33210. source += "';\n";
  33211. // If `variable` is not specified wrap a with-statement around the generated
  33212. // code to add the data object to the top of the scope chain.
  33213. // Like with sourceURL, we take care to not check the option's prototype,
  33214. // as this configuration is a code injection vector.
  33215. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  33216. if (!variable) {
  33217. source = 'with (obj) {\n' + source + '\n}\n';
  33218. }
  33219. // Cleanup code by stripping empty strings.
  33220. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  33221. .replace(reEmptyStringMiddle, '$1')
  33222. .replace(reEmptyStringTrailing, '$1;');
  33223. // Frame code as the function body.
  33224. source = 'function(' + (variable || 'obj') + ') {\n' +
  33225. (variable
  33226. ? ''
  33227. : 'obj || (obj = {});\n'
  33228. ) +
  33229. "var __t, __p = ''" +
  33230. (isEscaping
  33231. ? ', __e = _.escape'
  33232. : ''
  33233. ) +
  33234. (isEvaluating
  33235. ? ', __j = Array.prototype.join;\n' +
  33236. "function print() { __p += __j.call(arguments, '') }\n"
  33237. : ';\n'
  33238. ) +
  33239. source +
  33240. 'return __p\n}';
  33241. var result = attempt(function() {
  33242. return Function(importsKeys, sourceURL + 'return ' + source)
  33243. .apply(undefined, importsValues);
  33244. });
  33245. // Provide the compiled function's source by its `toString` method or
  33246. // the `source` property as a convenience for inlining compiled templates.
  33247. result.source = source;
  33248. if (isError(result)) {
  33249. throw result;
  33250. }
  33251. return result;
  33252. }
  33253. /**
  33254. * Converts `string`, as a whole, to lower case just like
  33255. * [String#toLowerCase](https://mdn.io/toLowerCase).
  33256. *
  33257. * @static
  33258. * @memberOf _
  33259. * @since 4.0.0
  33260. * @category String
  33261. * @param {string} [string=''] The string to convert.
  33262. * @returns {string} Returns the lower cased string.
  33263. * @example
  33264. *
  33265. * _.toLower('--Foo-Bar--');
  33266. * // => '--foo-bar--'
  33267. *
  33268. * _.toLower('fooBar');
  33269. * // => 'foobar'
  33270. *
  33271. * _.toLower('__FOO_BAR__');
  33272. * // => '__foo_bar__'
  33273. */
  33274. function toLower(value) {
  33275. return toString(value).toLowerCase();
  33276. }
  33277. /**
  33278. * Converts `string`, as a whole, to upper case just like
  33279. * [String#toUpperCase](https://mdn.io/toUpperCase).
  33280. *
  33281. * @static
  33282. * @memberOf _
  33283. * @since 4.0.0
  33284. * @category String
  33285. * @param {string} [string=''] The string to convert.
  33286. * @returns {string} Returns the upper cased string.
  33287. * @example
  33288. *
  33289. * _.toUpper('--foo-bar--');
  33290. * // => '--FOO-BAR--'
  33291. *
  33292. * _.toUpper('fooBar');
  33293. * // => 'FOOBAR'
  33294. *
  33295. * _.toUpper('__foo_bar__');
  33296. * // => '__FOO_BAR__'
  33297. */
  33298. function toUpper(value) {
  33299. return toString(value).toUpperCase();
  33300. }
  33301. /**
  33302. * Removes leading and trailing whitespace or specified characters from `string`.
  33303. *
  33304. * @static
  33305. * @memberOf _
  33306. * @since 3.0.0
  33307. * @category String
  33308. * @param {string} [string=''] The string to trim.
  33309. * @param {string} [chars=whitespace] The characters to trim.
  33310. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33311. * @returns {string} Returns the trimmed string.
  33312. * @example
  33313. *
  33314. * _.trim(' abc ');
  33315. * // => 'abc'
  33316. *
  33317. * _.trim('-_-abc-_-', '_-');
  33318. * // => 'abc'
  33319. *
  33320. * _.map([' foo ', ' bar '], _.trim);
  33321. * // => ['foo', 'bar']
  33322. */
  33323. function trim(string, chars, guard) {
  33324. string = toString(string);
  33325. if (string && (guard || chars === undefined)) {
  33326. return string.replace(reTrim, '');
  33327. }
  33328. if (!string || !(chars = baseToString(chars))) {
  33329. return string;
  33330. }
  33331. var strSymbols = stringToArray(string),
  33332. chrSymbols = stringToArray(chars),
  33333. start = charsStartIndex(strSymbols, chrSymbols),
  33334. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  33335. return castSlice(strSymbols, start, end).join('');
  33336. }
  33337. /**
  33338. * Removes trailing whitespace or specified characters from `string`.
  33339. *
  33340. * @static
  33341. * @memberOf _
  33342. * @since 4.0.0
  33343. * @category String
  33344. * @param {string} [string=''] The string to trim.
  33345. * @param {string} [chars=whitespace] The characters to trim.
  33346. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33347. * @returns {string} Returns the trimmed string.
  33348. * @example
  33349. *
  33350. * _.trimEnd(' abc ');
  33351. * // => ' abc'
  33352. *
  33353. * _.trimEnd('-_-abc-_-', '_-');
  33354. * // => '-_-abc'
  33355. */
  33356. function trimEnd(string, chars, guard) {
  33357. string = toString(string);
  33358. if (string && (guard || chars === undefined)) {
  33359. return string.replace(reTrimEnd, '');
  33360. }
  33361. if (!string || !(chars = baseToString(chars))) {
  33362. return string;
  33363. }
  33364. var strSymbols = stringToArray(string),
  33365. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  33366. return castSlice(strSymbols, 0, end).join('');
  33367. }
  33368. /**
  33369. * Removes leading whitespace or specified characters from `string`.
  33370. *
  33371. * @static
  33372. * @memberOf _
  33373. * @since 4.0.0
  33374. * @category String
  33375. * @param {string} [string=''] The string to trim.
  33376. * @param {string} [chars=whitespace] The characters to trim.
  33377. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33378. * @returns {string} Returns the trimmed string.
  33379. * @example
  33380. *
  33381. * _.trimStart(' abc ');
  33382. * // => 'abc '
  33383. *
  33384. * _.trimStart('-_-abc-_-', '_-');
  33385. * // => 'abc-_-'
  33386. */
  33387. function trimStart(string, chars, guard) {
  33388. string = toString(string);
  33389. if (string && (guard || chars === undefined)) {
  33390. return string.replace(reTrimStart, '');
  33391. }
  33392. if (!string || !(chars = baseToString(chars))) {
  33393. return string;
  33394. }
  33395. var strSymbols = stringToArray(string),
  33396. start = charsStartIndex(strSymbols, stringToArray(chars));
  33397. return castSlice(strSymbols, start).join('');
  33398. }
  33399. /**
  33400. * Truncates `string` if it's longer than the given maximum string length.
  33401. * The last characters of the truncated string are replaced with the omission
  33402. * string which defaults to "...".
  33403. *
  33404. * @static
  33405. * @memberOf _
  33406. * @since 4.0.0
  33407. * @category String
  33408. * @param {string} [string=''] The string to truncate.
  33409. * @param {Object} [options={}] The options object.
  33410. * @param {number} [options.length=30] The maximum string length.
  33411. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  33412. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  33413. * @returns {string} Returns the truncated string.
  33414. * @example
  33415. *
  33416. * _.truncate('hi-diddly-ho there, neighborino');
  33417. * // => 'hi-diddly-ho there, neighbo...'
  33418. *
  33419. * _.truncate('hi-diddly-ho there, neighborino', {
  33420. * 'length': 24,
  33421. * 'separator': ' '
  33422. * });
  33423. * // => 'hi-diddly-ho there,...'
  33424. *
  33425. * _.truncate('hi-diddly-ho there, neighborino', {
  33426. * 'length': 24,
  33427. * 'separator': /,? +/
  33428. * });
  33429. * // => 'hi-diddly-ho there...'
  33430. *
  33431. * _.truncate('hi-diddly-ho there, neighborino', {
  33432. * 'omission': ' [...]'
  33433. * });
  33434. * // => 'hi-diddly-ho there, neig [...]'
  33435. */
  33436. function truncate(string, options) {
  33437. var length = DEFAULT_TRUNC_LENGTH,
  33438. omission = DEFAULT_TRUNC_OMISSION;
  33439. if (isObject(options)) {
  33440. var separator = 'separator' in options ? options.separator : separator;
  33441. length = 'length' in options ? toInteger(options.length) : length;
  33442. omission = 'omission' in options ? baseToString(options.omission) : omission;
  33443. }
  33444. string = toString(string);
  33445. var strLength = string.length;
  33446. if (hasUnicode(string)) {
  33447. var strSymbols = stringToArray(string);
  33448. strLength = strSymbols.length;
  33449. }
  33450. if (length >= strLength) {
  33451. return string;
  33452. }
  33453. var end = length - stringSize(omission);
  33454. if (end < 1) {
  33455. return omission;
  33456. }
  33457. var result = strSymbols
  33458. ? castSlice(strSymbols, 0, end).join('')
  33459. : string.slice(0, end);
  33460. if (separator === undefined) {
  33461. return result + omission;
  33462. }
  33463. if (strSymbols) {
  33464. end += (result.length - end);
  33465. }
  33466. if (isRegExp(separator)) {
  33467. if (string.slice(end).search(separator)) {
  33468. var match,
  33469. substring = result;
  33470. if (!separator.global) {
  33471. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  33472. }
  33473. separator.lastIndex = 0;
  33474. while ((match = separator.exec(substring))) {
  33475. var newEnd = match.index;
  33476. }
  33477. result = result.slice(0, newEnd === undefined ? end : newEnd);
  33478. }
  33479. } else if (string.indexOf(baseToString(separator), end) != end) {
  33480. var index = result.lastIndexOf(separator);
  33481. if (index > -1) {
  33482. result = result.slice(0, index);
  33483. }
  33484. }
  33485. return result + omission;
  33486. }
  33487. /**
  33488. * The inverse of `_.escape`; this method converts the HTML entities
  33489. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  33490. * their corresponding characters.
  33491. *
  33492. * **Note:** No other HTML entities are unescaped. To unescape additional
  33493. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  33494. *
  33495. * @static
  33496. * @memberOf _
  33497. * @since 0.6.0
  33498. * @category String
  33499. * @param {string} [string=''] The string to unescape.
  33500. * @returns {string} Returns the unescaped string.
  33501. * @example
  33502. *
  33503. * _.unescape('fred, barney, &amp; pebbles');
  33504. * // => 'fred, barney, & pebbles'
  33505. */
  33506. function unescape(string) {
  33507. string = toString(string);
  33508. return (string && reHasEscapedHtml.test(string))
  33509. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  33510. : string;
  33511. }
  33512. /**
  33513. * Converts `string`, as space separated words, to upper case.
  33514. *
  33515. * @static
  33516. * @memberOf _
  33517. * @since 4.0.0
  33518. * @category String
  33519. * @param {string} [string=''] The string to convert.
  33520. * @returns {string} Returns the upper cased string.
  33521. * @example
  33522. *
  33523. * _.upperCase('--foo-bar');
  33524. * // => 'FOO BAR'
  33525. *
  33526. * _.upperCase('fooBar');
  33527. * // => 'FOO BAR'
  33528. *
  33529. * _.upperCase('__foo_bar__');
  33530. * // => 'FOO BAR'
  33531. */
  33532. var upperCase = createCompounder(function(result, word, index) {
  33533. return result + (index ? ' ' : '') + word.toUpperCase();
  33534. });
  33535. /**
  33536. * Converts the first character of `string` to upper case.
  33537. *
  33538. * @static
  33539. * @memberOf _
  33540. * @since 4.0.0
  33541. * @category String
  33542. * @param {string} [string=''] The string to convert.
  33543. * @returns {string} Returns the converted string.
  33544. * @example
  33545. *
  33546. * _.upperFirst('fred');
  33547. * // => 'Fred'
  33548. *
  33549. * _.upperFirst('FRED');
  33550. * // => 'FRED'
  33551. */
  33552. var upperFirst = createCaseFirst('toUpperCase');
  33553. /**
  33554. * Splits `string` into an array of its words.
  33555. *
  33556. * @static
  33557. * @memberOf _
  33558. * @since 3.0.0
  33559. * @category String
  33560. * @param {string} [string=''] The string to inspect.
  33561. * @param {RegExp|string} [pattern] The pattern to match words.
  33562. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33563. * @returns {Array} Returns the words of `string`.
  33564. * @example
  33565. *
  33566. * _.words('fred, barney, & pebbles');
  33567. * // => ['fred', 'barney', 'pebbles']
  33568. *
  33569. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  33570. * // => ['fred', 'barney', '&', 'pebbles']
  33571. */
  33572. function words(string, pattern, guard) {
  33573. string = toString(string);
  33574. pattern = guard ? undefined : pattern;
  33575. if (pattern === undefined) {
  33576. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  33577. }
  33578. return string.match(pattern) || [];
  33579. }
  33580. /*------------------------------------------------------------------------*/
  33581. /**
  33582. * Attempts to invoke `func`, returning either the result or the caught error
  33583. * object. Any additional arguments are provided to `func` when it's invoked.
  33584. *
  33585. * @static
  33586. * @memberOf _
  33587. * @since 3.0.0
  33588. * @category Util
  33589. * @param {Function} func The function to attempt.
  33590. * @param {...*} [args] The arguments to invoke `func` with.
  33591. * @returns {*} Returns the `func` result or error object.
  33592. * @example
  33593. *
  33594. * // Avoid throwing errors for invalid selectors.
  33595. * var elements = _.attempt(function(selector) {
  33596. * return document.querySelectorAll(selector);
  33597. * }, '>_>');
  33598. *
  33599. * if (_.isError(elements)) {
  33600. * elements = [];
  33601. * }
  33602. */
  33603. var attempt = baseRest(function(func, args) {
  33604. try {
  33605. return apply(func, undefined, args);
  33606. } catch (e) {
  33607. return isError(e) ? e : new Error(e);
  33608. }
  33609. });
  33610. /**
  33611. * Binds methods of an object to the object itself, overwriting the existing
  33612. * method.
  33613. *
  33614. * **Note:** This method doesn't set the "length" property of bound functions.
  33615. *
  33616. * @static
  33617. * @since 0.1.0
  33618. * @memberOf _
  33619. * @category Util
  33620. * @param {Object} object The object to bind and assign the bound methods to.
  33621. * @param {...(string|string[])} methodNames The object method names to bind.
  33622. * @returns {Object} Returns `object`.
  33623. * @example
  33624. *
  33625. * var view = {
  33626. * 'label': 'docs',
  33627. * 'click': function() {
  33628. * console.log('clicked ' + this.label);
  33629. * }
  33630. * };
  33631. *
  33632. * _.bindAll(view, ['click']);
  33633. * jQuery(element).on('click', view.click);
  33634. * // => Logs 'clicked docs' when clicked.
  33635. */
  33636. var bindAll = flatRest(function(object, methodNames) {
  33637. arrayEach(methodNames, function(key) {
  33638. key = toKey(key);
  33639. baseAssignValue(object, key, bind(object[key], object));
  33640. });
  33641. return object;
  33642. });
  33643. /**
  33644. * Creates a function that iterates over `pairs` and invokes the corresponding
  33645. * function of the first predicate to return truthy. The predicate-function
  33646. * pairs are invoked with the `this` binding and arguments of the created
  33647. * function.
  33648. *
  33649. * @static
  33650. * @memberOf _
  33651. * @since 4.0.0
  33652. * @category Util
  33653. * @param {Array} pairs The predicate-function pairs.
  33654. * @returns {Function} Returns the new composite function.
  33655. * @example
  33656. *
  33657. * var func = _.cond([
  33658. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  33659. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  33660. * [_.stubTrue, _.constant('no match')]
  33661. * ]);
  33662. *
  33663. * func({ 'a': 1, 'b': 2 });
  33664. * // => 'matches A'
  33665. *
  33666. * func({ 'a': 0, 'b': 1 });
  33667. * // => 'matches B'
  33668. *
  33669. * func({ 'a': '1', 'b': '2' });
  33670. * // => 'no match'
  33671. */
  33672. function cond(pairs) {
  33673. var length = pairs == null ? 0 : pairs.length,
  33674. toIteratee = getIteratee();
  33675. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  33676. if (typeof pair[1] != 'function') {
  33677. throw new TypeError(FUNC_ERROR_TEXT);
  33678. }
  33679. return [toIteratee(pair[0]), pair[1]];
  33680. });
  33681. return baseRest(function(args) {
  33682. var index = -1;
  33683. while (++index < length) {
  33684. var pair = pairs[index];
  33685. if (apply(pair[0], this, args)) {
  33686. return apply(pair[1], this, args);
  33687. }
  33688. }
  33689. });
  33690. }
  33691. /**
  33692. * Creates a function that invokes the predicate properties of `source` with
  33693. * the corresponding property values of a given object, returning `true` if
  33694. * all predicates return truthy, else `false`.
  33695. *
  33696. * **Note:** The created function is equivalent to `_.conformsTo` with
  33697. * `source` partially applied.
  33698. *
  33699. * @static
  33700. * @memberOf _
  33701. * @since 4.0.0
  33702. * @category Util
  33703. * @param {Object} source The object of property predicates to conform to.
  33704. * @returns {Function} Returns the new spec function.
  33705. * @example
  33706. *
  33707. * var objects = [
  33708. * { 'a': 2, 'b': 1 },
  33709. * { 'a': 1, 'b': 2 }
  33710. * ];
  33711. *
  33712. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  33713. * // => [{ 'a': 1, 'b': 2 }]
  33714. */
  33715. function conforms(source) {
  33716. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  33717. }
  33718. /**
  33719. * Creates a function that returns `value`.
  33720. *
  33721. * @static
  33722. * @memberOf _
  33723. * @since 2.4.0
  33724. * @category Util
  33725. * @param {*} value The value to return from the new function.
  33726. * @returns {Function} Returns the new constant function.
  33727. * @example
  33728. *
  33729. * var objects = _.times(2, _.constant({ 'a': 1 }));
  33730. *
  33731. * console.log(objects);
  33732. * // => [{ 'a': 1 }, { 'a': 1 }]
  33733. *
  33734. * console.log(objects[0] === objects[1]);
  33735. * // => true
  33736. */
  33737. function constant(value) {
  33738. return function() {
  33739. return value;
  33740. };
  33741. }
  33742. /**
  33743. * Checks `value` to determine whether a default value should be returned in
  33744. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  33745. * or `undefined`.
  33746. *
  33747. * @static
  33748. * @memberOf _
  33749. * @since 4.14.0
  33750. * @category Util
  33751. * @param {*} value The value to check.
  33752. * @param {*} defaultValue The default value.
  33753. * @returns {*} Returns the resolved value.
  33754. * @example
  33755. *
  33756. * _.defaultTo(1, 10);
  33757. * // => 1
  33758. *
  33759. * _.defaultTo(undefined, 10);
  33760. * // => 10
  33761. */
  33762. function defaultTo(value, defaultValue) {
  33763. return (value == null || value !== value) ? defaultValue : value;
  33764. }
  33765. /**
  33766. * Creates a function that returns the result of invoking the given functions
  33767. * with the `this` binding of the created function, where each successive
  33768. * invocation is supplied the return value of the previous.
  33769. *
  33770. * @static
  33771. * @memberOf _
  33772. * @since 3.0.0
  33773. * @category Util
  33774. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33775. * @returns {Function} Returns the new composite function.
  33776. * @see _.flowRight
  33777. * @example
  33778. *
  33779. * function square(n) {
  33780. * return n * n;
  33781. * }
  33782. *
  33783. * var addSquare = _.flow([_.add, square]);
  33784. * addSquare(1, 2);
  33785. * // => 9
  33786. */
  33787. var flow = createFlow();
  33788. /**
  33789. * This method is like `_.flow` except that it creates a function that
  33790. * invokes the given functions from right to left.
  33791. *
  33792. * @static
  33793. * @since 3.0.0
  33794. * @memberOf _
  33795. * @category Util
  33796. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33797. * @returns {Function} Returns the new composite function.
  33798. * @see _.flow
  33799. * @example
  33800. *
  33801. * function square(n) {
  33802. * return n * n;
  33803. * }
  33804. *
  33805. * var addSquare = _.flowRight([square, _.add]);
  33806. * addSquare(1, 2);
  33807. * // => 9
  33808. */
  33809. var flowRight = createFlow(true);
  33810. /**
  33811. * This method returns the first argument it receives.
  33812. *
  33813. * @static
  33814. * @since 0.1.0
  33815. * @memberOf _
  33816. * @category Util
  33817. * @param {*} value Any value.
  33818. * @returns {*} Returns `value`.
  33819. * @example
  33820. *
  33821. * var object = { 'a': 1 };
  33822. *
  33823. * console.log(_.identity(object) === object);
  33824. * // => true
  33825. */
  33826. function identity(value) {
  33827. return value;
  33828. }
  33829. /**
  33830. * Creates a function that invokes `func` with the arguments of the created
  33831. * function. If `func` is a property name, the created function returns the
  33832. * property value for a given element. If `func` is an array or object, the
  33833. * created function returns `true` for elements that contain the equivalent
  33834. * source properties, otherwise it returns `false`.
  33835. *
  33836. * @static
  33837. * @since 4.0.0
  33838. * @memberOf _
  33839. * @category Util
  33840. * @param {*} [func=_.identity] The value to convert to a callback.
  33841. * @returns {Function} Returns the callback.
  33842. * @example
  33843. *
  33844. * var users = [
  33845. * { 'user': 'barney', 'age': 36, 'active': true },
  33846. * { 'user': 'fred', 'age': 40, 'active': false }
  33847. * ];
  33848. *
  33849. * // The `_.matches` iteratee shorthand.
  33850. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  33851. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  33852. *
  33853. * // The `_.matchesProperty` iteratee shorthand.
  33854. * _.filter(users, _.iteratee(['user', 'fred']));
  33855. * // => [{ 'user': 'fred', 'age': 40 }]
  33856. *
  33857. * // The `_.property` iteratee shorthand.
  33858. * _.map(users, _.iteratee('user'));
  33859. * // => ['barney', 'fred']
  33860. *
  33861. * // Create custom iteratee shorthands.
  33862. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  33863. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  33864. * return func.test(string);
  33865. * };
  33866. * });
  33867. *
  33868. * _.filter(['abc', 'def'], /ef/);
  33869. * // => ['def']
  33870. */
  33871. function iteratee(func) {
  33872. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  33873. }
  33874. /**
  33875. * Creates a function that performs a partial deep comparison between a given
  33876. * object and `source`, returning `true` if the given object has equivalent
  33877. * property values, else `false`.
  33878. *
  33879. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  33880. * partially applied.
  33881. *
  33882. * Partial comparisons will match empty array and empty object `source`
  33883. * values against any array or object value, respectively. See `_.isEqual`
  33884. * for a list of supported value comparisons.
  33885. *
  33886. * @static
  33887. * @memberOf _
  33888. * @since 3.0.0
  33889. * @category Util
  33890. * @param {Object} source The object of property values to match.
  33891. * @returns {Function} Returns the new spec function.
  33892. * @example
  33893. *
  33894. * var objects = [
  33895. * { 'a': 1, 'b': 2, 'c': 3 },
  33896. * { 'a': 4, 'b': 5, 'c': 6 }
  33897. * ];
  33898. *
  33899. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  33900. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  33901. */
  33902. function matches(source) {
  33903. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  33904. }
  33905. /**
  33906. * Creates a function that performs a partial deep comparison between the
  33907. * value at `path` of a given object to `srcValue`, returning `true` if the
  33908. * object value is equivalent, else `false`.
  33909. *
  33910. * **Note:** Partial comparisons will match empty array and empty object
  33911. * `srcValue` values against any array or object value, respectively. See
  33912. * `_.isEqual` for a list of supported value comparisons.
  33913. *
  33914. * @static
  33915. * @memberOf _
  33916. * @since 3.2.0
  33917. * @category Util
  33918. * @param {Array|string} path The path of the property to get.
  33919. * @param {*} srcValue The value to match.
  33920. * @returns {Function} Returns the new spec function.
  33921. * @example
  33922. *
  33923. * var objects = [
  33924. * { 'a': 1, 'b': 2, 'c': 3 },
  33925. * { 'a': 4, 'b': 5, 'c': 6 }
  33926. * ];
  33927. *
  33928. * _.find(objects, _.matchesProperty('a', 4));
  33929. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33930. */
  33931. function matchesProperty(path, srcValue) {
  33932. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33933. }
  33934. /**
  33935. * Creates a function that invokes the method at `path` of a given object.
  33936. * Any additional arguments are provided to the invoked method.
  33937. *
  33938. * @static
  33939. * @memberOf _
  33940. * @since 3.7.0
  33941. * @category Util
  33942. * @param {Array|string} path The path of the method to invoke.
  33943. * @param {...*} [args] The arguments to invoke the method with.
  33944. * @returns {Function} Returns the new invoker function.
  33945. * @example
  33946. *
  33947. * var objects = [
  33948. * { 'a': { 'b': _.constant(2) } },
  33949. * { 'a': { 'b': _.constant(1) } }
  33950. * ];
  33951. *
  33952. * _.map(objects, _.method('a.b'));
  33953. * // => [2, 1]
  33954. *
  33955. * _.map(objects, _.method(['a', 'b']));
  33956. * // => [2, 1]
  33957. */
  33958. var method = baseRest(function(path, args) {
  33959. return function(object) {
  33960. return baseInvoke(object, path, args);
  33961. };
  33962. });
  33963. /**
  33964. * The opposite of `_.method`; this method creates a function that invokes
  33965. * the method at a given path of `object`. Any additional arguments are
  33966. * provided to the invoked method.
  33967. *
  33968. * @static
  33969. * @memberOf _
  33970. * @since 3.7.0
  33971. * @category Util
  33972. * @param {Object} object The object to query.
  33973. * @param {...*} [args] The arguments to invoke the method with.
  33974. * @returns {Function} Returns the new invoker function.
  33975. * @example
  33976. *
  33977. * var array = _.times(3, _.constant),
  33978. * object = { 'a': array, 'b': array, 'c': array };
  33979. *
  33980. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33981. * // => [2, 0]
  33982. *
  33983. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33984. * // => [2, 0]
  33985. */
  33986. var methodOf = baseRest(function(object, args) {
  33987. return function(path) {
  33988. return baseInvoke(object, path, args);
  33989. };
  33990. });
  33991. /**
  33992. * Adds all own enumerable string keyed function properties of a source
  33993. * object to the destination object. If `object` is a function, then methods
  33994. * are added to its prototype as well.
  33995. *
  33996. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33997. * avoid conflicts caused by modifying the original.
  33998. *
  33999. * @static
  34000. * @since 0.1.0
  34001. * @memberOf _
  34002. * @category Util
  34003. * @param {Function|Object} [object=lodash] The destination object.
  34004. * @param {Object} source The object of functions to add.
  34005. * @param {Object} [options={}] The options object.
  34006. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  34007. * @returns {Function|Object} Returns `object`.
  34008. * @example
  34009. *
  34010. * function vowels(string) {
  34011. * return _.filter(string, function(v) {
  34012. * return /[aeiou]/i.test(v);
  34013. * });
  34014. * }
  34015. *
  34016. * _.mixin({ 'vowels': vowels });
  34017. * _.vowels('fred');
  34018. * // => ['e']
  34019. *
  34020. * _('fred').vowels().value();
  34021. * // => ['e']
  34022. *
  34023. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  34024. * _('fred').vowels();
  34025. * // => ['e']
  34026. */
  34027. function mixin(object, source, options) {
  34028. var props = keys(source),
  34029. methodNames = baseFunctions(source, props);
  34030. if (options == null &&
  34031. !(isObject(source) && (methodNames.length || !props.length))) {
  34032. options = source;
  34033. source = object;
  34034. object = this;
  34035. methodNames = baseFunctions(source, keys(source));
  34036. }
  34037. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  34038. isFunc = isFunction(object);
  34039. arrayEach(methodNames, function(methodName) {
  34040. var func = source[methodName];
  34041. object[methodName] = func;
  34042. if (isFunc) {
  34043. object.prototype[methodName] = function() {
  34044. var chainAll = this.__chain__;
  34045. if (chain || chainAll) {
  34046. var result = object(this.__wrapped__),
  34047. actions = result.__actions__ = copyArray(this.__actions__);
  34048. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  34049. result.__chain__ = chainAll;
  34050. return result;
  34051. }
  34052. return func.apply(object, arrayPush([this.value()], arguments));
  34053. };
  34054. }
  34055. });
  34056. return object;
  34057. }
  34058. /**
  34059. * Reverts the `_` variable to its previous value and returns a reference to
  34060. * the `lodash` function.
  34061. *
  34062. * @static
  34063. * @since 0.1.0
  34064. * @memberOf _
  34065. * @category Util
  34066. * @returns {Function} Returns the `lodash` function.
  34067. * @example
  34068. *
  34069. * var lodash = _.noConflict();
  34070. */
  34071. function noConflict() {
  34072. if (root._ === this) {
  34073. root._ = oldDash;
  34074. }
  34075. return this;
  34076. }
  34077. /**
  34078. * This method returns `undefined`.
  34079. *
  34080. * @static
  34081. * @memberOf _
  34082. * @since 2.3.0
  34083. * @category Util
  34084. * @example
  34085. *
  34086. * _.times(2, _.noop);
  34087. * // => [undefined, undefined]
  34088. */
  34089. function noop() {
  34090. // No operation performed.
  34091. }
  34092. /**
  34093. * Creates a function that gets the argument at index `n`. If `n` is negative,
  34094. * the nth argument from the end is returned.
  34095. *
  34096. * @static
  34097. * @memberOf _
  34098. * @since 4.0.0
  34099. * @category Util
  34100. * @param {number} [n=0] The index of the argument to return.
  34101. * @returns {Function} Returns the new pass-thru function.
  34102. * @example
  34103. *
  34104. * var func = _.nthArg(1);
  34105. * func('a', 'b', 'c', 'd');
  34106. * // => 'b'
  34107. *
  34108. * var func = _.nthArg(-2);
  34109. * func('a', 'b', 'c', 'd');
  34110. * // => 'c'
  34111. */
  34112. function nthArg(n) {
  34113. n = toInteger(n);
  34114. return baseRest(function(args) {
  34115. return baseNth(args, n);
  34116. });
  34117. }
  34118. /**
  34119. * Creates a function that invokes `iteratees` with the arguments it receives
  34120. * and returns their results.
  34121. *
  34122. * @static
  34123. * @memberOf _
  34124. * @since 4.0.0
  34125. * @category Util
  34126. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  34127. * The iteratees to invoke.
  34128. * @returns {Function} Returns the new function.
  34129. * @example
  34130. *
  34131. * var func = _.over([Math.max, Math.min]);
  34132. *
  34133. * func(1, 2, 3, 4);
  34134. * // => [4, 1]
  34135. */
  34136. var over = createOver(arrayMap);
  34137. /**
  34138. * Creates a function that checks if **all** of the `predicates` return
  34139. * truthy when invoked with the arguments it receives.
  34140. *
  34141. * @static
  34142. * @memberOf _
  34143. * @since 4.0.0
  34144. * @category Util
  34145. * @param {...(Function|Function[])} [predicates=[_.identity]]
  34146. * The predicates to check.
  34147. * @returns {Function} Returns the new function.
  34148. * @example
  34149. *
  34150. * var func = _.overEvery([Boolean, isFinite]);
  34151. *
  34152. * func('1');
  34153. * // => true
  34154. *
  34155. * func(null);
  34156. * // => false
  34157. *
  34158. * func(NaN);
  34159. * // => false
  34160. */
  34161. var overEvery = createOver(arrayEvery);
  34162. /**
  34163. * Creates a function that checks if **any** of the `predicates` return
  34164. * truthy when invoked with the arguments it receives.
  34165. *
  34166. * @static
  34167. * @memberOf _
  34168. * @since 4.0.0
  34169. * @category Util
  34170. * @param {...(Function|Function[])} [predicates=[_.identity]]
  34171. * The predicates to check.
  34172. * @returns {Function} Returns the new function.
  34173. * @example
  34174. *
  34175. * var func = _.overSome([Boolean, isFinite]);
  34176. *
  34177. * func('1');
  34178. * // => true
  34179. *
  34180. * func(null);
  34181. * // => true
  34182. *
  34183. * func(NaN);
  34184. * // => false
  34185. */
  34186. var overSome = createOver(arraySome);
  34187. /**
  34188. * Creates a function that returns the value at `path` of a given object.
  34189. *
  34190. * @static
  34191. * @memberOf _
  34192. * @since 2.4.0
  34193. * @category Util
  34194. * @param {Array|string} path The path of the property to get.
  34195. * @returns {Function} Returns the new accessor function.
  34196. * @example
  34197. *
  34198. * var objects = [
  34199. * { 'a': { 'b': 2 } },
  34200. * { 'a': { 'b': 1 } }
  34201. * ];
  34202. *
  34203. * _.map(objects, _.property('a.b'));
  34204. * // => [2, 1]
  34205. *
  34206. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  34207. * // => [1, 2]
  34208. */
  34209. function property(path) {
  34210. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  34211. }
  34212. /**
  34213. * The opposite of `_.property`; this method creates a function that returns
  34214. * the value at a given path of `object`.
  34215. *
  34216. * @static
  34217. * @memberOf _
  34218. * @since 3.0.0
  34219. * @category Util
  34220. * @param {Object} object The object to query.
  34221. * @returns {Function} Returns the new accessor function.
  34222. * @example
  34223. *
  34224. * var array = [0, 1, 2],
  34225. * object = { 'a': array, 'b': array, 'c': array };
  34226. *
  34227. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  34228. * // => [2, 0]
  34229. *
  34230. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  34231. * // => [2, 0]
  34232. */
  34233. function propertyOf(object) {
  34234. return function(path) {
  34235. return object == null ? undefined : baseGet(object, path);
  34236. };
  34237. }
  34238. /**
  34239. * Creates an array of numbers (positive and/or negative) progressing from
  34240. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  34241. * `start` is specified without an `end` or `step`. If `end` is not specified,
  34242. * it's set to `start` with `start` then set to `0`.
  34243. *
  34244. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  34245. * floating-point values which can produce unexpected results.
  34246. *
  34247. * @static
  34248. * @since 0.1.0
  34249. * @memberOf _
  34250. * @category Util
  34251. * @param {number} [start=0] The start of the range.
  34252. * @param {number} end The end of the range.
  34253. * @param {number} [step=1] The value to increment or decrement by.
  34254. * @returns {Array} Returns the range of numbers.
  34255. * @see _.inRange, _.rangeRight
  34256. * @example
  34257. *
  34258. * _.range(4);
  34259. * // => [0, 1, 2, 3]
  34260. *
  34261. * _.range(-4);
  34262. * // => [0, -1, -2, -3]
  34263. *
  34264. * _.range(1, 5);
  34265. * // => [1, 2, 3, 4]
  34266. *
  34267. * _.range(0, 20, 5);
  34268. * // => [0, 5, 10, 15]
  34269. *
  34270. * _.range(0, -4, -1);
  34271. * // => [0, -1, -2, -3]
  34272. *
  34273. * _.range(1, 4, 0);
  34274. * // => [1, 1, 1]
  34275. *
  34276. * _.range(0);
  34277. * // => []
  34278. */
  34279. var range = createRange();
  34280. /**
  34281. * This method is like `_.range` except that it populates values in
  34282. * descending order.
  34283. *
  34284. * @static
  34285. * @memberOf _
  34286. * @since 4.0.0
  34287. * @category Util
  34288. * @param {number} [start=0] The start of the range.
  34289. * @param {number} end The end of the range.
  34290. * @param {number} [step=1] The value to increment or decrement by.
  34291. * @returns {Array} Returns the range of numbers.
  34292. * @see _.inRange, _.range
  34293. * @example
  34294. *
  34295. * _.rangeRight(4);
  34296. * // => [3, 2, 1, 0]
  34297. *
  34298. * _.rangeRight(-4);
  34299. * // => [-3, -2, -1, 0]
  34300. *
  34301. * _.rangeRight(1, 5);
  34302. * // => [4, 3, 2, 1]
  34303. *
  34304. * _.rangeRight(0, 20, 5);
  34305. * // => [15, 10, 5, 0]
  34306. *
  34307. * _.rangeRight(0, -4, -1);
  34308. * // => [-3, -2, -1, 0]
  34309. *
  34310. * _.rangeRight(1, 4, 0);
  34311. * // => [1, 1, 1]
  34312. *
  34313. * _.rangeRight(0);
  34314. * // => []
  34315. */
  34316. var rangeRight = createRange(true);
  34317. /**
  34318. * This method returns a new empty array.
  34319. *
  34320. * @static
  34321. * @memberOf _
  34322. * @since 4.13.0
  34323. * @category Util
  34324. * @returns {Array} Returns the new empty array.
  34325. * @example
  34326. *
  34327. * var arrays = _.times(2, _.stubArray);
  34328. *
  34329. * console.log(arrays);
  34330. * // => [[], []]
  34331. *
  34332. * console.log(arrays[0] === arrays[1]);
  34333. * // => false
  34334. */
  34335. function stubArray() {
  34336. return [];
  34337. }
  34338. /**
  34339. * This method returns `false`.
  34340. *
  34341. * @static
  34342. * @memberOf _
  34343. * @since 4.13.0
  34344. * @category Util
  34345. * @returns {boolean} Returns `false`.
  34346. * @example
  34347. *
  34348. * _.times(2, _.stubFalse);
  34349. * // => [false, false]
  34350. */
  34351. function stubFalse() {
  34352. return false;
  34353. }
  34354. /**
  34355. * This method returns a new empty object.
  34356. *
  34357. * @static
  34358. * @memberOf _
  34359. * @since 4.13.0
  34360. * @category Util
  34361. * @returns {Object} Returns the new empty object.
  34362. * @example
  34363. *
  34364. * var objects = _.times(2, _.stubObject);
  34365. *
  34366. * console.log(objects);
  34367. * // => [{}, {}]
  34368. *
  34369. * console.log(objects[0] === objects[1]);
  34370. * // => false
  34371. */
  34372. function stubObject() {
  34373. return {};
  34374. }
  34375. /**
  34376. * This method returns an empty string.
  34377. *
  34378. * @static
  34379. * @memberOf _
  34380. * @since 4.13.0
  34381. * @category Util
  34382. * @returns {string} Returns the empty string.
  34383. * @example
  34384. *
  34385. * _.times(2, _.stubString);
  34386. * // => ['', '']
  34387. */
  34388. function stubString() {
  34389. return '';
  34390. }
  34391. /**
  34392. * This method returns `true`.
  34393. *
  34394. * @static
  34395. * @memberOf _
  34396. * @since 4.13.0
  34397. * @category Util
  34398. * @returns {boolean} Returns `true`.
  34399. * @example
  34400. *
  34401. * _.times(2, _.stubTrue);
  34402. * // => [true, true]
  34403. */
  34404. function stubTrue() {
  34405. return true;
  34406. }
  34407. /**
  34408. * Invokes the iteratee `n` times, returning an array of the results of
  34409. * each invocation. The iteratee is invoked with one argument; (index).
  34410. *
  34411. * @static
  34412. * @since 0.1.0
  34413. * @memberOf _
  34414. * @category Util
  34415. * @param {number} n The number of times to invoke `iteratee`.
  34416. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  34417. * @returns {Array} Returns the array of results.
  34418. * @example
  34419. *
  34420. * _.times(3, String);
  34421. * // => ['0', '1', '2']
  34422. *
  34423. * _.times(4, _.constant(0));
  34424. * // => [0, 0, 0, 0]
  34425. */
  34426. function times(n, iteratee) {
  34427. n = toInteger(n);
  34428. if (n < 1 || n > MAX_SAFE_INTEGER) {
  34429. return [];
  34430. }
  34431. var index = MAX_ARRAY_LENGTH,
  34432. length = nativeMin(n, MAX_ARRAY_LENGTH);
  34433. iteratee = getIteratee(iteratee);
  34434. n -= MAX_ARRAY_LENGTH;
  34435. var result = baseTimes(length, iteratee);
  34436. while (++index < n) {
  34437. iteratee(index);
  34438. }
  34439. return result;
  34440. }
  34441. /**
  34442. * Converts `value` to a property path array.
  34443. *
  34444. * @static
  34445. * @memberOf _
  34446. * @since 4.0.0
  34447. * @category Util
  34448. * @param {*} value The value to convert.
  34449. * @returns {Array} Returns the new property path array.
  34450. * @example
  34451. *
  34452. * _.toPath('a.b.c');
  34453. * // => ['a', 'b', 'c']
  34454. *
  34455. * _.toPath('a[0].b.c');
  34456. * // => ['a', '0', 'b', 'c']
  34457. */
  34458. function toPath(value) {
  34459. if (isArray(value)) {
  34460. return arrayMap(value, toKey);
  34461. }
  34462. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  34463. }
  34464. /**
  34465. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  34466. *
  34467. * @static
  34468. * @since 0.1.0
  34469. * @memberOf _
  34470. * @category Util
  34471. * @param {string} [prefix=''] The value to prefix the ID with.
  34472. * @returns {string} Returns the unique ID.
  34473. * @example
  34474. *
  34475. * _.uniqueId('contact_');
  34476. * // => 'contact_104'
  34477. *
  34478. * _.uniqueId();
  34479. * // => '105'
  34480. */
  34481. function uniqueId(prefix) {
  34482. var id = ++idCounter;
  34483. return toString(prefix) + id;
  34484. }
  34485. /*------------------------------------------------------------------------*/
  34486. /**
  34487. * Adds two numbers.
  34488. *
  34489. * @static
  34490. * @memberOf _
  34491. * @since 3.4.0
  34492. * @category Math
  34493. * @param {number} augend The first number in an addition.
  34494. * @param {number} addend The second number in an addition.
  34495. * @returns {number} Returns the total.
  34496. * @example
  34497. *
  34498. * _.add(6, 4);
  34499. * // => 10
  34500. */
  34501. var add = createMathOperation(function(augend, addend) {
  34502. return augend + addend;
  34503. }, 0);
  34504. /**
  34505. * Computes `number` rounded up to `precision`.
  34506. *
  34507. * @static
  34508. * @memberOf _
  34509. * @since 3.10.0
  34510. * @category Math
  34511. * @param {number} number The number to round up.
  34512. * @param {number} [precision=0] The precision to round up to.
  34513. * @returns {number} Returns the rounded up number.
  34514. * @example
  34515. *
  34516. * _.ceil(4.006);
  34517. * // => 5
  34518. *
  34519. * _.ceil(6.004, 2);
  34520. * // => 6.01
  34521. *
  34522. * _.ceil(6040, -2);
  34523. * // => 6100
  34524. */
  34525. var ceil = createRound('ceil');
  34526. /**
  34527. * Divide two numbers.
  34528. *
  34529. * @static
  34530. * @memberOf _
  34531. * @since 4.7.0
  34532. * @category Math
  34533. * @param {number} dividend The first number in a division.
  34534. * @param {number} divisor The second number in a division.
  34535. * @returns {number} Returns the quotient.
  34536. * @example
  34537. *
  34538. * _.divide(6, 4);
  34539. * // => 1.5
  34540. */
  34541. var divide = createMathOperation(function(dividend, divisor) {
  34542. return dividend / divisor;
  34543. }, 1);
  34544. /**
  34545. * Computes `number` rounded down to `precision`.
  34546. *
  34547. * @static
  34548. * @memberOf _
  34549. * @since 3.10.0
  34550. * @category Math
  34551. * @param {number} number The number to round down.
  34552. * @param {number} [precision=0] The precision to round down to.
  34553. * @returns {number} Returns the rounded down number.
  34554. * @example
  34555. *
  34556. * _.floor(4.006);
  34557. * // => 4
  34558. *
  34559. * _.floor(0.046, 2);
  34560. * // => 0.04
  34561. *
  34562. * _.floor(4060, -2);
  34563. * // => 4000
  34564. */
  34565. var floor = createRound('floor');
  34566. /**
  34567. * Computes the maximum value of `array`. If `array` is empty or falsey,
  34568. * `undefined` is returned.
  34569. *
  34570. * @static
  34571. * @since 0.1.0
  34572. * @memberOf _
  34573. * @category Math
  34574. * @param {Array} array The array to iterate over.
  34575. * @returns {*} Returns the maximum value.
  34576. * @example
  34577. *
  34578. * _.max([4, 2, 8, 6]);
  34579. * // => 8
  34580. *
  34581. * _.max([]);
  34582. * // => undefined
  34583. */
  34584. function max(array) {
  34585. return (array && array.length)
  34586. ? baseExtremum(array, identity, baseGt)
  34587. : undefined;
  34588. }
  34589. /**
  34590. * This method is like `_.max` except that it accepts `iteratee` which is
  34591. * invoked for each element in `array` to generate the criterion by which
  34592. * the value is ranked. The iteratee is invoked with one argument: (value).
  34593. *
  34594. * @static
  34595. * @memberOf _
  34596. * @since 4.0.0
  34597. * @category Math
  34598. * @param {Array} array The array to iterate over.
  34599. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34600. * @returns {*} Returns the maximum value.
  34601. * @example
  34602. *
  34603. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34604. *
  34605. * _.maxBy(objects, function(o) { return o.n; });
  34606. * // => { 'n': 2 }
  34607. *
  34608. * // The `_.property` iteratee shorthand.
  34609. * _.maxBy(objects, 'n');
  34610. * // => { 'n': 2 }
  34611. */
  34612. function maxBy(array, iteratee) {
  34613. return (array && array.length)
  34614. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  34615. : undefined;
  34616. }
  34617. /**
  34618. * Computes the mean of the values in `array`.
  34619. *
  34620. * @static
  34621. * @memberOf _
  34622. * @since 4.0.0
  34623. * @category Math
  34624. * @param {Array} array The array to iterate over.
  34625. * @returns {number} Returns the mean.
  34626. * @example
  34627. *
  34628. * _.mean([4, 2, 8, 6]);
  34629. * // => 5
  34630. */
  34631. function mean(array) {
  34632. return baseMean(array, identity);
  34633. }
  34634. /**
  34635. * This method is like `_.mean` except that it accepts `iteratee` which is
  34636. * invoked for each element in `array` to generate the value to be averaged.
  34637. * The iteratee is invoked with one argument: (value).
  34638. *
  34639. * @static
  34640. * @memberOf _
  34641. * @since 4.7.0
  34642. * @category Math
  34643. * @param {Array} array The array to iterate over.
  34644. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34645. * @returns {number} Returns the mean.
  34646. * @example
  34647. *
  34648. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34649. *
  34650. * _.meanBy(objects, function(o) { return o.n; });
  34651. * // => 5
  34652. *
  34653. * // The `_.property` iteratee shorthand.
  34654. * _.meanBy(objects, 'n');
  34655. * // => 5
  34656. */
  34657. function meanBy(array, iteratee) {
  34658. return baseMean(array, getIteratee(iteratee, 2));
  34659. }
  34660. /**
  34661. * Computes the minimum value of `array`. If `array` is empty or falsey,
  34662. * `undefined` is returned.
  34663. *
  34664. * @static
  34665. * @since 0.1.0
  34666. * @memberOf _
  34667. * @category Math
  34668. * @param {Array} array The array to iterate over.
  34669. * @returns {*} Returns the minimum value.
  34670. * @example
  34671. *
  34672. * _.min([4, 2, 8, 6]);
  34673. * // => 2
  34674. *
  34675. * _.min([]);
  34676. * // => undefined
  34677. */
  34678. function min(array) {
  34679. return (array && array.length)
  34680. ? baseExtremum(array, identity, baseLt)
  34681. : undefined;
  34682. }
  34683. /**
  34684. * This method is like `_.min` except that it accepts `iteratee` which is
  34685. * invoked for each element in `array` to generate the criterion by which
  34686. * the value is ranked. The iteratee is invoked with one argument: (value).
  34687. *
  34688. * @static
  34689. * @memberOf _
  34690. * @since 4.0.0
  34691. * @category Math
  34692. * @param {Array} array The array to iterate over.
  34693. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34694. * @returns {*} Returns the minimum value.
  34695. * @example
  34696. *
  34697. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34698. *
  34699. * _.minBy(objects, function(o) { return o.n; });
  34700. * // => { 'n': 1 }
  34701. *
  34702. * // The `_.property` iteratee shorthand.
  34703. * _.minBy(objects, 'n');
  34704. * // => { 'n': 1 }
  34705. */
  34706. function minBy(array, iteratee) {
  34707. return (array && array.length)
  34708. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  34709. : undefined;
  34710. }
  34711. /**
  34712. * Multiply two numbers.
  34713. *
  34714. * @static
  34715. * @memberOf _
  34716. * @since 4.7.0
  34717. * @category Math
  34718. * @param {number} multiplier The first number in a multiplication.
  34719. * @param {number} multiplicand The second number in a multiplication.
  34720. * @returns {number} Returns the product.
  34721. * @example
  34722. *
  34723. * _.multiply(6, 4);
  34724. * // => 24
  34725. */
  34726. var multiply = createMathOperation(function(multiplier, multiplicand) {
  34727. return multiplier * multiplicand;
  34728. }, 1);
  34729. /**
  34730. * Computes `number` rounded to `precision`.
  34731. *
  34732. * @static
  34733. * @memberOf _
  34734. * @since 3.10.0
  34735. * @category Math
  34736. * @param {number} number The number to round.
  34737. * @param {number} [precision=0] The precision to round to.
  34738. * @returns {number} Returns the rounded number.
  34739. * @example
  34740. *
  34741. * _.round(4.006);
  34742. * // => 4
  34743. *
  34744. * _.round(4.006, 2);
  34745. * // => 4.01
  34746. *
  34747. * _.round(4060, -2);
  34748. * // => 4100
  34749. */
  34750. var round = createRound('round');
  34751. /**
  34752. * Subtract two numbers.
  34753. *
  34754. * @static
  34755. * @memberOf _
  34756. * @since 4.0.0
  34757. * @category Math
  34758. * @param {number} minuend The first number in a subtraction.
  34759. * @param {number} subtrahend The second number in a subtraction.
  34760. * @returns {number} Returns the difference.
  34761. * @example
  34762. *
  34763. * _.subtract(6, 4);
  34764. * // => 2
  34765. */
  34766. var subtract = createMathOperation(function(minuend, subtrahend) {
  34767. return minuend - subtrahend;
  34768. }, 0);
  34769. /**
  34770. * Computes the sum of the values in `array`.
  34771. *
  34772. * @static
  34773. * @memberOf _
  34774. * @since 3.4.0
  34775. * @category Math
  34776. * @param {Array} array The array to iterate over.
  34777. * @returns {number} Returns the sum.
  34778. * @example
  34779. *
  34780. * _.sum([4, 2, 8, 6]);
  34781. * // => 20
  34782. */
  34783. function sum(array) {
  34784. return (array && array.length)
  34785. ? baseSum(array, identity)
  34786. : 0;
  34787. }
  34788. /**
  34789. * This method is like `_.sum` except that it accepts `iteratee` which is
  34790. * invoked for each element in `array` to generate the value to be summed.
  34791. * The iteratee is invoked with one argument: (value).
  34792. *
  34793. * @static
  34794. * @memberOf _
  34795. * @since 4.0.0
  34796. * @category Math
  34797. * @param {Array} array The array to iterate over.
  34798. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34799. * @returns {number} Returns the sum.
  34800. * @example
  34801. *
  34802. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34803. *
  34804. * _.sumBy(objects, function(o) { return o.n; });
  34805. * // => 20
  34806. *
  34807. * // The `_.property` iteratee shorthand.
  34808. * _.sumBy(objects, 'n');
  34809. * // => 20
  34810. */
  34811. function sumBy(array, iteratee) {
  34812. return (array && array.length)
  34813. ? baseSum(array, getIteratee(iteratee, 2))
  34814. : 0;
  34815. }
  34816. /*------------------------------------------------------------------------*/
  34817. // Add methods that return wrapped values in chain sequences.
  34818. lodash.after = after;
  34819. lodash.ary = ary;
  34820. lodash.assign = assign;
  34821. lodash.assignIn = assignIn;
  34822. lodash.assignInWith = assignInWith;
  34823. lodash.assignWith = assignWith;
  34824. lodash.at = at;
  34825. lodash.before = before;
  34826. lodash.bind = bind;
  34827. lodash.bindAll = bindAll;
  34828. lodash.bindKey = bindKey;
  34829. lodash.castArray = castArray;
  34830. lodash.chain = chain;
  34831. lodash.chunk = chunk;
  34832. lodash.compact = compact;
  34833. lodash.concat = concat;
  34834. lodash.cond = cond;
  34835. lodash.conforms = conforms;
  34836. lodash.constant = constant;
  34837. lodash.countBy = countBy;
  34838. lodash.create = create;
  34839. lodash.curry = curry;
  34840. lodash.curryRight = curryRight;
  34841. lodash.debounce = debounce;
  34842. lodash.defaults = defaults;
  34843. lodash.defaultsDeep = defaultsDeep;
  34844. lodash.defer = defer;
  34845. lodash.delay = delay;
  34846. lodash.difference = difference;
  34847. lodash.differenceBy = differenceBy;
  34848. lodash.differenceWith = differenceWith;
  34849. lodash.drop = drop;
  34850. lodash.dropRight = dropRight;
  34851. lodash.dropRightWhile = dropRightWhile;
  34852. lodash.dropWhile = dropWhile;
  34853. lodash.fill = fill;
  34854. lodash.filter = filter;
  34855. lodash.flatMap = flatMap;
  34856. lodash.flatMapDeep = flatMapDeep;
  34857. lodash.flatMapDepth = flatMapDepth;
  34858. lodash.flatten = flatten;
  34859. lodash.flattenDeep = flattenDeep;
  34860. lodash.flattenDepth = flattenDepth;
  34861. lodash.flip = flip;
  34862. lodash.flow = flow;
  34863. lodash.flowRight = flowRight;
  34864. lodash.fromPairs = fromPairs;
  34865. lodash.functions = functions;
  34866. lodash.functionsIn = functionsIn;
  34867. lodash.groupBy = groupBy;
  34868. lodash.initial = initial;
  34869. lodash.intersection = intersection;
  34870. lodash.intersectionBy = intersectionBy;
  34871. lodash.intersectionWith = intersectionWith;
  34872. lodash.invert = invert;
  34873. lodash.invertBy = invertBy;
  34874. lodash.invokeMap = invokeMap;
  34875. lodash.iteratee = iteratee;
  34876. lodash.keyBy = keyBy;
  34877. lodash.keys = keys;
  34878. lodash.keysIn = keysIn;
  34879. lodash.map = map;
  34880. lodash.mapKeys = mapKeys;
  34881. lodash.mapValues = mapValues;
  34882. lodash.matches = matches;
  34883. lodash.matchesProperty = matchesProperty;
  34884. lodash.memoize = memoize;
  34885. lodash.merge = merge;
  34886. lodash.mergeWith = mergeWith;
  34887. lodash.method = method;
  34888. lodash.methodOf = methodOf;
  34889. lodash.mixin = mixin;
  34890. lodash.negate = negate;
  34891. lodash.nthArg = nthArg;
  34892. lodash.omit = omit;
  34893. lodash.omitBy = omitBy;
  34894. lodash.once = once;
  34895. lodash.orderBy = orderBy;
  34896. lodash.over = over;
  34897. lodash.overArgs = overArgs;
  34898. lodash.overEvery = overEvery;
  34899. lodash.overSome = overSome;
  34900. lodash.partial = partial;
  34901. lodash.partialRight = partialRight;
  34902. lodash.partition = partition;
  34903. lodash.pick = pick;
  34904. lodash.pickBy = pickBy;
  34905. lodash.property = property;
  34906. lodash.propertyOf = propertyOf;
  34907. lodash.pull = pull;
  34908. lodash.pullAll = pullAll;
  34909. lodash.pullAllBy = pullAllBy;
  34910. lodash.pullAllWith = pullAllWith;
  34911. lodash.pullAt = pullAt;
  34912. lodash.range = range;
  34913. lodash.rangeRight = rangeRight;
  34914. lodash.rearg = rearg;
  34915. lodash.reject = reject;
  34916. lodash.remove = remove;
  34917. lodash.rest = rest;
  34918. lodash.reverse = reverse;
  34919. lodash.sampleSize = sampleSize;
  34920. lodash.set = set;
  34921. lodash.setWith = setWith;
  34922. lodash.shuffle = shuffle;
  34923. lodash.slice = slice;
  34924. lodash.sortBy = sortBy;
  34925. lodash.sortedUniq = sortedUniq;
  34926. lodash.sortedUniqBy = sortedUniqBy;
  34927. lodash.split = split;
  34928. lodash.spread = spread;
  34929. lodash.tail = tail;
  34930. lodash.take = take;
  34931. lodash.takeRight = takeRight;
  34932. lodash.takeRightWhile = takeRightWhile;
  34933. lodash.takeWhile = takeWhile;
  34934. lodash.tap = tap;
  34935. lodash.throttle = throttle;
  34936. lodash.thru = thru;
  34937. lodash.toArray = toArray;
  34938. lodash.toPairs = toPairs;
  34939. lodash.toPairsIn = toPairsIn;
  34940. lodash.toPath = toPath;
  34941. lodash.toPlainObject = toPlainObject;
  34942. lodash.transform = transform;
  34943. lodash.unary = unary;
  34944. lodash.union = union;
  34945. lodash.unionBy = unionBy;
  34946. lodash.unionWith = unionWith;
  34947. lodash.uniq = uniq;
  34948. lodash.uniqBy = uniqBy;
  34949. lodash.uniqWith = uniqWith;
  34950. lodash.unset = unset;
  34951. lodash.unzip = unzip;
  34952. lodash.unzipWith = unzipWith;
  34953. lodash.update = update;
  34954. lodash.updateWith = updateWith;
  34955. lodash.values = values;
  34956. lodash.valuesIn = valuesIn;
  34957. lodash.without = without;
  34958. lodash.words = words;
  34959. lodash.wrap = wrap;
  34960. lodash.xor = xor;
  34961. lodash.xorBy = xorBy;
  34962. lodash.xorWith = xorWith;
  34963. lodash.zip = zip;
  34964. lodash.zipObject = zipObject;
  34965. lodash.zipObjectDeep = zipObjectDeep;
  34966. lodash.zipWith = zipWith;
  34967. // Add aliases.
  34968. lodash.entries = toPairs;
  34969. lodash.entriesIn = toPairsIn;
  34970. lodash.extend = assignIn;
  34971. lodash.extendWith = assignInWith;
  34972. // Add methods to `lodash.prototype`.
  34973. mixin(lodash, lodash);
  34974. /*------------------------------------------------------------------------*/
  34975. // Add methods that return unwrapped values in chain sequences.
  34976. lodash.add = add;
  34977. lodash.attempt = attempt;
  34978. lodash.camelCase = camelCase;
  34979. lodash.capitalize = capitalize;
  34980. lodash.ceil = ceil;
  34981. lodash.clamp = clamp;
  34982. lodash.clone = clone;
  34983. lodash.cloneDeep = cloneDeep;
  34984. lodash.cloneDeepWith = cloneDeepWith;
  34985. lodash.cloneWith = cloneWith;
  34986. lodash.conformsTo = conformsTo;
  34987. lodash.deburr = deburr;
  34988. lodash.defaultTo = defaultTo;
  34989. lodash.divide = divide;
  34990. lodash.endsWith = endsWith;
  34991. lodash.eq = eq;
  34992. lodash.escape = escape;
  34993. lodash.escapeRegExp = escapeRegExp;
  34994. lodash.every = every;
  34995. lodash.find = find;
  34996. lodash.findIndex = findIndex;
  34997. lodash.findKey = findKey;
  34998. lodash.findLast = findLast;
  34999. lodash.findLastIndex = findLastIndex;
  35000. lodash.findLastKey = findLastKey;
  35001. lodash.floor = floor;
  35002. lodash.forEach = forEach;
  35003. lodash.forEachRight = forEachRight;
  35004. lodash.forIn = forIn;
  35005. lodash.forInRight = forInRight;
  35006. lodash.forOwn = forOwn;
  35007. lodash.forOwnRight = forOwnRight;
  35008. lodash.get = get;
  35009. lodash.gt = gt;
  35010. lodash.gte = gte;
  35011. lodash.has = has;
  35012. lodash.hasIn = hasIn;
  35013. lodash.head = head;
  35014. lodash.identity = identity;
  35015. lodash.includes = includes;
  35016. lodash.indexOf = indexOf;
  35017. lodash.inRange = inRange;
  35018. lodash.invoke = invoke;
  35019. lodash.isArguments = isArguments;
  35020. lodash.isArray = isArray;
  35021. lodash.isArrayBuffer = isArrayBuffer;
  35022. lodash.isArrayLike = isArrayLike;
  35023. lodash.isArrayLikeObject = isArrayLikeObject;
  35024. lodash.isBoolean = isBoolean;
  35025. lodash.isBuffer = isBuffer;
  35026. lodash.isDate = isDate;
  35027. lodash.isElement = isElement;
  35028. lodash.isEmpty = isEmpty;
  35029. lodash.isEqual = isEqual;
  35030. lodash.isEqualWith = isEqualWith;
  35031. lodash.isError = isError;
  35032. lodash.isFinite = isFinite;
  35033. lodash.isFunction = isFunction;
  35034. lodash.isInteger = isInteger;
  35035. lodash.isLength = isLength;
  35036. lodash.isMap = isMap;
  35037. lodash.isMatch = isMatch;
  35038. lodash.isMatchWith = isMatchWith;
  35039. lodash.isNaN = isNaN;
  35040. lodash.isNative = isNative;
  35041. lodash.isNil = isNil;
  35042. lodash.isNull = isNull;
  35043. lodash.isNumber = isNumber;
  35044. lodash.isObject = isObject;
  35045. lodash.isObjectLike = isObjectLike;
  35046. lodash.isPlainObject = isPlainObject;
  35047. lodash.isRegExp = isRegExp;
  35048. lodash.isSafeInteger = isSafeInteger;
  35049. lodash.isSet = isSet;
  35050. lodash.isString = isString;
  35051. lodash.isSymbol = isSymbol;
  35052. lodash.isTypedArray = isTypedArray;
  35053. lodash.isUndefined = isUndefined;
  35054. lodash.isWeakMap = isWeakMap;
  35055. lodash.isWeakSet = isWeakSet;
  35056. lodash.join = join;
  35057. lodash.kebabCase = kebabCase;
  35058. lodash.last = last;
  35059. lodash.lastIndexOf = lastIndexOf;
  35060. lodash.lowerCase = lowerCase;
  35061. lodash.lowerFirst = lowerFirst;
  35062. lodash.lt = lt;
  35063. lodash.lte = lte;
  35064. lodash.max = max;
  35065. lodash.maxBy = maxBy;
  35066. lodash.mean = mean;
  35067. lodash.meanBy = meanBy;
  35068. lodash.min = min;
  35069. lodash.minBy = minBy;
  35070. lodash.stubArray = stubArray;
  35071. lodash.stubFalse = stubFalse;
  35072. lodash.stubObject = stubObject;
  35073. lodash.stubString = stubString;
  35074. lodash.stubTrue = stubTrue;
  35075. lodash.multiply = multiply;
  35076. lodash.nth = nth;
  35077. lodash.noConflict = noConflict;
  35078. lodash.noop = noop;
  35079. lodash.now = now;
  35080. lodash.pad = pad;
  35081. lodash.padEnd = padEnd;
  35082. lodash.padStart = padStart;
  35083. lodash.parseInt = parseInt;
  35084. lodash.random = random;
  35085. lodash.reduce = reduce;
  35086. lodash.reduceRight = reduceRight;
  35087. lodash.repeat = repeat;
  35088. lodash.replace = replace;
  35089. lodash.result = result;
  35090. lodash.round = round;
  35091. lodash.runInContext = runInContext;
  35092. lodash.sample = sample;
  35093. lodash.size = size;
  35094. lodash.snakeCase = snakeCase;
  35095. lodash.some = some;
  35096. lodash.sortedIndex = sortedIndex;
  35097. lodash.sortedIndexBy = sortedIndexBy;
  35098. lodash.sortedIndexOf = sortedIndexOf;
  35099. lodash.sortedLastIndex = sortedLastIndex;
  35100. lodash.sortedLastIndexBy = sortedLastIndexBy;
  35101. lodash.sortedLastIndexOf = sortedLastIndexOf;
  35102. lodash.startCase = startCase;
  35103. lodash.startsWith = startsWith;
  35104. lodash.subtract = subtract;
  35105. lodash.sum = sum;
  35106. lodash.sumBy = sumBy;
  35107. lodash.template = template;
  35108. lodash.times = times;
  35109. lodash.toFinite = toFinite;
  35110. lodash.toInteger = toInteger;
  35111. lodash.toLength = toLength;
  35112. lodash.toLower = toLower;
  35113. lodash.toNumber = toNumber;
  35114. lodash.toSafeInteger = toSafeInteger;
  35115. lodash.toString = toString;
  35116. lodash.toUpper = toUpper;
  35117. lodash.trim = trim;
  35118. lodash.trimEnd = trimEnd;
  35119. lodash.trimStart = trimStart;
  35120. lodash.truncate = truncate;
  35121. lodash.unescape = unescape;
  35122. lodash.uniqueId = uniqueId;
  35123. lodash.upperCase = upperCase;
  35124. lodash.upperFirst = upperFirst;
  35125. // Add aliases.
  35126. lodash.each = forEach;
  35127. lodash.eachRight = forEachRight;
  35128. lodash.first = head;
  35129. mixin(lodash, (function() {
  35130. var source = {};
  35131. baseForOwn(lodash, function(func, methodName) {
  35132. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  35133. source[methodName] = func;
  35134. }
  35135. });
  35136. return source;
  35137. }()), { 'chain': false });
  35138. /*------------------------------------------------------------------------*/
  35139. /**
  35140. * The semantic version number.
  35141. *
  35142. * @static
  35143. * @memberOf _
  35144. * @type {string}
  35145. */
  35146. lodash.VERSION = VERSION;
  35147. // Assign default placeholders.
  35148. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  35149. lodash[methodName].placeholder = lodash;
  35150. });
  35151. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  35152. arrayEach(['drop', 'take'], function(methodName, index) {
  35153. LazyWrapper.prototype[methodName] = function(n) {
  35154. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  35155. var result = (this.__filtered__ && !index)
  35156. ? new LazyWrapper(this)
  35157. : this.clone();
  35158. if (result.__filtered__) {
  35159. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  35160. } else {
  35161. result.__views__.push({
  35162. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  35163. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  35164. });
  35165. }
  35166. return result;
  35167. };
  35168. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  35169. return this.reverse()[methodName](n).reverse();
  35170. };
  35171. });
  35172. // Add `LazyWrapper` methods that accept an `iteratee` value.
  35173. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  35174. var type = index + 1,
  35175. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  35176. LazyWrapper.prototype[methodName] = function(iteratee) {
  35177. var result = this.clone();
  35178. result.__iteratees__.push({
  35179. 'iteratee': getIteratee(iteratee, 3),
  35180. 'type': type
  35181. });
  35182. result.__filtered__ = result.__filtered__ || isFilter;
  35183. return result;
  35184. };
  35185. });
  35186. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  35187. arrayEach(['head', 'last'], function(methodName, index) {
  35188. var takeName = 'take' + (index ? 'Right' : '');
  35189. LazyWrapper.prototype[methodName] = function() {
  35190. return this[takeName](1).value()[0];
  35191. };
  35192. });
  35193. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  35194. arrayEach(['initial', 'tail'], function(methodName, index) {
  35195. var dropName = 'drop' + (index ? '' : 'Right');
  35196. LazyWrapper.prototype[methodName] = function() {
  35197. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  35198. };
  35199. });
  35200. LazyWrapper.prototype.compact = function() {
  35201. return this.filter(identity);
  35202. };
  35203. LazyWrapper.prototype.find = function(predicate) {
  35204. return this.filter(predicate).head();
  35205. };
  35206. LazyWrapper.prototype.findLast = function(predicate) {
  35207. return this.reverse().find(predicate);
  35208. };
  35209. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  35210. if (typeof path == 'function') {
  35211. return new LazyWrapper(this);
  35212. }
  35213. return this.map(function(value) {
  35214. return baseInvoke(value, path, args);
  35215. });
  35216. });
  35217. LazyWrapper.prototype.reject = function(predicate) {
  35218. return this.filter(negate(getIteratee(predicate)));
  35219. };
  35220. LazyWrapper.prototype.slice = function(start, end) {
  35221. start = toInteger(start);
  35222. var result = this;
  35223. if (result.__filtered__ && (start > 0 || end < 0)) {
  35224. return new LazyWrapper(result);
  35225. }
  35226. if (start < 0) {
  35227. result = result.takeRight(-start);
  35228. } else if (start) {
  35229. result = result.drop(start);
  35230. }
  35231. if (end !== undefined) {
  35232. end = toInteger(end);
  35233. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  35234. }
  35235. return result;
  35236. };
  35237. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  35238. return this.reverse().takeWhile(predicate).reverse();
  35239. };
  35240. LazyWrapper.prototype.toArray = function() {
  35241. return this.take(MAX_ARRAY_LENGTH);
  35242. };
  35243. // Add `LazyWrapper` methods to `lodash.prototype`.
  35244. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  35245. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  35246. isTaker = /^(?:head|last)$/.test(methodName),
  35247. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  35248. retUnwrapped = isTaker || /^find/.test(methodName);
  35249. if (!lodashFunc) {
  35250. return;
  35251. }
  35252. lodash.prototype[methodName] = function() {
  35253. var value = this.__wrapped__,
  35254. args = isTaker ? [1] : arguments,
  35255. isLazy = value instanceof LazyWrapper,
  35256. iteratee = args[0],
  35257. useLazy = isLazy || isArray(value);
  35258. var interceptor = function(value) {
  35259. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  35260. return (isTaker && chainAll) ? result[0] : result;
  35261. };
  35262. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  35263. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  35264. isLazy = useLazy = false;
  35265. }
  35266. var chainAll = this.__chain__,
  35267. isHybrid = !!this.__actions__.length,
  35268. isUnwrapped = retUnwrapped && !chainAll,
  35269. onlyLazy = isLazy && !isHybrid;
  35270. if (!retUnwrapped && useLazy) {
  35271. value = onlyLazy ? value : new LazyWrapper(this);
  35272. var result = func.apply(value, args);
  35273. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  35274. return new LodashWrapper(result, chainAll);
  35275. }
  35276. if (isUnwrapped && onlyLazy) {
  35277. return func.apply(this, args);
  35278. }
  35279. result = this.thru(interceptor);
  35280. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  35281. };
  35282. });
  35283. // Add `Array` methods to `lodash.prototype`.
  35284. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  35285. var func = arrayProto[methodName],
  35286. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  35287. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  35288. lodash.prototype[methodName] = function() {
  35289. var args = arguments;
  35290. if (retUnwrapped && !this.__chain__) {
  35291. var value = this.value();
  35292. return func.apply(isArray(value) ? value : [], args);
  35293. }
  35294. return this[chainName](function(value) {
  35295. return func.apply(isArray(value) ? value : [], args);
  35296. });
  35297. };
  35298. });
  35299. // Map minified method names to their real names.
  35300. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  35301. var lodashFunc = lodash[methodName];
  35302. if (lodashFunc) {
  35303. var key = lodashFunc.name + '';
  35304. if (!hasOwnProperty.call(realNames, key)) {
  35305. realNames[key] = [];
  35306. }
  35307. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  35308. }
  35309. });
  35310. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  35311. 'name': 'wrapper',
  35312. 'func': undefined
  35313. }];
  35314. // Add methods to `LazyWrapper`.
  35315. LazyWrapper.prototype.clone = lazyClone;
  35316. LazyWrapper.prototype.reverse = lazyReverse;
  35317. LazyWrapper.prototype.value = lazyValue;
  35318. // Add chain sequence methods to the `lodash` wrapper.
  35319. lodash.prototype.at = wrapperAt;
  35320. lodash.prototype.chain = wrapperChain;
  35321. lodash.prototype.commit = wrapperCommit;
  35322. lodash.prototype.next = wrapperNext;
  35323. lodash.prototype.plant = wrapperPlant;
  35324. lodash.prototype.reverse = wrapperReverse;
  35325. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  35326. // Add lazy aliases.
  35327. lodash.prototype.first = lodash.prototype.head;
  35328. if (symIterator) {
  35329. lodash.prototype[symIterator] = wrapperToIterator;
  35330. }
  35331. return lodash;
  35332. });
  35333. /*--------------------------------------------------------------------------*/
  35334. // Export lodash.
  35335. var _ = runInContext();
  35336. // Some AMD build optimizers, like r.js, check for condition patterns like:
  35337. if (true) {
  35338. // Expose Lodash on the global object to prevent errors when Lodash is
  35339. // loaded by a script tag in the presence of an AMD loader.
  35340. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  35341. // Use `_.noConflict` to remove Lodash from the global object.
  35342. root._ = _;
  35343. // Define as an anonymous module so, through path mapping, it can be
  35344. // referenced as the "underscore" module.
  35345. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  35346. return _;
  35347. }).call(exports, __webpack_require__, exports, module),
  35348. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  35349. }
  35350. // Check for `exports` after `define` in case a build optimizer adds it.
  35351. else {}
  35352. }.call(this));
  35353. /* 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)))
  35354. /***/ }),
  35355. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  35356. /*!***************************************************!*\
  35357. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  35358. \***************************************************/
  35359. /*! exports provided: default */
  35360. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  35361. "use strict";
  35362. __webpack_require__.r(__webpack_exports__);
  35363. /* WEBPACK VAR INJECTION */(function(global) {/**!
  35364. * @fileOverview Kickass library to create and place poppers near their reference elements.
  35365. * @version 1.16.1
  35366. * @license
  35367. * Copyright (c) 2016 Federico Zivolo and contributors
  35368. *
  35369. * Permission is hereby granted, free of charge, to any person obtaining a copy
  35370. * of this software and associated documentation files (the "Software"), to deal
  35371. * in the Software without restriction, including without limitation the rights
  35372. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  35373. * copies of the Software, and to permit persons to whom the Software is
  35374. * furnished to do so, subject to the following conditions:
  35375. *
  35376. * The above copyright notice and this permission notice shall be included in all
  35377. * copies or substantial portions of the Software.
  35378. *
  35379. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  35380. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  35381. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  35382. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  35383. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  35384. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  35385. * SOFTWARE.
  35386. */
  35387. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  35388. var timeoutDuration = function () {
  35389. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  35390. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  35391. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  35392. return 1;
  35393. }
  35394. }
  35395. return 0;
  35396. }();
  35397. function microtaskDebounce(fn) {
  35398. var called = false;
  35399. return function () {
  35400. if (called) {
  35401. return;
  35402. }
  35403. called = true;
  35404. window.Promise.resolve().then(function () {
  35405. called = false;
  35406. fn();
  35407. });
  35408. };
  35409. }
  35410. function taskDebounce(fn) {
  35411. var scheduled = false;
  35412. return function () {
  35413. if (!scheduled) {
  35414. scheduled = true;
  35415. setTimeout(function () {
  35416. scheduled = false;
  35417. fn();
  35418. }, timeoutDuration);
  35419. }
  35420. };
  35421. }
  35422. var supportsMicroTasks = isBrowser && window.Promise;
  35423. /**
  35424. * Create a debounced version of a method, that's asynchronously deferred
  35425. * but called in the minimum time possible.
  35426. *
  35427. * @method
  35428. * @memberof Popper.Utils
  35429. * @argument {Function} fn
  35430. * @returns {Function}
  35431. */
  35432. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  35433. /**
  35434. * Check if the given variable is a function
  35435. * @method
  35436. * @memberof Popper.Utils
  35437. * @argument {Any} functionToCheck - variable to check
  35438. * @returns {Boolean} answer to: is a function?
  35439. */
  35440. function isFunction(functionToCheck) {
  35441. var getType = {};
  35442. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  35443. }
  35444. /**
  35445. * Get CSS computed property of the given element
  35446. * @method
  35447. * @memberof Popper.Utils
  35448. * @argument {Eement} element
  35449. * @argument {String} property
  35450. */
  35451. function getStyleComputedProperty(element, property) {
  35452. if (element.nodeType !== 1) {
  35453. return [];
  35454. }
  35455. // NOTE: 1 DOM access here
  35456. var window = element.ownerDocument.defaultView;
  35457. var css = window.getComputedStyle(element, null);
  35458. return property ? css[property] : css;
  35459. }
  35460. /**
  35461. * Returns the parentNode or the host of the element
  35462. * @method
  35463. * @memberof Popper.Utils
  35464. * @argument {Element} element
  35465. * @returns {Element} parent
  35466. */
  35467. function getParentNode(element) {
  35468. if (element.nodeName === 'HTML') {
  35469. return element;
  35470. }
  35471. return element.parentNode || element.host;
  35472. }
  35473. /**
  35474. * Returns the scrolling parent of the given element
  35475. * @method
  35476. * @memberof Popper.Utils
  35477. * @argument {Element} element
  35478. * @returns {Element} scroll parent
  35479. */
  35480. function getScrollParent(element) {
  35481. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  35482. if (!element) {
  35483. return document.body;
  35484. }
  35485. switch (element.nodeName) {
  35486. case 'HTML':
  35487. case 'BODY':
  35488. return element.ownerDocument.body;
  35489. case '#document':
  35490. return element.body;
  35491. }
  35492. // Firefox want us to check `-x` and `-y` variations as well
  35493. var _getStyleComputedProp = getStyleComputedProperty(element),
  35494. overflow = _getStyleComputedProp.overflow,
  35495. overflowX = _getStyleComputedProp.overflowX,
  35496. overflowY = _getStyleComputedProp.overflowY;
  35497. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  35498. return element;
  35499. }
  35500. return getScrollParent(getParentNode(element));
  35501. }
  35502. /**
  35503. * Returns the reference node of the reference object, or the reference object itself.
  35504. * @method
  35505. * @memberof Popper.Utils
  35506. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  35507. * @returns {Element} parent
  35508. */
  35509. function getReferenceNode(reference) {
  35510. return reference && reference.referenceNode ? reference.referenceNode : reference;
  35511. }
  35512. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  35513. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  35514. /**
  35515. * Determines if the browser is Internet Explorer
  35516. * @method
  35517. * @memberof Popper.Utils
  35518. * @param {Number} version to check
  35519. * @returns {Boolean} isIE
  35520. */
  35521. function isIE(version) {
  35522. if (version === 11) {
  35523. return isIE11;
  35524. }
  35525. if (version === 10) {
  35526. return isIE10;
  35527. }
  35528. return isIE11 || isIE10;
  35529. }
  35530. /**
  35531. * Returns the offset parent of the given element
  35532. * @method
  35533. * @memberof Popper.Utils
  35534. * @argument {Element} element
  35535. * @returns {Element} offset parent
  35536. */
  35537. function getOffsetParent(element) {
  35538. if (!element) {
  35539. return document.documentElement;
  35540. }
  35541. var noOffsetParent = isIE(10) ? document.body : null;
  35542. // NOTE: 1 DOM access here
  35543. var offsetParent = element.offsetParent || null;
  35544. // Skip hidden elements which don't have an offsetParent
  35545. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  35546. offsetParent = (element = element.nextElementSibling).offsetParent;
  35547. }
  35548. var nodeName = offsetParent && offsetParent.nodeName;
  35549. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  35550. return element ? element.ownerDocument.documentElement : document.documentElement;
  35551. }
  35552. // .offsetParent will return the closest TH, TD or TABLE in case
  35553. // no offsetParent is present, I hate this job...
  35554. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  35555. return getOffsetParent(offsetParent);
  35556. }
  35557. return offsetParent;
  35558. }
  35559. function isOffsetContainer(element) {
  35560. var nodeName = element.nodeName;
  35561. if (nodeName === 'BODY') {
  35562. return false;
  35563. }
  35564. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  35565. }
  35566. /**
  35567. * Finds the root node (document, shadowDOM root) of the given element
  35568. * @method
  35569. * @memberof Popper.Utils
  35570. * @argument {Element} node
  35571. * @returns {Element} root node
  35572. */
  35573. function getRoot(node) {
  35574. if (node.parentNode !== null) {
  35575. return getRoot(node.parentNode);
  35576. }
  35577. return node;
  35578. }
  35579. /**
  35580. * Finds the offset parent common to the two provided nodes
  35581. * @method
  35582. * @memberof Popper.Utils
  35583. * @argument {Element} element1
  35584. * @argument {Element} element2
  35585. * @returns {Element} common offset parent
  35586. */
  35587. function findCommonOffsetParent(element1, element2) {
  35588. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35589. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  35590. return document.documentElement;
  35591. }
  35592. // Here we make sure to give as "start" the element that comes first in the DOM
  35593. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  35594. var start = order ? element1 : element2;
  35595. var end = order ? element2 : element1;
  35596. // Get common ancestor container
  35597. var range = document.createRange();
  35598. range.setStart(start, 0);
  35599. range.setEnd(end, 0);
  35600. var commonAncestorContainer = range.commonAncestorContainer;
  35601. // Both nodes are inside #document
  35602. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  35603. if (isOffsetContainer(commonAncestorContainer)) {
  35604. return commonAncestorContainer;
  35605. }
  35606. return getOffsetParent(commonAncestorContainer);
  35607. }
  35608. // one of the nodes is inside shadowDOM, find which one
  35609. var element1root = getRoot(element1);
  35610. if (element1root.host) {
  35611. return findCommonOffsetParent(element1root.host, element2);
  35612. } else {
  35613. return findCommonOffsetParent(element1, getRoot(element2).host);
  35614. }
  35615. }
  35616. /**
  35617. * Gets the scroll value of the given element in the given side (top and left)
  35618. * @method
  35619. * @memberof Popper.Utils
  35620. * @argument {Element} element
  35621. * @argument {String} side `top` or `left`
  35622. * @returns {number} amount of scrolled pixels
  35623. */
  35624. function getScroll(element) {
  35625. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  35626. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  35627. var nodeName = element.nodeName;
  35628. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35629. var html = element.ownerDocument.documentElement;
  35630. var scrollingElement = element.ownerDocument.scrollingElement || html;
  35631. return scrollingElement[upperSide];
  35632. }
  35633. return element[upperSide];
  35634. }
  35635. /*
  35636. * Sum or subtract the element scroll values (left and top) from a given rect object
  35637. * @method
  35638. * @memberof Popper.Utils
  35639. * @param {Object} rect - Rect object you want to change
  35640. * @param {HTMLElement} element - The element from the function reads the scroll values
  35641. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  35642. * @return {Object} rect - The modifier rect object
  35643. */
  35644. function includeScroll(rect, element) {
  35645. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35646. var scrollTop = getScroll(element, 'top');
  35647. var scrollLeft = getScroll(element, 'left');
  35648. var modifier = subtract ? -1 : 1;
  35649. rect.top += scrollTop * modifier;
  35650. rect.bottom += scrollTop * modifier;
  35651. rect.left += scrollLeft * modifier;
  35652. rect.right += scrollLeft * modifier;
  35653. return rect;
  35654. }
  35655. /*
  35656. * Helper to detect borders of a given element
  35657. * @method
  35658. * @memberof Popper.Utils
  35659. * @param {CSSStyleDeclaration} styles
  35660. * Result of `getStyleComputedProperty` on the given element
  35661. * @param {String} axis - `x` or `y`
  35662. * @return {number} borders - The borders size of the given axis
  35663. */
  35664. function getBordersSize(styles, axis) {
  35665. var sideA = axis === 'x' ? 'Left' : 'Top';
  35666. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  35667. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  35668. }
  35669. function getSize(axis, body, html, computedStyle) {
  35670. 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);
  35671. }
  35672. function getWindowSizes(document) {
  35673. var body = document.body;
  35674. var html = document.documentElement;
  35675. var computedStyle = isIE(10) && getComputedStyle(html);
  35676. return {
  35677. height: getSize('Height', body, html, computedStyle),
  35678. width: getSize('Width', body, html, computedStyle)
  35679. };
  35680. }
  35681. var classCallCheck = function (instance, Constructor) {
  35682. if (!(instance instanceof Constructor)) {
  35683. throw new TypeError("Cannot call a class as a function");
  35684. }
  35685. };
  35686. var createClass = function () {
  35687. function defineProperties(target, props) {
  35688. for (var i = 0; i < props.length; i++) {
  35689. var descriptor = props[i];
  35690. descriptor.enumerable = descriptor.enumerable || false;
  35691. descriptor.configurable = true;
  35692. if ("value" in descriptor) descriptor.writable = true;
  35693. Object.defineProperty(target, descriptor.key, descriptor);
  35694. }
  35695. }
  35696. return function (Constructor, protoProps, staticProps) {
  35697. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  35698. if (staticProps) defineProperties(Constructor, staticProps);
  35699. return Constructor;
  35700. };
  35701. }();
  35702. var defineProperty = function (obj, key, value) {
  35703. if (key in obj) {
  35704. Object.defineProperty(obj, key, {
  35705. value: value,
  35706. enumerable: true,
  35707. configurable: true,
  35708. writable: true
  35709. });
  35710. } else {
  35711. obj[key] = value;
  35712. }
  35713. return obj;
  35714. };
  35715. var _extends = Object.assign || function (target) {
  35716. for (var i = 1; i < arguments.length; i++) {
  35717. var source = arguments[i];
  35718. for (var key in source) {
  35719. if (Object.prototype.hasOwnProperty.call(source, key)) {
  35720. target[key] = source[key];
  35721. }
  35722. }
  35723. }
  35724. return target;
  35725. };
  35726. /**
  35727. * Given element offsets, generate an output similar to getBoundingClientRect
  35728. * @method
  35729. * @memberof Popper.Utils
  35730. * @argument {Object} offsets
  35731. * @returns {Object} ClientRect like output
  35732. */
  35733. function getClientRect(offsets) {
  35734. return _extends({}, offsets, {
  35735. right: offsets.left + offsets.width,
  35736. bottom: offsets.top + offsets.height
  35737. });
  35738. }
  35739. /**
  35740. * Get bounding client rect of given element
  35741. * @method
  35742. * @memberof Popper.Utils
  35743. * @param {HTMLElement} element
  35744. * @return {Object} client rect
  35745. */
  35746. function getBoundingClientRect(element) {
  35747. var rect = {};
  35748. // IE10 10 FIX: Please, don't ask, the element isn't
  35749. // considered in DOM in some circumstances...
  35750. // This isn't reproducible in IE10 compatibility mode of IE11
  35751. try {
  35752. if (isIE(10)) {
  35753. rect = element.getBoundingClientRect();
  35754. var scrollTop = getScroll(element, 'top');
  35755. var scrollLeft = getScroll(element, 'left');
  35756. rect.top += scrollTop;
  35757. rect.left += scrollLeft;
  35758. rect.bottom += scrollTop;
  35759. rect.right += scrollLeft;
  35760. } else {
  35761. rect = element.getBoundingClientRect();
  35762. }
  35763. } catch (e) {}
  35764. var result = {
  35765. left: rect.left,
  35766. top: rect.top,
  35767. width: rect.right - rect.left,
  35768. height: rect.bottom - rect.top
  35769. };
  35770. // subtract scrollbar size from sizes
  35771. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  35772. var width = sizes.width || element.clientWidth || result.width;
  35773. var height = sizes.height || element.clientHeight || result.height;
  35774. var horizScrollbar = element.offsetWidth - width;
  35775. var vertScrollbar = element.offsetHeight - height;
  35776. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  35777. // we make this check conditional for performance reasons
  35778. if (horizScrollbar || vertScrollbar) {
  35779. var styles = getStyleComputedProperty(element);
  35780. horizScrollbar -= getBordersSize(styles, 'x');
  35781. vertScrollbar -= getBordersSize(styles, 'y');
  35782. result.width -= horizScrollbar;
  35783. result.height -= vertScrollbar;
  35784. }
  35785. return getClientRect(result);
  35786. }
  35787. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  35788. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35789. var isIE10 = isIE(10);
  35790. var isHTML = parent.nodeName === 'HTML';
  35791. var childrenRect = getBoundingClientRect(children);
  35792. var parentRect = getBoundingClientRect(parent);
  35793. var scrollParent = getScrollParent(children);
  35794. var styles = getStyleComputedProperty(parent);
  35795. var borderTopWidth = parseFloat(styles.borderTopWidth);
  35796. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  35797. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  35798. if (fixedPosition && isHTML) {
  35799. parentRect.top = Math.max(parentRect.top, 0);
  35800. parentRect.left = Math.max(parentRect.left, 0);
  35801. }
  35802. var offsets = getClientRect({
  35803. top: childrenRect.top - parentRect.top - borderTopWidth,
  35804. left: childrenRect.left - parentRect.left - borderLeftWidth,
  35805. width: childrenRect.width,
  35806. height: childrenRect.height
  35807. });
  35808. offsets.marginTop = 0;
  35809. offsets.marginLeft = 0;
  35810. // Subtract margins of documentElement in case it's being used as parent
  35811. // we do this only on HTML because it's the only element that behaves
  35812. // differently when margins are applied to it. The margins are included in
  35813. // the box of the documentElement, in the other cases not.
  35814. if (!isIE10 && isHTML) {
  35815. var marginTop = parseFloat(styles.marginTop);
  35816. var marginLeft = parseFloat(styles.marginLeft);
  35817. offsets.top -= borderTopWidth - marginTop;
  35818. offsets.bottom -= borderTopWidth - marginTop;
  35819. offsets.left -= borderLeftWidth - marginLeft;
  35820. offsets.right -= borderLeftWidth - marginLeft;
  35821. // Attach marginTop and marginLeft because in some circumstances we may need them
  35822. offsets.marginTop = marginTop;
  35823. offsets.marginLeft = marginLeft;
  35824. }
  35825. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  35826. offsets = includeScroll(offsets, parent);
  35827. }
  35828. return offsets;
  35829. }
  35830. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  35831. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35832. var html = element.ownerDocument.documentElement;
  35833. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  35834. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  35835. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  35836. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  35837. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  35838. var offset = {
  35839. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  35840. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  35841. width: width,
  35842. height: height
  35843. };
  35844. return getClientRect(offset);
  35845. }
  35846. /**
  35847. * Check if the given element is fixed or is inside a fixed parent
  35848. * @method
  35849. * @memberof Popper.Utils
  35850. * @argument {Element} element
  35851. * @argument {Element} customContainer
  35852. * @returns {Boolean} answer to "isFixed?"
  35853. */
  35854. function isFixed(element) {
  35855. var nodeName = element.nodeName;
  35856. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35857. return false;
  35858. }
  35859. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  35860. return true;
  35861. }
  35862. var parentNode = getParentNode(element);
  35863. if (!parentNode) {
  35864. return false;
  35865. }
  35866. return isFixed(parentNode);
  35867. }
  35868. /**
  35869. * Finds the first parent of an element that has a transformed property defined
  35870. * @method
  35871. * @memberof Popper.Utils
  35872. * @argument {Element} element
  35873. * @returns {Element} first transformed parent or documentElement
  35874. */
  35875. function getFixedPositionOffsetParent(element) {
  35876. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35877. if (!element || !element.parentElement || isIE()) {
  35878. return document.documentElement;
  35879. }
  35880. var el = element.parentElement;
  35881. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  35882. el = el.parentElement;
  35883. }
  35884. return el || document.documentElement;
  35885. }
  35886. /**
  35887. * Computed the boundaries limits and return them
  35888. * @method
  35889. * @memberof Popper.Utils
  35890. * @param {HTMLElement} popper
  35891. * @param {HTMLElement} reference
  35892. * @param {number} padding
  35893. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  35894. * @param {Boolean} fixedPosition - Is in fixed position mode
  35895. * @returns {Object} Coordinates of the boundaries
  35896. */
  35897. function getBoundaries(popper, reference, padding, boundariesElement) {
  35898. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  35899. // NOTE: 1 DOM access here
  35900. var boundaries = { top: 0, left: 0 };
  35901. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35902. // Handle viewport case
  35903. if (boundariesElement === 'viewport') {
  35904. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  35905. } else {
  35906. // Handle other cases based on DOM element used as boundaries
  35907. var boundariesNode = void 0;
  35908. if (boundariesElement === 'scrollParent') {
  35909. boundariesNode = getScrollParent(getParentNode(reference));
  35910. if (boundariesNode.nodeName === 'BODY') {
  35911. boundariesNode = popper.ownerDocument.documentElement;
  35912. }
  35913. } else if (boundariesElement === 'window') {
  35914. boundariesNode = popper.ownerDocument.documentElement;
  35915. } else {
  35916. boundariesNode = boundariesElement;
  35917. }
  35918. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  35919. // In case of HTML, we need a different computation
  35920. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  35921. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35922. height = _getWindowSizes.height,
  35923. width = _getWindowSizes.width;
  35924. boundaries.top += offsets.top - offsets.marginTop;
  35925. boundaries.bottom = height + offsets.top;
  35926. boundaries.left += offsets.left - offsets.marginLeft;
  35927. boundaries.right = width + offsets.left;
  35928. } else {
  35929. // for all the other DOM elements, this one is good
  35930. boundaries = offsets;
  35931. }
  35932. }
  35933. // Add paddings
  35934. padding = padding || 0;
  35935. var isPaddingNumber = typeof padding === 'number';
  35936. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35937. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35938. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35939. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35940. return boundaries;
  35941. }
  35942. function getArea(_ref) {
  35943. var width = _ref.width,
  35944. height = _ref.height;
  35945. return width * height;
  35946. }
  35947. /**
  35948. * Utility used to transform the `auto` placement to the placement with more
  35949. * available space.
  35950. * @method
  35951. * @memberof Popper.Utils
  35952. * @argument {Object} data - The data object generated by update method
  35953. * @argument {Object} options - Modifiers configuration and options
  35954. * @returns {Object} The data object, properly modified
  35955. */
  35956. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35957. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35958. if (placement.indexOf('auto') === -1) {
  35959. return placement;
  35960. }
  35961. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35962. var rects = {
  35963. top: {
  35964. width: boundaries.width,
  35965. height: refRect.top - boundaries.top
  35966. },
  35967. right: {
  35968. width: boundaries.right - refRect.right,
  35969. height: boundaries.height
  35970. },
  35971. bottom: {
  35972. width: boundaries.width,
  35973. height: boundaries.bottom - refRect.bottom
  35974. },
  35975. left: {
  35976. width: refRect.left - boundaries.left,
  35977. height: boundaries.height
  35978. }
  35979. };
  35980. var sortedAreas = Object.keys(rects).map(function (key) {
  35981. return _extends({
  35982. key: key
  35983. }, rects[key], {
  35984. area: getArea(rects[key])
  35985. });
  35986. }).sort(function (a, b) {
  35987. return b.area - a.area;
  35988. });
  35989. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35990. var width = _ref2.width,
  35991. height = _ref2.height;
  35992. return width >= popper.clientWidth && height >= popper.clientHeight;
  35993. });
  35994. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35995. var variation = placement.split('-')[1];
  35996. return computedPlacement + (variation ? '-' + variation : '');
  35997. }
  35998. /**
  35999. * Get offsets to the reference element
  36000. * @method
  36001. * @memberof Popper.Utils
  36002. * @param {Object} state
  36003. * @param {Element} popper - the popper element
  36004. * @param {Element} reference - the reference element (the popper will be relative to this)
  36005. * @param {Element} fixedPosition - is in fixed position mode
  36006. * @returns {Object} An object containing the offsets which will be applied to the popper
  36007. */
  36008. function getReferenceOffsets(state, popper, reference) {
  36009. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  36010. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  36011. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  36012. }
  36013. /**
  36014. * Get the outer sizes of the given element (offset size + margins)
  36015. * @method
  36016. * @memberof Popper.Utils
  36017. * @argument {Element} element
  36018. * @returns {Object} object containing width and height properties
  36019. */
  36020. function getOuterSizes(element) {
  36021. var window = element.ownerDocument.defaultView;
  36022. var styles = window.getComputedStyle(element);
  36023. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  36024. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  36025. var result = {
  36026. width: element.offsetWidth + y,
  36027. height: element.offsetHeight + x
  36028. };
  36029. return result;
  36030. }
  36031. /**
  36032. * Get the opposite placement of the given one
  36033. * @method
  36034. * @memberof Popper.Utils
  36035. * @argument {String} placement
  36036. * @returns {String} flipped placement
  36037. */
  36038. function getOppositePlacement(placement) {
  36039. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  36040. return placement.replace(/left|right|bottom|top/g, function (matched) {
  36041. return hash[matched];
  36042. });
  36043. }
  36044. /**
  36045. * Get offsets to the popper
  36046. * @method
  36047. * @memberof Popper.Utils
  36048. * @param {Object} position - CSS position the Popper will get applied
  36049. * @param {HTMLElement} popper - the popper element
  36050. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  36051. * @param {String} placement - one of the valid placement options
  36052. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  36053. */
  36054. function getPopperOffsets(popper, referenceOffsets, placement) {
  36055. placement = placement.split('-')[0];
  36056. // Get popper node sizes
  36057. var popperRect = getOuterSizes(popper);
  36058. // Add position, width and height to our offsets object
  36059. var popperOffsets = {
  36060. width: popperRect.width,
  36061. height: popperRect.height
  36062. };
  36063. // depending by the popper placement we have to compute its offsets slightly differently
  36064. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  36065. var mainSide = isHoriz ? 'top' : 'left';
  36066. var secondarySide = isHoriz ? 'left' : 'top';
  36067. var measurement = isHoriz ? 'height' : 'width';
  36068. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  36069. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  36070. if (placement === secondarySide) {
  36071. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  36072. } else {
  36073. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  36074. }
  36075. return popperOffsets;
  36076. }
  36077. /**
  36078. * Mimics the `find` method of Array
  36079. * @method
  36080. * @memberof Popper.Utils
  36081. * @argument {Array} arr
  36082. * @argument prop
  36083. * @argument value
  36084. * @returns index or -1
  36085. */
  36086. function find(arr, check) {
  36087. // use native find if supported
  36088. if (Array.prototype.find) {
  36089. return arr.find(check);
  36090. }
  36091. // use `filter` to obtain the same behavior of `find`
  36092. return arr.filter(check)[0];
  36093. }
  36094. /**
  36095. * Return the index of the matching object
  36096. * @method
  36097. * @memberof Popper.Utils
  36098. * @argument {Array} arr
  36099. * @argument prop
  36100. * @argument value
  36101. * @returns index or -1
  36102. */
  36103. function findIndex(arr, prop, value) {
  36104. // use native findIndex if supported
  36105. if (Array.prototype.findIndex) {
  36106. return arr.findIndex(function (cur) {
  36107. return cur[prop] === value;
  36108. });
  36109. }
  36110. // use `find` + `indexOf` if `findIndex` isn't supported
  36111. var match = find(arr, function (obj) {
  36112. return obj[prop] === value;
  36113. });
  36114. return arr.indexOf(match);
  36115. }
  36116. /**
  36117. * Loop trough the list of modifiers and run them in order,
  36118. * each of them will then edit the data object.
  36119. * @method
  36120. * @memberof Popper.Utils
  36121. * @param {dataObject} data
  36122. * @param {Array} modifiers
  36123. * @param {String} ends - Optional modifier name used as stopper
  36124. * @returns {dataObject}
  36125. */
  36126. function runModifiers(modifiers, data, ends) {
  36127. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  36128. modifiersToRun.forEach(function (modifier) {
  36129. if (modifier['function']) {
  36130. // eslint-disable-line dot-notation
  36131. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  36132. }
  36133. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  36134. if (modifier.enabled && isFunction(fn)) {
  36135. // Add properties to offsets to make them a complete clientRect object
  36136. // we do this before each modifier to make sure the previous one doesn't
  36137. // mess with these values
  36138. data.offsets.popper = getClientRect(data.offsets.popper);
  36139. data.offsets.reference = getClientRect(data.offsets.reference);
  36140. data = fn(data, modifier);
  36141. }
  36142. });
  36143. return data;
  36144. }
  36145. /**
  36146. * Updates the position of the popper, computing the new offsets and applying
  36147. * the new style.<br />
  36148. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  36149. * @method
  36150. * @memberof Popper
  36151. */
  36152. function update() {
  36153. // if popper is destroyed, don't perform any further update
  36154. if (this.state.isDestroyed) {
  36155. return;
  36156. }
  36157. var data = {
  36158. instance: this,
  36159. styles: {},
  36160. arrowStyles: {},
  36161. attributes: {},
  36162. flipped: false,
  36163. offsets: {}
  36164. };
  36165. // compute reference element offsets
  36166. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  36167. // compute auto placement, store placement inside the data object,
  36168. // modifiers will be able to edit `placement` if needed
  36169. // and refer to originalPlacement to know the original value
  36170. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  36171. // store the computed placement inside `originalPlacement`
  36172. data.originalPlacement = data.placement;
  36173. data.positionFixed = this.options.positionFixed;
  36174. // compute the popper offsets
  36175. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  36176. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  36177. // run the modifiers
  36178. data = runModifiers(this.modifiers, data);
  36179. // the first `update` will call `onCreate` callback
  36180. // the other ones will call `onUpdate` callback
  36181. if (!this.state.isCreated) {
  36182. this.state.isCreated = true;
  36183. this.options.onCreate(data);
  36184. } else {
  36185. this.options.onUpdate(data);
  36186. }
  36187. }
  36188. /**
  36189. * Helper used to know if the given modifier is enabled.
  36190. * @method
  36191. * @memberof Popper.Utils
  36192. * @returns {Boolean}
  36193. */
  36194. function isModifierEnabled(modifiers, modifierName) {
  36195. return modifiers.some(function (_ref) {
  36196. var name = _ref.name,
  36197. enabled = _ref.enabled;
  36198. return enabled && name === modifierName;
  36199. });
  36200. }
  36201. /**
  36202. * Get the prefixed supported property name
  36203. * @method
  36204. * @memberof Popper.Utils
  36205. * @argument {String} property (camelCase)
  36206. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  36207. */
  36208. function getSupportedPropertyName(property) {
  36209. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  36210. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  36211. for (var i = 0; i < prefixes.length; i++) {
  36212. var prefix = prefixes[i];
  36213. var toCheck = prefix ? '' + prefix + upperProp : property;
  36214. if (typeof document.body.style[toCheck] !== 'undefined') {
  36215. return toCheck;
  36216. }
  36217. }
  36218. return null;
  36219. }
  36220. /**
  36221. * Destroys the popper.
  36222. * @method
  36223. * @memberof Popper
  36224. */
  36225. function destroy() {
  36226. this.state.isDestroyed = true;
  36227. // touch DOM only if `applyStyle` modifier is enabled
  36228. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  36229. this.popper.removeAttribute('x-placement');
  36230. this.popper.style.position = '';
  36231. this.popper.style.top = '';
  36232. this.popper.style.left = '';
  36233. this.popper.style.right = '';
  36234. this.popper.style.bottom = '';
  36235. this.popper.style.willChange = '';
  36236. this.popper.style[getSupportedPropertyName('transform')] = '';
  36237. }
  36238. this.disableEventListeners();
  36239. // remove the popper if user explicitly asked for the deletion on destroy
  36240. // do not use `remove` because IE11 doesn't support it
  36241. if (this.options.removeOnDestroy) {
  36242. this.popper.parentNode.removeChild(this.popper);
  36243. }
  36244. return this;
  36245. }
  36246. /**
  36247. * Get the window associated with the element
  36248. * @argument {Element} element
  36249. * @returns {Window}
  36250. */
  36251. function getWindow(element) {
  36252. var ownerDocument = element.ownerDocument;
  36253. return ownerDocument ? ownerDocument.defaultView : window;
  36254. }
  36255. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  36256. var isBody = scrollParent.nodeName === 'BODY';
  36257. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  36258. target.addEventListener(event, callback, { passive: true });
  36259. if (!isBody) {
  36260. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  36261. }
  36262. scrollParents.push(target);
  36263. }
  36264. /**
  36265. * Setup needed event listeners used to update the popper position
  36266. * @method
  36267. * @memberof Popper.Utils
  36268. * @private
  36269. */
  36270. function setupEventListeners(reference, options, state, updateBound) {
  36271. // Resize event listener on window
  36272. state.updateBound = updateBound;
  36273. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  36274. // Scroll event listener on scroll parents
  36275. var scrollElement = getScrollParent(reference);
  36276. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  36277. state.scrollElement = scrollElement;
  36278. state.eventsEnabled = true;
  36279. return state;
  36280. }
  36281. /**
  36282. * It will add resize/scroll events and start recalculating
  36283. * position of the popper element when they are triggered.
  36284. * @method
  36285. * @memberof Popper
  36286. */
  36287. function enableEventListeners() {
  36288. if (!this.state.eventsEnabled) {
  36289. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  36290. }
  36291. }
  36292. /**
  36293. * Remove event listeners used to update the popper position
  36294. * @method
  36295. * @memberof Popper.Utils
  36296. * @private
  36297. */
  36298. function removeEventListeners(reference, state) {
  36299. // Remove resize event listener on window
  36300. getWindow(reference).removeEventListener('resize', state.updateBound);
  36301. // Remove scroll event listener on scroll parents
  36302. state.scrollParents.forEach(function (target) {
  36303. target.removeEventListener('scroll', state.updateBound);
  36304. });
  36305. // Reset state
  36306. state.updateBound = null;
  36307. state.scrollParents = [];
  36308. state.scrollElement = null;
  36309. state.eventsEnabled = false;
  36310. return state;
  36311. }
  36312. /**
  36313. * It will remove resize/scroll events and won't recalculate popper position
  36314. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  36315. * unless you call `update` method manually.
  36316. * @method
  36317. * @memberof Popper
  36318. */
  36319. function disableEventListeners() {
  36320. if (this.state.eventsEnabled) {
  36321. cancelAnimationFrame(this.scheduleUpdate);
  36322. this.state = removeEventListeners(this.reference, this.state);
  36323. }
  36324. }
  36325. /**
  36326. * Tells if a given input is a number
  36327. * @method
  36328. * @memberof Popper.Utils
  36329. * @param {*} input to check
  36330. * @return {Boolean}
  36331. */
  36332. function isNumeric(n) {
  36333. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  36334. }
  36335. /**
  36336. * Set the style to the given popper
  36337. * @method
  36338. * @memberof Popper.Utils
  36339. * @argument {Element} element - Element to apply the style to
  36340. * @argument {Object} styles
  36341. * Object with a list of properties and values which will be applied to the element
  36342. */
  36343. function setStyles(element, styles) {
  36344. Object.keys(styles).forEach(function (prop) {
  36345. var unit = '';
  36346. // add unit if the value is numeric and is one of the following
  36347. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  36348. unit = 'px';
  36349. }
  36350. element.style[prop] = styles[prop] + unit;
  36351. });
  36352. }
  36353. /**
  36354. * Set the attributes to the given popper
  36355. * @method
  36356. * @memberof Popper.Utils
  36357. * @argument {Element} element - Element to apply the attributes to
  36358. * @argument {Object} styles
  36359. * Object with a list of properties and values which will be applied to the element
  36360. */
  36361. function setAttributes(element, attributes) {
  36362. Object.keys(attributes).forEach(function (prop) {
  36363. var value = attributes[prop];
  36364. if (value !== false) {
  36365. element.setAttribute(prop, attributes[prop]);
  36366. } else {
  36367. element.removeAttribute(prop);
  36368. }
  36369. });
  36370. }
  36371. /**
  36372. * @function
  36373. * @memberof Modifiers
  36374. * @argument {Object} data - The data object generated by `update` method
  36375. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  36376. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  36377. * @argument {Object} options - Modifiers configuration and options
  36378. * @returns {Object} The same data object
  36379. */
  36380. function applyStyle(data) {
  36381. // any property present in `data.styles` will be applied to the popper,
  36382. // in this way we can make the 3rd party modifiers add custom styles to it
  36383. // Be aware, modifiers could override the properties defined in the previous
  36384. // lines of this modifier!
  36385. setStyles(data.instance.popper, data.styles);
  36386. // any property present in `data.attributes` will be applied to the popper,
  36387. // they will be set as HTML attributes of the element
  36388. setAttributes(data.instance.popper, data.attributes);
  36389. // if arrowElement is defined and arrowStyles has some properties
  36390. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  36391. setStyles(data.arrowElement, data.arrowStyles);
  36392. }
  36393. return data;
  36394. }
  36395. /**
  36396. * Set the x-placement attribute before everything else because it could be used
  36397. * to add margins to the popper margins needs to be calculated to get the
  36398. * correct popper offsets.
  36399. * @method
  36400. * @memberof Popper.modifiers
  36401. * @param {HTMLElement} reference - The reference element used to position the popper
  36402. * @param {HTMLElement} popper - The HTML element used as popper
  36403. * @param {Object} options - Popper.js options
  36404. */
  36405. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  36406. // compute reference element offsets
  36407. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  36408. // compute auto placement, store placement inside the data object,
  36409. // modifiers will be able to edit `placement` if needed
  36410. // and refer to originalPlacement to know the original value
  36411. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  36412. popper.setAttribute('x-placement', placement);
  36413. // Apply `position` to popper before anything else because
  36414. // without the position applied we can't guarantee correct computations
  36415. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  36416. return options;
  36417. }
  36418. /**
  36419. * @function
  36420. * @memberof Popper.Utils
  36421. * @argument {Object} data - The data object generated by `update` method
  36422. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  36423. * @returns {Object} The popper's position offsets rounded
  36424. *
  36425. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  36426. * good as it can be within reason.
  36427. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  36428. *
  36429. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  36430. * as well on High DPI screens).
  36431. *
  36432. * Firefox prefers no rounding for positioning and does not have blurriness on
  36433. * high DPI screens.
  36434. *
  36435. * Only horizontal placement and left/right values need to be considered.
  36436. */
  36437. function getRoundedOffsets(data, shouldRound) {
  36438. var _data$offsets = data.offsets,
  36439. popper = _data$offsets.popper,
  36440. reference = _data$offsets.reference;
  36441. var round = Math.round,
  36442. floor = Math.floor;
  36443. var noRound = function noRound(v) {
  36444. return v;
  36445. };
  36446. var referenceWidth = round(reference.width);
  36447. var popperWidth = round(popper.width);
  36448. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  36449. var isVariation = data.placement.indexOf('-') !== -1;
  36450. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  36451. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  36452. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  36453. var verticalToInteger = !shouldRound ? noRound : round;
  36454. return {
  36455. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  36456. top: verticalToInteger(popper.top),
  36457. bottom: verticalToInteger(popper.bottom),
  36458. right: horizontalToInteger(popper.right)
  36459. };
  36460. }
  36461. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  36462. /**
  36463. * @function
  36464. * @memberof Modifiers
  36465. * @argument {Object} data - The data object generated by `update` method
  36466. * @argument {Object} options - Modifiers configuration and options
  36467. * @returns {Object} The data object, properly modified
  36468. */
  36469. function computeStyle(data, options) {
  36470. var x = options.x,
  36471. y = options.y;
  36472. var popper = data.offsets.popper;
  36473. // Remove this legacy support in Popper.js v2
  36474. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  36475. return modifier.name === 'applyStyle';
  36476. }).gpuAcceleration;
  36477. if (legacyGpuAccelerationOption !== undefined) {
  36478. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  36479. }
  36480. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  36481. var offsetParent = getOffsetParent(data.instance.popper);
  36482. var offsetParentRect = getBoundingClientRect(offsetParent);
  36483. // Styles
  36484. var styles = {
  36485. position: popper.position
  36486. };
  36487. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  36488. var sideA = x === 'bottom' ? 'top' : 'bottom';
  36489. var sideB = y === 'right' ? 'left' : 'right';
  36490. // if gpuAcceleration is set to `true` and transform is supported,
  36491. // we use `translate3d` to apply the position to the popper we
  36492. // automatically use the supported prefixed version if needed
  36493. var prefixedProperty = getSupportedPropertyName('transform');
  36494. // now, let's make a step back and look at this code closely (wtf?)
  36495. // If the content of the popper grows once it's been positioned, it
  36496. // may happen that the popper gets misplaced because of the new content
  36497. // overflowing its reference element
  36498. // To avoid this problem, we provide two options (x and y), which allow
  36499. // the consumer to define the offset origin.
  36500. // If we position a popper on top of a reference element, we can set
  36501. // `x` to `top` to make the popper grow towards its top instead of
  36502. // its bottom.
  36503. var left = void 0,
  36504. top = void 0;
  36505. if (sideA === 'bottom') {
  36506. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  36507. // and not the bottom of the html element
  36508. if (offsetParent.nodeName === 'HTML') {
  36509. top = -offsetParent.clientHeight + offsets.bottom;
  36510. } else {
  36511. top = -offsetParentRect.height + offsets.bottom;
  36512. }
  36513. } else {
  36514. top = offsets.top;
  36515. }
  36516. if (sideB === 'right') {
  36517. if (offsetParent.nodeName === 'HTML') {
  36518. left = -offsetParent.clientWidth + offsets.right;
  36519. } else {
  36520. left = -offsetParentRect.width + offsets.right;
  36521. }
  36522. } else {
  36523. left = offsets.left;
  36524. }
  36525. if (gpuAcceleration && prefixedProperty) {
  36526. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  36527. styles[sideA] = 0;
  36528. styles[sideB] = 0;
  36529. styles.willChange = 'transform';
  36530. } else {
  36531. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  36532. var invertTop = sideA === 'bottom' ? -1 : 1;
  36533. var invertLeft = sideB === 'right' ? -1 : 1;
  36534. styles[sideA] = top * invertTop;
  36535. styles[sideB] = left * invertLeft;
  36536. styles.willChange = sideA + ', ' + sideB;
  36537. }
  36538. // Attributes
  36539. var attributes = {
  36540. 'x-placement': data.placement
  36541. };
  36542. // Update `data` attributes, styles and arrowStyles
  36543. data.attributes = _extends({}, attributes, data.attributes);
  36544. data.styles = _extends({}, styles, data.styles);
  36545. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  36546. return data;
  36547. }
  36548. /**
  36549. * Helper used to know if the given modifier depends from another one.<br />
  36550. * It checks if the needed modifier is listed and enabled.
  36551. * @method
  36552. * @memberof Popper.Utils
  36553. * @param {Array} modifiers - list of modifiers
  36554. * @param {String} requestingName - name of requesting modifier
  36555. * @param {String} requestedName - name of requested modifier
  36556. * @returns {Boolean}
  36557. */
  36558. function isModifierRequired(modifiers, requestingName, requestedName) {
  36559. var requesting = find(modifiers, function (_ref) {
  36560. var name = _ref.name;
  36561. return name === requestingName;
  36562. });
  36563. var isRequired = !!requesting && modifiers.some(function (modifier) {
  36564. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  36565. });
  36566. if (!isRequired) {
  36567. var _requesting = '`' + requestingName + '`';
  36568. var requested = '`' + requestedName + '`';
  36569. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  36570. }
  36571. return isRequired;
  36572. }
  36573. /**
  36574. * @function
  36575. * @memberof Modifiers
  36576. * @argument {Object} data - The data object generated by update method
  36577. * @argument {Object} options - Modifiers configuration and options
  36578. * @returns {Object} The data object, properly modified
  36579. */
  36580. function arrow(data, options) {
  36581. var _data$offsets$arrow;
  36582. // arrow depends on keepTogether in order to work
  36583. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  36584. return data;
  36585. }
  36586. var arrowElement = options.element;
  36587. // if arrowElement is a string, suppose it's a CSS selector
  36588. if (typeof arrowElement === 'string') {
  36589. arrowElement = data.instance.popper.querySelector(arrowElement);
  36590. // if arrowElement is not found, don't run the modifier
  36591. if (!arrowElement) {
  36592. return data;
  36593. }
  36594. } else {
  36595. // if the arrowElement isn't a query selector we must check that the
  36596. // provided DOM node is child of its popper node
  36597. if (!data.instance.popper.contains(arrowElement)) {
  36598. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  36599. return data;
  36600. }
  36601. }
  36602. var placement = data.placement.split('-')[0];
  36603. var _data$offsets = data.offsets,
  36604. popper = _data$offsets.popper,
  36605. reference = _data$offsets.reference;
  36606. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  36607. var len = isVertical ? 'height' : 'width';
  36608. var sideCapitalized = isVertical ? 'Top' : 'Left';
  36609. var side = sideCapitalized.toLowerCase();
  36610. var altSide = isVertical ? 'left' : 'top';
  36611. var opSide = isVertical ? 'bottom' : 'right';
  36612. var arrowElementSize = getOuterSizes(arrowElement)[len];
  36613. //
  36614. // extends keepTogether behavior making sure the popper and its
  36615. // reference have enough pixels in conjunction
  36616. //
  36617. // top/left side
  36618. if (reference[opSide] - arrowElementSize < popper[side]) {
  36619. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  36620. }
  36621. // bottom/right side
  36622. if (reference[side] + arrowElementSize > popper[opSide]) {
  36623. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  36624. }
  36625. data.offsets.popper = getClientRect(data.offsets.popper);
  36626. // compute center of the popper
  36627. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  36628. // Compute the sideValue using the updated popper offsets
  36629. // take popper margin in account because we don't have this info available
  36630. var css = getStyleComputedProperty(data.instance.popper);
  36631. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  36632. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  36633. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  36634. // prevent arrowElement from being placed not contiguously to its popper
  36635. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  36636. data.arrowElement = arrowElement;
  36637. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  36638. return data;
  36639. }
  36640. /**
  36641. * Get the opposite placement variation of the given one
  36642. * @method
  36643. * @memberof Popper.Utils
  36644. * @argument {String} placement variation
  36645. * @returns {String} flipped placement variation
  36646. */
  36647. function getOppositeVariation(variation) {
  36648. if (variation === 'end') {
  36649. return 'start';
  36650. } else if (variation === 'start') {
  36651. return 'end';
  36652. }
  36653. return variation;
  36654. }
  36655. /**
  36656. * List of accepted placements to use as values of the `placement` option.<br />
  36657. * Valid placements are:
  36658. * - `auto`
  36659. * - `top`
  36660. * - `right`
  36661. * - `bottom`
  36662. * - `left`
  36663. *
  36664. * Each placement can have a variation from this list:
  36665. * - `-start`
  36666. * - `-end`
  36667. *
  36668. * Variations are interpreted easily if you think of them as the left to right
  36669. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  36670. * is right.<br />
  36671. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  36672. *
  36673. * Some valid examples are:
  36674. * - `top-end` (on top of reference, right aligned)
  36675. * - `right-start` (on right of reference, top aligned)
  36676. * - `bottom` (on bottom, centered)
  36677. * - `auto-end` (on the side with more space available, alignment depends by placement)
  36678. *
  36679. * @static
  36680. * @type {Array}
  36681. * @enum {String}
  36682. * @readonly
  36683. * @method placements
  36684. * @memberof Popper
  36685. */
  36686. 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'];
  36687. // Get rid of `auto` `auto-start` and `auto-end`
  36688. var validPlacements = placements.slice(3);
  36689. /**
  36690. * Given an initial placement, returns all the subsequent placements
  36691. * clockwise (or counter-clockwise).
  36692. *
  36693. * @method
  36694. * @memberof Popper.Utils
  36695. * @argument {String} placement - A valid placement (it accepts variations)
  36696. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  36697. * @returns {Array} placements including their variations
  36698. */
  36699. function clockwise(placement) {
  36700. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  36701. var index = validPlacements.indexOf(placement);
  36702. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  36703. return counter ? arr.reverse() : arr;
  36704. }
  36705. var BEHAVIORS = {
  36706. FLIP: 'flip',
  36707. CLOCKWISE: 'clockwise',
  36708. COUNTERCLOCKWISE: 'counterclockwise'
  36709. };
  36710. /**
  36711. * @function
  36712. * @memberof Modifiers
  36713. * @argument {Object} data - The data object generated by update method
  36714. * @argument {Object} options - Modifiers configuration and options
  36715. * @returns {Object} The data object, properly modified
  36716. */
  36717. function flip(data, options) {
  36718. // if `inner` modifier is enabled, we can't use the `flip` modifier
  36719. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  36720. return data;
  36721. }
  36722. if (data.flipped && data.placement === data.originalPlacement) {
  36723. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  36724. return data;
  36725. }
  36726. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  36727. var placement = data.placement.split('-')[0];
  36728. var placementOpposite = getOppositePlacement(placement);
  36729. var variation = data.placement.split('-')[1] || '';
  36730. var flipOrder = [];
  36731. switch (options.behavior) {
  36732. case BEHAVIORS.FLIP:
  36733. flipOrder = [placement, placementOpposite];
  36734. break;
  36735. case BEHAVIORS.CLOCKWISE:
  36736. flipOrder = clockwise(placement);
  36737. break;
  36738. case BEHAVIORS.COUNTERCLOCKWISE:
  36739. flipOrder = clockwise(placement, true);
  36740. break;
  36741. default:
  36742. flipOrder = options.behavior;
  36743. }
  36744. flipOrder.forEach(function (step, index) {
  36745. if (placement !== step || flipOrder.length === index + 1) {
  36746. return data;
  36747. }
  36748. placement = data.placement.split('-')[0];
  36749. placementOpposite = getOppositePlacement(placement);
  36750. var popperOffsets = data.offsets.popper;
  36751. var refOffsets = data.offsets.reference;
  36752. // using floor because the reference offsets may contain decimals we are not going to consider here
  36753. var floor = Math.floor;
  36754. 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);
  36755. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  36756. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  36757. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  36758. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  36759. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  36760. // flip the variation if required
  36761. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36762. // flips variation if reference element overflows boundaries
  36763. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  36764. // flips variation if popper content overflows boundaries
  36765. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  36766. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  36767. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  36768. // this boolean to detect any flip loop
  36769. data.flipped = true;
  36770. if (overlapsRef || overflowsBoundaries) {
  36771. placement = flipOrder[index + 1];
  36772. }
  36773. if (flippedVariation) {
  36774. variation = getOppositeVariation(variation);
  36775. }
  36776. data.placement = placement + (variation ? '-' + variation : '');
  36777. // this object contains `position`, we want to preserve it along with
  36778. // any additional property we may add in the future
  36779. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  36780. data = runModifiers(data.instance.modifiers, data, 'flip');
  36781. }
  36782. });
  36783. return data;
  36784. }
  36785. /**
  36786. * @function
  36787. * @memberof Modifiers
  36788. * @argument {Object} data - The data object generated by update method
  36789. * @argument {Object} options - Modifiers configuration and options
  36790. * @returns {Object} The data object, properly modified
  36791. */
  36792. function keepTogether(data) {
  36793. var _data$offsets = data.offsets,
  36794. popper = _data$offsets.popper,
  36795. reference = _data$offsets.reference;
  36796. var placement = data.placement.split('-')[0];
  36797. var floor = Math.floor;
  36798. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36799. var side = isVertical ? 'right' : 'bottom';
  36800. var opSide = isVertical ? 'left' : 'top';
  36801. var measurement = isVertical ? 'width' : 'height';
  36802. if (popper[side] < floor(reference[opSide])) {
  36803. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  36804. }
  36805. if (popper[opSide] > floor(reference[side])) {
  36806. data.offsets.popper[opSide] = floor(reference[side]);
  36807. }
  36808. return data;
  36809. }
  36810. /**
  36811. * Converts a string containing value + unit into a px value number
  36812. * @function
  36813. * @memberof {modifiers~offset}
  36814. * @private
  36815. * @argument {String} str - Value + unit string
  36816. * @argument {String} measurement - `height` or `width`
  36817. * @argument {Object} popperOffsets
  36818. * @argument {Object} referenceOffsets
  36819. * @returns {Number|String}
  36820. * Value in pixels, or original string if no values were extracted
  36821. */
  36822. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  36823. // separate value from unit
  36824. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  36825. var value = +split[1];
  36826. var unit = split[2];
  36827. // If it's not a number it's an operator, I guess
  36828. if (!value) {
  36829. return str;
  36830. }
  36831. if (unit.indexOf('%') === 0) {
  36832. var element = void 0;
  36833. switch (unit) {
  36834. case '%p':
  36835. element = popperOffsets;
  36836. break;
  36837. case '%':
  36838. case '%r':
  36839. default:
  36840. element = referenceOffsets;
  36841. }
  36842. var rect = getClientRect(element);
  36843. return rect[measurement] / 100 * value;
  36844. } else if (unit === 'vh' || unit === 'vw') {
  36845. // if is a vh or vw, we calculate the size based on the viewport
  36846. var size = void 0;
  36847. if (unit === 'vh') {
  36848. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  36849. } else {
  36850. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  36851. }
  36852. return size / 100 * value;
  36853. } else {
  36854. // if is an explicit pixel unit, we get rid of the unit and keep the value
  36855. // if is an implicit unit, it's px, and we return just the value
  36856. return value;
  36857. }
  36858. }
  36859. /**
  36860. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  36861. * @function
  36862. * @memberof {modifiers~offset}
  36863. * @private
  36864. * @argument {String} offset
  36865. * @argument {Object} popperOffsets
  36866. * @argument {Object} referenceOffsets
  36867. * @argument {String} basePlacement
  36868. * @returns {Array} a two cells array with x and y offsets in numbers
  36869. */
  36870. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  36871. var offsets = [0, 0];
  36872. // Use height if placement is left or right and index is 0 otherwise use width
  36873. // in this way the first offset will use an axis and the second one
  36874. // will use the other one
  36875. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  36876. // Split the offset string to obtain a list of values and operands
  36877. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  36878. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  36879. return frag.trim();
  36880. });
  36881. // Detect if the offset string contains a pair of values or a single one
  36882. // they could be separated by comma or space
  36883. var divider = fragments.indexOf(find(fragments, function (frag) {
  36884. return frag.search(/,|\s/) !== -1;
  36885. }));
  36886. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  36887. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  36888. }
  36889. // If divider is found, we divide the list of values and operands to divide
  36890. // them by ofset X and Y.
  36891. var splitRegex = /\s*,\s*|\s+/;
  36892. 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];
  36893. // Convert the values with units to absolute pixels to allow our computations
  36894. ops = ops.map(function (op, index) {
  36895. // Most of the units rely on the orientation of the popper
  36896. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  36897. var mergeWithPrevious = false;
  36898. return op
  36899. // This aggregates any `+` or `-` sign that aren't considered operators
  36900. // e.g.: 10 + +5 => [10, +, +5]
  36901. .reduce(function (a, b) {
  36902. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  36903. a[a.length - 1] = b;
  36904. mergeWithPrevious = true;
  36905. return a;
  36906. } else if (mergeWithPrevious) {
  36907. a[a.length - 1] += b;
  36908. mergeWithPrevious = false;
  36909. return a;
  36910. } else {
  36911. return a.concat(b);
  36912. }
  36913. }, [])
  36914. // Here we convert the string values into number values (in px)
  36915. .map(function (str) {
  36916. return toValue(str, measurement, popperOffsets, referenceOffsets);
  36917. });
  36918. });
  36919. // Loop trough the offsets arrays and execute the operations
  36920. ops.forEach(function (op, index) {
  36921. op.forEach(function (frag, index2) {
  36922. if (isNumeric(frag)) {
  36923. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36924. }
  36925. });
  36926. });
  36927. return offsets;
  36928. }
  36929. /**
  36930. * @function
  36931. * @memberof Modifiers
  36932. * @argument {Object} data - The data object generated by update method
  36933. * @argument {Object} options - Modifiers configuration and options
  36934. * @argument {Number|String} options.offset=0
  36935. * The offset value as described in the modifier description
  36936. * @returns {Object} The data object, properly modified
  36937. */
  36938. function offset(data, _ref) {
  36939. var offset = _ref.offset;
  36940. var placement = data.placement,
  36941. _data$offsets = data.offsets,
  36942. popper = _data$offsets.popper,
  36943. reference = _data$offsets.reference;
  36944. var basePlacement = placement.split('-')[0];
  36945. var offsets = void 0;
  36946. if (isNumeric(+offset)) {
  36947. offsets = [+offset, 0];
  36948. } else {
  36949. offsets = parseOffset(offset, popper, reference, basePlacement);
  36950. }
  36951. if (basePlacement === 'left') {
  36952. popper.top += offsets[0];
  36953. popper.left -= offsets[1];
  36954. } else if (basePlacement === 'right') {
  36955. popper.top += offsets[0];
  36956. popper.left += offsets[1];
  36957. } else if (basePlacement === 'top') {
  36958. popper.left += offsets[0];
  36959. popper.top -= offsets[1];
  36960. } else if (basePlacement === 'bottom') {
  36961. popper.left += offsets[0];
  36962. popper.top += offsets[1];
  36963. }
  36964. data.popper = popper;
  36965. return data;
  36966. }
  36967. /**
  36968. * @function
  36969. * @memberof Modifiers
  36970. * @argument {Object} data - The data object generated by `update` method
  36971. * @argument {Object} options - Modifiers configuration and options
  36972. * @returns {Object} The data object, properly modified
  36973. */
  36974. function preventOverflow(data, options) {
  36975. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36976. // If offsetParent is the reference element, we really want to
  36977. // go one step up and use the next offsetParent as reference to
  36978. // avoid to make this modifier completely useless and look like broken
  36979. if (data.instance.reference === boundariesElement) {
  36980. boundariesElement = getOffsetParent(boundariesElement);
  36981. }
  36982. // NOTE: DOM access here
  36983. // resets the popper's position so that the document size can be calculated excluding
  36984. // the size of the popper element itself
  36985. var transformProp = getSupportedPropertyName('transform');
  36986. var popperStyles = data.instance.popper.style; // assignment to help minification
  36987. var top = popperStyles.top,
  36988. left = popperStyles.left,
  36989. transform = popperStyles[transformProp];
  36990. popperStyles.top = '';
  36991. popperStyles.left = '';
  36992. popperStyles[transformProp] = '';
  36993. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36994. // NOTE: DOM access here
  36995. // restores the original style properties after the offsets have been computed
  36996. popperStyles.top = top;
  36997. popperStyles.left = left;
  36998. popperStyles[transformProp] = transform;
  36999. options.boundaries = boundaries;
  37000. var order = options.priority;
  37001. var popper = data.offsets.popper;
  37002. var check = {
  37003. primary: function primary(placement) {
  37004. var value = popper[placement];
  37005. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  37006. value = Math.max(popper[placement], boundaries[placement]);
  37007. }
  37008. return defineProperty({}, placement, value);
  37009. },
  37010. secondary: function secondary(placement) {
  37011. var mainSide = placement === 'right' ? 'left' : 'top';
  37012. var value = popper[mainSide];
  37013. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  37014. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  37015. }
  37016. return defineProperty({}, mainSide, value);
  37017. }
  37018. };
  37019. order.forEach(function (placement) {
  37020. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  37021. popper = _extends({}, popper, check[side](placement));
  37022. });
  37023. data.offsets.popper = popper;
  37024. return data;
  37025. }
  37026. /**
  37027. * @function
  37028. * @memberof Modifiers
  37029. * @argument {Object} data - The data object generated by `update` method
  37030. * @argument {Object} options - Modifiers configuration and options
  37031. * @returns {Object} The data object, properly modified
  37032. */
  37033. function shift(data) {
  37034. var placement = data.placement;
  37035. var basePlacement = placement.split('-')[0];
  37036. var shiftvariation = placement.split('-')[1];
  37037. // if shift shiftvariation is specified, run the modifier
  37038. if (shiftvariation) {
  37039. var _data$offsets = data.offsets,
  37040. reference = _data$offsets.reference,
  37041. popper = _data$offsets.popper;
  37042. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  37043. var side = isVertical ? 'left' : 'top';
  37044. var measurement = isVertical ? 'width' : 'height';
  37045. var shiftOffsets = {
  37046. start: defineProperty({}, side, reference[side]),
  37047. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  37048. };
  37049. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  37050. }
  37051. return data;
  37052. }
  37053. /**
  37054. * @function
  37055. * @memberof Modifiers
  37056. * @argument {Object} data - The data object generated by update method
  37057. * @argument {Object} options - Modifiers configuration and options
  37058. * @returns {Object} The data object, properly modified
  37059. */
  37060. function hide(data) {
  37061. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  37062. return data;
  37063. }
  37064. var refRect = data.offsets.reference;
  37065. var bound = find(data.instance.modifiers, function (modifier) {
  37066. return modifier.name === 'preventOverflow';
  37067. }).boundaries;
  37068. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  37069. // Avoid unnecessary DOM access if visibility hasn't changed
  37070. if (data.hide === true) {
  37071. return data;
  37072. }
  37073. data.hide = true;
  37074. data.attributes['x-out-of-boundaries'] = '';
  37075. } else {
  37076. // Avoid unnecessary DOM access if visibility hasn't changed
  37077. if (data.hide === false) {
  37078. return data;
  37079. }
  37080. data.hide = false;
  37081. data.attributes['x-out-of-boundaries'] = false;
  37082. }
  37083. return data;
  37084. }
  37085. /**
  37086. * @function
  37087. * @memberof Modifiers
  37088. * @argument {Object} data - The data object generated by `update` method
  37089. * @argument {Object} options - Modifiers configuration and options
  37090. * @returns {Object} The data object, properly modified
  37091. */
  37092. function inner(data) {
  37093. var placement = data.placement;
  37094. var basePlacement = placement.split('-')[0];
  37095. var _data$offsets = data.offsets,
  37096. popper = _data$offsets.popper,
  37097. reference = _data$offsets.reference;
  37098. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  37099. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  37100. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  37101. data.placement = getOppositePlacement(placement);
  37102. data.offsets.popper = getClientRect(popper);
  37103. return data;
  37104. }
  37105. /**
  37106. * Modifier function, each modifier can have a function of this type assigned
  37107. * to its `fn` property.<br />
  37108. * These functions will be called on each update, this means that you must
  37109. * make sure they are performant enough to avoid performance bottlenecks.
  37110. *
  37111. * @function ModifierFn
  37112. * @argument {dataObject} data - The data object generated by `update` method
  37113. * @argument {Object} options - Modifiers configuration and options
  37114. * @returns {dataObject} The data object, properly modified
  37115. */
  37116. /**
  37117. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  37118. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  37119. * needed by the library.
  37120. *
  37121. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  37122. * All the other properties are configurations that could be tweaked.
  37123. * @namespace modifiers
  37124. */
  37125. var modifiers = {
  37126. /**
  37127. * Modifier used to shift the popper on the start or end of its reference
  37128. * element.<br />
  37129. * It will read the variation of the `placement` property.<br />
  37130. * It can be one either `-end` or `-start`.
  37131. * @memberof modifiers
  37132. * @inner
  37133. */
  37134. shift: {
  37135. /** @prop {number} order=100 - Index used to define the order of execution */
  37136. order: 100,
  37137. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37138. enabled: true,
  37139. /** @prop {ModifierFn} */
  37140. fn: shift
  37141. },
  37142. /**
  37143. * The `offset` modifier can shift your popper on both its axis.
  37144. *
  37145. * It accepts the following units:
  37146. * - `px` or unit-less, interpreted as pixels
  37147. * - `%` or `%r`, percentage relative to the length of the reference element
  37148. * - `%p`, percentage relative to the length of the popper element
  37149. * - `vw`, CSS viewport width unit
  37150. * - `vh`, CSS viewport height unit
  37151. *
  37152. * For length is intended the main axis relative to the placement of the popper.<br />
  37153. * This means that if the placement is `top` or `bottom`, the length will be the
  37154. * `width`. In case of `left` or `right`, it will be the `height`.
  37155. *
  37156. * You can provide a single value (as `Number` or `String`), or a pair of values
  37157. * as `String` divided by a comma or one (or more) white spaces.<br />
  37158. * The latter is a deprecated method because it leads to confusion and will be
  37159. * removed in v2.<br />
  37160. * Additionally, it accepts additions and subtractions between different units.
  37161. * Note that multiplications and divisions aren't supported.
  37162. *
  37163. * Valid examples are:
  37164. * ```
  37165. * 10
  37166. * '10%'
  37167. * '10, 10'
  37168. * '10%, 10'
  37169. * '10 + 10%'
  37170. * '10 - 5vh + 3%'
  37171. * '-10px + 5vh, 5px - 6%'
  37172. * ```
  37173. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  37174. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  37175. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  37176. *
  37177. * @memberof modifiers
  37178. * @inner
  37179. */
  37180. offset: {
  37181. /** @prop {number} order=200 - Index used to define the order of execution */
  37182. order: 200,
  37183. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37184. enabled: true,
  37185. /** @prop {ModifierFn} */
  37186. fn: offset,
  37187. /** @prop {Number|String} offset=0
  37188. * The offset value as described in the modifier description
  37189. */
  37190. offset: 0
  37191. },
  37192. /**
  37193. * Modifier used to prevent the popper from being positioned outside the boundary.
  37194. *
  37195. * A scenario exists where the reference itself is not within the boundaries.<br />
  37196. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  37197. * In this case we need to decide whether the popper should either:
  37198. *
  37199. * - detach from the reference and remain "trapped" in the boundaries, or
  37200. * - if it should ignore the boundary and "escape with its reference"
  37201. *
  37202. * When `escapeWithReference` is set to`true` and reference is completely
  37203. * outside its boundaries, the popper will overflow (or completely leave)
  37204. * the boundaries in order to remain attached to the edge of the reference.
  37205. *
  37206. * @memberof modifiers
  37207. * @inner
  37208. */
  37209. preventOverflow: {
  37210. /** @prop {number} order=300 - Index used to define the order of execution */
  37211. order: 300,
  37212. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37213. enabled: true,
  37214. /** @prop {ModifierFn} */
  37215. fn: preventOverflow,
  37216. /**
  37217. * @prop {Array} [priority=['left','right','top','bottom']]
  37218. * Popper will try to prevent overflow following these priorities by default,
  37219. * then, it could overflow on the left and on top of the `boundariesElement`
  37220. */
  37221. priority: ['left', 'right', 'top', 'bottom'],
  37222. /**
  37223. * @prop {number} padding=5
  37224. * Amount of pixel used to define a minimum distance between the boundaries
  37225. * and the popper. This makes sure the popper always has a little padding
  37226. * between the edges of its container
  37227. */
  37228. padding: 5,
  37229. /**
  37230. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  37231. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  37232. * `viewport` or any DOM element.
  37233. */
  37234. boundariesElement: 'scrollParent'
  37235. },
  37236. /**
  37237. * Modifier used to make sure the reference and its popper stay near each other
  37238. * without leaving any gap between the two. Especially useful when the arrow is
  37239. * enabled and you want to ensure that it points to its reference element.
  37240. * It cares only about the first axis. You can still have poppers with margin
  37241. * between the popper and its reference element.
  37242. * @memberof modifiers
  37243. * @inner
  37244. */
  37245. keepTogether: {
  37246. /** @prop {number} order=400 - Index used to define the order of execution */
  37247. order: 400,
  37248. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37249. enabled: true,
  37250. /** @prop {ModifierFn} */
  37251. fn: keepTogether
  37252. },
  37253. /**
  37254. * This modifier is used to move the `arrowElement` of the popper to make
  37255. * sure it is positioned between the reference element and its popper element.
  37256. * It will read the outer size of the `arrowElement` node to detect how many
  37257. * pixels of conjunction are needed.
  37258. *
  37259. * It has no effect if no `arrowElement` is provided.
  37260. * @memberof modifiers
  37261. * @inner
  37262. */
  37263. arrow: {
  37264. /** @prop {number} order=500 - Index used to define the order of execution */
  37265. order: 500,
  37266. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37267. enabled: true,
  37268. /** @prop {ModifierFn} */
  37269. fn: arrow,
  37270. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  37271. element: '[x-arrow]'
  37272. },
  37273. /**
  37274. * Modifier used to flip the popper's placement when it starts to overlap its
  37275. * reference element.
  37276. *
  37277. * Requires the `preventOverflow` modifier before it in order to work.
  37278. *
  37279. * **NOTE:** this modifier will interrupt the current update cycle and will
  37280. * restart it if it detects the need to flip the placement.
  37281. * @memberof modifiers
  37282. * @inner
  37283. */
  37284. flip: {
  37285. /** @prop {number} order=600 - Index used to define the order of execution */
  37286. order: 600,
  37287. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37288. enabled: true,
  37289. /** @prop {ModifierFn} */
  37290. fn: flip,
  37291. /**
  37292. * @prop {String|Array} behavior='flip'
  37293. * The behavior used to change the popper's placement. It can be one of
  37294. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  37295. * placements (with optional variations)
  37296. */
  37297. behavior: 'flip',
  37298. /**
  37299. * @prop {number} padding=5
  37300. * The popper will flip if it hits the edges of the `boundariesElement`
  37301. */
  37302. padding: 5,
  37303. /**
  37304. * @prop {String|HTMLElement} boundariesElement='viewport'
  37305. * The element which will define the boundaries of the popper position.
  37306. * The popper will never be placed outside of the defined boundaries
  37307. * (except if `keepTogether` is enabled)
  37308. */
  37309. boundariesElement: 'viewport',
  37310. /**
  37311. * @prop {Boolean} flipVariations=false
  37312. * The popper will switch placement variation between `-start` and `-end` when
  37313. * the reference element overlaps its boundaries.
  37314. *
  37315. * The original placement should have a set variation.
  37316. */
  37317. flipVariations: false,
  37318. /**
  37319. * @prop {Boolean} flipVariationsByContent=false
  37320. * The popper will switch placement variation between `-start` and `-end` when
  37321. * the popper element overlaps its reference boundaries.
  37322. *
  37323. * The original placement should have a set variation.
  37324. */
  37325. flipVariationsByContent: false
  37326. },
  37327. /**
  37328. * Modifier used to make the popper flow toward the inner of the reference element.
  37329. * By default, when this modifier is disabled, the popper will be placed outside
  37330. * the reference element.
  37331. * @memberof modifiers
  37332. * @inner
  37333. */
  37334. inner: {
  37335. /** @prop {number} order=700 - Index used to define the order of execution */
  37336. order: 700,
  37337. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  37338. enabled: false,
  37339. /** @prop {ModifierFn} */
  37340. fn: inner
  37341. },
  37342. /**
  37343. * Modifier used to hide the popper when its reference element is outside of the
  37344. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  37345. * be used to hide with a CSS selector the popper when its reference is
  37346. * out of boundaries.
  37347. *
  37348. * Requires the `preventOverflow` modifier before it in order to work.
  37349. * @memberof modifiers
  37350. * @inner
  37351. */
  37352. hide: {
  37353. /** @prop {number} order=800 - Index used to define the order of execution */
  37354. order: 800,
  37355. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37356. enabled: true,
  37357. /** @prop {ModifierFn} */
  37358. fn: hide
  37359. },
  37360. /**
  37361. * Computes the style that will be applied to the popper element to gets
  37362. * properly positioned.
  37363. *
  37364. * Note that this modifier will not touch the DOM, it just prepares the styles
  37365. * so that `applyStyle` modifier can apply it. This separation is useful
  37366. * in case you need to replace `applyStyle` with a custom implementation.
  37367. *
  37368. * This modifier has `850` as `order` value to maintain backward compatibility
  37369. * with previous versions of Popper.js. Expect the modifiers ordering method
  37370. * to change in future major versions of the library.
  37371. *
  37372. * @memberof modifiers
  37373. * @inner
  37374. */
  37375. computeStyle: {
  37376. /** @prop {number} order=850 - Index used to define the order of execution */
  37377. order: 850,
  37378. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37379. enabled: true,
  37380. /** @prop {ModifierFn} */
  37381. fn: computeStyle,
  37382. /**
  37383. * @prop {Boolean} gpuAcceleration=true
  37384. * If true, it uses the CSS 3D transformation to position the popper.
  37385. * Otherwise, it will use the `top` and `left` properties
  37386. */
  37387. gpuAcceleration: true,
  37388. /**
  37389. * @prop {string} [x='bottom']
  37390. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  37391. * Change this if your popper should grow in a direction different from `bottom`
  37392. */
  37393. x: 'bottom',
  37394. /**
  37395. * @prop {string} [x='left']
  37396. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  37397. * Change this if your popper should grow in a direction different from `right`
  37398. */
  37399. y: 'right'
  37400. },
  37401. /**
  37402. * Applies the computed styles to the popper element.
  37403. *
  37404. * All the DOM manipulations are limited to this modifier. This is useful in case
  37405. * you want to integrate Popper.js inside a framework or view library and you
  37406. * want to delegate all the DOM manipulations to it.
  37407. *
  37408. * Note that if you disable this modifier, you must make sure the popper element
  37409. * has its position set to `absolute` before Popper.js can do its work!
  37410. *
  37411. * Just disable this modifier and define your own to achieve the desired effect.
  37412. *
  37413. * @memberof modifiers
  37414. * @inner
  37415. */
  37416. applyStyle: {
  37417. /** @prop {number} order=900 - Index used to define the order of execution */
  37418. order: 900,
  37419. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37420. enabled: true,
  37421. /** @prop {ModifierFn} */
  37422. fn: applyStyle,
  37423. /** @prop {Function} */
  37424. onLoad: applyStyleOnLoad,
  37425. /**
  37426. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  37427. * @prop {Boolean} gpuAcceleration=true
  37428. * If true, it uses the CSS 3D transformation to position the popper.
  37429. * Otherwise, it will use the `top` and `left` properties
  37430. */
  37431. gpuAcceleration: undefined
  37432. }
  37433. };
  37434. /**
  37435. * The `dataObject` is an object containing all the information used by Popper.js.
  37436. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  37437. * @name dataObject
  37438. * @property {Object} data.instance The Popper.js instance
  37439. * @property {String} data.placement Placement applied to popper
  37440. * @property {String} data.originalPlacement Placement originally defined on init
  37441. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  37442. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  37443. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  37444. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37445. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37446. * @property {Object} data.boundaries Offsets of the popper boundaries
  37447. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  37448. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  37449. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  37450. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  37451. */
  37452. /**
  37453. * Default options provided to Popper.js constructor.<br />
  37454. * These can be overridden using the `options` argument of Popper.js.<br />
  37455. * To override an option, simply pass an object with the same
  37456. * structure of the `options` object, as the 3rd argument. For example:
  37457. * ```
  37458. * new Popper(ref, pop, {
  37459. * modifiers: {
  37460. * preventOverflow: { enabled: false }
  37461. * }
  37462. * })
  37463. * ```
  37464. * @type {Object}
  37465. * @static
  37466. * @memberof Popper
  37467. */
  37468. var Defaults = {
  37469. /**
  37470. * Popper's placement.
  37471. * @prop {Popper.placements} placement='bottom'
  37472. */
  37473. placement: 'bottom',
  37474. /**
  37475. * Set this to true if you want popper to position it self in 'fixed' mode
  37476. * @prop {Boolean} positionFixed=false
  37477. */
  37478. positionFixed: false,
  37479. /**
  37480. * Whether events (resize, scroll) are initially enabled.
  37481. * @prop {Boolean} eventsEnabled=true
  37482. */
  37483. eventsEnabled: true,
  37484. /**
  37485. * Set to true if you want to automatically remove the popper when
  37486. * you call the `destroy` method.
  37487. * @prop {Boolean} removeOnDestroy=false
  37488. */
  37489. removeOnDestroy: false,
  37490. /**
  37491. * Callback called when the popper is created.<br />
  37492. * By default, it is set to no-op.<br />
  37493. * Access Popper.js instance with `data.instance`.
  37494. * @prop {onCreate}
  37495. */
  37496. onCreate: function onCreate() {},
  37497. /**
  37498. * Callback called when the popper is updated. This callback is not called
  37499. * on the initialization/creation of the popper, but only on subsequent
  37500. * updates.<br />
  37501. * By default, it is set to no-op.<br />
  37502. * Access Popper.js instance with `data.instance`.
  37503. * @prop {onUpdate}
  37504. */
  37505. onUpdate: function onUpdate() {},
  37506. /**
  37507. * List of modifiers used to modify the offsets before they are applied to the popper.
  37508. * They provide most of the functionalities of Popper.js.
  37509. * @prop {modifiers}
  37510. */
  37511. modifiers: modifiers
  37512. };
  37513. /**
  37514. * @callback onCreate
  37515. * @param {dataObject} data
  37516. */
  37517. /**
  37518. * @callback onUpdate
  37519. * @param {dataObject} data
  37520. */
  37521. // Utils
  37522. // Methods
  37523. var Popper = function () {
  37524. /**
  37525. * Creates a new Popper.js instance.
  37526. * @class Popper
  37527. * @param {Element|referenceObject} reference - The reference element used to position the popper
  37528. * @param {Element} popper - The HTML / XML element used as the popper
  37529. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  37530. * @return {Object} instance - The generated Popper.js instance
  37531. */
  37532. function Popper(reference, popper) {
  37533. var _this = this;
  37534. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  37535. classCallCheck(this, Popper);
  37536. this.scheduleUpdate = function () {
  37537. return requestAnimationFrame(_this.update);
  37538. };
  37539. // make update() debounced, so that it only runs at most once-per-tick
  37540. this.update = debounce(this.update.bind(this));
  37541. // with {} we create a new object with the options inside it
  37542. this.options = _extends({}, Popper.Defaults, options);
  37543. // init state
  37544. this.state = {
  37545. isDestroyed: false,
  37546. isCreated: false,
  37547. scrollParents: []
  37548. };
  37549. // get reference and popper elements (allow jQuery wrappers)
  37550. this.reference = reference && reference.jquery ? reference[0] : reference;
  37551. this.popper = popper && popper.jquery ? popper[0] : popper;
  37552. // Deep merge modifiers options
  37553. this.options.modifiers = {};
  37554. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  37555. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  37556. });
  37557. // Refactoring modifiers' list (Object => Array)
  37558. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  37559. return _extends({
  37560. name: name
  37561. }, _this.options.modifiers[name]);
  37562. })
  37563. // sort the modifiers by order
  37564. .sort(function (a, b) {
  37565. return a.order - b.order;
  37566. });
  37567. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  37568. // such code is executed in the same order of its modifier
  37569. // they could add new properties to their options configuration
  37570. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  37571. this.modifiers.forEach(function (modifierOptions) {
  37572. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  37573. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  37574. }
  37575. });
  37576. // fire the first update to position the popper in the right place
  37577. this.update();
  37578. var eventsEnabled = this.options.eventsEnabled;
  37579. if (eventsEnabled) {
  37580. // setup event listeners, they will take care of update the position in specific situations
  37581. this.enableEventListeners();
  37582. }
  37583. this.state.eventsEnabled = eventsEnabled;
  37584. }
  37585. // We can't use class properties because they don't get listed in the
  37586. // class prototype and break stuff like Sinon stubs
  37587. createClass(Popper, [{
  37588. key: 'update',
  37589. value: function update$$1() {
  37590. return update.call(this);
  37591. }
  37592. }, {
  37593. key: 'destroy',
  37594. value: function destroy$$1() {
  37595. return destroy.call(this);
  37596. }
  37597. }, {
  37598. key: 'enableEventListeners',
  37599. value: function enableEventListeners$$1() {
  37600. return enableEventListeners.call(this);
  37601. }
  37602. }, {
  37603. key: 'disableEventListeners',
  37604. value: function disableEventListeners$$1() {
  37605. return disableEventListeners.call(this);
  37606. }
  37607. /**
  37608. * Schedules an update. It will run on the next UI update available.
  37609. * @method scheduleUpdate
  37610. * @memberof Popper
  37611. */
  37612. /**
  37613. * Collection of utilities useful when writing custom modifiers.
  37614. * Starting from version 1.7, this method is available only if you
  37615. * include `popper-utils.js` before `popper.js`.
  37616. *
  37617. * **DEPRECATION**: This way to access PopperUtils is deprecated
  37618. * and will be removed in v2! Use the PopperUtils module directly instead.
  37619. * Due to the high instability of the methods contained in Utils, we can't
  37620. * guarantee them to follow semver. Use them at your own risk!
  37621. * @static
  37622. * @private
  37623. * @type {Object}
  37624. * @deprecated since version 1.8
  37625. * @member Utils
  37626. * @memberof Popper
  37627. */
  37628. }]);
  37629. return Popper;
  37630. }();
  37631. /**
  37632. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  37633. * and lets you use it as replacement of a real DOM node.<br />
  37634. * You can use this method to position a popper relatively to a set of coordinates
  37635. * in case you don't have a DOM node to use as reference.
  37636. *
  37637. * ```
  37638. * new Popper(referenceObject, popperNode);
  37639. * ```
  37640. *
  37641. * NB: This feature isn't supported in Internet Explorer 10.
  37642. * @name referenceObject
  37643. * @property {Function} data.getBoundingClientRect
  37644. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  37645. * @property {number} data.clientWidth
  37646. * An ES6 getter that will return the width of the virtual reference element.
  37647. * @property {number} data.clientHeight
  37648. * An ES6 getter that will return the height of the virtual reference element.
  37649. */
  37650. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  37651. Popper.placements = placements;
  37652. Popper.Defaults = Defaults;
  37653. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  37654. //# sourceMappingURL=popper.js.map
  37655. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  37656. /***/ }),
  37657. /***/ "./node_modules/process/browser.js":
  37658. /*!*****************************************!*\
  37659. !*** ./node_modules/process/browser.js ***!
  37660. \*****************************************/
  37661. /*! no static exports found */
  37662. /***/ (function(module, exports) {
  37663. // shim for using process in browser
  37664. var process = module.exports = {};
  37665. // cached from whatever global is present so that test runners that stub it
  37666. // don't break things. But we need to wrap it in a try catch in case it is
  37667. // wrapped in strict mode code which doesn't define any globals. It's inside a
  37668. // function because try/catches deoptimize in certain engines.
  37669. var cachedSetTimeout;
  37670. var cachedClearTimeout;
  37671. function defaultSetTimout() {
  37672. throw new Error('setTimeout has not been defined');
  37673. }
  37674. function defaultClearTimeout () {
  37675. throw new Error('clearTimeout has not been defined');
  37676. }
  37677. (function () {
  37678. try {
  37679. if (typeof setTimeout === 'function') {
  37680. cachedSetTimeout = setTimeout;
  37681. } else {
  37682. cachedSetTimeout = defaultSetTimout;
  37683. }
  37684. } catch (e) {
  37685. cachedSetTimeout = defaultSetTimout;
  37686. }
  37687. try {
  37688. if (typeof clearTimeout === 'function') {
  37689. cachedClearTimeout = clearTimeout;
  37690. } else {
  37691. cachedClearTimeout = defaultClearTimeout;
  37692. }
  37693. } catch (e) {
  37694. cachedClearTimeout = defaultClearTimeout;
  37695. }
  37696. } ())
  37697. function runTimeout(fun) {
  37698. if (cachedSetTimeout === setTimeout) {
  37699. //normal enviroments in sane situations
  37700. return setTimeout(fun, 0);
  37701. }
  37702. // if setTimeout wasn't available but was latter defined
  37703. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  37704. cachedSetTimeout = setTimeout;
  37705. return setTimeout(fun, 0);
  37706. }
  37707. try {
  37708. // when when somebody has screwed with setTimeout but no I.E. maddness
  37709. return cachedSetTimeout(fun, 0);
  37710. } catch(e){
  37711. try {
  37712. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37713. return cachedSetTimeout.call(null, fun, 0);
  37714. } catch(e){
  37715. // 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
  37716. return cachedSetTimeout.call(this, fun, 0);
  37717. }
  37718. }
  37719. }
  37720. function runClearTimeout(marker) {
  37721. if (cachedClearTimeout === clearTimeout) {
  37722. //normal enviroments in sane situations
  37723. return clearTimeout(marker);
  37724. }
  37725. // if clearTimeout wasn't available but was latter defined
  37726. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  37727. cachedClearTimeout = clearTimeout;
  37728. return clearTimeout(marker);
  37729. }
  37730. try {
  37731. // when when somebody has screwed with setTimeout but no I.E. maddness
  37732. return cachedClearTimeout(marker);
  37733. } catch (e){
  37734. try {
  37735. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37736. return cachedClearTimeout.call(null, marker);
  37737. } catch (e){
  37738. // 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.
  37739. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  37740. return cachedClearTimeout.call(this, marker);
  37741. }
  37742. }
  37743. }
  37744. var queue = [];
  37745. var draining = false;
  37746. var currentQueue;
  37747. var queueIndex = -1;
  37748. function cleanUpNextTick() {
  37749. if (!draining || !currentQueue) {
  37750. return;
  37751. }
  37752. draining = false;
  37753. if (currentQueue.length) {
  37754. queue = currentQueue.concat(queue);
  37755. } else {
  37756. queueIndex = -1;
  37757. }
  37758. if (queue.length) {
  37759. drainQueue();
  37760. }
  37761. }
  37762. function drainQueue() {
  37763. if (draining) {
  37764. return;
  37765. }
  37766. var timeout = runTimeout(cleanUpNextTick);
  37767. draining = true;
  37768. var len = queue.length;
  37769. while(len) {
  37770. currentQueue = queue;
  37771. queue = [];
  37772. while (++queueIndex < len) {
  37773. if (currentQueue) {
  37774. currentQueue[queueIndex].run();
  37775. }
  37776. }
  37777. queueIndex = -1;
  37778. len = queue.length;
  37779. }
  37780. currentQueue = null;
  37781. draining = false;
  37782. runClearTimeout(timeout);
  37783. }
  37784. process.nextTick = function (fun) {
  37785. var args = new Array(arguments.length - 1);
  37786. if (arguments.length > 1) {
  37787. for (var i = 1; i < arguments.length; i++) {
  37788. args[i - 1] = arguments[i];
  37789. }
  37790. }
  37791. queue.push(new Item(fun, args));
  37792. if (queue.length === 1 && !draining) {
  37793. runTimeout(drainQueue);
  37794. }
  37795. };
  37796. // v8 likes predictible objects
  37797. function Item(fun, array) {
  37798. this.fun = fun;
  37799. this.array = array;
  37800. }
  37801. Item.prototype.run = function () {
  37802. this.fun.apply(null, this.array);
  37803. };
  37804. process.title = 'browser';
  37805. process.browser = true;
  37806. process.env = {};
  37807. process.argv = [];
  37808. process.version = ''; // empty string to avoid regexp issues
  37809. process.versions = {};
  37810. function noop() {}
  37811. process.on = noop;
  37812. process.addListener = noop;
  37813. process.once = noop;
  37814. process.off = noop;
  37815. process.removeListener = noop;
  37816. process.removeAllListeners = noop;
  37817. process.emit = noop;
  37818. process.prependListener = noop;
  37819. process.prependOnceListener = noop;
  37820. process.listeners = function (name) { return [] }
  37821. process.binding = function (name) {
  37822. throw new Error('process.binding is not supported');
  37823. };
  37824. process.cwd = function () { return '/' };
  37825. process.chdir = function (dir) {
  37826. throw new Error('process.chdir is not supported');
  37827. };
  37828. process.umask = function() { return 0; };
  37829. /***/ }),
  37830. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  37831. /*!***************************************************!*\
  37832. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  37833. \***************************************************/
  37834. /*! no static exports found */
  37835. /***/ (function(module, exports, __webpack_require__) {
  37836. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  37837. * Pusher JavaScript Library v5.0.3
  37838. * https://pusher.com/
  37839. *
  37840. * Copyright 2017, Pusher
  37841. * Released under the MIT licence.
  37842. */
  37843. (function webpackUniversalModuleDefinition(root, factory) {
  37844. if(true)
  37845. module.exports = factory();
  37846. else {}
  37847. })(window, function() {
  37848. return /******/ (function(modules) { // webpackBootstrap
  37849. /******/ // The module cache
  37850. /******/ var installedModules = {};
  37851. /******/
  37852. /******/ // The require function
  37853. /******/ function __webpack_require__(moduleId) {
  37854. /******/
  37855. /******/ // Check if module is in cache
  37856. /******/ if(installedModules[moduleId]) {
  37857. /******/ return installedModules[moduleId].exports;
  37858. /******/ }
  37859. /******/ // Create a new module (and put it into the cache)
  37860. /******/ var module = installedModules[moduleId] = {
  37861. /******/ i: moduleId,
  37862. /******/ l: false,
  37863. /******/ exports: {}
  37864. /******/ };
  37865. /******/
  37866. /******/ // Execute the module function
  37867. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  37868. /******/
  37869. /******/ // Flag the module as loaded
  37870. /******/ module.l = true;
  37871. /******/
  37872. /******/ // Return the exports of the module
  37873. /******/ return module.exports;
  37874. /******/ }
  37875. /******/
  37876. /******/
  37877. /******/ // expose the modules object (__webpack_modules__)
  37878. /******/ __webpack_require__.m = modules;
  37879. /******/
  37880. /******/ // expose the module cache
  37881. /******/ __webpack_require__.c = installedModules;
  37882. /******/
  37883. /******/ // define getter function for harmony exports
  37884. /******/ __webpack_require__.d = function(exports, name, getter) {
  37885. /******/ if(!__webpack_require__.o(exports, name)) {
  37886. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  37887. /******/ }
  37888. /******/ };
  37889. /******/
  37890. /******/ // define __esModule on exports
  37891. /******/ __webpack_require__.r = function(exports) {
  37892. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  37893. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  37894. /******/ }
  37895. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  37896. /******/ };
  37897. /******/
  37898. /******/ // create a fake namespace object
  37899. /******/ // mode & 1: value is a module id, require it
  37900. /******/ // mode & 2: merge all properties of value into the ns
  37901. /******/ // mode & 4: return value when already ns object
  37902. /******/ // mode & 8|1: behave like require
  37903. /******/ __webpack_require__.t = function(value, mode) {
  37904. /******/ if(mode & 1) value = __webpack_require__(value);
  37905. /******/ if(mode & 8) return value;
  37906. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  37907. /******/ var ns = Object.create(null);
  37908. /******/ __webpack_require__.r(ns);
  37909. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  37910. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  37911. /******/ return ns;
  37912. /******/ };
  37913. /******/
  37914. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37915. /******/ __webpack_require__.n = function(module) {
  37916. /******/ var getter = module && module.__esModule ?
  37917. /******/ function getDefault() { return module['default']; } :
  37918. /******/ function getModuleExports() { return module; };
  37919. /******/ __webpack_require__.d(getter, 'a', getter);
  37920. /******/ return getter;
  37921. /******/ };
  37922. /******/
  37923. /******/ // Object.prototype.hasOwnProperty.call
  37924. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37925. /******/
  37926. /******/ // __webpack_public_path__
  37927. /******/ __webpack_require__.p = "";
  37928. /******/
  37929. /******/
  37930. /******/ // Load entry module and return exports
  37931. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37932. /******/ })
  37933. /************************************************************************/
  37934. /******/ ([
  37935. /* 0 */
  37936. /***/ (function(module, exports, __webpack_require__) {
  37937. (function(nacl) {
  37938. 'use strict';
  37939. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37940. // Public domain.
  37941. //
  37942. // Implementation derived from TweetNaCl version 20140427.
  37943. // See for details: http://tweetnacl.cr.yp.to/
  37944. var gf = function(init) {
  37945. var i, r = new Float64Array(16);
  37946. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37947. return r;
  37948. };
  37949. // Pluggable, initialized in high-level API below.
  37950. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37951. var _0 = new Uint8Array(16);
  37952. var _9 = new Uint8Array(32); _9[0] = 9;
  37953. var gf0 = gf(),
  37954. gf1 = gf([1]),
  37955. _121665 = gf([0xdb41, 1]),
  37956. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37957. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37958. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37959. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37960. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37961. function ts64(x, i, h, l) {
  37962. x[i] = (h >> 24) & 0xff;
  37963. x[i+1] = (h >> 16) & 0xff;
  37964. x[i+2] = (h >> 8) & 0xff;
  37965. x[i+3] = h & 0xff;
  37966. x[i+4] = (l >> 24) & 0xff;
  37967. x[i+5] = (l >> 16) & 0xff;
  37968. x[i+6] = (l >> 8) & 0xff;
  37969. x[i+7] = l & 0xff;
  37970. }
  37971. function vn(x, xi, y, yi, n) {
  37972. var i,d = 0;
  37973. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37974. return (1 & ((d - 1) >>> 8)) - 1;
  37975. }
  37976. function crypto_verify_16(x, xi, y, yi) {
  37977. return vn(x,xi,y,yi,16);
  37978. }
  37979. function crypto_verify_32(x, xi, y, yi) {
  37980. return vn(x,xi,y,yi,32);
  37981. }
  37982. function core_salsa20(o, p, k, c) {
  37983. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37984. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37985. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37986. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37987. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37988. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37989. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37990. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37991. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37992. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37993. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37994. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37995. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37996. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37997. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37998. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37999. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  38000. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  38001. x15 = j15, u;
  38002. for (var i = 0; i < 20; i += 2) {
  38003. u = x0 + x12 | 0;
  38004. x4 ^= u<<7 | u>>>(32-7);
  38005. u = x4 + x0 | 0;
  38006. x8 ^= u<<9 | u>>>(32-9);
  38007. u = x8 + x4 | 0;
  38008. x12 ^= u<<13 | u>>>(32-13);
  38009. u = x12 + x8 | 0;
  38010. x0 ^= u<<18 | u>>>(32-18);
  38011. u = x5 + x1 | 0;
  38012. x9 ^= u<<7 | u>>>(32-7);
  38013. u = x9 + x5 | 0;
  38014. x13 ^= u<<9 | u>>>(32-9);
  38015. u = x13 + x9 | 0;
  38016. x1 ^= u<<13 | u>>>(32-13);
  38017. u = x1 + x13 | 0;
  38018. x5 ^= u<<18 | u>>>(32-18);
  38019. u = x10 + x6 | 0;
  38020. x14 ^= u<<7 | u>>>(32-7);
  38021. u = x14 + x10 | 0;
  38022. x2 ^= u<<9 | u>>>(32-9);
  38023. u = x2 + x14 | 0;
  38024. x6 ^= u<<13 | u>>>(32-13);
  38025. u = x6 + x2 | 0;
  38026. x10 ^= u<<18 | u>>>(32-18);
  38027. u = x15 + x11 | 0;
  38028. x3 ^= u<<7 | u>>>(32-7);
  38029. u = x3 + x15 | 0;
  38030. x7 ^= u<<9 | u>>>(32-9);
  38031. u = x7 + x3 | 0;
  38032. x11 ^= u<<13 | u>>>(32-13);
  38033. u = x11 + x7 | 0;
  38034. x15 ^= u<<18 | u>>>(32-18);
  38035. u = x0 + x3 | 0;
  38036. x1 ^= u<<7 | u>>>(32-7);
  38037. u = x1 + x0 | 0;
  38038. x2 ^= u<<9 | u>>>(32-9);
  38039. u = x2 + x1 | 0;
  38040. x3 ^= u<<13 | u>>>(32-13);
  38041. u = x3 + x2 | 0;
  38042. x0 ^= u<<18 | u>>>(32-18);
  38043. u = x5 + x4 | 0;
  38044. x6 ^= u<<7 | u>>>(32-7);
  38045. u = x6 + x5 | 0;
  38046. x7 ^= u<<9 | u>>>(32-9);
  38047. u = x7 + x6 | 0;
  38048. x4 ^= u<<13 | u>>>(32-13);
  38049. u = x4 + x7 | 0;
  38050. x5 ^= u<<18 | u>>>(32-18);
  38051. u = x10 + x9 | 0;
  38052. x11 ^= u<<7 | u>>>(32-7);
  38053. u = x11 + x10 | 0;
  38054. x8 ^= u<<9 | u>>>(32-9);
  38055. u = x8 + x11 | 0;
  38056. x9 ^= u<<13 | u>>>(32-13);
  38057. u = x9 + x8 | 0;
  38058. x10 ^= u<<18 | u>>>(32-18);
  38059. u = x15 + x14 | 0;
  38060. x12 ^= u<<7 | u>>>(32-7);
  38061. u = x12 + x15 | 0;
  38062. x13 ^= u<<9 | u>>>(32-9);
  38063. u = x13 + x12 | 0;
  38064. x14 ^= u<<13 | u>>>(32-13);
  38065. u = x14 + x13 | 0;
  38066. x15 ^= u<<18 | u>>>(32-18);
  38067. }
  38068. x0 = x0 + j0 | 0;
  38069. x1 = x1 + j1 | 0;
  38070. x2 = x2 + j2 | 0;
  38071. x3 = x3 + j3 | 0;
  38072. x4 = x4 + j4 | 0;
  38073. x5 = x5 + j5 | 0;
  38074. x6 = x6 + j6 | 0;
  38075. x7 = x7 + j7 | 0;
  38076. x8 = x8 + j8 | 0;
  38077. x9 = x9 + j9 | 0;
  38078. x10 = x10 + j10 | 0;
  38079. x11 = x11 + j11 | 0;
  38080. x12 = x12 + j12 | 0;
  38081. x13 = x13 + j13 | 0;
  38082. x14 = x14 + j14 | 0;
  38083. x15 = x15 + j15 | 0;
  38084. o[ 0] = x0 >>> 0 & 0xff;
  38085. o[ 1] = x0 >>> 8 & 0xff;
  38086. o[ 2] = x0 >>> 16 & 0xff;
  38087. o[ 3] = x0 >>> 24 & 0xff;
  38088. o[ 4] = x1 >>> 0 & 0xff;
  38089. o[ 5] = x1 >>> 8 & 0xff;
  38090. o[ 6] = x1 >>> 16 & 0xff;
  38091. o[ 7] = x1 >>> 24 & 0xff;
  38092. o[ 8] = x2 >>> 0 & 0xff;
  38093. o[ 9] = x2 >>> 8 & 0xff;
  38094. o[10] = x2 >>> 16 & 0xff;
  38095. o[11] = x2 >>> 24 & 0xff;
  38096. o[12] = x3 >>> 0 & 0xff;
  38097. o[13] = x3 >>> 8 & 0xff;
  38098. o[14] = x3 >>> 16 & 0xff;
  38099. o[15] = x3 >>> 24 & 0xff;
  38100. o[16] = x4 >>> 0 & 0xff;
  38101. o[17] = x4 >>> 8 & 0xff;
  38102. o[18] = x4 >>> 16 & 0xff;
  38103. o[19] = x4 >>> 24 & 0xff;
  38104. o[20] = x5 >>> 0 & 0xff;
  38105. o[21] = x5 >>> 8 & 0xff;
  38106. o[22] = x5 >>> 16 & 0xff;
  38107. o[23] = x5 >>> 24 & 0xff;
  38108. o[24] = x6 >>> 0 & 0xff;
  38109. o[25] = x6 >>> 8 & 0xff;
  38110. o[26] = x6 >>> 16 & 0xff;
  38111. o[27] = x6 >>> 24 & 0xff;
  38112. o[28] = x7 >>> 0 & 0xff;
  38113. o[29] = x7 >>> 8 & 0xff;
  38114. o[30] = x7 >>> 16 & 0xff;
  38115. o[31] = x7 >>> 24 & 0xff;
  38116. o[32] = x8 >>> 0 & 0xff;
  38117. o[33] = x8 >>> 8 & 0xff;
  38118. o[34] = x8 >>> 16 & 0xff;
  38119. o[35] = x8 >>> 24 & 0xff;
  38120. o[36] = x9 >>> 0 & 0xff;
  38121. o[37] = x9 >>> 8 & 0xff;
  38122. o[38] = x9 >>> 16 & 0xff;
  38123. o[39] = x9 >>> 24 & 0xff;
  38124. o[40] = x10 >>> 0 & 0xff;
  38125. o[41] = x10 >>> 8 & 0xff;
  38126. o[42] = x10 >>> 16 & 0xff;
  38127. o[43] = x10 >>> 24 & 0xff;
  38128. o[44] = x11 >>> 0 & 0xff;
  38129. o[45] = x11 >>> 8 & 0xff;
  38130. o[46] = x11 >>> 16 & 0xff;
  38131. o[47] = x11 >>> 24 & 0xff;
  38132. o[48] = x12 >>> 0 & 0xff;
  38133. o[49] = x12 >>> 8 & 0xff;
  38134. o[50] = x12 >>> 16 & 0xff;
  38135. o[51] = x12 >>> 24 & 0xff;
  38136. o[52] = x13 >>> 0 & 0xff;
  38137. o[53] = x13 >>> 8 & 0xff;
  38138. o[54] = x13 >>> 16 & 0xff;
  38139. o[55] = x13 >>> 24 & 0xff;
  38140. o[56] = x14 >>> 0 & 0xff;
  38141. o[57] = x14 >>> 8 & 0xff;
  38142. o[58] = x14 >>> 16 & 0xff;
  38143. o[59] = x14 >>> 24 & 0xff;
  38144. o[60] = x15 >>> 0 & 0xff;
  38145. o[61] = x15 >>> 8 & 0xff;
  38146. o[62] = x15 >>> 16 & 0xff;
  38147. o[63] = x15 >>> 24 & 0xff;
  38148. }
  38149. function core_hsalsa20(o,p,k,c) {
  38150. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  38151. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  38152. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  38153. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  38154. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  38155. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  38156. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  38157. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  38158. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  38159. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  38160. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  38161. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  38162. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  38163. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  38164. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  38165. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  38166. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  38167. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  38168. x15 = j15, u;
  38169. for (var i = 0; i < 20; i += 2) {
  38170. u = x0 + x12 | 0;
  38171. x4 ^= u<<7 | u>>>(32-7);
  38172. u = x4 + x0 | 0;
  38173. x8 ^= u<<9 | u>>>(32-9);
  38174. u = x8 + x4 | 0;
  38175. x12 ^= u<<13 | u>>>(32-13);
  38176. u = x12 + x8 | 0;
  38177. x0 ^= u<<18 | u>>>(32-18);
  38178. u = x5 + x1 | 0;
  38179. x9 ^= u<<7 | u>>>(32-7);
  38180. u = x9 + x5 | 0;
  38181. x13 ^= u<<9 | u>>>(32-9);
  38182. u = x13 + x9 | 0;
  38183. x1 ^= u<<13 | u>>>(32-13);
  38184. u = x1 + x13 | 0;
  38185. x5 ^= u<<18 | u>>>(32-18);
  38186. u = x10 + x6 | 0;
  38187. x14 ^= u<<7 | u>>>(32-7);
  38188. u = x14 + x10 | 0;
  38189. x2 ^= u<<9 | u>>>(32-9);
  38190. u = x2 + x14 | 0;
  38191. x6 ^= u<<13 | u>>>(32-13);
  38192. u = x6 + x2 | 0;
  38193. x10 ^= u<<18 | u>>>(32-18);
  38194. u = x15 + x11 | 0;
  38195. x3 ^= u<<7 | u>>>(32-7);
  38196. u = x3 + x15 | 0;
  38197. x7 ^= u<<9 | u>>>(32-9);
  38198. u = x7 + x3 | 0;
  38199. x11 ^= u<<13 | u>>>(32-13);
  38200. u = x11 + x7 | 0;
  38201. x15 ^= u<<18 | u>>>(32-18);
  38202. u = x0 + x3 | 0;
  38203. x1 ^= u<<7 | u>>>(32-7);
  38204. u = x1 + x0 | 0;
  38205. x2 ^= u<<9 | u>>>(32-9);
  38206. u = x2 + x1 | 0;
  38207. x3 ^= u<<13 | u>>>(32-13);
  38208. u = x3 + x2 | 0;
  38209. x0 ^= u<<18 | u>>>(32-18);
  38210. u = x5 + x4 | 0;
  38211. x6 ^= u<<7 | u>>>(32-7);
  38212. u = x6 + x5 | 0;
  38213. x7 ^= u<<9 | u>>>(32-9);
  38214. u = x7 + x6 | 0;
  38215. x4 ^= u<<13 | u>>>(32-13);
  38216. u = x4 + x7 | 0;
  38217. x5 ^= u<<18 | u>>>(32-18);
  38218. u = x10 + x9 | 0;
  38219. x11 ^= u<<7 | u>>>(32-7);
  38220. u = x11 + x10 | 0;
  38221. x8 ^= u<<9 | u>>>(32-9);
  38222. u = x8 + x11 | 0;
  38223. x9 ^= u<<13 | u>>>(32-13);
  38224. u = x9 + x8 | 0;
  38225. x10 ^= u<<18 | u>>>(32-18);
  38226. u = x15 + x14 | 0;
  38227. x12 ^= u<<7 | u>>>(32-7);
  38228. u = x12 + x15 | 0;
  38229. x13 ^= u<<9 | u>>>(32-9);
  38230. u = x13 + x12 | 0;
  38231. x14 ^= u<<13 | u>>>(32-13);
  38232. u = x14 + x13 | 0;
  38233. x15 ^= u<<18 | u>>>(32-18);
  38234. }
  38235. o[ 0] = x0 >>> 0 & 0xff;
  38236. o[ 1] = x0 >>> 8 & 0xff;
  38237. o[ 2] = x0 >>> 16 & 0xff;
  38238. o[ 3] = x0 >>> 24 & 0xff;
  38239. o[ 4] = x5 >>> 0 & 0xff;
  38240. o[ 5] = x5 >>> 8 & 0xff;
  38241. o[ 6] = x5 >>> 16 & 0xff;
  38242. o[ 7] = x5 >>> 24 & 0xff;
  38243. o[ 8] = x10 >>> 0 & 0xff;
  38244. o[ 9] = x10 >>> 8 & 0xff;
  38245. o[10] = x10 >>> 16 & 0xff;
  38246. o[11] = x10 >>> 24 & 0xff;
  38247. o[12] = x15 >>> 0 & 0xff;
  38248. o[13] = x15 >>> 8 & 0xff;
  38249. o[14] = x15 >>> 16 & 0xff;
  38250. o[15] = x15 >>> 24 & 0xff;
  38251. o[16] = x6 >>> 0 & 0xff;
  38252. o[17] = x6 >>> 8 & 0xff;
  38253. o[18] = x6 >>> 16 & 0xff;
  38254. o[19] = x6 >>> 24 & 0xff;
  38255. o[20] = x7 >>> 0 & 0xff;
  38256. o[21] = x7 >>> 8 & 0xff;
  38257. o[22] = x7 >>> 16 & 0xff;
  38258. o[23] = x7 >>> 24 & 0xff;
  38259. o[24] = x8 >>> 0 & 0xff;
  38260. o[25] = x8 >>> 8 & 0xff;
  38261. o[26] = x8 >>> 16 & 0xff;
  38262. o[27] = x8 >>> 24 & 0xff;
  38263. o[28] = x9 >>> 0 & 0xff;
  38264. o[29] = x9 >>> 8 & 0xff;
  38265. o[30] = x9 >>> 16 & 0xff;
  38266. o[31] = x9 >>> 24 & 0xff;
  38267. }
  38268. function crypto_core_salsa20(out,inp,k,c) {
  38269. core_salsa20(out,inp,k,c);
  38270. }
  38271. function crypto_core_hsalsa20(out,inp,k,c) {
  38272. core_hsalsa20(out,inp,k,c);
  38273. }
  38274. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  38275. // "expand 32-byte k"
  38276. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  38277. var z = new Uint8Array(16), x = new Uint8Array(64);
  38278. var u, i;
  38279. for (i = 0; i < 16; i++) z[i] = 0;
  38280. for (i = 0; i < 8; i++) z[i] = n[i];
  38281. while (b >= 64) {
  38282. crypto_core_salsa20(x,z,k,sigma);
  38283. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  38284. u = 1;
  38285. for (i = 8; i < 16; i++) {
  38286. u = u + (z[i] & 0xff) | 0;
  38287. z[i] = u & 0xff;
  38288. u >>>= 8;
  38289. }
  38290. b -= 64;
  38291. cpos += 64;
  38292. mpos += 64;
  38293. }
  38294. if (b > 0) {
  38295. crypto_core_salsa20(x,z,k,sigma);
  38296. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  38297. }
  38298. return 0;
  38299. }
  38300. function crypto_stream_salsa20(c,cpos,b,n,k) {
  38301. var z = new Uint8Array(16), x = new Uint8Array(64);
  38302. var u, i;
  38303. for (i = 0; i < 16; i++) z[i] = 0;
  38304. for (i = 0; i < 8; i++) z[i] = n[i];
  38305. while (b >= 64) {
  38306. crypto_core_salsa20(x,z,k,sigma);
  38307. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  38308. u = 1;
  38309. for (i = 8; i < 16; i++) {
  38310. u = u + (z[i] & 0xff) | 0;
  38311. z[i] = u & 0xff;
  38312. u >>>= 8;
  38313. }
  38314. b -= 64;
  38315. cpos += 64;
  38316. }
  38317. if (b > 0) {
  38318. crypto_core_salsa20(x,z,k,sigma);
  38319. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  38320. }
  38321. return 0;
  38322. }
  38323. function crypto_stream(c,cpos,d,n,k) {
  38324. var s = new Uint8Array(32);
  38325. crypto_core_hsalsa20(s,n,k,sigma);
  38326. var sn = new Uint8Array(8);
  38327. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  38328. return crypto_stream_salsa20(c,cpos,d,sn,s);
  38329. }
  38330. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  38331. var s = new Uint8Array(32);
  38332. crypto_core_hsalsa20(s,n,k,sigma);
  38333. var sn = new Uint8Array(8);
  38334. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  38335. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  38336. }
  38337. /*
  38338. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  38339. * https://github.com/floodyberry/poly1305-donna
  38340. */
  38341. var poly1305 = function(key) {
  38342. this.buffer = new Uint8Array(16);
  38343. this.r = new Uint16Array(10);
  38344. this.h = new Uint16Array(10);
  38345. this.pad = new Uint16Array(8);
  38346. this.leftover = 0;
  38347. this.fin = 0;
  38348. var t0, t1, t2, t3, t4, t5, t6, t7;
  38349. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  38350. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  38351. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  38352. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  38353. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  38354. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  38355. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  38356. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  38357. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  38358. this.r[9] = ((t7 >>> 5)) & 0x007f;
  38359. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  38360. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  38361. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  38362. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  38363. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  38364. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  38365. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  38366. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  38367. };
  38368. poly1305.prototype.blocks = function(m, mpos, bytes) {
  38369. var hibit = this.fin ? 0 : (1 << 11);
  38370. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  38371. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  38372. var h0 = this.h[0],
  38373. h1 = this.h[1],
  38374. h2 = this.h[2],
  38375. h3 = this.h[3],
  38376. h4 = this.h[4],
  38377. h5 = this.h[5],
  38378. h6 = this.h[6],
  38379. h7 = this.h[7],
  38380. h8 = this.h[8],
  38381. h9 = this.h[9];
  38382. var r0 = this.r[0],
  38383. r1 = this.r[1],
  38384. r2 = this.r[2],
  38385. r3 = this.r[3],
  38386. r4 = this.r[4],
  38387. r5 = this.r[5],
  38388. r6 = this.r[6],
  38389. r7 = this.r[7],
  38390. r8 = this.r[8],
  38391. r9 = this.r[9];
  38392. while (bytes >= 16) {
  38393. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  38394. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  38395. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  38396. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  38397. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  38398. h5 += ((t4 >>> 1)) & 0x1fff;
  38399. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  38400. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  38401. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  38402. h9 += ((t7 >>> 5)) | hibit;
  38403. c = 0;
  38404. d0 = c;
  38405. d0 += h0 * r0;
  38406. d0 += h1 * (5 * r9);
  38407. d0 += h2 * (5 * r8);
  38408. d0 += h3 * (5 * r7);
  38409. d0 += h4 * (5 * r6);
  38410. c = (d0 >>> 13); d0 &= 0x1fff;
  38411. d0 += h5 * (5 * r5);
  38412. d0 += h6 * (5 * r4);
  38413. d0 += h7 * (5 * r3);
  38414. d0 += h8 * (5 * r2);
  38415. d0 += h9 * (5 * r1);
  38416. c += (d0 >>> 13); d0 &= 0x1fff;
  38417. d1 = c;
  38418. d1 += h0 * r1;
  38419. d1 += h1 * r0;
  38420. d1 += h2 * (5 * r9);
  38421. d1 += h3 * (5 * r8);
  38422. d1 += h4 * (5 * r7);
  38423. c = (d1 >>> 13); d1 &= 0x1fff;
  38424. d1 += h5 * (5 * r6);
  38425. d1 += h6 * (5 * r5);
  38426. d1 += h7 * (5 * r4);
  38427. d1 += h8 * (5 * r3);
  38428. d1 += h9 * (5 * r2);
  38429. c += (d1 >>> 13); d1 &= 0x1fff;
  38430. d2 = c;
  38431. d2 += h0 * r2;
  38432. d2 += h1 * r1;
  38433. d2 += h2 * r0;
  38434. d2 += h3 * (5 * r9);
  38435. d2 += h4 * (5 * r8);
  38436. c = (d2 >>> 13); d2 &= 0x1fff;
  38437. d2 += h5 * (5 * r7);
  38438. d2 += h6 * (5 * r6);
  38439. d2 += h7 * (5 * r5);
  38440. d2 += h8 * (5 * r4);
  38441. d2 += h9 * (5 * r3);
  38442. c += (d2 >>> 13); d2 &= 0x1fff;
  38443. d3 = c;
  38444. d3 += h0 * r3;
  38445. d3 += h1 * r2;
  38446. d3 += h2 * r1;
  38447. d3 += h3 * r0;
  38448. d3 += h4 * (5 * r9);
  38449. c = (d3 >>> 13); d3 &= 0x1fff;
  38450. d3 += h5 * (5 * r8);
  38451. d3 += h6 * (5 * r7);
  38452. d3 += h7 * (5 * r6);
  38453. d3 += h8 * (5 * r5);
  38454. d3 += h9 * (5 * r4);
  38455. c += (d3 >>> 13); d3 &= 0x1fff;
  38456. d4 = c;
  38457. d4 += h0 * r4;
  38458. d4 += h1 * r3;
  38459. d4 += h2 * r2;
  38460. d4 += h3 * r1;
  38461. d4 += h4 * r0;
  38462. c = (d4 >>> 13); d4 &= 0x1fff;
  38463. d4 += h5 * (5 * r9);
  38464. d4 += h6 * (5 * r8);
  38465. d4 += h7 * (5 * r7);
  38466. d4 += h8 * (5 * r6);
  38467. d4 += h9 * (5 * r5);
  38468. c += (d4 >>> 13); d4 &= 0x1fff;
  38469. d5 = c;
  38470. d5 += h0 * r5;
  38471. d5 += h1 * r4;
  38472. d5 += h2 * r3;
  38473. d5 += h3 * r2;
  38474. d5 += h4 * r1;
  38475. c = (d5 >>> 13); d5 &= 0x1fff;
  38476. d5 += h5 * r0;
  38477. d5 += h6 * (5 * r9);
  38478. d5 += h7 * (5 * r8);
  38479. d5 += h8 * (5 * r7);
  38480. d5 += h9 * (5 * r6);
  38481. c += (d5 >>> 13); d5 &= 0x1fff;
  38482. d6 = c;
  38483. d6 += h0 * r6;
  38484. d6 += h1 * r5;
  38485. d6 += h2 * r4;
  38486. d6 += h3 * r3;
  38487. d6 += h4 * r2;
  38488. c = (d6 >>> 13); d6 &= 0x1fff;
  38489. d6 += h5 * r1;
  38490. d6 += h6 * r0;
  38491. d6 += h7 * (5 * r9);
  38492. d6 += h8 * (5 * r8);
  38493. d6 += h9 * (5 * r7);
  38494. c += (d6 >>> 13); d6 &= 0x1fff;
  38495. d7 = c;
  38496. d7 += h0 * r7;
  38497. d7 += h1 * r6;
  38498. d7 += h2 * r5;
  38499. d7 += h3 * r4;
  38500. d7 += h4 * r3;
  38501. c = (d7 >>> 13); d7 &= 0x1fff;
  38502. d7 += h5 * r2;
  38503. d7 += h6 * r1;
  38504. d7 += h7 * r0;
  38505. d7 += h8 * (5 * r9);
  38506. d7 += h9 * (5 * r8);
  38507. c += (d7 >>> 13); d7 &= 0x1fff;
  38508. d8 = c;
  38509. d8 += h0 * r8;
  38510. d8 += h1 * r7;
  38511. d8 += h2 * r6;
  38512. d8 += h3 * r5;
  38513. d8 += h4 * r4;
  38514. c = (d8 >>> 13); d8 &= 0x1fff;
  38515. d8 += h5 * r3;
  38516. d8 += h6 * r2;
  38517. d8 += h7 * r1;
  38518. d8 += h8 * r0;
  38519. d8 += h9 * (5 * r9);
  38520. c += (d8 >>> 13); d8 &= 0x1fff;
  38521. d9 = c;
  38522. d9 += h0 * r9;
  38523. d9 += h1 * r8;
  38524. d9 += h2 * r7;
  38525. d9 += h3 * r6;
  38526. d9 += h4 * r5;
  38527. c = (d9 >>> 13); d9 &= 0x1fff;
  38528. d9 += h5 * r4;
  38529. d9 += h6 * r3;
  38530. d9 += h7 * r2;
  38531. d9 += h8 * r1;
  38532. d9 += h9 * r0;
  38533. c += (d9 >>> 13); d9 &= 0x1fff;
  38534. c = (((c << 2) + c)) | 0;
  38535. c = (c + d0) | 0;
  38536. d0 = c & 0x1fff;
  38537. c = (c >>> 13);
  38538. d1 += c;
  38539. h0 = d0;
  38540. h1 = d1;
  38541. h2 = d2;
  38542. h3 = d3;
  38543. h4 = d4;
  38544. h5 = d5;
  38545. h6 = d6;
  38546. h7 = d7;
  38547. h8 = d8;
  38548. h9 = d9;
  38549. mpos += 16;
  38550. bytes -= 16;
  38551. }
  38552. this.h[0] = h0;
  38553. this.h[1] = h1;
  38554. this.h[2] = h2;
  38555. this.h[3] = h3;
  38556. this.h[4] = h4;
  38557. this.h[5] = h5;
  38558. this.h[6] = h6;
  38559. this.h[7] = h7;
  38560. this.h[8] = h8;
  38561. this.h[9] = h9;
  38562. };
  38563. poly1305.prototype.finish = function(mac, macpos) {
  38564. var g = new Uint16Array(10);
  38565. var c, mask, f, i;
  38566. if (this.leftover) {
  38567. i = this.leftover;
  38568. this.buffer[i++] = 1;
  38569. for (; i < 16; i++) this.buffer[i] = 0;
  38570. this.fin = 1;
  38571. this.blocks(this.buffer, 0, 16);
  38572. }
  38573. c = this.h[1] >>> 13;
  38574. this.h[1] &= 0x1fff;
  38575. for (i = 2; i < 10; i++) {
  38576. this.h[i] += c;
  38577. c = this.h[i] >>> 13;
  38578. this.h[i] &= 0x1fff;
  38579. }
  38580. this.h[0] += (c * 5);
  38581. c = this.h[0] >>> 13;
  38582. this.h[0] &= 0x1fff;
  38583. this.h[1] += c;
  38584. c = this.h[1] >>> 13;
  38585. this.h[1] &= 0x1fff;
  38586. this.h[2] += c;
  38587. g[0] = this.h[0] + 5;
  38588. c = g[0] >>> 13;
  38589. g[0] &= 0x1fff;
  38590. for (i = 1; i < 10; i++) {
  38591. g[i] = this.h[i] + c;
  38592. c = g[i] >>> 13;
  38593. g[i] &= 0x1fff;
  38594. }
  38595. g[9] -= (1 << 13);
  38596. mask = (c ^ 1) - 1;
  38597. for (i = 0; i < 10; i++) g[i] &= mask;
  38598. mask = ~mask;
  38599. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  38600. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  38601. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  38602. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  38603. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  38604. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  38605. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  38606. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  38607. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  38608. f = this.h[0] + this.pad[0];
  38609. this.h[0] = f & 0xffff;
  38610. for (i = 1; i < 8; i++) {
  38611. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  38612. this.h[i] = f & 0xffff;
  38613. }
  38614. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  38615. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  38616. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  38617. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  38618. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  38619. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  38620. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  38621. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  38622. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  38623. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  38624. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  38625. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  38626. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  38627. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  38628. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  38629. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  38630. };
  38631. poly1305.prototype.update = function(m, mpos, bytes) {
  38632. var i, want;
  38633. if (this.leftover) {
  38634. want = (16 - this.leftover);
  38635. if (want > bytes)
  38636. want = bytes;
  38637. for (i = 0; i < want; i++)
  38638. this.buffer[this.leftover + i] = m[mpos+i];
  38639. bytes -= want;
  38640. mpos += want;
  38641. this.leftover += want;
  38642. if (this.leftover < 16)
  38643. return;
  38644. this.blocks(this.buffer, 0, 16);
  38645. this.leftover = 0;
  38646. }
  38647. if (bytes >= 16) {
  38648. want = bytes - (bytes % 16);
  38649. this.blocks(m, mpos, want);
  38650. mpos += want;
  38651. bytes -= want;
  38652. }
  38653. if (bytes) {
  38654. for (i = 0; i < bytes; i++)
  38655. this.buffer[this.leftover + i] = m[mpos+i];
  38656. this.leftover += bytes;
  38657. }
  38658. };
  38659. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  38660. var s = new poly1305(k);
  38661. s.update(m, mpos, n);
  38662. s.finish(out, outpos);
  38663. return 0;
  38664. }
  38665. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  38666. var x = new Uint8Array(16);
  38667. crypto_onetimeauth(x,0,m,mpos,n,k);
  38668. return crypto_verify_16(h,hpos,x,0);
  38669. }
  38670. function crypto_secretbox(c,m,d,n,k) {
  38671. var i;
  38672. if (d < 32) return -1;
  38673. crypto_stream_xor(c,0,m,0,d,n,k);
  38674. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  38675. for (i = 0; i < 16; i++) c[i] = 0;
  38676. return 0;
  38677. }
  38678. function crypto_secretbox_open(m,c,d,n,k) {
  38679. var i;
  38680. var x = new Uint8Array(32);
  38681. if (d < 32) return -1;
  38682. crypto_stream(x,0,32,n,k);
  38683. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  38684. crypto_stream_xor(m,0,c,0,d,n,k);
  38685. for (i = 0; i < 32; i++) m[i] = 0;
  38686. return 0;
  38687. }
  38688. function set25519(r, a) {
  38689. var i;
  38690. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  38691. }
  38692. function car25519(o) {
  38693. var i, v, c = 1;
  38694. for (i = 0; i < 16; i++) {
  38695. v = o[i] + c + 65535;
  38696. c = Math.floor(v / 65536);
  38697. o[i] = v - c * 65536;
  38698. }
  38699. o[0] += c-1 + 37 * (c-1);
  38700. }
  38701. function sel25519(p, q, b) {
  38702. var t, c = ~(b-1);
  38703. for (var i = 0; i < 16; i++) {
  38704. t = c & (p[i] ^ q[i]);
  38705. p[i] ^= t;
  38706. q[i] ^= t;
  38707. }
  38708. }
  38709. function pack25519(o, n) {
  38710. var i, j, b;
  38711. var m = gf(), t = gf();
  38712. for (i = 0; i < 16; i++) t[i] = n[i];
  38713. car25519(t);
  38714. car25519(t);
  38715. car25519(t);
  38716. for (j = 0; j < 2; j++) {
  38717. m[0] = t[0] - 0xffed;
  38718. for (i = 1; i < 15; i++) {
  38719. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  38720. m[i-1] &= 0xffff;
  38721. }
  38722. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  38723. b = (m[15]>>16) & 1;
  38724. m[14] &= 0xffff;
  38725. sel25519(t, m, 1-b);
  38726. }
  38727. for (i = 0; i < 16; i++) {
  38728. o[2*i] = t[i] & 0xff;
  38729. o[2*i+1] = t[i]>>8;
  38730. }
  38731. }
  38732. function neq25519(a, b) {
  38733. var c = new Uint8Array(32), d = new Uint8Array(32);
  38734. pack25519(c, a);
  38735. pack25519(d, b);
  38736. return crypto_verify_32(c, 0, d, 0);
  38737. }
  38738. function par25519(a) {
  38739. var d = new Uint8Array(32);
  38740. pack25519(d, a);
  38741. return d[0] & 1;
  38742. }
  38743. function unpack25519(o, n) {
  38744. var i;
  38745. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  38746. o[15] &= 0x7fff;
  38747. }
  38748. function A(o, a, b) {
  38749. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  38750. }
  38751. function Z(o, a, b) {
  38752. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  38753. }
  38754. function M(o, a, b) {
  38755. var v, c,
  38756. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  38757. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  38758. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  38759. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  38760. b0 = b[0],
  38761. b1 = b[1],
  38762. b2 = b[2],
  38763. b3 = b[3],
  38764. b4 = b[4],
  38765. b5 = b[5],
  38766. b6 = b[6],
  38767. b7 = b[7],
  38768. b8 = b[8],
  38769. b9 = b[9],
  38770. b10 = b[10],
  38771. b11 = b[11],
  38772. b12 = b[12],
  38773. b13 = b[13],
  38774. b14 = b[14],
  38775. b15 = b[15];
  38776. v = a[0];
  38777. t0 += v * b0;
  38778. t1 += v * b1;
  38779. t2 += v * b2;
  38780. t3 += v * b3;
  38781. t4 += v * b4;
  38782. t5 += v * b5;
  38783. t6 += v * b6;
  38784. t7 += v * b7;
  38785. t8 += v * b8;
  38786. t9 += v * b9;
  38787. t10 += v * b10;
  38788. t11 += v * b11;
  38789. t12 += v * b12;
  38790. t13 += v * b13;
  38791. t14 += v * b14;
  38792. t15 += v * b15;
  38793. v = a[1];
  38794. t1 += v * b0;
  38795. t2 += v * b1;
  38796. t3 += v * b2;
  38797. t4 += v * b3;
  38798. t5 += v * b4;
  38799. t6 += v * b5;
  38800. t7 += v * b6;
  38801. t8 += v * b7;
  38802. t9 += v * b8;
  38803. t10 += v * b9;
  38804. t11 += v * b10;
  38805. t12 += v * b11;
  38806. t13 += v * b12;
  38807. t14 += v * b13;
  38808. t15 += v * b14;
  38809. t16 += v * b15;
  38810. v = a[2];
  38811. t2 += v * b0;
  38812. t3 += v * b1;
  38813. t4 += v * b2;
  38814. t5 += v * b3;
  38815. t6 += v * b4;
  38816. t7 += v * b5;
  38817. t8 += v * b6;
  38818. t9 += v * b7;
  38819. t10 += v * b8;
  38820. t11 += v * b9;
  38821. t12 += v * b10;
  38822. t13 += v * b11;
  38823. t14 += v * b12;
  38824. t15 += v * b13;
  38825. t16 += v * b14;
  38826. t17 += v * b15;
  38827. v = a[3];
  38828. t3 += v * b0;
  38829. t4 += v * b1;
  38830. t5 += v * b2;
  38831. t6 += v * b3;
  38832. t7 += v * b4;
  38833. t8 += v * b5;
  38834. t9 += v * b6;
  38835. t10 += v * b7;
  38836. t11 += v * b8;
  38837. t12 += v * b9;
  38838. t13 += v * b10;
  38839. t14 += v * b11;
  38840. t15 += v * b12;
  38841. t16 += v * b13;
  38842. t17 += v * b14;
  38843. t18 += v * b15;
  38844. v = a[4];
  38845. t4 += v * b0;
  38846. t5 += v * b1;
  38847. t6 += v * b2;
  38848. t7 += v * b3;
  38849. t8 += v * b4;
  38850. t9 += v * b5;
  38851. t10 += v * b6;
  38852. t11 += v * b7;
  38853. t12 += v * b8;
  38854. t13 += v * b9;
  38855. t14 += v * b10;
  38856. t15 += v * b11;
  38857. t16 += v * b12;
  38858. t17 += v * b13;
  38859. t18 += v * b14;
  38860. t19 += v * b15;
  38861. v = a[5];
  38862. t5 += v * b0;
  38863. t6 += v * b1;
  38864. t7 += v * b2;
  38865. t8 += v * b3;
  38866. t9 += v * b4;
  38867. t10 += v * b5;
  38868. t11 += v * b6;
  38869. t12 += v * b7;
  38870. t13 += v * b8;
  38871. t14 += v * b9;
  38872. t15 += v * b10;
  38873. t16 += v * b11;
  38874. t17 += v * b12;
  38875. t18 += v * b13;
  38876. t19 += v * b14;
  38877. t20 += v * b15;
  38878. v = a[6];
  38879. t6 += v * b0;
  38880. t7 += v * b1;
  38881. t8 += v * b2;
  38882. t9 += v * b3;
  38883. t10 += v * b4;
  38884. t11 += v * b5;
  38885. t12 += v * b6;
  38886. t13 += v * b7;
  38887. t14 += v * b8;
  38888. t15 += v * b9;
  38889. t16 += v * b10;
  38890. t17 += v * b11;
  38891. t18 += v * b12;
  38892. t19 += v * b13;
  38893. t20 += v * b14;
  38894. t21 += v * b15;
  38895. v = a[7];
  38896. t7 += v * b0;
  38897. t8 += v * b1;
  38898. t9 += v * b2;
  38899. t10 += v * b3;
  38900. t11 += v * b4;
  38901. t12 += v * b5;
  38902. t13 += v * b6;
  38903. t14 += v * b7;
  38904. t15 += v * b8;
  38905. t16 += v * b9;
  38906. t17 += v * b10;
  38907. t18 += v * b11;
  38908. t19 += v * b12;
  38909. t20 += v * b13;
  38910. t21 += v * b14;
  38911. t22 += v * b15;
  38912. v = a[8];
  38913. t8 += v * b0;
  38914. t9 += v * b1;
  38915. t10 += v * b2;
  38916. t11 += v * b3;
  38917. t12 += v * b4;
  38918. t13 += v * b5;
  38919. t14 += v * b6;
  38920. t15 += v * b7;
  38921. t16 += v * b8;
  38922. t17 += v * b9;
  38923. t18 += v * b10;
  38924. t19 += v * b11;
  38925. t20 += v * b12;
  38926. t21 += v * b13;
  38927. t22 += v * b14;
  38928. t23 += v * b15;
  38929. v = a[9];
  38930. t9 += v * b0;
  38931. t10 += v * b1;
  38932. t11 += v * b2;
  38933. t12 += v * b3;
  38934. t13 += v * b4;
  38935. t14 += v * b5;
  38936. t15 += v * b6;
  38937. t16 += v * b7;
  38938. t17 += v * b8;
  38939. t18 += v * b9;
  38940. t19 += v * b10;
  38941. t20 += v * b11;
  38942. t21 += v * b12;
  38943. t22 += v * b13;
  38944. t23 += v * b14;
  38945. t24 += v * b15;
  38946. v = a[10];
  38947. t10 += v * b0;
  38948. t11 += v * b1;
  38949. t12 += v * b2;
  38950. t13 += v * b3;
  38951. t14 += v * b4;
  38952. t15 += v * b5;
  38953. t16 += v * b6;
  38954. t17 += v * b7;
  38955. t18 += v * b8;
  38956. t19 += v * b9;
  38957. t20 += v * b10;
  38958. t21 += v * b11;
  38959. t22 += v * b12;
  38960. t23 += v * b13;
  38961. t24 += v * b14;
  38962. t25 += v * b15;
  38963. v = a[11];
  38964. t11 += v * b0;
  38965. t12 += v * b1;
  38966. t13 += v * b2;
  38967. t14 += v * b3;
  38968. t15 += v * b4;
  38969. t16 += v * b5;
  38970. t17 += v * b6;
  38971. t18 += v * b7;
  38972. t19 += v * b8;
  38973. t20 += v * b9;
  38974. t21 += v * b10;
  38975. t22 += v * b11;
  38976. t23 += v * b12;
  38977. t24 += v * b13;
  38978. t25 += v * b14;
  38979. t26 += v * b15;
  38980. v = a[12];
  38981. t12 += v * b0;
  38982. t13 += v * b1;
  38983. t14 += v * b2;
  38984. t15 += v * b3;
  38985. t16 += v * b4;
  38986. t17 += v * b5;
  38987. t18 += v * b6;
  38988. t19 += v * b7;
  38989. t20 += v * b8;
  38990. t21 += v * b9;
  38991. t22 += v * b10;
  38992. t23 += v * b11;
  38993. t24 += v * b12;
  38994. t25 += v * b13;
  38995. t26 += v * b14;
  38996. t27 += v * b15;
  38997. v = a[13];
  38998. t13 += v * b0;
  38999. t14 += v * b1;
  39000. t15 += v * b2;
  39001. t16 += v * b3;
  39002. t17 += v * b4;
  39003. t18 += v * b5;
  39004. t19 += v * b6;
  39005. t20 += v * b7;
  39006. t21 += v * b8;
  39007. t22 += v * b9;
  39008. t23 += v * b10;
  39009. t24 += v * b11;
  39010. t25 += v * b12;
  39011. t26 += v * b13;
  39012. t27 += v * b14;
  39013. t28 += v * b15;
  39014. v = a[14];
  39015. t14 += v * b0;
  39016. t15 += v * b1;
  39017. t16 += v * b2;
  39018. t17 += v * b3;
  39019. t18 += v * b4;
  39020. t19 += v * b5;
  39021. t20 += v * b6;
  39022. t21 += v * b7;
  39023. t22 += v * b8;
  39024. t23 += v * b9;
  39025. t24 += v * b10;
  39026. t25 += v * b11;
  39027. t26 += v * b12;
  39028. t27 += v * b13;
  39029. t28 += v * b14;
  39030. t29 += v * b15;
  39031. v = a[15];
  39032. t15 += v * b0;
  39033. t16 += v * b1;
  39034. t17 += v * b2;
  39035. t18 += v * b3;
  39036. t19 += v * b4;
  39037. t20 += v * b5;
  39038. t21 += v * b6;
  39039. t22 += v * b7;
  39040. t23 += v * b8;
  39041. t24 += v * b9;
  39042. t25 += v * b10;
  39043. t26 += v * b11;
  39044. t27 += v * b12;
  39045. t28 += v * b13;
  39046. t29 += v * b14;
  39047. t30 += v * b15;
  39048. t0 += 38 * t16;
  39049. t1 += 38 * t17;
  39050. t2 += 38 * t18;
  39051. t3 += 38 * t19;
  39052. t4 += 38 * t20;
  39053. t5 += 38 * t21;
  39054. t6 += 38 * t22;
  39055. t7 += 38 * t23;
  39056. t8 += 38 * t24;
  39057. t9 += 38 * t25;
  39058. t10 += 38 * t26;
  39059. t11 += 38 * t27;
  39060. t12 += 38 * t28;
  39061. t13 += 38 * t29;
  39062. t14 += 38 * t30;
  39063. // t15 left as is
  39064. // first car
  39065. c = 1;
  39066. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  39067. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  39068. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  39069. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  39070. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  39071. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  39072. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  39073. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  39074. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  39075. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  39076. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  39077. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  39078. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  39079. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  39080. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  39081. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  39082. t0 += c-1 + 37 * (c-1);
  39083. // second car
  39084. c = 1;
  39085. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  39086. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  39087. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  39088. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  39089. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  39090. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  39091. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  39092. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  39093. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  39094. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  39095. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  39096. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  39097. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  39098. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  39099. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  39100. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  39101. t0 += c-1 + 37 * (c-1);
  39102. o[ 0] = t0;
  39103. o[ 1] = t1;
  39104. o[ 2] = t2;
  39105. o[ 3] = t3;
  39106. o[ 4] = t4;
  39107. o[ 5] = t5;
  39108. o[ 6] = t6;
  39109. o[ 7] = t7;
  39110. o[ 8] = t8;
  39111. o[ 9] = t9;
  39112. o[10] = t10;
  39113. o[11] = t11;
  39114. o[12] = t12;
  39115. o[13] = t13;
  39116. o[14] = t14;
  39117. o[15] = t15;
  39118. }
  39119. function S(o, a) {
  39120. M(o, a, a);
  39121. }
  39122. function inv25519(o, i) {
  39123. var c = gf();
  39124. var a;
  39125. for (a = 0; a < 16; a++) c[a] = i[a];
  39126. for (a = 253; a >= 0; a--) {
  39127. S(c, c);
  39128. if(a !== 2 && a !== 4) M(c, c, i);
  39129. }
  39130. for (a = 0; a < 16; a++) o[a] = c[a];
  39131. }
  39132. function pow2523(o, i) {
  39133. var c = gf();
  39134. var a;
  39135. for (a = 0; a < 16; a++) c[a] = i[a];
  39136. for (a = 250; a >= 0; a--) {
  39137. S(c, c);
  39138. if(a !== 1) M(c, c, i);
  39139. }
  39140. for (a = 0; a < 16; a++) o[a] = c[a];
  39141. }
  39142. function crypto_scalarmult(q, n, p) {
  39143. var z = new Uint8Array(32);
  39144. var x = new Float64Array(80), r, i;
  39145. var a = gf(), b = gf(), c = gf(),
  39146. d = gf(), e = gf(), f = gf();
  39147. for (i = 0; i < 31; i++) z[i] = n[i];
  39148. z[31]=(n[31]&127)|64;
  39149. z[0]&=248;
  39150. unpack25519(x,p);
  39151. for (i = 0; i < 16; i++) {
  39152. b[i]=x[i];
  39153. d[i]=a[i]=c[i]=0;
  39154. }
  39155. a[0]=d[0]=1;
  39156. for (i=254; i>=0; --i) {
  39157. r=(z[i>>>3]>>>(i&7))&1;
  39158. sel25519(a,b,r);
  39159. sel25519(c,d,r);
  39160. A(e,a,c);
  39161. Z(a,a,c);
  39162. A(c,b,d);
  39163. Z(b,b,d);
  39164. S(d,e);
  39165. S(f,a);
  39166. M(a,c,a);
  39167. M(c,b,e);
  39168. A(e,a,c);
  39169. Z(a,a,c);
  39170. S(b,a);
  39171. Z(c,d,f);
  39172. M(a,c,_121665);
  39173. A(a,a,d);
  39174. M(c,c,a);
  39175. M(a,d,f);
  39176. M(d,b,x);
  39177. S(b,e);
  39178. sel25519(a,b,r);
  39179. sel25519(c,d,r);
  39180. }
  39181. for (i = 0; i < 16; i++) {
  39182. x[i+16]=a[i];
  39183. x[i+32]=c[i];
  39184. x[i+48]=b[i];
  39185. x[i+64]=d[i];
  39186. }
  39187. var x32 = x.subarray(32);
  39188. var x16 = x.subarray(16);
  39189. inv25519(x32,x32);
  39190. M(x16,x16,x32);
  39191. pack25519(q,x16);
  39192. return 0;
  39193. }
  39194. function crypto_scalarmult_base(q, n) {
  39195. return crypto_scalarmult(q, n, _9);
  39196. }
  39197. function crypto_box_keypair(y, x) {
  39198. randombytes(x, 32);
  39199. return crypto_scalarmult_base(y, x);
  39200. }
  39201. function crypto_box_beforenm(k, y, x) {
  39202. var s = new Uint8Array(32);
  39203. crypto_scalarmult(s, x, y);
  39204. return crypto_core_hsalsa20(k, _0, s, sigma);
  39205. }
  39206. var crypto_box_afternm = crypto_secretbox;
  39207. var crypto_box_open_afternm = crypto_secretbox_open;
  39208. function crypto_box(c, m, d, n, y, x) {
  39209. var k = new Uint8Array(32);
  39210. crypto_box_beforenm(k, y, x);
  39211. return crypto_box_afternm(c, m, d, n, k);
  39212. }
  39213. function crypto_box_open(m, c, d, n, y, x) {
  39214. var k = new Uint8Array(32);
  39215. crypto_box_beforenm(k, y, x);
  39216. return crypto_box_open_afternm(m, c, d, n, k);
  39217. }
  39218. var K = [
  39219. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  39220. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  39221. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  39222. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  39223. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  39224. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  39225. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  39226. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  39227. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  39228. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  39229. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  39230. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  39231. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  39232. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  39233. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  39234. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  39235. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  39236. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  39237. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  39238. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  39239. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  39240. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  39241. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  39242. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  39243. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  39244. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  39245. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  39246. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  39247. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  39248. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  39249. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  39250. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  39251. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  39252. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  39253. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  39254. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  39255. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  39256. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  39257. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  39258. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  39259. ];
  39260. function crypto_hashblocks_hl(hh, hl, m, n) {
  39261. var wh = new Int32Array(16), wl = new Int32Array(16),
  39262. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  39263. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  39264. th, tl, i, j, h, l, a, b, c, d;
  39265. var ah0 = hh[0],
  39266. ah1 = hh[1],
  39267. ah2 = hh[2],
  39268. ah3 = hh[3],
  39269. ah4 = hh[4],
  39270. ah5 = hh[5],
  39271. ah6 = hh[6],
  39272. ah7 = hh[7],
  39273. al0 = hl[0],
  39274. al1 = hl[1],
  39275. al2 = hl[2],
  39276. al3 = hl[3],
  39277. al4 = hl[4],
  39278. al5 = hl[5],
  39279. al6 = hl[6],
  39280. al7 = hl[7];
  39281. var pos = 0;
  39282. while (n >= 128) {
  39283. for (i = 0; i < 16; i++) {
  39284. j = 8 * i + pos;
  39285. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  39286. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  39287. }
  39288. for (i = 0; i < 80; i++) {
  39289. bh0 = ah0;
  39290. bh1 = ah1;
  39291. bh2 = ah2;
  39292. bh3 = ah3;
  39293. bh4 = ah4;
  39294. bh5 = ah5;
  39295. bh6 = ah6;
  39296. bh7 = ah7;
  39297. bl0 = al0;
  39298. bl1 = al1;
  39299. bl2 = al2;
  39300. bl3 = al3;
  39301. bl4 = al4;
  39302. bl5 = al5;
  39303. bl6 = al6;
  39304. bl7 = al7;
  39305. // add
  39306. h = ah7;
  39307. l = al7;
  39308. a = l & 0xffff; b = l >>> 16;
  39309. c = h & 0xffff; d = h >>> 16;
  39310. // Sigma1
  39311. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  39312. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  39313. a += l & 0xffff; b += l >>> 16;
  39314. c += h & 0xffff; d += h >>> 16;
  39315. // Ch
  39316. h = (ah4 & ah5) ^ (~ah4 & ah6);
  39317. l = (al4 & al5) ^ (~al4 & al6);
  39318. a += l & 0xffff; b += l >>> 16;
  39319. c += h & 0xffff; d += h >>> 16;
  39320. // K
  39321. h = K[i*2];
  39322. l = K[i*2+1];
  39323. a += l & 0xffff; b += l >>> 16;
  39324. c += h & 0xffff; d += h >>> 16;
  39325. // w
  39326. h = wh[i%16];
  39327. l = wl[i%16];
  39328. a += l & 0xffff; b += l >>> 16;
  39329. c += h & 0xffff; d += h >>> 16;
  39330. b += a >>> 16;
  39331. c += b >>> 16;
  39332. d += c >>> 16;
  39333. th = c & 0xffff | d << 16;
  39334. tl = a & 0xffff | b << 16;
  39335. // add
  39336. h = th;
  39337. l = tl;
  39338. a = l & 0xffff; b = l >>> 16;
  39339. c = h & 0xffff; d = h >>> 16;
  39340. // Sigma0
  39341. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  39342. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  39343. a += l & 0xffff; b += l >>> 16;
  39344. c += h & 0xffff; d += h >>> 16;
  39345. // Maj
  39346. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  39347. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  39348. a += l & 0xffff; b += l >>> 16;
  39349. c += h & 0xffff; d += h >>> 16;
  39350. b += a >>> 16;
  39351. c += b >>> 16;
  39352. d += c >>> 16;
  39353. bh7 = (c & 0xffff) | (d << 16);
  39354. bl7 = (a & 0xffff) | (b << 16);
  39355. // add
  39356. h = bh3;
  39357. l = bl3;
  39358. a = l & 0xffff; b = l >>> 16;
  39359. c = h & 0xffff; d = h >>> 16;
  39360. h = th;
  39361. l = tl;
  39362. a += l & 0xffff; b += l >>> 16;
  39363. c += h & 0xffff; d += h >>> 16;
  39364. b += a >>> 16;
  39365. c += b >>> 16;
  39366. d += c >>> 16;
  39367. bh3 = (c & 0xffff) | (d << 16);
  39368. bl3 = (a & 0xffff) | (b << 16);
  39369. ah1 = bh0;
  39370. ah2 = bh1;
  39371. ah3 = bh2;
  39372. ah4 = bh3;
  39373. ah5 = bh4;
  39374. ah6 = bh5;
  39375. ah7 = bh6;
  39376. ah0 = bh7;
  39377. al1 = bl0;
  39378. al2 = bl1;
  39379. al3 = bl2;
  39380. al4 = bl3;
  39381. al5 = bl4;
  39382. al6 = bl5;
  39383. al7 = bl6;
  39384. al0 = bl7;
  39385. if (i%16 === 15) {
  39386. for (j = 0; j < 16; j++) {
  39387. // add
  39388. h = wh[j];
  39389. l = wl[j];
  39390. a = l & 0xffff; b = l >>> 16;
  39391. c = h & 0xffff; d = h >>> 16;
  39392. h = wh[(j+9)%16];
  39393. l = wl[(j+9)%16];
  39394. a += l & 0xffff; b += l >>> 16;
  39395. c += h & 0xffff; d += h >>> 16;
  39396. // sigma0
  39397. th = wh[(j+1)%16];
  39398. tl = wl[(j+1)%16];
  39399. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  39400. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  39401. a += l & 0xffff; b += l >>> 16;
  39402. c += h & 0xffff; d += h >>> 16;
  39403. // sigma1
  39404. th = wh[(j+14)%16];
  39405. tl = wl[(j+14)%16];
  39406. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  39407. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  39408. a += l & 0xffff; b += l >>> 16;
  39409. c += h & 0xffff; d += h >>> 16;
  39410. b += a >>> 16;
  39411. c += b >>> 16;
  39412. d += c >>> 16;
  39413. wh[j] = (c & 0xffff) | (d << 16);
  39414. wl[j] = (a & 0xffff) | (b << 16);
  39415. }
  39416. }
  39417. }
  39418. // add
  39419. h = ah0;
  39420. l = al0;
  39421. a = l & 0xffff; b = l >>> 16;
  39422. c = h & 0xffff; d = h >>> 16;
  39423. h = hh[0];
  39424. l = hl[0];
  39425. a += l & 0xffff; b += l >>> 16;
  39426. c += h & 0xffff; d += h >>> 16;
  39427. b += a >>> 16;
  39428. c += b >>> 16;
  39429. d += c >>> 16;
  39430. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  39431. hl[0] = al0 = (a & 0xffff) | (b << 16);
  39432. h = ah1;
  39433. l = al1;
  39434. a = l & 0xffff; b = l >>> 16;
  39435. c = h & 0xffff; d = h >>> 16;
  39436. h = hh[1];
  39437. l = hl[1];
  39438. a += l & 0xffff; b += l >>> 16;
  39439. c += h & 0xffff; d += h >>> 16;
  39440. b += a >>> 16;
  39441. c += b >>> 16;
  39442. d += c >>> 16;
  39443. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  39444. hl[1] = al1 = (a & 0xffff) | (b << 16);
  39445. h = ah2;
  39446. l = al2;
  39447. a = l & 0xffff; b = l >>> 16;
  39448. c = h & 0xffff; d = h >>> 16;
  39449. h = hh[2];
  39450. l = hl[2];
  39451. a += l & 0xffff; b += l >>> 16;
  39452. c += h & 0xffff; d += h >>> 16;
  39453. b += a >>> 16;
  39454. c += b >>> 16;
  39455. d += c >>> 16;
  39456. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  39457. hl[2] = al2 = (a & 0xffff) | (b << 16);
  39458. h = ah3;
  39459. l = al3;
  39460. a = l & 0xffff; b = l >>> 16;
  39461. c = h & 0xffff; d = h >>> 16;
  39462. h = hh[3];
  39463. l = hl[3];
  39464. a += l & 0xffff; b += l >>> 16;
  39465. c += h & 0xffff; d += h >>> 16;
  39466. b += a >>> 16;
  39467. c += b >>> 16;
  39468. d += c >>> 16;
  39469. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  39470. hl[3] = al3 = (a & 0xffff) | (b << 16);
  39471. h = ah4;
  39472. l = al4;
  39473. a = l & 0xffff; b = l >>> 16;
  39474. c = h & 0xffff; d = h >>> 16;
  39475. h = hh[4];
  39476. l = hl[4];
  39477. a += l & 0xffff; b += l >>> 16;
  39478. c += h & 0xffff; d += h >>> 16;
  39479. b += a >>> 16;
  39480. c += b >>> 16;
  39481. d += c >>> 16;
  39482. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  39483. hl[4] = al4 = (a & 0xffff) | (b << 16);
  39484. h = ah5;
  39485. l = al5;
  39486. a = l & 0xffff; b = l >>> 16;
  39487. c = h & 0xffff; d = h >>> 16;
  39488. h = hh[5];
  39489. l = hl[5];
  39490. a += l & 0xffff; b += l >>> 16;
  39491. c += h & 0xffff; d += h >>> 16;
  39492. b += a >>> 16;
  39493. c += b >>> 16;
  39494. d += c >>> 16;
  39495. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  39496. hl[5] = al5 = (a & 0xffff) | (b << 16);
  39497. h = ah6;
  39498. l = al6;
  39499. a = l & 0xffff; b = l >>> 16;
  39500. c = h & 0xffff; d = h >>> 16;
  39501. h = hh[6];
  39502. l = hl[6];
  39503. a += l & 0xffff; b += l >>> 16;
  39504. c += h & 0xffff; d += h >>> 16;
  39505. b += a >>> 16;
  39506. c += b >>> 16;
  39507. d += c >>> 16;
  39508. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  39509. hl[6] = al6 = (a & 0xffff) | (b << 16);
  39510. h = ah7;
  39511. l = al7;
  39512. a = l & 0xffff; b = l >>> 16;
  39513. c = h & 0xffff; d = h >>> 16;
  39514. h = hh[7];
  39515. l = hl[7];
  39516. a += l & 0xffff; b += l >>> 16;
  39517. c += h & 0xffff; d += h >>> 16;
  39518. b += a >>> 16;
  39519. c += b >>> 16;
  39520. d += c >>> 16;
  39521. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  39522. hl[7] = al7 = (a & 0xffff) | (b << 16);
  39523. pos += 128;
  39524. n -= 128;
  39525. }
  39526. return n;
  39527. }
  39528. function crypto_hash(out, m, n) {
  39529. var hh = new Int32Array(8),
  39530. hl = new Int32Array(8),
  39531. x = new Uint8Array(256),
  39532. i, b = n;
  39533. hh[0] = 0x6a09e667;
  39534. hh[1] = 0xbb67ae85;
  39535. hh[2] = 0x3c6ef372;
  39536. hh[3] = 0xa54ff53a;
  39537. hh[4] = 0x510e527f;
  39538. hh[5] = 0x9b05688c;
  39539. hh[6] = 0x1f83d9ab;
  39540. hh[7] = 0x5be0cd19;
  39541. hl[0] = 0xf3bcc908;
  39542. hl[1] = 0x84caa73b;
  39543. hl[2] = 0xfe94f82b;
  39544. hl[3] = 0x5f1d36f1;
  39545. hl[4] = 0xade682d1;
  39546. hl[5] = 0x2b3e6c1f;
  39547. hl[6] = 0xfb41bd6b;
  39548. hl[7] = 0x137e2179;
  39549. crypto_hashblocks_hl(hh, hl, m, n);
  39550. n %= 128;
  39551. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  39552. x[n] = 128;
  39553. n = 256-128*(n<112?1:0);
  39554. x[n-9] = 0;
  39555. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  39556. crypto_hashblocks_hl(hh, hl, x, n);
  39557. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  39558. return 0;
  39559. }
  39560. function add(p, q) {
  39561. var a = gf(), b = gf(), c = gf(),
  39562. d = gf(), e = gf(), f = gf(),
  39563. g = gf(), h = gf(), t = gf();
  39564. Z(a, p[1], p[0]);
  39565. Z(t, q[1], q[0]);
  39566. M(a, a, t);
  39567. A(b, p[0], p[1]);
  39568. A(t, q[0], q[1]);
  39569. M(b, b, t);
  39570. M(c, p[3], q[3]);
  39571. M(c, c, D2);
  39572. M(d, p[2], q[2]);
  39573. A(d, d, d);
  39574. Z(e, b, a);
  39575. Z(f, d, c);
  39576. A(g, d, c);
  39577. A(h, b, a);
  39578. M(p[0], e, f);
  39579. M(p[1], h, g);
  39580. M(p[2], g, f);
  39581. M(p[3], e, h);
  39582. }
  39583. function cswap(p, q, b) {
  39584. var i;
  39585. for (i = 0; i < 4; i++) {
  39586. sel25519(p[i], q[i], b);
  39587. }
  39588. }
  39589. function pack(r, p) {
  39590. var tx = gf(), ty = gf(), zi = gf();
  39591. inv25519(zi, p[2]);
  39592. M(tx, p[0], zi);
  39593. M(ty, p[1], zi);
  39594. pack25519(r, ty);
  39595. r[31] ^= par25519(tx) << 7;
  39596. }
  39597. function scalarmult(p, q, s) {
  39598. var b, i;
  39599. set25519(p[0], gf0);
  39600. set25519(p[1], gf1);
  39601. set25519(p[2], gf1);
  39602. set25519(p[3], gf0);
  39603. for (i = 255; i >= 0; --i) {
  39604. b = (s[(i/8)|0] >> (i&7)) & 1;
  39605. cswap(p, q, b);
  39606. add(q, p);
  39607. add(p, p);
  39608. cswap(p, q, b);
  39609. }
  39610. }
  39611. function scalarbase(p, s) {
  39612. var q = [gf(), gf(), gf(), gf()];
  39613. set25519(q[0], X);
  39614. set25519(q[1], Y);
  39615. set25519(q[2], gf1);
  39616. M(q[3], X, Y);
  39617. scalarmult(p, q, s);
  39618. }
  39619. function crypto_sign_keypair(pk, sk, seeded) {
  39620. var d = new Uint8Array(64);
  39621. var p = [gf(), gf(), gf(), gf()];
  39622. var i;
  39623. if (!seeded) randombytes(sk, 32);
  39624. crypto_hash(d, sk, 32);
  39625. d[0] &= 248;
  39626. d[31] &= 127;
  39627. d[31] |= 64;
  39628. scalarbase(p, d);
  39629. pack(pk, p);
  39630. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  39631. return 0;
  39632. }
  39633. 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]);
  39634. function modL(r, x) {
  39635. var carry, i, j, k;
  39636. for (i = 63; i >= 32; --i) {
  39637. carry = 0;
  39638. for (j = i - 32, k = i - 12; j < k; ++j) {
  39639. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  39640. carry = (x[j] + 128) >> 8;
  39641. x[j] -= carry * 256;
  39642. }
  39643. x[j] += carry;
  39644. x[i] = 0;
  39645. }
  39646. carry = 0;
  39647. for (j = 0; j < 32; j++) {
  39648. x[j] += carry - (x[31] >> 4) * L[j];
  39649. carry = x[j] >> 8;
  39650. x[j] &= 255;
  39651. }
  39652. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  39653. for (i = 0; i < 32; i++) {
  39654. x[i+1] += x[i] >> 8;
  39655. r[i] = x[i] & 255;
  39656. }
  39657. }
  39658. function reduce(r) {
  39659. var x = new Float64Array(64), i;
  39660. for (i = 0; i < 64; i++) x[i] = r[i];
  39661. for (i = 0; i < 64; i++) r[i] = 0;
  39662. modL(r, x);
  39663. }
  39664. // Note: difference from C - smlen returned, not passed as argument.
  39665. function crypto_sign(sm, m, n, sk) {
  39666. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  39667. var i, j, x = new Float64Array(64);
  39668. var p = [gf(), gf(), gf(), gf()];
  39669. crypto_hash(d, sk, 32);
  39670. d[0] &= 248;
  39671. d[31] &= 127;
  39672. d[31] |= 64;
  39673. var smlen = n + 64;
  39674. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  39675. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  39676. crypto_hash(r, sm.subarray(32), n+32);
  39677. reduce(r);
  39678. scalarbase(p, r);
  39679. pack(sm, p);
  39680. for (i = 32; i < 64; i++) sm[i] = sk[i];
  39681. crypto_hash(h, sm, n + 64);
  39682. reduce(h);
  39683. for (i = 0; i < 64; i++) x[i] = 0;
  39684. for (i = 0; i < 32; i++) x[i] = r[i];
  39685. for (i = 0; i < 32; i++) {
  39686. for (j = 0; j < 32; j++) {
  39687. x[i+j] += h[i] * d[j];
  39688. }
  39689. }
  39690. modL(sm.subarray(32), x);
  39691. return smlen;
  39692. }
  39693. function unpackneg(r, p) {
  39694. var t = gf(), chk = gf(), num = gf(),
  39695. den = gf(), den2 = gf(), den4 = gf(),
  39696. den6 = gf();
  39697. set25519(r[2], gf1);
  39698. unpack25519(r[1], p);
  39699. S(num, r[1]);
  39700. M(den, num, D);
  39701. Z(num, num, r[2]);
  39702. A(den, r[2], den);
  39703. S(den2, den);
  39704. S(den4, den2);
  39705. M(den6, den4, den2);
  39706. M(t, den6, num);
  39707. M(t, t, den);
  39708. pow2523(t, t);
  39709. M(t, t, num);
  39710. M(t, t, den);
  39711. M(t, t, den);
  39712. M(r[0], t, den);
  39713. S(chk, r[0]);
  39714. M(chk, chk, den);
  39715. if (neq25519(chk, num)) M(r[0], r[0], I);
  39716. S(chk, r[0]);
  39717. M(chk, chk, den);
  39718. if (neq25519(chk, num)) return -1;
  39719. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  39720. M(r[3], r[0], r[1]);
  39721. return 0;
  39722. }
  39723. function crypto_sign_open(m, sm, n, pk) {
  39724. var i, mlen;
  39725. var t = new Uint8Array(32), h = new Uint8Array(64);
  39726. var p = [gf(), gf(), gf(), gf()],
  39727. q = [gf(), gf(), gf(), gf()];
  39728. mlen = -1;
  39729. if (n < 64) return -1;
  39730. if (unpackneg(q, pk)) return -1;
  39731. for (i = 0; i < n; i++) m[i] = sm[i];
  39732. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  39733. crypto_hash(h, m, n);
  39734. reduce(h);
  39735. scalarmult(p, q, h);
  39736. scalarbase(q, sm.subarray(32));
  39737. add(p, q);
  39738. pack(t, p);
  39739. n -= 64;
  39740. if (crypto_verify_32(sm, 0, t, 0)) {
  39741. for (i = 0; i < n; i++) m[i] = 0;
  39742. return -1;
  39743. }
  39744. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  39745. mlen = n;
  39746. return mlen;
  39747. }
  39748. var crypto_secretbox_KEYBYTES = 32,
  39749. crypto_secretbox_NONCEBYTES = 24,
  39750. crypto_secretbox_ZEROBYTES = 32,
  39751. crypto_secretbox_BOXZEROBYTES = 16,
  39752. crypto_scalarmult_BYTES = 32,
  39753. crypto_scalarmult_SCALARBYTES = 32,
  39754. crypto_box_PUBLICKEYBYTES = 32,
  39755. crypto_box_SECRETKEYBYTES = 32,
  39756. crypto_box_BEFORENMBYTES = 32,
  39757. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  39758. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  39759. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  39760. crypto_sign_BYTES = 64,
  39761. crypto_sign_PUBLICKEYBYTES = 32,
  39762. crypto_sign_SECRETKEYBYTES = 64,
  39763. crypto_sign_SEEDBYTES = 32,
  39764. crypto_hash_BYTES = 64;
  39765. nacl.lowlevel = {
  39766. crypto_core_hsalsa20: crypto_core_hsalsa20,
  39767. crypto_stream_xor: crypto_stream_xor,
  39768. crypto_stream: crypto_stream,
  39769. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  39770. crypto_stream_salsa20: crypto_stream_salsa20,
  39771. crypto_onetimeauth: crypto_onetimeauth,
  39772. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  39773. crypto_verify_16: crypto_verify_16,
  39774. crypto_verify_32: crypto_verify_32,
  39775. crypto_secretbox: crypto_secretbox,
  39776. crypto_secretbox_open: crypto_secretbox_open,
  39777. crypto_scalarmult: crypto_scalarmult,
  39778. crypto_scalarmult_base: crypto_scalarmult_base,
  39779. crypto_box_beforenm: crypto_box_beforenm,
  39780. crypto_box_afternm: crypto_box_afternm,
  39781. crypto_box: crypto_box,
  39782. crypto_box_open: crypto_box_open,
  39783. crypto_box_keypair: crypto_box_keypair,
  39784. crypto_hash: crypto_hash,
  39785. crypto_sign: crypto_sign,
  39786. crypto_sign_keypair: crypto_sign_keypair,
  39787. crypto_sign_open: crypto_sign_open,
  39788. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  39789. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  39790. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  39791. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  39792. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  39793. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  39794. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  39795. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  39796. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  39797. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  39798. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  39799. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  39800. crypto_sign_BYTES: crypto_sign_BYTES,
  39801. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  39802. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  39803. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  39804. crypto_hash_BYTES: crypto_hash_BYTES
  39805. };
  39806. /* High-level API */
  39807. function checkLengths(k, n) {
  39808. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  39809. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  39810. }
  39811. function checkBoxLengths(pk, sk) {
  39812. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  39813. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  39814. }
  39815. function checkArrayTypes() {
  39816. for (var i = 0; i < arguments.length; i++) {
  39817. if (!(arguments[i] instanceof Uint8Array))
  39818. throw new TypeError('unexpected type, use Uint8Array');
  39819. }
  39820. }
  39821. function cleanup(arr) {
  39822. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  39823. }
  39824. nacl.randomBytes = function(n) {
  39825. var b = new Uint8Array(n);
  39826. randombytes(b, n);
  39827. return b;
  39828. };
  39829. nacl.secretbox = function(msg, nonce, key) {
  39830. checkArrayTypes(msg, nonce, key);
  39831. checkLengths(key, nonce);
  39832. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  39833. var c = new Uint8Array(m.length);
  39834. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  39835. crypto_secretbox(c, m, m.length, nonce, key);
  39836. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  39837. };
  39838. nacl.secretbox.open = function(box, nonce, key) {
  39839. checkArrayTypes(box, nonce, key);
  39840. checkLengths(key, nonce);
  39841. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  39842. var m = new Uint8Array(c.length);
  39843. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  39844. if (c.length < 32) return null;
  39845. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  39846. return m.subarray(crypto_secretbox_ZEROBYTES);
  39847. };
  39848. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  39849. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  39850. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  39851. nacl.scalarMult = function(n, p) {
  39852. checkArrayTypes(n, p);
  39853. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39854. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  39855. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39856. crypto_scalarmult(q, n, p);
  39857. return q;
  39858. };
  39859. nacl.scalarMult.base = function(n) {
  39860. checkArrayTypes(n);
  39861. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39862. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39863. crypto_scalarmult_base(q, n);
  39864. return q;
  39865. };
  39866. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  39867. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  39868. nacl.box = function(msg, nonce, publicKey, secretKey) {
  39869. var k = nacl.box.before(publicKey, secretKey);
  39870. return nacl.secretbox(msg, nonce, k);
  39871. };
  39872. nacl.box.before = function(publicKey, secretKey) {
  39873. checkArrayTypes(publicKey, secretKey);
  39874. checkBoxLengths(publicKey, secretKey);
  39875. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  39876. crypto_box_beforenm(k, publicKey, secretKey);
  39877. return k;
  39878. };
  39879. nacl.box.after = nacl.secretbox;
  39880. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  39881. var k = nacl.box.before(publicKey, secretKey);
  39882. return nacl.secretbox.open(msg, nonce, k);
  39883. };
  39884. nacl.box.open.after = nacl.secretbox.open;
  39885. nacl.box.keyPair = function() {
  39886. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39887. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  39888. crypto_box_keypair(pk, sk);
  39889. return {publicKey: pk, secretKey: sk};
  39890. };
  39891. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  39892. checkArrayTypes(secretKey);
  39893. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  39894. throw new Error('bad secret key size');
  39895. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39896. crypto_scalarmult_base(pk, secretKey);
  39897. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39898. };
  39899. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  39900. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  39901. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  39902. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  39903. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  39904. nacl.sign = function(msg, secretKey) {
  39905. checkArrayTypes(msg, secretKey);
  39906. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39907. throw new Error('bad secret key size');
  39908. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  39909. crypto_sign(signedMsg, msg, msg.length, secretKey);
  39910. return signedMsg;
  39911. };
  39912. nacl.sign.open = function(signedMsg, publicKey) {
  39913. checkArrayTypes(signedMsg, publicKey);
  39914. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39915. throw new Error('bad public key size');
  39916. var tmp = new Uint8Array(signedMsg.length);
  39917. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  39918. if (mlen < 0) return null;
  39919. var m = new Uint8Array(mlen);
  39920. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  39921. return m;
  39922. };
  39923. nacl.sign.detached = function(msg, secretKey) {
  39924. var signedMsg = nacl.sign(msg, secretKey);
  39925. var sig = new Uint8Array(crypto_sign_BYTES);
  39926. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39927. return sig;
  39928. };
  39929. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39930. checkArrayTypes(msg, sig, publicKey);
  39931. if (sig.length !== crypto_sign_BYTES)
  39932. throw new Error('bad signature size');
  39933. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39934. throw new Error('bad public key size');
  39935. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39936. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39937. var i;
  39938. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39939. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39940. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39941. };
  39942. nacl.sign.keyPair = function() {
  39943. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39944. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39945. crypto_sign_keypair(pk, sk);
  39946. return {publicKey: pk, secretKey: sk};
  39947. };
  39948. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39949. checkArrayTypes(secretKey);
  39950. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39951. throw new Error('bad secret key size');
  39952. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39953. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39954. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39955. };
  39956. nacl.sign.keyPair.fromSeed = function(seed) {
  39957. checkArrayTypes(seed);
  39958. if (seed.length !== crypto_sign_SEEDBYTES)
  39959. throw new Error('bad seed size');
  39960. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39961. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39962. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39963. crypto_sign_keypair(pk, sk, true);
  39964. return {publicKey: pk, secretKey: sk};
  39965. };
  39966. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39967. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39968. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39969. nacl.sign.signatureLength = crypto_sign_BYTES;
  39970. nacl.hash = function(msg) {
  39971. checkArrayTypes(msg);
  39972. var h = new Uint8Array(crypto_hash_BYTES);
  39973. crypto_hash(h, msg, msg.length);
  39974. return h;
  39975. };
  39976. nacl.hash.hashLength = crypto_hash_BYTES;
  39977. nacl.verify = function(x, y) {
  39978. checkArrayTypes(x, y);
  39979. // Zero length arguments are considered not equal.
  39980. if (x.length === 0 || y.length === 0) return false;
  39981. if (x.length !== y.length) return false;
  39982. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39983. };
  39984. nacl.setPRNG = function(fn) {
  39985. randombytes = fn;
  39986. };
  39987. (function() {
  39988. // Initialize PRNG if environment provides CSPRNG.
  39989. // If not, methods calling randombytes will throw.
  39990. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39991. if (crypto && crypto.getRandomValues) {
  39992. // Browsers.
  39993. var QUOTA = 65536;
  39994. nacl.setPRNG(function(x, n) {
  39995. var i, v = new Uint8Array(n);
  39996. for (i = 0; i < n; i += QUOTA) {
  39997. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39998. }
  39999. for (i = 0; i < n; i++) x[i] = v[i];
  40000. cleanup(v);
  40001. });
  40002. } else if (true) {
  40003. // Node.js.
  40004. crypto = __webpack_require__(3);
  40005. if (crypto && crypto.randomBytes) {
  40006. nacl.setPRNG(function(x, n) {
  40007. var i, v = crypto.randomBytes(n);
  40008. for (i = 0; i < n; i++) x[i] = v[i];
  40009. cleanup(v);
  40010. });
  40011. }
  40012. }
  40013. })();
  40014. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  40015. /***/ }),
  40016. /* 1 */
  40017. /***/ (function(module, exports, __webpack_require__) {
  40018. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  40019. // Public domain.
  40020. (function(root, f) {
  40021. 'use strict';
  40022. if ( true && module.exports) module.exports = f();
  40023. else if (root.nacl) root.nacl.util = f();
  40024. else {
  40025. root.nacl = {};
  40026. root.nacl.util = f();
  40027. }
  40028. }(this, function() {
  40029. 'use strict';
  40030. var util = {};
  40031. function validateBase64(s) {
  40032. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  40033. throw new TypeError('invalid encoding');
  40034. }
  40035. }
  40036. util.decodeUTF8 = function(s) {
  40037. if (typeof s !== 'string') throw new TypeError('expected string');
  40038. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  40039. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  40040. return b;
  40041. };
  40042. util.encodeUTF8 = function(arr) {
  40043. var i, s = [];
  40044. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  40045. return decodeURIComponent(escape(s.join('')));
  40046. };
  40047. if (typeof atob === 'undefined') {
  40048. // Node.js
  40049. if (typeof Buffer.from !== 'undefined') {
  40050. // Node v6 and later
  40051. util.encodeBase64 = function (arr) { // v6 and later
  40052. return Buffer.from(arr).toString('base64');
  40053. };
  40054. util.decodeBase64 = function (s) {
  40055. validateBase64(s);
  40056. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  40057. };
  40058. } else {
  40059. // Node earlier than v6
  40060. util.encodeBase64 = function (arr) { // v6 and later
  40061. return (new Buffer(arr)).toString('base64');
  40062. };
  40063. util.decodeBase64 = function(s) {
  40064. validateBase64(s);
  40065. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  40066. };
  40067. }
  40068. } else {
  40069. // Browsers
  40070. util.encodeBase64 = function(arr) {
  40071. var i, s = [], len = arr.length;
  40072. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  40073. return btoa(s.join(''));
  40074. };
  40075. util.decodeBase64 = function(s) {
  40076. validateBase64(s);
  40077. var i, d = atob(s), b = new Uint8Array(d.length);
  40078. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  40079. return b;
  40080. };
  40081. }
  40082. return util;
  40083. }));
  40084. /***/ }),
  40085. /* 2 */
  40086. /***/ (function(module, exports, __webpack_require__) {
  40087. // required so we don't have to do require('pusher').default etc.
  40088. module.exports = __webpack_require__(4).default;
  40089. /***/ }),
  40090. /* 3 */
  40091. /***/ (function(module, exports) {
  40092. /* (ignored) */
  40093. /***/ }),
  40094. /* 4 */
  40095. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  40096. "use strict";
  40097. __webpack_require__.r(__webpack_exports__);
  40098. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  40099. var ScriptReceiverFactory = (function () {
  40100. function ScriptReceiverFactory(prefix, name) {
  40101. this.lastId = 0;
  40102. this.prefix = prefix;
  40103. this.name = name;
  40104. }
  40105. ScriptReceiverFactory.prototype.create = function (callback) {
  40106. this.lastId++;
  40107. var number = this.lastId;
  40108. var id = this.prefix + number;
  40109. var name = this.name + "[" + number + "]";
  40110. var called = false;
  40111. var callbackWrapper = function () {
  40112. if (!called) {
  40113. callback.apply(null, arguments);
  40114. called = true;
  40115. }
  40116. };
  40117. this[number] = callbackWrapper;
  40118. return { number: number, id: id, name: name, callback: callbackWrapper };
  40119. };
  40120. ScriptReceiverFactory.prototype.remove = function (receiver) {
  40121. delete this[receiver.number];
  40122. };
  40123. return ScriptReceiverFactory;
  40124. }());
  40125. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  40126. // CONCATENATED MODULE: ./src/core/defaults.ts
  40127. var Defaults = {
  40128. VERSION: "5.0.3",
  40129. PROTOCOL: 7,
  40130. host: 'ws.pusherapp.com',
  40131. ws_port: 80,
  40132. wss_port: 443,
  40133. ws_path: '',
  40134. sockjs_host: 'sockjs.pusher.com',
  40135. sockjs_http_port: 80,
  40136. sockjs_https_port: 443,
  40137. sockjs_path: '/pusher',
  40138. stats_host: 'stats.pusher.com',
  40139. channel_auth_endpoint: '/pusher/auth',
  40140. channel_auth_transport: 'ajax',
  40141. activity_timeout: 120000,
  40142. pong_timeout: 30000,
  40143. unavailable_timeout: 10000,
  40144. cdn_http: "http://js.pusher.com",
  40145. cdn_https: "https://js.pusher.com",
  40146. dependency_suffix: ""
  40147. };
  40148. /* harmony default export */ var defaults = (Defaults);
  40149. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  40150. var dependency_loader_DependencyLoader = (function () {
  40151. function DependencyLoader(options) {
  40152. this.options = options;
  40153. this.receivers = options.receivers || ScriptReceivers;
  40154. this.loading = {};
  40155. }
  40156. DependencyLoader.prototype.load = function (name, options, callback) {
  40157. var self = this;
  40158. if (self.loading[name] && self.loading[name].length > 0) {
  40159. self.loading[name].push(callback);
  40160. }
  40161. else {
  40162. self.loading[name] = [callback];
  40163. var request = runtime.createScriptRequest(self.getPath(name, options));
  40164. var receiver = self.receivers.create(function (error) {
  40165. self.receivers.remove(receiver);
  40166. if (self.loading[name]) {
  40167. var callbacks = self.loading[name];
  40168. delete self.loading[name];
  40169. var successCallback = function (wasSuccessful) {
  40170. if (!wasSuccessful) {
  40171. request.cleanup();
  40172. }
  40173. };
  40174. for (var i = 0; i < callbacks.length; i++) {
  40175. callbacks[i](error, successCallback);
  40176. }
  40177. }
  40178. });
  40179. request.send(receiver);
  40180. }
  40181. };
  40182. DependencyLoader.prototype.getRoot = function (options) {
  40183. var cdn;
  40184. var protocol = runtime.getDocument().location.protocol;
  40185. if ((options && options.useTLS) || protocol === "https:") {
  40186. cdn = this.options.cdn_https;
  40187. }
  40188. else {
  40189. cdn = this.options.cdn_http;
  40190. }
  40191. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  40192. };
  40193. DependencyLoader.prototype.getPath = function (name, options) {
  40194. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  40195. };
  40196. ;
  40197. return DependencyLoader;
  40198. }());
  40199. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  40200. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  40201. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  40202. var Dependencies = new dependency_loader({
  40203. cdn_http: defaults.cdn_http,
  40204. cdn_https: defaults.cdn_https,
  40205. version: defaults.VERSION,
  40206. suffix: defaults.dependency_suffix,
  40207. receivers: DependenciesReceivers
  40208. });
  40209. // CONCATENATED MODULE: ./src/core/base64.ts
  40210. function encode(s) {
  40211. return btoa(utob(s));
  40212. }
  40213. var fromCharCode = String.fromCharCode;
  40214. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  40215. var b64tab = {};
  40216. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  40217. b64tab[b64chars.charAt(base64_i)] = base64_i;
  40218. }
  40219. var cb_utob = function (c) {
  40220. var cc = c.charCodeAt(0);
  40221. return cc < 0x80
  40222. ? c
  40223. : cc < 0x800
  40224. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  40225. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  40226. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  40227. fromCharCode(0x80 | (cc & 0x3f));
  40228. };
  40229. var utob = function (u) {
  40230. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  40231. };
  40232. var cb_encode = function (ccc) {
  40233. var padlen = [0, 2, 1][ccc.length % 3];
  40234. var ord = (ccc.charCodeAt(0) << 16) |
  40235. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  40236. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  40237. var chars = [
  40238. b64chars.charAt(ord >>> 18),
  40239. b64chars.charAt((ord >>> 12) & 63),
  40240. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  40241. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  40242. ];
  40243. return chars.join('');
  40244. };
  40245. var btoa = window.btoa ||
  40246. function (b) {
  40247. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  40248. };
  40249. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  40250. var Timer = (function () {
  40251. function Timer(set, clear, delay, callback) {
  40252. var _this = this;
  40253. this.clear = clear;
  40254. this.timer = set(function () {
  40255. if (_this.timer) {
  40256. _this.timer = callback(_this.timer);
  40257. }
  40258. }, delay);
  40259. }
  40260. Timer.prototype.isRunning = function () {
  40261. return this.timer !== null;
  40262. };
  40263. Timer.prototype.ensureAborted = function () {
  40264. if (this.timer) {
  40265. this.clear(this.timer);
  40266. this.timer = null;
  40267. }
  40268. };
  40269. return Timer;
  40270. }());
  40271. /* harmony default export */ var abstract_timer = (Timer);
  40272. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  40273. var __extends = (undefined && undefined.__extends) || (function () {
  40274. var extendStatics = function (d, b) {
  40275. extendStatics = Object.setPrototypeOf ||
  40276. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40277. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40278. return extendStatics(d, b);
  40279. };
  40280. return function (d, b) {
  40281. extendStatics(d, b);
  40282. function __() { this.constructor = d; }
  40283. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40284. };
  40285. })();
  40286. function timers_clearTimeout(timer) {
  40287. window.clearTimeout(timer);
  40288. }
  40289. function timers_clearInterval(timer) {
  40290. window.clearInterval(timer);
  40291. }
  40292. var OneOffTimer = (function (_super) {
  40293. __extends(OneOffTimer, _super);
  40294. function OneOffTimer(delay, callback) {
  40295. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  40296. callback();
  40297. return null;
  40298. }) || this;
  40299. }
  40300. return OneOffTimer;
  40301. }(abstract_timer));
  40302. var PeriodicTimer = (function (_super) {
  40303. __extends(PeriodicTimer, _super);
  40304. function PeriodicTimer(delay, callback) {
  40305. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  40306. callback();
  40307. return timer;
  40308. }) || this;
  40309. }
  40310. return PeriodicTimer;
  40311. }(abstract_timer));
  40312. // CONCATENATED MODULE: ./src/core/util.ts
  40313. var Util = {
  40314. now: function () {
  40315. if (Date.now) {
  40316. return Date.now();
  40317. }
  40318. else {
  40319. return new Date().valueOf();
  40320. }
  40321. },
  40322. defer: function (callback) {
  40323. return new OneOffTimer(0, callback);
  40324. },
  40325. method: function (name) {
  40326. var args = [];
  40327. for (var _i = 1; _i < arguments.length; _i++) {
  40328. args[_i - 1] = arguments[_i];
  40329. }
  40330. var boundArguments = Array.prototype.slice.call(arguments, 1);
  40331. return function (object) {
  40332. return object[name].apply(object, boundArguments.concat(arguments));
  40333. };
  40334. }
  40335. };
  40336. /* harmony default export */ var util = (Util);
  40337. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  40338. function extend(target) {
  40339. var sources = [];
  40340. for (var _i = 1; _i < arguments.length; _i++) {
  40341. sources[_i - 1] = arguments[_i];
  40342. }
  40343. for (var i = 0; i < sources.length; i++) {
  40344. var extensions = sources[i];
  40345. for (var property in extensions) {
  40346. if (extensions[property] && extensions[property].constructor &&
  40347. extensions[property].constructor === Object) {
  40348. target[property] = extend(target[property] || {}, extensions[property]);
  40349. }
  40350. else {
  40351. target[property] = extensions[property];
  40352. }
  40353. }
  40354. }
  40355. return target;
  40356. }
  40357. function stringify() {
  40358. var m = ["Pusher"];
  40359. for (var i = 0; i < arguments.length; i++) {
  40360. if (typeof arguments[i] === "string") {
  40361. m.push(arguments[i]);
  40362. }
  40363. else {
  40364. m.push(safeJSONStringify(arguments[i]));
  40365. }
  40366. }
  40367. return m.join(" : ");
  40368. }
  40369. function arrayIndexOf(array, item) {
  40370. var nativeIndexOf = Array.prototype.indexOf;
  40371. if (array === null) {
  40372. return -1;
  40373. }
  40374. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  40375. return array.indexOf(item);
  40376. }
  40377. for (var i = 0, l = array.length; i < l; i++) {
  40378. if (array[i] === item) {
  40379. return i;
  40380. }
  40381. }
  40382. return -1;
  40383. }
  40384. function objectApply(object, f) {
  40385. for (var key in object) {
  40386. if (Object.prototype.hasOwnProperty.call(object, key)) {
  40387. f(object[key], key, object);
  40388. }
  40389. }
  40390. }
  40391. function keys(object) {
  40392. var keys = [];
  40393. objectApply(object, function (_, key) {
  40394. keys.push(key);
  40395. });
  40396. return keys;
  40397. }
  40398. function values(object) {
  40399. var values = [];
  40400. objectApply(object, function (value) {
  40401. values.push(value);
  40402. });
  40403. return values;
  40404. }
  40405. function apply(array, f, context) {
  40406. for (var i = 0; i < array.length; i++) {
  40407. f.call(context || window, array[i], i, array);
  40408. }
  40409. }
  40410. function map(array, f) {
  40411. var result = [];
  40412. for (var i = 0; i < array.length; i++) {
  40413. result.push(f(array[i], i, array, result));
  40414. }
  40415. return result;
  40416. }
  40417. function mapObject(object, f) {
  40418. var result = {};
  40419. objectApply(object, function (value, key) {
  40420. result[key] = f(value);
  40421. });
  40422. return result;
  40423. }
  40424. function filter(array, test) {
  40425. test = test || function (value) { return !!value; };
  40426. var result = [];
  40427. for (var i = 0; i < array.length; i++) {
  40428. if (test(array[i], i, array, result)) {
  40429. result.push(array[i]);
  40430. }
  40431. }
  40432. return result;
  40433. }
  40434. function filterObject(object, test) {
  40435. var result = {};
  40436. objectApply(object, function (value, key) {
  40437. if ((test && test(value, key, object, result)) || Boolean(value)) {
  40438. result[key] = value;
  40439. }
  40440. });
  40441. return result;
  40442. }
  40443. function flatten(object) {
  40444. var result = [];
  40445. objectApply(object, function (value, key) {
  40446. result.push([key, value]);
  40447. });
  40448. return result;
  40449. }
  40450. function any(array, test) {
  40451. for (var i = 0; i < array.length; i++) {
  40452. if (test(array[i], i, array)) {
  40453. return true;
  40454. }
  40455. }
  40456. return false;
  40457. }
  40458. function collections_all(array, test) {
  40459. for (var i = 0; i < array.length; i++) {
  40460. if (!test(array[i], i, array)) {
  40461. return false;
  40462. }
  40463. }
  40464. return true;
  40465. }
  40466. function encodeParamsObject(data) {
  40467. return mapObject(data, function (value) {
  40468. if (typeof value === "object") {
  40469. value = safeJSONStringify(value);
  40470. }
  40471. return encodeURIComponent(encode(value.toString()));
  40472. });
  40473. }
  40474. function buildQueryString(data) {
  40475. var params = filterObject(data, function (value) {
  40476. return value !== undefined;
  40477. });
  40478. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  40479. return query;
  40480. }
  40481. function decycleObject(object) {
  40482. var objects = [], paths = [];
  40483. return (function derez(value, path) {
  40484. var i, name, nu;
  40485. switch (typeof value) {
  40486. case 'object':
  40487. if (!value) {
  40488. return null;
  40489. }
  40490. for (i = 0; i < objects.length; i += 1) {
  40491. if (objects[i] === value) {
  40492. return { $ref: paths[i] };
  40493. }
  40494. }
  40495. objects.push(value);
  40496. paths.push(path);
  40497. if (Object.prototype.toString.apply(value) === '[object Array]') {
  40498. nu = [];
  40499. for (i = 0; i < value.length; i += 1) {
  40500. nu[i] = derez(value[i], path + '[' + i + ']');
  40501. }
  40502. }
  40503. else {
  40504. nu = {};
  40505. for (name in value) {
  40506. if (Object.prototype.hasOwnProperty.call(value, name)) {
  40507. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  40508. }
  40509. }
  40510. }
  40511. return nu;
  40512. case 'number':
  40513. case 'string':
  40514. case 'boolean':
  40515. return value;
  40516. }
  40517. }(object, '$'));
  40518. }
  40519. function safeJSONStringify(source) {
  40520. try {
  40521. return JSON.stringify(source);
  40522. }
  40523. catch (e) {
  40524. return JSON.stringify(decycleObject(source));
  40525. }
  40526. }
  40527. // CONCATENATED MODULE: ./src/core/logger.ts
  40528. var logger_Logger = (function () {
  40529. function Logger() {
  40530. this.globalLog = function (message) {
  40531. if (window.console && window.console.log) {
  40532. window.console.log(message);
  40533. }
  40534. };
  40535. }
  40536. Logger.prototype.debug = function () {
  40537. var args = [];
  40538. for (var _i = 0; _i < arguments.length; _i++) {
  40539. args[_i] = arguments[_i];
  40540. }
  40541. this.log(this.globalLog, args);
  40542. };
  40543. Logger.prototype.warn = function () {
  40544. var args = [];
  40545. for (var _i = 0; _i < arguments.length; _i++) {
  40546. args[_i] = arguments[_i];
  40547. }
  40548. this.log(this.globalLogWarn, args);
  40549. };
  40550. Logger.prototype.error = function () {
  40551. var args = [];
  40552. for (var _i = 0; _i < arguments.length; _i++) {
  40553. args[_i] = arguments[_i];
  40554. }
  40555. this.log(this.globalLogError, args);
  40556. };
  40557. Logger.prototype.globalLogWarn = function (message) {
  40558. if (window.console && window.console.warn) {
  40559. window.console.warn(message);
  40560. }
  40561. else {
  40562. this.globalLog(message);
  40563. }
  40564. };
  40565. Logger.prototype.globalLogError = function (message) {
  40566. if (window.console && window.console.error) {
  40567. window.console.error(message);
  40568. }
  40569. else {
  40570. this.globalLogWarn(message);
  40571. }
  40572. };
  40573. Logger.prototype.log = function (defaultLoggingFunction) {
  40574. var args = [];
  40575. for (var _i = 1; _i < arguments.length; _i++) {
  40576. args[_i - 1] = arguments[_i];
  40577. }
  40578. var message = stringify.apply(this, arguments);
  40579. if (core_pusher.log) {
  40580. core_pusher.log(message);
  40581. }
  40582. else if (core_pusher.logToConsole) {
  40583. var log = defaultLoggingFunction.bind(this);
  40584. log(message);
  40585. }
  40586. };
  40587. return Logger;
  40588. }());
  40589. /* harmony default export */ var logger = (new logger_Logger());
  40590. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  40591. var urlStore = {
  40592. baseUrl: "https://pusher.com",
  40593. urls: {
  40594. authenticationEndpoint: {
  40595. path: "/docs/authenticating_users",
  40596. },
  40597. javascriptQuickStart: {
  40598. path: "/docs/javascript_quick_start"
  40599. },
  40600. triggeringClientEvents: {
  40601. path: "/docs/client_api_guide/client_events#trigger-events"
  40602. }
  40603. }
  40604. };
  40605. var buildLogSuffix = function (key) {
  40606. var urlPrefix = "See:";
  40607. var urlObj = urlStore.urls[key];
  40608. if (!urlObj)
  40609. return "";
  40610. var url;
  40611. if (urlObj.fullUrl) {
  40612. url = urlObj.fullUrl;
  40613. }
  40614. else if (urlObj.path) {
  40615. url = urlStore.baseUrl + urlObj.path;
  40616. }
  40617. if (!url)
  40618. return "";
  40619. return urlPrefix + " " + url;
  40620. };
  40621. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  40622. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  40623. var ajax = function (context, socketId, callback) {
  40624. var self = this, xhr;
  40625. xhr = runtime.createXHR();
  40626. xhr.open("POST", self.options.authEndpoint, true);
  40627. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  40628. for (var headerName in this.authOptions.headers) {
  40629. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  40630. }
  40631. xhr.onreadystatechange = function () {
  40632. if (xhr.readyState === 4) {
  40633. if (xhr.status === 200) {
  40634. var data, parsed = false;
  40635. try {
  40636. data = JSON.parse(xhr.responseText);
  40637. parsed = true;
  40638. }
  40639. catch (e) {
  40640. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  40641. }
  40642. if (parsed) {
  40643. callback(false, data);
  40644. }
  40645. }
  40646. else {
  40647. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40648. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  40649. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  40650. ("Clients must be authenticated to join private or presence channels. " + suffix));
  40651. callback(true, xhr.status);
  40652. }
  40653. }
  40654. };
  40655. xhr.send(this.composeQuery(socketId));
  40656. return xhr;
  40657. };
  40658. /* harmony default export */ var xhr_auth = (ajax);
  40659. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  40660. var jsonp = function (context, socketId, callback) {
  40661. if (this.authOptions.headers !== undefined) {
  40662. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  40663. }
  40664. var callbackName = context.nextAuthCallbackID.toString();
  40665. context.nextAuthCallbackID++;
  40666. var document = context.getDocument();
  40667. var script = document.createElement("script");
  40668. context.auth_callbacks[callbackName] = function (data) {
  40669. callback(false, data);
  40670. };
  40671. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  40672. script.src = this.options.authEndpoint +
  40673. '?callback=' +
  40674. encodeURIComponent(callback_name) +
  40675. '&' +
  40676. this.composeQuery(socketId);
  40677. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  40678. head.insertBefore(script, head.firstChild);
  40679. };
  40680. /* harmony default export */ var jsonp_auth = (jsonp);
  40681. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  40682. var ScriptRequest = (function () {
  40683. function ScriptRequest(src) {
  40684. this.src = src;
  40685. }
  40686. ScriptRequest.prototype.send = function (receiver) {
  40687. var self = this;
  40688. var errorString = "Error loading " + self.src;
  40689. self.script = document.createElement("script");
  40690. self.script.id = receiver.id;
  40691. self.script.src = self.src;
  40692. self.script.type = "text/javascript";
  40693. self.script.charset = "UTF-8";
  40694. if (self.script.addEventListener) {
  40695. self.script.onerror = function () {
  40696. receiver.callback(errorString);
  40697. };
  40698. self.script.onload = function () {
  40699. receiver.callback(null);
  40700. };
  40701. }
  40702. else {
  40703. self.script.onreadystatechange = function () {
  40704. if (self.script.readyState === 'loaded' ||
  40705. self.script.readyState === 'complete') {
  40706. receiver.callback(null);
  40707. }
  40708. };
  40709. }
  40710. if (self.script.async === undefined && document.attachEvent &&
  40711. /opera/i.test(navigator.userAgent)) {
  40712. self.errorScript = document.createElement("script");
  40713. self.errorScript.id = receiver.id + "_error";
  40714. self.errorScript.text = receiver.name + "('" + errorString + "');";
  40715. self.script.async = self.errorScript.async = false;
  40716. }
  40717. else {
  40718. self.script.async = true;
  40719. }
  40720. var head = document.getElementsByTagName('head')[0];
  40721. head.insertBefore(self.script, head.firstChild);
  40722. if (self.errorScript) {
  40723. head.insertBefore(self.errorScript, self.script.nextSibling);
  40724. }
  40725. };
  40726. ScriptRequest.prototype.cleanup = function () {
  40727. if (this.script) {
  40728. this.script.onload = this.script.onerror = null;
  40729. this.script.onreadystatechange = null;
  40730. }
  40731. if (this.script && this.script.parentNode) {
  40732. this.script.parentNode.removeChild(this.script);
  40733. }
  40734. if (this.errorScript && this.errorScript.parentNode) {
  40735. this.errorScript.parentNode.removeChild(this.errorScript);
  40736. }
  40737. this.script = null;
  40738. this.errorScript = null;
  40739. };
  40740. return ScriptRequest;
  40741. }());
  40742. /* harmony default export */ var script_request = (ScriptRequest);
  40743. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  40744. var jsonp_request_JSONPRequest = (function () {
  40745. function JSONPRequest(url, data) {
  40746. this.url = url;
  40747. this.data = data;
  40748. }
  40749. JSONPRequest.prototype.send = function (receiver) {
  40750. if (this.request) {
  40751. return;
  40752. }
  40753. var query = buildQueryString(this.data);
  40754. var url = this.url + "/" + receiver.number + "?" + query;
  40755. this.request = runtime.createScriptRequest(url);
  40756. this.request.send(receiver);
  40757. };
  40758. JSONPRequest.prototype.cleanup = function () {
  40759. if (this.request) {
  40760. this.request.cleanup();
  40761. }
  40762. };
  40763. return JSONPRequest;
  40764. }());
  40765. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  40766. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  40767. var getAgent = function (sender, useTLS) {
  40768. return function (data, callback) {
  40769. var scheme = "http" + (useTLS ? "s" : "") + "://";
  40770. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  40771. var request = runtime.createJSONPRequest(url, data);
  40772. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  40773. ScriptReceivers.remove(receiver);
  40774. request.cleanup();
  40775. if (result && result.host) {
  40776. sender.host = result.host;
  40777. }
  40778. if (callback) {
  40779. callback(error, result);
  40780. }
  40781. });
  40782. request.send(receiver);
  40783. };
  40784. };
  40785. var jsonp_timeline_jsonp = {
  40786. name: 'jsonp',
  40787. getAgent: getAgent
  40788. };
  40789. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  40790. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  40791. function getGenericURL(baseScheme, params, path) {
  40792. var scheme = baseScheme + (params.useTLS ? "s" : "");
  40793. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  40794. return scheme + "://" + host + path;
  40795. }
  40796. function getGenericPath(key, queryString) {
  40797. var path = "/app/" + key;
  40798. var query = "?protocol=" + defaults.PROTOCOL +
  40799. "&client=js" +
  40800. "&version=" + defaults.VERSION +
  40801. (queryString ? ("&" + queryString) : "");
  40802. return path + query;
  40803. }
  40804. var ws = {
  40805. getInitial: function (key, params) {
  40806. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  40807. return getGenericURL("ws", params, path);
  40808. }
  40809. };
  40810. var http = {
  40811. getInitial: function (key, params) {
  40812. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  40813. return getGenericURL("http", params, path);
  40814. }
  40815. };
  40816. var sockjs = {
  40817. getInitial: function (key, params) {
  40818. return getGenericURL("http", params, params.httpPath || "/pusher");
  40819. },
  40820. getPath: function (key, params) {
  40821. return getGenericPath(key);
  40822. }
  40823. };
  40824. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  40825. var callback_registry_CallbackRegistry = (function () {
  40826. function CallbackRegistry() {
  40827. this._callbacks = {};
  40828. }
  40829. CallbackRegistry.prototype.get = function (name) {
  40830. return this._callbacks[prefix(name)];
  40831. };
  40832. CallbackRegistry.prototype.add = function (name, callback, context) {
  40833. var prefixedEventName = prefix(name);
  40834. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  40835. this._callbacks[prefixedEventName].push({
  40836. fn: callback,
  40837. context: context
  40838. });
  40839. };
  40840. CallbackRegistry.prototype.remove = function (name, callback, context) {
  40841. if (!name && !callback && !context) {
  40842. this._callbacks = {};
  40843. return;
  40844. }
  40845. var names = name ? [prefix(name)] : keys(this._callbacks);
  40846. if (callback || context) {
  40847. this.removeCallback(names, callback, context);
  40848. }
  40849. else {
  40850. this.removeAllCallbacks(names);
  40851. }
  40852. };
  40853. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  40854. apply(names, function (name) {
  40855. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  40856. return (callback && callback !== binding.fn) ||
  40857. (context && context !== binding.context);
  40858. });
  40859. if (this._callbacks[name].length === 0) {
  40860. delete this._callbacks[name];
  40861. }
  40862. }, this);
  40863. };
  40864. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  40865. apply(names, function (name) {
  40866. delete this._callbacks[name];
  40867. }, this);
  40868. };
  40869. return CallbackRegistry;
  40870. }());
  40871. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  40872. function prefix(name) {
  40873. return "_" + name;
  40874. }
  40875. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  40876. var dispatcher_Dispatcher = (function () {
  40877. function Dispatcher(failThrough) {
  40878. this.callbacks = new callback_registry();
  40879. this.global_callbacks = [];
  40880. this.failThrough = failThrough;
  40881. }
  40882. Dispatcher.prototype.bind = function (eventName, callback, context) {
  40883. this.callbacks.add(eventName, callback, context);
  40884. return this;
  40885. };
  40886. Dispatcher.prototype.bind_global = function (callback) {
  40887. this.global_callbacks.push(callback);
  40888. return this;
  40889. };
  40890. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  40891. this.callbacks.remove(eventName, callback, context);
  40892. return this;
  40893. };
  40894. Dispatcher.prototype.unbind_global = function (callback) {
  40895. if (!callback) {
  40896. this.global_callbacks = [];
  40897. return this;
  40898. }
  40899. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  40900. return this;
  40901. };
  40902. Dispatcher.prototype.unbind_all = function () {
  40903. this.unbind();
  40904. this.unbind_global();
  40905. return this;
  40906. };
  40907. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  40908. for (var i = 0; i < this.global_callbacks.length; i++) {
  40909. this.global_callbacks[i](eventName, data);
  40910. }
  40911. var callbacks = this.callbacks.get(eventName);
  40912. var args = [];
  40913. if (metadata) {
  40914. args.push(data, metadata);
  40915. }
  40916. else if (data) {
  40917. args.push(data);
  40918. }
  40919. if (callbacks && callbacks.length > 0) {
  40920. for (var i = 0; i < callbacks.length; i++) {
  40921. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40922. }
  40923. }
  40924. else if (this.failThrough) {
  40925. this.failThrough(eventName, data);
  40926. }
  40927. return this;
  40928. };
  40929. return Dispatcher;
  40930. }());
  40931. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40932. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40933. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40934. var extendStatics = function (d, b) {
  40935. extendStatics = Object.setPrototypeOf ||
  40936. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40937. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40938. return extendStatics(d, b);
  40939. };
  40940. return function (d, b) {
  40941. extendStatics(d, b);
  40942. function __() { this.constructor = d; }
  40943. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40944. };
  40945. })();
  40946. var transport_connection_TransportConnection = (function (_super) {
  40947. transport_connection_extends(TransportConnection, _super);
  40948. function TransportConnection(hooks, name, priority, key, options) {
  40949. var _this = _super.call(this) || this;
  40950. _this.initialize = runtime.transportConnectionInitializer;
  40951. _this.hooks = hooks;
  40952. _this.name = name;
  40953. _this.priority = priority;
  40954. _this.key = key;
  40955. _this.options = options;
  40956. _this.state = "new";
  40957. _this.timeline = options.timeline;
  40958. _this.activityTimeout = options.activityTimeout;
  40959. _this.id = _this.timeline.generateUniqueID();
  40960. return _this;
  40961. }
  40962. TransportConnection.prototype.handlesActivityChecks = function () {
  40963. return Boolean(this.hooks.handlesActivityChecks);
  40964. };
  40965. TransportConnection.prototype.supportsPing = function () {
  40966. return Boolean(this.hooks.supportsPing);
  40967. };
  40968. TransportConnection.prototype.connect = function () {
  40969. var _this = this;
  40970. if (this.socket || this.state !== "initialized") {
  40971. return false;
  40972. }
  40973. var url = this.hooks.urls.getInitial(this.key, this.options);
  40974. try {
  40975. this.socket = this.hooks.getSocket(url, this.options);
  40976. }
  40977. catch (e) {
  40978. util.defer(function () {
  40979. _this.onError(e);
  40980. _this.changeState("closed");
  40981. });
  40982. return false;
  40983. }
  40984. this.bindListeners();
  40985. logger.debug("Connecting", { transport: this.name, url: url });
  40986. this.changeState("connecting");
  40987. return true;
  40988. };
  40989. TransportConnection.prototype.close = function () {
  40990. if (this.socket) {
  40991. this.socket.close();
  40992. return true;
  40993. }
  40994. else {
  40995. return false;
  40996. }
  40997. };
  40998. TransportConnection.prototype.send = function (data) {
  40999. var _this = this;
  41000. if (this.state === "open") {
  41001. util.defer(function () {
  41002. if (_this.socket) {
  41003. _this.socket.send(data);
  41004. }
  41005. });
  41006. return true;
  41007. }
  41008. else {
  41009. return false;
  41010. }
  41011. };
  41012. TransportConnection.prototype.ping = function () {
  41013. if (this.state === "open" && this.supportsPing()) {
  41014. this.socket.ping();
  41015. }
  41016. };
  41017. TransportConnection.prototype.onOpen = function () {
  41018. if (this.hooks.beforeOpen) {
  41019. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  41020. }
  41021. this.changeState("open");
  41022. this.socket.onopen = undefined;
  41023. };
  41024. TransportConnection.prototype.onError = function (error) {
  41025. this.emit("error", { type: 'WebSocketError', error: error });
  41026. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  41027. };
  41028. TransportConnection.prototype.onClose = function (closeEvent) {
  41029. if (closeEvent) {
  41030. this.changeState("closed", {
  41031. code: closeEvent.code,
  41032. reason: closeEvent.reason,
  41033. wasClean: closeEvent.wasClean
  41034. });
  41035. }
  41036. else {
  41037. this.changeState("closed");
  41038. }
  41039. this.unbindListeners();
  41040. this.socket = undefined;
  41041. };
  41042. TransportConnection.prototype.onMessage = function (message) {
  41043. this.emit("message", message);
  41044. };
  41045. TransportConnection.prototype.onActivity = function () {
  41046. this.emit("activity");
  41047. };
  41048. TransportConnection.prototype.bindListeners = function () {
  41049. var _this = this;
  41050. this.socket.onopen = function () {
  41051. _this.onOpen();
  41052. };
  41053. this.socket.onerror = function (error) {
  41054. _this.onError(error);
  41055. };
  41056. this.socket.onclose = function (closeEvent) {
  41057. _this.onClose(closeEvent);
  41058. };
  41059. this.socket.onmessage = function (message) {
  41060. _this.onMessage(message);
  41061. };
  41062. if (this.supportsPing()) {
  41063. this.socket.onactivity = function () { _this.onActivity(); };
  41064. }
  41065. };
  41066. TransportConnection.prototype.unbindListeners = function () {
  41067. if (this.socket) {
  41068. this.socket.onopen = undefined;
  41069. this.socket.onerror = undefined;
  41070. this.socket.onclose = undefined;
  41071. this.socket.onmessage = undefined;
  41072. if (this.supportsPing()) {
  41073. this.socket.onactivity = undefined;
  41074. }
  41075. }
  41076. };
  41077. TransportConnection.prototype.changeState = function (state, params) {
  41078. this.state = state;
  41079. this.timeline.info(this.buildTimelineMessage({
  41080. state: state,
  41081. params: params
  41082. }));
  41083. this.emit(state, params);
  41084. };
  41085. TransportConnection.prototype.buildTimelineMessage = function (message) {
  41086. return extend({ cid: this.id }, message);
  41087. };
  41088. return TransportConnection;
  41089. }(dispatcher));
  41090. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  41091. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  41092. var transport_Transport = (function () {
  41093. function Transport(hooks) {
  41094. this.hooks = hooks;
  41095. }
  41096. Transport.prototype.isSupported = function (environment) {
  41097. return this.hooks.isSupported(environment);
  41098. };
  41099. Transport.prototype.createConnection = function (name, priority, key, options) {
  41100. return new transport_connection(this.hooks, name, priority, key, options);
  41101. };
  41102. return Transport;
  41103. }());
  41104. /* harmony default export */ var transports_transport = (transport_Transport);
  41105. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  41106. var WSTransport = new transports_transport({
  41107. urls: ws,
  41108. handlesActivityChecks: false,
  41109. supportsPing: false,
  41110. isInitialized: function () {
  41111. return Boolean(runtime.getWebSocketAPI());
  41112. },
  41113. isSupported: function () {
  41114. return Boolean(runtime.getWebSocketAPI());
  41115. },
  41116. getSocket: function (url) {
  41117. return runtime.createWebSocket(url);
  41118. }
  41119. });
  41120. var httpConfiguration = {
  41121. urls: http,
  41122. handlesActivityChecks: false,
  41123. supportsPing: true,
  41124. isInitialized: function () {
  41125. return true;
  41126. }
  41127. };
  41128. var streamingConfiguration = extend({ getSocket: function (url) {
  41129. return runtime.HTTPFactory.createStreamingSocket(url);
  41130. }
  41131. }, httpConfiguration);
  41132. var pollingConfiguration = extend({ getSocket: function (url) {
  41133. return runtime.HTTPFactory.createPollingSocket(url);
  41134. }
  41135. }, httpConfiguration);
  41136. var xhrConfiguration = {
  41137. isSupported: function () {
  41138. return runtime.isXHRSupported();
  41139. }
  41140. };
  41141. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  41142. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  41143. var Transports = {
  41144. ws: WSTransport,
  41145. xhr_streaming: XHRStreamingTransport,
  41146. xhr_polling: XHRPollingTransport
  41147. };
  41148. /* harmony default export */ var transports = (Transports);
  41149. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  41150. var SockJSTransport = new transports_transport({
  41151. file: "sockjs",
  41152. urls: sockjs,
  41153. handlesActivityChecks: true,
  41154. supportsPing: false,
  41155. isSupported: function () {
  41156. return true;
  41157. },
  41158. isInitialized: function () {
  41159. return window.SockJS !== undefined;
  41160. },
  41161. getSocket: function (url, options) {
  41162. return new window.SockJS(url, null, {
  41163. js_path: Dependencies.getPath("sockjs", {
  41164. useTLS: options.useTLS
  41165. }),
  41166. ignore_null_origin: options.ignoreNullOrigin
  41167. });
  41168. },
  41169. beforeOpen: function (socket, path) {
  41170. socket.send(JSON.stringify({
  41171. path: path
  41172. }));
  41173. }
  41174. });
  41175. var xdrConfiguration = {
  41176. isSupported: function (environment) {
  41177. var yes = runtime.isXDRSupported(environment.useTLS);
  41178. return yes;
  41179. }
  41180. };
  41181. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  41182. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  41183. transports.xdr_streaming = XDRStreamingTransport;
  41184. transports.xdr_polling = XDRPollingTransport;
  41185. transports.sockjs = SockJSTransport;
  41186. /* harmony default export */ var transports_transports = (transports);
  41187. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  41188. var net_info_extends = (undefined && undefined.__extends) || (function () {
  41189. var extendStatics = function (d, b) {
  41190. extendStatics = Object.setPrototypeOf ||
  41191. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41192. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41193. return extendStatics(d, b);
  41194. };
  41195. return function (d, b) {
  41196. extendStatics(d, b);
  41197. function __() { this.constructor = d; }
  41198. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41199. };
  41200. })();
  41201. var NetInfo = (function (_super) {
  41202. net_info_extends(NetInfo, _super);
  41203. function NetInfo() {
  41204. var _this = _super.call(this) || this;
  41205. var self = _this;
  41206. if (window.addEventListener !== undefined) {
  41207. window.addEventListener("online", function () {
  41208. self.emit('online');
  41209. }, false);
  41210. window.addEventListener("offline", function () {
  41211. self.emit('offline');
  41212. }, false);
  41213. }
  41214. return _this;
  41215. }
  41216. NetInfo.prototype.isOnline = function () {
  41217. if (window.navigator.onLine === undefined) {
  41218. return true;
  41219. }
  41220. else {
  41221. return window.navigator.onLine;
  41222. }
  41223. };
  41224. return NetInfo;
  41225. }(dispatcher));
  41226. var net_info_Network = new NetInfo();
  41227. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  41228. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  41229. function AssistantToTheTransportManager(manager, transport, options) {
  41230. this.manager = manager;
  41231. this.transport = transport;
  41232. this.minPingDelay = options.minPingDelay;
  41233. this.maxPingDelay = options.maxPingDelay;
  41234. this.pingDelay = undefined;
  41235. }
  41236. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  41237. var _this = this;
  41238. options = extend({}, options, {
  41239. activityTimeout: this.pingDelay
  41240. });
  41241. var connection = this.transport.createConnection(name, priority, key, options);
  41242. var openTimestamp = null;
  41243. var onOpen = function () {
  41244. connection.unbind("open", onOpen);
  41245. connection.bind("closed", onClosed);
  41246. openTimestamp = util.now();
  41247. };
  41248. var onClosed = function (closeEvent) {
  41249. connection.unbind("closed", onClosed);
  41250. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  41251. _this.manager.reportDeath();
  41252. }
  41253. else if (!closeEvent.wasClean && openTimestamp) {
  41254. var lifespan = util.now() - openTimestamp;
  41255. if (lifespan < 2 * _this.maxPingDelay) {
  41256. _this.manager.reportDeath();
  41257. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  41258. }
  41259. }
  41260. };
  41261. connection.bind("open", onOpen);
  41262. return connection;
  41263. };
  41264. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  41265. return this.manager.isAlive() && this.transport.isSupported(environment);
  41266. };
  41267. return AssistantToTheTransportManager;
  41268. }());
  41269. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  41270. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  41271. var Protocol = {
  41272. decodeMessage: function (messageEvent) {
  41273. try {
  41274. var messageData = JSON.parse(messageEvent.data);
  41275. var pusherEventData = messageData.data;
  41276. if (typeof pusherEventData === 'string') {
  41277. try {
  41278. pusherEventData = JSON.parse(messageData.data);
  41279. }
  41280. catch (e) { }
  41281. }
  41282. var pusherEvent = {
  41283. event: messageData.event,
  41284. channel: messageData.channel,
  41285. data: pusherEventData,
  41286. };
  41287. if (messageData.user_id) {
  41288. pusherEvent.user_id = messageData.user_id;
  41289. }
  41290. return pusherEvent;
  41291. }
  41292. catch (e) {
  41293. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  41294. }
  41295. },
  41296. encodeMessage: function (event) {
  41297. return JSON.stringify(event);
  41298. },
  41299. processHandshake: function (messageEvent) {
  41300. var message = Protocol.decodeMessage(messageEvent);
  41301. if (message.event === "pusher:connection_established") {
  41302. if (!message.data.activity_timeout) {
  41303. throw "No activity timeout specified in handshake";
  41304. }
  41305. return {
  41306. action: "connected",
  41307. id: message.data.socket_id,
  41308. activityTimeout: message.data.activity_timeout * 1000
  41309. };
  41310. }
  41311. else if (message.event === "pusher:error") {
  41312. return {
  41313. action: this.getCloseAction(message.data),
  41314. error: this.getCloseError(message.data)
  41315. };
  41316. }
  41317. else {
  41318. throw "Invalid handshake";
  41319. }
  41320. },
  41321. getCloseAction: function (closeEvent) {
  41322. if (closeEvent.code < 4000) {
  41323. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  41324. return "backoff";
  41325. }
  41326. else {
  41327. return null;
  41328. }
  41329. }
  41330. else if (closeEvent.code === 4000) {
  41331. return "tls_only";
  41332. }
  41333. else if (closeEvent.code < 4100) {
  41334. return "refused";
  41335. }
  41336. else if (closeEvent.code < 4200) {
  41337. return "backoff";
  41338. }
  41339. else if (closeEvent.code < 4300) {
  41340. return "retry";
  41341. }
  41342. else {
  41343. return "refused";
  41344. }
  41345. },
  41346. getCloseError: function (closeEvent) {
  41347. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  41348. return {
  41349. type: 'PusherError',
  41350. data: {
  41351. code: closeEvent.code,
  41352. message: closeEvent.reason || closeEvent.message
  41353. }
  41354. };
  41355. }
  41356. else {
  41357. return null;
  41358. }
  41359. }
  41360. };
  41361. /* harmony default export */ var protocol_protocol = (Protocol);
  41362. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  41363. var connection_extends = (undefined && undefined.__extends) || (function () {
  41364. var extendStatics = function (d, b) {
  41365. extendStatics = Object.setPrototypeOf ||
  41366. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41367. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41368. return extendStatics(d, b);
  41369. };
  41370. return function (d, b) {
  41371. extendStatics(d, b);
  41372. function __() { this.constructor = d; }
  41373. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41374. };
  41375. })();
  41376. var connection_Connection = (function (_super) {
  41377. connection_extends(Connection, _super);
  41378. function Connection(id, transport) {
  41379. var _this = _super.call(this) || this;
  41380. _this.id = id;
  41381. _this.transport = transport;
  41382. _this.activityTimeout = transport.activityTimeout;
  41383. _this.bindListeners();
  41384. return _this;
  41385. }
  41386. Connection.prototype.handlesActivityChecks = function () {
  41387. return this.transport.handlesActivityChecks();
  41388. };
  41389. Connection.prototype.send = function (data) {
  41390. return this.transport.send(data);
  41391. };
  41392. Connection.prototype.send_event = function (name, data, channel) {
  41393. var event = { event: name, data: data };
  41394. if (channel) {
  41395. event.channel = channel;
  41396. }
  41397. logger.debug('Event sent', event);
  41398. return this.send(protocol_protocol.encodeMessage(event));
  41399. };
  41400. Connection.prototype.ping = function () {
  41401. if (this.transport.supportsPing()) {
  41402. this.transport.ping();
  41403. }
  41404. else {
  41405. this.send_event('pusher:ping', {});
  41406. }
  41407. };
  41408. Connection.prototype.close = function () {
  41409. this.transport.close();
  41410. };
  41411. Connection.prototype.bindListeners = function () {
  41412. var _this = this;
  41413. var listeners = {
  41414. message: function (messageEvent) {
  41415. var pusherEvent;
  41416. try {
  41417. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  41418. }
  41419. catch (e) {
  41420. _this.emit('error', {
  41421. type: 'MessageParseError',
  41422. error: e,
  41423. data: messageEvent.data
  41424. });
  41425. }
  41426. if (pusherEvent !== undefined) {
  41427. logger.debug('Event recd', pusherEvent);
  41428. switch (pusherEvent.event) {
  41429. case 'pusher:error':
  41430. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  41431. break;
  41432. case 'pusher:ping':
  41433. _this.emit("ping");
  41434. break;
  41435. case 'pusher:pong':
  41436. _this.emit("pong");
  41437. break;
  41438. }
  41439. _this.emit('message', pusherEvent);
  41440. }
  41441. },
  41442. activity: function () {
  41443. _this.emit("activity");
  41444. },
  41445. error: function (error) {
  41446. _this.emit("error", { type: "WebSocketError", error: error });
  41447. },
  41448. closed: function (closeEvent) {
  41449. unbindListeners();
  41450. if (closeEvent && closeEvent.code) {
  41451. _this.handleCloseEvent(closeEvent);
  41452. }
  41453. _this.transport = null;
  41454. _this.emit("closed");
  41455. }
  41456. };
  41457. var unbindListeners = function () {
  41458. objectApply(listeners, function (listener, event) {
  41459. _this.transport.unbind(event, listener);
  41460. });
  41461. };
  41462. objectApply(listeners, function (listener, event) {
  41463. _this.transport.bind(event, listener);
  41464. });
  41465. };
  41466. Connection.prototype.handleCloseEvent = function (closeEvent) {
  41467. var action = protocol_protocol.getCloseAction(closeEvent);
  41468. var error = protocol_protocol.getCloseError(closeEvent);
  41469. if (error) {
  41470. this.emit('error', error);
  41471. }
  41472. if (action) {
  41473. this.emit(action, { action: action, error: error });
  41474. }
  41475. };
  41476. return Connection;
  41477. }(dispatcher));
  41478. /* harmony default export */ var connection_connection = (connection_Connection);
  41479. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  41480. var handshake_Handshake = (function () {
  41481. function Handshake(transport, callback) {
  41482. this.transport = transport;
  41483. this.callback = callback;
  41484. this.bindListeners();
  41485. }
  41486. Handshake.prototype.close = function () {
  41487. this.unbindListeners();
  41488. this.transport.close();
  41489. };
  41490. Handshake.prototype.bindListeners = function () {
  41491. var _this = this;
  41492. this.onMessage = function (m) {
  41493. _this.unbindListeners();
  41494. var result;
  41495. try {
  41496. result = protocol_protocol.processHandshake(m);
  41497. }
  41498. catch (e) {
  41499. _this.finish("error", { error: e });
  41500. _this.transport.close();
  41501. return;
  41502. }
  41503. if (result.action === "connected") {
  41504. _this.finish("connected", {
  41505. connection: new connection_connection(result.id, _this.transport),
  41506. activityTimeout: result.activityTimeout
  41507. });
  41508. }
  41509. else {
  41510. _this.finish(result.action, { error: result.error });
  41511. _this.transport.close();
  41512. }
  41513. };
  41514. this.onClosed = function (closeEvent) {
  41515. _this.unbindListeners();
  41516. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  41517. var error = protocol_protocol.getCloseError(closeEvent);
  41518. _this.finish(action, { error: error });
  41519. };
  41520. this.transport.bind("message", this.onMessage);
  41521. this.transport.bind("closed", this.onClosed);
  41522. };
  41523. Handshake.prototype.unbindListeners = function () {
  41524. this.transport.unbind("message", this.onMessage);
  41525. this.transport.unbind("closed", this.onClosed);
  41526. };
  41527. Handshake.prototype.finish = function (action, params) {
  41528. this.callback(extend({ transport: this.transport, action: action }, params));
  41529. };
  41530. return Handshake;
  41531. }());
  41532. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  41533. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  41534. var pusher_authorizer_PusherAuthorizer = (function () {
  41535. function PusherAuthorizer(channel, options) {
  41536. this.channel = channel;
  41537. var authTransport = options.authTransport;
  41538. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  41539. throw "'" + authTransport + "' is not a recognized auth transport";
  41540. }
  41541. this.type = authTransport;
  41542. this.options = options;
  41543. this.authOptions = (options || {}).auth || {};
  41544. }
  41545. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  41546. var query = 'socket_id=' + encodeURIComponent(socketId) +
  41547. '&channel_name=' + encodeURIComponent(this.channel.name);
  41548. for (var i in this.authOptions.params) {
  41549. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  41550. }
  41551. return query;
  41552. };
  41553. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  41554. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  41555. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  41556. };
  41557. return PusherAuthorizer;
  41558. }());
  41559. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  41560. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  41561. var timeline_sender_TimelineSender = (function () {
  41562. function TimelineSender(timeline, options) {
  41563. this.timeline = timeline;
  41564. this.options = options || {};
  41565. }
  41566. TimelineSender.prototype.send = function (useTLS, callback) {
  41567. if (this.timeline.isEmpty()) {
  41568. return;
  41569. }
  41570. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  41571. };
  41572. return TimelineSender;
  41573. }());
  41574. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  41575. // CONCATENATED MODULE: ./src/core/errors.ts
  41576. var errors_extends = (undefined && undefined.__extends) || (function () {
  41577. var extendStatics = function (d, b) {
  41578. extendStatics = Object.setPrototypeOf ||
  41579. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41580. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41581. return extendStatics(d, b);
  41582. };
  41583. return function (d, b) {
  41584. extendStatics(d, b);
  41585. function __() { this.constructor = d; }
  41586. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41587. };
  41588. })();
  41589. var BadEventName = (function (_super) {
  41590. errors_extends(BadEventName, _super);
  41591. function BadEventName(msg) {
  41592. var _newTarget = this.constructor;
  41593. var _this = _super.call(this, msg) || this;
  41594. Object.setPrototypeOf(_this, _newTarget.prototype);
  41595. return _this;
  41596. }
  41597. return BadEventName;
  41598. }(Error));
  41599. var RequestTimedOut = (function (_super) {
  41600. errors_extends(RequestTimedOut, _super);
  41601. function RequestTimedOut(msg) {
  41602. var _newTarget = this.constructor;
  41603. var _this = _super.call(this, msg) || this;
  41604. Object.setPrototypeOf(_this, _newTarget.prototype);
  41605. return _this;
  41606. }
  41607. return RequestTimedOut;
  41608. }(Error));
  41609. var TransportPriorityTooLow = (function (_super) {
  41610. errors_extends(TransportPriorityTooLow, _super);
  41611. function TransportPriorityTooLow(msg) {
  41612. var _newTarget = this.constructor;
  41613. var _this = _super.call(this, msg) || this;
  41614. Object.setPrototypeOf(_this, _newTarget.prototype);
  41615. return _this;
  41616. }
  41617. return TransportPriorityTooLow;
  41618. }(Error));
  41619. var TransportClosed = (function (_super) {
  41620. errors_extends(TransportClosed, _super);
  41621. function TransportClosed(msg) {
  41622. var _newTarget = this.constructor;
  41623. var _this = _super.call(this, msg) || this;
  41624. Object.setPrototypeOf(_this, _newTarget.prototype);
  41625. return _this;
  41626. }
  41627. return TransportClosed;
  41628. }(Error));
  41629. var UnsupportedFeature = (function (_super) {
  41630. errors_extends(UnsupportedFeature, _super);
  41631. function UnsupportedFeature(msg) {
  41632. var _newTarget = this.constructor;
  41633. var _this = _super.call(this, msg) || this;
  41634. Object.setPrototypeOf(_this, _newTarget.prototype);
  41635. return _this;
  41636. }
  41637. return UnsupportedFeature;
  41638. }(Error));
  41639. var UnsupportedTransport = (function (_super) {
  41640. errors_extends(UnsupportedTransport, _super);
  41641. function UnsupportedTransport(msg) {
  41642. var _newTarget = this.constructor;
  41643. var _this = _super.call(this, msg) || this;
  41644. Object.setPrototypeOf(_this, _newTarget.prototype);
  41645. return _this;
  41646. }
  41647. return UnsupportedTransport;
  41648. }(Error));
  41649. var UnsupportedStrategy = (function (_super) {
  41650. errors_extends(UnsupportedStrategy, _super);
  41651. function UnsupportedStrategy(msg) {
  41652. var _newTarget = this.constructor;
  41653. var _this = _super.call(this, msg) || this;
  41654. Object.setPrototypeOf(_this, _newTarget.prototype);
  41655. return _this;
  41656. }
  41657. return UnsupportedStrategy;
  41658. }(Error));
  41659. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  41660. var channel_extends = (undefined && undefined.__extends) || (function () {
  41661. var extendStatics = function (d, b) {
  41662. extendStatics = Object.setPrototypeOf ||
  41663. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41664. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41665. return extendStatics(d, b);
  41666. };
  41667. return function (d, b) {
  41668. extendStatics(d, b);
  41669. function __() { this.constructor = d; }
  41670. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41671. };
  41672. })();
  41673. var channel_Channel = (function (_super) {
  41674. channel_extends(Channel, _super);
  41675. function Channel(name, pusher) {
  41676. var _this = _super.call(this, function (event, data) {
  41677. logger.debug('No callbacks on ' + name + ' for ' + event);
  41678. }) || this;
  41679. _this.name = name;
  41680. _this.pusher = pusher;
  41681. _this.subscribed = false;
  41682. _this.subscriptionPending = false;
  41683. _this.subscriptionCancelled = false;
  41684. return _this;
  41685. }
  41686. Channel.prototype.authorize = function (socketId, callback) {
  41687. return callback(false, {});
  41688. };
  41689. Channel.prototype.trigger = function (event, data) {
  41690. if (event.indexOf("client-") !== 0) {
  41691. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  41692. }
  41693. if (!this.subscribed) {
  41694. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  41695. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  41696. }
  41697. return this.pusher.send_event(event, data, this.name);
  41698. };
  41699. Channel.prototype.disconnect = function () {
  41700. this.subscribed = false;
  41701. this.subscriptionPending = false;
  41702. };
  41703. Channel.prototype.handleEvent = function (event) {
  41704. var eventName = event.event;
  41705. var data = event.data;
  41706. if (eventName === "pusher_internal:subscription_succeeded") {
  41707. this.handleSubscriptionSucceededEvent(event);
  41708. }
  41709. else if (eventName.indexOf("pusher_internal:") !== 0) {
  41710. var metadata = {};
  41711. this.emit(eventName, data, metadata);
  41712. }
  41713. };
  41714. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41715. this.subscriptionPending = false;
  41716. this.subscribed = true;
  41717. if (this.subscriptionCancelled) {
  41718. this.pusher.unsubscribe(this.name);
  41719. }
  41720. else {
  41721. this.emit("pusher:subscription_succeeded", event.data);
  41722. }
  41723. };
  41724. Channel.prototype.subscribe = function () {
  41725. var _this = this;
  41726. if (this.subscribed) {
  41727. return;
  41728. }
  41729. this.subscriptionPending = true;
  41730. this.subscriptionCancelled = false;
  41731. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  41732. if (error) {
  41733. logger.error(data);
  41734. _this.emit('pusher:subscription_error', data);
  41735. }
  41736. else {
  41737. _this.pusher.send_event('pusher:subscribe', {
  41738. auth: data.auth,
  41739. channel_data: data.channel_data,
  41740. channel: _this.name
  41741. });
  41742. }
  41743. });
  41744. };
  41745. Channel.prototype.unsubscribe = function () {
  41746. this.subscribed = false;
  41747. this.pusher.send_event('pusher:unsubscribe', {
  41748. channel: this.name
  41749. });
  41750. };
  41751. Channel.prototype.cancelSubscription = function () {
  41752. this.subscriptionCancelled = true;
  41753. };
  41754. Channel.prototype.reinstateSubscription = function () {
  41755. this.subscriptionCancelled = false;
  41756. };
  41757. return Channel;
  41758. }(dispatcher));
  41759. /* harmony default export */ var channels_channel = (channel_Channel);
  41760. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  41761. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  41762. var extendStatics = function (d, b) {
  41763. extendStatics = Object.setPrototypeOf ||
  41764. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41765. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41766. return extendStatics(d, b);
  41767. };
  41768. return function (d, b) {
  41769. extendStatics(d, b);
  41770. function __() { this.constructor = d; }
  41771. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41772. };
  41773. })();
  41774. var private_channel_PrivateChannel = (function (_super) {
  41775. private_channel_extends(PrivateChannel, _super);
  41776. function PrivateChannel() {
  41777. return _super !== null && _super.apply(this, arguments) || this;
  41778. }
  41779. PrivateChannel.prototype.authorize = function (socketId, callback) {
  41780. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  41781. return authorizer.authorize(socketId, callback);
  41782. };
  41783. return PrivateChannel;
  41784. }(channels_channel));
  41785. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  41786. // CONCATENATED MODULE: ./src/core/channels/members.ts
  41787. var members_Members = (function () {
  41788. function Members() {
  41789. this.reset();
  41790. }
  41791. Members.prototype.get = function (id) {
  41792. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  41793. return {
  41794. id: id,
  41795. info: this.members[id]
  41796. };
  41797. }
  41798. else {
  41799. return null;
  41800. }
  41801. };
  41802. Members.prototype.each = function (callback) {
  41803. var _this = this;
  41804. objectApply(this.members, function (member, id) {
  41805. callback(_this.get(id));
  41806. });
  41807. };
  41808. Members.prototype.setMyID = function (id) {
  41809. this.myID = id;
  41810. };
  41811. Members.prototype.onSubscription = function (subscriptionData) {
  41812. this.members = subscriptionData.presence.hash;
  41813. this.count = subscriptionData.presence.count;
  41814. this.me = this.get(this.myID);
  41815. };
  41816. Members.prototype.addMember = function (memberData) {
  41817. if (this.get(memberData.user_id) === null) {
  41818. this.count++;
  41819. }
  41820. this.members[memberData.user_id] = memberData.user_info;
  41821. return this.get(memberData.user_id);
  41822. };
  41823. Members.prototype.removeMember = function (memberData) {
  41824. var member = this.get(memberData.user_id);
  41825. if (member) {
  41826. delete this.members[memberData.user_id];
  41827. this.count--;
  41828. }
  41829. return member;
  41830. };
  41831. Members.prototype.reset = function () {
  41832. this.members = {};
  41833. this.count = 0;
  41834. this.myID = null;
  41835. this.me = null;
  41836. };
  41837. return Members;
  41838. }());
  41839. /* harmony default export */ var members = (members_Members);
  41840. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  41841. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  41842. var extendStatics = function (d, b) {
  41843. extendStatics = Object.setPrototypeOf ||
  41844. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41845. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41846. return extendStatics(d, b);
  41847. };
  41848. return function (d, b) {
  41849. extendStatics(d, b);
  41850. function __() { this.constructor = d; }
  41851. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41852. };
  41853. })();
  41854. var presence_channel_PresenceChannel = (function (_super) {
  41855. presence_channel_extends(PresenceChannel, _super);
  41856. function PresenceChannel(name, pusher) {
  41857. var _this = _super.call(this, name, pusher) || this;
  41858. _this.members = new members();
  41859. return _this;
  41860. }
  41861. PresenceChannel.prototype.authorize = function (socketId, callback) {
  41862. var _this = this;
  41863. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41864. if (!error) {
  41865. if (authData.channel_data === undefined) {
  41866. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  41867. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  41868. ("expected 'channel_data' field. " + suffix));
  41869. callback("Invalid auth response");
  41870. return;
  41871. }
  41872. var channelData = JSON.parse(authData.channel_data);
  41873. _this.members.setMyID(channelData.user_id);
  41874. }
  41875. callback(error, authData);
  41876. });
  41877. };
  41878. PresenceChannel.prototype.handleEvent = function (event) {
  41879. var eventName = event.event;
  41880. if (eventName.indexOf("pusher_internal:") === 0) {
  41881. this.handleInternalEvent(event);
  41882. }
  41883. else {
  41884. var data = event.data;
  41885. var metadata = {};
  41886. if (event.user_id) {
  41887. metadata.user_id = event.user_id;
  41888. }
  41889. this.emit(eventName, data, metadata);
  41890. }
  41891. };
  41892. PresenceChannel.prototype.handleInternalEvent = function (event) {
  41893. var eventName = event.event;
  41894. var data = event.data;
  41895. switch (eventName) {
  41896. case "pusher_internal:subscription_succeeded":
  41897. this.handleSubscriptionSucceededEvent(event);
  41898. break;
  41899. case "pusher_internal:member_added":
  41900. var addedMember = this.members.addMember(data);
  41901. this.emit('pusher:member_added', addedMember);
  41902. break;
  41903. case "pusher_internal:member_removed":
  41904. var removedMember = this.members.removeMember(data);
  41905. if (removedMember) {
  41906. this.emit('pusher:member_removed', removedMember);
  41907. }
  41908. break;
  41909. }
  41910. };
  41911. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41912. this.subscriptionPending = false;
  41913. this.subscribed = true;
  41914. if (this.subscriptionCancelled) {
  41915. this.pusher.unsubscribe(this.name);
  41916. }
  41917. else {
  41918. this.members.onSubscription(event.data);
  41919. this.emit("pusher:subscription_succeeded", this.members);
  41920. }
  41921. };
  41922. PresenceChannel.prototype.disconnect = function () {
  41923. this.members.reset();
  41924. _super.prototype.disconnect.call(this);
  41925. };
  41926. return PresenceChannel;
  41927. }(private_channel));
  41928. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41929. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41930. var nacl_fast = __webpack_require__(0);
  41931. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41932. var nacl_util = __webpack_require__(1);
  41933. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41934. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41935. var extendStatics = function (d, b) {
  41936. extendStatics = Object.setPrototypeOf ||
  41937. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41938. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41939. return extendStatics(d, b);
  41940. };
  41941. return function (d, b) {
  41942. extendStatics(d, b);
  41943. function __() { this.constructor = d; }
  41944. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41945. };
  41946. })();
  41947. var encrypted_channel_EncryptedChannel = (function (_super) {
  41948. encrypted_channel_extends(EncryptedChannel, _super);
  41949. function EncryptedChannel() {
  41950. var _this = _super !== null && _super.apply(this, arguments) || this;
  41951. _this.key = null;
  41952. return _this;
  41953. }
  41954. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41955. var _this = this;
  41956. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41957. if (error) {
  41958. callback(true, authData);
  41959. return;
  41960. }
  41961. var sharedSecret = authData["shared_secret"];
  41962. if (!sharedSecret) {
  41963. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41964. callback(true, errorMsg);
  41965. return;
  41966. }
  41967. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41968. delete authData["shared_secret"];
  41969. callback(false, authData);
  41970. });
  41971. };
  41972. EncryptedChannel.prototype.trigger = function (event, data) {
  41973. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41974. };
  41975. EncryptedChannel.prototype.handleEvent = function (event) {
  41976. var eventName = event.event;
  41977. var data = event.data;
  41978. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41979. _super.prototype.handleEvent.call(this, event);
  41980. return;
  41981. }
  41982. this.handleEncryptedEvent(eventName, data);
  41983. };
  41984. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41985. var _this = this;
  41986. if (!this.key) {
  41987. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41988. return;
  41989. }
  41990. if (!data.ciphertext || !data.nonce) {
  41991. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41992. return;
  41993. }
  41994. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41995. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41996. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41997. return;
  41998. }
  41999. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  42000. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  42001. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  42002. return;
  42003. }
  42004. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  42005. if (bytes === null) {
  42006. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  42007. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  42008. if (error) {
  42009. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  42010. return;
  42011. }
  42012. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  42013. if (bytes === null) {
  42014. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  42015. return;
  42016. }
  42017. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  42018. return;
  42019. });
  42020. return;
  42021. }
  42022. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  42023. };
  42024. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  42025. try {
  42026. this.emit(eventName, JSON.parse(data));
  42027. }
  42028. catch (e) {
  42029. this.emit(eventName, data);
  42030. }
  42031. return this;
  42032. };
  42033. return EncryptedChannel;
  42034. }(private_channel));
  42035. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  42036. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  42037. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  42038. var extendStatics = function (d, b) {
  42039. extendStatics = Object.setPrototypeOf ||
  42040. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  42041. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  42042. return extendStatics(d, b);
  42043. };
  42044. return function (d, b) {
  42045. extendStatics(d, b);
  42046. function __() { this.constructor = d; }
  42047. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  42048. };
  42049. })();
  42050. var connection_manager_ConnectionManager = (function (_super) {
  42051. connection_manager_extends(ConnectionManager, _super);
  42052. function ConnectionManager(key, options) {
  42053. var _this = _super.call(this) || this;
  42054. _this.key = key;
  42055. _this.options = options || {};
  42056. _this.state = "initialized";
  42057. _this.connection = null;
  42058. _this.usingTLS = !!options.useTLS;
  42059. _this.timeline = _this.options.timeline;
  42060. _this.errorCallbacks = _this.buildErrorCallbacks();
  42061. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  42062. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  42063. var Network = runtime.getNetwork();
  42064. Network.bind("online", function () {
  42065. _this.timeline.info({ netinfo: "online" });
  42066. if (_this.state === "connecting" || _this.state === "unavailable") {
  42067. _this.retryIn(0);
  42068. }
  42069. });
  42070. Network.bind("offline", function () {
  42071. _this.timeline.info({ netinfo: "offline" });
  42072. if (_this.connection) {
  42073. _this.sendActivityCheck();
  42074. }
  42075. });
  42076. _this.updateStrategy();
  42077. return _this;
  42078. }
  42079. ConnectionManager.prototype.connect = function () {
  42080. if (this.connection || this.runner) {
  42081. return;
  42082. }
  42083. if (!this.strategy.isSupported()) {
  42084. this.updateState("failed");
  42085. return;
  42086. }
  42087. this.updateState("connecting");
  42088. this.startConnecting();
  42089. this.setUnavailableTimer();
  42090. };
  42091. ;
  42092. ConnectionManager.prototype.send = function (data) {
  42093. if (this.connection) {
  42094. return this.connection.send(data);
  42095. }
  42096. else {
  42097. return false;
  42098. }
  42099. };
  42100. ;
  42101. ConnectionManager.prototype.send_event = function (name, data, channel) {
  42102. if (this.connection) {
  42103. return this.connection.send_event(name, data, channel);
  42104. }
  42105. else {
  42106. return false;
  42107. }
  42108. };
  42109. ;
  42110. ConnectionManager.prototype.disconnect = function () {
  42111. this.disconnectInternally();
  42112. this.updateState("disconnected");
  42113. };
  42114. ;
  42115. ConnectionManager.prototype.isUsingTLS = function () {
  42116. return this.usingTLS;
  42117. };
  42118. ;
  42119. ConnectionManager.prototype.startConnecting = function () {
  42120. var _this = this;
  42121. var callback = function (error, handshake) {
  42122. if (error) {
  42123. _this.runner = _this.strategy.connect(0, callback);
  42124. }
  42125. else {
  42126. if (handshake.action === "error") {
  42127. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  42128. _this.timeline.error({ handshakeError: handshake.error });
  42129. }
  42130. else {
  42131. _this.abortConnecting();
  42132. _this.handshakeCallbacks[handshake.action](handshake);
  42133. }
  42134. }
  42135. };
  42136. this.runner = this.strategy.connect(0, callback);
  42137. };
  42138. ;
  42139. ConnectionManager.prototype.abortConnecting = function () {
  42140. if (this.runner) {
  42141. this.runner.abort();
  42142. this.runner = null;
  42143. }
  42144. };
  42145. ;
  42146. ConnectionManager.prototype.disconnectInternally = function () {
  42147. this.abortConnecting();
  42148. this.clearRetryTimer();
  42149. this.clearUnavailableTimer();
  42150. if (this.connection) {
  42151. var connection = this.abandonConnection();
  42152. connection.close();
  42153. }
  42154. };
  42155. ;
  42156. ConnectionManager.prototype.updateStrategy = function () {
  42157. this.strategy = this.options.getStrategy({
  42158. key: this.key,
  42159. timeline: this.timeline,
  42160. useTLS: this.usingTLS
  42161. });
  42162. };
  42163. ;
  42164. ConnectionManager.prototype.retryIn = function (delay) {
  42165. var _this = this;
  42166. this.timeline.info({ action: "retry", delay: delay });
  42167. if (delay > 0) {
  42168. this.emit("connecting_in", Math.round(delay / 1000));
  42169. }
  42170. this.retryTimer = new OneOffTimer(delay || 0, function () {
  42171. _this.disconnectInternally();
  42172. _this.connect();
  42173. });
  42174. };
  42175. ;
  42176. ConnectionManager.prototype.clearRetryTimer = function () {
  42177. if (this.retryTimer) {
  42178. this.retryTimer.ensureAborted();
  42179. this.retryTimer = null;
  42180. }
  42181. };
  42182. ;
  42183. ConnectionManager.prototype.setUnavailableTimer = function () {
  42184. var _this = this;
  42185. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  42186. _this.updateState("unavailable");
  42187. });
  42188. };
  42189. ;
  42190. ConnectionManager.prototype.clearUnavailableTimer = function () {
  42191. if (this.unavailableTimer) {
  42192. this.unavailableTimer.ensureAborted();
  42193. }
  42194. };
  42195. ;
  42196. ConnectionManager.prototype.sendActivityCheck = function () {
  42197. var _this = this;
  42198. this.stopActivityCheck();
  42199. this.connection.ping();
  42200. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  42201. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  42202. _this.retryIn(0);
  42203. });
  42204. };
  42205. ;
  42206. ConnectionManager.prototype.resetActivityCheck = function () {
  42207. var _this = this;
  42208. this.stopActivityCheck();
  42209. if (this.connection && !this.connection.handlesActivityChecks()) {
  42210. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  42211. _this.sendActivityCheck();
  42212. });
  42213. }
  42214. };
  42215. ;
  42216. ConnectionManager.prototype.stopActivityCheck = function () {
  42217. if (this.activityTimer) {
  42218. this.activityTimer.ensureAborted();
  42219. }
  42220. };
  42221. ;
  42222. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  42223. var _this = this;
  42224. return extend({}, errorCallbacks, {
  42225. message: function (message) {
  42226. _this.resetActivityCheck();
  42227. _this.emit('message', message);
  42228. },
  42229. ping: function () {
  42230. _this.send_event('pusher:pong', {});
  42231. },
  42232. activity: function () {
  42233. _this.resetActivityCheck();
  42234. },
  42235. error: function (error) {
  42236. _this.emit("error", { type: "WebSocketError", error: error });
  42237. },
  42238. closed: function () {
  42239. _this.abandonConnection();
  42240. if (_this.shouldRetry()) {
  42241. _this.retryIn(1000);
  42242. }
  42243. }
  42244. });
  42245. };
  42246. ;
  42247. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  42248. var _this = this;
  42249. return extend({}, errorCallbacks, {
  42250. connected: function (handshake) {
  42251. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  42252. _this.clearUnavailableTimer();
  42253. _this.setConnection(handshake.connection);
  42254. _this.socket_id = _this.connection.id;
  42255. _this.updateState("connected", { socket_id: _this.socket_id });
  42256. }
  42257. });
  42258. };
  42259. ;
  42260. ConnectionManager.prototype.buildErrorCallbacks = function () {
  42261. var _this = this;
  42262. var withErrorEmitted = function (callback) {
  42263. return function (result) {
  42264. if (result.error) {
  42265. _this.emit("error", { type: "WebSocketError", error: result.error });
  42266. }
  42267. callback(result);
  42268. };
  42269. };
  42270. return {
  42271. tls_only: withErrorEmitted(function () {
  42272. _this.usingTLS = true;
  42273. _this.updateStrategy();
  42274. _this.retryIn(0);
  42275. }),
  42276. refused: withErrorEmitted(function () {
  42277. _this.disconnect();
  42278. }),
  42279. backoff: withErrorEmitted(function () {
  42280. _this.retryIn(1000);
  42281. }),
  42282. retry: withErrorEmitted(function () {
  42283. _this.retryIn(0);
  42284. })
  42285. };
  42286. };
  42287. ;
  42288. ConnectionManager.prototype.setConnection = function (connection) {
  42289. this.connection = connection;
  42290. for (var event in this.connectionCallbacks) {
  42291. this.connection.bind(event, this.connectionCallbacks[event]);
  42292. }
  42293. this.resetActivityCheck();
  42294. };
  42295. ;
  42296. ConnectionManager.prototype.abandonConnection = function () {
  42297. if (!this.connection) {
  42298. return;
  42299. }
  42300. this.stopActivityCheck();
  42301. for (var event in this.connectionCallbacks) {
  42302. this.connection.unbind(event, this.connectionCallbacks[event]);
  42303. }
  42304. var connection = this.connection;
  42305. this.connection = null;
  42306. return connection;
  42307. };
  42308. ConnectionManager.prototype.updateState = function (newState, data) {
  42309. var previousState = this.state;
  42310. this.state = newState;
  42311. if (previousState !== newState) {
  42312. var newStateDescription = newState;
  42313. if (newStateDescription === "connected") {
  42314. newStateDescription += " with new socket ID " + data.socket_id;
  42315. }
  42316. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  42317. this.timeline.info({ state: newState, params: data });
  42318. this.emit('state_change', { previous: previousState, current: newState });
  42319. this.emit(newState, data);
  42320. }
  42321. };
  42322. ConnectionManager.prototype.shouldRetry = function () {
  42323. return this.state === "connecting" || this.state === "connected";
  42324. };
  42325. return ConnectionManager;
  42326. }(dispatcher));
  42327. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  42328. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  42329. var channels_Channels = (function () {
  42330. function Channels() {
  42331. this.channels = {};
  42332. }
  42333. Channels.prototype.add = function (name, pusher) {
  42334. if (!this.channels[name]) {
  42335. this.channels[name] = createChannel(name, pusher);
  42336. }
  42337. return this.channels[name];
  42338. };
  42339. Channels.prototype.all = function () {
  42340. return values(this.channels);
  42341. };
  42342. Channels.prototype.find = function (name) {
  42343. return this.channels[name];
  42344. };
  42345. Channels.prototype.remove = function (name) {
  42346. var channel = this.channels[name];
  42347. delete this.channels[name];
  42348. return channel;
  42349. };
  42350. Channels.prototype.disconnect = function () {
  42351. objectApply(this.channels, function (channel) {
  42352. channel.disconnect();
  42353. });
  42354. };
  42355. return Channels;
  42356. }());
  42357. /* harmony default export */ var channels = (channels_Channels);
  42358. function createChannel(name, pusher) {
  42359. if (name.indexOf('private-encrypted-') === 0) {
  42360. if (false) { var errorMsg; }
  42361. return factory.createEncryptedChannel(name, pusher);
  42362. }
  42363. else if (name.indexOf('private-') === 0) {
  42364. return factory.createPrivateChannel(name, pusher);
  42365. }
  42366. else if (name.indexOf('presence-') === 0) {
  42367. return factory.createPresenceChannel(name, pusher);
  42368. }
  42369. else {
  42370. return factory.createChannel(name, pusher);
  42371. }
  42372. }
  42373. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  42374. var Factory = {
  42375. createChannels: function () {
  42376. return new channels();
  42377. },
  42378. createConnectionManager: function (key, options) {
  42379. return new connection_manager(key, options);
  42380. },
  42381. createChannel: function (name, pusher) {
  42382. return new channels_channel(name, pusher);
  42383. },
  42384. createPrivateChannel: function (name, pusher) {
  42385. return new private_channel(name, pusher);
  42386. },
  42387. createPresenceChannel: function (name, pusher) {
  42388. return new presence_channel(name, pusher);
  42389. },
  42390. createEncryptedChannel: function (name, pusher) {
  42391. return new encrypted_channel(name, pusher);
  42392. },
  42393. createTimelineSender: function (timeline, options) {
  42394. return new timeline_sender(timeline, options);
  42395. },
  42396. createAuthorizer: function (channel, options) {
  42397. if (options.authorizer) {
  42398. return options.authorizer(channel, options);
  42399. }
  42400. return new pusher_authorizer(channel, options);
  42401. },
  42402. createHandshake: function (transport, callback) {
  42403. return new connection_handshake(transport, callback);
  42404. },
  42405. createAssistantToTheTransportManager: function (manager, transport, options) {
  42406. return new assistant_to_the_transport_manager(manager, transport, options);
  42407. }
  42408. };
  42409. /* harmony default export */ var factory = (Factory);
  42410. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  42411. var transport_manager_TransportManager = (function () {
  42412. function TransportManager(options) {
  42413. this.options = options || {};
  42414. this.livesLeft = this.options.lives || Infinity;
  42415. }
  42416. TransportManager.prototype.getAssistant = function (transport) {
  42417. return factory.createAssistantToTheTransportManager(this, transport, {
  42418. minPingDelay: this.options.minPingDelay,
  42419. maxPingDelay: this.options.maxPingDelay
  42420. });
  42421. };
  42422. TransportManager.prototype.isAlive = function () {
  42423. return this.livesLeft > 0;
  42424. };
  42425. TransportManager.prototype.reportDeath = function () {
  42426. this.livesLeft -= 1;
  42427. };
  42428. return TransportManager;
  42429. }());
  42430. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  42431. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  42432. var sequential_strategy_SequentialStrategy = (function () {
  42433. function SequentialStrategy(strategies, options) {
  42434. this.strategies = strategies;
  42435. this.loop = Boolean(options.loop);
  42436. this.failFast = Boolean(options.failFast);
  42437. this.timeout = options.timeout;
  42438. this.timeoutLimit = options.timeoutLimit;
  42439. }
  42440. SequentialStrategy.prototype.isSupported = function () {
  42441. return any(this.strategies, util.method("isSupported"));
  42442. };
  42443. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  42444. var _this = this;
  42445. var strategies = this.strategies;
  42446. var current = 0;
  42447. var timeout = this.timeout;
  42448. var runner = null;
  42449. var tryNextStrategy = function (error, handshake) {
  42450. if (handshake) {
  42451. callback(null, handshake);
  42452. }
  42453. else {
  42454. current = current + 1;
  42455. if (_this.loop) {
  42456. current = current % strategies.length;
  42457. }
  42458. if (current < strategies.length) {
  42459. if (timeout) {
  42460. timeout = timeout * 2;
  42461. if (_this.timeoutLimit) {
  42462. timeout = Math.min(timeout, _this.timeoutLimit);
  42463. }
  42464. }
  42465. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  42466. }
  42467. else {
  42468. callback(true);
  42469. }
  42470. }
  42471. };
  42472. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  42473. return {
  42474. abort: function () {
  42475. runner.abort();
  42476. },
  42477. forceMinPriority: function (p) {
  42478. minPriority = p;
  42479. if (runner) {
  42480. runner.forceMinPriority(p);
  42481. }
  42482. }
  42483. };
  42484. };
  42485. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  42486. var timer = null;
  42487. var runner = null;
  42488. if (options.timeout > 0) {
  42489. timer = new OneOffTimer(options.timeout, function () {
  42490. runner.abort();
  42491. callback(true);
  42492. });
  42493. }
  42494. runner = strategy.connect(minPriority, function (error, handshake) {
  42495. if (error && timer && timer.isRunning() && !options.failFast) {
  42496. return;
  42497. }
  42498. if (timer) {
  42499. timer.ensureAborted();
  42500. }
  42501. callback(error, handshake);
  42502. });
  42503. return {
  42504. abort: function () {
  42505. if (timer) {
  42506. timer.ensureAborted();
  42507. }
  42508. runner.abort();
  42509. },
  42510. forceMinPriority: function (p) {
  42511. runner.forceMinPriority(p);
  42512. }
  42513. };
  42514. };
  42515. return SequentialStrategy;
  42516. }());
  42517. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  42518. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  42519. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  42520. function BestConnectedEverStrategy(strategies) {
  42521. this.strategies = strategies;
  42522. }
  42523. BestConnectedEverStrategy.prototype.isSupported = function () {
  42524. return any(this.strategies, util.method("isSupported"));
  42525. };
  42526. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  42527. return connect(this.strategies, minPriority, function (i, runners) {
  42528. return function (error, handshake) {
  42529. runners[i].error = error;
  42530. if (error) {
  42531. if (allRunnersFailed(runners)) {
  42532. callback(true);
  42533. }
  42534. return;
  42535. }
  42536. apply(runners, function (runner) {
  42537. runner.forceMinPriority(handshake.transport.priority);
  42538. });
  42539. callback(null, handshake);
  42540. };
  42541. });
  42542. };
  42543. return BestConnectedEverStrategy;
  42544. }());
  42545. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  42546. function connect(strategies, minPriority, callbackBuilder) {
  42547. var runners = map(strategies, function (strategy, i, _, rs) {
  42548. return strategy.connect(minPriority, callbackBuilder(i, rs));
  42549. });
  42550. return {
  42551. abort: function () {
  42552. apply(runners, abortRunner);
  42553. },
  42554. forceMinPriority: function (p) {
  42555. apply(runners, function (runner) {
  42556. runner.forceMinPriority(p);
  42557. });
  42558. }
  42559. };
  42560. }
  42561. function allRunnersFailed(runners) {
  42562. return collections_all(runners, function (runner) {
  42563. return Boolean(runner.error);
  42564. });
  42565. }
  42566. function abortRunner(runner) {
  42567. if (!runner.error && !runner.aborted) {
  42568. runner.abort();
  42569. runner.aborted = true;
  42570. }
  42571. }
  42572. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  42573. var cached_strategy_CachedStrategy = (function () {
  42574. function CachedStrategy(strategy, transports, options) {
  42575. this.strategy = strategy;
  42576. this.transports = transports;
  42577. this.ttl = options.ttl || 1800 * 1000;
  42578. this.usingTLS = options.useTLS;
  42579. this.timeline = options.timeline;
  42580. }
  42581. CachedStrategy.prototype.isSupported = function () {
  42582. return this.strategy.isSupported();
  42583. };
  42584. CachedStrategy.prototype.connect = function (minPriority, callback) {
  42585. var usingTLS = this.usingTLS;
  42586. var info = fetchTransportCache(usingTLS);
  42587. var strategies = [this.strategy];
  42588. if (info && info.timestamp + this.ttl >= util.now()) {
  42589. var transport = this.transports[info.transport];
  42590. if (transport) {
  42591. this.timeline.info({
  42592. cached: true,
  42593. transport: info.transport,
  42594. latency: info.latency
  42595. });
  42596. strategies.push(new sequential_strategy([transport], {
  42597. timeout: info.latency * 2 + 1000,
  42598. failFast: true
  42599. }));
  42600. }
  42601. }
  42602. var startTimestamp = util.now();
  42603. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  42604. if (error) {
  42605. flushTransportCache(usingTLS);
  42606. if (strategies.length > 0) {
  42607. startTimestamp = util.now();
  42608. runner = strategies.pop().connect(minPriority, cb);
  42609. }
  42610. else {
  42611. callback(error);
  42612. }
  42613. }
  42614. else {
  42615. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  42616. callback(null, handshake);
  42617. }
  42618. });
  42619. return {
  42620. abort: function () {
  42621. runner.abort();
  42622. },
  42623. forceMinPriority: function (p) {
  42624. minPriority = p;
  42625. if (runner) {
  42626. runner.forceMinPriority(p);
  42627. }
  42628. }
  42629. };
  42630. };
  42631. return CachedStrategy;
  42632. }());
  42633. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  42634. function getTransportCacheKey(usingTLS) {
  42635. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  42636. }
  42637. function fetchTransportCache(usingTLS) {
  42638. var storage = runtime.getLocalStorage();
  42639. if (storage) {
  42640. try {
  42641. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  42642. if (serializedCache) {
  42643. return JSON.parse(serializedCache);
  42644. }
  42645. }
  42646. catch (e) {
  42647. flushTransportCache(usingTLS);
  42648. }
  42649. }
  42650. return null;
  42651. }
  42652. function storeTransportCache(usingTLS, transport, latency) {
  42653. var storage = runtime.getLocalStorage();
  42654. if (storage) {
  42655. try {
  42656. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  42657. timestamp: util.now(),
  42658. transport: transport,
  42659. latency: latency
  42660. });
  42661. }
  42662. catch (e) {
  42663. }
  42664. }
  42665. }
  42666. function flushTransportCache(usingTLS) {
  42667. var storage = runtime.getLocalStorage();
  42668. if (storage) {
  42669. try {
  42670. delete storage[getTransportCacheKey(usingTLS)];
  42671. }
  42672. catch (e) {
  42673. }
  42674. }
  42675. }
  42676. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  42677. var delayed_strategy_DelayedStrategy = (function () {
  42678. function DelayedStrategy(strategy, _a) {
  42679. var number = _a.delay;
  42680. this.strategy = strategy;
  42681. this.options = { delay: number };
  42682. }
  42683. DelayedStrategy.prototype.isSupported = function () {
  42684. return this.strategy.isSupported();
  42685. };
  42686. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  42687. var strategy = this.strategy;
  42688. var runner;
  42689. var timer = new OneOffTimer(this.options.delay, function () {
  42690. runner = strategy.connect(minPriority, callback);
  42691. });
  42692. return {
  42693. abort: function () {
  42694. timer.ensureAborted();
  42695. if (runner) {
  42696. runner.abort();
  42697. }
  42698. },
  42699. forceMinPriority: function (p) {
  42700. minPriority = p;
  42701. if (runner) {
  42702. runner.forceMinPriority(p);
  42703. }
  42704. }
  42705. };
  42706. };
  42707. return DelayedStrategy;
  42708. }());
  42709. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  42710. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  42711. var IfStrategy = (function () {
  42712. function IfStrategy(test, trueBranch, falseBranch) {
  42713. this.test = test;
  42714. this.trueBranch = trueBranch;
  42715. this.falseBranch = falseBranch;
  42716. }
  42717. IfStrategy.prototype.isSupported = function () {
  42718. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42719. return branch.isSupported();
  42720. };
  42721. IfStrategy.prototype.connect = function (minPriority, callback) {
  42722. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42723. return branch.connect(minPriority, callback);
  42724. };
  42725. return IfStrategy;
  42726. }());
  42727. /* harmony default export */ var if_strategy = (IfStrategy);
  42728. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  42729. var FirstConnectedStrategy = (function () {
  42730. function FirstConnectedStrategy(strategy) {
  42731. this.strategy = strategy;
  42732. }
  42733. FirstConnectedStrategy.prototype.isSupported = function () {
  42734. return this.strategy.isSupported();
  42735. };
  42736. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  42737. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  42738. if (handshake) {
  42739. runner.abort();
  42740. }
  42741. callback(error, handshake);
  42742. });
  42743. return runner;
  42744. };
  42745. return FirstConnectedStrategy;
  42746. }());
  42747. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  42748. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  42749. function testSupportsStrategy(strategy) {
  42750. return function () {
  42751. return strategy.isSupported();
  42752. };
  42753. }
  42754. var getDefaultStrategy = function (config, defineTransport) {
  42755. var definedTransports = {};
  42756. function defineTransportStrategy(name, type, priority, options, manager) {
  42757. var transport = defineTransport(config, name, type, priority, options, manager);
  42758. definedTransports[name] = transport;
  42759. return transport;
  42760. }
  42761. var ws_options = {
  42762. hostNonTLS: config.wsHost + ":" + config.wsPort,
  42763. hostTLS: config.wsHost + ":" + config.wssPort,
  42764. httpPath: config.wsPath
  42765. };
  42766. var wss_options = extend({}, ws_options, {
  42767. useTLS: true
  42768. });
  42769. var sockjs_options = {
  42770. hostNonTLS: config.httpHost + ":" + config.httpPort,
  42771. hostTLS: config.httpHost + ":" + config.httpsPort,
  42772. httpPath: config.httpPath
  42773. };
  42774. var timeouts = {
  42775. loop: true,
  42776. timeout: 15000,
  42777. timeoutLimit: 60000
  42778. };
  42779. var ws_manager = new transport_manager({
  42780. lives: 2,
  42781. minPingDelay: 10000,
  42782. maxPingDelay: config.activity_timeout
  42783. });
  42784. var streaming_manager = new transport_manager({
  42785. lives: 2,
  42786. minPingDelay: 10000,
  42787. maxPingDelay: config.activity_timeout
  42788. });
  42789. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  42790. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  42791. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  42792. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  42793. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  42794. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  42795. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  42796. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  42797. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  42798. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  42799. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  42800. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  42801. 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);
  42802. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  42803. var wsStrategy;
  42804. if (config.useTLS) {
  42805. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  42806. }
  42807. else {
  42808. wsStrategy = new best_connected_ever_strategy([
  42809. ws_loop,
  42810. new delayed_strategy(wss_loop, { delay: 2000 }),
  42811. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  42812. ]);
  42813. }
  42814. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  42815. ttl: 1800000,
  42816. timeline: config.timeline,
  42817. useTLS: config.useTLS
  42818. });
  42819. };
  42820. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  42821. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  42822. /* harmony default export */ var transport_connection_initializer = (function () {
  42823. var self = this;
  42824. self.timeline.info(self.buildTimelineMessage({
  42825. transport: self.name + (self.options.useTLS ? "s" : "")
  42826. }));
  42827. if (self.hooks.isInitialized()) {
  42828. self.changeState("initialized");
  42829. }
  42830. else if (self.hooks.file) {
  42831. self.changeState("initializing");
  42832. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  42833. if (self.hooks.isInitialized()) {
  42834. self.changeState("initialized");
  42835. callback(true);
  42836. }
  42837. else {
  42838. if (error) {
  42839. self.onError(error);
  42840. }
  42841. self.onClose();
  42842. callback(false);
  42843. }
  42844. });
  42845. }
  42846. else {
  42847. self.onClose();
  42848. }
  42849. });
  42850. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  42851. var http_xdomain_request_hooks = {
  42852. getRequest: function (socket) {
  42853. var xdr = new window.XDomainRequest();
  42854. xdr.ontimeout = function () {
  42855. socket.emit("error", new RequestTimedOut());
  42856. socket.close();
  42857. };
  42858. xdr.onerror = function (e) {
  42859. socket.emit("error", e);
  42860. socket.close();
  42861. };
  42862. xdr.onprogress = function () {
  42863. if (xdr.responseText && xdr.responseText.length > 0) {
  42864. socket.onChunk(200, xdr.responseText);
  42865. }
  42866. };
  42867. xdr.onload = function () {
  42868. if (xdr.responseText && xdr.responseText.length > 0) {
  42869. socket.onChunk(200, xdr.responseText);
  42870. }
  42871. socket.emit("finished", 200);
  42872. socket.close();
  42873. };
  42874. return xdr;
  42875. },
  42876. abortRequest: function (xdr) {
  42877. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  42878. xdr.abort();
  42879. }
  42880. };
  42881. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  42882. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  42883. var http_request_extends = (undefined && undefined.__extends) || (function () {
  42884. var extendStatics = function (d, b) {
  42885. extendStatics = Object.setPrototypeOf ||
  42886. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  42887. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  42888. return extendStatics(d, b);
  42889. };
  42890. return function (d, b) {
  42891. extendStatics(d, b);
  42892. function __() { this.constructor = d; }
  42893. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  42894. };
  42895. })();
  42896. var MAX_BUFFER_LENGTH = 256 * 1024;
  42897. var http_request_HTTPRequest = (function (_super) {
  42898. http_request_extends(HTTPRequest, _super);
  42899. function HTTPRequest(hooks, method, url) {
  42900. var _this = _super.call(this) || this;
  42901. _this.hooks = hooks;
  42902. _this.method = method;
  42903. _this.url = url;
  42904. return _this;
  42905. }
  42906. HTTPRequest.prototype.start = function (payload) {
  42907. var _this = this;
  42908. this.position = 0;
  42909. this.xhr = this.hooks.getRequest(this);
  42910. this.unloader = function () {
  42911. _this.close();
  42912. };
  42913. runtime.addUnloadListener(this.unloader);
  42914. this.xhr.open(this.method, this.url, true);
  42915. if (this.xhr.setRequestHeader) {
  42916. this.xhr.setRequestHeader("Content-Type", "application/json");
  42917. }
  42918. this.xhr.send(payload);
  42919. };
  42920. HTTPRequest.prototype.close = function () {
  42921. if (this.unloader) {
  42922. runtime.removeUnloadListener(this.unloader);
  42923. this.unloader = null;
  42924. }
  42925. if (this.xhr) {
  42926. this.hooks.abortRequest(this.xhr);
  42927. this.xhr = null;
  42928. }
  42929. };
  42930. HTTPRequest.prototype.onChunk = function (status, data) {
  42931. while (true) {
  42932. var chunk = this.advanceBuffer(data);
  42933. if (chunk) {
  42934. this.emit("chunk", { status: status, data: chunk });
  42935. }
  42936. else {
  42937. break;
  42938. }
  42939. }
  42940. if (this.isBufferTooLong(data)) {
  42941. this.emit("buffer_too_long");
  42942. }
  42943. };
  42944. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42945. var unreadData = buffer.slice(this.position);
  42946. var endOfLinePosition = unreadData.indexOf("\n");
  42947. if (endOfLinePosition !== -1) {
  42948. this.position += endOfLinePosition + 1;
  42949. return unreadData.slice(0, endOfLinePosition);
  42950. }
  42951. else {
  42952. return null;
  42953. }
  42954. };
  42955. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42956. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42957. };
  42958. return HTTPRequest;
  42959. }(dispatcher));
  42960. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42961. // CONCATENATED MODULE: ./src/core/http/state.ts
  42962. var State;
  42963. (function (State) {
  42964. State[State["CONNECTING"] = 0] = "CONNECTING";
  42965. State[State["OPEN"] = 1] = "OPEN";
  42966. State[State["CLOSED"] = 3] = "CLOSED";
  42967. })(State || (State = {}));
  42968. /* harmony default export */ var state = (State);
  42969. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42970. var autoIncrement = 1;
  42971. var http_socket_HTTPSocket = (function () {
  42972. function HTTPSocket(hooks, url) {
  42973. this.hooks = hooks;
  42974. this.session = randomNumber(1000) + "/" + randomString(8);
  42975. this.location = getLocation(url);
  42976. this.readyState = state.CONNECTING;
  42977. this.openStream();
  42978. }
  42979. HTTPSocket.prototype.send = function (payload) {
  42980. return this.sendRaw(JSON.stringify([payload]));
  42981. };
  42982. HTTPSocket.prototype.ping = function () {
  42983. this.hooks.sendHeartbeat(this);
  42984. };
  42985. HTTPSocket.prototype.close = function (code, reason) {
  42986. this.onClose(code, reason, true);
  42987. };
  42988. HTTPSocket.prototype.sendRaw = function (payload) {
  42989. if (this.readyState === state.OPEN) {
  42990. try {
  42991. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42992. return true;
  42993. }
  42994. catch (e) {
  42995. return false;
  42996. }
  42997. }
  42998. else {
  42999. return false;
  43000. }
  43001. };
  43002. HTTPSocket.prototype.reconnect = function () {
  43003. this.closeStream();
  43004. this.openStream();
  43005. };
  43006. ;
  43007. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  43008. this.closeStream();
  43009. this.readyState = state.CLOSED;
  43010. if (this.onclose) {
  43011. this.onclose({
  43012. code: code,
  43013. reason: reason,
  43014. wasClean: wasClean
  43015. });
  43016. }
  43017. };
  43018. HTTPSocket.prototype.onChunk = function (chunk) {
  43019. if (chunk.status !== 200) {
  43020. return;
  43021. }
  43022. if (this.readyState === state.OPEN) {
  43023. this.onActivity();
  43024. }
  43025. var payload;
  43026. var type = chunk.data.slice(0, 1);
  43027. switch (type) {
  43028. case 'o':
  43029. payload = JSON.parse(chunk.data.slice(1) || '{}');
  43030. this.onOpen(payload);
  43031. break;
  43032. case 'a':
  43033. payload = JSON.parse(chunk.data.slice(1) || '[]');
  43034. for (var i = 0; i < payload.length; i++) {
  43035. this.onEvent(payload[i]);
  43036. }
  43037. break;
  43038. case 'm':
  43039. payload = JSON.parse(chunk.data.slice(1) || 'null');
  43040. this.onEvent(payload);
  43041. break;
  43042. case 'h':
  43043. this.hooks.onHeartbeat(this);
  43044. break;
  43045. case 'c':
  43046. payload = JSON.parse(chunk.data.slice(1) || '[]');
  43047. this.onClose(payload[0], payload[1], true);
  43048. break;
  43049. }
  43050. };
  43051. HTTPSocket.prototype.onOpen = function (options) {
  43052. if (this.readyState === state.CONNECTING) {
  43053. if (options && options.hostname) {
  43054. this.location.base = replaceHost(this.location.base, options.hostname);
  43055. }
  43056. this.readyState = state.OPEN;
  43057. if (this.onopen) {
  43058. this.onopen();
  43059. }
  43060. }
  43061. else {
  43062. this.onClose(1006, "Server lost session", true);
  43063. }
  43064. };
  43065. HTTPSocket.prototype.onEvent = function (event) {
  43066. if (this.readyState === state.OPEN && this.onmessage) {
  43067. this.onmessage({ data: event });
  43068. }
  43069. };
  43070. HTTPSocket.prototype.onActivity = function () {
  43071. if (this.onactivity) {
  43072. this.onactivity();
  43073. }
  43074. };
  43075. HTTPSocket.prototype.onError = function (error) {
  43076. if (this.onerror) {
  43077. this.onerror(error);
  43078. }
  43079. };
  43080. HTTPSocket.prototype.openStream = function () {
  43081. var _this = this;
  43082. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  43083. this.stream.bind("chunk", function (chunk) {
  43084. _this.onChunk(chunk);
  43085. });
  43086. this.stream.bind("finished", function (status) {
  43087. _this.hooks.onFinished(_this, status);
  43088. });
  43089. this.stream.bind("buffer_too_long", function () {
  43090. _this.reconnect();
  43091. });
  43092. try {
  43093. this.stream.start();
  43094. }
  43095. catch (error) {
  43096. util.defer(function () {
  43097. _this.onError(error);
  43098. _this.onClose(1006, "Could not start streaming", false);
  43099. });
  43100. }
  43101. };
  43102. HTTPSocket.prototype.closeStream = function () {
  43103. if (this.stream) {
  43104. this.stream.unbind_all();
  43105. this.stream.close();
  43106. this.stream = null;
  43107. }
  43108. };
  43109. return HTTPSocket;
  43110. }());
  43111. function getLocation(url) {
  43112. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  43113. return {
  43114. base: parts[1],
  43115. queryString: parts[2]
  43116. };
  43117. }
  43118. function getSendURL(url, session) {
  43119. return url.base + "/" + session + "/xhr_send";
  43120. }
  43121. function getUniqueURL(url) {
  43122. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  43123. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  43124. }
  43125. function replaceHost(url, hostname) {
  43126. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  43127. return urlParts[1] + hostname + urlParts[3];
  43128. }
  43129. function randomNumber(max) {
  43130. return Math.floor(Math.random() * max);
  43131. }
  43132. function randomString(length) {
  43133. var result = [];
  43134. for (var i = 0; i < length; i++) {
  43135. result.push(randomNumber(32).toString(32));
  43136. }
  43137. return result.join('');
  43138. }
  43139. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  43140. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  43141. var http_streaming_socket_hooks = {
  43142. getReceiveURL: function (url, session) {
  43143. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  43144. },
  43145. onHeartbeat: function (socket) {
  43146. socket.sendRaw("[]");
  43147. },
  43148. sendHeartbeat: function (socket) {
  43149. socket.sendRaw("[]");
  43150. },
  43151. onFinished: function (socket, status) {
  43152. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  43153. }
  43154. };
  43155. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  43156. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  43157. var http_polling_socket_hooks = {
  43158. getReceiveURL: function (url, session) {
  43159. return url.base + "/" + session + "/xhr" + url.queryString;
  43160. },
  43161. onHeartbeat: function () {
  43162. },
  43163. sendHeartbeat: function (socket) {
  43164. socket.sendRaw("[]");
  43165. },
  43166. onFinished: function (socket, status) {
  43167. if (status === 200) {
  43168. socket.reconnect();
  43169. }
  43170. else {
  43171. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  43172. }
  43173. }
  43174. };
  43175. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  43176. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  43177. var http_xhr_request_hooks = {
  43178. getRequest: function (socket) {
  43179. var Constructor = runtime.getXHRAPI();
  43180. var xhr = new Constructor();
  43181. xhr.onreadystatechange = xhr.onprogress = function () {
  43182. switch (xhr.readyState) {
  43183. case 3:
  43184. if (xhr.responseText && xhr.responseText.length > 0) {
  43185. socket.onChunk(xhr.status, xhr.responseText);
  43186. }
  43187. break;
  43188. case 4:
  43189. if (xhr.responseText && xhr.responseText.length > 0) {
  43190. socket.onChunk(xhr.status, xhr.responseText);
  43191. }
  43192. socket.emit("finished", xhr.status);
  43193. socket.close();
  43194. break;
  43195. }
  43196. };
  43197. return xhr;
  43198. },
  43199. abortRequest: function (xhr) {
  43200. xhr.onreadystatechange = null;
  43201. xhr.abort();
  43202. }
  43203. };
  43204. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  43205. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  43206. var HTTP = {
  43207. createStreamingSocket: function (url) {
  43208. return this.createSocket(http_streaming_socket, url);
  43209. },
  43210. createPollingSocket: function (url) {
  43211. return this.createSocket(http_polling_socket, url);
  43212. },
  43213. createSocket: function (hooks, url) {
  43214. return new http_socket(hooks, url);
  43215. },
  43216. createXHR: function (method, url) {
  43217. return this.createRequest(http_xhr_request, method, url);
  43218. },
  43219. createRequest: function (hooks, method, url) {
  43220. return new http_request(hooks, method, url);
  43221. }
  43222. };
  43223. /* harmony default export */ var http_http = (HTTP);
  43224. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  43225. http_http.createXDR = function (method, url) {
  43226. return this.createRequest(http_xdomain_request, method, url);
  43227. };
  43228. /* harmony default export */ var web_http_http = (http_http);
  43229. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  43230. var Runtime = {
  43231. nextAuthCallbackID: 1,
  43232. auth_callbacks: {},
  43233. ScriptReceivers: ScriptReceivers,
  43234. DependenciesReceivers: DependenciesReceivers,
  43235. getDefaultStrategy: default_strategy,
  43236. Transports: transports_transports,
  43237. transportConnectionInitializer: transport_connection_initializer,
  43238. HTTPFactory: web_http_http,
  43239. TimelineTransport: jsonp_timeline,
  43240. getXHRAPI: function () {
  43241. return window.XMLHttpRequest;
  43242. },
  43243. getWebSocketAPI: function () {
  43244. return window.WebSocket || window.MozWebSocket;
  43245. },
  43246. setup: function (PusherClass) {
  43247. var _this = this;
  43248. window.Pusher = PusherClass;
  43249. var initializeOnDocumentBody = function () {
  43250. _this.onDocumentBody(PusherClass.ready);
  43251. };
  43252. if (!window.JSON) {
  43253. Dependencies.load("json2", {}, initializeOnDocumentBody);
  43254. }
  43255. else {
  43256. initializeOnDocumentBody();
  43257. }
  43258. },
  43259. getDocument: function () {
  43260. return document;
  43261. },
  43262. getProtocol: function () {
  43263. return this.getDocument().location.protocol;
  43264. },
  43265. getAuthorizers: function () {
  43266. return { ajax: xhr_auth, jsonp: jsonp_auth };
  43267. },
  43268. onDocumentBody: function (callback) {
  43269. var _this = this;
  43270. if (document.body) {
  43271. callback();
  43272. }
  43273. else {
  43274. setTimeout(function () {
  43275. _this.onDocumentBody(callback);
  43276. }, 0);
  43277. }
  43278. },
  43279. createJSONPRequest: function (url, data) {
  43280. return new jsonp_request(url, data);
  43281. },
  43282. createScriptRequest: function (src) {
  43283. return new script_request(src);
  43284. },
  43285. getLocalStorage: function () {
  43286. try {
  43287. return window.localStorage;
  43288. }
  43289. catch (e) {
  43290. return undefined;
  43291. }
  43292. },
  43293. createXHR: function () {
  43294. if (this.getXHRAPI()) {
  43295. return this.createXMLHttpRequest();
  43296. }
  43297. else {
  43298. return this.createMicrosoftXHR();
  43299. }
  43300. },
  43301. createXMLHttpRequest: function () {
  43302. var Constructor = this.getXHRAPI();
  43303. return new Constructor();
  43304. },
  43305. createMicrosoftXHR: function () {
  43306. return new ActiveXObject("Microsoft.XMLHTTP");
  43307. },
  43308. getNetwork: function () {
  43309. return net_info_Network;
  43310. },
  43311. createWebSocket: function (url) {
  43312. var Constructor = this.getWebSocketAPI();
  43313. return new Constructor(url);
  43314. },
  43315. createSocketRequest: function (method, url) {
  43316. if (this.isXHRSupported()) {
  43317. return this.HTTPFactory.createXHR(method, url);
  43318. }
  43319. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  43320. return this.HTTPFactory.createXDR(method, url);
  43321. }
  43322. else {
  43323. throw "Cross-origin HTTP requests are not supported";
  43324. }
  43325. },
  43326. isXHRSupported: function () {
  43327. var Constructor = this.getXHRAPI();
  43328. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  43329. },
  43330. isXDRSupported: function (useTLS) {
  43331. var protocol = useTLS ? "https:" : "http:";
  43332. var documentProtocol = this.getProtocol();
  43333. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  43334. },
  43335. addUnloadListener: function (listener) {
  43336. if (window.addEventListener !== undefined) {
  43337. window.addEventListener("unload", listener, false);
  43338. }
  43339. else if (window.attachEvent !== undefined) {
  43340. window.attachEvent("onunload", listener);
  43341. }
  43342. },
  43343. removeUnloadListener: function (listener) {
  43344. if (window.addEventListener !== undefined) {
  43345. window.removeEventListener("unload", listener, false);
  43346. }
  43347. else if (window.detachEvent !== undefined) {
  43348. window.detachEvent("onunload", listener);
  43349. }
  43350. }
  43351. };
  43352. /* harmony default export */ var runtime = (Runtime);
  43353. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  43354. var TimelineLevel;
  43355. (function (TimelineLevel) {
  43356. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  43357. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  43358. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  43359. })(TimelineLevel || (TimelineLevel = {}));
  43360. /* harmony default export */ var timeline_level = (TimelineLevel);
  43361. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  43362. var timeline_Timeline = (function () {
  43363. function Timeline(key, session, options) {
  43364. this.key = key;
  43365. this.session = session;
  43366. this.events = [];
  43367. this.options = options || {};
  43368. this.sent = 0;
  43369. this.uniqueID = 0;
  43370. }
  43371. Timeline.prototype.log = function (level, event) {
  43372. if (level <= this.options.level) {
  43373. this.events.push(extend({}, event, { timestamp: util.now() }));
  43374. if (this.options.limit && this.events.length > this.options.limit) {
  43375. this.events.shift();
  43376. }
  43377. }
  43378. };
  43379. Timeline.prototype.error = function (event) {
  43380. this.log(timeline_level.ERROR, event);
  43381. };
  43382. Timeline.prototype.info = function (event) {
  43383. this.log(timeline_level.INFO, event);
  43384. };
  43385. Timeline.prototype.debug = function (event) {
  43386. this.log(timeline_level.DEBUG, event);
  43387. };
  43388. Timeline.prototype.isEmpty = function () {
  43389. return this.events.length === 0;
  43390. };
  43391. Timeline.prototype.send = function (sendfn, callback) {
  43392. var _this = this;
  43393. var data = extend({
  43394. session: this.session,
  43395. bundle: this.sent + 1,
  43396. key: this.key,
  43397. lib: "js",
  43398. version: this.options.version,
  43399. cluster: this.options.cluster,
  43400. features: this.options.features,
  43401. timeline: this.events
  43402. }, this.options.params);
  43403. this.events = [];
  43404. sendfn(data, function (error, result) {
  43405. if (!error) {
  43406. _this.sent++;
  43407. }
  43408. if (callback) {
  43409. callback(error, result);
  43410. }
  43411. });
  43412. return true;
  43413. };
  43414. Timeline.prototype.generateUniqueID = function () {
  43415. this.uniqueID++;
  43416. return this.uniqueID;
  43417. };
  43418. return Timeline;
  43419. }());
  43420. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  43421. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  43422. var transport_strategy_TransportStrategy = (function () {
  43423. function TransportStrategy(name, priority, transport, options) {
  43424. this.name = name;
  43425. this.priority = priority;
  43426. this.transport = transport;
  43427. this.options = options || {};
  43428. }
  43429. TransportStrategy.prototype.isSupported = function () {
  43430. return this.transport.isSupported({
  43431. useTLS: this.options.useTLS
  43432. });
  43433. };
  43434. TransportStrategy.prototype.connect = function (minPriority, callback) {
  43435. var _this = this;
  43436. if (!this.isSupported()) {
  43437. return failAttempt(new UnsupportedStrategy(), callback);
  43438. }
  43439. else if (this.priority < minPriority) {
  43440. return failAttempt(new TransportPriorityTooLow(), callback);
  43441. }
  43442. var connected = false;
  43443. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  43444. var handshake = null;
  43445. var onInitialized = function () {
  43446. transport.unbind("initialized", onInitialized);
  43447. transport.connect();
  43448. };
  43449. var onOpen = function () {
  43450. handshake = factory.createHandshake(transport, function (result) {
  43451. connected = true;
  43452. unbindListeners();
  43453. callback(null, result);
  43454. });
  43455. };
  43456. var onError = function (error) {
  43457. unbindListeners();
  43458. callback(error);
  43459. };
  43460. var onClosed = function () {
  43461. unbindListeners();
  43462. var serializedTransport;
  43463. serializedTransport = safeJSONStringify(transport);
  43464. callback(new TransportClosed(serializedTransport));
  43465. };
  43466. var unbindListeners = function () {
  43467. transport.unbind("initialized", onInitialized);
  43468. transport.unbind("open", onOpen);
  43469. transport.unbind("error", onError);
  43470. transport.unbind("closed", onClosed);
  43471. };
  43472. transport.bind("initialized", onInitialized);
  43473. transport.bind("open", onOpen);
  43474. transport.bind("error", onError);
  43475. transport.bind("closed", onClosed);
  43476. transport.initialize();
  43477. return {
  43478. abort: function () {
  43479. if (connected) {
  43480. return;
  43481. }
  43482. unbindListeners();
  43483. if (handshake) {
  43484. handshake.close();
  43485. }
  43486. else {
  43487. transport.close();
  43488. }
  43489. },
  43490. forceMinPriority: function (p) {
  43491. if (connected) {
  43492. return;
  43493. }
  43494. if (_this.priority < p) {
  43495. if (handshake) {
  43496. handshake.close();
  43497. }
  43498. else {
  43499. transport.close();
  43500. }
  43501. }
  43502. }
  43503. };
  43504. };
  43505. return TransportStrategy;
  43506. }());
  43507. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  43508. function failAttempt(error, callback) {
  43509. util.defer(function () {
  43510. callback(error);
  43511. });
  43512. return {
  43513. abort: function () { },
  43514. forceMinPriority: function () { }
  43515. };
  43516. }
  43517. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  43518. var strategy_builder_Transports = runtime.Transports;
  43519. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  43520. var transportClass = strategy_builder_Transports[type];
  43521. if (!transportClass) {
  43522. throw new UnsupportedTransport(type);
  43523. }
  43524. var enabled = (!config.enabledTransports ||
  43525. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  43526. (!config.disabledTransports ||
  43527. arrayIndexOf(config.disabledTransports, name) === -1);
  43528. var transport;
  43529. if (enabled) {
  43530. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  43531. key: config.key,
  43532. useTLS: config.useTLS,
  43533. timeline: config.timeline,
  43534. ignoreNullOrigin: config.ignoreNullOrigin
  43535. }, options));
  43536. }
  43537. else {
  43538. transport = strategy_builder_UnsupportedStrategy;
  43539. }
  43540. return transport;
  43541. };
  43542. var strategy_builder_UnsupportedStrategy = {
  43543. isSupported: function () {
  43544. return false;
  43545. },
  43546. connect: function (_, callback) {
  43547. var deferred = util.defer(function () {
  43548. callback(new UnsupportedStrategy());
  43549. });
  43550. return {
  43551. abort: function () {
  43552. deferred.ensureAborted();
  43553. },
  43554. forceMinPriority: function () { }
  43555. };
  43556. }
  43557. };
  43558. // CONCATENATED MODULE: ./src/core/config.ts
  43559. var getGlobalConfig = function () {
  43560. return {
  43561. wsHost: defaults.host,
  43562. wsPort: defaults.ws_port,
  43563. wssPort: defaults.wss_port,
  43564. wsPath: defaults.ws_path,
  43565. httpHost: defaults.sockjs_host,
  43566. httpPort: defaults.sockjs_http_port,
  43567. httpsPort: defaults.sockjs_https_port,
  43568. httpPath: defaults.sockjs_path,
  43569. statsHost: defaults.stats_host,
  43570. authEndpoint: defaults.channel_auth_endpoint,
  43571. authTransport: defaults.channel_auth_transport,
  43572. activity_timeout: defaults.activity_timeout,
  43573. pong_timeout: defaults.pong_timeout,
  43574. unavailable_timeout: defaults.unavailable_timeout
  43575. };
  43576. };
  43577. var getClusterConfig = function (clusterName) {
  43578. return {
  43579. wsHost: 'ws-' + clusterName + '.pusher.com',
  43580. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  43581. };
  43582. };
  43583. // CONCATENATED MODULE: ./src/core/pusher.ts
  43584. var pusher_Pusher = (function () {
  43585. function Pusher(app_key, options) {
  43586. var _this = this;
  43587. checkAppKey(app_key);
  43588. options = options || {};
  43589. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  43590. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  43591. logger.warn("You should always specify a cluster when connecting. " + suffix);
  43592. }
  43593. this.key = app_key;
  43594. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  43595. this.channels = factory.createChannels();
  43596. this.global_emitter = new dispatcher();
  43597. this.sessionID = Math.floor(Math.random() * 1000000000);
  43598. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  43599. cluster: this.config.cluster,
  43600. features: Pusher.getClientFeatures(),
  43601. params: this.config.timelineParams || {},
  43602. limit: 50,
  43603. level: timeline_level.INFO,
  43604. version: defaults.VERSION
  43605. });
  43606. if (!this.config.disableStats) {
  43607. this.timelineSender = factory.createTimelineSender(this.timeline, {
  43608. host: this.config.statsHost,
  43609. path: '/timeline/v2/' + runtime.TimelineTransport.name
  43610. });
  43611. }
  43612. var getStrategy = function (options) {
  43613. var config = extend({}, _this.config, options);
  43614. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  43615. };
  43616. this.connection = factory.createConnectionManager(this.key, extend({
  43617. getStrategy: getStrategy,
  43618. timeline: this.timeline,
  43619. activityTimeout: this.config.activity_timeout,
  43620. pongTimeout: this.config.pong_timeout,
  43621. unavailableTimeout: this.config.unavailable_timeout
  43622. }, this.config, { useTLS: this.shouldUseTLS() }));
  43623. this.connection.bind('connected', function () {
  43624. _this.subscribeAll();
  43625. if (_this.timelineSender) {
  43626. _this.timelineSender.send(_this.connection.isUsingTLS());
  43627. }
  43628. });
  43629. this.connection.bind('message', function (event) {
  43630. var eventName = event.event;
  43631. var internal = eventName.indexOf('pusher_internal:') === 0;
  43632. if (event.channel) {
  43633. var channel = _this.channel(event.channel);
  43634. if (channel) {
  43635. channel.handleEvent(event);
  43636. }
  43637. }
  43638. if (!internal) {
  43639. _this.global_emitter.emit(event.event, event.data);
  43640. }
  43641. });
  43642. this.connection.bind('connecting', function () {
  43643. _this.channels.disconnect();
  43644. });
  43645. this.connection.bind('disconnected', function () {
  43646. _this.channels.disconnect();
  43647. });
  43648. this.connection.bind('error', function (err) {
  43649. logger.warn(err);
  43650. });
  43651. Pusher.instances.push(this);
  43652. this.timeline.info({ instances: Pusher.instances.length });
  43653. if (Pusher.isReady) {
  43654. this.connect();
  43655. }
  43656. }
  43657. Pusher.ready = function () {
  43658. Pusher.isReady = true;
  43659. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  43660. Pusher.instances[i].connect();
  43661. }
  43662. };
  43663. Pusher.getClientFeatures = function () {
  43664. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  43665. return t.isSupported({});
  43666. }));
  43667. };
  43668. Pusher.prototype.channel = function (name) {
  43669. return this.channels.find(name);
  43670. };
  43671. Pusher.prototype.allChannels = function () {
  43672. return this.channels.all();
  43673. };
  43674. Pusher.prototype.connect = function () {
  43675. this.connection.connect();
  43676. if (this.timelineSender) {
  43677. if (!this.timelineSenderTimer) {
  43678. var usingTLS = this.connection.isUsingTLS();
  43679. var timelineSender = this.timelineSender;
  43680. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  43681. timelineSender.send(usingTLS);
  43682. });
  43683. }
  43684. }
  43685. };
  43686. Pusher.prototype.disconnect = function () {
  43687. this.connection.disconnect();
  43688. if (this.timelineSenderTimer) {
  43689. this.timelineSenderTimer.ensureAborted();
  43690. this.timelineSenderTimer = null;
  43691. }
  43692. };
  43693. Pusher.prototype.bind = function (event_name, callback, context) {
  43694. this.global_emitter.bind(event_name, callback, context);
  43695. return this;
  43696. };
  43697. Pusher.prototype.unbind = function (event_name, callback, context) {
  43698. this.global_emitter.unbind(event_name, callback, context);
  43699. return this;
  43700. };
  43701. Pusher.prototype.bind_global = function (callback) {
  43702. this.global_emitter.bind_global(callback);
  43703. return this;
  43704. };
  43705. Pusher.prototype.unbind_global = function (callback) {
  43706. this.global_emitter.unbind_global(callback);
  43707. return this;
  43708. };
  43709. Pusher.prototype.unbind_all = function (callback) {
  43710. this.global_emitter.unbind_all();
  43711. return this;
  43712. };
  43713. Pusher.prototype.subscribeAll = function () {
  43714. var channelName;
  43715. for (channelName in this.channels.channels) {
  43716. if (this.channels.channels.hasOwnProperty(channelName)) {
  43717. this.subscribe(channelName);
  43718. }
  43719. }
  43720. };
  43721. Pusher.prototype.subscribe = function (channel_name) {
  43722. var channel = this.channels.add(channel_name, this);
  43723. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  43724. channel.reinstateSubscription();
  43725. }
  43726. else if (!channel.subscriptionPending &&
  43727. this.connection.state === 'connected') {
  43728. channel.subscribe();
  43729. }
  43730. return channel;
  43731. };
  43732. Pusher.prototype.unsubscribe = function (channel_name) {
  43733. var channel = this.channels.find(channel_name);
  43734. if (channel && channel.subscriptionPending) {
  43735. channel.cancelSubscription();
  43736. }
  43737. else {
  43738. channel = this.channels.remove(channel_name);
  43739. if (channel && this.connection.state === 'connected') {
  43740. channel.unsubscribe();
  43741. }
  43742. }
  43743. };
  43744. Pusher.prototype.send_event = function (event_name, data, channel) {
  43745. return this.connection.send_event(event_name, data, channel);
  43746. };
  43747. Pusher.prototype.shouldUseTLS = function () {
  43748. if (runtime.getProtocol() === 'https:') {
  43749. return true;
  43750. }
  43751. else if (this.config.forceTLS === true) {
  43752. return true;
  43753. }
  43754. else {
  43755. return Boolean(this.config.encrypted);
  43756. }
  43757. };
  43758. Pusher.instances = [];
  43759. Pusher.isReady = false;
  43760. Pusher.logToConsole = false;
  43761. Pusher.Runtime = runtime;
  43762. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  43763. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  43764. Pusher.auth_callbacks = runtime.auth_callbacks;
  43765. return Pusher;
  43766. }());
  43767. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  43768. function checkAppKey(key) {
  43769. if (key === null || key === undefined) {
  43770. throw 'You must pass your app key when you instantiate Pusher.';
  43771. }
  43772. }
  43773. runtime.setup(pusher_Pusher);
  43774. /***/ })
  43775. /******/ ]);
  43776. });
  43777. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  43778. /***/ }),
  43779. /***/ "./node_modules/setimmediate/setImmediate.js":
  43780. /*!***************************************************!*\
  43781. !*** ./node_modules/setimmediate/setImmediate.js ***!
  43782. \***************************************************/
  43783. /*! no static exports found */
  43784. /***/ (function(module, exports, __webpack_require__) {
  43785. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  43786. "use strict";
  43787. if (global.setImmediate) {
  43788. return;
  43789. }
  43790. var nextHandle = 1; // Spec says greater than zero
  43791. var tasksByHandle = {};
  43792. var currentlyRunningATask = false;
  43793. var doc = global.document;
  43794. var registerImmediate;
  43795. function setImmediate(callback) {
  43796. // Callback can either be a function or a string
  43797. if (typeof callback !== "function") {
  43798. callback = new Function("" + callback);
  43799. }
  43800. // Copy function arguments
  43801. var args = new Array(arguments.length - 1);
  43802. for (var i = 0; i < args.length; i++) {
  43803. args[i] = arguments[i + 1];
  43804. }
  43805. // Store and register the task
  43806. var task = { callback: callback, args: args };
  43807. tasksByHandle[nextHandle] = task;
  43808. registerImmediate(nextHandle);
  43809. return nextHandle++;
  43810. }
  43811. function clearImmediate(handle) {
  43812. delete tasksByHandle[handle];
  43813. }
  43814. function run(task) {
  43815. var callback = task.callback;
  43816. var args = task.args;
  43817. switch (args.length) {
  43818. case 0:
  43819. callback();
  43820. break;
  43821. case 1:
  43822. callback(args[0]);
  43823. break;
  43824. case 2:
  43825. callback(args[0], args[1]);
  43826. break;
  43827. case 3:
  43828. callback(args[0], args[1], args[2]);
  43829. break;
  43830. default:
  43831. callback.apply(undefined, args);
  43832. break;
  43833. }
  43834. }
  43835. function runIfPresent(handle) {
  43836. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  43837. // So if we're currently running a task, we'll need to delay this invocation.
  43838. if (currentlyRunningATask) {
  43839. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  43840. // "too much recursion" error.
  43841. setTimeout(runIfPresent, 0, handle);
  43842. } else {
  43843. var task = tasksByHandle[handle];
  43844. if (task) {
  43845. currentlyRunningATask = true;
  43846. try {
  43847. run(task);
  43848. } finally {
  43849. clearImmediate(handle);
  43850. currentlyRunningATask = false;
  43851. }
  43852. }
  43853. }
  43854. }
  43855. function installNextTickImplementation() {
  43856. registerImmediate = function(handle) {
  43857. process.nextTick(function () { runIfPresent(handle); });
  43858. };
  43859. }
  43860. function canUsePostMessage() {
  43861. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  43862. // where `global.postMessage` means something completely different and can't be used for this purpose.
  43863. if (global.postMessage && !global.importScripts) {
  43864. var postMessageIsAsynchronous = true;
  43865. var oldOnMessage = global.onmessage;
  43866. global.onmessage = function() {
  43867. postMessageIsAsynchronous = false;
  43868. };
  43869. global.postMessage("", "*");
  43870. global.onmessage = oldOnMessage;
  43871. return postMessageIsAsynchronous;
  43872. }
  43873. }
  43874. function installPostMessageImplementation() {
  43875. // Installs an event handler on `global` for the `message` event: see
  43876. // * https://developer.mozilla.org/en/DOM/window.postMessage
  43877. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  43878. var messagePrefix = "setImmediate$" + Math.random() + "$";
  43879. var onGlobalMessage = function(event) {
  43880. if (event.source === global &&
  43881. typeof event.data === "string" &&
  43882. event.data.indexOf(messagePrefix) === 0) {
  43883. runIfPresent(+event.data.slice(messagePrefix.length));
  43884. }
  43885. };
  43886. if (global.addEventListener) {
  43887. global.addEventListener("message", onGlobalMessage, false);
  43888. } else {
  43889. global.attachEvent("onmessage", onGlobalMessage);
  43890. }
  43891. registerImmediate = function(handle) {
  43892. global.postMessage(messagePrefix + handle, "*");
  43893. };
  43894. }
  43895. function installMessageChannelImplementation() {
  43896. var channel = new MessageChannel();
  43897. channel.port1.onmessage = function(event) {
  43898. var handle = event.data;
  43899. runIfPresent(handle);
  43900. };
  43901. registerImmediate = function(handle) {
  43902. channel.port2.postMessage(handle);
  43903. };
  43904. }
  43905. function installReadyStateChangeImplementation() {
  43906. var html = doc.documentElement;
  43907. registerImmediate = function(handle) {
  43908. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  43909. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  43910. var script = doc.createElement("script");
  43911. script.onreadystatechange = function () {
  43912. runIfPresent(handle);
  43913. script.onreadystatechange = null;
  43914. html.removeChild(script);
  43915. script = null;
  43916. };
  43917. html.appendChild(script);
  43918. };
  43919. }
  43920. function installSetTimeoutImplementation() {
  43921. registerImmediate = function(handle) {
  43922. setTimeout(runIfPresent, 0, handle);
  43923. };
  43924. }
  43925. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43926. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43927. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43928. // Don't get fooled by e.g. browserify environments.
  43929. if ({}.toString.call(global.process) === "[object process]") {
  43930. // For Node.js before 0.9
  43931. installNextTickImplementation();
  43932. } else if (canUsePostMessage()) {
  43933. // For non-IE10 modern browsers
  43934. installPostMessageImplementation();
  43935. } else if (global.MessageChannel) {
  43936. // For web workers, where supported
  43937. installMessageChannelImplementation();
  43938. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43939. // For IE 6–8
  43940. installReadyStateChangeImplementation();
  43941. } else {
  43942. // For older browsers
  43943. installSetTimeoutImplementation();
  43944. }
  43945. attachTo.setImmediate = setImmediate;
  43946. attachTo.clearImmediate = clearImmediate;
  43947. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43948. /* 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")))
  43949. /***/ }),
  43950. /***/ "./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&":
  43951. /*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43952. !*** ./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& ***!
  43953. \***********************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43954. /*! no static exports found */
  43955. /***/ (function(module, exports, __webpack_require__) {
  43956. 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&");
  43957. if(typeof content === 'string') content = [[module.i, content, '']];
  43958. var transform;
  43959. var insertInto;
  43960. var options = {"hmr":true}
  43961. options.transform = transform
  43962. options.insertInto = undefined;
  43963. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43964. if(content.locals) module.exports = content.locals;
  43965. if(false) {}
  43966. /***/ }),
  43967. /***/ "./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&":
  43968. /*!************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43969. !*** ./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& ***!
  43970. \************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43971. /*! no static exports found */
  43972. /***/ (function(module, exports, __webpack_require__) {
  43973. 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&");
  43974. if(typeof content === 'string') content = [[module.i, content, '']];
  43975. var transform;
  43976. var insertInto;
  43977. var options = {"hmr":true}
  43978. options.transform = transform
  43979. options.insertInto = undefined;
  43980. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43981. if(content.locals) module.exports = content.locals;
  43982. if(false) {}
  43983. /***/ }),
  43984. /***/ "./node_modules/style-loader/lib/addStyles.js":
  43985. /*!****************************************************!*\
  43986. !*** ./node_modules/style-loader/lib/addStyles.js ***!
  43987. \****************************************************/
  43988. /*! no static exports found */
  43989. /***/ (function(module, exports, __webpack_require__) {
  43990. /*
  43991. MIT License http://www.opensource.org/licenses/mit-license.php
  43992. Author Tobias Koppers @sokra
  43993. */
  43994. var stylesInDom = {};
  43995. var memoize = function (fn) {
  43996. var memo;
  43997. return function () {
  43998. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  43999. return memo;
  44000. };
  44001. };
  44002. var isOldIE = memoize(function () {
  44003. // Test for IE <= 9 as proposed by Browserhacks
  44004. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  44005. // Tests for existence of standard globals is to allow style-loader
  44006. // to operate correctly into non-standard environments
  44007. // @see https://github.com/webpack-contrib/style-loader/issues/177
  44008. return window && document && document.all && !window.atob;
  44009. });
  44010. var getTarget = function (target, parent) {
  44011. if (parent){
  44012. return parent.querySelector(target);
  44013. }
  44014. return document.querySelector(target);
  44015. };
  44016. var getElement = (function (fn) {
  44017. var memo = {};
  44018. return function(target, parent) {
  44019. // If passing function in options, then use it for resolve "head" element.
  44020. // Useful for Shadow Root style i.e
  44021. // {
  44022. // insertInto: function () { return document.querySelector("#foo").shadowRoot }
  44023. // }
  44024. if (typeof target === 'function') {
  44025. return target();
  44026. }
  44027. if (typeof memo[target] === "undefined") {
  44028. var styleTarget = getTarget.call(this, target, parent);
  44029. // Special case to return head of iframe instead of iframe itself
  44030. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  44031. try {
  44032. // This will throw an exception if access to iframe is blocked
  44033. // due to cross-origin restrictions
  44034. styleTarget = styleTarget.contentDocument.head;
  44035. } catch(e) {
  44036. styleTarget = null;
  44037. }
  44038. }
  44039. memo[target] = styleTarget;
  44040. }
  44041. return memo[target]
  44042. };
  44043. })();
  44044. var singleton = null;
  44045. var singletonCounter = 0;
  44046. var stylesInsertedAtTop = [];
  44047. var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js");
  44048. module.exports = function(list, options) {
  44049. if (typeof DEBUG !== "undefined" && DEBUG) {
  44050. if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  44051. }
  44052. options = options || {};
  44053. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  44054. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  44055. // tags it will allow on a page
  44056. if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
  44057. // By default, add <style> tags to the <head> element
  44058. if (!options.insertInto) options.insertInto = "head";
  44059. // By default, add <style> tags to the bottom of the target
  44060. if (!options.insertAt) options.insertAt = "bottom";
  44061. var styles = listToStyles(list, options);
  44062. addStylesToDom(styles, options);
  44063. return function update (newList) {
  44064. var mayRemove = [];
  44065. for (var i = 0; i < styles.length; i++) {
  44066. var item = styles[i];
  44067. var domStyle = stylesInDom[item.id];
  44068. domStyle.refs--;
  44069. mayRemove.push(domStyle);
  44070. }
  44071. if(newList) {
  44072. var newStyles = listToStyles(newList, options);
  44073. addStylesToDom(newStyles, options);
  44074. }
  44075. for (var i = 0; i < mayRemove.length; i++) {
  44076. var domStyle = mayRemove[i];
  44077. if(domStyle.refs === 0) {
  44078. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
  44079. delete stylesInDom[domStyle.id];
  44080. }
  44081. }
  44082. };
  44083. };
  44084. function addStylesToDom (styles, options) {
  44085. for (var i = 0; i < styles.length; i++) {
  44086. var item = styles[i];
  44087. var domStyle = stylesInDom[item.id];
  44088. if(domStyle) {
  44089. domStyle.refs++;
  44090. for(var j = 0; j < domStyle.parts.length; j++) {
  44091. domStyle.parts[j](item.parts[j]);
  44092. }
  44093. for(; j < item.parts.length; j++) {
  44094. domStyle.parts.push(addStyle(item.parts[j], options));
  44095. }
  44096. } else {
  44097. var parts = [];
  44098. for(var j = 0; j < item.parts.length; j++) {
  44099. parts.push(addStyle(item.parts[j], options));
  44100. }
  44101. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  44102. }
  44103. }
  44104. }
  44105. function listToStyles (list, options) {
  44106. var styles = [];
  44107. var newStyles = {};
  44108. for (var i = 0; i < list.length; i++) {
  44109. var item = list[i];
  44110. var id = options.base ? item[0] + options.base : item[0];
  44111. var css = item[1];
  44112. var media = item[2];
  44113. var sourceMap = item[3];
  44114. var part = {css: css, media: media, sourceMap: sourceMap};
  44115. if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
  44116. else newStyles[id].parts.push(part);
  44117. }
  44118. return styles;
  44119. }
  44120. function insertStyleElement (options, style) {
  44121. var target = getElement(options.insertInto)
  44122. if (!target) {
  44123. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  44124. }
  44125. var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
  44126. if (options.insertAt === "top") {
  44127. if (!lastStyleElementInsertedAtTop) {
  44128. target.insertBefore(style, target.firstChild);
  44129. } else if (lastStyleElementInsertedAtTop.nextSibling) {
  44130. target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
  44131. } else {
  44132. target.appendChild(style);
  44133. }
  44134. stylesInsertedAtTop.push(style);
  44135. } else if (options.insertAt === "bottom") {
  44136. target.appendChild(style);
  44137. } else if (typeof options.insertAt === "object" && options.insertAt.before) {
  44138. var nextSibling = getElement(options.insertAt.before, target);
  44139. target.insertBefore(style, nextSibling);
  44140. } else {
  44141. 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");
  44142. }
  44143. }
  44144. function removeStyleElement (style) {
  44145. if (style.parentNode === null) return false;
  44146. style.parentNode.removeChild(style);
  44147. var idx = stylesInsertedAtTop.indexOf(style);
  44148. if(idx >= 0) {
  44149. stylesInsertedAtTop.splice(idx, 1);
  44150. }
  44151. }
  44152. function createStyleElement (options) {
  44153. var style = document.createElement("style");
  44154. if(options.attrs.type === undefined) {
  44155. options.attrs.type = "text/css";
  44156. }
  44157. if(options.attrs.nonce === undefined) {
  44158. var nonce = getNonce();
  44159. if (nonce) {
  44160. options.attrs.nonce = nonce;
  44161. }
  44162. }
  44163. addAttrs(style, options.attrs);
  44164. insertStyleElement(options, style);
  44165. return style;
  44166. }
  44167. function createLinkElement (options) {
  44168. var link = document.createElement("link");
  44169. if(options.attrs.type === undefined) {
  44170. options.attrs.type = "text/css";
  44171. }
  44172. options.attrs.rel = "stylesheet";
  44173. addAttrs(link, options.attrs);
  44174. insertStyleElement(options, link);
  44175. return link;
  44176. }
  44177. function addAttrs (el, attrs) {
  44178. Object.keys(attrs).forEach(function (key) {
  44179. el.setAttribute(key, attrs[key]);
  44180. });
  44181. }
  44182. function getNonce() {
  44183. if (false) {}
  44184. return __webpack_require__.nc;
  44185. }
  44186. function addStyle (obj, options) {
  44187. var style, update, remove, result;
  44188. // If a transform function was defined, run it on the css
  44189. if (options.transform && obj.css) {
  44190. result = typeof options.transform === 'function'
  44191. ? options.transform(obj.css)
  44192. : options.transform.default(obj.css);
  44193. if (result) {
  44194. // If transform returns a value, use that instead of the original css.
  44195. // This allows running runtime transformations on the css.
  44196. obj.css = result;
  44197. } else {
  44198. // If the transform function returns a falsy value, don't add this css.
  44199. // This allows conditional loading of css
  44200. return function() {
  44201. // noop
  44202. };
  44203. }
  44204. }
  44205. if (options.singleton) {
  44206. var styleIndex = singletonCounter++;
  44207. style = singleton || (singleton = createStyleElement(options));
  44208. update = applyToSingletonTag.bind(null, style, styleIndex, false);
  44209. remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  44210. } else if (
  44211. obj.sourceMap &&
  44212. typeof URL === "function" &&
  44213. typeof URL.createObjectURL === "function" &&
  44214. typeof URL.revokeObjectURL === "function" &&
  44215. typeof Blob === "function" &&
  44216. typeof btoa === "function"
  44217. ) {
  44218. style = createLinkElement(options);
  44219. update = updateLink.bind(null, style, options);
  44220. remove = function () {
  44221. removeStyleElement(style);
  44222. if(style.href) URL.revokeObjectURL(style.href);
  44223. };
  44224. } else {
  44225. style = createStyleElement(options);
  44226. update = applyToTag.bind(null, style);
  44227. remove = function () {
  44228. removeStyleElement(style);
  44229. };
  44230. }
  44231. update(obj);
  44232. return function updateStyle (newObj) {
  44233. if (newObj) {
  44234. if (
  44235. newObj.css === obj.css &&
  44236. newObj.media === obj.media &&
  44237. newObj.sourceMap === obj.sourceMap
  44238. ) {
  44239. return;
  44240. }
  44241. update(obj = newObj);
  44242. } else {
  44243. remove();
  44244. }
  44245. };
  44246. }
  44247. var replaceText = (function () {
  44248. var textStore = [];
  44249. return function (index, replacement) {
  44250. textStore[index] = replacement;
  44251. return textStore.filter(Boolean).join('\n');
  44252. };
  44253. })();
  44254. function applyToSingletonTag (style, index, remove, obj) {
  44255. var css = remove ? "" : obj.css;
  44256. if (style.styleSheet) {
  44257. style.styleSheet.cssText = replaceText(index, css);
  44258. } else {
  44259. var cssNode = document.createTextNode(css);
  44260. var childNodes = style.childNodes;
  44261. if (childNodes[index]) style.removeChild(childNodes[index]);
  44262. if (childNodes.length) {
  44263. style.insertBefore(cssNode, childNodes[index]);
  44264. } else {
  44265. style.appendChild(cssNode);
  44266. }
  44267. }
  44268. }
  44269. function applyToTag (style, obj) {
  44270. var css = obj.css;
  44271. var media = obj.media;
  44272. if(media) {
  44273. style.setAttribute("media", media)
  44274. }
  44275. if(style.styleSheet) {
  44276. style.styleSheet.cssText = css;
  44277. } else {
  44278. while(style.firstChild) {
  44279. style.removeChild(style.firstChild);
  44280. }
  44281. style.appendChild(document.createTextNode(css));
  44282. }
  44283. }
  44284. function updateLink (link, options, obj) {
  44285. var css = obj.css;
  44286. var sourceMap = obj.sourceMap;
  44287. /*
  44288. If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  44289. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  44290. on by default. Otherwise default to the convertToAbsoluteUrls option
  44291. directly
  44292. */
  44293. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  44294. if (options.convertToAbsoluteUrls || autoFixUrls) {
  44295. css = fixUrls(css);
  44296. }
  44297. if (sourceMap) {
  44298. // http://stackoverflow.com/a/26603875
  44299. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  44300. }
  44301. var blob = new Blob([css], { type: "text/css" });
  44302. var oldSrc = link.href;
  44303. link.href = URL.createObjectURL(blob);
  44304. if(oldSrc) URL.revokeObjectURL(oldSrc);
  44305. }
  44306. /***/ }),
  44307. /***/ "./node_modules/style-loader/lib/urls.js":
  44308. /*!***********************************************!*\
  44309. !*** ./node_modules/style-loader/lib/urls.js ***!
  44310. \***********************************************/
  44311. /*! no static exports found */
  44312. /***/ (function(module, exports) {
  44313. /**
  44314. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  44315. * embed the css on the page. This breaks all relative urls because now they are relative to a
  44316. * bundle instead of the current page.
  44317. *
  44318. * One solution is to only use full urls, but that may be impossible.
  44319. *
  44320. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  44321. *
  44322. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  44323. *
  44324. */
  44325. module.exports = function (css) {
  44326. // get current location
  44327. var location = typeof window !== "undefined" && window.location;
  44328. if (!location) {
  44329. throw new Error("fixUrls requires window.location");
  44330. }
  44331. // blank or null?
  44332. if (!css || typeof css !== "string") {
  44333. return css;
  44334. }
  44335. var baseUrl = location.protocol + "//" + location.host;
  44336. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  44337. // convert each url(...)
  44338. /*
  44339. This regular expression is just a way to recursively match brackets within
  44340. a string.
  44341. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  44342. ( = Start a capturing group
  44343. (?: = Start a non-capturing group
  44344. [^)(] = Match anything that isn't a parentheses
  44345. | = OR
  44346. \( = Match a start parentheses
  44347. (?: = Start another non-capturing groups
  44348. [^)(]+ = Match anything that isn't a parentheses
  44349. | = OR
  44350. \( = Match a start parentheses
  44351. [^)(]* = Match anything that isn't a parentheses
  44352. \) = Match a end parentheses
  44353. ) = End Group
  44354. *\) = Match anything and then a close parens
  44355. ) = Close non-capturing group
  44356. * = Match anything
  44357. ) = Close capturing group
  44358. \) = Match a close parens
  44359. /gi = Get all matches, not the first. Be case insensitive.
  44360. */
  44361. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  44362. // strip quotes (if they exist)
  44363. var unquotedOrigUrl = origUrl
  44364. .trim()
  44365. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  44366. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  44367. // already a full url? no change
  44368. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
  44369. return fullMatch;
  44370. }
  44371. // convert the url to a full url
  44372. var newUrl;
  44373. if (unquotedOrigUrl.indexOf("//") === 0) {
  44374. //TODO: should we add protocol?
  44375. newUrl = unquotedOrigUrl;
  44376. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  44377. // path should be relative to the base url
  44378. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  44379. } else {
  44380. // path should be relative to current directory
  44381. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  44382. }
  44383. // send back the fixed url(...)
  44384. return "url(" + JSON.stringify(newUrl) + ")";
  44385. });
  44386. // send back the fixed css
  44387. return fixedCss;
  44388. };
  44389. /***/ }),
  44390. /***/ "./node_modules/timers-browserify/main.js":
  44391. /*!************************************************!*\
  44392. !*** ./node_modules/timers-browserify/main.js ***!
  44393. \************************************************/
  44394. /*! no static exports found */
  44395. /***/ (function(module, exports, __webpack_require__) {
  44396. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  44397. (typeof self !== "undefined" && self) ||
  44398. window;
  44399. var apply = Function.prototype.apply;
  44400. // DOM APIs, for completeness
  44401. exports.setTimeout = function() {
  44402. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  44403. };
  44404. exports.setInterval = function() {
  44405. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  44406. };
  44407. exports.clearTimeout =
  44408. exports.clearInterval = function(timeout) {
  44409. if (timeout) {
  44410. timeout.close();
  44411. }
  44412. };
  44413. function Timeout(id, clearFn) {
  44414. this._id = id;
  44415. this._clearFn = clearFn;
  44416. }
  44417. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  44418. Timeout.prototype.close = function() {
  44419. this._clearFn.call(scope, this._id);
  44420. };
  44421. // Does not start the time, just sets up the members needed.
  44422. exports.enroll = function(item, msecs) {
  44423. clearTimeout(item._idleTimeoutId);
  44424. item._idleTimeout = msecs;
  44425. };
  44426. exports.unenroll = function(item) {
  44427. clearTimeout(item._idleTimeoutId);
  44428. item._idleTimeout = -1;
  44429. };
  44430. exports._unrefActive = exports.active = function(item) {
  44431. clearTimeout(item._idleTimeoutId);
  44432. var msecs = item._idleTimeout;
  44433. if (msecs >= 0) {
  44434. item._idleTimeoutId = setTimeout(function onTimeout() {
  44435. if (item._onTimeout)
  44436. item._onTimeout();
  44437. }, msecs);
  44438. }
  44439. };
  44440. // setimmediate attaches itself to the global object
  44441. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  44442. // On some exotic environments, it's not clear which object `setimmediate` was
  44443. // able to install onto. Search each possibility in the same order as the
  44444. // `setimmediate` library.
  44445. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  44446. (typeof global !== "undefined" && global.setImmediate) ||
  44447. (this && this.setImmediate);
  44448. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  44449. (typeof global !== "undefined" && global.clearImmediate) ||
  44450. (this && this.clearImmediate);
  44451. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  44452. /***/ }),
  44453. /***/ "./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&":
  44454. /*!************************************************************************************************************************************************************************************************************!*\
  44455. !*** ./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& ***!
  44456. \************************************************************************************************************************************************************************************************************/
  44457. /*! exports provided: render, staticRenderFns */
  44458. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44459. "use strict";
  44460. __webpack_require__.r(__webpack_exports__);
  44461. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44462. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44463. var render = function() {
  44464. var _vm = this
  44465. var _h = _vm.$createElement
  44466. var _c = _vm._self._c || _h
  44467. return _c(
  44468. "div",
  44469. [
  44470. _c("asset-info-edit-modal", {
  44471. attrs: {
  44472. "modal-id": "asset" + _vm.asset.pcid + "editModal",
  44473. "populate-with": _vm.asset
  44474. }
  44475. }),
  44476. _vm._v(" "),
  44477. _c("h4", { staticClass: "text-center" }, [
  44478. _vm._v(
  44479. _vm._s(this.asset.pcmanu) + " " + _vm._s(this.asset.pcmake) + " - "
  44480. ),
  44481. _c("small", { staticClass: "text-muted" }, [
  44482. _vm._v(_vm._s(this.asset.pcnickname))
  44483. ])
  44484. ]),
  44485. _vm._v(" "),
  44486. _c("p", [_vm._v("OS: " + _vm._s(this.asset.pcextra[2]))]),
  44487. _vm._v(" "),
  44488. _c("p", [_vm._v("S/N: " + _vm._s(this.asset.pcextra[104]))]),
  44489. _vm._v(" "),
  44490. _c("p", [_vm._v("CPU: " + _vm._s(this.asset.pcextra[101]))]),
  44491. _vm._v(" "),
  44492. _c("p", [_vm._v("RAM: " + _vm._s(this.asset.pcextra[100]))]),
  44493. _vm._v(" "),
  44494. _c("p", [_vm._v("Graphics: " + _vm._s(this.asset.pcextra[4]))]),
  44495. _vm._v(" "),
  44496. _c(
  44497. "button",
  44498. {
  44499. staticClass: "btn btn-primary",
  44500. attrs: {
  44501. type: "button",
  44502. "data-toggle": "modal",
  44503. "data-target": "#asset" + _vm.asset.pcid + "editModal"
  44504. }
  44505. },
  44506. [_vm._v("Edit")]
  44507. )
  44508. ],
  44509. 1
  44510. )
  44511. }
  44512. var staticRenderFns = []
  44513. render._withStripped = true
  44514. /***/ }),
  44515. /***/ "./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&":
  44516. /*!*********************************************************************************************************************************************************************************************************************!*\
  44517. !*** ./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& ***!
  44518. \*********************************************************************************************************************************************************************************************************************/
  44519. /*! exports provided: render, staticRenderFns */
  44520. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44521. "use strict";
  44522. __webpack_require__.r(__webpack_exports__);
  44523. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44524. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44525. var render = function() {
  44526. var _vm = this
  44527. var _h = _vm.$createElement
  44528. var _c = _vm._self._c || _h
  44529. return _c(
  44530. "modal",
  44531. {
  44532. attrs: {
  44533. id: _vm.modalId,
  44534. tabindex: "-1",
  44535. role: "dialog",
  44536. "aria-labelledby": _vm.modalId + "Label"
  44537. }
  44538. },
  44539. [
  44540. _c(
  44541. "h5",
  44542. {
  44543. staticClass: "modal-title",
  44544. attrs: { slot: "header", id: _vm.modalId + "Label" },
  44545. slot: "header"
  44546. },
  44547. [_vm._v("\n Edit Work Order Information\n ")]
  44548. ),
  44549. _vm._v(" "),
  44550. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44551. _c("div", { staticClass: "form-group" }, [
  44552. _c("label", { attrs: { for: "manufacturer" } }, [
  44553. _vm._v("Manufacturer")
  44554. ]),
  44555. _vm._v(" "),
  44556. _c("input", {
  44557. directives: [
  44558. {
  44559. name: "model",
  44560. rawName: "v-model",
  44561. value: _vm.asset.pcmanu,
  44562. expression: "asset.pcmanu"
  44563. }
  44564. ],
  44565. staticClass: "form-control",
  44566. attrs: { type: "text", name: "manufacturer", id: "manufacturer" },
  44567. domProps: { value: _vm.asset.pcmanu },
  44568. on: {
  44569. input: function($event) {
  44570. if ($event.target.composing) {
  44571. return
  44572. }
  44573. _vm.$set(_vm.asset, "pcmanu", $event.target.value)
  44574. }
  44575. }
  44576. })
  44577. ]),
  44578. _vm._v(" "),
  44579. _c("div", { staticClass: "form-group" }, [
  44580. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  44581. _vm._v(" "),
  44582. _c("input", {
  44583. directives: [
  44584. {
  44585. name: "model",
  44586. rawName: "v-model",
  44587. value: _vm.asset.pcmake,
  44588. expression: "asset.pcmake"
  44589. }
  44590. ],
  44591. staticClass: "form-control",
  44592. attrs: { type: "text", name: "make", id: "make" },
  44593. domProps: { value: _vm.asset.pcmake },
  44594. on: {
  44595. input: function($event) {
  44596. if ($event.target.composing) {
  44597. return
  44598. }
  44599. _vm.$set(_vm.asset, "pcmake", $event.target.value)
  44600. }
  44601. }
  44602. })
  44603. ]),
  44604. _vm._v(" "),
  44605. _c("div", { staticClass: "form-group" }, [
  44606. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  44607. _vm._v(" "),
  44608. _c("input", {
  44609. directives: [
  44610. {
  44611. name: "model",
  44612. rawName: "v-model",
  44613. value: _vm.asset.pcnickname,
  44614. expression: "asset.pcnickname"
  44615. }
  44616. ],
  44617. staticClass: "form-control",
  44618. attrs: { type: "text", name: "nickname", id: "nickname" },
  44619. domProps: { value: _vm.asset.pcnickname },
  44620. on: {
  44621. input: function($event) {
  44622. if ($event.target.composing) {
  44623. return
  44624. }
  44625. _vm.$set(_vm.asset, "pcnickname", $event.target.value)
  44626. }
  44627. }
  44628. })
  44629. ]),
  44630. _vm._v(" "),
  44631. _c("div", { staticClass: "form-group" }, [
  44632. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  44633. _vm._v(" "),
  44634. _c("input", {
  44635. directives: [
  44636. {
  44637. name: "model",
  44638. rawName: "v-model",
  44639. value: _vm.asset.pcextra[2],
  44640. expression: "asset.pcextra[2]"
  44641. }
  44642. ],
  44643. staticClass: "form-control",
  44644. attrs: { type: "text", name: "os", id: "os" },
  44645. domProps: { value: _vm.asset.pcextra[2] },
  44646. on: {
  44647. input: function($event) {
  44648. if ($event.target.composing) {
  44649. return
  44650. }
  44651. _vm.$set(_vm.asset.pcextra, 2, $event.target.value)
  44652. }
  44653. }
  44654. })
  44655. ]),
  44656. _vm._v(" "),
  44657. _c("div", { staticClass: "form-group" }, [
  44658. _c("label", { attrs: { for: "serial" } }, [_vm._v("Serial Number")]),
  44659. _vm._v(" "),
  44660. _c("input", {
  44661. directives: [
  44662. {
  44663. name: "model",
  44664. rawName: "v-model",
  44665. value: _vm.asset.pcextra[104],
  44666. expression: "asset.pcextra[104]"
  44667. }
  44668. ],
  44669. staticClass: "form-control",
  44670. attrs: { type: "text", id: "serial", name: "serial" },
  44671. domProps: { value: _vm.asset.pcextra[104] },
  44672. on: {
  44673. input: function($event) {
  44674. if ($event.target.composing) {
  44675. return
  44676. }
  44677. _vm.$set(_vm.asset.pcextra, 104, $event.target.value)
  44678. }
  44679. }
  44680. })
  44681. ]),
  44682. _vm._v(" "),
  44683. _c("div", { staticClass: "form-group" }, [
  44684. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  44685. _vm._v(" "),
  44686. _c("input", {
  44687. directives: [
  44688. {
  44689. name: "model",
  44690. rawName: "v-model",
  44691. value: _vm.asset.pcextra[101],
  44692. expression: "asset.pcextra[101]"
  44693. }
  44694. ],
  44695. staticClass: "form-control",
  44696. attrs: { type: "text", id: "cpu", name: "cpu" },
  44697. domProps: { value: _vm.asset.pcextra[101] },
  44698. on: {
  44699. input: function($event) {
  44700. if ($event.target.composing) {
  44701. return
  44702. }
  44703. _vm.$set(_vm.asset.pcextra, 101, $event.target.value)
  44704. }
  44705. }
  44706. })
  44707. ]),
  44708. _vm._v(" "),
  44709. _c("div", { staticClass: "form-group" }, [
  44710. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  44711. _vm._v(" "),
  44712. _c("input", {
  44713. directives: [
  44714. {
  44715. name: "model",
  44716. rawName: "v-model",
  44717. value: _vm.asset.pcextra[100],
  44718. expression: "asset.pcextra[100]"
  44719. }
  44720. ],
  44721. staticClass: "form-control",
  44722. attrs: { type: "text", name: "ram", id: "ram" },
  44723. domProps: { value: _vm.asset.pcextra[100] },
  44724. on: {
  44725. input: function($event) {
  44726. if ($event.target.composing) {
  44727. return
  44728. }
  44729. _vm.$set(_vm.asset.pcextra, 100, $event.target.value)
  44730. }
  44731. }
  44732. })
  44733. ]),
  44734. _vm._v(" "),
  44735. _c("div", { staticClass: "form-group" }, [
  44736. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  44737. _vm._v(" "),
  44738. _c("input", {
  44739. directives: [
  44740. {
  44741. name: "model",
  44742. rawName: "v-model",
  44743. value: _vm.asset.pcextra[4],
  44744. expression: "asset.pcextra[4]"
  44745. }
  44746. ],
  44747. staticClass: "form-control",
  44748. attrs: { type: "text", name: "graphics", id: "grapics" },
  44749. domProps: { value: _vm.asset.pcextra[4] },
  44750. on: {
  44751. input: function($event) {
  44752. if ($event.target.composing) {
  44753. return
  44754. }
  44755. _vm.$set(_vm.asset.pcextra, 4, $event.target.value)
  44756. }
  44757. }
  44758. })
  44759. ])
  44760. ]),
  44761. _vm._v(" "),
  44762. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44763. _c(
  44764. "button",
  44765. {
  44766. staticClass: "btn btn-secondary",
  44767. attrs: { type: "button", "data-dismiss": "modal" }
  44768. },
  44769. [_vm._v("Close")]
  44770. ),
  44771. _vm._v(" "),
  44772. _c(
  44773. "button",
  44774. {
  44775. staticClass: "btn btn-primary",
  44776. attrs: { type: "button" },
  44777. on: {
  44778. click: function($event) {
  44779. return _vm.updateAsset()
  44780. }
  44781. }
  44782. },
  44783. [
  44784. !_vm.assetSaving
  44785. ? _c("div", [_vm._v("Save")])
  44786. : _c("circle-spinner", { attrs: { size: 2 } })
  44787. ],
  44788. 1
  44789. )
  44790. ])
  44791. ]
  44792. )
  44793. }
  44794. var staticRenderFns = []
  44795. render._withStripped = true
  44796. /***/ }),
  44797. /***/ "./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&":
  44798. /*!*****************************************************************************************************************************************************************************************************************************!*\
  44799. !*** ./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& ***!
  44800. \*****************************************************************************************************************************************************************************************************************************/
  44801. /*! exports provided: render, staticRenderFns */
  44802. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44803. "use strict";
  44804. __webpack_require__.r(__webpack_exports__);
  44805. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44806. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44807. var render = function() {
  44808. var _vm = this
  44809. var _h = _vm.$createElement
  44810. var _c = _vm._self._c || _h
  44811. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  44812. _c("div", { staticClass: "input-group" }, [
  44813. _c("input", {
  44814. directives: [
  44815. {
  44816. name: "model",
  44817. rawName: "v-model",
  44818. value: _vm.searchText,
  44819. expression: "searchText"
  44820. }
  44821. ],
  44822. staticClass: "form-control",
  44823. attrs: { type: "text" },
  44824. domProps: { value: _vm.searchText },
  44825. on: {
  44826. input: [
  44827. function($event) {
  44828. if ($event.target.composing) {
  44829. return
  44830. }
  44831. _vm.searchText = $event.target.value
  44832. },
  44833. _vm.searchChanged
  44834. ]
  44835. }
  44836. }),
  44837. _vm._v(" "),
  44838. _c("div", { staticClass: "form-group-append" }, [
  44839. _c(
  44840. "a",
  44841. {
  44842. staticClass: "toggle input-group-text bg-primary text-light",
  44843. on: {
  44844. mousedown: function($event) {
  44845. $event.preventDefault()
  44846. },
  44847. click: function($event) {
  44848. return _vm.setOpen(!_vm.open)
  44849. }
  44850. }
  44851. },
  44852. [
  44853. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  44854. _vm._v(" "),
  44855. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  44856. ]
  44857. )
  44858. ])
  44859. ]),
  44860. _vm._v(" "),
  44861. _c(
  44862. "ul",
  44863. { staticClass: "suggestion-list list-unstyled" },
  44864. _vm._l(_vm.matches, function(suggestion, index) {
  44865. return _c(
  44866. "li",
  44867. {
  44868. key: index,
  44869. on: {
  44870. mousedown: function($event) {
  44871. $event.preventDefault()
  44872. },
  44873. click: function($event) {
  44874. return _vm.suggestionSelected(suggestion)
  44875. }
  44876. }
  44877. },
  44878. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  44879. )
  44880. }),
  44881. 0
  44882. )
  44883. ])
  44884. }
  44885. var staticRenderFns = []
  44886. render._withStripped = true
  44887. /***/ }),
  44888. /***/ "./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&":
  44889. /*!****************************************************************************************************************************************************************************************************************************!*\
  44890. !*** ./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& ***!
  44891. \****************************************************************************************************************************************************************************************************************************/
  44892. /*! exports provided: render, staticRenderFns */
  44893. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44894. "use strict";
  44895. __webpack_require__.r(__webpack_exports__);
  44896. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44897. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44898. var render = function() {
  44899. var _vm = this
  44900. var _h = _vm.$createElement
  44901. var _c = _vm._self._c || _h
  44902. return _c(
  44903. "div",
  44904. {
  44905. staticClass: "loader",
  44906. style: {
  44907. fontSize: _vm.size + "px",
  44908. borderLeft: "1.1em solid " + _vm.color
  44909. }
  44910. },
  44911. [_vm._v("Loading...")]
  44912. )
  44913. }
  44914. var staticRenderFns = []
  44915. render._withStripped = true
  44916. /***/ }),
  44917. /***/ "./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&":
  44918. /*!*************************************************************************************************************************************************************************************************************!*\
  44919. !*** ./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& ***!
  44920. \*************************************************************************************************************************************************************************************************************/
  44921. /*! exports provided: render, staticRenderFns */
  44922. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44923. "use strict";
  44924. __webpack_require__.r(__webpack_exports__);
  44925. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44926. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44927. var render = function() {
  44928. var _vm = this
  44929. var _h = _vm.$createElement
  44930. var _c = _vm._self._c || _h
  44931. return _c(
  44932. "div",
  44933. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  44934. [
  44935. _c("credential-form-modal", {
  44936. attrs: {
  44937. descriptions: _vm.creddescList,
  44938. "modal-id": "credential" + this.data.credid + "editModal",
  44939. populateWith: this.data
  44940. }
  44941. }),
  44942. _vm._v(" "),
  44943. _c(
  44944. "modal",
  44945. {
  44946. attrs: {
  44947. id: "credential" + this.data.credid + "deleteModal",
  44948. tabindex: "-1"
  44949. }
  44950. },
  44951. [
  44952. _c(
  44953. "h5",
  44954. {
  44955. staticClass: "modal-title",
  44956. attrs: {
  44957. slot: "header",
  44958. id: "credential" + this.data.credid + "deleteModalLabel"
  44959. },
  44960. slot: "header"
  44961. },
  44962. [_vm._v("\r\n Delete Credential\r\n ")]
  44963. ),
  44964. _vm._v(" "),
  44965. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44966. _vm._v("\r\n Are you sure?\r\n ")
  44967. ]),
  44968. _vm._v(" "),
  44969. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44970. _c(
  44971. "button",
  44972. {
  44973. staticClass: "btn btn-secondary",
  44974. attrs: { type: "button", "data-dismiss": "modal" }
  44975. },
  44976. [_vm._v("Cancel")]
  44977. ),
  44978. _vm._v(" "),
  44979. _c(
  44980. "button",
  44981. {
  44982. staticClass: "btn btn-danger",
  44983. attrs: { type: "button" },
  44984. on: {
  44985. click: function($event) {
  44986. return _vm.deleteCredential()
  44987. }
  44988. }
  44989. },
  44990. [
  44991. !_vm.credentialDeleting
  44992. ? _c("div", [_vm._v("Confirm")])
  44993. : _c("circle-spinner", { attrs: { size: 2 } })
  44994. ],
  44995. 1
  44996. )
  44997. ])
  44998. ]
  44999. ),
  45000. _vm._v(" "),
  45001. _c("div", { staticClass: "row no-gutters" }, [
  45002. _c("div", { staticClass: "h5 col-3 text-left" }, [
  45003. _vm._v(_vm._s(this.data.creddesc))
  45004. ]),
  45005. _vm._v(" "),
  45006. _c("div", { staticClass: "col-9 text-right" }, [
  45007. _vm._v(_vm._s(this.data.creddate))
  45008. ])
  45009. ]),
  45010. _vm._v(" "),
  45011. _c("div", { staticClass: "row" }, [
  45012. _c("div", { staticClass: "col-lg-9" }, [
  45013. _c("div", [
  45014. _vm._m(0),
  45015. _vm._v(" "),
  45016. _c("input", {
  45017. staticClass: "border-0 credential",
  45018. attrs: {
  45019. type: "text",
  45020. id: "username" + this.data.credid,
  45021. readonly: ""
  45022. },
  45023. domProps: { value: this.data.creduser }
  45024. }),
  45025. _vm._v(" "),
  45026. _c(
  45027. "button",
  45028. {
  45029. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  45030. attrs: {
  45031. id: "btn-username" + this.data.credid,
  45032. "data-clipboard-target": "#username" + this.data.credid
  45033. }
  45034. },
  45035. [_c("i", { staticClass: "far fa-clone" })]
  45036. )
  45037. ]),
  45038. _vm._v(" "),
  45039. _c("div", [
  45040. _vm._m(1),
  45041. _vm._v(" "),
  45042. _c("input", {
  45043. staticClass: "border-0 credential",
  45044. attrs: {
  45045. type: "text",
  45046. id: "password" + this.data.credid,
  45047. readonly: ""
  45048. },
  45049. domProps: { value: this.data.credpass }
  45050. }),
  45051. _vm._v(" "),
  45052. _c(
  45053. "button",
  45054. {
  45055. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  45056. attrs: {
  45057. id: "btn-password" + this.data.credid,
  45058. "data-clipboard-target": "#password" + this.data.credid
  45059. }
  45060. },
  45061. [_c("i", { staticClass: "far fa-clone" })]
  45062. )
  45063. ])
  45064. ]),
  45065. _vm._v(" "),
  45066. _c(
  45067. "div",
  45068. {
  45069. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  45070. attrs: { role: "group", "aria-label": "Edit and Delete" }
  45071. },
  45072. [
  45073. _c(
  45074. "button",
  45075. {
  45076. staticClass: "btn btn-sm btn-secondary p-lg-1",
  45077. attrs: {
  45078. type: "button",
  45079. "data-toggle": "modal",
  45080. "data-target": "#credential" + this.data.credid + "editModal"
  45081. }
  45082. },
  45083. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  45084. ),
  45085. _vm._v(" "),
  45086. _c(
  45087. "button",
  45088. {
  45089. staticClass: "btn btn-sm btn-danger p-lg-1",
  45090. attrs: {
  45091. type: "button",
  45092. "data-toggle": "modal",
  45093. "data-target":
  45094. "#credential" + this.data.credid + "deleteModal"
  45095. }
  45096. },
  45097. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  45098. )
  45099. ]
  45100. )
  45101. ])
  45102. ],
  45103. 1
  45104. )
  45105. }
  45106. var staticRenderFns = [
  45107. function() {
  45108. var _vm = this
  45109. var _h = _vm.$createElement
  45110. var _c = _vm._self._c || _h
  45111. return _c("label", { attrs: { for: "username" } }, [
  45112. _c("i", { staticClass: "fas fa-fw fa-user" })
  45113. ])
  45114. },
  45115. function() {
  45116. var _vm = this
  45117. var _h = _vm.$createElement
  45118. var _c = _vm._self._c || _h
  45119. return _c("label", { attrs: { for: "password" } }, [
  45120. _c("i", { staticClass: "fas fa-fw fa-key" })
  45121. ])
  45122. }
  45123. ]
  45124. render._withStripped = true
  45125. /***/ }),
  45126. /***/ "./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&":
  45127. /*!**********************************************************************************************************************************************************************************************************************!*\
  45128. !*** ./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& ***!
  45129. \**********************************************************************************************************************************************************************************************************************/
  45130. /*! exports provided: render, staticRenderFns */
  45131. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45132. "use strict";
  45133. __webpack_require__.r(__webpack_exports__);
  45134. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45135. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45136. var render = function() {
  45137. var _vm = this
  45138. var _h = _vm.$createElement
  45139. var _c = _vm._self._c || _h
  45140. return _c(
  45141. "modal",
  45142. {
  45143. attrs: {
  45144. id: _vm.id,
  45145. tabindex: "-1",
  45146. role: "dialog",
  45147. "aria-labelledby": _vm.id + "Label"
  45148. }
  45149. },
  45150. [
  45151. _c(
  45152. "h5",
  45153. {
  45154. staticClass: "modal-title",
  45155. attrs: { slot: "header", id: _vm.id + "Label" },
  45156. slot: "header"
  45157. },
  45158. [_vm._v("\n Edit Credential\n ")]
  45159. ),
  45160. _vm._v(" "),
  45161. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45162. _c(
  45163. "div",
  45164. { staticClass: "form" },
  45165. [
  45166. _c("autocomplete-custom-dropdown", {
  45167. attrs: {
  45168. options: _vm.descriptions,
  45169. value: _vm.creddesc,
  45170. "allow-custom": true
  45171. },
  45172. model: {
  45173. value: _vm.creddesc,
  45174. callback: function($$v) {
  45175. _vm.creddesc = $$v
  45176. },
  45177. expression: "creddesc"
  45178. }
  45179. })
  45180. ],
  45181. 1
  45182. ),
  45183. _vm._v(" "),
  45184. _c("div", { staticClass: "form-group" }, [
  45185. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  45186. _vm._v(" "),
  45187. _c("input", {
  45188. directives: [
  45189. {
  45190. name: "model",
  45191. rawName: "v-model",
  45192. value: _vm.data.creduser,
  45193. expression: "data.creduser"
  45194. }
  45195. ],
  45196. staticClass: "form-control credential",
  45197. attrs: {
  45198. type: "text",
  45199. name: "newusername" + _vm.data.credid,
  45200. id: "newusername" + _vm.data.credid
  45201. },
  45202. domProps: { value: _vm.data.creduser },
  45203. on: {
  45204. input: function($event) {
  45205. if ($event.target.composing) {
  45206. return
  45207. }
  45208. _vm.$set(_vm.data, "creduser", $event.target.value)
  45209. }
  45210. }
  45211. })
  45212. ]),
  45213. _vm._v(" "),
  45214. _c("div", { staticClass: "form-group" }, [
  45215. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  45216. _vm._v(" "),
  45217. _c("input", {
  45218. directives: [
  45219. {
  45220. name: "model",
  45221. rawName: "v-model",
  45222. value: _vm.data.credpass,
  45223. expression: "data.credpass"
  45224. }
  45225. ],
  45226. staticClass: "form-control credential",
  45227. attrs: {
  45228. type: "text",
  45229. name: "newpassword" + _vm.data.credid,
  45230. id: "newpassword" + _vm.data.credid
  45231. },
  45232. domProps: { value: _vm.data.credpass },
  45233. on: {
  45234. input: function($event) {
  45235. if ($event.target.composing) {
  45236. return
  45237. }
  45238. _vm.$set(_vm.data, "credpass", $event.target.value)
  45239. }
  45240. }
  45241. }),
  45242. _vm._v(" "),
  45243. _c(
  45244. "button",
  45245. {
  45246. staticClass: "btn btn-secondary",
  45247. attrs: { type: "button" },
  45248. on: {
  45249. click: function($event) {
  45250. return _vm.getRandomPassword(_vm.data.credid)
  45251. }
  45252. }
  45253. },
  45254. [_vm._v("Generate Random")]
  45255. )
  45256. ]),
  45257. _vm._v(" "),
  45258. _c("div", { staticClass: "form-group" })
  45259. ]),
  45260. _vm._v(" "),
  45261. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45262. _c(
  45263. "button",
  45264. {
  45265. staticClass: "btn btn-secondary",
  45266. attrs: { type: "button", "data-dismiss": "modal" }
  45267. },
  45268. [_vm._v("Close")]
  45269. ),
  45270. _vm._v(" "),
  45271. _c(
  45272. "button",
  45273. {
  45274. staticClass: "btn btn-primary",
  45275. attrs: { type: "button" },
  45276. on: {
  45277. click: function($event) {
  45278. return _vm.updateCredential()
  45279. }
  45280. }
  45281. },
  45282. [
  45283. !_vm.credentialSaving
  45284. ? _c("div", [_vm._v("Save")])
  45285. : _c("circle-spinner", { attrs: { size: 2 } })
  45286. ],
  45287. 1
  45288. )
  45289. ])
  45290. ]
  45291. )
  45292. }
  45293. var staticRenderFns = []
  45294. render._withStripped = true
  45295. /***/ }),
  45296. /***/ "./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&":
  45297. /*!*****************************************************************************************************************************************************************************************************************!*\
  45298. !*** ./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& ***!
  45299. \*****************************************************************************************************************************************************************************************************************/
  45300. /*! exports provided: render, staticRenderFns */
  45301. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45302. "use strict";
  45303. __webpack_require__.r(__webpack_exports__);
  45304. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45305. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45306. var render = function() {
  45307. var _vm = this
  45308. var _h = _vm.$createElement
  45309. var _c = _vm._self._c || _h
  45310. return _c(
  45311. "div",
  45312. [
  45313. _c("credential-form-modal", {
  45314. attrs: {
  45315. "modal-id": "newCredentialModal",
  45316. descriptions: _vm.creddescList,
  45317. create: true,
  45318. pcid: _vm.pcid
  45319. }
  45320. }),
  45321. _vm._v(" "),
  45322. _c(
  45323. "button",
  45324. {
  45325. staticClass: "btn btn-primary",
  45326. attrs: {
  45327. type: "button",
  45328. "data-toggle": "modal",
  45329. "data-target": "#newCredentialModal"
  45330. }
  45331. },
  45332. [_vm._v("New Credential")]
  45333. ),
  45334. _vm._v(" "),
  45335. _vm._l(_vm.credentials, function(credential) {
  45336. return _c(
  45337. "div",
  45338. { key: credential.credid },
  45339. [
  45340. _c("credential", {
  45341. attrs: { credential: credential, descriptions: _vm.creddescList }
  45342. })
  45343. ],
  45344. 1
  45345. )
  45346. })
  45347. ],
  45348. 2
  45349. )
  45350. }
  45351. var staticRenderFns = []
  45352. render._withStripped = true
  45353. /***/ }),
  45354. /***/ "./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&":
  45355. /*!************************************************************************************************************************************************************************************************************!*\
  45356. !*** ./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& ***!
  45357. \************************************************************************************************************************************************************************************************************/
  45358. /*! exports provided: render, staticRenderFns */
  45359. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45360. "use strict";
  45361. __webpack_require__.r(__webpack_exports__);
  45362. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45363. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45364. var render = function() {
  45365. var _vm = this
  45366. var _h = _vm.$createElement
  45367. var _c = _vm._self._c || _h
  45368. return _c(
  45369. "ul",
  45370. { staticClass: "list-unstyled" },
  45371. _vm._l(_vm.errorList, function(error) {
  45372. return _c("li", { key: error, staticClass: "text-danger" }, [
  45373. _vm._v(" " + _vm._s(error) + " ")
  45374. ])
  45375. }),
  45376. 0
  45377. )
  45378. }
  45379. var staticRenderFns = []
  45380. render._withStripped = true
  45381. /***/ }),
  45382. /***/ "./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&":
  45383. /*!********************************************************************************************************************************************************************************************************!*\
  45384. !*** ./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& ***!
  45385. \********************************************************************************************************************************************************************************************************/
  45386. /*! exports provided: render, staticRenderFns */
  45387. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45388. "use strict";
  45389. __webpack_require__.r(__webpack_exports__);
  45390. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45391. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45392. var render = function() {
  45393. var _vm = this
  45394. var _h = _vm.$createElement
  45395. var _c = _vm._self._c || _h
  45396. return _c("div", { staticClass: "modal fade" }, [
  45397. _c(
  45398. "div",
  45399. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  45400. [
  45401. _c("div", { staticClass: "modal-content" }, [
  45402. _c(
  45403. "div",
  45404. { staticClass: "modal-header" },
  45405. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  45406. 2
  45407. ),
  45408. _vm._v(" "),
  45409. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  45410. _vm._v(" "),
  45411. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  45412. ])
  45413. ]
  45414. )
  45415. ])
  45416. }
  45417. var staticRenderFns = [
  45418. function() {
  45419. var _vm = this
  45420. var _h = _vm.$createElement
  45421. var _c = _vm._self._c || _h
  45422. return _c(
  45423. "button",
  45424. {
  45425. staticClass: "close",
  45426. attrs: {
  45427. type: "button",
  45428. "data-dismiss": "modal",
  45429. "aria-label": "Close"
  45430. }
  45431. },
  45432. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  45433. )
  45434. }
  45435. ]
  45436. render._withStripped = true
  45437. /***/ }),
  45438. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/NoteDeleteModal.vue?vue&type=template&id=49f798d5&":
  45439. /*!******************************************************************************************************************************************************************************************************************!*\
  45440. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/NoteDeleteModal.vue?vue&type=template&id=49f798d5& ***!
  45441. \******************************************************************************************************************************************************************************************************************/
  45442. /*! exports provided: render, staticRenderFns */
  45443. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45444. "use strict";
  45445. __webpack_require__.r(__webpack_exports__);
  45446. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45447. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45448. var render = function() {
  45449. var _vm = this
  45450. var _h = _vm.$createElement
  45451. var _c = _vm._self._c || _h
  45452. return _c(
  45453. "modal",
  45454. {
  45455. attrs: {
  45456. id: _vm.modalId,
  45457. tabindex: "-1",
  45458. role: "dialog",
  45459. "aria-labelledby": _vm.modalId + "Label"
  45460. }
  45461. },
  45462. [
  45463. _c(
  45464. "h5",
  45465. {
  45466. staticClass: "modal-title",
  45467. attrs: { slot: "header", id: _vm.modalId + "Label" },
  45468. slot: "header"
  45469. },
  45470. [_vm._v("\n Delete Note\n ")]
  45471. ),
  45472. _vm._v(" "),
  45473. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45474. _vm._v("\n Are you sure?\n ")
  45475. ]),
  45476. _vm._v(" "),
  45477. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45478. _c(
  45479. "button",
  45480. {
  45481. staticClass: "btn btn-secondary",
  45482. attrs: { type: "button", "data-dismiss": "modal" }
  45483. },
  45484. [_vm._v("Close")]
  45485. ),
  45486. _vm._v(" "),
  45487. _c(
  45488. "button",
  45489. {
  45490. staticClass: "btn btn-danger",
  45491. attrs: { type: "button" },
  45492. on: {
  45493. click: function($event) {
  45494. return _vm.deleteNote(_vm.note)
  45495. }
  45496. }
  45497. },
  45498. [
  45499. !_vm.noteDeleting
  45500. ? _c("div", [_vm._v("Confirm")])
  45501. : _c("circle-spinner", { attrs: { size: 2 } })
  45502. ],
  45503. 1
  45504. )
  45505. ])
  45506. ]
  45507. )
  45508. }
  45509. var staticRenderFns = []
  45510. render._withStripped = true
  45511. /***/ }),
  45512. /***/ "./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&":
  45513. /*!****************************************************************************************************************************************************************************************************************!*\
  45514. !*** ./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& ***!
  45515. \****************************************************************************************************************************************************************************************************************/
  45516. /*! exports provided: render, staticRenderFns */
  45517. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45518. "use strict";
  45519. __webpack_require__.r(__webpack_exports__);
  45520. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45521. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45522. var render = function() {
  45523. var _vm = this
  45524. var _h = _vm.$createElement
  45525. var _c = _vm._self._c || _h
  45526. return _c(
  45527. "div",
  45528. [
  45529. _vm.changeType
  45530. ? _c(
  45531. "modal",
  45532. {
  45533. attrs: {
  45534. id: _vm.modalId,
  45535. tabindex: "-1",
  45536. role: "dialog",
  45537. "aria-labelledby": _vm.modalId + "Label"
  45538. }
  45539. },
  45540. [
  45541. _vm.populateWith.notetype === 0
  45542. ? _c(
  45543. "h5",
  45544. {
  45545. staticClass: "modal-title",
  45546. attrs: { slot: "header", id: _vm.modalId + "Label" },
  45547. slot: "header"
  45548. },
  45549. [_vm._v("\n Change to Private Note\n ")]
  45550. )
  45551. : _c(
  45552. "h5",
  45553. {
  45554. staticClass: "modal-title",
  45555. attrs: { slot: "header", id: _vm.modalId + "Label" },
  45556. slot: "header"
  45557. },
  45558. [_vm._v("\n Change to Public Note\n ")]
  45559. ),
  45560. _vm._v(" "),
  45561. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45562. _vm._v("\n Are you sure?\n ")
  45563. ]),
  45564. _vm._v(" "),
  45565. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45566. _c(
  45567. "button",
  45568. {
  45569. staticClass: "btn btn-secondary",
  45570. attrs: { type: "button", "data-dismiss": "modal" }
  45571. },
  45572. [_vm._v("Close")]
  45573. ),
  45574. _vm._v(" "),
  45575. _c(
  45576. "button",
  45577. {
  45578. staticClass: "btn btn-primary",
  45579. attrs: { type: "button" },
  45580. on: {
  45581. click: function($event) {
  45582. return _vm.updateNote()
  45583. }
  45584. }
  45585. },
  45586. [
  45587. !_vm.noteSaving
  45588. ? _c("div", [_vm._v("Confirm")])
  45589. : _c("circle-spinner", { attrs: { size: 2 } })
  45590. ],
  45591. 1
  45592. )
  45593. ])
  45594. ]
  45595. )
  45596. : _c(
  45597. "modal",
  45598. {
  45599. attrs: {
  45600. id: _vm.modalId,
  45601. tabindex: "-1",
  45602. role: "dialog",
  45603. "aria-labelledby": _vm.modalId + "Label"
  45604. }
  45605. },
  45606. [
  45607. _c(
  45608. "h5",
  45609. {
  45610. staticClass: "modal-title",
  45611. attrs: { slot: "header", id: _vm.modalId + "Label" },
  45612. slot: "header"
  45613. },
  45614. [_vm._v("\n Edit Note\n ")]
  45615. ),
  45616. _vm._v(" "),
  45617. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45618. _c("div", { staticClass: "form-group" }, [
  45619. _c("label", { attrs: { for: "content" } }, [
  45620. _vm._v("Content")
  45621. ]),
  45622. _vm._v(" "),
  45623. _c("textarea", {
  45624. directives: [
  45625. {
  45626. name: "model",
  45627. rawName: "v-model",
  45628. value: _vm.note.thenote,
  45629. expression: "note.thenote"
  45630. }
  45631. ],
  45632. staticClass: "form-control",
  45633. attrs: {
  45634. name: "content" + _vm.note.noteid,
  45635. id: "content" + _vm.note.noteid
  45636. },
  45637. domProps: { value: _vm.note.thenote },
  45638. on: {
  45639. input: function($event) {
  45640. if ($event.target.composing) {
  45641. return
  45642. }
  45643. _vm.$set(_vm.note, "thenote", $event.target.value)
  45644. }
  45645. }
  45646. })
  45647. ])
  45648. ]),
  45649. _vm._v(" "),
  45650. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45651. _c(
  45652. "button",
  45653. {
  45654. staticClass: "btn btn-secondary",
  45655. attrs: { type: "button", "data-dismiss": "modal" }
  45656. },
  45657. [_vm._v("Close")]
  45658. ),
  45659. _vm._v(" "),
  45660. _c(
  45661. "button",
  45662. {
  45663. staticClass: "btn btn-primary",
  45664. attrs: { type: "button" },
  45665. on: {
  45666. click: function($event) {
  45667. return _vm.updateNote()
  45668. }
  45669. }
  45670. },
  45671. [
  45672. !_vm.noteSaving
  45673. ? _c("div", [_vm._v("Save")])
  45674. : _c("circle-spinner", { attrs: { size: 2 } })
  45675. ],
  45676. 1
  45677. )
  45678. ])
  45679. ]
  45680. )
  45681. ],
  45682. 1
  45683. )
  45684. }
  45685. var staticRenderFns = []
  45686. render._withStripped = true
  45687. /***/ }),
  45688. /***/ "./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&":
  45689. /*!********************************************************************************************************************************************************************************************************!*\
  45690. !*** ./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& ***!
  45691. \********************************************************************************************************************************************************************************************************/
  45692. /*! exports provided: render, staticRenderFns */
  45693. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45694. "use strict";
  45695. __webpack_require__.r(__webpack_exports__);
  45696. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45697. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45698. var render = function() {
  45699. var _vm = this
  45700. var _h = _vm.$createElement
  45701. var _c = _vm._self._c || _h
  45702. return _c(
  45703. "ul",
  45704. { staticClass: "list-unstyled" },
  45705. [
  45706. _c("div", { staticClass: "row" }, [
  45707. _c(
  45708. "div",
  45709. {
  45710. staticClass:
  45711. "col-md-2 d-flex justify-content-center justify-content-md-start"
  45712. },
  45713. [
  45714. _c(
  45715. "button",
  45716. {
  45717. staticClass: "btn btn-primary m-2",
  45718. attrs: {
  45719. type: "button",
  45720. "data-toggle": "collapse",
  45721. "data-target": "#note" + _vm.noteType + "add"
  45722. }
  45723. },
  45724. [
  45725. _c("i", { staticClass: "fas fa-fw fa-plus" }),
  45726. _vm._v(" Add New Note")
  45727. ]
  45728. )
  45729. ]
  45730. ),
  45731. _vm._v(" "),
  45732. _c("div", { staticClass: "col-md-10" }, [
  45733. _c(
  45734. "div",
  45735. {
  45736. staticClass: "collapse",
  45737. attrs: { id: "note" + _vm.noteType + "add" }
  45738. },
  45739. [
  45740. _c(
  45741. "div",
  45742. {
  45743. staticClass:
  45744. "d-flex flex-wrap flex-md-nowrap justify-content-center"
  45745. },
  45746. [
  45747. _c("textarea", {
  45748. directives: [
  45749. {
  45750. name: "model",
  45751. rawName: "v-model",
  45752. value: _vm.newNote.thenote,
  45753. expression: "newNote.thenote"
  45754. }
  45755. ],
  45756. staticClass: "form-control",
  45757. attrs: {
  45758. name: "newnote" + _vm.noteType,
  45759. id: "newnote" + _vm.noteType
  45760. },
  45761. domProps: { value: _vm.newNote.thenote },
  45762. on: {
  45763. input: function($event) {
  45764. if ($event.target.composing) {
  45765. return
  45766. }
  45767. _vm.$set(_vm.newNote, "thenote", $event.target.value)
  45768. }
  45769. }
  45770. }),
  45771. _vm._v(" "),
  45772. _c(
  45773. "button",
  45774. {
  45775. staticClass: "btn btn-secondary m-2",
  45776. attrs: { type: "button" },
  45777. on: {
  45778. click: function($event) {
  45779. return _vm.createNote()
  45780. }
  45781. }
  45782. },
  45783. [
  45784. !_vm.noteSaving
  45785. ? _c("div", [_vm._v("Save")])
  45786. : _c("circle-spinner", { attrs: { size: 2 } })
  45787. ],
  45788. 1
  45789. )
  45790. ]
  45791. )
  45792. ]
  45793. )
  45794. ])
  45795. ]),
  45796. _vm._v(" "),
  45797. _vm._l(this.notes, function(note, index) {
  45798. return _c(
  45799. "li",
  45800. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  45801. [
  45802. _c("note-form-modal", {
  45803. attrs: {
  45804. "modal-id": "note" + note.noteid + "editModal",
  45805. "populate-with": note
  45806. }
  45807. }),
  45808. _vm._v(" "),
  45809. _c("note-delete-modal", {
  45810. attrs: {
  45811. "modal-id": "note" + note.noteid + "deleteModal",
  45812. note: note
  45813. }
  45814. }),
  45815. _vm._v(" "),
  45816. _c("note-form-modal", {
  45817. attrs: {
  45818. "modal-id": "note" + note.noteid + "switchModal",
  45819. "populate-with": note,
  45820. "change-type": ""
  45821. }
  45822. }),
  45823. _vm._v(" "),
  45824. _c(
  45825. "div",
  45826. {
  45827. staticClass: "col-md-1 d-flex flex-column mx-md-3",
  45828. class: _vm.noteOrders[index]
  45829. },
  45830. [
  45831. _c("div", { staticClass: "text-center p-0 m-0" }, [
  45832. _vm._v(_vm._s(note.noteuser))
  45833. ]),
  45834. _vm._v(" "),
  45835. _c(
  45836. "div",
  45837. { staticClass: "text-muted text-small text-center p-0 m-0" },
  45838. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  45839. ),
  45840. _vm._v(" "),
  45841. _c(
  45842. "div",
  45843. { staticClass: "btn-group justify-content-center p-0 m-0" },
  45844. [
  45845. _vm.authusername === note.noteuser ||
  45846. _vm.authusername === "admin"
  45847. ? [
  45848. _c(
  45849. "button",
  45850. {
  45851. staticClass: "btn btn-sm btn-primary m-1",
  45852. attrs: {
  45853. "data-toggle": "modal",
  45854. "data-target":
  45855. "#note" + note.noteid + "editModal"
  45856. }
  45857. },
  45858. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  45859. ),
  45860. _vm._v(" "),
  45861. _c(
  45862. "button",
  45863. {
  45864. staticClass: "btn btn-sm btn-danger m-1",
  45865. attrs: {
  45866. "data-toggle": "modal",
  45867. "data-target":
  45868. "#note" + note.noteid + "deleteModal"
  45869. }
  45870. },
  45871. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  45872. ),
  45873. _vm._v(" "),
  45874. _c(
  45875. "button",
  45876. {
  45877. staticClass: "btn btn-sm btn-primary m-1",
  45878. attrs: {
  45879. "data-toggle": "modal",
  45880. "data-target":
  45881. "#note" + note.noteid + "switchModal"
  45882. }
  45883. },
  45884. [_c("i", { staticClass: "fa fa-fw fa-random" })]
  45885. )
  45886. ]
  45887. : _vm._e()
  45888. ],
  45889. 2
  45890. )
  45891. ]
  45892. ),
  45893. _vm._v(" "),
  45894. _c("div", { staticClass: "col-md-10" }, [
  45895. _c("div", { staticClass: "card m-2" }, [
  45896. _c("div", { staticClass: "card-body p-2" }, [
  45897. _vm._v(
  45898. "\n " +
  45899. _vm._s(note.thenote) +
  45900. "\n "
  45901. )
  45902. ])
  45903. ])
  45904. ])
  45905. ],
  45906. 1
  45907. )
  45908. })
  45909. ],
  45910. 2
  45911. )
  45912. }
  45913. var staticRenderFns = []
  45914. render._withStripped = true
  45915. /***/ }),
  45916. /***/ "./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&":
  45917. /*!******************************************************************************************************************************************************************************************************************!*\
  45918. !*** ./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& ***!
  45919. \******************************************************************************************************************************************************************************************************************/
  45920. /*! exports provided: render, staticRenderFns */
  45921. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45922. "use strict";
  45923. __webpack_require__.r(__webpack_exports__);
  45924. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45925. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45926. var render = function() {
  45927. var _vm = this
  45928. var _h = _vm.$createElement
  45929. var _c = _vm._self._c || _h
  45930. return _c(
  45931. "modal",
  45932. {
  45933. attrs: {
  45934. id: _vm.id,
  45935. tabindex: "-1",
  45936. role: "dialog",
  45937. "aria-labelledby": _vm.id + "Label"
  45938. }
  45939. },
  45940. [
  45941. _c(
  45942. "h5",
  45943. {
  45944. staticClass: "modal-title",
  45945. attrs: { slot: "header", id: _vm.id + "Label" },
  45946. slot: "header"
  45947. },
  45948. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  45949. ),
  45950. _vm._v(" "),
  45951. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45952. _c(
  45953. "div",
  45954. { staticClass: "form-group" },
  45955. [
  45956. _c("label", { attrs: { for: "probdesc" } }, [
  45957. _vm._v("Problem Description")
  45958. ]),
  45959. _vm._v(" "),
  45960. _c("textarea", {
  45961. directives: [
  45962. {
  45963. name: "model",
  45964. rawName: "v-model",
  45965. value: _vm.data.probdesc,
  45966. expression: "data.probdesc"
  45967. }
  45968. ],
  45969. class: {
  45970. "form-control": true,
  45971. "is-invalid": _vm.errors.probdesc
  45972. },
  45973. attrs: { id: "probdesc", name: "probdesc" },
  45974. domProps: { value: _vm.data.probdesc },
  45975. on: {
  45976. input: function($event) {
  45977. if ($event.target.composing) {
  45978. return
  45979. }
  45980. _vm.$set(_vm.data, "probdesc", $event.target.value)
  45981. }
  45982. }
  45983. }),
  45984. _vm._v(" "),
  45985. _c("error-list", { attrs: { errors: _vm.errors.probdesc } })
  45986. ],
  45987. 1
  45988. ),
  45989. _vm._v(" "),
  45990. _c(
  45991. "div",
  45992. { staticClass: "form-group" },
  45993. [
  45994. _c("label", { attrs: { for: "suggested" } }, [
  45995. _vm._v("Suggested Solution")
  45996. ]),
  45997. _vm._v(" "),
  45998. _c("textarea", {
  45999. directives: [
  46000. {
  46001. name: "model",
  46002. rawName: "v-model",
  46003. value: _vm.data.suggested,
  46004. expression: "data.suggested"
  46005. }
  46006. ],
  46007. class: {
  46008. "form-control": true,
  46009. "is-invalid": _vm.errors.suggested
  46010. },
  46011. attrs: { id: "suggested", name: "suggested" },
  46012. domProps: { value: _vm.data.suggested },
  46013. on: {
  46014. input: function($event) {
  46015. if ($event.target.composing) {
  46016. return
  46017. }
  46018. _vm.$set(_vm.data, "suggested", $event.target.value)
  46019. }
  46020. }
  46021. }),
  46022. _vm._v(" "),
  46023. _c("error-list", { attrs: { errors: _vm.errors.suggested } })
  46024. ],
  46025. 1
  46026. ),
  46027. _vm._v(" "),
  46028. _c(
  46029. "div",
  46030. { staticClass: "form-group" },
  46031. [
  46032. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  46033. _vm._v(" "),
  46034. _c("autocomplete-custom-dropdown", {
  46035. attrs: { options: _vm.storeList, value: this.store },
  46036. model: {
  46037. value: _vm.store,
  46038. callback: function($$v) {
  46039. _vm.store = $$v
  46040. },
  46041. expression: "store"
  46042. }
  46043. })
  46044. ],
  46045. 1
  46046. )
  46047. ]),
  46048. _vm._v(" "),
  46049. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  46050. _c(
  46051. "button",
  46052. {
  46053. staticClass: "btn btn-secondary",
  46054. attrs: { type: "button", "data-dismiss": "modal" }
  46055. },
  46056. [_vm._v("Close")]
  46057. ),
  46058. _vm._v(" "),
  46059. _c(
  46060. "button",
  46061. {
  46062. staticClass: "btn btn-primary",
  46063. attrs: { type: "button" },
  46064. on: {
  46065. click: function($event) {
  46066. return _vm.updateWorkOrder()
  46067. }
  46068. }
  46069. },
  46070. [
  46071. !_vm.woInfoSaving
  46072. ? _c("div", [_vm._v("Save")])
  46073. : _c("circle-spinner", { attrs: { size: 2 } })
  46074. ],
  46075. 1
  46076. )
  46077. ])
  46078. ]
  46079. )
  46080. }
  46081. var staticRenderFns = []
  46082. render._withStripped = true
  46083. /***/ }),
  46084. /***/ "./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&":
  46085. /*!****************************************************************************************************************************************************************************************************************!*\
  46086. !*** ./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& ***!
  46087. \****************************************************************************************************************************************************************************************************************/
  46088. /*! exports provided: render, staticRenderFns */
  46089. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46090. "use strict";
  46091. __webpack_require__.r(__webpack_exports__);
  46092. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46093. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46094. var render = function() {
  46095. var _vm = this
  46096. var _h = _vm.$createElement
  46097. var _c = _vm._self._c || _h
  46098. return _c(
  46099. "div",
  46100. [
  46101. _c("wo-info-edit-modal", {
  46102. attrs: {
  46103. "modal-id": "workordereditModal",
  46104. "populate-with": _vm.workOrder,
  46105. "store-list": this.storeList
  46106. }
  46107. }),
  46108. _vm._v(" "),
  46109. _c("p", [
  46110. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  46111. _vm._v(" "),
  46112. _c("span", {
  46113. domProps: { textContent: _vm._s(_vm.workOrder.probdesc) }
  46114. })
  46115. ]),
  46116. _vm._v(" "),
  46117. _c("p", [
  46118. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  46119. _vm._v(" "),
  46120. _c("span", {
  46121. domProps: { textContent: _vm._s(_vm.workOrder.suggested) }
  46122. })
  46123. ]),
  46124. _vm._v(" "),
  46125. _c("p", [
  46126. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  46127. _vm._v(" "),
  46128. _c("span", { domProps: { textContent: _vm._s(_vm.workOrder.woid) } })
  46129. ]),
  46130. _vm._v(" "),
  46131. _c("p", [
  46132. _c("i", { staticClass: "fas fa-fw fa-building" }),
  46133. _vm._v(" "),
  46134. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.workOrder.storeid]))])
  46135. ]),
  46136. _vm._v(" "),
  46137. _c("p", [
  46138. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  46139. _vm._v(" "),
  46140. _c(
  46141. "span",
  46142. {
  46143. staticClass: "dashed-underline",
  46144. attrs: {
  46145. "data-toggle": "tooltip",
  46146. "data-placement": "bottom",
  46147. title: this.getHRDate(_vm.workOrder.dropdate)
  46148. }
  46149. },
  46150. [
  46151. _vm._v(
  46152. "\n " +
  46153. _vm._s(
  46154. Math.floor(this.daysSinceToday(_vm.workOrder.dropdate))
  46155. ) +
  46156. " days ago\n "
  46157. )
  46158. ]
  46159. )
  46160. ]),
  46161. _vm._v(" "),
  46162. _c("p", [
  46163. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  46164. _vm._v(" "),
  46165. !this.isZero(_vm.workOrder.pickupdate)
  46166. ? _c(
  46167. "span",
  46168. {
  46169. staticClass: "dashed-underline",
  46170. attrs: {
  46171. "data-toggle": "tooltip",
  46172. "data-placement": "bottom",
  46173. title: this.getHRDate(_vm.workOrder.pickupdate)
  46174. }
  46175. },
  46176. [
  46177. _vm._v(
  46178. "\n " +
  46179. _vm._s(
  46180. Math.floor(this.daysSinceToday(_vm.workOrder.pickupdate))
  46181. ) +
  46182. " days ago\n "
  46183. )
  46184. ]
  46185. )
  46186. : _vm._e()
  46187. ]),
  46188. _vm._v(" "),
  46189. _c(
  46190. "button",
  46191. {
  46192. staticClass: "btn btn-primary",
  46193. attrs: {
  46194. type: "button",
  46195. "data-toggle": "modal",
  46196. "data-target": "#workordereditModal"
  46197. }
  46198. },
  46199. [_vm._v("Edit")]
  46200. )
  46201. ],
  46202. 1
  46203. )
  46204. }
  46205. var staticRenderFns = []
  46206. render._withStripped = true
  46207. /***/ }),
  46208. /***/ "./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&":
  46209. /*!*************************************************************************************************************************************************************************************************!*\
  46210. !*** ./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& ***!
  46211. \*************************************************************************************************************************************************************************************************/
  46212. /*! exports provided: render, staticRenderFns */
  46213. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46214. "use strict";
  46215. __webpack_require__.r(__webpack_exports__);
  46216. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46217. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46218. var render = function() {
  46219. var _vm = this
  46220. var _h = _vm.$createElement
  46221. var _c = _vm._self._c || _h
  46222. return _c("div", [
  46223. _c(
  46224. "nav",
  46225. {
  46226. staticClass:
  46227. "navbar navbar-expand navbar-dark bg-primary text-light shadow-sm"
  46228. },
  46229. [
  46230. _c(
  46231. "div",
  46232. { staticClass: "container-fluid" },
  46233. [
  46234. _c(
  46235. "router-link",
  46236. { staticClass: "navbar-brand", attrs: { to: { name: "home" } } },
  46237. [_vm._v("\n UPCCRT\n ")]
  46238. ),
  46239. _vm._v(" "),
  46240. _vm._m(0),
  46241. _vm._v(" "),
  46242. _c(
  46243. "div",
  46244. {
  46245. staticClass: "collapse navbar-collapse",
  46246. attrs: { id: "navbarSupportedContent" }
  46247. },
  46248. [
  46249. _c("ul", { staticClass: "navbar-nav mr-auto text-center" }, [
  46250. _vm._m(1),
  46251. _vm._v(" "),
  46252. _vm._m(2),
  46253. _vm._v(" "),
  46254. _c(
  46255. "li",
  46256. { staticClass: "nav-item" },
  46257. [
  46258. _c(
  46259. "router-link",
  46260. {
  46261. staticClass: "nav-link",
  46262. attrs: { to: { name: "dashboard" } }
  46263. },
  46264. [
  46265. _c("i", { staticClass: "fas fa-tachometer-alt" }),
  46266. _vm._v(" "),
  46267. _c(
  46268. "span",
  46269. { staticClass: "d-none d-sm-block d-md-inline" },
  46270. [_vm._v("Dashboard")]
  46271. )
  46272. ]
  46273. )
  46274. ],
  46275. 1
  46276. ),
  46277. _vm._v(" "),
  46278. _vm._m(3)
  46279. ]),
  46280. _vm._v(" "),
  46281. _c(
  46282. "ul",
  46283. { staticClass: "navbar-nav ml-auto" },
  46284. [
  46285. !_vm.isLoggedIn
  46286. ? _c(
  46287. "router-link",
  46288. {
  46289. staticClass: "nav-link",
  46290. attrs: { to: { name: "login" } }
  46291. },
  46292. [_vm._v("Login")]
  46293. )
  46294. : _vm._e(),
  46295. _vm._v(" "),
  46296. _vm.isLoggedIn
  46297. ? _c("li", { staticClass: "nav-link" }, [
  46298. _vm._v(_vm._s(_vm.username))
  46299. ])
  46300. : _vm._e(),
  46301. _vm._v(" "),
  46302. _vm.isLoggedIn
  46303. ? _c(
  46304. "router-link",
  46305. {
  46306. staticClass: "nav-link",
  46307. attrs: { to: { name: "home" } }
  46308. },
  46309. [_vm._v("Home")]
  46310. )
  46311. : _vm._e()
  46312. ],
  46313. 1
  46314. )
  46315. ]
  46316. )
  46317. ],
  46318. 1
  46319. )
  46320. ]
  46321. ),
  46322. _vm._v(" "),
  46323. _c("main", { staticClass: "py-4" }, [_c("router-view")], 1)
  46324. ])
  46325. }
  46326. var staticRenderFns = [
  46327. function() {
  46328. var _vm = this
  46329. var _h = _vm.$createElement
  46330. var _c = _vm._self._c || _h
  46331. return _c(
  46332. "button",
  46333. {
  46334. staticClass: "navbar-toggler",
  46335. attrs: {
  46336. type: "button",
  46337. "data-toggle": "collapse",
  46338. "data-target": "#navbarSupportedContent",
  46339. "aria-controls": "navbarSupportedContent",
  46340. "aria-expanded": "false"
  46341. }
  46342. },
  46343. [_c("span", { staticClass: "navbar-toggler-icon" })]
  46344. )
  46345. },
  46346. function() {
  46347. var _vm = this
  46348. var _h = _vm.$createElement
  46349. var _c = _vm._self._c || _h
  46350. return _c("li", { staticClass: "nav-item" }, [
  46351. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46352. _c("i", { staticClass: "fas fa-sign-in-alt" }),
  46353. _vm._v(" "),
  46354. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46355. _vm._v("Check-In")
  46356. ])
  46357. ])
  46358. ])
  46359. },
  46360. function() {
  46361. var _vm = this
  46362. var _h = _vm.$createElement
  46363. var _c = _vm._self._c || _h
  46364. return _c("li", { staticClass: "nav-item" }, [
  46365. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46366. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  46367. _vm._v(" "),
  46368. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46369. _vm._v("Check-Out")
  46370. ])
  46371. ])
  46372. ])
  46373. },
  46374. function() {
  46375. var _vm = this
  46376. var _h = _vm.$createElement
  46377. var _c = _vm._self._c || _h
  46378. return _c("li", { staticClass: "nav-item" }, [
  46379. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46380. _c("i", { staticClass: "fas fa-chart-bar" }),
  46381. _vm._v(" "),
  46382. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46383. _vm._v("Reports")
  46384. ])
  46385. ])
  46386. ])
  46387. }
  46388. ]
  46389. render._withStripped = true
  46390. /***/ }),
  46391. /***/ "./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&":
  46392. /*!*******************************************************************************************************************************************************************************************************!*\
  46393. !*** ./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& ***!
  46394. \*******************************************************************************************************************************************************************************************************/
  46395. /*! exports provided: render, staticRenderFns */
  46396. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46397. "use strict";
  46398. __webpack_require__.r(__webpack_exports__);
  46399. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46400. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46401. var render = function() {
  46402. var _vm = this
  46403. var _h = _vm.$createElement
  46404. var _c = _vm._self._c || _h
  46405. return _c("div", { staticClass: "container" }, [
  46406. _c("div", { staticClass: "row justify-content-center" }, [
  46407. !_vm.isLoading
  46408. ? _c(
  46409. "div",
  46410. { staticClass: "col-md-12" },
  46411. _vm._l(_vm.workOrders, function(workOrder, index) {
  46412. return _c(
  46413. "div",
  46414. { key: workOrder.woid, staticClass: "col-md-4" },
  46415. [
  46416. _c("div", { staticClass: "card" }, [
  46417. _c(
  46418. "div",
  46419. { staticClass: "card-header" },
  46420. [
  46421. _c(
  46422. "router-link",
  46423. {
  46424. staticClass: "h4 card-title",
  46425. attrs: {
  46426. to: {
  46427. name: "workorders",
  46428. params: { id: workOrder.woid }
  46429. }
  46430. }
  46431. },
  46432. [_vm._v(_vm._s(workOrder.woid))]
  46433. )
  46434. ],
  46435. 1
  46436. ),
  46437. _vm._v(" "),
  46438. _c("div", { staticClass: "card-body card-body-dark" }, [
  46439. _c("div", [
  46440. _vm._v(
  46441. "\n " +
  46442. _vm._s(workOrder.probdesc) +
  46443. "\n "
  46444. )
  46445. ]),
  46446. _vm._v(" "),
  46447. _c("div", [
  46448. _vm._v(
  46449. "\n " +
  46450. _vm._s(workOrder.suggested) +
  46451. "\n "
  46452. )
  46453. ])
  46454. ])
  46455. ])
  46456. ]
  46457. )
  46458. }),
  46459. 0
  46460. )
  46461. : _c(
  46462. "div",
  46463. { staticClass: "col-md-12" },
  46464. [_c("circle-spinner", { attrs: { color: "#663399" } })],
  46465. 1
  46466. )
  46467. ])
  46468. ])
  46469. }
  46470. var staticRenderFns = []
  46471. render._withStripped = true
  46472. /***/ }),
  46473. /***/ "./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&":
  46474. /*!***************************************************************************************************************************************************************************************************!*\
  46475. !*** ./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& ***!
  46476. \***************************************************************************************************************************************************************************************************/
  46477. /*! exports provided: render, staticRenderFns */
  46478. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46479. "use strict";
  46480. __webpack_require__.r(__webpack_exports__);
  46481. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46482. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46483. var render = function() {
  46484. var _vm = this
  46485. var _h = _vm.$createElement
  46486. var _c = _vm._self._c || _h
  46487. return _c("div", { staticClass: "container" }, [
  46488. _c("div", { staticClass: "row justify-content-center" }, [
  46489. _c("div", { staticClass: "col-md-8" }, [
  46490. _c("div", { staticClass: "card card-default" }, [
  46491. _c("div", { staticClass: "card-header" }, [_vm._v("Login")]),
  46492. _vm._v(" "),
  46493. _c("div", { staticClass: "card-body" }, [
  46494. _c("form", { attrs: { method: "POST", action: "/login" } }, [
  46495. _c("div", { staticClass: "form-group row" }, [
  46496. _c(
  46497. "label",
  46498. {
  46499. staticClass: "col-sm-4 col-form-label text-md-right",
  46500. attrs: { for: "username" }
  46501. },
  46502. [_vm._v("Username")]
  46503. ),
  46504. _vm._v(" "),
  46505. _c("div", { staticClass: "col-md-6" }, [
  46506. _c("input", {
  46507. directives: [
  46508. {
  46509. name: "model",
  46510. rawName: "v-model",
  46511. value: _vm.username,
  46512. expression: "username"
  46513. }
  46514. ],
  46515. staticClass: "form-control",
  46516. attrs: {
  46517. id: "username",
  46518. type: "username",
  46519. required: "",
  46520. autofocus: ""
  46521. },
  46522. domProps: { value: _vm.username },
  46523. on: {
  46524. input: function($event) {
  46525. if ($event.target.composing) {
  46526. return
  46527. }
  46528. _vm.username = $event.target.value
  46529. }
  46530. }
  46531. })
  46532. ])
  46533. ]),
  46534. _vm._v(" "),
  46535. _c("div", { staticClass: "form-group row" }, [
  46536. _c(
  46537. "label",
  46538. {
  46539. staticClass: "col-md-4 col-form-label text-md-right",
  46540. attrs: { for: "password" }
  46541. },
  46542. [_vm._v("Password")]
  46543. ),
  46544. _vm._v(" "),
  46545. _c("div", { staticClass: "col-md-6" }, [
  46546. _c("input", {
  46547. directives: [
  46548. {
  46549. name: "model",
  46550. rawName: "v-model",
  46551. value: _vm.password,
  46552. expression: "password"
  46553. }
  46554. ],
  46555. staticClass: "form-control",
  46556. attrs: { id: "password", type: "password", required: "" },
  46557. domProps: { value: _vm.password },
  46558. on: {
  46559. input: function($event) {
  46560. if ($event.target.composing) {
  46561. return
  46562. }
  46563. _vm.password = $event.target.value
  46564. }
  46565. }
  46566. })
  46567. ])
  46568. ]),
  46569. _vm._v(" "),
  46570. _c("div", { staticClass: "form-group row mb-0" }, [
  46571. _c("div", { staticClass: "col-md-8 offset-md-4" }, [
  46572. _c(
  46573. "button",
  46574. {
  46575. staticClass: "btn btn-primary",
  46576. attrs: { type: "submit" },
  46577. on: { click: _vm.handleSubmit }
  46578. },
  46579. [
  46580. _vm._v(
  46581. "\n Login\n "
  46582. )
  46583. ]
  46584. )
  46585. ])
  46586. ])
  46587. ])
  46588. ])
  46589. ])
  46590. ])
  46591. ])
  46592. ])
  46593. }
  46594. var staticRenderFns = []
  46595. render._withStripped = true
  46596. /***/ }),
  46597. /***/ "./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&":
  46598. /*!*****************************************************************************************************************************************************************************************************************!*\
  46599. !*** ./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& ***!
  46600. \*****************************************************************************************************************************************************************************************************************/
  46601. /*! exports provided: render, staticRenderFns */
  46602. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46603. "use strict";
  46604. __webpack_require__.r(__webpack_exports__);
  46605. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46606. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46607. var render = function() {
  46608. var _vm = this
  46609. var _h = _vm.$createElement
  46610. var _c = _vm._self._c || _h
  46611. return _vm._m(0)
  46612. }
  46613. var staticRenderFns = [
  46614. function() {
  46615. var _vm = this
  46616. var _h = _vm.$createElement
  46617. var _c = _vm._self._c || _h
  46618. return _c("div", { staticClass: "flex-center position-ref full-height" }, [
  46619. _c("div", { staticClass: "content" }, [
  46620. _c("div", { staticClass: "m-b-md" }, [
  46621. _c("h2", { staticClass: "title m-b-md" }, [
  46622. _vm._v("\n UPCCRT\n ")
  46623. ]),
  46624. _vm._v(" "),
  46625. _c("h3", [
  46626. _vm._v(
  46627. "\n University PC Care Repair Tracker\n "
  46628. )
  46629. ])
  46630. ])
  46631. ])
  46632. ])
  46633. }
  46634. ]
  46635. render._withStripped = true
  46636. /***/ }),
  46637. /***/ "./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&":
  46638. /*!*******************************************************************************************************************************************************************************************************!*\
  46639. !*** ./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& ***!
  46640. \*******************************************************************************************************************************************************************************************************/
  46641. /*! exports provided: render, staticRenderFns */
  46642. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46643. "use strict";
  46644. __webpack_require__.r(__webpack_exports__);
  46645. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46646. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46647. var render = function() {
  46648. var _vm = this
  46649. var _h = _vm.$createElement
  46650. var _c = _vm._self._c || _h
  46651. return _c("div", { staticClass: "container-fluid" }, [
  46652. _c("div", { staticClass: "row my-3" }, [
  46653. _c("div", { staticClass: "col-lg-6" }, [
  46654. _c("div", { staticClass: "card h-100" }, [
  46655. _vm._m(0),
  46656. _vm._v(" "),
  46657. _c("div", { staticClass: "card-body" }, [
  46658. _c("div", { staticClass: "tab-content" }, [
  46659. _c(
  46660. "div",
  46661. {
  46662. staticClass: "tab-pane active",
  46663. attrs: {
  46664. id: "assetinfo",
  46665. role: "tabpanel",
  46666. "aria-labelledby": "assetinfo-tab"
  46667. }
  46668. },
  46669. [
  46670. !_vm.assetLoading
  46671. ? _c("asset-info", { attrs: { asset: _vm.asset } })
  46672. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46673. ],
  46674. 1
  46675. ),
  46676. _vm._v(" "),
  46677. _c(
  46678. "div",
  46679. {
  46680. staticClass: "tab-pane",
  46681. attrs: {
  46682. id: "credentials",
  46683. role: "tabpanel",
  46684. "aria-labelledby": "credentials-tab"
  46685. }
  46686. },
  46687. [
  46688. !_vm.credentialsLoading && !_vm.credentialDescriptionsLoading
  46689. ? _c("credential-list", {
  46690. attrs: {
  46691. credentials: _vm.credentials,
  46692. descriptions: _vm.credentialDescriptions,
  46693. pcid: _vm.asset.pcid
  46694. }
  46695. })
  46696. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46697. ],
  46698. 1
  46699. )
  46700. ])
  46701. ])
  46702. ])
  46703. ]),
  46704. _vm._v(" "),
  46705. _c("div", { staticClass: "col-lg-6" }, [
  46706. _c("div", { staticClass: "card h-100" }, [
  46707. _vm._m(1),
  46708. _vm._v(" "),
  46709. _c("div", { staticClass: "card-body" }, [
  46710. _c("div", { staticClass: "tab-content" }, [
  46711. _c(
  46712. "div",
  46713. {
  46714. staticClass: "tab-pane active",
  46715. attrs: {
  46716. id: "workordersumm",
  46717. role: "tabpanel",
  46718. "aria-labelledby": "workordersumm-tab"
  46719. }
  46720. },
  46721. [
  46722. !_vm.woLoading && !_vm.storesLoading
  46723. ? _c("work-order-info", {
  46724. attrs: {
  46725. "work-order": _vm.workOrder,
  46726. stores: _vm.stores
  46727. }
  46728. })
  46729. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46730. ],
  46731. 1
  46732. ),
  46733. _vm._v(" "),
  46734. _c(
  46735. "div",
  46736. {
  46737. staticClass: "tab-pane",
  46738. attrs: {
  46739. id: "attachments",
  46740. role: "tabpanel",
  46741. "aria-labelledby": "attachments-tab"
  46742. }
  46743. },
  46744. [
  46745. _vm._v(
  46746. "\n TODO 2\n "
  46747. )
  46748. ]
  46749. )
  46750. ])
  46751. ])
  46752. ])
  46753. ])
  46754. ]),
  46755. _vm._v(" "),
  46756. _c("div", { staticClass: "row my-3 no-gutters" }, [
  46757. _c("div", { staticClass: "col-12" }, [
  46758. _c("div", { staticClass: "card" }, [
  46759. _c(
  46760. "div",
  46761. { staticClass: "card-body" },
  46762. [
  46763. _c("h5", { staticClass: "card-title" }, [
  46764. _vm._v("Customer Notes")
  46765. ]),
  46766. _vm._v(" "),
  46767. !_vm.workOrderNotesLoading
  46768. ? _c("notes", {
  46769. attrs: {
  46770. notes: _vm.publicNotes,
  46771. authusername: _vm.authUser,
  46772. "note-type": 0,
  46773. woid: _vm.id
  46774. }
  46775. })
  46776. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46777. ],
  46778. 1
  46779. )
  46780. ])
  46781. ])
  46782. ]),
  46783. _vm._v(" "),
  46784. _c("div", { staticClass: "row my-3 no-gutters" }, [
  46785. _c("div", { staticClass: "col-12" }, [
  46786. _c("div", { staticClass: "card" }, [
  46787. _c(
  46788. "div",
  46789. { staticClass: "card-body" },
  46790. [
  46791. _c("h5", { staticClass: "card-title" }, [
  46792. _vm._v("Private/Billing Notes")
  46793. ]),
  46794. _vm._v(" "),
  46795. !_vm.workOrderNotesLoading
  46796. ? _c("notes", {
  46797. attrs: {
  46798. notes: _vm.privateNotes,
  46799. authusername: _vm.authUser,
  46800. "note-type": 1,
  46801. woid: _vm.id
  46802. }
  46803. })
  46804. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46805. ],
  46806. 1
  46807. )
  46808. ])
  46809. ])
  46810. ])
  46811. ])
  46812. }
  46813. var staticRenderFns = [
  46814. function() {
  46815. var _vm = this
  46816. var _h = _vm.$createElement
  46817. var _c = _vm._self._c || _h
  46818. return _c("div", { staticClass: "card-header text-right" }, [
  46819. _c(
  46820. "button",
  46821. {
  46822. staticClass: "btn btn-default xs-toggle",
  46823. attrs: {
  46824. type: "button",
  46825. "data-toggle": "collapse",
  46826. "data-target": "#assetTab"
  46827. }
  46828. },
  46829. [
  46830. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  46831. _vm._v(" "),
  46832. _c("span", { staticClass: "icon-bar" }),
  46833. _vm._v(" "),
  46834. _c("span", { staticClass: "icon-bar" }),
  46835. _vm._v(" "),
  46836. _c("span", { staticClass: "icon-bar" })
  46837. ]
  46838. ),
  46839. _vm._v(" "),
  46840. _c(
  46841. "ul",
  46842. {
  46843. staticClass:
  46844. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  46845. attrs: { id: "assetTab", role: "tablist" }
  46846. },
  46847. [
  46848. _c("li", { staticClass: "nav-item" }, [
  46849. _c(
  46850. "a",
  46851. {
  46852. staticClass: "nav-link active",
  46853. attrs: {
  46854. id: "assetinfo-tab",
  46855. "data-toggle": "pill",
  46856. href: "#assetinfo",
  46857. role: "tab",
  46858. "aria-controls": "assetinfo",
  46859. "aria-selected": "true"
  46860. }
  46861. },
  46862. [_vm._v("Hardware")]
  46863. )
  46864. ]),
  46865. _vm._v(" "),
  46866. _c("li", { staticClass: "nav-item" }, [
  46867. _c(
  46868. "a",
  46869. {
  46870. staticClass: "nav-link",
  46871. attrs: {
  46872. id: "credentials-tab",
  46873. "data-toggle": "pill",
  46874. href: "#credentials",
  46875. role: "tab",
  46876. "aria-controls": "credentials",
  46877. "aria-selected": "false"
  46878. }
  46879. },
  46880. [_vm._v("Credentials")]
  46881. )
  46882. ])
  46883. ]
  46884. )
  46885. ])
  46886. },
  46887. function() {
  46888. var _vm = this
  46889. var _h = _vm.$createElement
  46890. var _c = _vm._self._c || _h
  46891. return _c("div", { staticClass: "card-header text-right" }, [
  46892. _c(
  46893. "button",
  46894. {
  46895. staticClass: "btn btn-default xs-toggle",
  46896. attrs: {
  46897. type: "button",
  46898. "data-toggle": "collapse",
  46899. "data-target": "#workorderTab"
  46900. }
  46901. },
  46902. [
  46903. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  46904. _vm._v(" "),
  46905. _c("span", { staticClass: "icon-bar" }),
  46906. _vm._v(" "),
  46907. _c("span", { staticClass: "icon-bar" }),
  46908. _vm._v(" "),
  46909. _c("span", { staticClass: "icon-bar" })
  46910. ]
  46911. ),
  46912. _vm._v(" "),
  46913. _c(
  46914. "ul",
  46915. {
  46916. staticClass:
  46917. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  46918. attrs: { id: "workorderTab", role: "tablist" }
  46919. },
  46920. [
  46921. _c("li", { staticClass: "nav-item" }, [
  46922. _c(
  46923. "a",
  46924. {
  46925. staticClass: "nav-link active",
  46926. attrs: {
  46927. id: "workordersumm-tab",
  46928. "data-toggle": "pill",
  46929. href: "#workordersumm",
  46930. role: "tab",
  46931. "aria-controls": "workordersumm",
  46932. "aria-selected": "true"
  46933. }
  46934. },
  46935. [_vm._v("Summary")]
  46936. )
  46937. ]),
  46938. _vm._v(" "),
  46939. _c("li", { staticClass: "nav-item" }, [
  46940. _c(
  46941. "a",
  46942. {
  46943. staticClass: "nav-link",
  46944. attrs: {
  46945. id: "attachments-tab",
  46946. "data-toggle": "pill",
  46947. href: "#attachments",
  46948. role: "tab",
  46949. "aria-controls": "attachments",
  46950. "aria-selected": "false"
  46951. }
  46952. },
  46953. [_vm._v("Attachments")]
  46954. )
  46955. ])
  46956. ]
  46957. )
  46958. ])
  46959. }
  46960. ]
  46961. render._withStripped = true
  46962. /***/ }),
  46963. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  46964. /*!********************************************************************!*\
  46965. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  46966. \********************************************************************/
  46967. /*! exports provided: default */
  46968. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46969. "use strict";
  46970. __webpack_require__.r(__webpack_exports__);
  46971. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  46972. /* globals __VUE_SSR_CONTEXT__ */
  46973. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  46974. // This module is a runtime utility for cleaner component module output and will
  46975. // be included in the final webpack user bundle.
  46976. function normalizeComponent (
  46977. scriptExports,
  46978. render,
  46979. staticRenderFns,
  46980. functionalTemplate,
  46981. injectStyles,
  46982. scopeId,
  46983. moduleIdentifier, /* server only */
  46984. shadowMode /* vue-cli only */
  46985. ) {
  46986. // Vue.extend constructor export interop
  46987. var options = typeof scriptExports === 'function'
  46988. ? scriptExports.options
  46989. : scriptExports
  46990. // render functions
  46991. if (render) {
  46992. options.render = render
  46993. options.staticRenderFns = staticRenderFns
  46994. options._compiled = true
  46995. }
  46996. // functional template
  46997. if (functionalTemplate) {
  46998. options.functional = true
  46999. }
  47000. // scopedId
  47001. if (scopeId) {
  47002. options._scopeId = 'data-v-' + scopeId
  47003. }
  47004. var hook
  47005. if (moduleIdentifier) { // server build
  47006. hook = function (context) {
  47007. // 2.3 injection
  47008. context =
  47009. context || // cached call
  47010. (this.$vnode && this.$vnode.ssrContext) || // stateful
  47011. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  47012. // 2.2 with runInNewContext: true
  47013. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  47014. context = __VUE_SSR_CONTEXT__
  47015. }
  47016. // inject component styles
  47017. if (injectStyles) {
  47018. injectStyles.call(this, context)
  47019. }
  47020. // register component module identifier for async chunk inferrence
  47021. if (context && context._registeredComponents) {
  47022. context._registeredComponents.add(moduleIdentifier)
  47023. }
  47024. }
  47025. // used by ssr in case component is cached and beforeCreate
  47026. // never gets called
  47027. options._ssrRegister = hook
  47028. } else if (injectStyles) {
  47029. hook = shadowMode
  47030. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  47031. : injectStyles
  47032. }
  47033. if (hook) {
  47034. if (options.functional) {
  47035. // for template-only hot-reload because in that case the render fn doesn't
  47036. // go through the normalizer
  47037. options._injectStyles = hook
  47038. // register for functioal component in vue file
  47039. var originalRender = options.render
  47040. options.render = function renderWithStyleInjection (h, context) {
  47041. hook.call(context)
  47042. return originalRender(h, context)
  47043. }
  47044. } else {
  47045. // inject component registration as beforeCreate hook
  47046. var existing = options.beforeCreate
  47047. options.beforeCreate = existing
  47048. ? [].concat(existing, hook)
  47049. : [hook]
  47050. }
  47051. }
  47052. return {
  47053. exports: scriptExports,
  47054. options: options
  47055. }
  47056. }
  47057. /***/ }),
  47058. /***/ "./node_modules/vue-router/dist/vue-router.esm.js":
  47059. /*!********************************************************!*\
  47060. !*** ./node_modules/vue-router/dist/vue-router.esm.js ***!
  47061. \********************************************************/
  47062. /*! exports provided: default */
  47063. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  47064. "use strict";
  47065. __webpack_require__.r(__webpack_exports__);
  47066. /*!
  47067. * vue-router v3.1.6
  47068. * (c) 2020 Evan You
  47069. * @license MIT
  47070. */
  47071. /* */
  47072. function assert (condition, message) {
  47073. if (!condition) {
  47074. throw new Error(("[vue-router] " + message))
  47075. }
  47076. }
  47077. function warn (condition, message) {
  47078. if ( true && !condition) {
  47079. typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
  47080. }
  47081. }
  47082. function isError (err) {
  47083. return Object.prototype.toString.call(err).indexOf('Error') > -1
  47084. }
  47085. function isExtendedError (constructor, err) {
  47086. return (
  47087. err instanceof constructor ||
  47088. // _name is to support IE9 too
  47089. (err && (err.name === constructor.name || err._name === constructor._name))
  47090. )
  47091. }
  47092. function extend (a, b) {
  47093. for (var key in b) {
  47094. a[key] = b[key];
  47095. }
  47096. return a
  47097. }
  47098. var View = {
  47099. name: 'RouterView',
  47100. functional: true,
  47101. props: {
  47102. name: {
  47103. type: String,
  47104. default: 'default'
  47105. }
  47106. },
  47107. render: function render (_, ref) {
  47108. var props = ref.props;
  47109. var children = ref.children;
  47110. var parent = ref.parent;
  47111. var data = ref.data;
  47112. // used by devtools to display a router-view badge
  47113. data.routerView = true;
  47114. // directly use parent context's createElement() function
  47115. // so that components rendered by router-view can resolve named slots
  47116. var h = parent.$createElement;
  47117. var name = props.name;
  47118. var route = parent.$route;
  47119. var cache = parent._routerViewCache || (parent._routerViewCache = {});
  47120. // determine current view depth, also check to see if the tree
  47121. // has been toggled inactive but kept-alive.
  47122. var depth = 0;
  47123. var inactive = false;
  47124. while (parent && parent._routerRoot !== parent) {
  47125. var vnodeData = parent.$vnode ? parent.$vnode.data : {};
  47126. if (vnodeData.routerView) {
  47127. depth++;
  47128. }
  47129. if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
  47130. inactive = true;
  47131. }
  47132. parent = parent.$parent;
  47133. }
  47134. data.routerViewDepth = depth;
  47135. // render previous view if the tree is inactive and kept-alive
  47136. if (inactive) {
  47137. var cachedData = cache[name];
  47138. var cachedComponent = cachedData && cachedData.component;
  47139. if (cachedComponent) {
  47140. // #2301
  47141. // pass props
  47142. if (cachedData.configProps) {
  47143. fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
  47144. }
  47145. return h(cachedComponent, data, children)
  47146. } else {
  47147. // render previous empty view
  47148. return h()
  47149. }
  47150. }
  47151. var matched = route.matched[depth];
  47152. var component = matched && matched.components[name];
  47153. // render empty node if no matched route or no config component
  47154. if (!matched || !component) {
  47155. cache[name] = null;
  47156. return h()
  47157. }
  47158. // cache component
  47159. cache[name] = { component: component };
  47160. // attach instance registration hook
  47161. // this will be called in the instance's injected lifecycle hooks
  47162. data.registerRouteInstance = function (vm, val) {
  47163. // val could be undefined for unregistration
  47164. var current = matched.instances[name];
  47165. if (
  47166. (val && current !== vm) ||
  47167. (!val && current === vm)
  47168. ) {
  47169. matched.instances[name] = val;
  47170. }
  47171. }
  47172. // also register instance in prepatch hook
  47173. // in case the same component instance is reused across different routes
  47174. ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
  47175. matched.instances[name] = vnode.componentInstance;
  47176. };
  47177. // register instance in init hook
  47178. // in case kept-alive component be actived when routes changed
  47179. data.hook.init = function (vnode) {
  47180. if (vnode.data.keepAlive &&
  47181. vnode.componentInstance &&
  47182. vnode.componentInstance !== matched.instances[name]
  47183. ) {
  47184. matched.instances[name] = vnode.componentInstance;
  47185. }
  47186. };
  47187. var configProps = matched.props && matched.props[name];
  47188. // save route and configProps in cachce
  47189. if (configProps) {
  47190. extend(cache[name], {
  47191. route: route,
  47192. configProps: configProps
  47193. });
  47194. fillPropsinData(component, data, route, configProps);
  47195. }
  47196. return h(component, data, children)
  47197. }
  47198. };
  47199. function fillPropsinData (component, data, route, configProps) {
  47200. // resolve props
  47201. var propsToPass = data.props = resolveProps(route, configProps);
  47202. if (propsToPass) {
  47203. // clone to prevent mutation
  47204. propsToPass = data.props = extend({}, propsToPass);
  47205. // pass non-declared props as attrs
  47206. var attrs = data.attrs = data.attrs || {};
  47207. for (var key in propsToPass) {
  47208. if (!component.props || !(key in component.props)) {
  47209. attrs[key] = propsToPass[key];
  47210. delete propsToPass[key];
  47211. }
  47212. }
  47213. }
  47214. }
  47215. function resolveProps (route, config) {
  47216. switch (typeof config) {
  47217. case 'undefined':
  47218. return
  47219. case 'object':
  47220. return config
  47221. case 'function':
  47222. return config(route)
  47223. case 'boolean':
  47224. return config ? route.params : undefined
  47225. default:
  47226. if (true) {
  47227. warn(
  47228. false,
  47229. "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
  47230. "expecting an object, function or boolean."
  47231. );
  47232. }
  47233. }
  47234. }
  47235. /* */
  47236. var encodeReserveRE = /[!'()*]/g;
  47237. var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
  47238. var commaRE = /%2C/g;
  47239. // fixed encodeURIComponent which is more conformant to RFC3986:
  47240. // - escapes [!'()*]
  47241. // - preserve commas
  47242. var encode = function (str) { return encodeURIComponent(str)
  47243. .replace(encodeReserveRE, encodeReserveReplacer)
  47244. .replace(commaRE, ','); };
  47245. var decode = decodeURIComponent;
  47246. function resolveQuery (
  47247. query,
  47248. extraQuery,
  47249. _parseQuery
  47250. ) {
  47251. if ( extraQuery === void 0 ) extraQuery = {};
  47252. var parse = _parseQuery || parseQuery;
  47253. var parsedQuery;
  47254. try {
  47255. parsedQuery = parse(query || '');
  47256. } catch (e) {
  47257. true && warn(false, e.message);
  47258. parsedQuery = {};
  47259. }
  47260. for (var key in extraQuery) {
  47261. parsedQuery[key] = extraQuery[key];
  47262. }
  47263. return parsedQuery
  47264. }
  47265. function parseQuery (query) {
  47266. var res = {};
  47267. query = query.trim().replace(/^(\?|#|&)/, '');
  47268. if (!query) {
  47269. return res
  47270. }
  47271. query.split('&').forEach(function (param) {
  47272. var parts = param.replace(/\+/g, ' ').split('=');
  47273. var key = decode(parts.shift());
  47274. var val = parts.length > 0
  47275. ? decode(parts.join('='))
  47276. : null;
  47277. if (res[key] === undefined) {
  47278. res[key] = val;
  47279. } else if (Array.isArray(res[key])) {
  47280. res[key].push(val);
  47281. } else {
  47282. res[key] = [res[key], val];
  47283. }
  47284. });
  47285. return res
  47286. }
  47287. function stringifyQuery (obj) {
  47288. var res = obj ? Object.keys(obj).map(function (key) {
  47289. var val = obj[key];
  47290. if (val === undefined) {
  47291. return ''
  47292. }
  47293. if (val === null) {
  47294. return encode(key)
  47295. }
  47296. if (Array.isArray(val)) {
  47297. var result = [];
  47298. val.forEach(function (val2) {
  47299. if (val2 === undefined) {
  47300. return
  47301. }
  47302. if (val2 === null) {
  47303. result.push(encode(key));
  47304. } else {
  47305. result.push(encode(key) + '=' + encode(val2));
  47306. }
  47307. });
  47308. return result.join('&')
  47309. }
  47310. return encode(key) + '=' + encode(val)
  47311. }).filter(function (x) { return x.length > 0; }).join('&') : null;
  47312. return res ? ("?" + res) : ''
  47313. }
  47314. /* */
  47315. var trailingSlashRE = /\/?$/;
  47316. function createRoute (
  47317. record,
  47318. location,
  47319. redirectedFrom,
  47320. router
  47321. ) {
  47322. var stringifyQuery = router && router.options.stringifyQuery;
  47323. var query = location.query || {};
  47324. try {
  47325. query = clone(query);
  47326. } catch (e) {}
  47327. var route = {
  47328. name: location.name || (record && record.name),
  47329. meta: (record && record.meta) || {},
  47330. path: location.path || '/',
  47331. hash: location.hash || '',
  47332. query: query,
  47333. params: location.params || {},
  47334. fullPath: getFullPath(location, stringifyQuery),
  47335. matched: record ? formatMatch(record) : []
  47336. };
  47337. if (redirectedFrom) {
  47338. route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery);
  47339. }
  47340. return Object.freeze(route)
  47341. }
  47342. function clone (value) {
  47343. if (Array.isArray(value)) {
  47344. return value.map(clone)
  47345. } else if (value && typeof value === 'object') {
  47346. var res = {};
  47347. for (var key in value) {
  47348. res[key] = clone(value[key]);
  47349. }
  47350. return res
  47351. } else {
  47352. return value
  47353. }
  47354. }
  47355. // the starting route that represents the initial state
  47356. var START = createRoute(null, {
  47357. path: '/'
  47358. });
  47359. function formatMatch (record) {
  47360. var res = [];
  47361. while (record) {
  47362. res.unshift(record);
  47363. record = record.parent;
  47364. }
  47365. return res
  47366. }
  47367. function getFullPath (
  47368. ref,
  47369. _stringifyQuery
  47370. ) {
  47371. var path = ref.path;
  47372. var query = ref.query; if ( query === void 0 ) query = {};
  47373. var hash = ref.hash; if ( hash === void 0 ) hash = '';
  47374. var stringify = _stringifyQuery || stringifyQuery;
  47375. return (path || '/') + stringify(query) + hash
  47376. }
  47377. function isSameRoute (a, b) {
  47378. if (b === START) {
  47379. return a === b
  47380. } else if (!b) {
  47381. return false
  47382. } else if (a.path && b.path) {
  47383. return (
  47384. a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
  47385. a.hash === b.hash &&
  47386. isObjectEqual(a.query, b.query)
  47387. )
  47388. } else if (a.name && b.name) {
  47389. return (
  47390. a.name === b.name &&
  47391. a.hash === b.hash &&
  47392. isObjectEqual(a.query, b.query) &&
  47393. isObjectEqual(a.params, b.params)
  47394. )
  47395. } else {
  47396. return false
  47397. }
  47398. }
  47399. function isObjectEqual (a, b) {
  47400. if ( a === void 0 ) a = {};
  47401. if ( b === void 0 ) b = {};
  47402. // handle null value #1566
  47403. if (!a || !b) { return a === b }
  47404. var aKeys = Object.keys(a);
  47405. var bKeys = Object.keys(b);
  47406. if (aKeys.length !== bKeys.length) {
  47407. return false
  47408. }
  47409. return aKeys.every(function (key) {
  47410. var aVal = a[key];
  47411. var bVal = b[key];
  47412. // check nested equality
  47413. if (typeof aVal === 'object' && typeof bVal === 'object') {
  47414. return isObjectEqual(aVal, bVal)
  47415. }
  47416. return String(aVal) === String(bVal)
  47417. })
  47418. }
  47419. function isIncludedRoute (current, target) {
  47420. return (
  47421. current.path.replace(trailingSlashRE, '/').indexOf(
  47422. target.path.replace(trailingSlashRE, '/')
  47423. ) === 0 &&
  47424. (!target.hash || current.hash === target.hash) &&
  47425. queryIncludes(current.query, target.query)
  47426. )
  47427. }
  47428. function queryIncludes (current, target) {
  47429. for (var key in target) {
  47430. if (!(key in current)) {
  47431. return false
  47432. }
  47433. }
  47434. return true
  47435. }
  47436. /* */
  47437. function resolvePath (
  47438. relative,
  47439. base,
  47440. append
  47441. ) {
  47442. var firstChar = relative.charAt(0);
  47443. if (firstChar === '/') {
  47444. return relative
  47445. }
  47446. if (firstChar === '?' || firstChar === '#') {
  47447. return base + relative
  47448. }
  47449. var stack = base.split('/');
  47450. // remove trailing segment if:
  47451. // - not appending
  47452. // - appending to trailing slash (last segment is empty)
  47453. if (!append || !stack[stack.length - 1]) {
  47454. stack.pop();
  47455. }
  47456. // resolve relative path
  47457. var segments = relative.replace(/^\//, '').split('/');
  47458. for (var i = 0; i < segments.length; i++) {
  47459. var segment = segments[i];
  47460. if (segment === '..') {
  47461. stack.pop();
  47462. } else if (segment !== '.') {
  47463. stack.push(segment);
  47464. }
  47465. }
  47466. // ensure leading slash
  47467. if (stack[0] !== '') {
  47468. stack.unshift('');
  47469. }
  47470. return stack.join('/')
  47471. }
  47472. function parsePath (path) {
  47473. var hash = '';
  47474. var query = '';
  47475. var hashIndex = path.indexOf('#');
  47476. if (hashIndex >= 0) {
  47477. hash = path.slice(hashIndex);
  47478. path = path.slice(0, hashIndex);
  47479. }
  47480. var queryIndex = path.indexOf('?');
  47481. if (queryIndex >= 0) {
  47482. query = path.slice(queryIndex + 1);
  47483. path = path.slice(0, queryIndex);
  47484. }
  47485. return {
  47486. path: path,
  47487. query: query,
  47488. hash: hash
  47489. }
  47490. }
  47491. function cleanPath (path) {
  47492. return path.replace(/\/\//g, '/')
  47493. }
  47494. var isarray = Array.isArray || function (arr) {
  47495. return Object.prototype.toString.call(arr) == '[object Array]';
  47496. };
  47497. /**
  47498. * Expose `pathToRegexp`.
  47499. */
  47500. var pathToRegexp_1 = pathToRegexp;
  47501. var parse_1 = parse;
  47502. var compile_1 = compile;
  47503. var tokensToFunction_1 = tokensToFunction;
  47504. var tokensToRegExp_1 = tokensToRegExp;
  47505. /**
  47506. * The main path matching regexp utility.
  47507. *
  47508. * @type {RegExp}
  47509. */
  47510. var PATH_REGEXP = new RegExp([
  47511. // Match escaped characters that would otherwise appear in future matches.
  47512. // This allows the user to escape special characters that won't transform.
  47513. '(\\\\.)',
  47514. // Match Express-style parameters and un-named parameters with a prefix
  47515. // and optional suffixes. Matches appear as:
  47516. //
  47517. // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
  47518. // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
  47519. // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
  47520. '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
  47521. ].join('|'), 'g');
  47522. /**
  47523. * Parse a string for the raw tokens.
  47524. *
  47525. * @param {string} str
  47526. * @param {Object=} options
  47527. * @return {!Array}
  47528. */
  47529. function parse (str, options) {
  47530. var tokens = [];
  47531. var key = 0;
  47532. var index = 0;
  47533. var path = '';
  47534. var defaultDelimiter = options && options.delimiter || '/';
  47535. var res;
  47536. while ((res = PATH_REGEXP.exec(str)) != null) {
  47537. var m = res[0];
  47538. var escaped = res[1];
  47539. var offset = res.index;
  47540. path += str.slice(index, offset);
  47541. index = offset + m.length;
  47542. // Ignore already escaped sequences.
  47543. if (escaped) {
  47544. path += escaped[1];
  47545. continue
  47546. }
  47547. var next = str[index];
  47548. var prefix = res[2];
  47549. var name = res[3];
  47550. var capture = res[4];
  47551. var group = res[5];
  47552. var modifier = res[6];
  47553. var asterisk = res[7];
  47554. // Push the current path onto the tokens.
  47555. if (path) {
  47556. tokens.push(path);
  47557. path = '';
  47558. }
  47559. var partial = prefix != null && next != null && next !== prefix;
  47560. var repeat = modifier === '+' || modifier === '*';
  47561. var optional = modifier === '?' || modifier === '*';
  47562. var delimiter = res[2] || defaultDelimiter;
  47563. var pattern = capture || group;
  47564. tokens.push({
  47565. name: name || key++,
  47566. prefix: prefix || '',
  47567. delimiter: delimiter,
  47568. optional: optional,
  47569. repeat: repeat,
  47570. partial: partial,
  47571. asterisk: !!asterisk,
  47572. pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
  47573. });
  47574. }
  47575. // Match any characters still remaining.
  47576. if (index < str.length) {
  47577. path += str.substr(index);
  47578. }
  47579. // If the path exists, push it onto the end.
  47580. if (path) {
  47581. tokens.push(path);
  47582. }
  47583. return tokens
  47584. }
  47585. /**
  47586. * Compile a string to a template function for the path.
  47587. *
  47588. * @param {string} str
  47589. * @param {Object=} options
  47590. * @return {!function(Object=, Object=)}
  47591. */
  47592. function compile (str, options) {
  47593. return tokensToFunction(parse(str, options))
  47594. }
  47595. /**
  47596. * Prettier encoding of URI path segments.
  47597. *
  47598. * @param {string}
  47599. * @return {string}
  47600. */
  47601. function encodeURIComponentPretty (str) {
  47602. return encodeURI(str).replace(/[\/?#]/g, function (c) {
  47603. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  47604. })
  47605. }
  47606. /**
  47607. * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
  47608. *
  47609. * @param {string}
  47610. * @return {string}
  47611. */
  47612. function encodeAsterisk (str) {
  47613. return encodeURI(str).replace(/[?#]/g, function (c) {
  47614. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  47615. })
  47616. }
  47617. /**
  47618. * Expose a method for transforming tokens into the path function.
  47619. */
  47620. function tokensToFunction (tokens) {
  47621. // Compile all the tokens into regexps.
  47622. var matches = new Array(tokens.length);
  47623. // Compile all the patterns before compilation.
  47624. for (var i = 0; i < tokens.length; i++) {
  47625. if (typeof tokens[i] === 'object') {
  47626. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
  47627. }
  47628. }
  47629. return function (obj, opts) {
  47630. var path = '';
  47631. var data = obj || {};
  47632. var options = opts || {};
  47633. var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
  47634. for (var i = 0; i < tokens.length; i++) {
  47635. var token = tokens[i];
  47636. if (typeof token === 'string') {
  47637. path += token;
  47638. continue
  47639. }
  47640. var value = data[token.name];
  47641. var segment;
  47642. if (value == null) {
  47643. if (token.optional) {
  47644. // Prepend partial segment prefixes.
  47645. if (token.partial) {
  47646. path += token.prefix;
  47647. }
  47648. continue
  47649. } else {
  47650. throw new TypeError('Expected "' + token.name + '" to be defined')
  47651. }
  47652. }
  47653. if (isarray(value)) {
  47654. if (!token.repeat) {
  47655. throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
  47656. }
  47657. if (value.length === 0) {
  47658. if (token.optional) {
  47659. continue
  47660. } else {
  47661. throw new TypeError('Expected "' + token.name + '" to not be empty')
  47662. }
  47663. }
  47664. for (var j = 0; j < value.length; j++) {
  47665. segment = encode(value[j]);
  47666. if (!matches[i].test(segment)) {
  47667. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
  47668. }
  47669. path += (j === 0 ? token.prefix : token.delimiter) + segment;
  47670. }
  47671. continue
  47672. }
  47673. segment = token.asterisk ? encodeAsterisk(value) : encode(value);
  47674. if (!matches[i].test(segment)) {
  47675. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
  47676. }
  47677. path += token.prefix + segment;
  47678. }
  47679. return path
  47680. }
  47681. }
  47682. /**
  47683. * Escape a regular expression string.
  47684. *
  47685. * @param {string} str
  47686. * @return {string}
  47687. */
  47688. function escapeString (str) {
  47689. return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
  47690. }
  47691. /**
  47692. * Escape the capturing group by escaping special characters and meaning.
  47693. *
  47694. * @param {string} group
  47695. * @return {string}
  47696. */
  47697. function escapeGroup (group) {
  47698. return group.replace(/([=!:$\/()])/g, '\\$1')
  47699. }
  47700. /**
  47701. * Attach the keys as a property of the regexp.
  47702. *
  47703. * @param {!RegExp} re
  47704. * @param {Array} keys
  47705. * @return {!RegExp}
  47706. */
  47707. function attachKeys (re, keys) {
  47708. re.keys = keys;
  47709. return re
  47710. }
  47711. /**
  47712. * Get the flags for a regexp from the options.
  47713. *
  47714. * @param {Object} options
  47715. * @return {string}
  47716. */
  47717. function flags (options) {
  47718. return options.sensitive ? '' : 'i'
  47719. }
  47720. /**
  47721. * Pull out keys from a regexp.
  47722. *
  47723. * @param {!RegExp} path
  47724. * @param {!Array} keys
  47725. * @return {!RegExp}
  47726. */
  47727. function regexpToRegexp (path, keys) {
  47728. // Use a negative lookahead to match only capturing groups.
  47729. var groups = path.source.match(/\((?!\?)/g);
  47730. if (groups) {
  47731. for (var i = 0; i < groups.length; i++) {
  47732. keys.push({
  47733. name: i,
  47734. prefix: null,
  47735. delimiter: null,
  47736. optional: false,
  47737. repeat: false,
  47738. partial: false,
  47739. asterisk: false,
  47740. pattern: null
  47741. });
  47742. }
  47743. }
  47744. return attachKeys(path, keys)
  47745. }
  47746. /**
  47747. * Transform an array into a regexp.
  47748. *
  47749. * @param {!Array} path
  47750. * @param {Array} keys
  47751. * @param {!Object} options
  47752. * @return {!RegExp}
  47753. */
  47754. function arrayToRegexp (path, keys, options) {
  47755. var parts = [];
  47756. for (var i = 0; i < path.length; i++) {
  47757. parts.push(pathToRegexp(path[i], keys, options).source);
  47758. }
  47759. var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
  47760. return attachKeys(regexp, keys)
  47761. }
  47762. /**
  47763. * Create a path regexp from string input.
  47764. *
  47765. * @param {string} path
  47766. * @param {!Array} keys
  47767. * @param {!Object} options
  47768. * @return {!RegExp}
  47769. */
  47770. function stringToRegexp (path, keys, options) {
  47771. return tokensToRegExp(parse(path, options), keys, options)
  47772. }
  47773. /**
  47774. * Expose a function for taking tokens and returning a RegExp.
  47775. *
  47776. * @param {!Array} tokens
  47777. * @param {(Array|Object)=} keys
  47778. * @param {Object=} options
  47779. * @return {!RegExp}
  47780. */
  47781. function tokensToRegExp (tokens, keys, options) {
  47782. if (!isarray(keys)) {
  47783. options = /** @type {!Object} */ (keys || options);
  47784. keys = [];
  47785. }
  47786. options = options || {};
  47787. var strict = options.strict;
  47788. var end = options.end !== false;
  47789. var route = '';
  47790. // Iterate over the tokens and create our regexp string.
  47791. for (var i = 0; i < tokens.length; i++) {
  47792. var token = tokens[i];
  47793. if (typeof token === 'string') {
  47794. route += escapeString(token);
  47795. } else {
  47796. var prefix = escapeString(token.prefix);
  47797. var capture = '(?:' + token.pattern + ')';
  47798. keys.push(token);
  47799. if (token.repeat) {
  47800. capture += '(?:' + prefix + capture + ')*';
  47801. }
  47802. if (token.optional) {
  47803. if (!token.partial) {
  47804. capture = '(?:' + prefix + '(' + capture + '))?';
  47805. } else {
  47806. capture = prefix + '(' + capture + ')?';
  47807. }
  47808. } else {
  47809. capture = prefix + '(' + capture + ')';
  47810. }
  47811. route += capture;
  47812. }
  47813. }
  47814. var delimiter = escapeString(options.delimiter || '/');
  47815. var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
  47816. // In non-strict mode we allow a slash at the end of match. If the path to
  47817. // match already ends with a slash, we remove it for consistency. The slash
  47818. // is valid at the end of a path match, not in the middle. This is important
  47819. // in non-ending mode, where "/test/" shouldn't match "/test//route".
  47820. if (!strict) {
  47821. route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
  47822. }
  47823. if (end) {
  47824. route += '$';
  47825. } else {
  47826. // In non-ending mode, we need the capturing groups to match as much as
  47827. // possible by using a positive lookahead to the end or next path segment.
  47828. route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
  47829. }
  47830. return attachKeys(new RegExp('^' + route, flags(options)), keys)
  47831. }
  47832. /**
  47833. * Normalize the given path string, returning a regular expression.
  47834. *
  47835. * An empty array can be passed in for the keys, which will hold the
  47836. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  47837. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  47838. *
  47839. * @param {(string|RegExp|Array)} path
  47840. * @param {(Array|Object)=} keys
  47841. * @param {Object=} options
  47842. * @return {!RegExp}
  47843. */
  47844. function pathToRegexp (path, keys, options) {
  47845. if (!isarray(keys)) {
  47846. options = /** @type {!Object} */ (keys || options);
  47847. keys = [];
  47848. }
  47849. options = options || {};
  47850. if (path instanceof RegExp) {
  47851. return regexpToRegexp(path, /** @type {!Array} */ (keys))
  47852. }
  47853. if (isarray(path)) {
  47854. return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
  47855. }
  47856. return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
  47857. }
  47858. pathToRegexp_1.parse = parse_1;
  47859. pathToRegexp_1.compile = compile_1;
  47860. pathToRegexp_1.tokensToFunction = tokensToFunction_1;
  47861. pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
  47862. /* */
  47863. // $flow-disable-line
  47864. var regexpCompileCache = Object.create(null);
  47865. function fillParams (
  47866. path,
  47867. params,
  47868. routeMsg
  47869. ) {
  47870. params = params || {};
  47871. try {
  47872. var filler =
  47873. regexpCompileCache[path] ||
  47874. (regexpCompileCache[path] = pathToRegexp_1.compile(path));
  47875. // Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }}
  47876. // and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string
  47877. if (typeof params.pathMatch === 'string') { params[0] = params.pathMatch; }
  47878. return filler(params, { pretty: true })
  47879. } catch (e) {
  47880. if (true) {
  47881. // Fix #3072 no warn if `pathMatch` is string
  47882. warn(typeof params.pathMatch === 'string', ("missing param for " + routeMsg + ": " + (e.message)));
  47883. }
  47884. return ''
  47885. } finally {
  47886. // delete the 0 if it was added
  47887. delete params[0];
  47888. }
  47889. }
  47890. /* */
  47891. function normalizeLocation (
  47892. raw,
  47893. current,
  47894. append,
  47895. router
  47896. ) {
  47897. var next = typeof raw === 'string' ? { path: raw } : raw;
  47898. // named target
  47899. if (next._normalized) {
  47900. return next
  47901. } else if (next.name) {
  47902. next = extend({}, raw);
  47903. var params = next.params;
  47904. if (params && typeof params === 'object') {
  47905. next.params = extend({}, params);
  47906. }
  47907. return next
  47908. }
  47909. // relative params
  47910. if (!next.path && next.params && current) {
  47911. next = extend({}, next);
  47912. next._normalized = true;
  47913. var params$1 = extend(extend({}, current.params), next.params);
  47914. if (current.name) {
  47915. next.name = current.name;
  47916. next.params = params$1;
  47917. } else if (current.matched.length) {
  47918. var rawPath = current.matched[current.matched.length - 1].path;
  47919. next.path = fillParams(rawPath, params$1, ("path " + (current.path)));
  47920. } else if (true) {
  47921. warn(false, "relative params navigation requires a current route.");
  47922. }
  47923. return next
  47924. }
  47925. var parsedPath = parsePath(next.path || '');
  47926. var basePath = (current && current.path) || '/';
  47927. var path = parsedPath.path
  47928. ? resolvePath(parsedPath.path, basePath, append || next.append)
  47929. : basePath;
  47930. var query = resolveQuery(
  47931. parsedPath.query,
  47932. next.query,
  47933. router && router.options.parseQuery
  47934. );
  47935. var hash = next.hash || parsedPath.hash;
  47936. if (hash && hash.charAt(0) !== '#') {
  47937. hash = "#" + hash;
  47938. }
  47939. return {
  47940. _normalized: true,
  47941. path: path,
  47942. query: query,
  47943. hash: hash
  47944. }
  47945. }
  47946. /* */
  47947. // work around weird flow bug
  47948. var toTypes = [String, Object];
  47949. var eventTypes = [String, Array];
  47950. var noop = function () {};
  47951. var Link = {
  47952. name: 'RouterLink',
  47953. props: {
  47954. to: {
  47955. type: toTypes,
  47956. required: true
  47957. },
  47958. tag: {
  47959. type: String,
  47960. default: 'a'
  47961. },
  47962. exact: Boolean,
  47963. append: Boolean,
  47964. replace: Boolean,
  47965. activeClass: String,
  47966. exactActiveClass: String,
  47967. event: {
  47968. type: eventTypes,
  47969. default: 'click'
  47970. }
  47971. },
  47972. render: function render (h) {
  47973. var this$1 = this;
  47974. var router = this.$router;
  47975. var current = this.$route;
  47976. var ref = router.resolve(
  47977. this.to,
  47978. current,
  47979. this.append
  47980. );
  47981. var location = ref.location;
  47982. var route = ref.route;
  47983. var href = ref.href;
  47984. var classes = {};
  47985. var globalActiveClass = router.options.linkActiveClass;
  47986. var globalExactActiveClass = router.options.linkExactActiveClass;
  47987. // Support global empty active class
  47988. var activeClassFallback =
  47989. globalActiveClass == null ? 'router-link-active' : globalActiveClass;
  47990. var exactActiveClassFallback =
  47991. globalExactActiveClass == null
  47992. ? 'router-link-exact-active'
  47993. : globalExactActiveClass;
  47994. var activeClass =
  47995. this.activeClass == null ? activeClassFallback : this.activeClass;
  47996. var exactActiveClass =
  47997. this.exactActiveClass == null
  47998. ? exactActiveClassFallback
  47999. : this.exactActiveClass;
  48000. var compareTarget = route.redirectedFrom
  48001. ? createRoute(null, normalizeLocation(route.redirectedFrom), null, router)
  48002. : route;
  48003. classes[exactActiveClass] = isSameRoute(current, compareTarget);
  48004. classes[activeClass] = this.exact
  48005. ? classes[exactActiveClass]
  48006. : isIncludedRoute(current, compareTarget);
  48007. var handler = function (e) {
  48008. if (guardEvent(e)) {
  48009. if (this$1.replace) {
  48010. router.replace(location, noop);
  48011. } else {
  48012. router.push(location, noop);
  48013. }
  48014. }
  48015. };
  48016. var on = { click: guardEvent };
  48017. if (Array.isArray(this.event)) {
  48018. this.event.forEach(function (e) {
  48019. on[e] = handler;
  48020. });
  48021. } else {
  48022. on[this.event] = handler;
  48023. }
  48024. var data = { class: classes };
  48025. var scopedSlot =
  48026. !this.$scopedSlots.$hasNormal &&
  48027. this.$scopedSlots.default &&
  48028. this.$scopedSlots.default({
  48029. href: href,
  48030. route: route,
  48031. navigate: handler,
  48032. isActive: classes[activeClass],
  48033. isExactActive: classes[exactActiveClass]
  48034. });
  48035. if (scopedSlot) {
  48036. if (scopedSlot.length === 1) {
  48037. return scopedSlot[0]
  48038. } else if (scopedSlot.length > 1 || !scopedSlot.length) {
  48039. if (true) {
  48040. warn(
  48041. false,
  48042. ("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.")
  48043. );
  48044. }
  48045. return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot)
  48046. }
  48047. }
  48048. if (this.tag === 'a') {
  48049. data.on = on;
  48050. data.attrs = { href: href };
  48051. } else {
  48052. // find the first <a> child and apply listener and href
  48053. var a = findAnchor(this.$slots.default);
  48054. if (a) {
  48055. // in case the <a> is a static node
  48056. a.isStatic = false;
  48057. var aData = (a.data = extend({}, a.data));
  48058. aData.on = aData.on || {};
  48059. // transform existing events in both objects into arrays so we can push later
  48060. for (var event in aData.on) {
  48061. var handler$1 = aData.on[event];
  48062. if (event in on) {
  48063. aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1];
  48064. }
  48065. }
  48066. // append new listeners for router-link
  48067. for (var event$1 in on) {
  48068. if (event$1 in aData.on) {
  48069. // on[event] is always a function
  48070. aData.on[event$1].push(on[event$1]);
  48071. } else {
  48072. aData.on[event$1] = handler;
  48073. }
  48074. }
  48075. var aAttrs = (a.data.attrs = extend({}, a.data.attrs));
  48076. aAttrs.href = href;
  48077. } else {
  48078. // doesn't have <a> child, apply listener to self
  48079. data.on = on;
  48080. }
  48081. }
  48082. return h(this.tag, data, this.$slots.default)
  48083. }
  48084. };
  48085. function guardEvent (e) {
  48086. // don't redirect with control keys
  48087. if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
  48088. // don't redirect when preventDefault called
  48089. if (e.defaultPrevented) { return }
  48090. // don't redirect on right click
  48091. if (e.button !== undefined && e.button !== 0) { return }
  48092. // don't redirect if `target="_blank"`
  48093. if (e.currentTarget && e.currentTarget.getAttribute) {
  48094. var target = e.currentTarget.getAttribute('target');
  48095. if (/\b_blank\b/i.test(target)) { return }
  48096. }
  48097. // this may be a Weex event which doesn't have this method
  48098. if (e.preventDefault) {
  48099. e.preventDefault();
  48100. }
  48101. return true
  48102. }
  48103. function findAnchor (children) {
  48104. if (children) {
  48105. var child;
  48106. for (var i = 0; i < children.length; i++) {
  48107. child = children[i];
  48108. if (child.tag === 'a') {
  48109. return child
  48110. }
  48111. if (child.children && (child = findAnchor(child.children))) {
  48112. return child
  48113. }
  48114. }
  48115. }
  48116. }
  48117. var _Vue;
  48118. function install (Vue) {
  48119. if (install.installed && _Vue === Vue) { return }
  48120. install.installed = true;
  48121. _Vue = Vue;
  48122. var isDef = function (v) { return v !== undefined; };
  48123. var registerInstance = function (vm, callVal) {
  48124. var i = vm.$options._parentVnode;
  48125. if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
  48126. i(vm, callVal);
  48127. }
  48128. };
  48129. Vue.mixin({
  48130. beforeCreate: function beforeCreate () {
  48131. if (isDef(this.$options.router)) {
  48132. this._routerRoot = this;
  48133. this._router = this.$options.router;
  48134. this._router.init(this);
  48135. Vue.util.defineReactive(this, '_route', this._router.history.current);
  48136. } else {
  48137. this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
  48138. }
  48139. registerInstance(this, this);
  48140. },
  48141. destroyed: function destroyed () {
  48142. registerInstance(this);
  48143. }
  48144. });
  48145. Object.defineProperty(Vue.prototype, '$router', {
  48146. get: function get () { return this._routerRoot._router }
  48147. });
  48148. Object.defineProperty(Vue.prototype, '$route', {
  48149. get: function get () { return this._routerRoot._route }
  48150. });
  48151. Vue.component('RouterView', View);
  48152. Vue.component('RouterLink', Link);
  48153. var strats = Vue.config.optionMergeStrategies;
  48154. // use the same hook merging strategy for route hooks
  48155. strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
  48156. }
  48157. /* */
  48158. var inBrowser = typeof window !== 'undefined';
  48159. /* */
  48160. function createRouteMap (
  48161. routes,
  48162. oldPathList,
  48163. oldPathMap,
  48164. oldNameMap
  48165. ) {
  48166. // the path list is used to control path matching priority
  48167. var pathList = oldPathList || [];
  48168. // $flow-disable-line
  48169. var pathMap = oldPathMap || Object.create(null);
  48170. // $flow-disable-line
  48171. var nameMap = oldNameMap || Object.create(null);
  48172. routes.forEach(function (route) {
  48173. addRouteRecord(pathList, pathMap, nameMap, route);
  48174. });
  48175. // ensure wildcard routes are always at the end
  48176. for (var i = 0, l = pathList.length; i < l; i++) {
  48177. if (pathList[i] === '*') {
  48178. pathList.push(pathList.splice(i, 1)[0]);
  48179. l--;
  48180. i--;
  48181. }
  48182. }
  48183. if (true) {
  48184. // warn if routes do not include leading slashes
  48185. var found = pathList
  48186. // check for missing leading slash
  48187. .filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; });
  48188. if (found.length > 0) {
  48189. var pathNames = found.map(function (path) { return ("- " + path); }).join('\n');
  48190. warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames));
  48191. }
  48192. }
  48193. return {
  48194. pathList: pathList,
  48195. pathMap: pathMap,
  48196. nameMap: nameMap
  48197. }
  48198. }
  48199. function addRouteRecord (
  48200. pathList,
  48201. pathMap,
  48202. nameMap,
  48203. route,
  48204. parent,
  48205. matchAs
  48206. ) {
  48207. var path = route.path;
  48208. var name = route.name;
  48209. if (true) {
  48210. assert(path != null, "\"path\" is required in a route configuration.");
  48211. assert(
  48212. typeof route.component !== 'string',
  48213. "route config \"component\" for path: " + (String(
  48214. path || name
  48215. )) + " cannot be a " + "string id. Use an actual component instead."
  48216. );
  48217. }
  48218. var pathToRegexpOptions =
  48219. route.pathToRegexpOptions || {};
  48220. var normalizedPath = normalizePath(path, parent, pathToRegexpOptions.strict);
  48221. if (typeof route.caseSensitive === 'boolean') {
  48222. pathToRegexpOptions.sensitive = route.caseSensitive;
  48223. }
  48224. var record = {
  48225. path: normalizedPath,
  48226. regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
  48227. components: route.components || { default: route.component },
  48228. instances: {},
  48229. name: name,
  48230. parent: parent,
  48231. matchAs: matchAs,
  48232. redirect: route.redirect,
  48233. beforeEnter: route.beforeEnter,
  48234. meta: route.meta || {},
  48235. props:
  48236. route.props == null
  48237. ? {}
  48238. : route.components
  48239. ? route.props
  48240. : { default: route.props }
  48241. };
  48242. if (route.children) {
  48243. // Warn if route is named, does not redirect and has a default child route.
  48244. // If users navigate to this route by name, the default child will
  48245. // not be rendered (GH Issue #629)
  48246. if (true) {
  48247. if (
  48248. route.name &&
  48249. !route.redirect &&
  48250. route.children.some(function (child) { return /^\/?$/.test(child.path); })
  48251. ) {
  48252. warn(
  48253. false,
  48254. "Named Route '" + (route.name) + "' has a default child route. " +
  48255. "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
  48256. "the default child route will not be rendered. Remove the name from " +
  48257. "this route and use the name of the default child route for named " +
  48258. "links instead."
  48259. );
  48260. }
  48261. }
  48262. route.children.forEach(function (child) {
  48263. var childMatchAs = matchAs
  48264. ? cleanPath((matchAs + "/" + (child.path)))
  48265. : undefined;
  48266. addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
  48267. });
  48268. }
  48269. if (!pathMap[record.path]) {
  48270. pathList.push(record.path);
  48271. pathMap[record.path] = record;
  48272. }
  48273. if (route.alias !== undefined) {
  48274. var aliases = Array.isArray(route.alias) ? route.alias : [route.alias];
  48275. for (var i = 0; i < aliases.length; ++i) {
  48276. var alias = aliases[i];
  48277. if ( true && alias === path) {
  48278. warn(
  48279. false,
  48280. ("Found an alias with the same value as the path: \"" + path + "\". You have to remove that alias. It will be ignored in development.")
  48281. );
  48282. // skip in dev to make it work
  48283. continue
  48284. }
  48285. var aliasRoute = {
  48286. path: alias,
  48287. children: route.children
  48288. };
  48289. addRouteRecord(
  48290. pathList,
  48291. pathMap,
  48292. nameMap,
  48293. aliasRoute,
  48294. parent,
  48295. record.path || '/' // matchAs
  48296. );
  48297. }
  48298. }
  48299. if (name) {
  48300. if (!nameMap[name]) {
  48301. nameMap[name] = record;
  48302. } else if ( true && !matchAs) {
  48303. warn(
  48304. false,
  48305. "Duplicate named routes definition: " +
  48306. "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
  48307. );
  48308. }
  48309. }
  48310. }
  48311. function compileRouteRegex (
  48312. path,
  48313. pathToRegexpOptions
  48314. ) {
  48315. var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
  48316. if (true) {
  48317. var keys = Object.create(null);
  48318. regex.keys.forEach(function (key) {
  48319. warn(
  48320. !keys[key.name],
  48321. ("Duplicate param keys in route with path: \"" + path + "\"")
  48322. );
  48323. keys[key.name] = true;
  48324. });
  48325. }
  48326. return regex
  48327. }
  48328. function normalizePath (
  48329. path,
  48330. parent,
  48331. strict
  48332. ) {
  48333. if (!strict) { path = path.replace(/\/$/, ''); }
  48334. if (path[0] === '/') { return path }
  48335. if (parent == null) { return path }
  48336. return cleanPath(((parent.path) + "/" + path))
  48337. }
  48338. /* */
  48339. function createMatcher (
  48340. routes,
  48341. router
  48342. ) {
  48343. var ref = createRouteMap(routes);
  48344. var pathList = ref.pathList;
  48345. var pathMap = ref.pathMap;
  48346. var nameMap = ref.nameMap;
  48347. function addRoutes (routes) {
  48348. createRouteMap(routes, pathList, pathMap, nameMap);
  48349. }
  48350. function match (
  48351. raw,
  48352. currentRoute,
  48353. redirectedFrom
  48354. ) {
  48355. var location = normalizeLocation(raw, currentRoute, false, router);
  48356. var name = location.name;
  48357. if (name) {
  48358. var record = nameMap[name];
  48359. if (true) {
  48360. warn(record, ("Route with name '" + name + "' does not exist"));
  48361. }
  48362. if (!record) { return _createRoute(null, location) }
  48363. var paramNames = record.regex.keys
  48364. .filter(function (key) { return !key.optional; })
  48365. .map(function (key) { return key.name; });
  48366. if (typeof location.params !== 'object') {
  48367. location.params = {};
  48368. }
  48369. if (currentRoute && typeof currentRoute.params === 'object') {
  48370. for (var key in currentRoute.params) {
  48371. if (!(key in location.params) && paramNames.indexOf(key) > -1) {
  48372. location.params[key] = currentRoute.params[key];
  48373. }
  48374. }
  48375. }
  48376. location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
  48377. return _createRoute(record, location, redirectedFrom)
  48378. } else if (location.path) {
  48379. location.params = {};
  48380. for (var i = 0; i < pathList.length; i++) {
  48381. var path = pathList[i];
  48382. var record$1 = pathMap[path];
  48383. if (matchRoute(record$1.regex, location.path, location.params)) {
  48384. return _createRoute(record$1, location, redirectedFrom)
  48385. }
  48386. }
  48387. }
  48388. // no match
  48389. return _createRoute(null, location)
  48390. }
  48391. function redirect (
  48392. record,
  48393. location
  48394. ) {
  48395. var originalRedirect = record.redirect;
  48396. var redirect = typeof originalRedirect === 'function'
  48397. ? originalRedirect(createRoute(record, location, null, router))
  48398. : originalRedirect;
  48399. if (typeof redirect === 'string') {
  48400. redirect = { path: redirect };
  48401. }
  48402. if (!redirect || typeof redirect !== 'object') {
  48403. if (true) {
  48404. warn(
  48405. false, ("invalid redirect option: " + (JSON.stringify(redirect)))
  48406. );
  48407. }
  48408. return _createRoute(null, location)
  48409. }
  48410. var re = redirect;
  48411. var name = re.name;
  48412. var path = re.path;
  48413. var query = location.query;
  48414. var hash = location.hash;
  48415. var params = location.params;
  48416. query = re.hasOwnProperty('query') ? re.query : query;
  48417. hash = re.hasOwnProperty('hash') ? re.hash : hash;
  48418. params = re.hasOwnProperty('params') ? re.params : params;
  48419. if (name) {
  48420. // resolved named direct
  48421. var targetRecord = nameMap[name];
  48422. if (true) {
  48423. assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
  48424. }
  48425. return match({
  48426. _normalized: true,
  48427. name: name,
  48428. query: query,
  48429. hash: hash,
  48430. params: params
  48431. }, undefined, location)
  48432. } else if (path) {
  48433. // 1. resolve relative redirect
  48434. var rawPath = resolveRecordPath(path, record);
  48435. // 2. resolve params
  48436. var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
  48437. // 3. rematch with existing query and hash
  48438. return match({
  48439. _normalized: true,
  48440. path: resolvedPath,
  48441. query: query,
  48442. hash: hash
  48443. }, undefined, location)
  48444. } else {
  48445. if (true) {
  48446. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
  48447. }
  48448. return _createRoute(null, location)
  48449. }
  48450. }
  48451. function alias (
  48452. record,
  48453. location,
  48454. matchAs
  48455. ) {
  48456. var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
  48457. var aliasedMatch = match({
  48458. _normalized: true,
  48459. path: aliasedPath
  48460. });
  48461. if (aliasedMatch) {
  48462. var matched = aliasedMatch.matched;
  48463. var aliasedRecord = matched[matched.length - 1];
  48464. location.params = aliasedMatch.params;
  48465. return _createRoute(aliasedRecord, location)
  48466. }
  48467. return _createRoute(null, location)
  48468. }
  48469. function _createRoute (
  48470. record,
  48471. location,
  48472. redirectedFrom
  48473. ) {
  48474. if (record && record.redirect) {
  48475. return redirect(record, redirectedFrom || location)
  48476. }
  48477. if (record && record.matchAs) {
  48478. return alias(record, location, record.matchAs)
  48479. }
  48480. return createRoute(record, location, redirectedFrom, router)
  48481. }
  48482. return {
  48483. match: match,
  48484. addRoutes: addRoutes
  48485. }
  48486. }
  48487. function matchRoute (
  48488. regex,
  48489. path,
  48490. params
  48491. ) {
  48492. var m = path.match(regex);
  48493. if (!m) {
  48494. return false
  48495. } else if (!params) {
  48496. return true
  48497. }
  48498. for (var i = 1, len = m.length; i < len; ++i) {
  48499. var key = regex.keys[i - 1];
  48500. var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
  48501. if (key) {
  48502. // Fix #1994: using * with props: true generates a param named 0
  48503. params[key.name || 'pathMatch'] = val;
  48504. }
  48505. }
  48506. return true
  48507. }
  48508. function resolveRecordPath (path, record) {
  48509. return resolvePath(path, record.parent ? record.parent.path : '/', true)
  48510. }
  48511. /* */
  48512. // use User Timing api (if present) for more accurate key precision
  48513. var Time =
  48514. inBrowser && window.performance && window.performance.now
  48515. ? window.performance
  48516. : Date;
  48517. function genStateKey () {
  48518. return Time.now().toFixed(3)
  48519. }
  48520. var _key = genStateKey();
  48521. function getStateKey () {
  48522. return _key
  48523. }
  48524. function setStateKey (key) {
  48525. return (_key = key)
  48526. }
  48527. /* */
  48528. var positionStore = Object.create(null);
  48529. function setupScroll () {
  48530. // Fix for #1585 for Firefox
  48531. // Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
  48532. // Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with
  48533. // window.location.protocol + '//' + window.location.host
  48534. // location.host contains the port and location.hostname doesn't
  48535. var protocolAndPath = window.location.protocol + '//' + window.location.host;
  48536. var absolutePath = window.location.href.replace(protocolAndPath, '');
  48537. // preserve existing history state as it could be overriden by the user
  48538. var stateCopy = extend({}, window.history.state);
  48539. stateCopy.key = getStateKey();
  48540. window.history.replaceState(stateCopy, '', absolutePath);
  48541. window.addEventListener('popstate', function (e) {
  48542. saveScrollPosition();
  48543. if (e.state && e.state.key) {
  48544. setStateKey(e.state.key);
  48545. }
  48546. });
  48547. }
  48548. function handleScroll (
  48549. router,
  48550. to,
  48551. from,
  48552. isPop
  48553. ) {
  48554. if (!router.app) {
  48555. return
  48556. }
  48557. var behavior = router.options.scrollBehavior;
  48558. if (!behavior) {
  48559. return
  48560. }
  48561. if (true) {
  48562. assert(typeof behavior === 'function', "scrollBehavior must be a function");
  48563. }
  48564. // wait until re-render finishes before scrolling
  48565. router.app.$nextTick(function () {
  48566. var position = getScrollPosition();
  48567. var shouldScroll = behavior.call(
  48568. router,
  48569. to,
  48570. from,
  48571. isPop ? position : null
  48572. );
  48573. if (!shouldScroll) {
  48574. return
  48575. }
  48576. if (typeof shouldScroll.then === 'function') {
  48577. shouldScroll
  48578. .then(function (shouldScroll) {
  48579. scrollToPosition((shouldScroll), position);
  48580. })
  48581. .catch(function (err) {
  48582. if (true) {
  48583. assert(false, err.toString());
  48584. }
  48585. });
  48586. } else {
  48587. scrollToPosition(shouldScroll, position);
  48588. }
  48589. });
  48590. }
  48591. function saveScrollPosition () {
  48592. var key = getStateKey();
  48593. if (key) {
  48594. positionStore[key] = {
  48595. x: window.pageXOffset,
  48596. y: window.pageYOffset
  48597. };
  48598. }
  48599. }
  48600. function getScrollPosition () {
  48601. var key = getStateKey();
  48602. if (key) {
  48603. return positionStore[key]
  48604. }
  48605. }
  48606. function getElementPosition (el, offset) {
  48607. var docEl = document.documentElement;
  48608. var docRect = docEl.getBoundingClientRect();
  48609. var elRect = el.getBoundingClientRect();
  48610. return {
  48611. x: elRect.left - docRect.left - offset.x,
  48612. y: elRect.top - docRect.top - offset.y
  48613. }
  48614. }
  48615. function isValidPosition (obj) {
  48616. return isNumber(obj.x) || isNumber(obj.y)
  48617. }
  48618. function normalizePosition (obj) {
  48619. return {
  48620. x: isNumber(obj.x) ? obj.x : window.pageXOffset,
  48621. y: isNumber(obj.y) ? obj.y : window.pageYOffset
  48622. }
  48623. }
  48624. function normalizeOffset (obj) {
  48625. return {
  48626. x: isNumber(obj.x) ? obj.x : 0,
  48627. y: isNumber(obj.y) ? obj.y : 0
  48628. }
  48629. }
  48630. function isNumber (v) {
  48631. return typeof v === 'number'
  48632. }
  48633. var hashStartsWithNumberRE = /^#\d/;
  48634. function scrollToPosition (shouldScroll, position) {
  48635. var isObject = typeof shouldScroll === 'object';
  48636. if (isObject && typeof shouldScroll.selector === 'string') {
  48637. // getElementById would still fail if the selector contains a more complicated query like #main[data-attr]
  48638. // but at the same time, it doesn't make much sense to select an element with an id and an extra selector
  48639. var el = hashStartsWithNumberRE.test(shouldScroll.selector) // $flow-disable-line
  48640. ? document.getElementById(shouldScroll.selector.slice(1)) // $flow-disable-line
  48641. : document.querySelector(shouldScroll.selector);
  48642. if (el) {
  48643. var offset =
  48644. shouldScroll.offset && typeof shouldScroll.offset === 'object'
  48645. ? shouldScroll.offset
  48646. : {};
  48647. offset = normalizeOffset(offset);
  48648. position = getElementPosition(el, offset);
  48649. } else if (isValidPosition(shouldScroll)) {
  48650. position = normalizePosition(shouldScroll);
  48651. }
  48652. } else if (isObject && isValidPosition(shouldScroll)) {
  48653. position = normalizePosition(shouldScroll);
  48654. }
  48655. if (position) {
  48656. window.scrollTo(position.x, position.y);
  48657. }
  48658. }
  48659. /* */
  48660. var supportsPushState =
  48661. inBrowser &&
  48662. (function () {
  48663. var ua = window.navigator.userAgent;
  48664. if (
  48665. (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
  48666. ua.indexOf('Mobile Safari') !== -1 &&
  48667. ua.indexOf('Chrome') === -1 &&
  48668. ua.indexOf('Windows Phone') === -1
  48669. ) {
  48670. return false
  48671. }
  48672. return window.history && 'pushState' in window.history
  48673. })();
  48674. function pushState (url, replace) {
  48675. saveScrollPosition();
  48676. // try...catch the pushState call to get around Safari
  48677. // DOM Exception 18 where it limits to 100 pushState calls
  48678. var history = window.history;
  48679. try {
  48680. if (replace) {
  48681. // preserve existing history state as it could be overriden by the user
  48682. var stateCopy = extend({}, history.state);
  48683. stateCopy.key = getStateKey();
  48684. history.replaceState(stateCopy, '', url);
  48685. } else {
  48686. history.pushState({ key: setStateKey(genStateKey()) }, '', url);
  48687. }
  48688. } catch (e) {
  48689. window.location[replace ? 'replace' : 'assign'](url);
  48690. }
  48691. }
  48692. function replaceState (url) {
  48693. pushState(url, true);
  48694. }
  48695. /* */
  48696. function runQueue (queue, fn, cb) {
  48697. var step = function (index) {
  48698. if (index >= queue.length) {
  48699. cb();
  48700. } else {
  48701. if (queue[index]) {
  48702. fn(queue[index], function () {
  48703. step(index + 1);
  48704. });
  48705. } else {
  48706. step(index + 1);
  48707. }
  48708. }
  48709. };
  48710. step(0);
  48711. }
  48712. /* */
  48713. function resolveAsyncComponents (matched) {
  48714. return function (to, from, next) {
  48715. var hasAsync = false;
  48716. var pending = 0;
  48717. var error = null;
  48718. flatMapComponents(matched, function (def, _, match, key) {
  48719. // if it's a function and doesn't have cid attached,
  48720. // assume it's an async component resolve function.
  48721. // we are not using Vue's default async resolving mechanism because
  48722. // we want to halt the navigation until the incoming component has been
  48723. // resolved.
  48724. if (typeof def === 'function' && def.cid === undefined) {
  48725. hasAsync = true;
  48726. pending++;
  48727. var resolve = once(function (resolvedDef) {
  48728. if (isESModule(resolvedDef)) {
  48729. resolvedDef = resolvedDef.default;
  48730. }
  48731. // save resolved on async factory in case it's used elsewhere
  48732. def.resolved = typeof resolvedDef === 'function'
  48733. ? resolvedDef
  48734. : _Vue.extend(resolvedDef);
  48735. match.components[key] = resolvedDef;
  48736. pending--;
  48737. if (pending <= 0) {
  48738. next();
  48739. }
  48740. });
  48741. var reject = once(function (reason) {
  48742. var msg = "Failed to resolve async component " + key + ": " + reason;
  48743. true && warn(false, msg);
  48744. if (!error) {
  48745. error = isError(reason)
  48746. ? reason
  48747. : new Error(msg);
  48748. next(error);
  48749. }
  48750. });
  48751. var res;
  48752. try {
  48753. res = def(resolve, reject);
  48754. } catch (e) {
  48755. reject(e);
  48756. }
  48757. if (res) {
  48758. if (typeof res.then === 'function') {
  48759. res.then(resolve, reject);
  48760. } else {
  48761. // new syntax in Vue 2.3
  48762. var comp = res.component;
  48763. if (comp && typeof comp.then === 'function') {
  48764. comp.then(resolve, reject);
  48765. }
  48766. }
  48767. }
  48768. }
  48769. });
  48770. if (!hasAsync) { next(); }
  48771. }
  48772. }
  48773. function flatMapComponents (
  48774. matched,
  48775. fn
  48776. ) {
  48777. return flatten(matched.map(function (m) {
  48778. return Object.keys(m.components).map(function (key) { return fn(
  48779. m.components[key],
  48780. m.instances[key],
  48781. m, key
  48782. ); })
  48783. }))
  48784. }
  48785. function flatten (arr) {
  48786. return Array.prototype.concat.apply([], arr)
  48787. }
  48788. var hasSymbol =
  48789. typeof Symbol === 'function' &&
  48790. typeof Symbol.toStringTag === 'symbol';
  48791. function isESModule (obj) {
  48792. return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
  48793. }
  48794. // in Webpack 2, require.ensure now also returns a Promise
  48795. // so the resolve/reject functions may get called an extra time
  48796. // if the user uses an arrow function shorthand that happens to
  48797. // return that Promise.
  48798. function once (fn) {
  48799. var called = false;
  48800. return function () {
  48801. var args = [], len = arguments.length;
  48802. while ( len-- ) args[ len ] = arguments[ len ];
  48803. if (called) { return }
  48804. called = true;
  48805. return fn.apply(this, args)
  48806. }
  48807. }
  48808. var NavigationDuplicated = /*@__PURE__*/(function (Error) {
  48809. function NavigationDuplicated (normalizedLocation) {
  48810. Error.call(this);
  48811. this.name = this._name = 'NavigationDuplicated';
  48812. // passing the message to super() doesn't seem to work in the transpiled version
  48813. this.message = "Navigating to current location (\"" + (normalizedLocation.fullPath) + "\") is not allowed";
  48814. // add a stack property so services like Sentry can correctly display it
  48815. Object.defineProperty(this, 'stack', {
  48816. value: new Error().stack,
  48817. writable: true,
  48818. configurable: true
  48819. });
  48820. // we could also have used
  48821. // Error.captureStackTrace(this, this.constructor)
  48822. // but it only exists on node and chrome
  48823. }
  48824. if ( Error ) NavigationDuplicated.__proto__ = Error;
  48825. NavigationDuplicated.prototype = Object.create( Error && Error.prototype );
  48826. NavigationDuplicated.prototype.constructor = NavigationDuplicated;
  48827. return NavigationDuplicated;
  48828. }(Error));
  48829. // support IE9
  48830. NavigationDuplicated._name = 'NavigationDuplicated';
  48831. /* */
  48832. var History = function History (router, base) {
  48833. this.router = router;
  48834. this.base = normalizeBase(base);
  48835. // start with a route object that stands for "nowhere"
  48836. this.current = START;
  48837. this.pending = null;
  48838. this.ready = false;
  48839. this.readyCbs = [];
  48840. this.readyErrorCbs = [];
  48841. this.errorCbs = [];
  48842. };
  48843. History.prototype.listen = function listen (cb) {
  48844. this.cb = cb;
  48845. };
  48846. History.prototype.onReady = function onReady (cb, errorCb) {
  48847. if (this.ready) {
  48848. cb();
  48849. } else {
  48850. this.readyCbs.push(cb);
  48851. if (errorCb) {
  48852. this.readyErrorCbs.push(errorCb);
  48853. }
  48854. }
  48855. };
  48856. History.prototype.onError = function onError (errorCb) {
  48857. this.errorCbs.push(errorCb);
  48858. };
  48859. History.prototype.transitionTo = function transitionTo (
  48860. location,
  48861. onComplete,
  48862. onAbort
  48863. ) {
  48864. var this$1 = this;
  48865. var route = this.router.match(location, this.current);
  48866. this.confirmTransition(
  48867. route,
  48868. function () {
  48869. this$1.updateRoute(route);
  48870. onComplete && onComplete(route);
  48871. this$1.ensureURL();
  48872. // fire ready cbs once
  48873. if (!this$1.ready) {
  48874. this$1.ready = true;
  48875. this$1.readyCbs.forEach(function (cb) {
  48876. cb(route);
  48877. });
  48878. }
  48879. },
  48880. function (err) {
  48881. if (onAbort) {
  48882. onAbort(err);
  48883. }
  48884. if (err && !this$1.ready) {
  48885. this$1.ready = true;
  48886. this$1.readyErrorCbs.forEach(function (cb) {
  48887. cb(err);
  48888. });
  48889. }
  48890. }
  48891. );
  48892. };
  48893. History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
  48894. var this$1 = this;
  48895. var current = this.current;
  48896. var abort = function (err) {
  48897. // after merging https://github.com/vuejs/vue-router/pull/2771 we
  48898. // When the user navigates through history through back/forward buttons
  48899. // we do not want to throw the error. We only throw it if directly calling
  48900. // push/replace. That's why it's not included in isError
  48901. if (!isExtendedError(NavigationDuplicated, err) && isError(err)) {
  48902. if (this$1.errorCbs.length) {
  48903. this$1.errorCbs.forEach(function (cb) {
  48904. cb(err);
  48905. });
  48906. } else {
  48907. warn(false, 'uncaught error during route navigation:');
  48908. console.error(err);
  48909. }
  48910. }
  48911. onAbort && onAbort(err);
  48912. };
  48913. if (
  48914. isSameRoute(route, current) &&
  48915. // in the case the route map has been dynamically appended to
  48916. route.matched.length === current.matched.length
  48917. ) {
  48918. this.ensureURL();
  48919. return abort(new NavigationDuplicated(route))
  48920. }
  48921. var ref = resolveQueue(
  48922. this.current.matched,
  48923. route.matched
  48924. );
  48925. var updated = ref.updated;
  48926. var deactivated = ref.deactivated;
  48927. var activated = ref.activated;
  48928. var queue = [].concat(
  48929. // in-component leave guards
  48930. extractLeaveGuards(deactivated),
  48931. // global before hooks
  48932. this.router.beforeHooks,
  48933. // in-component update hooks
  48934. extractUpdateHooks(updated),
  48935. // in-config enter guards
  48936. activated.map(function (m) { return m.beforeEnter; }),
  48937. // async components
  48938. resolveAsyncComponents(activated)
  48939. );
  48940. this.pending = route;
  48941. var iterator = function (hook, next) {
  48942. if (this$1.pending !== route) {
  48943. return abort()
  48944. }
  48945. try {
  48946. hook(route, current, function (to) {
  48947. if (to === false || isError(to)) {
  48948. // next(false) -> abort navigation, ensure current URL
  48949. this$1.ensureURL(true);
  48950. abort(to);
  48951. } else if (
  48952. typeof to === 'string' ||
  48953. (typeof to === 'object' &&
  48954. (typeof to.path === 'string' || typeof to.name === 'string'))
  48955. ) {
  48956. // next('/') or next({ path: '/' }) -> redirect
  48957. abort();
  48958. if (typeof to === 'object' && to.replace) {
  48959. this$1.replace(to);
  48960. } else {
  48961. this$1.push(to);
  48962. }
  48963. } else {
  48964. // confirm transition and pass on the value
  48965. next(to);
  48966. }
  48967. });
  48968. } catch (e) {
  48969. abort(e);
  48970. }
  48971. };
  48972. runQueue(queue, iterator, function () {
  48973. var postEnterCbs = [];
  48974. var isValid = function () { return this$1.current === route; };
  48975. // wait until async components are resolved before
  48976. // extracting in-component enter guards
  48977. var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
  48978. var queue = enterGuards.concat(this$1.router.resolveHooks);
  48979. runQueue(queue, iterator, function () {
  48980. if (this$1.pending !== route) {
  48981. return abort()
  48982. }
  48983. this$1.pending = null;
  48984. onComplete(route);
  48985. if (this$1.router.app) {
  48986. this$1.router.app.$nextTick(function () {
  48987. postEnterCbs.forEach(function (cb) {
  48988. cb();
  48989. });
  48990. });
  48991. }
  48992. });
  48993. });
  48994. };
  48995. History.prototype.updateRoute = function updateRoute (route) {
  48996. var prev = this.current;
  48997. this.current = route;
  48998. this.cb && this.cb(route);
  48999. this.router.afterHooks.forEach(function (hook) {
  49000. hook && hook(route, prev);
  49001. });
  49002. };
  49003. function normalizeBase (base) {
  49004. if (!base) {
  49005. if (inBrowser) {
  49006. // respect <base> tag
  49007. var baseEl = document.querySelector('base');
  49008. base = (baseEl && baseEl.getAttribute('href')) || '/';
  49009. // strip full URL origin
  49010. base = base.replace(/^https?:\/\/[^\/]+/, '');
  49011. } else {
  49012. base = '/';
  49013. }
  49014. }
  49015. // make sure there's the starting slash
  49016. if (base.charAt(0) !== '/') {
  49017. base = '/' + base;
  49018. }
  49019. // remove trailing slash
  49020. return base.replace(/\/$/, '')
  49021. }
  49022. function resolveQueue (
  49023. current,
  49024. next
  49025. ) {
  49026. var i;
  49027. var max = Math.max(current.length, next.length);
  49028. for (i = 0; i < max; i++) {
  49029. if (current[i] !== next[i]) {
  49030. break
  49031. }
  49032. }
  49033. return {
  49034. updated: next.slice(0, i),
  49035. activated: next.slice(i),
  49036. deactivated: current.slice(i)
  49037. }
  49038. }
  49039. function extractGuards (
  49040. records,
  49041. name,
  49042. bind,
  49043. reverse
  49044. ) {
  49045. var guards = flatMapComponents(records, function (def, instance, match, key) {
  49046. var guard = extractGuard(def, name);
  49047. if (guard) {
  49048. return Array.isArray(guard)
  49049. ? guard.map(function (guard) { return bind(guard, instance, match, key); })
  49050. : bind(guard, instance, match, key)
  49051. }
  49052. });
  49053. return flatten(reverse ? guards.reverse() : guards)
  49054. }
  49055. function extractGuard (
  49056. def,
  49057. key
  49058. ) {
  49059. if (typeof def !== 'function') {
  49060. // extend now so that global mixins are applied.
  49061. def = _Vue.extend(def);
  49062. }
  49063. return def.options[key]
  49064. }
  49065. function extractLeaveGuards (deactivated) {
  49066. return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
  49067. }
  49068. function extractUpdateHooks (updated) {
  49069. return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
  49070. }
  49071. function bindGuard (guard, instance) {
  49072. if (instance) {
  49073. return function boundRouteGuard () {
  49074. return guard.apply(instance, arguments)
  49075. }
  49076. }
  49077. }
  49078. function extractEnterGuards (
  49079. activated,
  49080. cbs,
  49081. isValid
  49082. ) {
  49083. return extractGuards(
  49084. activated,
  49085. 'beforeRouteEnter',
  49086. function (guard, _, match, key) {
  49087. return bindEnterGuard(guard, match, key, cbs, isValid)
  49088. }
  49089. )
  49090. }
  49091. function bindEnterGuard (
  49092. guard,
  49093. match,
  49094. key,
  49095. cbs,
  49096. isValid
  49097. ) {
  49098. return function routeEnterGuard (to, from, next) {
  49099. return guard(to, from, function (cb) {
  49100. if (typeof cb === 'function') {
  49101. cbs.push(function () {
  49102. // #750
  49103. // if a router-view is wrapped with an out-in transition,
  49104. // the instance may not have been registered at this time.
  49105. // we will need to poll for registration until current route
  49106. // is no longer valid.
  49107. poll(cb, match.instances, key, isValid);
  49108. });
  49109. }
  49110. next(cb);
  49111. })
  49112. }
  49113. }
  49114. function poll (
  49115. cb, // somehow flow cannot infer this is a function
  49116. instances,
  49117. key,
  49118. isValid
  49119. ) {
  49120. if (
  49121. instances[key] &&
  49122. !instances[key]._isBeingDestroyed // do not reuse being destroyed instance
  49123. ) {
  49124. cb(instances[key]);
  49125. } else if (isValid()) {
  49126. setTimeout(function () {
  49127. poll(cb, instances, key, isValid);
  49128. }, 16);
  49129. }
  49130. }
  49131. /* */
  49132. var HTML5History = /*@__PURE__*/(function (History) {
  49133. function HTML5History (router, base) {
  49134. var this$1 = this;
  49135. History.call(this, router, base);
  49136. var expectScroll = router.options.scrollBehavior;
  49137. var supportsScroll = supportsPushState && expectScroll;
  49138. if (supportsScroll) {
  49139. setupScroll();
  49140. }
  49141. var initLocation = getLocation(this.base);
  49142. window.addEventListener('popstate', function (e) {
  49143. var current = this$1.current;
  49144. // Avoiding first `popstate` event dispatched in some browsers but first
  49145. // history route not updated since async guard at the same time.
  49146. var location = getLocation(this$1.base);
  49147. if (this$1.current === START && location === initLocation) {
  49148. return
  49149. }
  49150. this$1.transitionTo(location, function (route) {
  49151. if (supportsScroll) {
  49152. handleScroll(router, route, current, true);
  49153. }
  49154. });
  49155. });
  49156. }
  49157. if ( History ) HTML5History.__proto__ = History;
  49158. HTML5History.prototype = Object.create( History && History.prototype );
  49159. HTML5History.prototype.constructor = HTML5History;
  49160. HTML5History.prototype.go = function go (n) {
  49161. window.history.go(n);
  49162. };
  49163. HTML5History.prototype.push = function push (location, onComplete, onAbort) {
  49164. var this$1 = this;
  49165. var ref = this;
  49166. var fromRoute = ref.current;
  49167. this.transitionTo(location, function (route) {
  49168. pushState(cleanPath(this$1.base + route.fullPath));
  49169. handleScroll(this$1.router, route, fromRoute, false);
  49170. onComplete && onComplete(route);
  49171. }, onAbort);
  49172. };
  49173. HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
  49174. var this$1 = this;
  49175. var ref = this;
  49176. var fromRoute = ref.current;
  49177. this.transitionTo(location, function (route) {
  49178. replaceState(cleanPath(this$1.base + route.fullPath));
  49179. handleScroll(this$1.router, route, fromRoute, false);
  49180. onComplete && onComplete(route);
  49181. }, onAbort);
  49182. };
  49183. HTML5History.prototype.ensureURL = function ensureURL (push) {
  49184. if (getLocation(this.base) !== this.current.fullPath) {
  49185. var current = cleanPath(this.base + this.current.fullPath);
  49186. push ? pushState(current) : replaceState(current);
  49187. }
  49188. };
  49189. HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
  49190. return getLocation(this.base)
  49191. };
  49192. return HTML5History;
  49193. }(History));
  49194. function getLocation (base) {
  49195. var path = decodeURI(window.location.pathname);
  49196. if (base && path.indexOf(base) === 0) {
  49197. path = path.slice(base.length);
  49198. }
  49199. return (path || '/') + window.location.search + window.location.hash
  49200. }
  49201. /* */
  49202. var HashHistory = /*@__PURE__*/(function (History) {
  49203. function HashHistory (router, base, fallback) {
  49204. History.call(this, router, base);
  49205. // check history fallback deeplinking
  49206. if (fallback && checkFallback(this.base)) {
  49207. return
  49208. }
  49209. ensureSlash();
  49210. }
  49211. if ( History ) HashHistory.__proto__ = History;
  49212. HashHistory.prototype = Object.create( History && History.prototype );
  49213. HashHistory.prototype.constructor = HashHistory;
  49214. // this is delayed until the app mounts
  49215. // to avoid the hashchange listener being fired too early
  49216. HashHistory.prototype.setupListeners = function setupListeners () {
  49217. var this$1 = this;
  49218. var router = this.router;
  49219. var expectScroll = router.options.scrollBehavior;
  49220. var supportsScroll = supportsPushState && expectScroll;
  49221. if (supportsScroll) {
  49222. setupScroll();
  49223. }
  49224. window.addEventListener(
  49225. supportsPushState ? 'popstate' : 'hashchange',
  49226. function () {
  49227. var current = this$1.current;
  49228. if (!ensureSlash()) {
  49229. return
  49230. }
  49231. this$1.transitionTo(getHash(), function (route) {
  49232. if (supportsScroll) {
  49233. handleScroll(this$1.router, route, current, true);
  49234. }
  49235. if (!supportsPushState) {
  49236. replaceHash(route.fullPath);
  49237. }
  49238. });
  49239. }
  49240. );
  49241. };
  49242. HashHistory.prototype.push = function push (location, onComplete, onAbort) {
  49243. var this$1 = this;
  49244. var ref = this;
  49245. var fromRoute = ref.current;
  49246. this.transitionTo(
  49247. location,
  49248. function (route) {
  49249. pushHash(route.fullPath);
  49250. handleScroll(this$1.router, route, fromRoute, false);
  49251. onComplete && onComplete(route);
  49252. },
  49253. onAbort
  49254. );
  49255. };
  49256. HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  49257. var this$1 = this;
  49258. var ref = this;
  49259. var fromRoute = ref.current;
  49260. this.transitionTo(
  49261. location,
  49262. function (route) {
  49263. replaceHash(route.fullPath);
  49264. handleScroll(this$1.router, route, fromRoute, false);
  49265. onComplete && onComplete(route);
  49266. },
  49267. onAbort
  49268. );
  49269. };
  49270. HashHistory.prototype.go = function go (n) {
  49271. window.history.go(n);
  49272. };
  49273. HashHistory.prototype.ensureURL = function ensureURL (push) {
  49274. var current = this.current.fullPath;
  49275. if (getHash() !== current) {
  49276. push ? pushHash(current) : replaceHash(current);
  49277. }
  49278. };
  49279. HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  49280. return getHash()
  49281. };
  49282. return HashHistory;
  49283. }(History));
  49284. function checkFallback (base) {
  49285. var location = getLocation(base);
  49286. if (!/^\/#/.test(location)) {
  49287. window.location.replace(cleanPath(base + '/#' + location));
  49288. return true
  49289. }
  49290. }
  49291. function ensureSlash () {
  49292. var path = getHash();
  49293. if (path.charAt(0) === '/') {
  49294. return true
  49295. }
  49296. replaceHash('/' + path);
  49297. return false
  49298. }
  49299. function getHash () {
  49300. // We can't use window.location.hash here because it's not
  49301. // consistent across browsers - Firefox will pre-decode it!
  49302. var href = window.location.href;
  49303. var index = href.indexOf('#');
  49304. // empty path
  49305. if (index < 0) { return '' }
  49306. href = href.slice(index + 1);
  49307. // decode the hash but not the search or hash
  49308. // as search(query) is already decoded
  49309. // https://github.com/vuejs/vue-router/issues/2708
  49310. var searchIndex = href.indexOf('?');
  49311. if (searchIndex < 0) {
  49312. var hashIndex = href.indexOf('#');
  49313. if (hashIndex > -1) {
  49314. href = decodeURI(href.slice(0, hashIndex)) + href.slice(hashIndex);
  49315. } else { href = decodeURI(href); }
  49316. } else {
  49317. href = decodeURI(href.slice(0, searchIndex)) + href.slice(searchIndex);
  49318. }
  49319. return href
  49320. }
  49321. function getUrl (path) {
  49322. var href = window.location.href;
  49323. var i = href.indexOf('#');
  49324. var base = i >= 0 ? href.slice(0, i) : href;
  49325. return (base + "#" + path)
  49326. }
  49327. function pushHash (path) {
  49328. if (supportsPushState) {
  49329. pushState(getUrl(path));
  49330. } else {
  49331. window.location.hash = path;
  49332. }
  49333. }
  49334. function replaceHash (path) {
  49335. if (supportsPushState) {
  49336. replaceState(getUrl(path));
  49337. } else {
  49338. window.location.replace(getUrl(path));
  49339. }
  49340. }
  49341. /* */
  49342. var AbstractHistory = /*@__PURE__*/(function (History) {
  49343. function AbstractHistory (router, base) {
  49344. History.call(this, router, base);
  49345. this.stack = [];
  49346. this.index = -1;
  49347. }
  49348. if ( History ) AbstractHistory.__proto__ = History;
  49349. AbstractHistory.prototype = Object.create( History && History.prototype );
  49350. AbstractHistory.prototype.constructor = AbstractHistory;
  49351. AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
  49352. var this$1 = this;
  49353. this.transitionTo(
  49354. location,
  49355. function (route) {
  49356. this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
  49357. this$1.index++;
  49358. onComplete && onComplete(route);
  49359. },
  49360. onAbort
  49361. );
  49362. };
  49363. AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  49364. var this$1 = this;
  49365. this.transitionTo(
  49366. location,
  49367. function (route) {
  49368. this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
  49369. onComplete && onComplete(route);
  49370. },
  49371. onAbort
  49372. );
  49373. };
  49374. AbstractHistory.prototype.go = function go (n) {
  49375. var this$1 = this;
  49376. var targetIndex = this.index + n;
  49377. if (targetIndex < 0 || targetIndex >= this.stack.length) {
  49378. return
  49379. }
  49380. var route = this.stack[targetIndex];
  49381. this.confirmTransition(
  49382. route,
  49383. function () {
  49384. this$1.index = targetIndex;
  49385. this$1.updateRoute(route);
  49386. },
  49387. function (err) {
  49388. if (isExtendedError(NavigationDuplicated, err)) {
  49389. this$1.index = targetIndex;
  49390. }
  49391. }
  49392. );
  49393. };
  49394. AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  49395. var current = this.stack[this.stack.length - 1];
  49396. return current ? current.fullPath : '/'
  49397. };
  49398. AbstractHistory.prototype.ensureURL = function ensureURL () {
  49399. // noop
  49400. };
  49401. return AbstractHistory;
  49402. }(History));
  49403. /* */
  49404. var VueRouter = function VueRouter (options) {
  49405. if ( options === void 0 ) options = {};
  49406. this.app = null;
  49407. this.apps = [];
  49408. this.options = options;
  49409. this.beforeHooks = [];
  49410. this.resolveHooks = [];
  49411. this.afterHooks = [];
  49412. this.matcher = createMatcher(options.routes || [], this);
  49413. var mode = options.mode || 'hash';
  49414. this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
  49415. if (this.fallback) {
  49416. mode = 'hash';
  49417. }
  49418. if (!inBrowser) {
  49419. mode = 'abstract';
  49420. }
  49421. this.mode = mode;
  49422. switch (mode) {
  49423. case 'history':
  49424. this.history = new HTML5History(this, options.base);
  49425. break
  49426. case 'hash':
  49427. this.history = new HashHistory(this, options.base, this.fallback);
  49428. break
  49429. case 'abstract':
  49430. this.history = new AbstractHistory(this, options.base);
  49431. break
  49432. default:
  49433. if (true) {
  49434. assert(false, ("invalid mode: " + mode));
  49435. }
  49436. }
  49437. };
  49438. var prototypeAccessors = { currentRoute: { configurable: true } };
  49439. VueRouter.prototype.match = function match (
  49440. raw,
  49441. current,
  49442. redirectedFrom
  49443. ) {
  49444. return this.matcher.match(raw, current, redirectedFrom)
  49445. };
  49446. prototypeAccessors.currentRoute.get = function () {
  49447. return this.history && this.history.current
  49448. };
  49449. VueRouter.prototype.init = function init (app /* Vue component instance */) {
  49450. var this$1 = this;
  49451. true && assert(
  49452. install.installed,
  49453. "not installed. Make sure to call `Vue.use(VueRouter)` " +
  49454. "before creating root instance."
  49455. );
  49456. this.apps.push(app);
  49457. // set up app destroyed handler
  49458. // https://github.com/vuejs/vue-router/issues/2639
  49459. app.$once('hook:destroyed', function () {
  49460. // clean out app from this.apps array once destroyed
  49461. var index = this$1.apps.indexOf(app);
  49462. if (index > -1) { this$1.apps.splice(index, 1); }
  49463. // ensure we still have a main app or null if no apps
  49464. // we do not release the router so it can be reused
  49465. if (this$1.app === app) { this$1.app = this$1.apps[0] || null; }
  49466. });
  49467. // main app previously initialized
  49468. // return as we don't need to set up new history listener
  49469. if (this.app) {
  49470. return
  49471. }
  49472. this.app = app;
  49473. var history = this.history;
  49474. if (history instanceof HTML5History) {
  49475. history.transitionTo(history.getCurrentLocation());
  49476. } else if (history instanceof HashHistory) {
  49477. var setupHashListener = function () {
  49478. history.setupListeners();
  49479. };
  49480. history.transitionTo(
  49481. history.getCurrentLocation(),
  49482. setupHashListener,
  49483. setupHashListener
  49484. );
  49485. }
  49486. history.listen(function (route) {
  49487. this$1.apps.forEach(function (app) {
  49488. app._route = route;
  49489. });
  49490. });
  49491. };
  49492. VueRouter.prototype.beforeEach = function beforeEach (fn) {
  49493. return registerHook(this.beforeHooks, fn)
  49494. };
  49495. VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
  49496. return registerHook(this.resolveHooks, fn)
  49497. };
  49498. VueRouter.prototype.afterEach = function afterEach (fn) {
  49499. return registerHook(this.afterHooks, fn)
  49500. };
  49501. VueRouter.prototype.onReady = function onReady (cb, errorCb) {
  49502. this.history.onReady(cb, errorCb);
  49503. };
  49504. VueRouter.prototype.onError = function onError (errorCb) {
  49505. this.history.onError(errorCb);
  49506. };
  49507. VueRouter.prototype.push = function push (location, onComplete, onAbort) {
  49508. var this$1 = this;
  49509. // $flow-disable-line
  49510. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  49511. return new Promise(function (resolve, reject) {
  49512. this$1.history.push(location, resolve, reject);
  49513. })
  49514. } else {
  49515. this.history.push(location, onComplete, onAbort);
  49516. }
  49517. };
  49518. VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
  49519. var this$1 = this;
  49520. // $flow-disable-line
  49521. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  49522. return new Promise(function (resolve, reject) {
  49523. this$1.history.replace(location, resolve, reject);
  49524. })
  49525. } else {
  49526. this.history.replace(location, onComplete, onAbort);
  49527. }
  49528. };
  49529. VueRouter.prototype.go = function go (n) {
  49530. this.history.go(n);
  49531. };
  49532. VueRouter.prototype.back = function back () {
  49533. this.go(-1);
  49534. };
  49535. VueRouter.prototype.forward = function forward () {
  49536. this.go(1);
  49537. };
  49538. VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
  49539. var route = to
  49540. ? to.matched
  49541. ? to
  49542. : this.resolve(to).route
  49543. : this.currentRoute;
  49544. if (!route) {
  49545. return []
  49546. }
  49547. return [].concat.apply([], route.matched.map(function (m) {
  49548. return Object.keys(m.components).map(function (key) {
  49549. return m.components[key]
  49550. })
  49551. }))
  49552. };
  49553. VueRouter.prototype.resolve = function resolve (
  49554. to,
  49555. current,
  49556. append
  49557. ) {
  49558. current = current || this.history.current;
  49559. var location = normalizeLocation(
  49560. to,
  49561. current,
  49562. append,
  49563. this
  49564. );
  49565. var route = this.match(location, current);
  49566. var fullPath = route.redirectedFrom || route.fullPath;
  49567. var base = this.history.base;
  49568. var href = createHref(base, fullPath, this.mode);
  49569. return {
  49570. location: location,
  49571. route: route,
  49572. href: href,
  49573. // for backwards compat
  49574. normalizedTo: location,
  49575. resolved: route
  49576. }
  49577. };
  49578. VueRouter.prototype.addRoutes = function addRoutes (routes) {
  49579. this.matcher.addRoutes(routes);
  49580. if (this.history.current !== START) {
  49581. this.history.transitionTo(this.history.getCurrentLocation());
  49582. }
  49583. };
  49584. Object.defineProperties( VueRouter.prototype, prototypeAccessors );
  49585. function registerHook (list, fn) {
  49586. list.push(fn);
  49587. return function () {
  49588. var i = list.indexOf(fn);
  49589. if (i > -1) { list.splice(i, 1); }
  49590. }
  49591. }
  49592. function createHref (base, fullPath, mode) {
  49593. var path = mode === 'hash' ? '#' + fullPath : fullPath;
  49594. return base ? cleanPath(base + '/' + path) : path
  49595. }
  49596. VueRouter.install = install;
  49597. VueRouter.version = '3.1.6';
  49598. if (inBrowser && window.Vue) {
  49599. window.Vue.use(VueRouter);
  49600. }
  49601. /* harmony default export */ __webpack_exports__["default"] = (VueRouter);
  49602. /***/ }),
  49603. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  49604. /*!*************************************************!*\
  49605. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  49606. \*************************************************/
  49607. /*! no static exports found */
  49608. /***/ (function(module, exports, __webpack_require__) {
  49609. "use strict";
  49610. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  49611. * Vue.js v2.6.11
  49612. * (c) 2014-2019 Evan You
  49613. * Released under the MIT License.
  49614. */
  49615. /* */
  49616. var emptyObject = Object.freeze({});
  49617. // These helpers produce better VM code in JS engines due to their
  49618. // explicitness and function inlining.
  49619. function isUndef (v) {
  49620. return v === undefined || v === null
  49621. }
  49622. function isDef (v) {
  49623. return v !== undefined && v !== null
  49624. }
  49625. function isTrue (v) {
  49626. return v === true
  49627. }
  49628. function isFalse (v) {
  49629. return v === false
  49630. }
  49631. /**
  49632. * Check if value is primitive.
  49633. */
  49634. function isPrimitive (value) {
  49635. return (
  49636. typeof value === 'string' ||
  49637. typeof value === 'number' ||
  49638. // $flow-disable-line
  49639. typeof value === 'symbol' ||
  49640. typeof value === 'boolean'
  49641. )
  49642. }
  49643. /**
  49644. * Quick object check - this is primarily used to tell
  49645. * Objects from primitive values when we know the value
  49646. * is a JSON-compliant type.
  49647. */
  49648. function isObject (obj) {
  49649. return obj !== null && typeof obj === 'object'
  49650. }
  49651. /**
  49652. * Get the raw type string of a value, e.g., [object Object].
  49653. */
  49654. var _toString = Object.prototype.toString;
  49655. function toRawType (value) {
  49656. return _toString.call(value).slice(8, -1)
  49657. }
  49658. /**
  49659. * Strict object type check. Only returns true
  49660. * for plain JavaScript objects.
  49661. */
  49662. function isPlainObject (obj) {
  49663. return _toString.call(obj) === '[object Object]'
  49664. }
  49665. function isRegExp (v) {
  49666. return _toString.call(v) === '[object RegExp]'
  49667. }
  49668. /**
  49669. * Check if val is a valid array index.
  49670. */
  49671. function isValidArrayIndex (val) {
  49672. var n = parseFloat(String(val));
  49673. return n >= 0 && Math.floor(n) === n && isFinite(val)
  49674. }
  49675. function isPromise (val) {
  49676. return (
  49677. isDef(val) &&
  49678. typeof val.then === 'function' &&
  49679. typeof val.catch === 'function'
  49680. )
  49681. }
  49682. /**
  49683. * Convert a value to a string that is actually rendered.
  49684. */
  49685. function toString (val) {
  49686. return val == null
  49687. ? ''
  49688. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  49689. ? JSON.stringify(val, null, 2)
  49690. : String(val)
  49691. }
  49692. /**
  49693. * Convert an input value to a number for persistence.
  49694. * If the conversion fails, return original string.
  49695. */
  49696. function toNumber (val) {
  49697. var n = parseFloat(val);
  49698. return isNaN(n) ? val : n
  49699. }
  49700. /**
  49701. * Make a map and return a function for checking if a key
  49702. * is in that map.
  49703. */
  49704. function makeMap (
  49705. str,
  49706. expectsLowerCase
  49707. ) {
  49708. var map = Object.create(null);
  49709. var list = str.split(',');
  49710. for (var i = 0; i < list.length; i++) {
  49711. map[list[i]] = true;
  49712. }
  49713. return expectsLowerCase
  49714. ? function (val) { return map[val.toLowerCase()]; }
  49715. : function (val) { return map[val]; }
  49716. }
  49717. /**
  49718. * Check if a tag is a built-in tag.
  49719. */
  49720. var isBuiltInTag = makeMap('slot,component', true);
  49721. /**
  49722. * Check if an attribute is a reserved attribute.
  49723. */
  49724. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  49725. /**
  49726. * Remove an item from an array.
  49727. */
  49728. function remove (arr, item) {
  49729. if (arr.length) {
  49730. var index = arr.indexOf(item);
  49731. if (index > -1) {
  49732. return arr.splice(index, 1)
  49733. }
  49734. }
  49735. }
  49736. /**
  49737. * Check whether an object has the property.
  49738. */
  49739. var hasOwnProperty = Object.prototype.hasOwnProperty;
  49740. function hasOwn (obj, key) {
  49741. return hasOwnProperty.call(obj, key)
  49742. }
  49743. /**
  49744. * Create a cached version of a pure function.
  49745. */
  49746. function cached (fn) {
  49747. var cache = Object.create(null);
  49748. return (function cachedFn (str) {
  49749. var hit = cache[str];
  49750. return hit || (cache[str] = fn(str))
  49751. })
  49752. }
  49753. /**
  49754. * Camelize a hyphen-delimited string.
  49755. */
  49756. var camelizeRE = /-(\w)/g;
  49757. var camelize = cached(function (str) {
  49758. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  49759. });
  49760. /**
  49761. * Capitalize a string.
  49762. */
  49763. var capitalize = cached(function (str) {
  49764. return str.charAt(0).toUpperCase() + str.slice(1)
  49765. });
  49766. /**
  49767. * Hyphenate a camelCase string.
  49768. */
  49769. var hyphenateRE = /\B([A-Z])/g;
  49770. var hyphenate = cached(function (str) {
  49771. return str.replace(hyphenateRE, '-$1').toLowerCase()
  49772. });
  49773. /**
  49774. * Simple bind polyfill for environments that do not support it,
  49775. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  49776. * since native bind is now performant enough in most browsers.
  49777. * But removing it would mean breaking code that was able to run in
  49778. * PhantomJS 1.x, so this must be kept for backward compatibility.
  49779. */
  49780. /* istanbul ignore next */
  49781. function polyfillBind (fn, ctx) {
  49782. function boundFn (a) {
  49783. var l = arguments.length;
  49784. return l
  49785. ? l > 1
  49786. ? fn.apply(ctx, arguments)
  49787. : fn.call(ctx, a)
  49788. : fn.call(ctx)
  49789. }
  49790. boundFn._length = fn.length;
  49791. return boundFn
  49792. }
  49793. function nativeBind (fn, ctx) {
  49794. return fn.bind(ctx)
  49795. }
  49796. var bind = Function.prototype.bind
  49797. ? nativeBind
  49798. : polyfillBind;
  49799. /**
  49800. * Convert an Array-like object to a real Array.
  49801. */
  49802. function toArray (list, start) {
  49803. start = start || 0;
  49804. var i = list.length - start;
  49805. var ret = new Array(i);
  49806. while (i--) {
  49807. ret[i] = list[i + start];
  49808. }
  49809. return ret
  49810. }
  49811. /**
  49812. * Mix properties into target object.
  49813. */
  49814. function extend (to, _from) {
  49815. for (var key in _from) {
  49816. to[key] = _from[key];
  49817. }
  49818. return to
  49819. }
  49820. /**
  49821. * Merge an Array of Objects into a single Object.
  49822. */
  49823. function toObject (arr) {
  49824. var res = {};
  49825. for (var i = 0; i < arr.length; i++) {
  49826. if (arr[i]) {
  49827. extend(res, arr[i]);
  49828. }
  49829. }
  49830. return res
  49831. }
  49832. /* eslint-disable no-unused-vars */
  49833. /**
  49834. * Perform no operation.
  49835. * Stubbing args to make Flow happy without leaving useless transpiled code
  49836. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  49837. */
  49838. function noop (a, b, c) {}
  49839. /**
  49840. * Always return false.
  49841. */
  49842. var no = function (a, b, c) { return false; };
  49843. /* eslint-enable no-unused-vars */
  49844. /**
  49845. * Return the same value.
  49846. */
  49847. var identity = function (_) { return _; };
  49848. /**
  49849. * Generate a string containing static keys from compiler modules.
  49850. */
  49851. function genStaticKeys (modules) {
  49852. return modules.reduce(function (keys, m) {
  49853. return keys.concat(m.staticKeys || [])
  49854. }, []).join(',')
  49855. }
  49856. /**
  49857. * Check if two values are loosely equal - that is,
  49858. * if they are plain objects, do they have the same shape?
  49859. */
  49860. function looseEqual (a, b) {
  49861. if (a === b) { return true }
  49862. var isObjectA = isObject(a);
  49863. var isObjectB = isObject(b);
  49864. if (isObjectA && isObjectB) {
  49865. try {
  49866. var isArrayA = Array.isArray(a);
  49867. var isArrayB = Array.isArray(b);
  49868. if (isArrayA && isArrayB) {
  49869. return a.length === b.length && a.every(function (e, i) {
  49870. return looseEqual(e, b[i])
  49871. })
  49872. } else if (a instanceof Date && b instanceof Date) {
  49873. return a.getTime() === b.getTime()
  49874. } else if (!isArrayA && !isArrayB) {
  49875. var keysA = Object.keys(a);
  49876. var keysB = Object.keys(b);
  49877. return keysA.length === keysB.length && keysA.every(function (key) {
  49878. return looseEqual(a[key], b[key])
  49879. })
  49880. } else {
  49881. /* istanbul ignore next */
  49882. return false
  49883. }
  49884. } catch (e) {
  49885. /* istanbul ignore next */
  49886. return false
  49887. }
  49888. } else if (!isObjectA && !isObjectB) {
  49889. return String(a) === String(b)
  49890. } else {
  49891. return false
  49892. }
  49893. }
  49894. /**
  49895. * Return the first index at which a loosely equal value can be
  49896. * found in the array (if value is a plain object, the array must
  49897. * contain an object of the same shape), or -1 if it is not present.
  49898. */
  49899. function looseIndexOf (arr, val) {
  49900. for (var i = 0; i < arr.length; i++) {
  49901. if (looseEqual(arr[i], val)) { return i }
  49902. }
  49903. return -1
  49904. }
  49905. /**
  49906. * Ensure a function is called only once.
  49907. */
  49908. function once (fn) {
  49909. var called = false;
  49910. return function () {
  49911. if (!called) {
  49912. called = true;
  49913. fn.apply(this, arguments);
  49914. }
  49915. }
  49916. }
  49917. var SSR_ATTR = 'data-server-rendered';
  49918. var ASSET_TYPES = [
  49919. 'component',
  49920. 'directive',
  49921. 'filter'
  49922. ];
  49923. var LIFECYCLE_HOOKS = [
  49924. 'beforeCreate',
  49925. 'created',
  49926. 'beforeMount',
  49927. 'mounted',
  49928. 'beforeUpdate',
  49929. 'updated',
  49930. 'beforeDestroy',
  49931. 'destroyed',
  49932. 'activated',
  49933. 'deactivated',
  49934. 'errorCaptured',
  49935. 'serverPrefetch'
  49936. ];
  49937. /* */
  49938. var config = ({
  49939. /**
  49940. * Option merge strategies (used in core/util/options)
  49941. */
  49942. // $flow-disable-line
  49943. optionMergeStrategies: Object.create(null),
  49944. /**
  49945. * Whether to suppress warnings.
  49946. */
  49947. silent: false,
  49948. /**
  49949. * Show production mode tip message on boot?
  49950. */
  49951. productionTip: "development" !== 'production',
  49952. /**
  49953. * Whether to enable devtools
  49954. */
  49955. devtools: "development" !== 'production',
  49956. /**
  49957. * Whether to record perf
  49958. */
  49959. performance: false,
  49960. /**
  49961. * Error handler for watcher errors
  49962. */
  49963. errorHandler: null,
  49964. /**
  49965. * Warn handler for watcher warns
  49966. */
  49967. warnHandler: null,
  49968. /**
  49969. * Ignore certain custom elements
  49970. */
  49971. ignoredElements: [],
  49972. /**
  49973. * Custom user key aliases for v-on
  49974. */
  49975. // $flow-disable-line
  49976. keyCodes: Object.create(null),
  49977. /**
  49978. * Check if a tag is reserved so that it cannot be registered as a
  49979. * component. This is platform-dependent and may be overwritten.
  49980. */
  49981. isReservedTag: no,
  49982. /**
  49983. * Check if an attribute is reserved so that it cannot be used as a component
  49984. * prop. This is platform-dependent and may be overwritten.
  49985. */
  49986. isReservedAttr: no,
  49987. /**
  49988. * Check if a tag is an unknown element.
  49989. * Platform-dependent.
  49990. */
  49991. isUnknownElement: no,
  49992. /**
  49993. * Get the namespace of an element
  49994. */
  49995. getTagNamespace: noop,
  49996. /**
  49997. * Parse the real tag name for the specific platform.
  49998. */
  49999. parsePlatformTagName: identity,
  50000. /**
  50001. * Check if an attribute must be bound using property, e.g. value
  50002. * Platform-dependent.
  50003. */
  50004. mustUseProp: no,
  50005. /**
  50006. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  50007. * This will significantly reduce performance if set to false.
  50008. */
  50009. async: true,
  50010. /**
  50011. * Exposed for legacy reasons
  50012. */
  50013. _lifecycleHooks: LIFECYCLE_HOOKS
  50014. });
  50015. /* */
  50016. /**
  50017. * unicode letters used for parsing html tags, component names and property paths.
  50018. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  50019. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  50020. */
  50021. 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/;
  50022. /**
  50023. * Check if a string starts with $ or _
  50024. */
  50025. function isReserved (str) {
  50026. var c = (str + '').charCodeAt(0);
  50027. return c === 0x24 || c === 0x5F
  50028. }
  50029. /**
  50030. * Define a property.
  50031. */
  50032. function def (obj, key, val, enumerable) {
  50033. Object.defineProperty(obj, key, {
  50034. value: val,
  50035. enumerable: !!enumerable,
  50036. writable: true,
  50037. configurable: true
  50038. });
  50039. }
  50040. /**
  50041. * Parse simple path.
  50042. */
  50043. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  50044. function parsePath (path) {
  50045. if (bailRE.test(path)) {
  50046. return
  50047. }
  50048. var segments = path.split('.');
  50049. return function (obj) {
  50050. for (var i = 0; i < segments.length; i++) {
  50051. if (!obj) { return }
  50052. obj = obj[segments[i]];
  50053. }
  50054. return obj
  50055. }
  50056. }
  50057. /* */
  50058. // can we use __proto__?
  50059. var hasProto = '__proto__' in {};
  50060. // Browser environment sniffing
  50061. var inBrowser = typeof window !== 'undefined';
  50062. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  50063. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  50064. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  50065. var isIE = UA && /msie|trident/.test(UA);
  50066. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  50067. var isEdge = UA && UA.indexOf('edge/') > 0;
  50068. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  50069. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  50070. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  50071. var isPhantomJS = UA && /phantomjs/.test(UA);
  50072. var isFF = UA && UA.match(/firefox\/(\d+)/);
  50073. // Firefox has a "watch" function on Object.prototype...
  50074. var nativeWatch = ({}).watch;
  50075. var supportsPassive = false;
  50076. if (inBrowser) {
  50077. try {
  50078. var opts = {};
  50079. Object.defineProperty(opts, 'passive', ({
  50080. get: function get () {
  50081. /* istanbul ignore next */
  50082. supportsPassive = true;
  50083. }
  50084. })); // https://github.com/facebook/flow/issues/285
  50085. window.addEventListener('test-passive', null, opts);
  50086. } catch (e) {}
  50087. }
  50088. // this needs to be lazy-evaled because vue may be required before
  50089. // vue-server-renderer can set VUE_ENV
  50090. var _isServer;
  50091. var isServerRendering = function () {
  50092. if (_isServer === undefined) {
  50093. /* istanbul ignore if */
  50094. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  50095. // detect presence of vue-server-renderer and avoid
  50096. // Webpack shimming the process
  50097. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  50098. } else {
  50099. _isServer = false;
  50100. }
  50101. }
  50102. return _isServer
  50103. };
  50104. // detect devtools
  50105. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  50106. /* istanbul ignore next */
  50107. function isNative (Ctor) {
  50108. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  50109. }
  50110. var hasSymbol =
  50111. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  50112. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  50113. var _Set;
  50114. /* istanbul ignore if */ // $flow-disable-line
  50115. if (typeof Set !== 'undefined' && isNative(Set)) {
  50116. // use native Set when available.
  50117. _Set = Set;
  50118. } else {
  50119. // a non-standard Set polyfill that only works with primitive keys.
  50120. _Set = /*@__PURE__*/(function () {
  50121. function Set () {
  50122. this.set = Object.create(null);
  50123. }
  50124. Set.prototype.has = function has (key) {
  50125. return this.set[key] === true
  50126. };
  50127. Set.prototype.add = function add (key) {
  50128. this.set[key] = true;
  50129. };
  50130. Set.prototype.clear = function clear () {
  50131. this.set = Object.create(null);
  50132. };
  50133. return Set;
  50134. }());
  50135. }
  50136. /* */
  50137. var warn = noop;
  50138. var tip = noop;
  50139. var generateComponentTrace = (noop); // work around flow check
  50140. var formatComponentName = (noop);
  50141. {
  50142. var hasConsole = typeof console !== 'undefined';
  50143. var classifyRE = /(?:^|[-_])(\w)/g;
  50144. var classify = function (str) { return str
  50145. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  50146. .replace(/[-_]/g, ''); };
  50147. warn = function (msg, vm) {
  50148. var trace = vm ? generateComponentTrace(vm) : '';
  50149. if (config.warnHandler) {
  50150. config.warnHandler.call(null, msg, vm, trace);
  50151. } else if (hasConsole && (!config.silent)) {
  50152. console.error(("[Vue warn]: " + msg + trace));
  50153. }
  50154. };
  50155. tip = function (msg, vm) {
  50156. if (hasConsole && (!config.silent)) {
  50157. console.warn("[Vue tip]: " + msg + (
  50158. vm ? generateComponentTrace(vm) : ''
  50159. ));
  50160. }
  50161. };
  50162. formatComponentName = function (vm, includeFile) {
  50163. if (vm.$root === vm) {
  50164. return '<Root>'
  50165. }
  50166. var options = typeof vm === 'function' && vm.cid != null
  50167. ? vm.options
  50168. : vm._isVue
  50169. ? vm.$options || vm.constructor.options
  50170. : vm;
  50171. var name = options.name || options._componentTag;
  50172. var file = options.__file;
  50173. if (!name && file) {
  50174. var match = file.match(/([^/\\]+)\.vue$/);
  50175. name = match && match[1];
  50176. }
  50177. return (
  50178. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  50179. (file && includeFile !== false ? (" at " + file) : '')
  50180. )
  50181. };
  50182. var repeat = function (str, n) {
  50183. var res = '';
  50184. while (n) {
  50185. if (n % 2 === 1) { res += str; }
  50186. if (n > 1) { str += str; }
  50187. n >>= 1;
  50188. }
  50189. return res
  50190. };
  50191. generateComponentTrace = function (vm) {
  50192. if (vm._isVue && vm.$parent) {
  50193. var tree = [];
  50194. var currentRecursiveSequence = 0;
  50195. while (vm) {
  50196. if (tree.length > 0) {
  50197. var last = tree[tree.length - 1];
  50198. if (last.constructor === vm.constructor) {
  50199. currentRecursiveSequence++;
  50200. vm = vm.$parent;
  50201. continue
  50202. } else if (currentRecursiveSequence > 0) {
  50203. tree[tree.length - 1] = [last, currentRecursiveSequence];
  50204. currentRecursiveSequence = 0;
  50205. }
  50206. }
  50207. tree.push(vm);
  50208. vm = vm.$parent;
  50209. }
  50210. return '\n\nfound in\n\n' + tree
  50211. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  50212. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  50213. : formatComponentName(vm))); })
  50214. .join('\n')
  50215. } else {
  50216. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  50217. }
  50218. };
  50219. }
  50220. /* */
  50221. var uid = 0;
  50222. /**
  50223. * A dep is an observable that can have multiple
  50224. * directives subscribing to it.
  50225. */
  50226. var Dep = function Dep () {
  50227. this.id = uid++;
  50228. this.subs = [];
  50229. };
  50230. Dep.prototype.addSub = function addSub (sub) {
  50231. this.subs.push(sub);
  50232. };
  50233. Dep.prototype.removeSub = function removeSub (sub) {
  50234. remove(this.subs, sub);
  50235. };
  50236. Dep.prototype.depend = function depend () {
  50237. if (Dep.target) {
  50238. Dep.target.addDep(this);
  50239. }
  50240. };
  50241. Dep.prototype.notify = function notify () {
  50242. // stabilize the subscriber list first
  50243. var subs = this.subs.slice();
  50244. if (!config.async) {
  50245. // subs aren't sorted in scheduler if not running async
  50246. // we need to sort them now to make sure they fire in correct
  50247. // order
  50248. subs.sort(function (a, b) { return a.id - b.id; });
  50249. }
  50250. for (var i = 0, l = subs.length; i < l; i++) {
  50251. subs[i].update();
  50252. }
  50253. };
  50254. // The current target watcher being evaluated.
  50255. // This is globally unique because only one watcher
  50256. // can be evaluated at a time.
  50257. Dep.target = null;
  50258. var targetStack = [];
  50259. function pushTarget (target) {
  50260. targetStack.push(target);
  50261. Dep.target = target;
  50262. }
  50263. function popTarget () {
  50264. targetStack.pop();
  50265. Dep.target = targetStack[targetStack.length - 1];
  50266. }
  50267. /* */
  50268. var VNode = function VNode (
  50269. tag,
  50270. data,
  50271. children,
  50272. text,
  50273. elm,
  50274. context,
  50275. componentOptions,
  50276. asyncFactory
  50277. ) {
  50278. this.tag = tag;
  50279. this.data = data;
  50280. this.children = children;
  50281. this.text = text;
  50282. this.elm = elm;
  50283. this.ns = undefined;
  50284. this.context = context;
  50285. this.fnContext = undefined;
  50286. this.fnOptions = undefined;
  50287. this.fnScopeId = undefined;
  50288. this.key = data && data.key;
  50289. this.componentOptions = componentOptions;
  50290. this.componentInstance = undefined;
  50291. this.parent = undefined;
  50292. this.raw = false;
  50293. this.isStatic = false;
  50294. this.isRootInsert = true;
  50295. this.isComment = false;
  50296. this.isCloned = false;
  50297. this.isOnce = false;
  50298. this.asyncFactory = asyncFactory;
  50299. this.asyncMeta = undefined;
  50300. this.isAsyncPlaceholder = false;
  50301. };
  50302. var prototypeAccessors = { child: { configurable: true } };
  50303. // DEPRECATED: alias for componentInstance for backwards compat.
  50304. /* istanbul ignore next */
  50305. prototypeAccessors.child.get = function () {
  50306. return this.componentInstance
  50307. };
  50308. Object.defineProperties( VNode.prototype, prototypeAccessors );
  50309. var createEmptyVNode = function (text) {
  50310. if ( text === void 0 ) text = '';
  50311. var node = new VNode();
  50312. node.text = text;
  50313. node.isComment = true;
  50314. return node
  50315. };
  50316. function createTextVNode (val) {
  50317. return new VNode(undefined, undefined, undefined, String(val))
  50318. }
  50319. // optimized shallow clone
  50320. // used for static nodes and slot nodes because they may be reused across
  50321. // multiple renders, cloning them avoids errors when DOM manipulations rely
  50322. // on their elm reference.
  50323. function cloneVNode (vnode) {
  50324. var cloned = new VNode(
  50325. vnode.tag,
  50326. vnode.data,
  50327. // #7975
  50328. // clone children array to avoid mutating original in case of cloning
  50329. // a child.
  50330. vnode.children && vnode.children.slice(),
  50331. vnode.text,
  50332. vnode.elm,
  50333. vnode.context,
  50334. vnode.componentOptions,
  50335. vnode.asyncFactory
  50336. );
  50337. cloned.ns = vnode.ns;
  50338. cloned.isStatic = vnode.isStatic;
  50339. cloned.key = vnode.key;
  50340. cloned.isComment = vnode.isComment;
  50341. cloned.fnContext = vnode.fnContext;
  50342. cloned.fnOptions = vnode.fnOptions;
  50343. cloned.fnScopeId = vnode.fnScopeId;
  50344. cloned.asyncMeta = vnode.asyncMeta;
  50345. cloned.isCloned = true;
  50346. return cloned
  50347. }
  50348. /*
  50349. * not type checking this file because flow doesn't play well with
  50350. * dynamically accessing methods on Array prototype
  50351. */
  50352. var arrayProto = Array.prototype;
  50353. var arrayMethods = Object.create(arrayProto);
  50354. var methodsToPatch = [
  50355. 'push',
  50356. 'pop',
  50357. 'shift',
  50358. 'unshift',
  50359. 'splice',
  50360. 'sort',
  50361. 'reverse'
  50362. ];
  50363. /**
  50364. * Intercept mutating methods and emit events
  50365. */
  50366. methodsToPatch.forEach(function (method) {
  50367. // cache original method
  50368. var original = arrayProto[method];
  50369. def(arrayMethods, method, function mutator () {
  50370. var args = [], len = arguments.length;
  50371. while ( len-- ) args[ len ] = arguments[ len ];
  50372. var result = original.apply(this, args);
  50373. var ob = this.__ob__;
  50374. var inserted;
  50375. switch (method) {
  50376. case 'push':
  50377. case 'unshift':
  50378. inserted = args;
  50379. break
  50380. case 'splice':
  50381. inserted = args.slice(2);
  50382. break
  50383. }
  50384. if (inserted) { ob.observeArray(inserted); }
  50385. // notify change
  50386. ob.dep.notify();
  50387. return result
  50388. });
  50389. });
  50390. /* */
  50391. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  50392. /**
  50393. * In some cases we may want to disable observation inside a component's
  50394. * update computation.
  50395. */
  50396. var shouldObserve = true;
  50397. function toggleObserving (value) {
  50398. shouldObserve = value;
  50399. }
  50400. /**
  50401. * Observer class that is attached to each observed
  50402. * object. Once attached, the observer converts the target
  50403. * object's property keys into getter/setters that
  50404. * collect dependencies and dispatch updates.
  50405. */
  50406. var Observer = function Observer (value) {
  50407. this.value = value;
  50408. this.dep = new Dep();
  50409. this.vmCount = 0;
  50410. def(value, '__ob__', this);
  50411. if (Array.isArray(value)) {
  50412. if (hasProto) {
  50413. protoAugment(value, arrayMethods);
  50414. } else {
  50415. copyAugment(value, arrayMethods, arrayKeys);
  50416. }
  50417. this.observeArray(value);
  50418. } else {
  50419. this.walk(value);
  50420. }
  50421. };
  50422. /**
  50423. * Walk through all properties and convert them into
  50424. * getter/setters. This method should only be called when
  50425. * value type is Object.
  50426. */
  50427. Observer.prototype.walk = function walk (obj) {
  50428. var keys = Object.keys(obj);
  50429. for (var i = 0; i < keys.length; i++) {
  50430. defineReactive$$1(obj, keys[i]);
  50431. }
  50432. };
  50433. /**
  50434. * Observe a list of Array items.
  50435. */
  50436. Observer.prototype.observeArray = function observeArray (items) {
  50437. for (var i = 0, l = items.length; i < l; i++) {
  50438. observe(items[i]);
  50439. }
  50440. };
  50441. // helpers
  50442. /**
  50443. * Augment a target Object or Array by intercepting
  50444. * the prototype chain using __proto__
  50445. */
  50446. function protoAugment (target, src) {
  50447. /* eslint-disable no-proto */
  50448. target.__proto__ = src;
  50449. /* eslint-enable no-proto */
  50450. }
  50451. /**
  50452. * Augment a target Object or Array by defining
  50453. * hidden properties.
  50454. */
  50455. /* istanbul ignore next */
  50456. function copyAugment (target, src, keys) {
  50457. for (var i = 0, l = keys.length; i < l; i++) {
  50458. var key = keys[i];
  50459. def(target, key, src[key]);
  50460. }
  50461. }
  50462. /**
  50463. * Attempt to create an observer instance for a value,
  50464. * returns the new observer if successfully observed,
  50465. * or the existing observer if the value already has one.
  50466. */
  50467. function observe (value, asRootData) {
  50468. if (!isObject(value) || value instanceof VNode) {
  50469. return
  50470. }
  50471. var ob;
  50472. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  50473. ob = value.__ob__;
  50474. } else if (
  50475. shouldObserve &&
  50476. !isServerRendering() &&
  50477. (Array.isArray(value) || isPlainObject(value)) &&
  50478. Object.isExtensible(value) &&
  50479. !value._isVue
  50480. ) {
  50481. ob = new Observer(value);
  50482. }
  50483. if (asRootData && ob) {
  50484. ob.vmCount++;
  50485. }
  50486. return ob
  50487. }
  50488. /**
  50489. * Define a reactive property on an Object.
  50490. */
  50491. function defineReactive$$1 (
  50492. obj,
  50493. key,
  50494. val,
  50495. customSetter,
  50496. shallow
  50497. ) {
  50498. var dep = new Dep();
  50499. var property = Object.getOwnPropertyDescriptor(obj, key);
  50500. if (property && property.configurable === false) {
  50501. return
  50502. }
  50503. // cater for pre-defined getter/setters
  50504. var getter = property && property.get;
  50505. var setter = property && property.set;
  50506. if ((!getter || setter) && arguments.length === 2) {
  50507. val = obj[key];
  50508. }
  50509. var childOb = !shallow && observe(val);
  50510. Object.defineProperty(obj, key, {
  50511. enumerable: true,
  50512. configurable: true,
  50513. get: function reactiveGetter () {
  50514. var value = getter ? getter.call(obj) : val;
  50515. if (Dep.target) {
  50516. dep.depend();
  50517. if (childOb) {
  50518. childOb.dep.depend();
  50519. if (Array.isArray(value)) {
  50520. dependArray(value);
  50521. }
  50522. }
  50523. }
  50524. return value
  50525. },
  50526. set: function reactiveSetter (newVal) {
  50527. var value = getter ? getter.call(obj) : val;
  50528. /* eslint-disable no-self-compare */
  50529. if (newVal === value || (newVal !== newVal && value !== value)) {
  50530. return
  50531. }
  50532. /* eslint-enable no-self-compare */
  50533. if (customSetter) {
  50534. customSetter();
  50535. }
  50536. // #7981: for accessor properties without setter
  50537. if (getter && !setter) { return }
  50538. if (setter) {
  50539. setter.call(obj, newVal);
  50540. } else {
  50541. val = newVal;
  50542. }
  50543. childOb = !shallow && observe(newVal);
  50544. dep.notify();
  50545. }
  50546. });
  50547. }
  50548. /**
  50549. * Set a property on an object. Adds the new property and
  50550. * triggers change notification if the property doesn't
  50551. * already exist.
  50552. */
  50553. function set (target, key, val) {
  50554. if (isUndef(target) || isPrimitive(target)
  50555. ) {
  50556. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  50557. }
  50558. if (Array.isArray(target) && isValidArrayIndex(key)) {
  50559. target.length = Math.max(target.length, key);
  50560. target.splice(key, 1, val);
  50561. return val
  50562. }
  50563. if (key in target && !(key in Object.prototype)) {
  50564. target[key] = val;
  50565. return val
  50566. }
  50567. var ob = (target).__ob__;
  50568. if (target._isVue || (ob && ob.vmCount)) {
  50569. warn(
  50570. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  50571. 'at runtime - declare it upfront in the data option.'
  50572. );
  50573. return val
  50574. }
  50575. if (!ob) {
  50576. target[key] = val;
  50577. return val
  50578. }
  50579. defineReactive$$1(ob.value, key, val);
  50580. ob.dep.notify();
  50581. return val
  50582. }
  50583. /**
  50584. * Delete a property and trigger change if necessary.
  50585. */
  50586. function del (target, key) {
  50587. if (isUndef(target) || isPrimitive(target)
  50588. ) {
  50589. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  50590. }
  50591. if (Array.isArray(target) && isValidArrayIndex(key)) {
  50592. target.splice(key, 1);
  50593. return
  50594. }
  50595. var ob = (target).__ob__;
  50596. if (target._isVue || (ob && ob.vmCount)) {
  50597. warn(
  50598. 'Avoid deleting properties on a Vue instance or its root $data ' +
  50599. '- just set it to null.'
  50600. );
  50601. return
  50602. }
  50603. if (!hasOwn(target, key)) {
  50604. return
  50605. }
  50606. delete target[key];
  50607. if (!ob) {
  50608. return
  50609. }
  50610. ob.dep.notify();
  50611. }
  50612. /**
  50613. * Collect dependencies on array elements when the array is touched, since
  50614. * we cannot intercept array element access like property getters.
  50615. */
  50616. function dependArray (value) {
  50617. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  50618. e = value[i];
  50619. e && e.__ob__ && e.__ob__.dep.depend();
  50620. if (Array.isArray(e)) {
  50621. dependArray(e);
  50622. }
  50623. }
  50624. }
  50625. /* */
  50626. /**
  50627. * Option overwriting strategies are functions that handle
  50628. * how to merge a parent option value and a child option
  50629. * value into the final value.
  50630. */
  50631. var strats = config.optionMergeStrategies;
  50632. /**
  50633. * Options with restrictions
  50634. */
  50635. {
  50636. strats.el = strats.propsData = function (parent, child, vm, key) {
  50637. if (!vm) {
  50638. warn(
  50639. "option \"" + key + "\" can only be used during instance " +
  50640. 'creation with the `new` keyword.'
  50641. );
  50642. }
  50643. return defaultStrat(parent, child)
  50644. };
  50645. }
  50646. /**
  50647. * Helper that recursively merges two data objects together.
  50648. */
  50649. function mergeData (to, from) {
  50650. if (!from) { return to }
  50651. var key, toVal, fromVal;
  50652. var keys = hasSymbol
  50653. ? Reflect.ownKeys(from)
  50654. : Object.keys(from);
  50655. for (var i = 0; i < keys.length; i++) {
  50656. key = keys[i];
  50657. // in case the object is already observed...
  50658. if (key === '__ob__') { continue }
  50659. toVal = to[key];
  50660. fromVal = from[key];
  50661. if (!hasOwn(to, key)) {
  50662. set(to, key, fromVal);
  50663. } else if (
  50664. toVal !== fromVal &&
  50665. isPlainObject(toVal) &&
  50666. isPlainObject(fromVal)
  50667. ) {
  50668. mergeData(toVal, fromVal);
  50669. }
  50670. }
  50671. return to
  50672. }
  50673. /**
  50674. * Data
  50675. */
  50676. function mergeDataOrFn (
  50677. parentVal,
  50678. childVal,
  50679. vm
  50680. ) {
  50681. if (!vm) {
  50682. // in a Vue.extend merge, both should be functions
  50683. if (!childVal) {
  50684. return parentVal
  50685. }
  50686. if (!parentVal) {
  50687. return childVal
  50688. }
  50689. // when parentVal & childVal are both present,
  50690. // we need to return a function that returns the
  50691. // merged result of both functions... no need to
  50692. // check if parentVal is a function here because
  50693. // it has to be a function to pass previous merges.
  50694. return function mergedDataFn () {
  50695. return mergeData(
  50696. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  50697. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  50698. )
  50699. }
  50700. } else {
  50701. return function mergedInstanceDataFn () {
  50702. // instance merge
  50703. var instanceData = typeof childVal === 'function'
  50704. ? childVal.call(vm, vm)
  50705. : childVal;
  50706. var defaultData = typeof parentVal === 'function'
  50707. ? parentVal.call(vm, vm)
  50708. : parentVal;
  50709. if (instanceData) {
  50710. return mergeData(instanceData, defaultData)
  50711. } else {
  50712. return defaultData
  50713. }
  50714. }
  50715. }
  50716. }
  50717. strats.data = function (
  50718. parentVal,
  50719. childVal,
  50720. vm
  50721. ) {
  50722. if (!vm) {
  50723. if (childVal && typeof childVal !== 'function') {
  50724. warn(
  50725. 'The "data" option should be a function ' +
  50726. 'that returns a per-instance value in component ' +
  50727. 'definitions.',
  50728. vm
  50729. );
  50730. return parentVal
  50731. }
  50732. return mergeDataOrFn(parentVal, childVal)
  50733. }
  50734. return mergeDataOrFn(parentVal, childVal, vm)
  50735. };
  50736. /**
  50737. * Hooks and props are merged as arrays.
  50738. */
  50739. function mergeHook (
  50740. parentVal,
  50741. childVal
  50742. ) {
  50743. var res = childVal
  50744. ? parentVal
  50745. ? parentVal.concat(childVal)
  50746. : Array.isArray(childVal)
  50747. ? childVal
  50748. : [childVal]
  50749. : parentVal;
  50750. return res
  50751. ? dedupeHooks(res)
  50752. : res
  50753. }
  50754. function dedupeHooks (hooks) {
  50755. var res = [];
  50756. for (var i = 0; i < hooks.length; i++) {
  50757. if (res.indexOf(hooks[i]) === -1) {
  50758. res.push(hooks[i]);
  50759. }
  50760. }
  50761. return res
  50762. }
  50763. LIFECYCLE_HOOKS.forEach(function (hook) {
  50764. strats[hook] = mergeHook;
  50765. });
  50766. /**
  50767. * Assets
  50768. *
  50769. * When a vm is present (instance creation), we need to do
  50770. * a three-way merge between constructor options, instance
  50771. * options and parent options.
  50772. */
  50773. function mergeAssets (
  50774. parentVal,
  50775. childVal,
  50776. vm,
  50777. key
  50778. ) {
  50779. var res = Object.create(parentVal || null);
  50780. if (childVal) {
  50781. assertObjectType(key, childVal, vm);
  50782. return extend(res, childVal)
  50783. } else {
  50784. return res
  50785. }
  50786. }
  50787. ASSET_TYPES.forEach(function (type) {
  50788. strats[type + 's'] = mergeAssets;
  50789. });
  50790. /**
  50791. * Watchers.
  50792. *
  50793. * Watchers hashes should not overwrite one
  50794. * another, so we merge them as arrays.
  50795. */
  50796. strats.watch = function (
  50797. parentVal,
  50798. childVal,
  50799. vm,
  50800. key
  50801. ) {
  50802. // work around Firefox's Object.prototype.watch...
  50803. if (parentVal === nativeWatch) { parentVal = undefined; }
  50804. if (childVal === nativeWatch) { childVal = undefined; }
  50805. /* istanbul ignore if */
  50806. if (!childVal) { return Object.create(parentVal || null) }
  50807. {
  50808. assertObjectType(key, childVal, vm);
  50809. }
  50810. if (!parentVal) { return childVal }
  50811. var ret = {};
  50812. extend(ret, parentVal);
  50813. for (var key$1 in childVal) {
  50814. var parent = ret[key$1];
  50815. var child = childVal[key$1];
  50816. if (parent && !Array.isArray(parent)) {
  50817. parent = [parent];
  50818. }
  50819. ret[key$1] = parent
  50820. ? parent.concat(child)
  50821. : Array.isArray(child) ? child : [child];
  50822. }
  50823. return ret
  50824. };
  50825. /**
  50826. * Other object hashes.
  50827. */
  50828. strats.props =
  50829. strats.methods =
  50830. strats.inject =
  50831. strats.computed = function (
  50832. parentVal,
  50833. childVal,
  50834. vm,
  50835. key
  50836. ) {
  50837. if (childVal && "development" !== 'production') {
  50838. assertObjectType(key, childVal, vm);
  50839. }
  50840. if (!parentVal) { return childVal }
  50841. var ret = Object.create(null);
  50842. extend(ret, parentVal);
  50843. if (childVal) { extend(ret, childVal); }
  50844. return ret
  50845. };
  50846. strats.provide = mergeDataOrFn;
  50847. /**
  50848. * Default strategy.
  50849. */
  50850. var defaultStrat = function (parentVal, childVal) {
  50851. return childVal === undefined
  50852. ? parentVal
  50853. : childVal
  50854. };
  50855. /**
  50856. * Validate component names
  50857. */
  50858. function checkComponents (options) {
  50859. for (var key in options.components) {
  50860. validateComponentName(key);
  50861. }
  50862. }
  50863. function validateComponentName (name) {
  50864. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  50865. warn(
  50866. 'Invalid component name: "' + name + '". Component names ' +
  50867. 'should conform to valid custom element name in html5 specification.'
  50868. );
  50869. }
  50870. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  50871. warn(
  50872. 'Do not use built-in or reserved HTML elements as component ' +
  50873. 'id: ' + name
  50874. );
  50875. }
  50876. }
  50877. /**
  50878. * Ensure all props option syntax are normalized into the
  50879. * Object-based format.
  50880. */
  50881. function normalizeProps (options, vm) {
  50882. var props = options.props;
  50883. if (!props) { return }
  50884. var res = {};
  50885. var i, val, name;
  50886. if (Array.isArray(props)) {
  50887. i = props.length;
  50888. while (i--) {
  50889. val = props[i];
  50890. if (typeof val === 'string') {
  50891. name = camelize(val);
  50892. res[name] = { type: null };
  50893. } else {
  50894. warn('props must be strings when using array syntax.');
  50895. }
  50896. }
  50897. } else if (isPlainObject(props)) {
  50898. for (var key in props) {
  50899. val = props[key];
  50900. name = camelize(key);
  50901. res[name] = isPlainObject(val)
  50902. ? val
  50903. : { type: val };
  50904. }
  50905. } else {
  50906. warn(
  50907. "Invalid value for option \"props\": expected an Array or an Object, " +
  50908. "but got " + (toRawType(props)) + ".",
  50909. vm
  50910. );
  50911. }
  50912. options.props = res;
  50913. }
  50914. /**
  50915. * Normalize all injections into Object-based format
  50916. */
  50917. function normalizeInject (options, vm) {
  50918. var inject = options.inject;
  50919. if (!inject) { return }
  50920. var normalized = options.inject = {};
  50921. if (Array.isArray(inject)) {
  50922. for (var i = 0; i < inject.length; i++) {
  50923. normalized[inject[i]] = { from: inject[i] };
  50924. }
  50925. } else if (isPlainObject(inject)) {
  50926. for (var key in inject) {
  50927. var val = inject[key];
  50928. normalized[key] = isPlainObject(val)
  50929. ? extend({ from: key }, val)
  50930. : { from: val };
  50931. }
  50932. } else {
  50933. warn(
  50934. "Invalid value for option \"inject\": expected an Array or an Object, " +
  50935. "but got " + (toRawType(inject)) + ".",
  50936. vm
  50937. );
  50938. }
  50939. }
  50940. /**
  50941. * Normalize raw function directives into object format.
  50942. */
  50943. function normalizeDirectives (options) {
  50944. var dirs = options.directives;
  50945. if (dirs) {
  50946. for (var key in dirs) {
  50947. var def$$1 = dirs[key];
  50948. if (typeof def$$1 === 'function') {
  50949. dirs[key] = { bind: def$$1, update: def$$1 };
  50950. }
  50951. }
  50952. }
  50953. }
  50954. function assertObjectType (name, value, vm) {
  50955. if (!isPlainObject(value)) {
  50956. warn(
  50957. "Invalid value for option \"" + name + "\": expected an Object, " +
  50958. "but got " + (toRawType(value)) + ".",
  50959. vm
  50960. );
  50961. }
  50962. }
  50963. /**
  50964. * Merge two option objects into a new one.
  50965. * Core utility used in both instantiation and inheritance.
  50966. */
  50967. function mergeOptions (
  50968. parent,
  50969. child,
  50970. vm
  50971. ) {
  50972. {
  50973. checkComponents(child);
  50974. }
  50975. if (typeof child === 'function') {
  50976. child = child.options;
  50977. }
  50978. normalizeProps(child, vm);
  50979. normalizeInject(child, vm);
  50980. normalizeDirectives(child);
  50981. // Apply extends and mixins on the child options,
  50982. // but only if it is a raw options object that isn't
  50983. // the result of another mergeOptions call.
  50984. // Only merged options has the _base property.
  50985. if (!child._base) {
  50986. if (child.extends) {
  50987. parent = mergeOptions(parent, child.extends, vm);
  50988. }
  50989. if (child.mixins) {
  50990. for (var i = 0, l = child.mixins.length; i < l; i++) {
  50991. parent = mergeOptions(parent, child.mixins[i], vm);
  50992. }
  50993. }
  50994. }
  50995. var options = {};
  50996. var key;
  50997. for (key in parent) {
  50998. mergeField(key);
  50999. }
  51000. for (key in child) {
  51001. if (!hasOwn(parent, key)) {
  51002. mergeField(key);
  51003. }
  51004. }
  51005. function mergeField (key) {
  51006. var strat = strats[key] || defaultStrat;
  51007. options[key] = strat(parent[key], child[key], vm, key);
  51008. }
  51009. return options
  51010. }
  51011. /**
  51012. * Resolve an asset.
  51013. * This function is used because child instances need access
  51014. * to assets defined in its ancestor chain.
  51015. */
  51016. function resolveAsset (
  51017. options,
  51018. type,
  51019. id,
  51020. warnMissing
  51021. ) {
  51022. /* istanbul ignore if */
  51023. if (typeof id !== 'string') {
  51024. return
  51025. }
  51026. var assets = options[type];
  51027. // check local registration variations first
  51028. if (hasOwn(assets, id)) { return assets[id] }
  51029. var camelizedId = camelize(id);
  51030. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  51031. var PascalCaseId = capitalize(camelizedId);
  51032. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  51033. // fallback to prototype chain
  51034. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  51035. if (warnMissing && !res) {
  51036. warn(
  51037. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  51038. options
  51039. );
  51040. }
  51041. return res
  51042. }
  51043. /* */
  51044. function validateProp (
  51045. key,
  51046. propOptions,
  51047. propsData,
  51048. vm
  51049. ) {
  51050. var prop = propOptions[key];
  51051. var absent = !hasOwn(propsData, key);
  51052. var value = propsData[key];
  51053. // boolean casting
  51054. var booleanIndex = getTypeIndex(Boolean, prop.type);
  51055. if (booleanIndex > -1) {
  51056. if (absent && !hasOwn(prop, 'default')) {
  51057. value = false;
  51058. } else if (value === '' || value === hyphenate(key)) {
  51059. // only cast empty string / same name to boolean if
  51060. // boolean has higher priority
  51061. var stringIndex = getTypeIndex(String, prop.type);
  51062. if (stringIndex < 0 || booleanIndex < stringIndex) {
  51063. value = true;
  51064. }
  51065. }
  51066. }
  51067. // check default value
  51068. if (value === undefined) {
  51069. value = getPropDefaultValue(vm, prop, key);
  51070. // since the default value is a fresh copy,
  51071. // make sure to observe it.
  51072. var prevShouldObserve = shouldObserve;
  51073. toggleObserving(true);
  51074. observe(value);
  51075. toggleObserving(prevShouldObserve);
  51076. }
  51077. {
  51078. assertProp(prop, key, value, vm, absent);
  51079. }
  51080. return value
  51081. }
  51082. /**
  51083. * Get the default value of a prop.
  51084. */
  51085. function getPropDefaultValue (vm, prop, key) {
  51086. // no default, return undefined
  51087. if (!hasOwn(prop, 'default')) {
  51088. return undefined
  51089. }
  51090. var def = prop.default;
  51091. // warn against non-factory defaults for Object & Array
  51092. if (isObject(def)) {
  51093. warn(
  51094. 'Invalid default value for prop "' + key + '": ' +
  51095. 'Props with type Object/Array must use a factory function ' +
  51096. 'to return the default value.',
  51097. vm
  51098. );
  51099. }
  51100. // the raw prop value was also undefined from previous render,
  51101. // return previous default value to avoid unnecessary watcher trigger
  51102. if (vm && vm.$options.propsData &&
  51103. vm.$options.propsData[key] === undefined &&
  51104. vm._props[key] !== undefined
  51105. ) {
  51106. return vm._props[key]
  51107. }
  51108. // call factory function for non-Function types
  51109. // a value is Function if its prototype is function even across different execution context
  51110. return typeof def === 'function' && getType(prop.type) !== 'Function'
  51111. ? def.call(vm)
  51112. : def
  51113. }
  51114. /**
  51115. * Assert whether a prop is valid.
  51116. */
  51117. function assertProp (
  51118. prop,
  51119. name,
  51120. value,
  51121. vm,
  51122. absent
  51123. ) {
  51124. if (prop.required && absent) {
  51125. warn(
  51126. 'Missing required prop: "' + name + '"',
  51127. vm
  51128. );
  51129. return
  51130. }
  51131. if (value == null && !prop.required) {
  51132. return
  51133. }
  51134. var type = prop.type;
  51135. var valid = !type || type === true;
  51136. var expectedTypes = [];
  51137. if (type) {
  51138. if (!Array.isArray(type)) {
  51139. type = [type];
  51140. }
  51141. for (var i = 0; i < type.length && !valid; i++) {
  51142. var assertedType = assertType(value, type[i]);
  51143. expectedTypes.push(assertedType.expectedType || '');
  51144. valid = assertedType.valid;
  51145. }
  51146. }
  51147. if (!valid) {
  51148. warn(
  51149. getInvalidTypeMessage(name, value, expectedTypes),
  51150. vm
  51151. );
  51152. return
  51153. }
  51154. var validator = prop.validator;
  51155. if (validator) {
  51156. if (!validator(value)) {
  51157. warn(
  51158. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  51159. vm
  51160. );
  51161. }
  51162. }
  51163. }
  51164. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  51165. function assertType (value, type) {
  51166. var valid;
  51167. var expectedType = getType(type);
  51168. if (simpleCheckRE.test(expectedType)) {
  51169. var t = typeof value;
  51170. valid = t === expectedType.toLowerCase();
  51171. // for primitive wrapper objects
  51172. if (!valid && t === 'object') {
  51173. valid = value instanceof type;
  51174. }
  51175. } else if (expectedType === 'Object') {
  51176. valid = isPlainObject(value);
  51177. } else if (expectedType === 'Array') {
  51178. valid = Array.isArray(value);
  51179. } else {
  51180. valid = value instanceof type;
  51181. }
  51182. return {
  51183. valid: valid,
  51184. expectedType: expectedType
  51185. }
  51186. }
  51187. /**
  51188. * Use function string name to check built-in types,
  51189. * because a simple equality check will fail when running
  51190. * across different vms / iframes.
  51191. */
  51192. function getType (fn) {
  51193. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  51194. return match ? match[1] : ''
  51195. }
  51196. function isSameType (a, b) {
  51197. return getType(a) === getType(b)
  51198. }
  51199. function getTypeIndex (type, expectedTypes) {
  51200. if (!Array.isArray(expectedTypes)) {
  51201. return isSameType(expectedTypes, type) ? 0 : -1
  51202. }
  51203. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  51204. if (isSameType(expectedTypes[i], type)) {
  51205. return i
  51206. }
  51207. }
  51208. return -1
  51209. }
  51210. function getInvalidTypeMessage (name, value, expectedTypes) {
  51211. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  51212. " Expected " + (expectedTypes.map(capitalize).join(', '));
  51213. var expectedType = expectedTypes[0];
  51214. var receivedType = toRawType(value);
  51215. var expectedValue = styleValue(value, expectedType);
  51216. var receivedValue = styleValue(value, receivedType);
  51217. // check if we need to specify expected value
  51218. if (expectedTypes.length === 1 &&
  51219. isExplicable(expectedType) &&
  51220. !isBoolean(expectedType, receivedType)) {
  51221. message += " with value " + expectedValue;
  51222. }
  51223. message += ", got " + receivedType + " ";
  51224. // check if we need to specify received value
  51225. if (isExplicable(receivedType)) {
  51226. message += "with value " + receivedValue + ".";
  51227. }
  51228. return message
  51229. }
  51230. function styleValue (value, type) {
  51231. if (type === 'String') {
  51232. return ("\"" + value + "\"")
  51233. } else if (type === 'Number') {
  51234. return ("" + (Number(value)))
  51235. } else {
  51236. return ("" + value)
  51237. }
  51238. }
  51239. function isExplicable (value) {
  51240. var explicitTypes = ['string', 'number', 'boolean'];
  51241. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  51242. }
  51243. function isBoolean () {
  51244. var args = [], len = arguments.length;
  51245. while ( len-- ) args[ len ] = arguments[ len ];
  51246. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  51247. }
  51248. /* */
  51249. function handleError (err, vm, info) {
  51250. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  51251. // See: https://github.com/vuejs/vuex/issues/1505
  51252. pushTarget();
  51253. try {
  51254. if (vm) {
  51255. var cur = vm;
  51256. while ((cur = cur.$parent)) {
  51257. var hooks = cur.$options.errorCaptured;
  51258. if (hooks) {
  51259. for (var i = 0; i < hooks.length; i++) {
  51260. try {
  51261. var capture = hooks[i].call(cur, err, vm, info) === false;
  51262. if (capture) { return }
  51263. } catch (e) {
  51264. globalHandleError(e, cur, 'errorCaptured hook');
  51265. }
  51266. }
  51267. }
  51268. }
  51269. }
  51270. globalHandleError(err, vm, info);
  51271. } finally {
  51272. popTarget();
  51273. }
  51274. }
  51275. function invokeWithErrorHandling (
  51276. handler,
  51277. context,
  51278. args,
  51279. vm,
  51280. info
  51281. ) {
  51282. var res;
  51283. try {
  51284. res = args ? handler.apply(context, args) : handler.call(context);
  51285. if (res && !res._isVue && isPromise(res) && !res._handled) {
  51286. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  51287. // issue #9511
  51288. // avoid catch triggering multiple times when nested calls
  51289. res._handled = true;
  51290. }
  51291. } catch (e) {
  51292. handleError(e, vm, info);
  51293. }
  51294. return res
  51295. }
  51296. function globalHandleError (err, vm, info) {
  51297. if (config.errorHandler) {
  51298. try {
  51299. return config.errorHandler.call(null, err, vm, info)
  51300. } catch (e) {
  51301. // if the user intentionally throws the original error in the handler,
  51302. // do not log it twice
  51303. if (e !== err) {
  51304. logError(e, null, 'config.errorHandler');
  51305. }
  51306. }
  51307. }
  51308. logError(err, vm, info);
  51309. }
  51310. function logError (err, vm, info) {
  51311. {
  51312. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  51313. }
  51314. /* istanbul ignore else */
  51315. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  51316. console.error(err);
  51317. } else {
  51318. throw err
  51319. }
  51320. }
  51321. /* */
  51322. var isUsingMicroTask = false;
  51323. var callbacks = [];
  51324. var pending = false;
  51325. function flushCallbacks () {
  51326. pending = false;
  51327. var copies = callbacks.slice(0);
  51328. callbacks.length = 0;
  51329. for (var i = 0; i < copies.length; i++) {
  51330. copies[i]();
  51331. }
  51332. }
  51333. // Here we have async deferring wrappers using microtasks.
  51334. // In 2.5 we used (macro) tasks (in combination with microtasks).
  51335. // However, it has subtle problems when state is changed right before repaint
  51336. // (e.g. #6813, out-in transitions).
  51337. // Also, using (macro) tasks in event handler would cause some weird behaviors
  51338. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  51339. // So we now use microtasks everywhere, again.
  51340. // A major drawback of this tradeoff is that there are some scenarios
  51341. // where microtasks have too high a priority and fire in between supposedly
  51342. // sequential events (e.g. #4521, #6690, which have workarounds)
  51343. // or even between bubbling of the same event (#6566).
  51344. var timerFunc;
  51345. // The nextTick behavior leverages the microtask queue, which can be accessed
  51346. // via either native Promise.then or MutationObserver.
  51347. // MutationObserver has wider support, however it is seriously bugged in
  51348. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  51349. // completely stops working after triggering a few times... so, if native
  51350. // Promise is available, we will use it:
  51351. /* istanbul ignore next, $flow-disable-line */
  51352. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  51353. var p = Promise.resolve();
  51354. timerFunc = function () {
  51355. p.then(flushCallbacks);
  51356. // In problematic UIWebViews, Promise.then doesn't completely break, but
  51357. // it can get stuck in a weird state where callbacks are pushed into the
  51358. // microtask queue but the queue isn't being flushed, until the browser
  51359. // needs to do some other work, e.g. handle a timer. Therefore we can
  51360. // "force" the microtask queue to be flushed by adding an empty timer.
  51361. if (isIOS) { setTimeout(noop); }
  51362. };
  51363. isUsingMicroTask = true;
  51364. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  51365. isNative(MutationObserver) ||
  51366. // PhantomJS and iOS 7.x
  51367. MutationObserver.toString() === '[object MutationObserverConstructor]'
  51368. )) {
  51369. // Use MutationObserver where native Promise is not available,
  51370. // e.g. PhantomJS, iOS7, Android 4.4
  51371. // (#6466 MutationObserver is unreliable in IE11)
  51372. var counter = 1;
  51373. var observer = new MutationObserver(flushCallbacks);
  51374. var textNode = document.createTextNode(String(counter));
  51375. observer.observe(textNode, {
  51376. characterData: true
  51377. });
  51378. timerFunc = function () {
  51379. counter = (counter + 1) % 2;
  51380. textNode.data = String(counter);
  51381. };
  51382. isUsingMicroTask = true;
  51383. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  51384. // Fallback to setImmediate.
  51385. // Technically it leverages the (macro) task queue,
  51386. // but it is still a better choice than setTimeout.
  51387. timerFunc = function () {
  51388. setImmediate(flushCallbacks);
  51389. };
  51390. } else {
  51391. // Fallback to setTimeout.
  51392. timerFunc = function () {
  51393. setTimeout(flushCallbacks, 0);
  51394. };
  51395. }
  51396. function nextTick (cb, ctx) {
  51397. var _resolve;
  51398. callbacks.push(function () {
  51399. if (cb) {
  51400. try {
  51401. cb.call(ctx);
  51402. } catch (e) {
  51403. handleError(e, ctx, 'nextTick');
  51404. }
  51405. } else if (_resolve) {
  51406. _resolve(ctx);
  51407. }
  51408. });
  51409. if (!pending) {
  51410. pending = true;
  51411. timerFunc();
  51412. }
  51413. // $flow-disable-line
  51414. if (!cb && typeof Promise !== 'undefined') {
  51415. return new Promise(function (resolve) {
  51416. _resolve = resolve;
  51417. })
  51418. }
  51419. }
  51420. /* */
  51421. var mark;
  51422. var measure;
  51423. {
  51424. var perf = inBrowser && window.performance;
  51425. /* istanbul ignore if */
  51426. if (
  51427. perf &&
  51428. perf.mark &&
  51429. perf.measure &&
  51430. perf.clearMarks &&
  51431. perf.clearMeasures
  51432. ) {
  51433. mark = function (tag) { return perf.mark(tag); };
  51434. measure = function (name, startTag, endTag) {
  51435. perf.measure(name, startTag, endTag);
  51436. perf.clearMarks(startTag);
  51437. perf.clearMarks(endTag);
  51438. // perf.clearMeasures(name)
  51439. };
  51440. }
  51441. }
  51442. /* not type checking this file because flow doesn't play well with Proxy */
  51443. var initProxy;
  51444. {
  51445. var allowedGlobals = makeMap(
  51446. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  51447. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  51448. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  51449. 'require' // for Webpack/Browserify
  51450. );
  51451. var warnNonPresent = function (target, key) {
  51452. warn(
  51453. "Property or method \"" + key + "\" is not defined on the instance but " +
  51454. 'referenced during render. Make sure that this property is reactive, ' +
  51455. 'either in the data option, or for class-based components, by ' +
  51456. 'initializing the property. ' +
  51457. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  51458. target
  51459. );
  51460. };
  51461. var warnReservedPrefix = function (target, key) {
  51462. warn(
  51463. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  51464. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  51465. 'prevent conflicts with Vue internals. ' +
  51466. 'See: https://vuejs.org/v2/api/#data',
  51467. target
  51468. );
  51469. };
  51470. var hasProxy =
  51471. typeof Proxy !== 'undefined' && isNative(Proxy);
  51472. if (hasProxy) {
  51473. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  51474. config.keyCodes = new Proxy(config.keyCodes, {
  51475. set: function set (target, key, value) {
  51476. if (isBuiltInModifier(key)) {
  51477. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  51478. return false
  51479. } else {
  51480. target[key] = value;
  51481. return true
  51482. }
  51483. }
  51484. });
  51485. }
  51486. var hasHandler = {
  51487. has: function has (target, key) {
  51488. var has = key in target;
  51489. var isAllowed = allowedGlobals(key) ||
  51490. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  51491. if (!has && !isAllowed) {
  51492. if (key in target.$data) { warnReservedPrefix(target, key); }
  51493. else { warnNonPresent(target, key); }
  51494. }
  51495. return has || !isAllowed
  51496. }
  51497. };
  51498. var getHandler = {
  51499. get: function get (target, key) {
  51500. if (typeof key === 'string' && !(key in target)) {
  51501. if (key in target.$data) { warnReservedPrefix(target, key); }
  51502. else { warnNonPresent(target, key); }
  51503. }
  51504. return target[key]
  51505. }
  51506. };
  51507. initProxy = function initProxy (vm) {
  51508. if (hasProxy) {
  51509. // determine which proxy handler to use
  51510. var options = vm.$options;
  51511. var handlers = options.render && options.render._withStripped
  51512. ? getHandler
  51513. : hasHandler;
  51514. vm._renderProxy = new Proxy(vm, handlers);
  51515. } else {
  51516. vm._renderProxy = vm;
  51517. }
  51518. };
  51519. }
  51520. /* */
  51521. var seenObjects = new _Set();
  51522. /**
  51523. * Recursively traverse an object to evoke all converted
  51524. * getters, so that every nested property inside the object
  51525. * is collected as a "deep" dependency.
  51526. */
  51527. function traverse (val) {
  51528. _traverse(val, seenObjects);
  51529. seenObjects.clear();
  51530. }
  51531. function _traverse (val, seen) {
  51532. var i, keys;
  51533. var isA = Array.isArray(val);
  51534. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  51535. return
  51536. }
  51537. if (val.__ob__) {
  51538. var depId = val.__ob__.dep.id;
  51539. if (seen.has(depId)) {
  51540. return
  51541. }
  51542. seen.add(depId);
  51543. }
  51544. if (isA) {
  51545. i = val.length;
  51546. while (i--) { _traverse(val[i], seen); }
  51547. } else {
  51548. keys = Object.keys(val);
  51549. i = keys.length;
  51550. while (i--) { _traverse(val[keys[i]], seen); }
  51551. }
  51552. }
  51553. /* */
  51554. var normalizeEvent = cached(function (name) {
  51555. var passive = name.charAt(0) === '&';
  51556. name = passive ? name.slice(1) : name;
  51557. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  51558. name = once$$1 ? name.slice(1) : name;
  51559. var capture = name.charAt(0) === '!';
  51560. name = capture ? name.slice(1) : name;
  51561. return {
  51562. name: name,
  51563. once: once$$1,
  51564. capture: capture,
  51565. passive: passive
  51566. }
  51567. });
  51568. function createFnInvoker (fns, vm) {
  51569. function invoker () {
  51570. var arguments$1 = arguments;
  51571. var fns = invoker.fns;
  51572. if (Array.isArray(fns)) {
  51573. var cloned = fns.slice();
  51574. for (var i = 0; i < cloned.length; i++) {
  51575. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  51576. }
  51577. } else {
  51578. // return handler return value for single handlers
  51579. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  51580. }
  51581. }
  51582. invoker.fns = fns;
  51583. return invoker
  51584. }
  51585. function updateListeners (
  51586. on,
  51587. oldOn,
  51588. add,
  51589. remove$$1,
  51590. createOnceHandler,
  51591. vm
  51592. ) {
  51593. var name, def$$1, cur, old, event;
  51594. for (name in on) {
  51595. def$$1 = cur = on[name];
  51596. old = oldOn[name];
  51597. event = normalizeEvent(name);
  51598. if (isUndef(cur)) {
  51599. warn(
  51600. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  51601. vm
  51602. );
  51603. } else if (isUndef(old)) {
  51604. if (isUndef(cur.fns)) {
  51605. cur = on[name] = createFnInvoker(cur, vm);
  51606. }
  51607. if (isTrue(event.once)) {
  51608. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  51609. }
  51610. add(event.name, cur, event.capture, event.passive, event.params);
  51611. } else if (cur !== old) {
  51612. old.fns = cur;
  51613. on[name] = old;
  51614. }
  51615. }
  51616. for (name in oldOn) {
  51617. if (isUndef(on[name])) {
  51618. event = normalizeEvent(name);
  51619. remove$$1(event.name, oldOn[name], event.capture);
  51620. }
  51621. }
  51622. }
  51623. /* */
  51624. function mergeVNodeHook (def, hookKey, hook) {
  51625. if (def instanceof VNode) {
  51626. def = def.data.hook || (def.data.hook = {});
  51627. }
  51628. var invoker;
  51629. var oldHook = def[hookKey];
  51630. function wrappedHook () {
  51631. hook.apply(this, arguments);
  51632. // important: remove merged hook to ensure it's called only once
  51633. // and prevent memory leak
  51634. remove(invoker.fns, wrappedHook);
  51635. }
  51636. if (isUndef(oldHook)) {
  51637. // no existing hook
  51638. invoker = createFnInvoker([wrappedHook]);
  51639. } else {
  51640. /* istanbul ignore if */
  51641. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  51642. // already a merged invoker
  51643. invoker = oldHook;
  51644. invoker.fns.push(wrappedHook);
  51645. } else {
  51646. // existing plain hook
  51647. invoker = createFnInvoker([oldHook, wrappedHook]);
  51648. }
  51649. }
  51650. invoker.merged = true;
  51651. def[hookKey] = invoker;
  51652. }
  51653. /* */
  51654. function extractPropsFromVNodeData (
  51655. data,
  51656. Ctor,
  51657. tag
  51658. ) {
  51659. // we are only extracting raw values here.
  51660. // validation and default values are handled in the child
  51661. // component itself.
  51662. var propOptions = Ctor.options.props;
  51663. if (isUndef(propOptions)) {
  51664. return
  51665. }
  51666. var res = {};
  51667. var attrs = data.attrs;
  51668. var props = data.props;
  51669. if (isDef(attrs) || isDef(props)) {
  51670. for (var key in propOptions) {
  51671. var altKey = hyphenate(key);
  51672. {
  51673. var keyInLowerCase = key.toLowerCase();
  51674. if (
  51675. key !== keyInLowerCase &&
  51676. attrs && hasOwn(attrs, keyInLowerCase)
  51677. ) {
  51678. tip(
  51679. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  51680. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  51681. " \"" + key + "\". " +
  51682. "Note that HTML attributes are case-insensitive and camelCased " +
  51683. "props need to use their kebab-case equivalents when using in-DOM " +
  51684. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  51685. );
  51686. }
  51687. }
  51688. checkProp(res, props, key, altKey, true) ||
  51689. checkProp(res, attrs, key, altKey, false);
  51690. }
  51691. }
  51692. return res
  51693. }
  51694. function checkProp (
  51695. res,
  51696. hash,
  51697. key,
  51698. altKey,
  51699. preserve
  51700. ) {
  51701. if (isDef(hash)) {
  51702. if (hasOwn(hash, key)) {
  51703. res[key] = hash[key];
  51704. if (!preserve) {
  51705. delete hash[key];
  51706. }
  51707. return true
  51708. } else if (hasOwn(hash, altKey)) {
  51709. res[key] = hash[altKey];
  51710. if (!preserve) {
  51711. delete hash[altKey];
  51712. }
  51713. return true
  51714. }
  51715. }
  51716. return false
  51717. }
  51718. /* */
  51719. // The template compiler attempts to minimize the need for normalization by
  51720. // statically analyzing the template at compile time.
  51721. //
  51722. // For plain HTML markup, normalization can be completely skipped because the
  51723. // generated render function is guaranteed to return Array<VNode>. There are
  51724. // two cases where extra normalization is needed:
  51725. // 1. When the children contains components - because a functional component
  51726. // may return an Array instead of a single root. In this case, just a simple
  51727. // normalization is needed - if any child is an Array, we flatten the whole
  51728. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  51729. // because functional components already normalize their own children.
  51730. function simpleNormalizeChildren (children) {
  51731. for (var i = 0; i < children.length; i++) {
  51732. if (Array.isArray(children[i])) {
  51733. return Array.prototype.concat.apply([], children)
  51734. }
  51735. }
  51736. return children
  51737. }
  51738. // 2. When the children contains constructs that always generated nested Arrays,
  51739. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  51740. // with hand-written render functions / JSX. In such cases a full normalization
  51741. // is needed to cater to all possible types of children values.
  51742. function normalizeChildren (children) {
  51743. return isPrimitive(children)
  51744. ? [createTextVNode(children)]
  51745. : Array.isArray(children)
  51746. ? normalizeArrayChildren(children)
  51747. : undefined
  51748. }
  51749. function isTextNode (node) {
  51750. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  51751. }
  51752. function normalizeArrayChildren (children, nestedIndex) {
  51753. var res = [];
  51754. var i, c, lastIndex, last;
  51755. for (i = 0; i < children.length; i++) {
  51756. c = children[i];
  51757. if (isUndef(c) || typeof c === 'boolean') { continue }
  51758. lastIndex = res.length - 1;
  51759. last = res[lastIndex];
  51760. // nested
  51761. if (Array.isArray(c)) {
  51762. if (c.length > 0) {
  51763. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  51764. // merge adjacent text nodes
  51765. if (isTextNode(c[0]) && isTextNode(last)) {
  51766. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  51767. c.shift();
  51768. }
  51769. res.push.apply(res, c);
  51770. }
  51771. } else if (isPrimitive(c)) {
  51772. if (isTextNode(last)) {
  51773. // merge adjacent text nodes
  51774. // this is necessary for SSR hydration because text nodes are
  51775. // essentially merged when rendered to HTML strings
  51776. res[lastIndex] = createTextVNode(last.text + c);
  51777. } else if (c !== '') {
  51778. // convert primitive to vnode
  51779. res.push(createTextVNode(c));
  51780. }
  51781. } else {
  51782. if (isTextNode(c) && isTextNode(last)) {
  51783. // merge adjacent text nodes
  51784. res[lastIndex] = createTextVNode(last.text + c.text);
  51785. } else {
  51786. // default key for nested array children (likely generated by v-for)
  51787. if (isTrue(children._isVList) &&
  51788. isDef(c.tag) &&
  51789. isUndef(c.key) &&
  51790. isDef(nestedIndex)) {
  51791. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  51792. }
  51793. res.push(c);
  51794. }
  51795. }
  51796. }
  51797. return res
  51798. }
  51799. /* */
  51800. function initProvide (vm) {
  51801. var provide = vm.$options.provide;
  51802. if (provide) {
  51803. vm._provided = typeof provide === 'function'
  51804. ? provide.call(vm)
  51805. : provide;
  51806. }
  51807. }
  51808. function initInjections (vm) {
  51809. var result = resolveInject(vm.$options.inject, vm);
  51810. if (result) {
  51811. toggleObserving(false);
  51812. Object.keys(result).forEach(function (key) {
  51813. /* istanbul ignore else */
  51814. {
  51815. defineReactive$$1(vm, key, result[key], function () {
  51816. warn(
  51817. "Avoid mutating an injected value directly since the changes will be " +
  51818. "overwritten whenever the provided component re-renders. " +
  51819. "injection being mutated: \"" + key + "\"",
  51820. vm
  51821. );
  51822. });
  51823. }
  51824. });
  51825. toggleObserving(true);
  51826. }
  51827. }
  51828. function resolveInject (inject, vm) {
  51829. if (inject) {
  51830. // inject is :any because flow is not smart enough to figure out cached
  51831. var result = Object.create(null);
  51832. var keys = hasSymbol
  51833. ? Reflect.ownKeys(inject)
  51834. : Object.keys(inject);
  51835. for (var i = 0; i < keys.length; i++) {
  51836. var key = keys[i];
  51837. // #6574 in case the inject object is observed...
  51838. if (key === '__ob__') { continue }
  51839. var provideKey = inject[key].from;
  51840. var source = vm;
  51841. while (source) {
  51842. if (source._provided && hasOwn(source._provided, provideKey)) {
  51843. result[key] = source._provided[provideKey];
  51844. break
  51845. }
  51846. source = source.$parent;
  51847. }
  51848. if (!source) {
  51849. if ('default' in inject[key]) {
  51850. var provideDefault = inject[key].default;
  51851. result[key] = typeof provideDefault === 'function'
  51852. ? provideDefault.call(vm)
  51853. : provideDefault;
  51854. } else {
  51855. warn(("Injection \"" + key + "\" not found"), vm);
  51856. }
  51857. }
  51858. }
  51859. return result
  51860. }
  51861. }
  51862. /* */
  51863. /**
  51864. * Runtime helper for resolving raw children VNodes into a slot object.
  51865. */
  51866. function resolveSlots (
  51867. children,
  51868. context
  51869. ) {
  51870. if (!children || !children.length) {
  51871. return {}
  51872. }
  51873. var slots = {};
  51874. for (var i = 0, l = children.length; i < l; i++) {
  51875. var child = children[i];
  51876. var data = child.data;
  51877. // remove slot attribute if the node is resolved as a Vue slot node
  51878. if (data && data.attrs && data.attrs.slot) {
  51879. delete data.attrs.slot;
  51880. }
  51881. // named slots should only be respected if the vnode was rendered in the
  51882. // same context.
  51883. if ((child.context === context || child.fnContext === context) &&
  51884. data && data.slot != null
  51885. ) {
  51886. var name = data.slot;
  51887. var slot = (slots[name] || (slots[name] = []));
  51888. if (child.tag === 'template') {
  51889. slot.push.apply(slot, child.children || []);
  51890. } else {
  51891. slot.push(child);
  51892. }
  51893. } else {
  51894. (slots.default || (slots.default = [])).push(child);
  51895. }
  51896. }
  51897. // ignore slots that contains only whitespace
  51898. for (var name$1 in slots) {
  51899. if (slots[name$1].every(isWhitespace)) {
  51900. delete slots[name$1];
  51901. }
  51902. }
  51903. return slots
  51904. }
  51905. function isWhitespace (node) {
  51906. return (node.isComment && !node.asyncFactory) || node.text === ' '
  51907. }
  51908. /* */
  51909. function normalizeScopedSlots (
  51910. slots,
  51911. normalSlots,
  51912. prevSlots
  51913. ) {
  51914. var res;
  51915. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  51916. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  51917. var key = slots && slots.$key;
  51918. if (!slots) {
  51919. res = {};
  51920. } else if (slots._normalized) {
  51921. // fast path 1: child component re-render only, parent did not change
  51922. return slots._normalized
  51923. } else if (
  51924. isStable &&
  51925. prevSlots &&
  51926. prevSlots !== emptyObject &&
  51927. key === prevSlots.$key &&
  51928. !hasNormalSlots &&
  51929. !prevSlots.$hasNormal
  51930. ) {
  51931. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  51932. // only need to normalize once
  51933. return prevSlots
  51934. } else {
  51935. res = {};
  51936. for (var key$1 in slots) {
  51937. if (slots[key$1] && key$1[0] !== '$') {
  51938. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  51939. }
  51940. }
  51941. }
  51942. // expose normal slots on scopedSlots
  51943. for (var key$2 in normalSlots) {
  51944. if (!(key$2 in res)) {
  51945. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  51946. }
  51947. }
  51948. // avoriaz seems to mock a non-extensible $scopedSlots object
  51949. // and when that is passed down this would cause an error
  51950. if (slots && Object.isExtensible(slots)) {
  51951. (slots)._normalized = res;
  51952. }
  51953. def(res, '$stable', isStable);
  51954. def(res, '$key', key);
  51955. def(res, '$hasNormal', hasNormalSlots);
  51956. return res
  51957. }
  51958. function normalizeScopedSlot(normalSlots, key, fn) {
  51959. var normalized = function () {
  51960. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  51961. res = res && typeof res === 'object' && !Array.isArray(res)
  51962. ? [res] // single vnode
  51963. : normalizeChildren(res);
  51964. return res && (
  51965. res.length === 0 ||
  51966. (res.length === 1 && res[0].isComment) // #9658
  51967. ) ? undefined
  51968. : res
  51969. };
  51970. // this is a slot using the new v-slot syntax without scope. although it is
  51971. // compiled as a scoped slot, render fn users would expect it to be present
  51972. // on this.$slots because the usage is semantically a normal slot.
  51973. if (fn.proxy) {
  51974. Object.defineProperty(normalSlots, key, {
  51975. get: normalized,
  51976. enumerable: true,
  51977. configurable: true
  51978. });
  51979. }
  51980. return normalized
  51981. }
  51982. function proxyNormalSlot(slots, key) {
  51983. return function () { return slots[key]; }
  51984. }
  51985. /* */
  51986. /**
  51987. * Runtime helper for rendering v-for lists.
  51988. */
  51989. function renderList (
  51990. val,
  51991. render
  51992. ) {
  51993. var ret, i, l, keys, key;
  51994. if (Array.isArray(val) || typeof val === 'string') {
  51995. ret = new Array(val.length);
  51996. for (i = 0, l = val.length; i < l; i++) {
  51997. ret[i] = render(val[i], i);
  51998. }
  51999. } else if (typeof val === 'number') {
  52000. ret = new Array(val);
  52001. for (i = 0; i < val; i++) {
  52002. ret[i] = render(i + 1, i);
  52003. }
  52004. } else if (isObject(val)) {
  52005. if (hasSymbol && val[Symbol.iterator]) {
  52006. ret = [];
  52007. var iterator = val[Symbol.iterator]();
  52008. var result = iterator.next();
  52009. while (!result.done) {
  52010. ret.push(render(result.value, ret.length));
  52011. result = iterator.next();
  52012. }
  52013. } else {
  52014. keys = Object.keys(val);
  52015. ret = new Array(keys.length);
  52016. for (i = 0, l = keys.length; i < l; i++) {
  52017. key = keys[i];
  52018. ret[i] = render(val[key], key, i);
  52019. }
  52020. }
  52021. }
  52022. if (!isDef(ret)) {
  52023. ret = [];
  52024. }
  52025. (ret)._isVList = true;
  52026. return ret
  52027. }
  52028. /* */
  52029. /**
  52030. * Runtime helper for rendering <slot>
  52031. */
  52032. function renderSlot (
  52033. name,
  52034. fallback,
  52035. props,
  52036. bindObject
  52037. ) {
  52038. var scopedSlotFn = this.$scopedSlots[name];
  52039. var nodes;
  52040. if (scopedSlotFn) { // scoped slot
  52041. props = props || {};
  52042. if (bindObject) {
  52043. if (!isObject(bindObject)) {
  52044. warn(
  52045. 'slot v-bind without argument expects an Object',
  52046. this
  52047. );
  52048. }
  52049. props = extend(extend({}, bindObject), props);
  52050. }
  52051. nodes = scopedSlotFn(props) || fallback;
  52052. } else {
  52053. nodes = this.$slots[name] || fallback;
  52054. }
  52055. var target = props && props.slot;
  52056. if (target) {
  52057. return this.$createElement('template', { slot: target }, nodes)
  52058. } else {
  52059. return nodes
  52060. }
  52061. }
  52062. /* */
  52063. /**
  52064. * Runtime helper for resolving filters
  52065. */
  52066. function resolveFilter (id) {
  52067. return resolveAsset(this.$options, 'filters', id, true) || identity
  52068. }
  52069. /* */
  52070. function isKeyNotMatch (expect, actual) {
  52071. if (Array.isArray(expect)) {
  52072. return expect.indexOf(actual) === -1
  52073. } else {
  52074. return expect !== actual
  52075. }
  52076. }
  52077. /**
  52078. * Runtime helper for checking keyCodes from config.
  52079. * exposed as Vue.prototype._k
  52080. * passing in eventKeyName as last argument separately for backwards compat
  52081. */
  52082. function checkKeyCodes (
  52083. eventKeyCode,
  52084. key,
  52085. builtInKeyCode,
  52086. eventKeyName,
  52087. builtInKeyName
  52088. ) {
  52089. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  52090. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  52091. return isKeyNotMatch(builtInKeyName, eventKeyName)
  52092. } else if (mappedKeyCode) {
  52093. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  52094. } else if (eventKeyName) {
  52095. return hyphenate(eventKeyName) !== key
  52096. }
  52097. }
  52098. /* */
  52099. /**
  52100. * Runtime helper for merging v-bind="object" into a VNode's data.
  52101. */
  52102. function bindObjectProps (
  52103. data,
  52104. tag,
  52105. value,
  52106. asProp,
  52107. isSync
  52108. ) {
  52109. if (value) {
  52110. if (!isObject(value)) {
  52111. warn(
  52112. 'v-bind without argument expects an Object or Array value',
  52113. this
  52114. );
  52115. } else {
  52116. if (Array.isArray(value)) {
  52117. value = toObject(value);
  52118. }
  52119. var hash;
  52120. var loop = function ( key ) {
  52121. if (
  52122. key === 'class' ||
  52123. key === 'style' ||
  52124. isReservedAttribute(key)
  52125. ) {
  52126. hash = data;
  52127. } else {
  52128. var type = data.attrs && data.attrs.type;
  52129. hash = asProp || config.mustUseProp(tag, type, key)
  52130. ? data.domProps || (data.domProps = {})
  52131. : data.attrs || (data.attrs = {});
  52132. }
  52133. var camelizedKey = camelize(key);
  52134. var hyphenatedKey = hyphenate(key);
  52135. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  52136. hash[key] = value[key];
  52137. if (isSync) {
  52138. var on = data.on || (data.on = {});
  52139. on[("update:" + key)] = function ($event) {
  52140. value[key] = $event;
  52141. };
  52142. }
  52143. }
  52144. };
  52145. for (var key in value) loop( key );
  52146. }
  52147. }
  52148. return data
  52149. }
  52150. /* */
  52151. /**
  52152. * Runtime helper for rendering static trees.
  52153. */
  52154. function renderStatic (
  52155. index,
  52156. isInFor
  52157. ) {
  52158. var cached = this._staticTrees || (this._staticTrees = []);
  52159. var tree = cached[index];
  52160. // if has already-rendered static tree and not inside v-for,
  52161. // we can reuse the same tree.
  52162. if (tree && !isInFor) {
  52163. return tree
  52164. }
  52165. // otherwise, render a fresh tree.
  52166. tree = cached[index] = this.$options.staticRenderFns[index].call(
  52167. this._renderProxy,
  52168. null,
  52169. this // for render fns generated for functional component templates
  52170. );
  52171. markStatic(tree, ("__static__" + index), false);
  52172. return tree
  52173. }
  52174. /**
  52175. * Runtime helper for v-once.
  52176. * Effectively it means marking the node as static with a unique key.
  52177. */
  52178. function markOnce (
  52179. tree,
  52180. index,
  52181. key
  52182. ) {
  52183. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  52184. return tree
  52185. }
  52186. function markStatic (
  52187. tree,
  52188. key,
  52189. isOnce
  52190. ) {
  52191. if (Array.isArray(tree)) {
  52192. for (var i = 0; i < tree.length; i++) {
  52193. if (tree[i] && typeof tree[i] !== 'string') {
  52194. markStaticNode(tree[i], (key + "_" + i), isOnce);
  52195. }
  52196. }
  52197. } else {
  52198. markStaticNode(tree, key, isOnce);
  52199. }
  52200. }
  52201. function markStaticNode (node, key, isOnce) {
  52202. node.isStatic = true;
  52203. node.key = key;
  52204. node.isOnce = isOnce;
  52205. }
  52206. /* */
  52207. function bindObjectListeners (data, value) {
  52208. if (value) {
  52209. if (!isPlainObject(value)) {
  52210. warn(
  52211. 'v-on without argument expects an Object value',
  52212. this
  52213. );
  52214. } else {
  52215. var on = data.on = data.on ? extend({}, data.on) : {};
  52216. for (var key in value) {
  52217. var existing = on[key];
  52218. var ours = value[key];
  52219. on[key] = existing ? [].concat(existing, ours) : ours;
  52220. }
  52221. }
  52222. }
  52223. return data
  52224. }
  52225. /* */
  52226. function resolveScopedSlots (
  52227. fns, // see flow/vnode
  52228. res,
  52229. // the following are added in 2.6
  52230. hasDynamicKeys,
  52231. contentHashKey
  52232. ) {
  52233. res = res || { $stable: !hasDynamicKeys };
  52234. for (var i = 0; i < fns.length; i++) {
  52235. var slot = fns[i];
  52236. if (Array.isArray(slot)) {
  52237. resolveScopedSlots(slot, res, hasDynamicKeys);
  52238. } else if (slot) {
  52239. // marker for reverse proxying v-slot without scope on this.$slots
  52240. if (slot.proxy) {
  52241. slot.fn.proxy = true;
  52242. }
  52243. res[slot.key] = slot.fn;
  52244. }
  52245. }
  52246. if (contentHashKey) {
  52247. (res).$key = contentHashKey;
  52248. }
  52249. return res
  52250. }
  52251. /* */
  52252. function bindDynamicKeys (baseObj, values) {
  52253. for (var i = 0; i < values.length; i += 2) {
  52254. var key = values[i];
  52255. if (typeof key === 'string' && key) {
  52256. baseObj[values[i]] = values[i + 1];
  52257. } else if (key !== '' && key !== null) {
  52258. // null is a special value for explicitly removing a binding
  52259. warn(
  52260. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  52261. this
  52262. );
  52263. }
  52264. }
  52265. return baseObj
  52266. }
  52267. // helper to dynamically append modifier runtime markers to event names.
  52268. // ensure only append when value is already string, otherwise it will be cast
  52269. // to string and cause the type check to miss.
  52270. function prependModifier (value, symbol) {
  52271. return typeof value === 'string' ? symbol + value : value
  52272. }
  52273. /* */
  52274. function installRenderHelpers (target) {
  52275. target._o = markOnce;
  52276. target._n = toNumber;
  52277. target._s = toString;
  52278. target._l = renderList;
  52279. target._t = renderSlot;
  52280. target._q = looseEqual;
  52281. target._i = looseIndexOf;
  52282. target._m = renderStatic;
  52283. target._f = resolveFilter;
  52284. target._k = checkKeyCodes;
  52285. target._b = bindObjectProps;
  52286. target._v = createTextVNode;
  52287. target._e = createEmptyVNode;
  52288. target._u = resolveScopedSlots;
  52289. target._g = bindObjectListeners;
  52290. target._d = bindDynamicKeys;
  52291. target._p = prependModifier;
  52292. }
  52293. /* */
  52294. function FunctionalRenderContext (
  52295. data,
  52296. props,
  52297. children,
  52298. parent,
  52299. Ctor
  52300. ) {
  52301. var this$1 = this;
  52302. var options = Ctor.options;
  52303. // ensure the createElement function in functional components
  52304. // gets a unique context - this is necessary for correct named slot check
  52305. var contextVm;
  52306. if (hasOwn(parent, '_uid')) {
  52307. contextVm = Object.create(parent);
  52308. // $flow-disable-line
  52309. contextVm._original = parent;
  52310. } else {
  52311. // the context vm passed in is a functional context as well.
  52312. // in this case we want to make sure we are able to get a hold to the
  52313. // real context instance.
  52314. contextVm = parent;
  52315. // $flow-disable-line
  52316. parent = parent._original;
  52317. }
  52318. var isCompiled = isTrue(options._compiled);
  52319. var needNormalization = !isCompiled;
  52320. this.data = data;
  52321. this.props = props;
  52322. this.children = children;
  52323. this.parent = parent;
  52324. this.listeners = data.on || emptyObject;
  52325. this.injections = resolveInject(options.inject, parent);
  52326. this.slots = function () {
  52327. if (!this$1.$slots) {
  52328. normalizeScopedSlots(
  52329. data.scopedSlots,
  52330. this$1.$slots = resolveSlots(children, parent)
  52331. );
  52332. }
  52333. return this$1.$slots
  52334. };
  52335. Object.defineProperty(this, 'scopedSlots', ({
  52336. enumerable: true,
  52337. get: function get () {
  52338. return normalizeScopedSlots(data.scopedSlots, this.slots())
  52339. }
  52340. }));
  52341. // support for compiled functional template
  52342. if (isCompiled) {
  52343. // exposing $options for renderStatic()
  52344. this.$options = options;
  52345. // pre-resolve slots for renderSlot()
  52346. this.$slots = this.slots();
  52347. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  52348. }
  52349. if (options._scopeId) {
  52350. this._c = function (a, b, c, d) {
  52351. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  52352. if (vnode && !Array.isArray(vnode)) {
  52353. vnode.fnScopeId = options._scopeId;
  52354. vnode.fnContext = parent;
  52355. }
  52356. return vnode
  52357. };
  52358. } else {
  52359. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  52360. }
  52361. }
  52362. installRenderHelpers(FunctionalRenderContext.prototype);
  52363. function createFunctionalComponent (
  52364. Ctor,
  52365. propsData,
  52366. data,
  52367. contextVm,
  52368. children
  52369. ) {
  52370. var options = Ctor.options;
  52371. var props = {};
  52372. var propOptions = options.props;
  52373. if (isDef(propOptions)) {
  52374. for (var key in propOptions) {
  52375. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  52376. }
  52377. } else {
  52378. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  52379. if (isDef(data.props)) { mergeProps(props, data.props); }
  52380. }
  52381. var renderContext = new FunctionalRenderContext(
  52382. data,
  52383. props,
  52384. children,
  52385. contextVm,
  52386. Ctor
  52387. );
  52388. var vnode = options.render.call(null, renderContext._c, renderContext);
  52389. if (vnode instanceof VNode) {
  52390. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  52391. } else if (Array.isArray(vnode)) {
  52392. var vnodes = normalizeChildren(vnode) || [];
  52393. var res = new Array(vnodes.length);
  52394. for (var i = 0; i < vnodes.length; i++) {
  52395. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  52396. }
  52397. return res
  52398. }
  52399. }
  52400. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  52401. // #7817 clone node before setting fnContext, otherwise if the node is reused
  52402. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  52403. // that should not be matched to match.
  52404. var clone = cloneVNode(vnode);
  52405. clone.fnContext = contextVm;
  52406. clone.fnOptions = options;
  52407. {
  52408. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  52409. }
  52410. if (data.slot) {
  52411. (clone.data || (clone.data = {})).slot = data.slot;
  52412. }
  52413. return clone
  52414. }
  52415. function mergeProps (to, from) {
  52416. for (var key in from) {
  52417. to[camelize(key)] = from[key];
  52418. }
  52419. }
  52420. /* */
  52421. /* */
  52422. /* */
  52423. /* */
  52424. // inline hooks to be invoked on component VNodes during patch
  52425. var componentVNodeHooks = {
  52426. init: function init (vnode, hydrating) {
  52427. if (
  52428. vnode.componentInstance &&
  52429. !vnode.componentInstance._isDestroyed &&
  52430. vnode.data.keepAlive
  52431. ) {
  52432. // kept-alive components, treat as a patch
  52433. var mountedNode = vnode; // work around flow
  52434. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  52435. } else {
  52436. var child = vnode.componentInstance = createComponentInstanceForVnode(
  52437. vnode,
  52438. activeInstance
  52439. );
  52440. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  52441. }
  52442. },
  52443. prepatch: function prepatch (oldVnode, vnode) {
  52444. var options = vnode.componentOptions;
  52445. var child = vnode.componentInstance = oldVnode.componentInstance;
  52446. updateChildComponent(
  52447. child,
  52448. options.propsData, // updated props
  52449. options.listeners, // updated listeners
  52450. vnode, // new parent vnode
  52451. options.children // new children
  52452. );
  52453. },
  52454. insert: function insert (vnode) {
  52455. var context = vnode.context;
  52456. var componentInstance = vnode.componentInstance;
  52457. if (!componentInstance._isMounted) {
  52458. componentInstance._isMounted = true;
  52459. callHook(componentInstance, 'mounted');
  52460. }
  52461. if (vnode.data.keepAlive) {
  52462. if (context._isMounted) {
  52463. // vue-router#1212
  52464. // During updates, a kept-alive component's child components may
  52465. // change, so directly walking the tree here may call activated hooks
  52466. // on incorrect children. Instead we push them into a queue which will
  52467. // be processed after the whole patch process ended.
  52468. queueActivatedComponent(componentInstance);
  52469. } else {
  52470. activateChildComponent(componentInstance, true /* direct */);
  52471. }
  52472. }
  52473. },
  52474. destroy: function destroy (vnode) {
  52475. var componentInstance = vnode.componentInstance;
  52476. if (!componentInstance._isDestroyed) {
  52477. if (!vnode.data.keepAlive) {
  52478. componentInstance.$destroy();
  52479. } else {
  52480. deactivateChildComponent(componentInstance, true /* direct */);
  52481. }
  52482. }
  52483. }
  52484. };
  52485. var hooksToMerge = Object.keys(componentVNodeHooks);
  52486. function createComponent (
  52487. Ctor,
  52488. data,
  52489. context,
  52490. children,
  52491. tag
  52492. ) {
  52493. if (isUndef(Ctor)) {
  52494. return
  52495. }
  52496. var baseCtor = context.$options._base;
  52497. // plain options object: turn it into a constructor
  52498. if (isObject(Ctor)) {
  52499. Ctor = baseCtor.extend(Ctor);
  52500. }
  52501. // if at this stage it's not a constructor or an async component factory,
  52502. // reject.
  52503. if (typeof Ctor !== 'function') {
  52504. {
  52505. warn(("Invalid Component definition: " + (String(Ctor))), context);
  52506. }
  52507. return
  52508. }
  52509. // async component
  52510. var asyncFactory;
  52511. if (isUndef(Ctor.cid)) {
  52512. asyncFactory = Ctor;
  52513. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  52514. if (Ctor === undefined) {
  52515. // return a placeholder node for async component, which is rendered
  52516. // as a comment node but preserves all the raw information for the node.
  52517. // the information will be used for async server-rendering and hydration.
  52518. return createAsyncPlaceholder(
  52519. asyncFactory,
  52520. data,
  52521. context,
  52522. children,
  52523. tag
  52524. )
  52525. }
  52526. }
  52527. data = data || {};
  52528. // resolve constructor options in case global mixins are applied after
  52529. // component constructor creation
  52530. resolveConstructorOptions(Ctor);
  52531. // transform component v-model data into props & events
  52532. if (isDef(data.model)) {
  52533. transformModel(Ctor.options, data);
  52534. }
  52535. // extract props
  52536. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  52537. // functional component
  52538. if (isTrue(Ctor.options.functional)) {
  52539. return createFunctionalComponent(Ctor, propsData, data, context, children)
  52540. }
  52541. // extract listeners, since these needs to be treated as
  52542. // child component listeners instead of DOM listeners
  52543. var listeners = data.on;
  52544. // replace with listeners with .native modifier
  52545. // so it gets processed during parent component patch.
  52546. data.on = data.nativeOn;
  52547. if (isTrue(Ctor.options.abstract)) {
  52548. // abstract components do not keep anything
  52549. // other than props & listeners & slot
  52550. // work around flow
  52551. var slot = data.slot;
  52552. data = {};
  52553. if (slot) {
  52554. data.slot = slot;
  52555. }
  52556. }
  52557. // install component management hooks onto the placeholder node
  52558. installComponentHooks(data);
  52559. // return a placeholder vnode
  52560. var name = Ctor.options.name || tag;
  52561. var vnode = new VNode(
  52562. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  52563. data, undefined, undefined, undefined, context,
  52564. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  52565. asyncFactory
  52566. );
  52567. return vnode
  52568. }
  52569. function createComponentInstanceForVnode (
  52570. vnode, // we know it's MountedComponentVNode but flow doesn't
  52571. parent // activeInstance in lifecycle state
  52572. ) {
  52573. var options = {
  52574. _isComponent: true,
  52575. _parentVnode: vnode,
  52576. parent: parent
  52577. };
  52578. // check inline-template render functions
  52579. var inlineTemplate = vnode.data.inlineTemplate;
  52580. if (isDef(inlineTemplate)) {
  52581. options.render = inlineTemplate.render;
  52582. options.staticRenderFns = inlineTemplate.staticRenderFns;
  52583. }
  52584. return new vnode.componentOptions.Ctor(options)
  52585. }
  52586. function installComponentHooks (data) {
  52587. var hooks = data.hook || (data.hook = {});
  52588. for (var i = 0; i < hooksToMerge.length; i++) {
  52589. var key = hooksToMerge[i];
  52590. var existing = hooks[key];
  52591. var toMerge = componentVNodeHooks[key];
  52592. if (existing !== toMerge && !(existing && existing._merged)) {
  52593. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  52594. }
  52595. }
  52596. }
  52597. function mergeHook$1 (f1, f2) {
  52598. var merged = function (a, b) {
  52599. // flow complains about extra args which is why we use any
  52600. f1(a, b);
  52601. f2(a, b);
  52602. };
  52603. merged._merged = true;
  52604. return merged
  52605. }
  52606. // transform component v-model info (value and callback) into
  52607. // prop and event handler respectively.
  52608. function transformModel (options, data) {
  52609. var prop = (options.model && options.model.prop) || 'value';
  52610. var event = (options.model && options.model.event) || 'input'
  52611. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  52612. var on = data.on || (data.on = {});
  52613. var existing = on[event];
  52614. var callback = data.model.callback;
  52615. if (isDef(existing)) {
  52616. if (
  52617. Array.isArray(existing)
  52618. ? existing.indexOf(callback) === -1
  52619. : existing !== callback
  52620. ) {
  52621. on[event] = [callback].concat(existing);
  52622. }
  52623. } else {
  52624. on[event] = callback;
  52625. }
  52626. }
  52627. /* */
  52628. var SIMPLE_NORMALIZE = 1;
  52629. var ALWAYS_NORMALIZE = 2;
  52630. // wrapper function for providing a more flexible interface
  52631. // without getting yelled at by flow
  52632. function createElement (
  52633. context,
  52634. tag,
  52635. data,
  52636. children,
  52637. normalizationType,
  52638. alwaysNormalize
  52639. ) {
  52640. if (Array.isArray(data) || isPrimitive(data)) {
  52641. normalizationType = children;
  52642. children = data;
  52643. data = undefined;
  52644. }
  52645. if (isTrue(alwaysNormalize)) {
  52646. normalizationType = ALWAYS_NORMALIZE;
  52647. }
  52648. return _createElement(context, tag, data, children, normalizationType)
  52649. }
  52650. function _createElement (
  52651. context,
  52652. tag,
  52653. data,
  52654. children,
  52655. normalizationType
  52656. ) {
  52657. if (isDef(data) && isDef((data).__ob__)) {
  52658. warn(
  52659. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  52660. 'Always create fresh vnode data objects in each render!',
  52661. context
  52662. );
  52663. return createEmptyVNode()
  52664. }
  52665. // object syntax in v-bind
  52666. if (isDef(data) && isDef(data.is)) {
  52667. tag = data.is;
  52668. }
  52669. if (!tag) {
  52670. // in case of component :is set to falsy value
  52671. return createEmptyVNode()
  52672. }
  52673. // warn against non-primitive key
  52674. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  52675. ) {
  52676. {
  52677. warn(
  52678. 'Avoid using non-primitive value as key, ' +
  52679. 'use string/number value instead.',
  52680. context
  52681. );
  52682. }
  52683. }
  52684. // support single function children as default scoped slot
  52685. if (Array.isArray(children) &&
  52686. typeof children[0] === 'function'
  52687. ) {
  52688. data = data || {};
  52689. data.scopedSlots = { default: children[0] };
  52690. children.length = 0;
  52691. }
  52692. if (normalizationType === ALWAYS_NORMALIZE) {
  52693. children = normalizeChildren(children);
  52694. } else if (normalizationType === SIMPLE_NORMALIZE) {
  52695. children = simpleNormalizeChildren(children);
  52696. }
  52697. var vnode, ns;
  52698. if (typeof tag === 'string') {
  52699. var Ctor;
  52700. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  52701. if (config.isReservedTag(tag)) {
  52702. // platform built-in elements
  52703. if (isDef(data) && isDef(data.nativeOn)) {
  52704. warn(
  52705. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  52706. context
  52707. );
  52708. }
  52709. vnode = new VNode(
  52710. config.parsePlatformTagName(tag), data, children,
  52711. undefined, undefined, context
  52712. );
  52713. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  52714. // component
  52715. vnode = createComponent(Ctor, data, context, children, tag);
  52716. } else {
  52717. // unknown or unlisted namespaced elements
  52718. // check at runtime because it may get assigned a namespace when its
  52719. // parent normalizes children
  52720. vnode = new VNode(
  52721. tag, data, children,
  52722. undefined, undefined, context
  52723. );
  52724. }
  52725. } else {
  52726. // direct component options / constructor
  52727. vnode = createComponent(tag, data, context, children);
  52728. }
  52729. if (Array.isArray(vnode)) {
  52730. return vnode
  52731. } else if (isDef(vnode)) {
  52732. if (isDef(ns)) { applyNS(vnode, ns); }
  52733. if (isDef(data)) { registerDeepBindings(data); }
  52734. return vnode
  52735. } else {
  52736. return createEmptyVNode()
  52737. }
  52738. }
  52739. function applyNS (vnode, ns, force) {
  52740. vnode.ns = ns;
  52741. if (vnode.tag === 'foreignObject') {
  52742. // use default namespace inside foreignObject
  52743. ns = undefined;
  52744. force = true;
  52745. }
  52746. if (isDef(vnode.children)) {
  52747. for (var i = 0, l = vnode.children.length; i < l; i++) {
  52748. var child = vnode.children[i];
  52749. if (isDef(child.tag) && (
  52750. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  52751. applyNS(child, ns, force);
  52752. }
  52753. }
  52754. }
  52755. }
  52756. // ref #5318
  52757. // necessary to ensure parent re-render when deep bindings like :style and
  52758. // :class are used on slot nodes
  52759. function registerDeepBindings (data) {
  52760. if (isObject(data.style)) {
  52761. traverse(data.style);
  52762. }
  52763. if (isObject(data.class)) {
  52764. traverse(data.class);
  52765. }
  52766. }
  52767. /* */
  52768. function initRender (vm) {
  52769. vm._vnode = null; // the root of the child tree
  52770. vm._staticTrees = null; // v-once cached trees
  52771. var options = vm.$options;
  52772. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  52773. var renderContext = parentVnode && parentVnode.context;
  52774. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  52775. vm.$scopedSlots = emptyObject;
  52776. // bind the createElement fn to this instance
  52777. // so that we get proper render context inside it.
  52778. // args order: tag, data, children, normalizationType, alwaysNormalize
  52779. // internal version is used by render functions compiled from templates
  52780. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  52781. // normalization is always applied for the public version, used in
  52782. // user-written render functions.
  52783. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  52784. // $attrs & $listeners are exposed for easier HOC creation.
  52785. // they need to be reactive so that HOCs using them are always updated
  52786. var parentData = parentVnode && parentVnode.data;
  52787. /* istanbul ignore else */
  52788. {
  52789. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  52790. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  52791. }, true);
  52792. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  52793. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  52794. }, true);
  52795. }
  52796. }
  52797. var currentRenderingInstance = null;
  52798. function renderMixin (Vue) {
  52799. // install runtime convenience helpers
  52800. installRenderHelpers(Vue.prototype);
  52801. Vue.prototype.$nextTick = function (fn) {
  52802. return nextTick(fn, this)
  52803. };
  52804. Vue.prototype._render = function () {
  52805. var vm = this;
  52806. var ref = vm.$options;
  52807. var render = ref.render;
  52808. var _parentVnode = ref._parentVnode;
  52809. if (_parentVnode) {
  52810. vm.$scopedSlots = normalizeScopedSlots(
  52811. _parentVnode.data.scopedSlots,
  52812. vm.$slots,
  52813. vm.$scopedSlots
  52814. );
  52815. }
  52816. // set parent vnode. this allows render functions to have access
  52817. // to the data on the placeholder node.
  52818. vm.$vnode = _parentVnode;
  52819. // render self
  52820. var vnode;
  52821. try {
  52822. // There's no need to maintain a stack because all render fns are called
  52823. // separately from one another. Nested component's render fns are called
  52824. // when parent component is patched.
  52825. currentRenderingInstance = vm;
  52826. vnode = render.call(vm._renderProxy, vm.$createElement);
  52827. } catch (e) {
  52828. handleError(e, vm, "render");
  52829. // return error render result,
  52830. // or previous vnode to prevent render error causing blank component
  52831. /* istanbul ignore else */
  52832. if (vm.$options.renderError) {
  52833. try {
  52834. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  52835. } catch (e) {
  52836. handleError(e, vm, "renderError");
  52837. vnode = vm._vnode;
  52838. }
  52839. } else {
  52840. vnode = vm._vnode;
  52841. }
  52842. } finally {
  52843. currentRenderingInstance = null;
  52844. }
  52845. // if the returned array contains only a single node, allow it
  52846. if (Array.isArray(vnode) && vnode.length === 1) {
  52847. vnode = vnode[0];
  52848. }
  52849. // return empty vnode in case the render function errored out
  52850. if (!(vnode instanceof VNode)) {
  52851. if (Array.isArray(vnode)) {
  52852. warn(
  52853. 'Multiple root nodes returned from render function. Render function ' +
  52854. 'should return a single root node.',
  52855. vm
  52856. );
  52857. }
  52858. vnode = createEmptyVNode();
  52859. }
  52860. // set parent
  52861. vnode.parent = _parentVnode;
  52862. return vnode
  52863. };
  52864. }
  52865. /* */
  52866. function ensureCtor (comp, base) {
  52867. if (
  52868. comp.__esModule ||
  52869. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  52870. ) {
  52871. comp = comp.default;
  52872. }
  52873. return isObject(comp)
  52874. ? base.extend(comp)
  52875. : comp
  52876. }
  52877. function createAsyncPlaceholder (
  52878. factory,
  52879. data,
  52880. context,
  52881. children,
  52882. tag
  52883. ) {
  52884. var node = createEmptyVNode();
  52885. node.asyncFactory = factory;
  52886. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  52887. return node
  52888. }
  52889. function resolveAsyncComponent (
  52890. factory,
  52891. baseCtor
  52892. ) {
  52893. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  52894. return factory.errorComp
  52895. }
  52896. if (isDef(factory.resolved)) {
  52897. return factory.resolved
  52898. }
  52899. var owner = currentRenderingInstance;
  52900. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  52901. // already pending
  52902. factory.owners.push(owner);
  52903. }
  52904. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  52905. return factory.loadingComp
  52906. }
  52907. if (owner && !isDef(factory.owners)) {
  52908. var owners = factory.owners = [owner];
  52909. var sync = true;
  52910. var timerLoading = null;
  52911. var timerTimeout = null
  52912. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  52913. var forceRender = function (renderCompleted) {
  52914. for (var i = 0, l = owners.length; i < l; i++) {
  52915. (owners[i]).$forceUpdate();
  52916. }
  52917. if (renderCompleted) {
  52918. owners.length = 0;
  52919. if (timerLoading !== null) {
  52920. clearTimeout(timerLoading);
  52921. timerLoading = null;
  52922. }
  52923. if (timerTimeout !== null) {
  52924. clearTimeout(timerTimeout);
  52925. timerTimeout = null;
  52926. }
  52927. }
  52928. };
  52929. var resolve = once(function (res) {
  52930. // cache resolved
  52931. factory.resolved = ensureCtor(res, baseCtor);
  52932. // invoke callbacks only if this is not a synchronous resolve
  52933. // (async resolves are shimmed as synchronous during SSR)
  52934. if (!sync) {
  52935. forceRender(true);
  52936. } else {
  52937. owners.length = 0;
  52938. }
  52939. });
  52940. var reject = once(function (reason) {
  52941. warn(
  52942. "Failed to resolve async component: " + (String(factory)) +
  52943. (reason ? ("\nReason: " + reason) : '')
  52944. );
  52945. if (isDef(factory.errorComp)) {
  52946. factory.error = true;
  52947. forceRender(true);
  52948. }
  52949. });
  52950. var res = factory(resolve, reject);
  52951. if (isObject(res)) {
  52952. if (isPromise(res)) {
  52953. // () => Promise
  52954. if (isUndef(factory.resolved)) {
  52955. res.then(resolve, reject);
  52956. }
  52957. } else if (isPromise(res.component)) {
  52958. res.component.then(resolve, reject);
  52959. if (isDef(res.error)) {
  52960. factory.errorComp = ensureCtor(res.error, baseCtor);
  52961. }
  52962. if (isDef(res.loading)) {
  52963. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  52964. if (res.delay === 0) {
  52965. factory.loading = true;
  52966. } else {
  52967. timerLoading = setTimeout(function () {
  52968. timerLoading = null;
  52969. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  52970. factory.loading = true;
  52971. forceRender(false);
  52972. }
  52973. }, res.delay || 200);
  52974. }
  52975. }
  52976. if (isDef(res.timeout)) {
  52977. timerTimeout = setTimeout(function () {
  52978. timerTimeout = null;
  52979. if (isUndef(factory.resolved)) {
  52980. reject(
  52981. "timeout (" + (res.timeout) + "ms)"
  52982. );
  52983. }
  52984. }, res.timeout);
  52985. }
  52986. }
  52987. }
  52988. sync = false;
  52989. // return in case resolved synchronously
  52990. return factory.loading
  52991. ? factory.loadingComp
  52992. : factory.resolved
  52993. }
  52994. }
  52995. /* */
  52996. function isAsyncPlaceholder (node) {
  52997. return node.isComment && node.asyncFactory
  52998. }
  52999. /* */
  53000. function getFirstComponentChild (children) {
  53001. if (Array.isArray(children)) {
  53002. for (var i = 0; i < children.length; i++) {
  53003. var c = children[i];
  53004. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  53005. return c
  53006. }
  53007. }
  53008. }
  53009. }
  53010. /* */
  53011. /* */
  53012. function initEvents (vm) {
  53013. vm._events = Object.create(null);
  53014. vm._hasHookEvent = false;
  53015. // init parent attached events
  53016. var listeners = vm.$options._parentListeners;
  53017. if (listeners) {
  53018. updateComponentListeners(vm, listeners);
  53019. }
  53020. }
  53021. var target;
  53022. function add (event, fn) {
  53023. target.$on(event, fn);
  53024. }
  53025. function remove$1 (event, fn) {
  53026. target.$off(event, fn);
  53027. }
  53028. function createOnceHandler (event, fn) {
  53029. var _target = target;
  53030. return function onceHandler () {
  53031. var res = fn.apply(null, arguments);
  53032. if (res !== null) {
  53033. _target.$off(event, onceHandler);
  53034. }
  53035. }
  53036. }
  53037. function updateComponentListeners (
  53038. vm,
  53039. listeners,
  53040. oldListeners
  53041. ) {
  53042. target = vm;
  53043. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  53044. target = undefined;
  53045. }
  53046. function eventsMixin (Vue) {
  53047. var hookRE = /^hook:/;
  53048. Vue.prototype.$on = function (event, fn) {
  53049. var vm = this;
  53050. if (Array.isArray(event)) {
  53051. for (var i = 0, l = event.length; i < l; i++) {
  53052. vm.$on(event[i], fn);
  53053. }
  53054. } else {
  53055. (vm._events[event] || (vm._events[event] = [])).push(fn);
  53056. // optimize hook:event cost by using a boolean flag marked at registration
  53057. // instead of a hash lookup
  53058. if (hookRE.test(event)) {
  53059. vm._hasHookEvent = true;
  53060. }
  53061. }
  53062. return vm
  53063. };
  53064. Vue.prototype.$once = function (event, fn) {
  53065. var vm = this;
  53066. function on () {
  53067. vm.$off(event, on);
  53068. fn.apply(vm, arguments);
  53069. }
  53070. on.fn = fn;
  53071. vm.$on(event, on);
  53072. return vm
  53073. };
  53074. Vue.prototype.$off = function (event, fn) {
  53075. var vm = this;
  53076. // all
  53077. if (!arguments.length) {
  53078. vm._events = Object.create(null);
  53079. return vm
  53080. }
  53081. // array of events
  53082. if (Array.isArray(event)) {
  53083. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  53084. vm.$off(event[i$1], fn);
  53085. }
  53086. return vm
  53087. }
  53088. // specific event
  53089. var cbs = vm._events[event];
  53090. if (!cbs) {
  53091. return vm
  53092. }
  53093. if (!fn) {
  53094. vm._events[event] = null;
  53095. return vm
  53096. }
  53097. // specific handler
  53098. var cb;
  53099. var i = cbs.length;
  53100. while (i--) {
  53101. cb = cbs[i];
  53102. if (cb === fn || cb.fn === fn) {
  53103. cbs.splice(i, 1);
  53104. break
  53105. }
  53106. }
  53107. return vm
  53108. };
  53109. Vue.prototype.$emit = function (event) {
  53110. var vm = this;
  53111. {
  53112. var lowerCaseEvent = event.toLowerCase();
  53113. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  53114. tip(
  53115. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  53116. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  53117. "Note that HTML attributes are case-insensitive and you cannot use " +
  53118. "v-on to listen to camelCase events when using in-DOM templates. " +
  53119. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  53120. );
  53121. }
  53122. }
  53123. var cbs = vm._events[event];
  53124. if (cbs) {
  53125. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  53126. var args = toArray(arguments, 1);
  53127. var info = "event handler for \"" + event + "\"";
  53128. for (var i = 0, l = cbs.length; i < l; i++) {
  53129. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  53130. }
  53131. }
  53132. return vm
  53133. };
  53134. }
  53135. /* */
  53136. var activeInstance = null;
  53137. var isUpdatingChildComponent = false;
  53138. function setActiveInstance(vm) {
  53139. var prevActiveInstance = activeInstance;
  53140. activeInstance = vm;
  53141. return function () {
  53142. activeInstance = prevActiveInstance;
  53143. }
  53144. }
  53145. function initLifecycle (vm) {
  53146. var options = vm.$options;
  53147. // locate first non-abstract parent
  53148. var parent = options.parent;
  53149. if (parent && !options.abstract) {
  53150. while (parent.$options.abstract && parent.$parent) {
  53151. parent = parent.$parent;
  53152. }
  53153. parent.$children.push(vm);
  53154. }
  53155. vm.$parent = parent;
  53156. vm.$root = parent ? parent.$root : vm;
  53157. vm.$children = [];
  53158. vm.$refs = {};
  53159. vm._watcher = null;
  53160. vm._inactive = null;
  53161. vm._directInactive = false;
  53162. vm._isMounted = false;
  53163. vm._isDestroyed = false;
  53164. vm._isBeingDestroyed = false;
  53165. }
  53166. function lifecycleMixin (Vue) {
  53167. Vue.prototype._update = function (vnode, hydrating) {
  53168. var vm = this;
  53169. var prevEl = vm.$el;
  53170. var prevVnode = vm._vnode;
  53171. var restoreActiveInstance = setActiveInstance(vm);
  53172. vm._vnode = vnode;
  53173. // Vue.prototype.__patch__ is injected in entry points
  53174. // based on the rendering backend used.
  53175. if (!prevVnode) {
  53176. // initial render
  53177. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  53178. } else {
  53179. // updates
  53180. vm.$el = vm.__patch__(prevVnode, vnode);
  53181. }
  53182. restoreActiveInstance();
  53183. // update __vue__ reference
  53184. if (prevEl) {
  53185. prevEl.__vue__ = null;
  53186. }
  53187. if (vm.$el) {
  53188. vm.$el.__vue__ = vm;
  53189. }
  53190. // if parent is an HOC, update its $el as well
  53191. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  53192. vm.$parent.$el = vm.$el;
  53193. }
  53194. // updated hook is called by the scheduler to ensure that children are
  53195. // updated in a parent's updated hook.
  53196. };
  53197. Vue.prototype.$forceUpdate = function () {
  53198. var vm = this;
  53199. if (vm._watcher) {
  53200. vm._watcher.update();
  53201. }
  53202. };
  53203. Vue.prototype.$destroy = function () {
  53204. var vm = this;
  53205. if (vm._isBeingDestroyed) {
  53206. return
  53207. }
  53208. callHook(vm, 'beforeDestroy');
  53209. vm._isBeingDestroyed = true;
  53210. // remove self from parent
  53211. var parent = vm.$parent;
  53212. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  53213. remove(parent.$children, vm);
  53214. }
  53215. // teardown watchers
  53216. if (vm._watcher) {
  53217. vm._watcher.teardown();
  53218. }
  53219. var i = vm._watchers.length;
  53220. while (i--) {
  53221. vm._watchers[i].teardown();
  53222. }
  53223. // remove reference from data ob
  53224. // frozen object may not have observer.
  53225. if (vm._data.__ob__) {
  53226. vm._data.__ob__.vmCount--;
  53227. }
  53228. // call the last hook...
  53229. vm._isDestroyed = true;
  53230. // invoke destroy hooks on current rendered tree
  53231. vm.__patch__(vm._vnode, null);
  53232. // fire destroyed hook
  53233. callHook(vm, 'destroyed');
  53234. // turn off all instance listeners.
  53235. vm.$off();
  53236. // remove __vue__ reference
  53237. if (vm.$el) {
  53238. vm.$el.__vue__ = null;
  53239. }
  53240. // release circular reference (#6759)
  53241. if (vm.$vnode) {
  53242. vm.$vnode.parent = null;
  53243. }
  53244. };
  53245. }
  53246. function mountComponent (
  53247. vm,
  53248. el,
  53249. hydrating
  53250. ) {
  53251. vm.$el = el;
  53252. if (!vm.$options.render) {
  53253. vm.$options.render = createEmptyVNode;
  53254. {
  53255. /* istanbul ignore if */
  53256. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  53257. vm.$options.el || el) {
  53258. warn(
  53259. 'You are using the runtime-only build of Vue where the template ' +
  53260. 'compiler is not available. Either pre-compile the templates into ' +
  53261. 'render functions, or use the compiler-included build.',
  53262. vm
  53263. );
  53264. } else {
  53265. warn(
  53266. 'Failed to mount component: template or render function not defined.',
  53267. vm
  53268. );
  53269. }
  53270. }
  53271. }
  53272. callHook(vm, 'beforeMount');
  53273. var updateComponent;
  53274. /* istanbul ignore if */
  53275. if (config.performance && mark) {
  53276. updateComponent = function () {
  53277. var name = vm._name;
  53278. var id = vm._uid;
  53279. var startTag = "vue-perf-start:" + id;
  53280. var endTag = "vue-perf-end:" + id;
  53281. mark(startTag);
  53282. var vnode = vm._render();
  53283. mark(endTag);
  53284. measure(("vue " + name + " render"), startTag, endTag);
  53285. mark(startTag);
  53286. vm._update(vnode, hydrating);
  53287. mark(endTag);
  53288. measure(("vue " + name + " patch"), startTag, endTag);
  53289. };
  53290. } else {
  53291. updateComponent = function () {
  53292. vm._update(vm._render(), hydrating);
  53293. };
  53294. }
  53295. // we set this to vm._watcher inside the watcher's constructor
  53296. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  53297. // component's mounted hook), which relies on vm._watcher being already defined
  53298. new Watcher(vm, updateComponent, noop, {
  53299. before: function before () {
  53300. if (vm._isMounted && !vm._isDestroyed) {
  53301. callHook(vm, 'beforeUpdate');
  53302. }
  53303. }
  53304. }, true /* isRenderWatcher */);
  53305. hydrating = false;
  53306. // manually mounted instance, call mounted on self
  53307. // mounted is called for render-created child components in its inserted hook
  53308. if (vm.$vnode == null) {
  53309. vm._isMounted = true;
  53310. callHook(vm, 'mounted');
  53311. }
  53312. return vm
  53313. }
  53314. function updateChildComponent (
  53315. vm,
  53316. propsData,
  53317. listeners,
  53318. parentVnode,
  53319. renderChildren
  53320. ) {
  53321. {
  53322. isUpdatingChildComponent = true;
  53323. }
  53324. // determine whether component has slot children
  53325. // we need to do this before overwriting $options._renderChildren.
  53326. // check if there are dynamic scopedSlots (hand-written or compiled but with
  53327. // dynamic slot names). Static scoped slots compiled from template has the
  53328. // "$stable" marker.
  53329. var newScopedSlots = parentVnode.data.scopedSlots;
  53330. var oldScopedSlots = vm.$scopedSlots;
  53331. var hasDynamicScopedSlot = !!(
  53332. (newScopedSlots && !newScopedSlots.$stable) ||
  53333. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  53334. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  53335. );
  53336. // Any static slot children from the parent may have changed during parent's
  53337. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  53338. // update is necessary to ensure correctness.
  53339. var needsForceUpdate = !!(
  53340. renderChildren || // has new static slots
  53341. vm.$options._renderChildren || // has old static slots
  53342. hasDynamicScopedSlot
  53343. );
  53344. vm.$options._parentVnode = parentVnode;
  53345. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  53346. if (vm._vnode) { // update child tree's parent
  53347. vm._vnode.parent = parentVnode;
  53348. }
  53349. vm.$options._renderChildren = renderChildren;
  53350. // update $attrs and $listeners hash
  53351. // these are also reactive so they may trigger child update if the child
  53352. // used them during render
  53353. vm.$attrs = parentVnode.data.attrs || emptyObject;
  53354. vm.$listeners = listeners || emptyObject;
  53355. // update props
  53356. if (propsData && vm.$options.props) {
  53357. toggleObserving(false);
  53358. var props = vm._props;
  53359. var propKeys = vm.$options._propKeys || [];
  53360. for (var i = 0; i < propKeys.length; i++) {
  53361. var key = propKeys[i];
  53362. var propOptions = vm.$options.props; // wtf flow?
  53363. props[key] = validateProp(key, propOptions, propsData, vm);
  53364. }
  53365. toggleObserving(true);
  53366. // keep a copy of raw propsData
  53367. vm.$options.propsData = propsData;
  53368. }
  53369. // update listeners
  53370. listeners = listeners || emptyObject;
  53371. var oldListeners = vm.$options._parentListeners;
  53372. vm.$options._parentListeners = listeners;
  53373. updateComponentListeners(vm, listeners, oldListeners);
  53374. // resolve slots + force update if has children
  53375. if (needsForceUpdate) {
  53376. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  53377. vm.$forceUpdate();
  53378. }
  53379. {
  53380. isUpdatingChildComponent = false;
  53381. }
  53382. }
  53383. function isInInactiveTree (vm) {
  53384. while (vm && (vm = vm.$parent)) {
  53385. if (vm._inactive) { return true }
  53386. }
  53387. return false
  53388. }
  53389. function activateChildComponent (vm, direct) {
  53390. if (direct) {
  53391. vm._directInactive = false;
  53392. if (isInInactiveTree(vm)) {
  53393. return
  53394. }
  53395. } else if (vm._directInactive) {
  53396. return
  53397. }
  53398. if (vm._inactive || vm._inactive === null) {
  53399. vm._inactive = false;
  53400. for (var i = 0; i < vm.$children.length; i++) {
  53401. activateChildComponent(vm.$children[i]);
  53402. }
  53403. callHook(vm, 'activated');
  53404. }
  53405. }
  53406. function deactivateChildComponent (vm, direct) {
  53407. if (direct) {
  53408. vm._directInactive = true;
  53409. if (isInInactiveTree(vm)) {
  53410. return
  53411. }
  53412. }
  53413. if (!vm._inactive) {
  53414. vm._inactive = true;
  53415. for (var i = 0; i < vm.$children.length; i++) {
  53416. deactivateChildComponent(vm.$children[i]);
  53417. }
  53418. callHook(vm, 'deactivated');
  53419. }
  53420. }
  53421. function callHook (vm, hook) {
  53422. // #7573 disable dep collection when invoking lifecycle hooks
  53423. pushTarget();
  53424. var handlers = vm.$options[hook];
  53425. var info = hook + " hook";
  53426. if (handlers) {
  53427. for (var i = 0, j = handlers.length; i < j; i++) {
  53428. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  53429. }
  53430. }
  53431. if (vm._hasHookEvent) {
  53432. vm.$emit('hook:' + hook);
  53433. }
  53434. popTarget();
  53435. }
  53436. /* */
  53437. var MAX_UPDATE_COUNT = 100;
  53438. var queue = [];
  53439. var activatedChildren = [];
  53440. var has = {};
  53441. var circular = {};
  53442. var waiting = false;
  53443. var flushing = false;
  53444. var index = 0;
  53445. /**
  53446. * Reset the scheduler's state.
  53447. */
  53448. function resetSchedulerState () {
  53449. index = queue.length = activatedChildren.length = 0;
  53450. has = {};
  53451. {
  53452. circular = {};
  53453. }
  53454. waiting = flushing = false;
  53455. }
  53456. // Async edge case #6566 requires saving the timestamp when event listeners are
  53457. // attached. However, calling performance.now() has a perf overhead especially
  53458. // if the page has thousands of event listeners. Instead, we take a timestamp
  53459. // every time the scheduler flushes and use that for all event listeners
  53460. // attached during that flush.
  53461. var currentFlushTimestamp = 0;
  53462. // Async edge case fix requires storing an event listener's attach timestamp.
  53463. var getNow = Date.now;
  53464. // Determine what event timestamp the browser is using. Annoyingly, the
  53465. // timestamp can either be hi-res (relative to page load) or low-res
  53466. // (relative to UNIX epoch), so in order to compare time we have to use the
  53467. // same timestamp type when saving the flush timestamp.
  53468. // All IE versions use low-res event timestamps, and have problematic clock
  53469. // implementations (#9632)
  53470. if (inBrowser && !isIE) {
  53471. var performance = window.performance;
  53472. if (
  53473. performance &&
  53474. typeof performance.now === 'function' &&
  53475. getNow() > document.createEvent('Event').timeStamp
  53476. ) {
  53477. // if the event timestamp, although evaluated AFTER the Date.now(), is
  53478. // smaller than it, it means the event is using a hi-res timestamp,
  53479. // and we need to use the hi-res version for event listener timestamps as
  53480. // well.
  53481. getNow = function () { return performance.now(); };
  53482. }
  53483. }
  53484. /**
  53485. * Flush both queues and run the watchers.
  53486. */
  53487. function flushSchedulerQueue () {
  53488. currentFlushTimestamp = getNow();
  53489. flushing = true;
  53490. var watcher, id;
  53491. // Sort queue before flush.
  53492. // This ensures that:
  53493. // 1. Components are updated from parent to child. (because parent is always
  53494. // created before the child)
  53495. // 2. A component's user watchers are run before its render watcher (because
  53496. // user watchers are created before the render watcher)
  53497. // 3. If a component is destroyed during a parent component's watcher run,
  53498. // its watchers can be skipped.
  53499. queue.sort(function (a, b) { return a.id - b.id; });
  53500. // do not cache length because more watchers might be pushed
  53501. // as we run existing watchers
  53502. for (index = 0; index < queue.length; index++) {
  53503. watcher = queue[index];
  53504. if (watcher.before) {
  53505. watcher.before();
  53506. }
  53507. id = watcher.id;
  53508. has[id] = null;
  53509. watcher.run();
  53510. // in dev build, check and stop circular updates.
  53511. if (has[id] != null) {
  53512. circular[id] = (circular[id] || 0) + 1;
  53513. if (circular[id] > MAX_UPDATE_COUNT) {
  53514. warn(
  53515. 'You may have an infinite update loop ' + (
  53516. watcher.user
  53517. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  53518. : "in a component render function."
  53519. ),
  53520. watcher.vm
  53521. );
  53522. break
  53523. }
  53524. }
  53525. }
  53526. // keep copies of post queues before resetting state
  53527. var activatedQueue = activatedChildren.slice();
  53528. var updatedQueue = queue.slice();
  53529. resetSchedulerState();
  53530. // call component updated and activated hooks
  53531. callActivatedHooks(activatedQueue);
  53532. callUpdatedHooks(updatedQueue);
  53533. // devtool hook
  53534. /* istanbul ignore if */
  53535. if (devtools && config.devtools) {
  53536. devtools.emit('flush');
  53537. }
  53538. }
  53539. function callUpdatedHooks (queue) {
  53540. var i = queue.length;
  53541. while (i--) {
  53542. var watcher = queue[i];
  53543. var vm = watcher.vm;
  53544. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  53545. callHook(vm, 'updated');
  53546. }
  53547. }
  53548. }
  53549. /**
  53550. * Queue a kept-alive component that was activated during patch.
  53551. * The queue will be processed after the entire tree has been patched.
  53552. */
  53553. function queueActivatedComponent (vm) {
  53554. // setting _inactive to false here so that a render function can
  53555. // rely on checking whether it's in an inactive tree (e.g. router-view)
  53556. vm._inactive = false;
  53557. activatedChildren.push(vm);
  53558. }
  53559. function callActivatedHooks (queue) {
  53560. for (var i = 0; i < queue.length; i++) {
  53561. queue[i]._inactive = true;
  53562. activateChildComponent(queue[i], true /* true */);
  53563. }
  53564. }
  53565. /**
  53566. * Push a watcher into the watcher queue.
  53567. * Jobs with duplicate IDs will be skipped unless it's
  53568. * pushed when the queue is being flushed.
  53569. */
  53570. function queueWatcher (watcher) {
  53571. var id = watcher.id;
  53572. if (has[id] == null) {
  53573. has[id] = true;
  53574. if (!flushing) {
  53575. queue.push(watcher);
  53576. } else {
  53577. // if already flushing, splice the watcher based on its id
  53578. // if already past its id, it will be run next immediately.
  53579. var i = queue.length - 1;
  53580. while (i > index && queue[i].id > watcher.id) {
  53581. i--;
  53582. }
  53583. queue.splice(i + 1, 0, watcher);
  53584. }
  53585. // queue the flush
  53586. if (!waiting) {
  53587. waiting = true;
  53588. if (!config.async) {
  53589. flushSchedulerQueue();
  53590. return
  53591. }
  53592. nextTick(flushSchedulerQueue);
  53593. }
  53594. }
  53595. }
  53596. /* */
  53597. var uid$2 = 0;
  53598. /**
  53599. * A watcher parses an expression, collects dependencies,
  53600. * and fires callback when the expression value changes.
  53601. * This is used for both the $watch() api and directives.
  53602. */
  53603. var Watcher = function Watcher (
  53604. vm,
  53605. expOrFn,
  53606. cb,
  53607. options,
  53608. isRenderWatcher
  53609. ) {
  53610. this.vm = vm;
  53611. if (isRenderWatcher) {
  53612. vm._watcher = this;
  53613. }
  53614. vm._watchers.push(this);
  53615. // options
  53616. if (options) {
  53617. this.deep = !!options.deep;
  53618. this.user = !!options.user;
  53619. this.lazy = !!options.lazy;
  53620. this.sync = !!options.sync;
  53621. this.before = options.before;
  53622. } else {
  53623. this.deep = this.user = this.lazy = this.sync = false;
  53624. }
  53625. this.cb = cb;
  53626. this.id = ++uid$2; // uid for batching
  53627. this.active = true;
  53628. this.dirty = this.lazy; // for lazy watchers
  53629. this.deps = [];
  53630. this.newDeps = [];
  53631. this.depIds = new _Set();
  53632. this.newDepIds = new _Set();
  53633. this.expression = expOrFn.toString();
  53634. // parse expression for getter
  53635. if (typeof expOrFn === 'function') {
  53636. this.getter = expOrFn;
  53637. } else {
  53638. this.getter = parsePath(expOrFn);
  53639. if (!this.getter) {
  53640. this.getter = noop;
  53641. warn(
  53642. "Failed watching path: \"" + expOrFn + "\" " +
  53643. 'Watcher only accepts simple dot-delimited paths. ' +
  53644. 'For full control, use a function instead.',
  53645. vm
  53646. );
  53647. }
  53648. }
  53649. this.value = this.lazy
  53650. ? undefined
  53651. : this.get();
  53652. };
  53653. /**
  53654. * Evaluate the getter, and re-collect dependencies.
  53655. */
  53656. Watcher.prototype.get = function get () {
  53657. pushTarget(this);
  53658. var value;
  53659. var vm = this.vm;
  53660. try {
  53661. value = this.getter.call(vm, vm);
  53662. } catch (e) {
  53663. if (this.user) {
  53664. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  53665. } else {
  53666. throw e
  53667. }
  53668. } finally {
  53669. // "touch" every property so they are all tracked as
  53670. // dependencies for deep watching
  53671. if (this.deep) {
  53672. traverse(value);
  53673. }
  53674. popTarget();
  53675. this.cleanupDeps();
  53676. }
  53677. return value
  53678. };
  53679. /**
  53680. * Add a dependency to this directive.
  53681. */
  53682. Watcher.prototype.addDep = function addDep (dep) {
  53683. var id = dep.id;
  53684. if (!this.newDepIds.has(id)) {
  53685. this.newDepIds.add(id);
  53686. this.newDeps.push(dep);
  53687. if (!this.depIds.has(id)) {
  53688. dep.addSub(this);
  53689. }
  53690. }
  53691. };
  53692. /**
  53693. * Clean up for dependency collection.
  53694. */
  53695. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  53696. var i = this.deps.length;
  53697. while (i--) {
  53698. var dep = this.deps[i];
  53699. if (!this.newDepIds.has(dep.id)) {
  53700. dep.removeSub(this);
  53701. }
  53702. }
  53703. var tmp = this.depIds;
  53704. this.depIds = this.newDepIds;
  53705. this.newDepIds = tmp;
  53706. this.newDepIds.clear();
  53707. tmp = this.deps;
  53708. this.deps = this.newDeps;
  53709. this.newDeps = tmp;
  53710. this.newDeps.length = 0;
  53711. };
  53712. /**
  53713. * Subscriber interface.
  53714. * Will be called when a dependency changes.
  53715. */
  53716. Watcher.prototype.update = function update () {
  53717. /* istanbul ignore else */
  53718. if (this.lazy) {
  53719. this.dirty = true;
  53720. } else if (this.sync) {
  53721. this.run();
  53722. } else {
  53723. queueWatcher(this);
  53724. }
  53725. };
  53726. /**
  53727. * Scheduler job interface.
  53728. * Will be called by the scheduler.
  53729. */
  53730. Watcher.prototype.run = function run () {
  53731. if (this.active) {
  53732. var value = this.get();
  53733. if (
  53734. value !== this.value ||
  53735. // Deep watchers and watchers on Object/Arrays should fire even
  53736. // when the value is the same, because the value may
  53737. // have mutated.
  53738. isObject(value) ||
  53739. this.deep
  53740. ) {
  53741. // set new value
  53742. var oldValue = this.value;
  53743. this.value = value;
  53744. if (this.user) {
  53745. try {
  53746. this.cb.call(this.vm, value, oldValue);
  53747. } catch (e) {
  53748. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  53749. }
  53750. } else {
  53751. this.cb.call(this.vm, value, oldValue);
  53752. }
  53753. }
  53754. }
  53755. };
  53756. /**
  53757. * Evaluate the value of the watcher.
  53758. * This only gets called for lazy watchers.
  53759. */
  53760. Watcher.prototype.evaluate = function evaluate () {
  53761. this.value = this.get();
  53762. this.dirty = false;
  53763. };
  53764. /**
  53765. * Depend on all deps collected by this watcher.
  53766. */
  53767. Watcher.prototype.depend = function depend () {
  53768. var i = this.deps.length;
  53769. while (i--) {
  53770. this.deps[i].depend();
  53771. }
  53772. };
  53773. /**
  53774. * Remove self from all dependencies' subscriber list.
  53775. */
  53776. Watcher.prototype.teardown = function teardown () {
  53777. if (this.active) {
  53778. // remove self from vm's watcher list
  53779. // this is a somewhat expensive operation so we skip it
  53780. // if the vm is being destroyed.
  53781. if (!this.vm._isBeingDestroyed) {
  53782. remove(this.vm._watchers, this);
  53783. }
  53784. var i = this.deps.length;
  53785. while (i--) {
  53786. this.deps[i].removeSub(this);
  53787. }
  53788. this.active = false;
  53789. }
  53790. };
  53791. /* */
  53792. var sharedPropertyDefinition = {
  53793. enumerable: true,
  53794. configurable: true,
  53795. get: noop,
  53796. set: noop
  53797. };
  53798. function proxy (target, sourceKey, key) {
  53799. sharedPropertyDefinition.get = function proxyGetter () {
  53800. return this[sourceKey][key]
  53801. };
  53802. sharedPropertyDefinition.set = function proxySetter (val) {
  53803. this[sourceKey][key] = val;
  53804. };
  53805. Object.defineProperty(target, key, sharedPropertyDefinition);
  53806. }
  53807. function initState (vm) {
  53808. vm._watchers = [];
  53809. var opts = vm.$options;
  53810. if (opts.props) { initProps(vm, opts.props); }
  53811. if (opts.methods) { initMethods(vm, opts.methods); }
  53812. if (opts.data) {
  53813. initData(vm);
  53814. } else {
  53815. observe(vm._data = {}, true /* asRootData */);
  53816. }
  53817. if (opts.computed) { initComputed(vm, opts.computed); }
  53818. if (opts.watch && opts.watch !== nativeWatch) {
  53819. initWatch(vm, opts.watch);
  53820. }
  53821. }
  53822. function initProps (vm, propsOptions) {
  53823. var propsData = vm.$options.propsData || {};
  53824. var props = vm._props = {};
  53825. // cache prop keys so that future props updates can iterate using Array
  53826. // instead of dynamic object key enumeration.
  53827. var keys = vm.$options._propKeys = [];
  53828. var isRoot = !vm.$parent;
  53829. // root instance props should be converted
  53830. if (!isRoot) {
  53831. toggleObserving(false);
  53832. }
  53833. var loop = function ( key ) {
  53834. keys.push(key);
  53835. var value = validateProp(key, propsOptions, propsData, vm);
  53836. /* istanbul ignore else */
  53837. {
  53838. var hyphenatedKey = hyphenate(key);
  53839. if (isReservedAttribute(hyphenatedKey) ||
  53840. config.isReservedAttr(hyphenatedKey)) {
  53841. warn(
  53842. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  53843. vm
  53844. );
  53845. }
  53846. defineReactive$$1(props, key, value, function () {
  53847. if (!isRoot && !isUpdatingChildComponent) {
  53848. warn(
  53849. "Avoid mutating a prop directly since the value will be " +
  53850. "overwritten whenever the parent component re-renders. " +
  53851. "Instead, use a data or computed property based on the prop's " +
  53852. "value. Prop being mutated: \"" + key + "\"",
  53853. vm
  53854. );
  53855. }
  53856. });
  53857. }
  53858. // static props are already proxied on the component's prototype
  53859. // during Vue.extend(). We only need to proxy props defined at
  53860. // instantiation here.
  53861. if (!(key in vm)) {
  53862. proxy(vm, "_props", key);
  53863. }
  53864. };
  53865. for (var key in propsOptions) loop( key );
  53866. toggleObserving(true);
  53867. }
  53868. function initData (vm) {
  53869. var data = vm.$options.data;
  53870. data = vm._data = typeof data === 'function'
  53871. ? getData(data, vm)
  53872. : data || {};
  53873. if (!isPlainObject(data)) {
  53874. data = {};
  53875. warn(
  53876. 'data functions should return an object:\n' +
  53877. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  53878. vm
  53879. );
  53880. }
  53881. // proxy data on instance
  53882. var keys = Object.keys(data);
  53883. var props = vm.$options.props;
  53884. var methods = vm.$options.methods;
  53885. var i = keys.length;
  53886. while (i--) {
  53887. var key = keys[i];
  53888. {
  53889. if (methods && hasOwn(methods, key)) {
  53890. warn(
  53891. ("Method \"" + key + "\" has already been defined as a data property."),
  53892. vm
  53893. );
  53894. }
  53895. }
  53896. if (props && hasOwn(props, key)) {
  53897. warn(
  53898. "The data property \"" + key + "\" is already declared as a prop. " +
  53899. "Use prop default value instead.",
  53900. vm
  53901. );
  53902. } else if (!isReserved(key)) {
  53903. proxy(vm, "_data", key);
  53904. }
  53905. }
  53906. // observe data
  53907. observe(data, true /* asRootData */);
  53908. }
  53909. function getData (data, vm) {
  53910. // #7573 disable dep collection when invoking data getters
  53911. pushTarget();
  53912. try {
  53913. return data.call(vm, vm)
  53914. } catch (e) {
  53915. handleError(e, vm, "data()");
  53916. return {}
  53917. } finally {
  53918. popTarget();
  53919. }
  53920. }
  53921. var computedWatcherOptions = { lazy: true };
  53922. function initComputed (vm, computed) {
  53923. // $flow-disable-line
  53924. var watchers = vm._computedWatchers = Object.create(null);
  53925. // computed properties are just getters during SSR
  53926. var isSSR = isServerRendering();
  53927. for (var key in computed) {
  53928. var userDef = computed[key];
  53929. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  53930. if (getter == null) {
  53931. warn(
  53932. ("Getter is missing for computed property \"" + key + "\"."),
  53933. vm
  53934. );
  53935. }
  53936. if (!isSSR) {
  53937. // create internal watcher for the computed property.
  53938. watchers[key] = new Watcher(
  53939. vm,
  53940. getter || noop,
  53941. noop,
  53942. computedWatcherOptions
  53943. );
  53944. }
  53945. // component-defined computed properties are already defined on the
  53946. // component prototype. We only need to define computed properties defined
  53947. // at instantiation here.
  53948. if (!(key in vm)) {
  53949. defineComputed(vm, key, userDef);
  53950. } else {
  53951. if (key in vm.$data) {
  53952. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  53953. } else if (vm.$options.props && key in vm.$options.props) {
  53954. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  53955. }
  53956. }
  53957. }
  53958. }
  53959. function defineComputed (
  53960. target,
  53961. key,
  53962. userDef
  53963. ) {
  53964. var shouldCache = !isServerRendering();
  53965. if (typeof userDef === 'function') {
  53966. sharedPropertyDefinition.get = shouldCache
  53967. ? createComputedGetter(key)
  53968. : createGetterInvoker(userDef);
  53969. sharedPropertyDefinition.set = noop;
  53970. } else {
  53971. sharedPropertyDefinition.get = userDef.get
  53972. ? shouldCache && userDef.cache !== false
  53973. ? createComputedGetter(key)
  53974. : createGetterInvoker(userDef.get)
  53975. : noop;
  53976. sharedPropertyDefinition.set = userDef.set || noop;
  53977. }
  53978. if (sharedPropertyDefinition.set === noop) {
  53979. sharedPropertyDefinition.set = function () {
  53980. warn(
  53981. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  53982. this
  53983. );
  53984. };
  53985. }
  53986. Object.defineProperty(target, key, sharedPropertyDefinition);
  53987. }
  53988. function createComputedGetter (key) {
  53989. return function computedGetter () {
  53990. var watcher = this._computedWatchers && this._computedWatchers[key];
  53991. if (watcher) {
  53992. if (watcher.dirty) {
  53993. watcher.evaluate();
  53994. }
  53995. if (Dep.target) {
  53996. watcher.depend();
  53997. }
  53998. return watcher.value
  53999. }
  54000. }
  54001. }
  54002. function createGetterInvoker(fn) {
  54003. return function computedGetter () {
  54004. return fn.call(this, this)
  54005. }
  54006. }
  54007. function initMethods (vm, methods) {
  54008. var props = vm.$options.props;
  54009. for (var key in methods) {
  54010. {
  54011. if (typeof methods[key] !== 'function') {
  54012. warn(
  54013. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  54014. "Did you reference the function correctly?",
  54015. vm
  54016. );
  54017. }
  54018. if (props && hasOwn(props, key)) {
  54019. warn(
  54020. ("Method \"" + key + "\" has already been defined as a prop."),
  54021. vm
  54022. );
  54023. }
  54024. if ((key in vm) && isReserved(key)) {
  54025. warn(
  54026. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  54027. "Avoid defining component methods that start with _ or $."
  54028. );
  54029. }
  54030. }
  54031. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  54032. }
  54033. }
  54034. function initWatch (vm, watch) {
  54035. for (var key in watch) {
  54036. var handler = watch[key];
  54037. if (Array.isArray(handler)) {
  54038. for (var i = 0; i < handler.length; i++) {
  54039. createWatcher(vm, key, handler[i]);
  54040. }
  54041. } else {
  54042. createWatcher(vm, key, handler);
  54043. }
  54044. }
  54045. }
  54046. function createWatcher (
  54047. vm,
  54048. expOrFn,
  54049. handler,
  54050. options
  54051. ) {
  54052. if (isPlainObject(handler)) {
  54053. options = handler;
  54054. handler = handler.handler;
  54055. }
  54056. if (typeof handler === 'string') {
  54057. handler = vm[handler];
  54058. }
  54059. return vm.$watch(expOrFn, handler, options)
  54060. }
  54061. function stateMixin (Vue) {
  54062. // flow somehow has problems with directly declared definition object
  54063. // when using Object.defineProperty, so we have to procedurally build up
  54064. // the object here.
  54065. var dataDef = {};
  54066. dataDef.get = function () { return this._data };
  54067. var propsDef = {};
  54068. propsDef.get = function () { return this._props };
  54069. {
  54070. dataDef.set = function () {
  54071. warn(
  54072. 'Avoid replacing instance root $data. ' +
  54073. 'Use nested data properties instead.',
  54074. this
  54075. );
  54076. };
  54077. propsDef.set = function () {
  54078. warn("$props is readonly.", this);
  54079. };
  54080. }
  54081. Object.defineProperty(Vue.prototype, '$data', dataDef);
  54082. Object.defineProperty(Vue.prototype, '$props', propsDef);
  54083. Vue.prototype.$set = set;
  54084. Vue.prototype.$delete = del;
  54085. Vue.prototype.$watch = function (
  54086. expOrFn,
  54087. cb,
  54088. options
  54089. ) {
  54090. var vm = this;
  54091. if (isPlainObject(cb)) {
  54092. return createWatcher(vm, expOrFn, cb, options)
  54093. }
  54094. options = options || {};
  54095. options.user = true;
  54096. var watcher = new Watcher(vm, expOrFn, cb, options);
  54097. if (options.immediate) {
  54098. try {
  54099. cb.call(vm, watcher.value);
  54100. } catch (error) {
  54101. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  54102. }
  54103. }
  54104. return function unwatchFn () {
  54105. watcher.teardown();
  54106. }
  54107. };
  54108. }
  54109. /* */
  54110. var uid$3 = 0;
  54111. function initMixin (Vue) {
  54112. Vue.prototype._init = function (options) {
  54113. var vm = this;
  54114. // a uid
  54115. vm._uid = uid$3++;
  54116. var startTag, endTag;
  54117. /* istanbul ignore if */
  54118. if (config.performance && mark) {
  54119. startTag = "vue-perf-start:" + (vm._uid);
  54120. endTag = "vue-perf-end:" + (vm._uid);
  54121. mark(startTag);
  54122. }
  54123. // a flag to avoid this being observed
  54124. vm._isVue = true;
  54125. // merge options
  54126. if (options && options._isComponent) {
  54127. // optimize internal component instantiation
  54128. // since dynamic options merging is pretty slow, and none of the
  54129. // internal component options needs special treatment.
  54130. initInternalComponent(vm, options);
  54131. } else {
  54132. vm.$options = mergeOptions(
  54133. resolveConstructorOptions(vm.constructor),
  54134. options || {},
  54135. vm
  54136. );
  54137. }
  54138. /* istanbul ignore else */
  54139. {
  54140. initProxy(vm);
  54141. }
  54142. // expose real self
  54143. vm._self = vm;
  54144. initLifecycle(vm);
  54145. initEvents(vm);
  54146. initRender(vm);
  54147. callHook(vm, 'beforeCreate');
  54148. initInjections(vm); // resolve injections before data/props
  54149. initState(vm);
  54150. initProvide(vm); // resolve provide after data/props
  54151. callHook(vm, 'created');
  54152. /* istanbul ignore if */
  54153. if (config.performance && mark) {
  54154. vm._name = formatComponentName(vm, false);
  54155. mark(endTag);
  54156. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  54157. }
  54158. if (vm.$options.el) {
  54159. vm.$mount(vm.$options.el);
  54160. }
  54161. };
  54162. }
  54163. function initInternalComponent (vm, options) {
  54164. var opts = vm.$options = Object.create(vm.constructor.options);
  54165. // doing this because it's faster than dynamic enumeration.
  54166. var parentVnode = options._parentVnode;
  54167. opts.parent = options.parent;
  54168. opts._parentVnode = parentVnode;
  54169. var vnodeComponentOptions = parentVnode.componentOptions;
  54170. opts.propsData = vnodeComponentOptions.propsData;
  54171. opts._parentListeners = vnodeComponentOptions.listeners;
  54172. opts._renderChildren = vnodeComponentOptions.children;
  54173. opts._componentTag = vnodeComponentOptions.tag;
  54174. if (options.render) {
  54175. opts.render = options.render;
  54176. opts.staticRenderFns = options.staticRenderFns;
  54177. }
  54178. }
  54179. function resolveConstructorOptions (Ctor) {
  54180. var options = Ctor.options;
  54181. if (Ctor.super) {
  54182. var superOptions = resolveConstructorOptions(Ctor.super);
  54183. var cachedSuperOptions = Ctor.superOptions;
  54184. if (superOptions !== cachedSuperOptions) {
  54185. // super option changed,
  54186. // need to resolve new options.
  54187. Ctor.superOptions = superOptions;
  54188. // check if there are any late-modified/attached options (#4976)
  54189. var modifiedOptions = resolveModifiedOptions(Ctor);
  54190. // update base extend options
  54191. if (modifiedOptions) {
  54192. extend(Ctor.extendOptions, modifiedOptions);
  54193. }
  54194. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  54195. if (options.name) {
  54196. options.components[options.name] = Ctor;
  54197. }
  54198. }
  54199. }
  54200. return options
  54201. }
  54202. function resolveModifiedOptions (Ctor) {
  54203. var modified;
  54204. var latest = Ctor.options;
  54205. var sealed = Ctor.sealedOptions;
  54206. for (var key in latest) {
  54207. if (latest[key] !== sealed[key]) {
  54208. if (!modified) { modified = {}; }
  54209. modified[key] = latest[key];
  54210. }
  54211. }
  54212. return modified
  54213. }
  54214. function Vue (options) {
  54215. if (!(this instanceof Vue)
  54216. ) {
  54217. warn('Vue is a constructor and should be called with the `new` keyword');
  54218. }
  54219. this._init(options);
  54220. }
  54221. initMixin(Vue);
  54222. stateMixin(Vue);
  54223. eventsMixin(Vue);
  54224. lifecycleMixin(Vue);
  54225. renderMixin(Vue);
  54226. /* */
  54227. function initUse (Vue) {
  54228. Vue.use = function (plugin) {
  54229. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  54230. if (installedPlugins.indexOf(plugin) > -1) {
  54231. return this
  54232. }
  54233. // additional parameters
  54234. var args = toArray(arguments, 1);
  54235. args.unshift(this);
  54236. if (typeof plugin.install === 'function') {
  54237. plugin.install.apply(plugin, args);
  54238. } else if (typeof plugin === 'function') {
  54239. plugin.apply(null, args);
  54240. }
  54241. installedPlugins.push(plugin);
  54242. return this
  54243. };
  54244. }
  54245. /* */
  54246. function initMixin$1 (Vue) {
  54247. Vue.mixin = function (mixin) {
  54248. this.options = mergeOptions(this.options, mixin);
  54249. return this
  54250. };
  54251. }
  54252. /* */
  54253. function initExtend (Vue) {
  54254. /**
  54255. * Each instance constructor, including Vue, has a unique
  54256. * cid. This enables us to create wrapped "child
  54257. * constructors" for prototypal inheritance and cache them.
  54258. */
  54259. Vue.cid = 0;
  54260. var cid = 1;
  54261. /**
  54262. * Class inheritance
  54263. */
  54264. Vue.extend = function (extendOptions) {
  54265. extendOptions = extendOptions || {};
  54266. var Super = this;
  54267. var SuperId = Super.cid;
  54268. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  54269. if (cachedCtors[SuperId]) {
  54270. return cachedCtors[SuperId]
  54271. }
  54272. var name = extendOptions.name || Super.options.name;
  54273. if (name) {
  54274. validateComponentName(name);
  54275. }
  54276. var Sub = function VueComponent (options) {
  54277. this._init(options);
  54278. };
  54279. Sub.prototype = Object.create(Super.prototype);
  54280. Sub.prototype.constructor = Sub;
  54281. Sub.cid = cid++;
  54282. Sub.options = mergeOptions(
  54283. Super.options,
  54284. extendOptions
  54285. );
  54286. Sub['super'] = Super;
  54287. // For props and computed properties, we define the proxy getters on
  54288. // the Vue instances at extension time, on the extended prototype. This
  54289. // avoids Object.defineProperty calls for each instance created.
  54290. if (Sub.options.props) {
  54291. initProps$1(Sub);
  54292. }
  54293. if (Sub.options.computed) {
  54294. initComputed$1(Sub);
  54295. }
  54296. // allow further extension/mixin/plugin usage
  54297. Sub.extend = Super.extend;
  54298. Sub.mixin = Super.mixin;
  54299. Sub.use = Super.use;
  54300. // create asset registers, so extended classes
  54301. // can have their private assets too.
  54302. ASSET_TYPES.forEach(function (type) {
  54303. Sub[type] = Super[type];
  54304. });
  54305. // enable recursive self-lookup
  54306. if (name) {
  54307. Sub.options.components[name] = Sub;
  54308. }
  54309. // keep a reference to the super options at extension time.
  54310. // later at instantiation we can check if Super's options have
  54311. // been updated.
  54312. Sub.superOptions = Super.options;
  54313. Sub.extendOptions = extendOptions;
  54314. Sub.sealedOptions = extend({}, Sub.options);
  54315. // cache constructor
  54316. cachedCtors[SuperId] = Sub;
  54317. return Sub
  54318. };
  54319. }
  54320. function initProps$1 (Comp) {
  54321. var props = Comp.options.props;
  54322. for (var key in props) {
  54323. proxy(Comp.prototype, "_props", key);
  54324. }
  54325. }
  54326. function initComputed$1 (Comp) {
  54327. var computed = Comp.options.computed;
  54328. for (var key in computed) {
  54329. defineComputed(Comp.prototype, key, computed[key]);
  54330. }
  54331. }
  54332. /* */
  54333. function initAssetRegisters (Vue) {
  54334. /**
  54335. * Create asset registration methods.
  54336. */
  54337. ASSET_TYPES.forEach(function (type) {
  54338. Vue[type] = function (
  54339. id,
  54340. definition
  54341. ) {
  54342. if (!definition) {
  54343. return this.options[type + 's'][id]
  54344. } else {
  54345. /* istanbul ignore if */
  54346. if (type === 'component') {
  54347. validateComponentName(id);
  54348. }
  54349. if (type === 'component' && isPlainObject(definition)) {
  54350. definition.name = definition.name || id;
  54351. definition = this.options._base.extend(definition);
  54352. }
  54353. if (type === 'directive' && typeof definition === 'function') {
  54354. definition = { bind: definition, update: definition };
  54355. }
  54356. this.options[type + 's'][id] = definition;
  54357. return definition
  54358. }
  54359. };
  54360. });
  54361. }
  54362. /* */
  54363. function getComponentName (opts) {
  54364. return opts && (opts.Ctor.options.name || opts.tag)
  54365. }
  54366. function matches (pattern, name) {
  54367. if (Array.isArray(pattern)) {
  54368. return pattern.indexOf(name) > -1
  54369. } else if (typeof pattern === 'string') {
  54370. return pattern.split(',').indexOf(name) > -1
  54371. } else if (isRegExp(pattern)) {
  54372. return pattern.test(name)
  54373. }
  54374. /* istanbul ignore next */
  54375. return false
  54376. }
  54377. function pruneCache (keepAliveInstance, filter) {
  54378. var cache = keepAliveInstance.cache;
  54379. var keys = keepAliveInstance.keys;
  54380. var _vnode = keepAliveInstance._vnode;
  54381. for (var key in cache) {
  54382. var cachedNode = cache[key];
  54383. if (cachedNode) {
  54384. var name = getComponentName(cachedNode.componentOptions);
  54385. if (name && !filter(name)) {
  54386. pruneCacheEntry(cache, key, keys, _vnode);
  54387. }
  54388. }
  54389. }
  54390. }
  54391. function pruneCacheEntry (
  54392. cache,
  54393. key,
  54394. keys,
  54395. current
  54396. ) {
  54397. var cached$$1 = cache[key];
  54398. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  54399. cached$$1.componentInstance.$destroy();
  54400. }
  54401. cache[key] = null;
  54402. remove(keys, key);
  54403. }
  54404. var patternTypes = [String, RegExp, Array];
  54405. var KeepAlive = {
  54406. name: 'keep-alive',
  54407. abstract: true,
  54408. props: {
  54409. include: patternTypes,
  54410. exclude: patternTypes,
  54411. max: [String, Number]
  54412. },
  54413. created: function created () {
  54414. this.cache = Object.create(null);
  54415. this.keys = [];
  54416. },
  54417. destroyed: function destroyed () {
  54418. for (var key in this.cache) {
  54419. pruneCacheEntry(this.cache, key, this.keys);
  54420. }
  54421. },
  54422. mounted: function mounted () {
  54423. var this$1 = this;
  54424. this.$watch('include', function (val) {
  54425. pruneCache(this$1, function (name) { return matches(val, name); });
  54426. });
  54427. this.$watch('exclude', function (val) {
  54428. pruneCache(this$1, function (name) { return !matches(val, name); });
  54429. });
  54430. },
  54431. render: function render () {
  54432. var slot = this.$slots.default;
  54433. var vnode = getFirstComponentChild(slot);
  54434. var componentOptions = vnode && vnode.componentOptions;
  54435. if (componentOptions) {
  54436. // check pattern
  54437. var name = getComponentName(componentOptions);
  54438. var ref = this;
  54439. var include = ref.include;
  54440. var exclude = ref.exclude;
  54441. if (
  54442. // not included
  54443. (include && (!name || !matches(include, name))) ||
  54444. // excluded
  54445. (exclude && name && matches(exclude, name))
  54446. ) {
  54447. return vnode
  54448. }
  54449. var ref$1 = this;
  54450. var cache = ref$1.cache;
  54451. var keys = ref$1.keys;
  54452. var key = vnode.key == null
  54453. // same constructor may get registered as different local components
  54454. // so cid alone is not enough (#3269)
  54455. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  54456. : vnode.key;
  54457. if (cache[key]) {
  54458. vnode.componentInstance = cache[key].componentInstance;
  54459. // make current key freshest
  54460. remove(keys, key);
  54461. keys.push(key);
  54462. } else {
  54463. cache[key] = vnode;
  54464. keys.push(key);
  54465. // prune oldest entry
  54466. if (this.max && keys.length > parseInt(this.max)) {
  54467. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  54468. }
  54469. }
  54470. vnode.data.keepAlive = true;
  54471. }
  54472. return vnode || (slot && slot[0])
  54473. }
  54474. };
  54475. var builtInComponents = {
  54476. KeepAlive: KeepAlive
  54477. };
  54478. /* */
  54479. function initGlobalAPI (Vue) {
  54480. // config
  54481. var configDef = {};
  54482. configDef.get = function () { return config; };
  54483. {
  54484. configDef.set = function () {
  54485. warn(
  54486. 'Do not replace the Vue.config object, set individual fields instead.'
  54487. );
  54488. };
  54489. }
  54490. Object.defineProperty(Vue, 'config', configDef);
  54491. // exposed util methods.
  54492. // NOTE: these are not considered part of the public API - avoid relying on
  54493. // them unless you are aware of the risk.
  54494. Vue.util = {
  54495. warn: warn,
  54496. extend: extend,
  54497. mergeOptions: mergeOptions,
  54498. defineReactive: defineReactive$$1
  54499. };
  54500. Vue.set = set;
  54501. Vue.delete = del;
  54502. Vue.nextTick = nextTick;
  54503. // 2.6 explicit observable API
  54504. Vue.observable = function (obj) {
  54505. observe(obj);
  54506. return obj
  54507. };
  54508. Vue.options = Object.create(null);
  54509. ASSET_TYPES.forEach(function (type) {
  54510. Vue.options[type + 's'] = Object.create(null);
  54511. });
  54512. // this is used to identify the "base" constructor to extend all plain-object
  54513. // components with in Weex's multi-instance scenarios.
  54514. Vue.options._base = Vue;
  54515. extend(Vue.options.components, builtInComponents);
  54516. initUse(Vue);
  54517. initMixin$1(Vue);
  54518. initExtend(Vue);
  54519. initAssetRegisters(Vue);
  54520. }
  54521. initGlobalAPI(Vue);
  54522. Object.defineProperty(Vue.prototype, '$isServer', {
  54523. get: isServerRendering
  54524. });
  54525. Object.defineProperty(Vue.prototype, '$ssrContext', {
  54526. get: function get () {
  54527. /* istanbul ignore next */
  54528. return this.$vnode && this.$vnode.ssrContext
  54529. }
  54530. });
  54531. // expose FunctionalRenderContext for ssr runtime helper installation
  54532. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  54533. value: FunctionalRenderContext
  54534. });
  54535. Vue.version = '2.6.11';
  54536. /* */
  54537. // these are reserved for web because they are directly compiled away
  54538. // during template compilation
  54539. var isReservedAttr = makeMap('style,class');
  54540. // attributes that should be using props for binding
  54541. var acceptValue = makeMap('input,textarea,option,select,progress');
  54542. var mustUseProp = function (tag, type, attr) {
  54543. return (
  54544. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  54545. (attr === 'selected' && tag === 'option') ||
  54546. (attr === 'checked' && tag === 'input') ||
  54547. (attr === 'muted' && tag === 'video')
  54548. )
  54549. };
  54550. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  54551. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  54552. var convertEnumeratedValue = function (key, value) {
  54553. return isFalsyAttrValue(value) || value === 'false'
  54554. ? 'false'
  54555. // allow arbitrary string value for contenteditable
  54556. : key === 'contenteditable' && isValidContentEditableValue(value)
  54557. ? value
  54558. : 'true'
  54559. };
  54560. var isBooleanAttr = makeMap(
  54561. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  54562. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  54563. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  54564. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  54565. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  54566. 'truespeed,typemustmatch,visible'
  54567. );
  54568. var xlinkNS = 'http://www.w3.org/1999/xlink';
  54569. var isXlink = function (name) {
  54570. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  54571. };
  54572. var getXlinkProp = function (name) {
  54573. return isXlink(name) ? name.slice(6, name.length) : ''
  54574. };
  54575. var isFalsyAttrValue = function (val) {
  54576. return val == null || val === false
  54577. };
  54578. /* */
  54579. function genClassForVnode (vnode) {
  54580. var data = vnode.data;
  54581. var parentNode = vnode;
  54582. var childNode = vnode;
  54583. while (isDef(childNode.componentInstance)) {
  54584. childNode = childNode.componentInstance._vnode;
  54585. if (childNode && childNode.data) {
  54586. data = mergeClassData(childNode.data, data);
  54587. }
  54588. }
  54589. while (isDef(parentNode = parentNode.parent)) {
  54590. if (parentNode && parentNode.data) {
  54591. data = mergeClassData(data, parentNode.data);
  54592. }
  54593. }
  54594. return renderClass(data.staticClass, data.class)
  54595. }
  54596. function mergeClassData (child, parent) {
  54597. return {
  54598. staticClass: concat(child.staticClass, parent.staticClass),
  54599. class: isDef(child.class)
  54600. ? [child.class, parent.class]
  54601. : parent.class
  54602. }
  54603. }
  54604. function renderClass (
  54605. staticClass,
  54606. dynamicClass
  54607. ) {
  54608. if (isDef(staticClass) || isDef(dynamicClass)) {
  54609. return concat(staticClass, stringifyClass(dynamicClass))
  54610. }
  54611. /* istanbul ignore next */
  54612. return ''
  54613. }
  54614. function concat (a, b) {
  54615. return a ? b ? (a + ' ' + b) : a : (b || '')
  54616. }
  54617. function stringifyClass (value) {
  54618. if (Array.isArray(value)) {
  54619. return stringifyArray(value)
  54620. }
  54621. if (isObject(value)) {
  54622. return stringifyObject(value)
  54623. }
  54624. if (typeof value === 'string') {
  54625. return value
  54626. }
  54627. /* istanbul ignore next */
  54628. return ''
  54629. }
  54630. function stringifyArray (value) {
  54631. var res = '';
  54632. var stringified;
  54633. for (var i = 0, l = value.length; i < l; i++) {
  54634. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  54635. if (res) { res += ' '; }
  54636. res += stringified;
  54637. }
  54638. }
  54639. return res
  54640. }
  54641. function stringifyObject (value) {
  54642. var res = '';
  54643. for (var key in value) {
  54644. if (value[key]) {
  54645. if (res) { res += ' '; }
  54646. res += key;
  54647. }
  54648. }
  54649. return res
  54650. }
  54651. /* */
  54652. var namespaceMap = {
  54653. svg: 'http://www.w3.org/2000/svg',
  54654. math: 'http://www.w3.org/1998/Math/MathML'
  54655. };
  54656. var isHTMLTag = makeMap(
  54657. 'html,body,base,head,link,meta,style,title,' +
  54658. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  54659. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  54660. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  54661. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  54662. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  54663. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  54664. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  54665. 'output,progress,select,textarea,' +
  54666. 'details,dialog,menu,menuitem,summary,' +
  54667. 'content,element,shadow,template,blockquote,iframe,tfoot'
  54668. );
  54669. // this map is intentionally selective, only covering SVG elements that may
  54670. // contain child elements.
  54671. var isSVG = makeMap(
  54672. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  54673. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  54674. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  54675. true
  54676. );
  54677. var isPreTag = function (tag) { return tag === 'pre'; };
  54678. var isReservedTag = function (tag) {
  54679. return isHTMLTag(tag) || isSVG(tag)
  54680. };
  54681. function getTagNamespace (tag) {
  54682. if (isSVG(tag)) {
  54683. return 'svg'
  54684. }
  54685. // basic support for MathML
  54686. // note it doesn't support other MathML elements being component roots
  54687. if (tag === 'math') {
  54688. return 'math'
  54689. }
  54690. }
  54691. var unknownElementCache = Object.create(null);
  54692. function isUnknownElement (tag) {
  54693. /* istanbul ignore if */
  54694. if (!inBrowser) {
  54695. return true
  54696. }
  54697. if (isReservedTag(tag)) {
  54698. return false
  54699. }
  54700. tag = tag.toLowerCase();
  54701. /* istanbul ignore if */
  54702. if (unknownElementCache[tag] != null) {
  54703. return unknownElementCache[tag]
  54704. }
  54705. var el = document.createElement(tag);
  54706. if (tag.indexOf('-') > -1) {
  54707. // http://stackoverflow.com/a/28210364/1070244
  54708. return (unknownElementCache[tag] = (
  54709. el.constructor === window.HTMLUnknownElement ||
  54710. el.constructor === window.HTMLElement
  54711. ))
  54712. } else {
  54713. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  54714. }
  54715. }
  54716. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  54717. /* */
  54718. /**
  54719. * Query an element selector if it's not an element already.
  54720. */
  54721. function query (el) {
  54722. if (typeof el === 'string') {
  54723. var selected = document.querySelector(el);
  54724. if (!selected) {
  54725. warn(
  54726. 'Cannot find element: ' + el
  54727. );
  54728. return document.createElement('div')
  54729. }
  54730. return selected
  54731. } else {
  54732. return el
  54733. }
  54734. }
  54735. /* */
  54736. function createElement$1 (tagName, vnode) {
  54737. var elm = document.createElement(tagName);
  54738. if (tagName !== 'select') {
  54739. return elm
  54740. }
  54741. // false or null will remove the attribute but undefined will not
  54742. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  54743. elm.setAttribute('multiple', 'multiple');
  54744. }
  54745. return elm
  54746. }
  54747. function createElementNS (namespace, tagName) {
  54748. return document.createElementNS(namespaceMap[namespace], tagName)
  54749. }
  54750. function createTextNode (text) {
  54751. return document.createTextNode(text)
  54752. }
  54753. function createComment (text) {
  54754. return document.createComment(text)
  54755. }
  54756. function insertBefore (parentNode, newNode, referenceNode) {
  54757. parentNode.insertBefore(newNode, referenceNode);
  54758. }
  54759. function removeChild (node, child) {
  54760. node.removeChild(child);
  54761. }
  54762. function appendChild (node, child) {
  54763. node.appendChild(child);
  54764. }
  54765. function parentNode (node) {
  54766. return node.parentNode
  54767. }
  54768. function nextSibling (node) {
  54769. return node.nextSibling
  54770. }
  54771. function tagName (node) {
  54772. return node.tagName
  54773. }
  54774. function setTextContent (node, text) {
  54775. node.textContent = text;
  54776. }
  54777. function setStyleScope (node, scopeId) {
  54778. node.setAttribute(scopeId, '');
  54779. }
  54780. var nodeOps = /*#__PURE__*/Object.freeze({
  54781. createElement: createElement$1,
  54782. createElementNS: createElementNS,
  54783. createTextNode: createTextNode,
  54784. createComment: createComment,
  54785. insertBefore: insertBefore,
  54786. removeChild: removeChild,
  54787. appendChild: appendChild,
  54788. parentNode: parentNode,
  54789. nextSibling: nextSibling,
  54790. tagName: tagName,
  54791. setTextContent: setTextContent,
  54792. setStyleScope: setStyleScope
  54793. });
  54794. /* */
  54795. var ref = {
  54796. create: function create (_, vnode) {
  54797. registerRef(vnode);
  54798. },
  54799. update: function update (oldVnode, vnode) {
  54800. if (oldVnode.data.ref !== vnode.data.ref) {
  54801. registerRef(oldVnode, true);
  54802. registerRef(vnode);
  54803. }
  54804. },
  54805. destroy: function destroy (vnode) {
  54806. registerRef(vnode, true);
  54807. }
  54808. };
  54809. function registerRef (vnode, isRemoval) {
  54810. var key = vnode.data.ref;
  54811. if (!isDef(key)) { return }
  54812. var vm = vnode.context;
  54813. var ref = vnode.componentInstance || vnode.elm;
  54814. var refs = vm.$refs;
  54815. if (isRemoval) {
  54816. if (Array.isArray(refs[key])) {
  54817. remove(refs[key], ref);
  54818. } else if (refs[key] === ref) {
  54819. refs[key] = undefined;
  54820. }
  54821. } else {
  54822. if (vnode.data.refInFor) {
  54823. if (!Array.isArray(refs[key])) {
  54824. refs[key] = [ref];
  54825. } else if (refs[key].indexOf(ref) < 0) {
  54826. // $flow-disable-line
  54827. refs[key].push(ref);
  54828. }
  54829. } else {
  54830. refs[key] = ref;
  54831. }
  54832. }
  54833. }
  54834. /**
  54835. * Virtual DOM patching algorithm based on Snabbdom by
  54836. * Simon Friis Vindum (@paldepind)
  54837. * Licensed under the MIT License
  54838. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  54839. *
  54840. * modified by Evan You (@yyx990803)
  54841. *
  54842. * Not type-checking this because this file is perf-critical and the cost
  54843. * of making flow understand it is not worth it.
  54844. */
  54845. var emptyNode = new VNode('', {}, []);
  54846. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  54847. function sameVnode (a, b) {
  54848. return (
  54849. a.key === b.key && (
  54850. (
  54851. a.tag === b.tag &&
  54852. a.isComment === b.isComment &&
  54853. isDef(a.data) === isDef(b.data) &&
  54854. sameInputType(a, b)
  54855. ) || (
  54856. isTrue(a.isAsyncPlaceholder) &&
  54857. a.asyncFactory === b.asyncFactory &&
  54858. isUndef(b.asyncFactory.error)
  54859. )
  54860. )
  54861. )
  54862. }
  54863. function sameInputType (a, b) {
  54864. if (a.tag !== 'input') { return true }
  54865. var i;
  54866. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  54867. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  54868. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  54869. }
  54870. function createKeyToOldIdx (children, beginIdx, endIdx) {
  54871. var i, key;
  54872. var map = {};
  54873. for (i = beginIdx; i <= endIdx; ++i) {
  54874. key = children[i].key;
  54875. if (isDef(key)) { map[key] = i; }
  54876. }
  54877. return map
  54878. }
  54879. function createPatchFunction (backend) {
  54880. var i, j;
  54881. var cbs = {};
  54882. var modules = backend.modules;
  54883. var nodeOps = backend.nodeOps;
  54884. for (i = 0; i < hooks.length; ++i) {
  54885. cbs[hooks[i]] = [];
  54886. for (j = 0; j < modules.length; ++j) {
  54887. if (isDef(modules[j][hooks[i]])) {
  54888. cbs[hooks[i]].push(modules[j][hooks[i]]);
  54889. }
  54890. }
  54891. }
  54892. function emptyNodeAt (elm) {
  54893. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  54894. }
  54895. function createRmCb (childElm, listeners) {
  54896. function remove$$1 () {
  54897. if (--remove$$1.listeners === 0) {
  54898. removeNode(childElm);
  54899. }
  54900. }
  54901. remove$$1.listeners = listeners;
  54902. return remove$$1
  54903. }
  54904. function removeNode (el) {
  54905. var parent = nodeOps.parentNode(el);
  54906. // element may have already been removed due to v-html / v-text
  54907. if (isDef(parent)) {
  54908. nodeOps.removeChild(parent, el);
  54909. }
  54910. }
  54911. function isUnknownElement$$1 (vnode, inVPre) {
  54912. return (
  54913. !inVPre &&
  54914. !vnode.ns &&
  54915. !(
  54916. config.ignoredElements.length &&
  54917. config.ignoredElements.some(function (ignore) {
  54918. return isRegExp(ignore)
  54919. ? ignore.test(vnode.tag)
  54920. : ignore === vnode.tag
  54921. })
  54922. ) &&
  54923. config.isUnknownElement(vnode.tag)
  54924. )
  54925. }
  54926. var creatingElmInVPre = 0;
  54927. function createElm (
  54928. vnode,
  54929. insertedVnodeQueue,
  54930. parentElm,
  54931. refElm,
  54932. nested,
  54933. ownerArray,
  54934. index
  54935. ) {
  54936. if (isDef(vnode.elm) && isDef(ownerArray)) {
  54937. // This vnode was used in a previous render!
  54938. // now it's used as a new node, overwriting its elm would cause
  54939. // potential patch errors down the road when it's used as an insertion
  54940. // reference node. Instead, we clone the node on-demand before creating
  54941. // associated DOM element for it.
  54942. vnode = ownerArray[index] = cloneVNode(vnode);
  54943. }
  54944. vnode.isRootInsert = !nested; // for transition enter check
  54945. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  54946. return
  54947. }
  54948. var data = vnode.data;
  54949. var children = vnode.children;
  54950. var tag = vnode.tag;
  54951. if (isDef(tag)) {
  54952. {
  54953. if (data && data.pre) {
  54954. creatingElmInVPre++;
  54955. }
  54956. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  54957. warn(
  54958. 'Unknown custom element: <' + tag + '> - did you ' +
  54959. 'register the component correctly? For recursive components, ' +
  54960. 'make sure to provide the "name" option.',
  54961. vnode.context
  54962. );
  54963. }
  54964. }
  54965. vnode.elm = vnode.ns
  54966. ? nodeOps.createElementNS(vnode.ns, tag)
  54967. : nodeOps.createElement(tag, vnode);
  54968. setScope(vnode);
  54969. /* istanbul ignore if */
  54970. {
  54971. createChildren(vnode, children, insertedVnodeQueue);
  54972. if (isDef(data)) {
  54973. invokeCreateHooks(vnode, insertedVnodeQueue);
  54974. }
  54975. insert(parentElm, vnode.elm, refElm);
  54976. }
  54977. if (data && data.pre) {
  54978. creatingElmInVPre--;
  54979. }
  54980. } else if (isTrue(vnode.isComment)) {
  54981. vnode.elm = nodeOps.createComment(vnode.text);
  54982. insert(parentElm, vnode.elm, refElm);
  54983. } else {
  54984. vnode.elm = nodeOps.createTextNode(vnode.text);
  54985. insert(parentElm, vnode.elm, refElm);
  54986. }
  54987. }
  54988. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  54989. var i = vnode.data;
  54990. if (isDef(i)) {
  54991. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  54992. if (isDef(i = i.hook) && isDef(i = i.init)) {
  54993. i(vnode, false /* hydrating */);
  54994. }
  54995. // after calling the init hook, if the vnode is a child component
  54996. // it should've created a child instance and mounted it. the child
  54997. // component also has set the placeholder vnode's elm.
  54998. // in that case we can just return the element and be done.
  54999. if (isDef(vnode.componentInstance)) {
  55000. initComponent(vnode, insertedVnodeQueue);
  55001. insert(parentElm, vnode.elm, refElm);
  55002. if (isTrue(isReactivated)) {
  55003. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  55004. }
  55005. return true
  55006. }
  55007. }
  55008. }
  55009. function initComponent (vnode, insertedVnodeQueue) {
  55010. if (isDef(vnode.data.pendingInsert)) {
  55011. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  55012. vnode.data.pendingInsert = null;
  55013. }
  55014. vnode.elm = vnode.componentInstance.$el;
  55015. if (isPatchable(vnode)) {
  55016. invokeCreateHooks(vnode, insertedVnodeQueue);
  55017. setScope(vnode);
  55018. } else {
  55019. // empty component root.
  55020. // skip all element-related modules except for ref (#3455)
  55021. registerRef(vnode);
  55022. // make sure to invoke the insert hook
  55023. insertedVnodeQueue.push(vnode);
  55024. }
  55025. }
  55026. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  55027. var i;
  55028. // hack for #4339: a reactivated component with inner transition
  55029. // does not trigger because the inner node's created hooks are not called
  55030. // again. It's not ideal to involve module-specific logic in here but
  55031. // there doesn't seem to be a better way to do it.
  55032. var innerNode = vnode;
  55033. while (innerNode.componentInstance) {
  55034. innerNode = innerNode.componentInstance._vnode;
  55035. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  55036. for (i = 0; i < cbs.activate.length; ++i) {
  55037. cbs.activate[i](emptyNode, innerNode);
  55038. }
  55039. insertedVnodeQueue.push(innerNode);
  55040. break
  55041. }
  55042. }
  55043. // unlike a newly created component,
  55044. // a reactivated keep-alive component doesn't insert itself
  55045. insert(parentElm, vnode.elm, refElm);
  55046. }
  55047. function insert (parent, elm, ref$$1) {
  55048. if (isDef(parent)) {
  55049. if (isDef(ref$$1)) {
  55050. if (nodeOps.parentNode(ref$$1) === parent) {
  55051. nodeOps.insertBefore(parent, elm, ref$$1);
  55052. }
  55053. } else {
  55054. nodeOps.appendChild(parent, elm);
  55055. }
  55056. }
  55057. }
  55058. function createChildren (vnode, children, insertedVnodeQueue) {
  55059. if (Array.isArray(children)) {
  55060. {
  55061. checkDuplicateKeys(children);
  55062. }
  55063. for (var i = 0; i < children.length; ++i) {
  55064. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  55065. }
  55066. } else if (isPrimitive(vnode.text)) {
  55067. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  55068. }
  55069. }
  55070. function isPatchable (vnode) {
  55071. while (vnode.componentInstance) {
  55072. vnode = vnode.componentInstance._vnode;
  55073. }
  55074. return isDef(vnode.tag)
  55075. }
  55076. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  55077. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  55078. cbs.create[i$1](emptyNode, vnode);
  55079. }
  55080. i = vnode.data.hook; // Reuse variable
  55081. if (isDef(i)) {
  55082. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  55083. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  55084. }
  55085. }
  55086. // set scope id attribute for scoped CSS.
  55087. // this is implemented as a special case to avoid the overhead
  55088. // of going through the normal attribute patching process.
  55089. function setScope (vnode) {
  55090. var i;
  55091. if (isDef(i = vnode.fnScopeId)) {
  55092. nodeOps.setStyleScope(vnode.elm, i);
  55093. } else {
  55094. var ancestor = vnode;
  55095. while (ancestor) {
  55096. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  55097. nodeOps.setStyleScope(vnode.elm, i);
  55098. }
  55099. ancestor = ancestor.parent;
  55100. }
  55101. }
  55102. // for slot content they should also get the scopeId from the host instance.
  55103. if (isDef(i = activeInstance) &&
  55104. i !== vnode.context &&
  55105. i !== vnode.fnContext &&
  55106. isDef(i = i.$options._scopeId)
  55107. ) {
  55108. nodeOps.setStyleScope(vnode.elm, i);
  55109. }
  55110. }
  55111. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  55112. for (; startIdx <= endIdx; ++startIdx) {
  55113. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  55114. }
  55115. }
  55116. function invokeDestroyHook (vnode) {
  55117. var i, j;
  55118. var data = vnode.data;
  55119. if (isDef(data)) {
  55120. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  55121. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  55122. }
  55123. if (isDef(i = vnode.children)) {
  55124. for (j = 0; j < vnode.children.length; ++j) {
  55125. invokeDestroyHook(vnode.children[j]);
  55126. }
  55127. }
  55128. }
  55129. function removeVnodes (vnodes, startIdx, endIdx) {
  55130. for (; startIdx <= endIdx; ++startIdx) {
  55131. var ch = vnodes[startIdx];
  55132. if (isDef(ch)) {
  55133. if (isDef(ch.tag)) {
  55134. removeAndInvokeRemoveHook(ch);
  55135. invokeDestroyHook(ch);
  55136. } else { // Text node
  55137. removeNode(ch.elm);
  55138. }
  55139. }
  55140. }
  55141. }
  55142. function removeAndInvokeRemoveHook (vnode, rm) {
  55143. if (isDef(rm) || isDef(vnode.data)) {
  55144. var i;
  55145. var listeners = cbs.remove.length + 1;
  55146. if (isDef(rm)) {
  55147. // we have a recursively passed down rm callback
  55148. // increase the listeners count
  55149. rm.listeners += listeners;
  55150. } else {
  55151. // directly removing
  55152. rm = createRmCb(vnode.elm, listeners);
  55153. }
  55154. // recursively invoke hooks on child component root node
  55155. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  55156. removeAndInvokeRemoveHook(i, rm);
  55157. }
  55158. for (i = 0; i < cbs.remove.length; ++i) {
  55159. cbs.remove[i](vnode, rm);
  55160. }
  55161. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  55162. i(vnode, rm);
  55163. } else {
  55164. rm();
  55165. }
  55166. } else {
  55167. removeNode(vnode.elm);
  55168. }
  55169. }
  55170. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  55171. var oldStartIdx = 0;
  55172. var newStartIdx = 0;
  55173. var oldEndIdx = oldCh.length - 1;
  55174. var oldStartVnode = oldCh[0];
  55175. var oldEndVnode = oldCh[oldEndIdx];
  55176. var newEndIdx = newCh.length - 1;
  55177. var newStartVnode = newCh[0];
  55178. var newEndVnode = newCh[newEndIdx];
  55179. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  55180. // removeOnly is a special flag used only by <transition-group>
  55181. // to ensure removed elements stay in correct relative positions
  55182. // during leaving transitions
  55183. var canMove = !removeOnly;
  55184. {
  55185. checkDuplicateKeys(newCh);
  55186. }
  55187. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  55188. if (isUndef(oldStartVnode)) {
  55189. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  55190. } else if (isUndef(oldEndVnode)) {
  55191. oldEndVnode = oldCh[--oldEndIdx];
  55192. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  55193. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  55194. oldStartVnode = oldCh[++oldStartIdx];
  55195. newStartVnode = newCh[++newStartIdx];
  55196. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  55197. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  55198. oldEndVnode = oldCh[--oldEndIdx];
  55199. newEndVnode = newCh[--newEndIdx];
  55200. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  55201. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  55202. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  55203. oldStartVnode = oldCh[++oldStartIdx];
  55204. newEndVnode = newCh[--newEndIdx];
  55205. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  55206. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  55207. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  55208. oldEndVnode = oldCh[--oldEndIdx];
  55209. newStartVnode = newCh[++newStartIdx];
  55210. } else {
  55211. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  55212. idxInOld = isDef(newStartVnode.key)
  55213. ? oldKeyToIdx[newStartVnode.key]
  55214. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  55215. if (isUndef(idxInOld)) { // New element
  55216. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  55217. } else {
  55218. vnodeToMove = oldCh[idxInOld];
  55219. if (sameVnode(vnodeToMove, newStartVnode)) {
  55220. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  55221. oldCh[idxInOld] = undefined;
  55222. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  55223. } else {
  55224. // same key but different element. treat as new element
  55225. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  55226. }
  55227. }
  55228. newStartVnode = newCh[++newStartIdx];
  55229. }
  55230. }
  55231. if (oldStartIdx > oldEndIdx) {
  55232. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  55233. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  55234. } else if (newStartIdx > newEndIdx) {
  55235. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  55236. }
  55237. }
  55238. function checkDuplicateKeys (children) {
  55239. var seenKeys = {};
  55240. for (var i = 0; i < children.length; i++) {
  55241. var vnode = children[i];
  55242. var key = vnode.key;
  55243. if (isDef(key)) {
  55244. if (seenKeys[key]) {
  55245. warn(
  55246. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  55247. vnode.context
  55248. );
  55249. } else {
  55250. seenKeys[key] = true;
  55251. }
  55252. }
  55253. }
  55254. }
  55255. function findIdxInOld (node, oldCh, start, end) {
  55256. for (var i = start; i < end; i++) {
  55257. var c = oldCh[i];
  55258. if (isDef(c) && sameVnode(node, c)) { return i }
  55259. }
  55260. }
  55261. function patchVnode (
  55262. oldVnode,
  55263. vnode,
  55264. insertedVnodeQueue,
  55265. ownerArray,
  55266. index,
  55267. removeOnly
  55268. ) {
  55269. if (oldVnode === vnode) {
  55270. return
  55271. }
  55272. if (isDef(vnode.elm) && isDef(ownerArray)) {
  55273. // clone reused vnode
  55274. vnode = ownerArray[index] = cloneVNode(vnode);
  55275. }
  55276. var elm = vnode.elm = oldVnode.elm;
  55277. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  55278. if (isDef(vnode.asyncFactory.resolved)) {
  55279. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  55280. } else {
  55281. vnode.isAsyncPlaceholder = true;
  55282. }
  55283. return
  55284. }
  55285. // reuse element for static trees.
  55286. // note we only do this if the vnode is cloned -
  55287. // if the new node is not cloned it means the render functions have been
  55288. // reset by the hot-reload-api and we need to do a proper re-render.
  55289. if (isTrue(vnode.isStatic) &&
  55290. isTrue(oldVnode.isStatic) &&
  55291. vnode.key === oldVnode.key &&
  55292. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  55293. ) {
  55294. vnode.componentInstance = oldVnode.componentInstance;
  55295. return
  55296. }
  55297. var i;
  55298. var data = vnode.data;
  55299. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  55300. i(oldVnode, vnode);
  55301. }
  55302. var oldCh = oldVnode.children;
  55303. var ch = vnode.children;
  55304. if (isDef(data) && isPatchable(vnode)) {
  55305. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  55306. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  55307. }
  55308. if (isUndef(vnode.text)) {
  55309. if (isDef(oldCh) && isDef(ch)) {
  55310. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  55311. } else if (isDef(ch)) {
  55312. {
  55313. checkDuplicateKeys(ch);
  55314. }
  55315. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  55316. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  55317. } else if (isDef(oldCh)) {
  55318. removeVnodes(oldCh, 0, oldCh.length - 1);
  55319. } else if (isDef(oldVnode.text)) {
  55320. nodeOps.setTextContent(elm, '');
  55321. }
  55322. } else if (oldVnode.text !== vnode.text) {
  55323. nodeOps.setTextContent(elm, vnode.text);
  55324. }
  55325. if (isDef(data)) {
  55326. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  55327. }
  55328. }
  55329. function invokeInsertHook (vnode, queue, initial) {
  55330. // delay insert hooks for component root nodes, invoke them after the
  55331. // element is really inserted
  55332. if (isTrue(initial) && isDef(vnode.parent)) {
  55333. vnode.parent.data.pendingInsert = queue;
  55334. } else {
  55335. for (var i = 0; i < queue.length; ++i) {
  55336. queue[i].data.hook.insert(queue[i]);
  55337. }
  55338. }
  55339. }
  55340. var hydrationBailed = false;
  55341. // list of modules that can skip create hook during hydration because they
  55342. // are already rendered on the client or has no need for initialization
  55343. // Note: style is excluded because it relies on initial clone for future
  55344. // deep updates (#7063).
  55345. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  55346. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  55347. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  55348. var i;
  55349. var tag = vnode.tag;
  55350. var data = vnode.data;
  55351. var children = vnode.children;
  55352. inVPre = inVPre || (data && data.pre);
  55353. vnode.elm = elm;
  55354. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  55355. vnode.isAsyncPlaceholder = true;
  55356. return true
  55357. }
  55358. // assert node match
  55359. {
  55360. if (!assertNodeMatch(elm, vnode, inVPre)) {
  55361. return false
  55362. }
  55363. }
  55364. if (isDef(data)) {
  55365. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  55366. if (isDef(i = vnode.componentInstance)) {
  55367. // child component. it should have hydrated its own tree.
  55368. initComponent(vnode, insertedVnodeQueue);
  55369. return true
  55370. }
  55371. }
  55372. if (isDef(tag)) {
  55373. if (isDef(children)) {
  55374. // empty element, allow client to pick up and populate children
  55375. if (!elm.hasChildNodes()) {
  55376. createChildren(vnode, children, insertedVnodeQueue);
  55377. } else {
  55378. // v-html and domProps: innerHTML
  55379. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  55380. if (i !== elm.innerHTML) {
  55381. /* istanbul ignore if */
  55382. if (typeof console !== 'undefined' &&
  55383. !hydrationBailed
  55384. ) {
  55385. hydrationBailed = true;
  55386. console.warn('Parent: ', elm);
  55387. console.warn('server innerHTML: ', i);
  55388. console.warn('client innerHTML: ', elm.innerHTML);
  55389. }
  55390. return false
  55391. }
  55392. } else {
  55393. // iterate and compare children lists
  55394. var childrenMatch = true;
  55395. var childNode = elm.firstChild;
  55396. for (var i$1 = 0; i$1 < children.length; i$1++) {
  55397. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  55398. childrenMatch = false;
  55399. break
  55400. }
  55401. childNode = childNode.nextSibling;
  55402. }
  55403. // if childNode is not null, it means the actual childNodes list is
  55404. // longer than the virtual children list.
  55405. if (!childrenMatch || childNode) {
  55406. /* istanbul ignore if */
  55407. if (typeof console !== 'undefined' &&
  55408. !hydrationBailed
  55409. ) {
  55410. hydrationBailed = true;
  55411. console.warn('Parent: ', elm);
  55412. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  55413. }
  55414. return false
  55415. }
  55416. }
  55417. }
  55418. }
  55419. if (isDef(data)) {
  55420. var fullInvoke = false;
  55421. for (var key in data) {
  55422. if (!isRenderedModule(key)) {
  55423. fullInvoke = true;
  55424. invokeCreateHooks(vnode, insertedVnodeQueue);
  55425. break
  55426. }
  55427. }
  55428. if (!fullInvoke && data['class']) {
  55429. // ensure collecting deps for deep class bindings for future updates
  55430. traverse(data['class']);
  55431. }
  55432. }
  55433. } else if (elm.data !== vnode.text) {
  55434. elm.data = vnode.text;
  55435. }
  55436. return true
  55437. }
  55438. function assertNodeMatch (node, vnode, inVPre) {
  55439. if (isDef(vnode.tag)) {
  55440. return vnode.tag.indexOf('vue-component') === 0 || (
  55441. !isUnknownElement$$1(vnode, inVPre) &&
  55442. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  55443. )
  55444. } else {
  55445. return node.nodeType === (vnode.isComment ? 8 : 3)
  55446. }
  55447. }
  55448. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  55449. if (isUndef(vnode)) {
  55450. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  55451. return
  55452. }
  55453. var isInitialPatch = false;
  55454. var insertedVnodeQueue = [];
  55455. if (isUndef(oldVnode)) {
  55456. // empty mount (likely as component), create new root element
  55457. isInitialPatch = true;
  55458. createElm(vnode, insertedVnodeQueue);
  55459. } else {
  55460. var isRealElement = isDef(oldVnode.nodeType);
  55461. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  55462. // patch existing root node
  55463. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  55464. } else {
  55465. if (isRealElement) {
  55466. // mounting to a real element
  55467. // check if this is server-rendered content and if we can perform
  55468. // a successful hydration.
  55469. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  55470. oldVnode.removeAttribute(SSR_ATTR);
  55471. hydrating = true;
  55472. }
  55473. if (isTrue(hydrating)) {
  55474. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  55475. invokeInsertHook(vnode, insertedVnodeQueue, true);
  55476. return oldVnode
  55477. } else {
  55478. warn(
  55479. 'The client-side rendered virtual DOM tree is not matching ' +
  55480. 'server-rendered content. This is likely caused by incorrect ' +
  55481. 'HTML markup, for example nesting block-level elements inside ' +
  55482. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  55483. 'full client-side render.'
  55484. );
  55485. }
  55486. }
  55487. // either not server-rendered, or hydration failed.
  55488. // create an empty node and replace it
  55489. oldVnode = emptyNodeAt(oldVnode);
  55490. }
  55491. // replacing existing element
  55492. var oldElm = oldVnode.elm;
  55493. var parentElm = nodeOps.parentNode(oldElm);
  55494. // create new node
  55495. createElm(
  55496. vnode,
  55497. insertedVnodeQueue,
  55498. // extremely rare edge case: do not insert if old element is in a
  55499. // leaving transition. Only happens when combining transition +
  55500. // keep-alive + HOCs. (#4590)
  55501. oldElm._leaveCb ? null : parentElm,
  55502. nodeOps.nextSibling(oldElm)
  55503. );
  55504. // update parent placeholder node element, recursively
  55505. if (isDef(vnode.parent)) {
  55506. var ancestor = vnode.parent;
  55507. var patchable = isPatchable(vnode);
  55508. while (ancestor) {
  55509. for (var i = 0; i < cbs.destroy.length; ++i) {
  55510. cbs.destroy[i](ancestor);
  55511. }
  55512. ancestor.elm = vnode.elm;
  55513. if (patchable) {
  55514. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  55515. cbs.create[i$1](emptyNode, ancestor);
  55516. }
  55517. // #6513
  55518. // invoke insert hooks that may have been merged by create hooks.
  55519. // e.g. for directives that uses the "inserted" hook.
  55520. var insert = ancestor.data.hook.insert;
  55521. if (insert.merged) {
  55522. // start at index 1 to avoid re-invoking component mounted hook
  55523. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  55524. insert.fns[i$2]();
  55525. }
  55526. }
  55527. } else {
  55528. registerRef(ancestor);
  55529. }
  55530. ancestor = ancestor.parent;
  55531. }
  55532. }
  55533. // destroy old node
  55534. if (isDef(parentElm)) {
  55535. removeVnodes([oldVnode], 0, 0);
  55536. } else if (isDef(oldVnode.tag)) {
  55537. invokeDestroyHook(oldVnode);
  55538. }
  55539. }
  55540. }
  55541. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  55542. return vnode.elm
  55543. }
  55544. }
  55545. /* */
  55546. var directives = {
  55547. create: updateDirectives,
  55548. update: updateDirectives,
  55549. destroy: function unbindDirectives (vnode) {
  55550. updateDirectives(vnode, emptyNode);
  55551. }
  55552. };
  55553. function updateDirectives (oldVnode, vnode) {
  55554. if (oldVnode.data.directives || vnode.data.directives) {
  55555. _update(oldVnode, vnode);
  55556. }
  55557. }
  55558. function _update (oldVnode, vnode) {
  55559. var isCreate = oldVnode === emptyNode;
  55560. var isDestroy = vnode === emptyNode;
  55561. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  55562. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  55563. var dirsWithInsert = [];
  55564. var dirsWithPostpatch = [];
  55565. var key, oldDir, dir;
  55566. for (key in newDirs) {
  55567. oldDir = oldDirs[key];
  55568. dir = newDirs[key];
  55569. if (!oldDir) {
  55570. // new directive, bind
  55571. callHook$1(dir, 'bind', vnode, oldVnode);
  55572. if (dir.def && dir.def.inserted) {
  55573. dirsWithInsert.push(dir);
  55574. }
  55575. } else {
  55576. // existing directive, update
  55577. dir.oldValue = oldDir.value;
  55578. dir.oldArg = oldDir.arg;
  55579. callHook$1(dir, 'update', vnode, oldVnode);
  55580. if (dir.def && dir.def.componentUpdated) {
  55581. dirsWithPostpatch.push(dir);
  55582. }
  55583. }
  55584. }
  55585. if (dirsWithInsert.length) {
  55586. var callInsert = function () {
  55587. for (var i = 0; i < dirsWithInsert.length; i++) {
  55588. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  55589. }
  55590. };
  55591. if (isCreate) {
  55592. mergeVNodeHook(vnode, 'insert', callInsert);
  55593. } else {
  55594. callInsert();
  55595. }
  55596. }
  55597. if (dirsWithPostpatch.length) {
  55598. mergeVNodeHook(vnode, 'postpatch', function () {
  55599. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  55600. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  55601. }
  55602. });
  55603. }
  55604. if (!isCreate) {
  55605. for (key in oldDirs) {
  55606. if (!newDirs[key]) {
  55607. // no longer present, unbind
  55608. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  55609. }
  55610. }
  55611. }
  55612. }
  55613. var emptyModifiers = Object.create(null);
  55614. function normalizeDirectives$1 (
  55615. dirs,
  55616. vm
  55617. ) {
  55618. var res = Object.create(null);
  55619. if (!dirs) {
  55620. // $flow-disable-line
  55621. return res
  55622. }
  55623. var i, dir;
  55624. for (i = 0; i < dirs.length; i++) {
  55625. dir = dirs[i];
  55626. if (!dir.modifiers) {
  55627. // $flow-disable-line
  55628. dir.modifiers = emptyModifiers;
  55629. }
  55630. res[getRawDirName(dir)] = dir;
  55631. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  55632. }
  55633. // $flow-disable-line
  55634. return res
  55635. }
  55636. function getRawDirName (dir) {
  55637. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  55638. }
  55639. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  55640. var fn = dir.def && dir.def[hook];
  55641. if (fn) {
  55642. try {
  55643. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  55644. } catch (e) {
  55645. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  55646. }
  55647. }
  55648. }
  55649. var baseModules = [
  55650. ref,
  55651. directives
  55652. ];
  55653. /* */
  55654. function updateAttrs (oldVnode, vnode) {
  55655. var opts = vnode.componentOptions;
  55656. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  55657. return
  55658. }
  55659. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  55660. return
  55661. }
  55662. var key, cur, old;
  55663. var elm = vnode.elm;
  55664. var oldAttrs = oldVnode.data.attrs || {};
  55665. var attrs = vnode.data.attrs || {};
  55666. // clone observed objects, as the user probably wants to mutate it
  55667. if (isDef(attrs.__ob__)) {
  55668. attrs = vnode.data.attrs = extend({}, attrs);
  55669. }
  55670. for (key in attrs) {
  55671. cur = attrs[key];
  55672. old = oldAttrs[key];
  55673. if (old !== cur) {
  55674. setAttr(elm, key, cur);
  55675. }
  55676. }
  55677. // #4391: in IE9, setting type can reset value for input[type=radio]
  55678. // #6666: IE/Edge forces progress value down to 1 before setting a max
  55679. /* istanbul ignore if */
  55680. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  55681. setAttr(elm, 'value', attrs.value);
  55682. }
  55683. for (key in oldAttrs) {
  55684. if (isUndef(attrs[key])) {
  55685. if (isXlink(key)) {
  55686. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  55687. } else if (!isEnumeratedAttr(key)) {
  55688. elm.removeAttribute(key);
  55689. }
  55690. }
  55691. }
  55692. }
  55693. function setAttr (el, key, value) {
  55694. if (el.tagName.indexOf('-') > -1) {
  55695. baseSetAttr(el, key, value);
  55696. } else if (isBooleanAttr(key)) {
  55697. // set attribute for blank value
  55698. // e.g. <option disabled>Select one</option>
  55699. if (isFalsyAttrValue(value)) {
  55700. el.removeAttribute(key);
  55701. } else {
  55702. // technically allowfullscreen is a boolean attribute for <iframe>,
  55703. // but Flash expects a value of "true" when used on <embed> tag
  55704. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  55705. ? 'true'
  55706. : key;
  55707. el.setAttribute(key, value);
  55708. }
  55709. } else if (isEnumeratedAttr(key)) {
  55710. el.setAttribute(key, convertEnumeratedValue(key, value));
  55711. } else if (isXlink(key)) {
  55712. if (isFalsyAttrValue(value)) {
  55713. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  55714. } else {
  55715. el.setAttributeNS(xlinkNS, key, value);
  55716. }
  55717. } else {
  55718. baseSetAttr(el, key, value);
  55719. }
  55720. }
  55721. function baseSetAttr (el, key, value) {
  55722. if (isFalsyAttrValue(value)) {
  55723. el.removeAttribute(key);
  55724. } else {
  55725. // #7138: IE10 & 11 fires input event when setting placeholder on
  55726. // <textarea>... block the first input event and remove the blocker
  55727. // immediately.
  55728. /* istanbul ignore if */
  55729. if (
  55730. isIE && !isIE9 &&
  55731. el.tagName === 'TEXTAREA' &&
  55732. key === 'placeholder' && value !== '' && !el.__ieph
  55733. ) {
  55734. var blocker = function (e) {
  55735. e.stopImmediatePropagation();
  55736. el.removeEventListener('input', blocker);
  55737. };
  55738. el.addEventListener('input', blocker);
  55739. // $flow-disable-line
  55740. el.__ieph = true; /* IE placeholder patched */
  55741. }
  55742. el.setAttribute(key, value);
  55743. }
  55744. }
  55745. var attrs = {
  55746. create: updateAttrs,
  55747. update: updateAttrs
  55748. };
  55749. /* */
  55750. function updateClass (oldVnode, vnode) {
  55751. var el = vnode.elm;
  55752. var data = vnode.data;
  55753. var oldData = oldVnode.data;
  55754. if (
  55755. isUndef(data.staticClass) &&
  55756. isUndef(data.class) && (
  55757. isUndef(oldData) || (
  55758. isUndef(oldData.staticClass) &&
  55759. isUndef(oldData.class)
  55760. )
  55761. )
  55762. ) {
  55763. return
  55764. }
  55765. var cls = genClassForVnode(vnode);
  55766. // handle transition classes
  55767. var transitionClass = el._transitionClasses;
  55768. if (isDef(transitionClass)) {
  55769. cls = concat(cls, stringifyClass(transitionClass));
  55770. }
  55771. // set the class
  55772. if (cls !== el._prevClass) {
  55773. el.setAttribute('class', cls);
  55774. el._prevClass = cls;
  55775. }
  55776. }
  55777. var klass = {
  55778. create: updateClass,
  55779. update: updateClass
  55780. };
  55781. /* */
  55782. var validDivisionCharRE = /[\w).+\-_$\]]/;
  55783. function parseFilters (exp) {
  55784. var inSingle = false;
  55785. var inDouble = false;
  55786. var inTemplateString = false;
  55787. var inRegex = false;
  55788. var curly = 0;
  55789. var square = 0;
  55790. var paren = 0;
  55791. var lastFilterIndex = 0;
  55792. var c, prev, i, expression, filters;
  55793. for (i = 0; i < exp.length; i++) {
  55794. prev = c;
  55795. c = exp.charCodeAt(i);
  55796. if (inSingle) {
  55797. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  55798. } else if (inDouble) {
  55799. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  55800. } else if (inTemplateString) {
  55801. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  55802. } else if (inRegex) {
  55803. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  55804. } else if (
  55805. c === 0x7C && // pipe
  55806. exp.charCodeAt(i + 1) !== 0x7C &&
  55807. exp.charCodeAt(i - 1) !== 0x7C &&
  55808. !curly && !square && !paren
  55809. ) {
  55810. if (expression === undefined) {
  55811. // first filter, end of expression
  55812. lastFilterIndex = i + 1;
  55813. expression = exp.slice(0, i).trim();
  55814. } else {
  55815. pushFilter();
  55816. }
  55817. } else {
  55818. switch (c) {
  55819. case 0x22: inDouble = true; break // "
  55820. case 0x27: inSingle = true; break // '
  55821. case 0x60: inTemplateString = true; break // `
  55822. case 0x28: paren++; break // (
  55823. case 0x29: paren--; break // )
  55824. case 0x5B: square++; break // [
  55825. case 0x5D: square--; break // ]
  55826. case 0x7B: curly++; break // {
  55827. case 0x7D: curly--; break // }
  55828. }
  55829. if (c === 0x2f) { // /
  55830. var j = i - 1;
  55831. var p = (void 0);
  55832. // find first non-whitespace prev char
  55833. for (; j >= 0; j--) {
  55834. p = exp.charAt(j);
  55835. if (p !== ' ') { break }
  55836. }
  55837. if (!p || !validDivisionCharRE.test(p)) {
  55838. inRegex = true;
  55839. }
  55840. }
  55841. }
  55842. }
  55843. if (expression === undefined) {
  55844. expression = exp.slice(0, i).trim();
  55845. } else if (lastFilterIndex !== 0) {
  55846. pushFilter();
  55847. }
  55848. function pushFilter () {
  55849. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  55850. lastFilterIndex = i + 1;
  55851. }
  55852. if (filters) {
  55853. for (i = 0; i < filters.length; i++) {
  55854. expression = wrapFilter(expression, filters[i]);
  55855. }
  55856. }
  55857. return expression
  55858. }
  55859. function wrapFilter (exp, filter) {
  55860. var i = filter.indexOf('(');
  55861. if (i < 0) {
  55862. // _f: resolveFilter
  55863. return ("_f(\"" + filter + "\")(" + exp + ")")
  55864. } else {
  55865. var name = filter.slice(0, i);
  55866. var args = filter.slice(i + 1);
  55867. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  55868. }
  55869. }
  55870. /* */
  55871. /* eslint-disable no-unused-vars */
  55872. function baseWarn (msg, range) {
  55873. console.error(("[Vue compiler]: " + msg));
  55874. }
  55875. /* eslint-enable no-unused-vars */
  55876. function pluckModuleFunction (
  55877. modules,
  55878. key
  55879. ) {
  55880. return modules
  55881. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  55882. : []
  55883. }
  55884. function addProp (el, name, value, range, dynamic) {
  55885. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  55886. el.plain = false;
  55887. }
  55888. function addAttr (el, name, value, range, dynamic) {
  55889. var attrs = dynamic
  55890. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  55891. : (el.attrs || (el.attrs = []));
  55892. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  55893. el.plain = false;
  55894. }
  55895. // add a raw attr (use this in preTransforms)
  55896. function addRawAttr (el, name, value, range) {
  55897. el.attrsMap[name] = value;
  55898. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  55899. }
  55900. function addDirective (
  55901. el,
  55902. name,
  55903. rawName,
  55904. value,
  55905. arg,
  55906. isDynamicArg,
  55907. modifiers,
  55908. range
  55909. ) {
  55910. (el.directives || (el.directives = [])).push(rangeSetItem({
  55911. name: name,
  55912. rawName: rawName,
  55913. value: value,
  55914. arg: arg,
  55915. isDynamicArg: isDynamicArg,
  55916. modifiers: modifiers
  55917. }, range));
  55918. el.plain = false;
  55919. }
  55920. function prependModifierMarker (symbol, name, dynamic) {
  55921. return dynamic
  55922. ? ("_p(" + name + ",\"" + symbol + "\")")
  55923. : symbol + name // mark the event as captured
  55924. }
  55925. function addHandler (
  55926. el,
  55927. name,
  55928. value,
  55929. modifiers,
  55930. important,
  55931. warn,
  55932. range,
  55933. dynamic
  55934. ) {
  55935. modifiers = modifiers || emptyObject;
  55936. // warn prevent and passive modifier
  55937. /* istanbul ignore if */
  55938. if (
  55939. warn &&
  55940. modifiers.prevent && modifiers.passive
  55941. ) {
  55942. warn(
  55943. 'passive and prevent can\'t be used together. ' +
  55944. 'Passive handler can\'t prevent default event.',
  55945. range
  55946. );
  55947. }
  55948. // normalize click.right and click.middle since they don't actually fire
  55949. // this is technically browser-specific, but at least for now browsers are
  55950. // the only target envs that have right/middle clicks.
  55951. if (modifiers.right) {
  55952. if (dynamic) {
  55953. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  55954. } else if (name === 'click') {
  55955. name = 'contextmenu';
  55956. delete modifiers.right;
  55957. }
  55958. } else if (modifiers.middle) {
  55959. if (dynamic) {
  55960. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  55961. } else if (name === 'click') {
  55962. name = 'mouseup';
  55963. }
  55964. }
  55965. // check capture modifier
  55966. if (modifiers.capture) {
  55967. delete modifiers.capture;
  55968. name = prependModifierMarker('!', name, dynamic);
  55969. }
  55970. if (modifiers.once) {
  55971. delete modifiers.once;
  55972. name = prependModifierMarker('~', name, dynamic);
  55973. }
  55974. /* istanbul ignore if */
  55975. if (modifiers.passive) {
  55976. delete modifiers.passive;
  55977. name = prependModifierMarker('&', name, dynamic);
  55978. }
  55979. var events;
  55980. if (modifiers.native) {
  55981. delete modifiers.native;
  55982. events = el.nativeEvents || (el.nativeEvents = {});
  55983. } else {
  55984. events = el.events || (el.events = {});
  55985. }
  55986. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  55987. if (modifiers !== emptyObject) {
  55988. newHandler.modifiers = modifiers;
  55989. }
  55990. var handlers = events[name];
  55991. /* istanbul ignore if */
  55992. if (Array.isArray(handlers)) {
  55993. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  55994. } else if (handlers) {
  55995. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  55996. } else {
  55997. events[name] = newHandler;
  55998. }
  55999. el.plain = false;
  56000. }
  56001. function getRawBindingAttr (
  56002. el,
  56003. name
  56004. ) {
  56005. return el.rawAttrsMap[':' + name] ||
  56006. el.rawAttrsMap['v-bind:' + name] ||
  56007. el.rawAttrsMap[name]
  56008. }
  56009. function getBindingAttr (
  56010. el,
  56011. name,
  56012. getStatic
  56013. ) {
  56014. var dynamicValue =
  56015. getAndRemoveAttr(el, ':' + name) ||
  56016. getAndRemoveAttr(el, 'v-bind:' + name);
  56017. if (dynamicValue != null) {
  56018. return parseFilters(dynamicValue)
  56019. } else if (getStatic !== false) {
  56020. var staticValue = getAndRemoveAttr(el, name);
  56021. if (staticValue != null) {
  56022. return JSON.stringify(staticValue)
  56023. }
  56024. }
  56025. }
  56026. // note: this only removes the attr from the Array (attrsList) so that it
  56027. // doesn't get processed by processAttrs.
  56028. // By default it does NOT remove it from the map (attrsMap) because the map is
  56029. // needed during codegen.
  56030. function getAndRemoveAttr (
  56031. el,
  56032. name,
  56033. removeFromMap
  56034. ) {
  56035. var val;
  56036. if ((val = el.attrsMap[name]) != null) {
  56037. var list = el.attrsList;
  56038. for (var i = 0, l = list.length; i < l; i++) {
  56039. if (list[i].name === name) {
  56040. list.splice(i, 1);
  56041. break
  56042. }
  56043. }
  56044. }
  56045. if (removeFromMap) {
  56046. delete el.attrsMap[name];
  56047. }
  56048. return val
  56049. }
  56050. function getAndRemoveAttrByRegex (
  56051. el,
  56052. name
  56053. ) {
  56054. var list = el.attrsList;
  56055. for (var i = 0, l = list.length; i < l; i++) {
  56056. var attr = list[i];
  56057. if (name.test(attr.name)) {
  56058. list.splice(i, 1);
  56059. return attr
  56060. }
  56061. }
  56062. }
  56063. function rangeSetItem (
  56064. item,
  56065. range
  56066. ) {
  56067. if (range) {
  56068. if (range.start != null) {
  56069. item.start = range.start;
  56070. }
  56071. if (range.end != null) {
  56072. item.end = range.end;
  56073. }
  56074. }
  56075. return item
  56076. }
  56077. /* */
  56078. /**
  56079. * Cross-platform code generation for component v-model
  56080. */
  56081. function genComponentModel (
  56082. el,
  56083. value,
  56084. modifiers
  56085. ) {
  56086. var ref = modifiers || {};
  56087. var number = ref.number;
  56088. var trim = ref.trim;
  56089. var baseValueExpression = '$$v';
  56090. var valueExpression = baseValueExpression;
  56091. if (trim) {
  56092. valueExpression =
  56093. "(typeof " + baseValueExpression + " === 'string'" +
  56094. "? " + baseValueExpression + ".trim()" +
  56095. ": " + baseValueExpression + ")";
  56096. }
  56097. if (number) {
  56098. valueExpression = "_n(" + valueExpression + ")";
  56099. }
  56100. var assignment = genAssignmentCode(value, valueExpression);
  56101. el.model = {
  56102. value: ("(" + value + ")"),
  56103. expression: JSON.stringify(value),
  56104. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  56105. };
  56106. }
  56107. /**
  56108. * Cross-platform codegen helper for generating v-model value assignment code.
  56109. */
  56110. function genAssignmentCode (
  56111. value,
  56112. assignment
  56113. ) {
  56114. var res = parseModel(value);
  56115. if (res.key === null) {
  56116. return (value + "=" + assignment)
  56117. } else {
  56118. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  56119. }
  56120. }
  56121. /**
  56122. * Parse a v-model expression into a base path and a final key segment.
  56123. * Handles both dot-path and possible square brackets.
  56124. *
  56125. * Possible cases:
  56126. *
  56127. * - test
  56128. * - test[key]
  56129. * - test[test1[key]]
  56130. * - test["a"][key]
  56131. * - xxx.test[a[a].test1[key]]
  56132. * - test.xxx.a["asa"][test1[key]]
  56133. *
  56134. */
  56135. var len, str, chr, index$1, expressionPos, expressionEndPos;
  56136. function parseModel (val) {
  56137. // Fix https://github.com/vuejs/vue/pull/7730
  56138. // allow v-model="obj.val " (trailing whitespace)
  56139. val = val.trim();
  56140. len = val.length;
  56141. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  56142. index$1 = val.lastIndexOf('.');
  56143. if (index$1 > -1) {
  56144. return {
  56145. exp: val.slice(0, index$1),
  56146. key: '"' + val.slice(index$1 + 1) + '"'
  56147. }
  56148. } else {
  56149. return {
  56150. exp: val,
  56151. key: null
  56152. }
  56153. }
  56154. }
  56155. str = val;
  56156. index$1 = expressionPos = expressionEndPos = 0;
  56157. while (!eof()) {
  56158. chr = next();
  56159. /* istanbul ignore if */
  56160. if (isStringStart(chr)) {
  56161. parseString(chr);
  56162. } else if (chr === 0x5B) {
  56163. parseBracket(chr);
  56164. }
  56165. }
  56166. return {
  56167. exp: val.slice(0, expressionPos),
  56168. key: val.slice(expressionPos + 1, expressionEndPos)
  56169. }
  56170. }
  56171. function next () {
  56172. return str.charCodeAt(++index$1)
  56173. }
  56174. function eof () {
  56175. return index$1 >= len
  56176. }
  56177. function isStringStart (chr) {
  56178. return chr === 0x22 || chr === 0x27
  56179. }
  56180. function parseBracket (chr) {
  56181. var inBracket = 1;
  56182. expressionPos = index$1;
  56183. while (!eof()) {
  56184. chr = next();
  56185. if (isStringStart(chr)) {
  56186. parseString(chr);
  56187. continue
  56188. }
  56189. if (chr === 0x5B) { inBracket++; }
  56190. if (chr === 0x5D) { inBracket--; }
  56191. if (inBracket === 0) {
  56192. expressionEndPos = index$1;
  56193. break
  56194. }
  56195. }
  56196. }
  56197. function parseString (chr) {
  56198. var stringQuote = chr;
  56199. while (!eof()) {
  56200. chr = next();
  56201. if (chr === stringQuote) {
  56202. break
  56203. }
  56204. }
  56205. }
  56206. /* */
  56207. var warn$1;
  56208. // in some cases, the event used has to be determined at runtime
  56209. // so we used some reserved tokens during compile.
  56210. var RANGE_TOKEN = '__r';
  56211. var CHECKBOX_RADIO_TOKEN = '__c';
  56212. function model (
  56213. el,
  56214. dir,
  56215. _warn
  56216. ) {
  56217. warn$1 = _warn;
  56218. var value = dir.value;
  56219. var modifiers = dir.modifiers;
  56220. var tag = el.tag;
  56221. var type = el.attrsMap.type;
  56222. {
  56223. // inputs with type="file" are read only and setting the input's
  56224. // value will throw an error.
  56225. if (tag === 'input' && type === 'file') {
  56226. warn$1(
  56227. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  56228. "File inputs are read only. Use a v-on:change listener instead.",
  56229. el.rawAttrsMap['v-model']
  56230. );
  56231. }
  56232. }
  56233. if (el.component) {
  56234. genComponentModel(el, value, modifiers);
  56235. // component v-model doesn't need extra runtime
  56236. return false
  56237. } else if (tag === 'select') {
  56238. genSelect(el, value, modifiers);
  56239. } else if (tag === 'input' && type === 'checkbox') {
  56240. genCheckboxModel(el, value, modifiers);
  56241. } else if (tag === 'input' && type === 'radio') {
  56242. genRadioModel(el, value, modifiers);
  56243. } else if (tag === 'input' || tag === 'textarea') {
  56244. genDefaultModel(el, value, modifiers);
  56245. } else if (!config.isReservedTag(tag)) {
  56246. genComponentModel(el, value, modifiers);
  56247. // component v-model doesn't need extra runtime
  56248. return false
  56249. } else {
  56250. warn$1(
  56251. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  56252. "v-model is not supported on this element type. " +
  56253. 'If you are working with contenteditable, it\'s recommended to ' +
  56254. 'wrap a library dedicated for that purpose inside a custom component.',
  56255. el.rawAttrsMap['v-model']
  56256. );
  56257. }
  56258. // ensure runtime directive metadata
  56259. return true
  56260. }
  56261. function genCheckboxModel (
  56262. el,
  56263. value,
  56264. modifiers
  56265. ) {
  56266. var number = modifiers && modifiers.number;
  56267. var valueBinding = getBindingAttr(el, 'value') || 'null';
  56268. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  56269. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  56270. addProp(el, 'checked',
  56271. "Array.isArray(" + value + ")" +
  56272. "?_i(" + value + "," + valueBinding + ")>-1" + (
  56273. trueValueBinding === 'true'
  56274. ? (":(" + value + ")")
  56275. : (":_q(" + value + "," + trueValueBinding + ")")
  56276. )
  56277. );
  56278. addHandler(el, 'change',
  56279. "var $$a=" + value + "," +
  56280. '$$el=$event.target,' +
  56281. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  56282. 'if(Array.isArray($$a)){' +
  56283. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  56284. '$$i=_i($$a,$$v);' +
  56285. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  56286. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  56287. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  56288. null, true
  56289. );
  56290. }
  56291. function genRadioModel (
  56292. el,
  56293. value,
  56294. modifiers
  56295. ) {
  56296. var number = modifiers && modifiers.number;
  56297. var valueBinding = getBindingAttr(el, 'value') || 'null';
  56298. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  56299. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  56300. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  56301. }
  56302. function genSelect (
  56303. el,
  56304. value,
  56305. modifiers
  56306. ) {
  56307. var number = modifiers && modifiers.number;
  56308. var selectedVal = "Array.prototype.filter" +
  56309. ".call($event.target.options,function(o){return o.selected})" +
  56310. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  56311. "return " + (number ? '_n(val)' : 'val') + "})";
  56312. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  56313. var code = "var $$selectedVal = " + selectedVal + ";";
  56314. code = code + " " + (genAssignmentCode(value, assignment));
  56315. addHandler(el, 'change', code, null, true);
  56316. }
  56317. function genDefaultModel (
  56318. el,
  56319. value,
  56320. modifiers
  56321. ) {
  56322. var type = el.attrsMap.type;
  56323. // warn if v-bind:value conflicts with v-model
  56324. // except for inputs with v-bind:type
  56325. {
  56326. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  56327. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  56328. if (value$1 && !typeBinding) {
  56329. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  56330. warn$1(
  56331. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  56332. 'because the latter already expands to a value binding internally',
  56333. el.rawAttrsMap[binding]
  56334. );
  56335. }
  56336. }
  56337. var ref = modifiers || {};
  56338. var lazy = ref.lazy;
  56339. var number = ref.number;
  56340. var trim = ref.trim;
  56341. var needCompositionGuard = !lazy && type !== 'range';
  56342. var event = lazy
  56343. ? 'change'
  56344. : type === 'range'
  56345. ? RANGE_TOKEN
  56346. : 'input';
  56347. var valueExpression = '$event.target.value';
  56348. if (trim) {
  56349. valueExpression = "$event.target.value.trim()";
  56350. }
  56351. if (number) {
  56352. valueExpression = "_n(" + valueExpression + ")";
  56353. }
  56354. var code = genAssignmentCode(value, valueExpression);
  56355. if (needCompositionGuard) {
  56356. code = "if($event.target.composing)return;" + code;
  56357. }
  56358. addProp(el, 'value', ("(" + value + ")"));
  56359. addHandler(el, event, code, null, true);
  56360. if (trim || number) {
  56361. addHandler(el, 'blur', '$forceUpdate()');
  56362. }
  56363. }
  56364. /* */
  56365. // normalize v-model event tokens that can only be determined at runtime.
  56366. // it's important to place the event as the first in the array because
  56367. // the whole point is ensuring the v-model callback gets called before
  56368. // user-attached handlers.
  56369. function normalizeEvents (on) {
  56370. /* istanbul ignore if */
  56371. if (isDef(on[RANGE_TOKEN])) {
  56372. // IE input[type=range] only supports `change` event
  56373. var event = isIE ? 'change' : 'input';
  56374. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  56375. delete on[RANGE_TOKEN];
  56376. }
  56377. // This was originally intended to fix #4521 but no longer necessary
  56378. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  56379. /* istanbul ignore if */
  56380. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  56381. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  56382. delete on[CHECKBOX_RADIO_TOKEN];
  56383. }
  56384. }
  56385. var target$1;
  56386. function createOnceHandler$1 (event, handler, capture) {
  56387. var _target = target$1; // save current target element in closure
  56388. return function onceHandler () {
  56389. var res = handler.apply(null, arguments);
  56390. if (res !== null) {
  56391. remove$2(event, onceHandler, capture, _target);
  56392. }
  56393. }
  56394. }
  56395. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  56396. // implementation and does not fire microtasks in between event propagation, so
  56397. // safe to exclude.
  56398. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  56399. function add$1 (
  56400. name,
  56401. handler,
  56402. capture,
  56403. passive
  56404. ) {
  56405. // async edge case #6566: inner click event triggers patch, event handler
  56406. // attached to outer element during patch, and triggered again. This
  56407. // happens because browsers fire microtask ticks between event propagation.
  56408. // the solution is simple: we save the timestamp when a handler is attached,
  56409. // and the handler would only fire if the event passed to it was fired
  56410. // AFTER it was attached.
  56411. if (useMicrotaskFix) {
  56412. var attachedTimestamp = currentFlushTimestamp;
  56413. var original = handler;
  56414. handler = original._wrapper = function (e) {
  56415. if (
  56416. // no bubbling, should always fire.
  56417. // this is just a safety net in case event.timeStamp is unreliable in
  56418. // certain weird environments...
  56419. e.target === e.currentTarget ||
  56420. // event is fired after handler attachment
  56421. e.timeStamp >= attachedTimestamp ||
  56422. // bail for environments that have buggy event.timeStamp implementations
  56423. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  56424. // #9681 QtWebEngine event.timeStamp is negative value
  56425. e.timeStamp <= 0 ||
  56426. // #9448 bail if event is fired in another document in a multi-page
  56427. // electron/nw.js app, since event.timeStamp will be using a different
  56428. // starting reference
  56429. e.target.ownerDocument !== document
  56430. ) {
  56431. return original.apply(this, arguments)
  56432. }
  56433. };
  56434. }
  56435. target$1.addEventListener(
  56436. name,
  56437. handler,
  56438. supportsPassive
  56439. ? { capture: capture, passive: passive }
  56440. : capture
  56441. );
  56442. }
  56443. function remove$2 (
  56444. name,
  56445. handler,
  56446. capture,
  56447. _target
  56448. ) {
  56449. (_target || target$1).removeEventListener(
  56450. name,
  56451. handler._wrapper || handler,
  56452. capture
  56453. );
  56454. }
  56455. function updateDOMListeners (oldVnode, vnode) {
  56456. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  56457. return
  56458. }
  56459. var on = vnode.data.on || {};
  56460. var oldOn = oldVnode.data.on || {};
  56461. target$1 = vnode.elm;
  56462. normalizeEvents(on);
  56463. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  56464. target$1 = undefined;
  56465. }
  56466. var events = {
  56467. create: updateDOMListeners,
  56468. update: updateDOMListeners
  56469. };
  56470. /* */
  56471. var svgContainer;
  56472. function updateDOMProps (oldVnode, vnode) {
  56473. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  56474. return
  56475. }
  56476. var key, cur;
  56477. var elm = vnode.elm;
  56478. var oldProps = oldVnode.data.domProps || {};
  56479. var props = vnode.data.domProps || {};
  56480. // clone observed objects, as the user probably wants to mutate it
  56481. if (isDef(props.__ob__)) {
  56482. props = vnode.data.domProps = extend({}, props);
  56483. }
  56484. for (key in oldProps) {
  56485. if (!(key in props)) {
  56486. elm[key] = '';
  56487. }
  56488. }
  56489. for (key in props) {
  56490. cur = props[key];
  56491. // ignore children if the node has textContent or innerHTML,
  56492. // as these will throw away existing DOM nodes and cause removal errors
  56493. // on subsequent patches (#3360)
  56494. if (key === 'textContent' || key === 'innerHTML') {
  56495. if (vnode.children) { vnode.children.length = 0; }
  56496. if (cur === oldProps[key]) { continue }
  56497. // #6601 work around Chrome version <= 55 bug where single textNode
  56498. // replaced by innerHTML/textContent retains its parentNode property
  56499. if (elm.childNodes.length === 1) {
  56500. elm.removeChild(elm.childNodes[0]);
  56501. }
  56502. }
  56503. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  56504. // store value as _value as well since
  56505. // non-string values will be stringified
  56506. elm._value = cur;
  56507. // avoid resetting cursor position when value is the same
  56508. var strCur = isUndef(cur) ? '' : String(cur);
  56509. if (shouldUpdateValue(elm, strCur)) {
  56510. elm.value = strCur;
  56511. }
  56512. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  56513. // IE doesn't support innerHTML for SVG elements
  56514. svgContainer = svgContainer || document.createElement('div');
  56515. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  56516. var svg = svgContainer.firstChild;
  56517. while (elm.firstChild) {
  56518. elm.removeChild(elm.firstChild);
  56519. }
  56520. while (svg.firstChild) {
  56521. elm.appendChild(svg.firstChild);
  56522. }
  56523. } else if (
  56524. // skip the update if old and new VDOM state is the same.
  56525. // `value` is handled separately because the DOM value may be temporarily
  56526. // out of sync with VDOM state due to focus, composition and modifiers.
  56527. // This #4521 by skipping the unnecesarry `checked` update.
  56528. cur !== oldProps[key]
  56529. ) {
  56530. // some property updates can throw
  56531. // e.g. `value` on <progress> w/ non-finite value
  56532. try {
  56533. elm[key] = cur;
  56534. } catch (e) {}
  56535. }
  56536. }
  56537. }
  56538. // check platforms/web/util/attrs.js acceptValue
  56539. function shouldUpdateValue (elm, checkVal) {
  56540. return (!elm.composing && (
  56541. elm.tagName === 'OPTION' ||
  56542. isNotInFocusAndDirty(elm, checkVal) ||
  56543. isDirtyWithModifiers(elm, checkVal)
  56544. ))
  56545. }
  56546. function isNotInFocusAndDirty (elm, checkVal) {
  56547. // return true when textbox (.number and .trim) loses focus and its value is
  56548. // not equal to the updated value
  56549. var notInFocus = true;
  56550. // #6157
  56551. // work around IE bug when accessing document.activeElement in an iframe
  56552. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  56553. return notInFocus && elm.value !== checkVal
  56554. }
  56555. function isDirtyWithModifiers (elm, newVal) {
  56556. var value = elm.value;
  56557. var modifiers = elm._vModifiers; // injected by v-model runtime
  56558. if (isDef(modifiers)) {
  56559. if (modifiers.number) {
  56560. return toNumber(value) !== toNumber(newVal)
  56561. }
  56562. if (modifiers.trim) {
  56563. return value.trim() !== newVal.trim()
  56564. }
  56565. }
  56566. return value !== newVal
  56567. }
  56568. var domProps = {
  56569. create: updateDOMProps,
  56570. update: updateDOMProps
  56571. };
  56572. /* */
  56573. var parseStyleText = cached(function (cssText) {
  56574. var res = {};
  56575. var listDelimiter = /;(?![^(]*\))/g;
  56576. var propertyDelimiter = /:(.+)/;
  56577. cssText.split(listDelimiter).forEach(function (item) {
  56578. if (item) {
  56579. var tmp = item.split(propertyDelimiter);
  56580. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  56581. }
  56582. });
  56583. return res
  56584. });
  56585. // merge static and dynamic style data on the same vnode
  56586. function normalizeStyleData (data) {
  56587. var style = normalizeStyleBinding(data.style);
  56588. // static style is pre-processed into an object during compilation
  56589. // and is always a fresh object, so it's safe to merge into it
  56590. return data.staticStyle
  56591. ? extend(data.staticStyle, style)
  56592. : style
  56593. }
  56594. // normalize possible array / string values into Object
  56595. function normalizeStyleBinding (bindingStyle) {
  56596. if (Array.isArray(bindingStyle)) {
  56597. return toObject(bindingStyle)
  56598. }
  56599. if (typeof bindingStyle === 'string') {
  56600. return parseStyleText(bindingStyle)
  56601. }
  56602. return bindingStyle
  56603. }
  56604. /**
  56605. * parent component style should be after child's
  56606. * so that parent component's style could override it
  56607. */
  56608. function getStyle (vnode, checkChild) {
  56609. var res = {};
  56610. var styleData;
  56611. if (checkChild) {
  56612. var childNode = vnode;
  56613. while (childNode.componentInstance) {
  56614. childNode = childNode.componentInstance._vnode;
  56615. if (
  56616. childNode && childNode.data &&
  56617. (styleData = normalizeStyleData(childNode.data))
  56618. ) {
  56619. extend(res, styleData);
  56620. }
  56621. }
  56622. }
  56623. if ((styleData = normalizeStyleData(vnode.data))) {
  56624. extend(res, styleData);
  56625. }
  56626. var parentNode = vnode;
  56627. while ((parentNode = parentNode.parent)) {
  56628. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  56629. extend(res, styleData);
  56630. }
  56631. }
  56632. return res
  56633. }
  56634. /* */
  56635. var cssVarRE = /^--/;
  56636. var importantRE = /\s*!important$/;
  56637. var setProp = function (el, name, val) {
  56638. /* istanbul ignore if */
  56639. if (cssVarRE.test(name)) {
  56640. el.style.setProperty(name, val);
  56641. } else if (importantRE.test(val)) {
  56642. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  56643. } else {
  56644. var normalizedName = normalize(name);
  56645. if (Array.isArray(val)) {
  56646. // Support values array created by autoprefixer, e.g.
  56647. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  56648. // Set them one by one, and the browser will only set those it can recognize
  56649. for (var i = 0, len = val.length; i < len; i++) {
  56650. el.style[normalizedName] = val[i];
  56651. }
  56652. } else {
  56653. el.style[normalizedName] = val;
  56654. }
  56655. }
  56656. };
  56657. var vendorNames = ['Webkit', 'Moz', 'ms'];
  56658. var emptyStyle;
  56659. var normalize = cached(function (prop) {
  56660. emptyStyle = emptyStyle || document.createElement('div').style;
  56661. prop = camelize(prop);
  56662. if (prop !== 'filter' && (prop in emptyStyle)) {
  56663. return prop
  56664. }
  56665. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  56666. for (var i = 0; i < vendorNames.length; i++) {
  56667. var name = vendorNames[i] + capName;
  56668. if (name in emptyStyle) {
  56669. return name
  56670. }
  56671. }
  56672. });
  56673. function updateStyle (oldVnode, vnode) {
  56674. var data = vnode.data;
  56675. var oldData = oldVnode.data;
  56676. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  56677. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  56678. ) {
  56679. return
  56680. }
  56681. var cur, name;
  56682. var el = vnode.elm;
  56683. var oldStaticStyle = oldData.staticStyle;
  56684. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  56685. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  56686. var oldStyle = oldStaticStyle || oldStyleBinding;
  56687. var style = normalizeStyleBinding(vnode.data.style) || {};
  56688. // store normalized style under a different key for next diff
  56689. // make sure to clone it if it's reactive, since the user likely wants
  56690. // to mutate it.
  56691. vnode.data.normalizedStyle = isDef(style.__ob__)
  56692. ? extend({}, style)
  56693. : style;
  56694. var newStyle = getStyle(vnode, true);
  56695. for (name in oldStyle) {
  56696. if (isUndef(newStyle[name])) {
  56697. setProp(el, name, '');
  56698. }
  56699. }
  56700. for (name in newStyle) {
  56701. cur = newStyle[name];
  56702. if (cur !== oldStyle[name]) {
  56703. // ie9 setting to null has no effect, must use empty string
  56704. setProp(el, name, cur == null ? '' : cur);
  56705. }
  56706. }
  56707. }
  56708. var style = {
  56709. create: updateStyle,
  56710. update: updateStyle
  56711. };
  56712. /* */
  56713. var whitespaceRE = /\s+/;
  56714. /**
  56715. * Add class with compatibility for SVG since classList is not supported on
  56716. * SVG elements in IE
  56717. */
  56718. function addClass (el, cls) {
  56719. /* istanbul ignore if */
  56720. if (!cls || !(cls = cls.trim())) {
  56721. return
  56722. }
  56723. /* istanbul ignore else */
  56724. if (el.classList) {
  56725. if (cls.indexOf(' ') > -1) {
  56726. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  56727. } else {
  56728. el.classList.add(cls);
  56729. }
  56730. } else {
  56731. var cur = " " + (el.getAttribute('class') || '') + " ";
  56732. if (cur.indexOf(' ' + cls + ' ') < 0) {
  56733. el.setAttribute('class', (cur + cls).trim());
  56734. }
  56735. }
  56736. }
  56737. /**
  56738. * Remove class with compatibility for SVG since classList is not supported on
  56739. * SVG elements in IE
  56740. */
  56741. function removeClass (el, cls) {
  56742. /* istanbul ignore if */
  56743. if (!cls || !(cls = cls.trim())) {
  56744. return
  56745. }
  56746. /* istanbul ignore else */
  56747. if (el.classList) {
  56748. if (cls.indexOf(' ') > -1) {
  56749. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  56750. } else {
  56751. el.classList.remove(cls);
  56752. }
  56753. if (!el.classList.length) {
  56754. el.removeAttribute('class');
  56755. }
  56756. } else {
  56757. var cur = " " + (el.getAttribute('class') || '') + " ";
  56758. var tar = ' ' + cls + ' ';
  56759. while (cur.indexOf(tar) >= 0) {
  56760. cur = cur.replace(tar, ' ');
  56761. }
  56762. cur = cur.trim();
  56763. if (cur) {
  56764. el.setAttribute('class', cur);
  56765. } else {
  56766. el.removeAttribute('class');
  56767. }
  56768. }
  56769. }
  56770. /* */
  56771. function resolveTransition (def$$1) {
  56772. if (!def$$1) {
  56773. return
  56774. }
  56775. /* istanbul ignore else */
  56776. if (typeof def$$1 === 'object') {
  56777. var res = {};
  56778. if (def$$1.css !== false) {
  56779. extend(res, autoCssTransition(def$$1.name || 'v'));
  56780. }
  56781. extend(res, def$$1);
  56782. return res
  56783. } else if (typeof def$$1 === 'string') {
  56784. return autoCssTransition(def$$1)
  56785. }
  56786. }
  56787. var autoCssTransition = cached(function (name) {
  56788. return {
  56789. enterClass: (name + "-enter"),
  56790. enterToClass: (name + "-enter-to"),
  56791. enterActiveClass: (name + "-enter-active"),
  56792. leaveClass: (name + "-leave"),
  56793. leaveToClass: (name + "-leave-to"),
  56794. leaveActiveClass: (name + "-leave-active")
  56795. }
  56796. });
  56797. var hasTransition = inBrowser && !isIE9;
  56798. var TRANSITION = 'transition';
  56799. var ANIMATION = 'animation';
  56800. // Transition property/event sniffing
  56801. var transitionProp = 'transition';
  56802. var transitionEndEvent = 'transitionend';
  56803. var animationProp = 'animation';
  56804. var animationEndEvent = 'animationend';
  56805. if (hasTransition) {
  56806. /* istanbul ignore if */
  56807. if (window.ontransitionend === undefined &&
  56808. window.onwebkittransitionend !== undefined
  56809. ) {
  56810. transitionProp = 'WebkitTransition';
  56811. transitionEndEvent = 'webkitTransitionEnd';
  56812. }
  56813. if (window.onanimationend === undefined &&
  56814. window.onwebkitanimationend !== undefined
  56815. ) {
  56816. animationProp = 'WebkitAnimation';
  56817. animationEndEvent = 'webkitAnimationEnd';
  56818. }
  56819. }
  56820. // binding to window is necessary to make hot reload work in IE in strict mode
  56821. var raf = inBrowser
  56822. ? window.requestAnimationFrame
  56823. ? window.requestAnimationFrame.bind(window)
  56824. : setTimeout
  56825. : /* istanbul ignore next */ function (fn) { return fn(); };
  56826. function nextFrame (fn) {
  56827. raf(function () {
  56828. raf(fn);
  56829. });
  56830. }
  56831. function addTransitionClass (el, cls) {
  56832. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  56833. if (transitionClasses.indexOf(cls) < 0) {
  56834. transitionClasses.push(cls);
  56835. addClass(el, cls);
  56836. }
  56837. }
  56838. function removeTransitionClass (el, cls) {
  56839. if (el._transitionClasses) {
  56840. remove(el._transitionClasses, cls);
  56841. }
  56842. removeClass(el, cls);
  56843. }
  56844. function whenTransitionEnds (
  56845. el,
  56846. expectedType,
  56847. cb
  56848. ) {
  56849. var ref = getTransitionInfo(el, expectedType);
  56850. var type = ref.type;
  56851. var timeout = ref.timeout;
  56852. var propCount = ref.propCount;
  56853. if (!type) { return cb() }
  56854. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  56855. var ended = 0;
  56856. var end = function () {
  56857. el.removeEventListener(event, onEnd);
  56858. cb();
  56859. };
  56860. var onEnd = function (e) {
  56861. if (e.target === el) {
  56862. if (++ended >= propCount) {
  56863. end();
  56864. }
  56865. }
  56866. };
  56867. setTimeout(function () {
  56868. if (ended < propCount) {
  56869. end();
  56870. }
  56871. }, timeout + 1);
  56872. el.addEventListener(event, onEnd);
  56873. }
  56874. var transformRE = /\b(transform|all)(,|$)/;
  56875. function getTransitionInfo (el, expectedType) {
  56876. var styles = window.getComputedStyle(el);
  56877. // JSDOM may return undefined for transition properties
  56878. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  56879. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  56880. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  56881. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  56882. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  56883. var animationTimeout = getTimeout(animationDelays, animationDurations);
  56884. var type;
  56885. var timeout = 0;
  56886. var propCount = 0;
  56887. /* istanbul ignore if */
  56888. if (expectedType === TRANSITION) {
  56889. if (transitionTimeout > 0) {
  56890. type = TRANSITION;
  56891. timeout = transitionTimeout;
  56892. propCount = transitionDurations.length;
  56893. }
  56894. } else if (expectedType === ANIMATION) {
  56895. if (animationTimeout > 0) {
  56896. type = ANIMATION;
  56897. timeout = animationTimeout;
  56898. propCount = animationDurations.length;
  56899. }
  56900. } else {
  56901. timeout = Math.max(transitionTimeout, animationTimeout);
  56902. type = timeout > 0
  56903. ? transitionTimeout > animationTimeout
  56904. ? TRANSITION
  56905. : ANIMATION
  56906. : null;
  56907. propCount = type
  56908. ? type === TRANSITION
  56909. ? transitionDurations.length
  56910. : animationDurations.length
  56911. : 0;
  56912. }
  56913. var hasTransform =
  56914. type === TRANSITION &&
  56915. transformRE.test(styles[transitionProp + 'Property']);
  56916. return {
  56917. type: type,
  56918. timeout: timeout,
  56919. propCount: propCount,
  56920. hasTransform: hasTransform
  56921. }
  56922. }
  56923. function getTimeout (delays, durations) {
  56924. /* istanbul ignore next */
  56925. while (delays.length < durations.length) {
  56926. delays = delays.concat(delays);
  56927. }
  56928. return Math.max.apply(null, durations.map(function (d, i) {
  56929. return toMs(d) + toMs(delays[i])
  56930. }))
  56931. }
  56932. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  56933. // in a locale-dependent way, using a comma instead of a dot.
  56934. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  56935. // as a floor function) causing unexpected behaviors
  56936. function toMs (s) {
  56937. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  56938. }
  56939. /* */
  56940. function enter (vnode, toggleDisplay) {
  56941. var el = vnode.elm;
  56942. // call leave callback now
  56943. if (isDef(el._leaveCb)) {
  56944. el._leaveCb.cancelled = true;
  56945. el._leaveCb();
  56946. }
  56947. var data = resolveTransition(vnode.data.transition);
  56948. if (isUndef(data)) {
  56949. return
  56950. }
  56951. /* istanbul ignore if */
  56952. if (isDef(el._enterCb) || el.nodeType !== 1) {
  56953. return
  56954. }
  56955. var css = data.css;
  56956. var type = data.type;
  56957. var enterClass = data.enterClass;
  56958. var enterToClass = data.enterToClass;
  56959. var enterActiveClass = data.enterActiveClass;
  56960. var appearClass = data.appearClass;
  56961. var appearToClass = data.appearToClass;
  56962. var appearActiveClass = data.appearActiveClass;
  56963. var beforeEnter = data.beforeEnter;
  56964. var enter = data.enter;
  56965. var afterEnter = data.afterEnter;
  56966. var enterCancelled = data.enterCancelled;
  56967. var beforeAppear = data.beforeAppear;
  56968. var appear = data.appear;
  56969. var afterAppear = data.afterAppear;
  56970. var appearCancelled = data.appearCancelled;
  56971. var duration = data.duration;
  56972. // activeInstance will always be the <transition> component managing this
  56973. // transition. One edge case to check is when the <transition> is placed
  56974. // as the root node of a child component. In that case we need to check
  56975. // <transition>'s parent for appear check.
  56976. var context = activeInstance;
  56977. var transitionNode = activeInstance.$vnode;
  56978. while (transitionNode && transitionNode.parent) {
  56979. context = transitionNode.context;
  56980. transitionNode = transitionNode.parent;
  56981. }
  56982. var isAppear = !context._isMounted || !vnode.isRootInsert;
  56983. if (isAppear && !appear && appear !== '') {
  56984. return
  56985. }
  56986. var startClass = isAppear && appearClass
  56987. ? appearClass
  56988. : enterClass;
  56989. var activeClass = isAppear && appearActiveClass
  56990. ? appearActiveClass
  56991. : enterActiveClass;
  56992. var toClass = isAppear && appearToClass
  56993. ? appearToClass
  56994. : enterToClass;
  56995. var beforeEnterHook = isAppear
  56996. ? (beforeAppear || beforeEnter)
  56997. : beforeEnter;
  56998. var enterHook = isAppear
  56999. ? (typeof appear === 'function' ? appear : enter)
  57000. : enter;
  57001. var afterEnterHook = isAppear
  57002. ? (afterAppear || afterEnter)
  57003. : afterEnter;
  57004. var enterCancelledHook = isAppear
  57005. ? (appearCancelled || enterCancelled)
  57006. : enterCancelled;
  57007. var explicitEnterDuration = toNumber(
  57008. isObject(duration)
  57009. ? duration.enter
  57010. : duration
  57011. );
  57012. if (explicitEnterDuration != null) {
  57013. checkDuration(explicitEnterDuration, 'enter', vnode);
  57014. }
  57015. var expectsCSS = css !== false && !isIE9;
  57016. var userWantsControl = getHookArgumentsLength(enterHook);
  57017. var cb = el._enterCb = once(function () {
  57018. if (expectsCSS) {
  57019. removeTransitionClass(el, toClass);
  57020. removeTransitionClass(el, activeClass);
  57021. }
  57022. if (cb.cancelled) {
  57023. if (expectsCSS) {
  57024. removeTransitionClass(el, startClass);
  57025. }
  57026. enterCancelledHook && enterCancelledHook(el);
  57027. } else {
  57028. afterEnterHook && afterEnterHook(el);
  57029. }
  57030. el._enterCb = null;
  57031. });
  57032. if (!vnode.data.show) {
  57033. // remove pending leave element on enter by injecting an insert hook
  57034. mergeVNodeHook(vnode, 'insert', function () {
  57035. var parent = el.parentNode;
  57036. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  57037. if (pendingNode &&
  57038. pendingNode.tag === vnode.tag &&
  57039. pendingNode.elm._leaveCb
  57040. ) {
  57041. pendingNode.elm._leaveCb();
  57042. }
  57043. enterHook && enterHook(el, cb);
  57044. });
  57045. }
  57046. // start enter transition
  57047. beforeEnterHook && beforeEnterHook(el);
  57048. if (expectsCSS) {
  57049. addTransitionClass(el, startClass);
  57050. addTransitionClass(el, activeClass);
  57051. nextFrame(function () {
  57052. removeTransitionClass(el, startClass);
  57053. if (!cb.cancelled) {
  57054. addTransitionClass(el, toClass);
  57055. if (!userWantsControl) {
  57056. if (isValidDuration(explicitEnterDuration)) {
  57057. setTimeout(cb, explicitEnterDuration);
  57058. } else {
  57059. whenTransitionEnds(el, type, cb);
  57060. }
  57061. }
  57062. }
  57063. });
  57064. }
  57065. if (vnode.data.show) {
  57066. toggleDisplay && toggleDisplay();
  57067. enterHook && enterHook(el, cb);
  57068. }
  57069. if (!expectsCSS && !userWantsControl) {
  57070. cb();
  57071. }
  57072. }
  57073. function leave (vnode, rm) {
  57074. var el = vnode.elm;
  57075. // call enter callback now
  57076. if (isDef(el._enterCb)) {
  57077. el._enterCb.cancelled = true;
  57078. el._enterCb();
  57079. }
  57080. var data = resolveTransition(vnode.data.transition);
  57081. if (isUndef(data) || el.nodeType !== 1) {
  57082. return rm()
  57083. }
  57084. /* istanbul ignore if */
  57085. if (isDef(el._leaveCb)) {
  57086. return
  57087. }
  57088. var css = data.css;
  57089. var type = data.type;
  57090. var leaveClass = data.leaveClass;
  57091. var leaveToClass = data.leaveToClass;
  57092. var leaveActiveClass = data.leaveActiveClass;
  57093. var beforeLeave = data.beforeLeave;
  57094. var leave = data.leave;
  57095. var afterLeave = data.afterLeave;
  57096. var leaveCancelled = data.leaveCancelled;
  57097. var delayLeave = data.delayLeave;
  57098. var duration = data.duration;
  57099. var expectsCSS = css !== false && !isIE9;
  57100. var userWantsControl = getHookArgumentsLength(leave);
  57101. var explicitLeaveDuration = toNumber(
  57102. isObject(duration)
  57103. ? duration.leave
  57104. : duration
  57105. );
  57106. if (isDef(explicitLeaveDuration)) {
  57107. checkDuration(explicitLeaveDuration, 'leave', vnode);
  57108. }
  57109. var cb = el._leaveCb = once(function () {
  57110. if (el.parentNode && el.parentNode._pending) {
  57111. el.parentNode._pending[vnode.key] = null;
  57112. }
  57113. if (expectsCSS) {
  57114. removeTransitionClass(el, leaveToClass);
  57115. removeTransitionClass(el, leaveActiveClass);
  57116. }
  57117. if (cb.cancelled) {
  57118. if (expectsCSS) {
  57119. removeTransitionClass(el, leaveClass);
  57120. }
  57121. leaveCancelled && leaveCancelled(el);
  57122. } else {
  57123. rm();
  57124. afterLeave && afterLeave(el);
  57125. }
  57126. el._leaveCb = null;
  57127. });
  57128. if (delayLeave) {
  57129. delayLeave(performLeave);
  57130. } else {
  57131. performLeave();
  57132. }
  57133. function performLeave () {
  57134. // the delayed leave may have already been cancelled
  57135. if (cb.cancelled) {
  57136. return
  57137. }
  57138. // record leaving element
  57139. if (!vnode.data.show && el.parentNode) {
  57140. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  57141. }
  57142. beforeLeave && beforeLeave(el);
  57143. if (expectsCSS) {
  57144. addTransitionClass(el, leaveClass);
  57145. addTransitionClass(el, leaveActiveClass);
  57146. nextFrame(function () {
  57147. removeTransitionClass(el, leaveClass);
  57148. if (!cb.cancelled) {
  57149. addTransitionClass(el, leaveToClass);
  57150. if (!userWantsControl) {
  57151. if (isValidDuration(explicitLeaveDuration)) {
  57152. setTimeout(cb, explicitLeaveDuration);
  57153. } else {
  57154. whenTransitionEnds(el, type, cb);
  57155. }
  57156. }
  57157. }
  57158. });
  57159. }
  57160. leave && leave(el, cb);
  57161. if (!expectsCSS && !userWantsControl) {
  57162. cb();
  57163. }
  57164. }
  57165. }
  57166. // only used in dev mode
  57167. function checkDuration (val, name, vnode) {
  57168. if (typeof val !== 'number') {
  57169. warn(
  57170. "<transition> explicit " + name + " duration is not a valid number - " +
  57171. "got " + (JSON.stringify(val)) + ".",
  57172. vnode.context
  57173. );
  57174. } else if (isNaN(val)) {
  57175. warn(
  57176. "<transition> explicit " + name + " duration is NaN - " +
  57177. 'the duration expression might be incorrect.',
  57178. vnode.context
  57179. );
  57180. }
  57181. }
  57182. function isValidDuration (val) {
  57183. return typeof val === 'number' && !isNaN(val)
  57184. }
  57185. /**
  57186. * Normalize a transition hook's argument length. The hook may be:
  57187. * - a merged hook (invoker) with the original in .fns
  57188. * - a wrapped component method (check ._length)
  57189. * - a plain function (.length)
  57190. */
  57191. function getHookArgumentsLength (fn) {
  57192. if (isUndef(fn)) {
  57193. return false
  57194. }
  57195. var invokerFns = fn.fns;
  57196. if (isDef(invokerFns)) {
  57197. // invoker
  57198. return getHookArgumentsLength(
  57199. Array.isArray(invokerFns)
  57200. ? invokerFns[0]
  57201. : invokerFns
  57202. )
  57203. } else {
  57204. return (fn._length || fn.length) > 1
  57205. }
  57206. }
  57207. function _enter (_, vnode) {
  57208. if (vnode.data.show !== true) {
  57209. enter(vnode);
  57210. }
  57211. }
  57212. var transition = inBrowser ? {
  57213. create: _enter,
  57214. activate: _enter,
  57215. remove: function remove$$1 (vnode, rm) {
  57216. /* istanbul ignore else */
  57217. if (vnode.data.show !== true) {
  57218. leave(vnode, rm);
  57219. } else {
  57220. rm();
  57221. }
  57222. }
  57223. } : {};
  57224. var platformModules = [
  57225. attrs,
  57226. klass,
  57227. events,
  57228. domProps,
  57229. style,
  57230. transition
  57231. ];
  57232. /* */
  57233. // the directive module should be applied last, after all
  57234. // built-in modules have been applied.
  57235. var modules = platformModules.concat(baseModules);
  57236. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  57237. /**
  57238. * Not type checking this file because flow doesn't like attaching
  57239. * properties to Elements.
  57240. */
  57241. /* istanbul ignore if */
  57242. if (isIE9) {
  57243. // http://www.matts411.com/post/internet-explorer-9-oninput/
  57244. document.addEventListener('selectionchange', function () {
  57245. var el = document.activeElement;
  57246. if (el && el.vmodel) {
  57247. trigger(el, 'input');
  57248. }
  57249. });
  57250. }
  57251. var directive = {
  57252. inserted: function inserted (el, binding, vnode, oldVnode) {
  57253. if (vnode.tag === 'select') {
  57254. // #6903
  57255. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  57256. mergeVNodeHook(vnode, 'postpatch', function () {
  57257. directive.componentUpdated(el, binding, vnode);
  57258. });
  57259. } else {
  57260. setSelected(el, binding, vnode.context);
  57261. }
  57262. el._vOptions = [].map.call(el.options, getValue);
  57263. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  57264. el._vModifiers = binding.modifiers;
  57265. if (!binding.modifiers.lazy) {
  57266. el.addEventListener('compositionstart', onCompositionStart);
  57267. el.addEventListener('compositionend', onCompositionEnd);
  57268. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  57269. // switching focus before confirming composition choice
  57270. // this also fixes the issue where some browsers e.g. iOS Chrome
  57271. // fires "change" instead of "input" on autocomplete.
  57272. el.addEventListener('change', onCompositionEnd);
  57273. /* istanbul ignore if */
  57274. if (isIE9) {
  57275. el.vmodel = true;
  57276. }
  57277. }
  57278. }
  57279. },
  57280. componentUpdated: function componentUpdated (el, binding, vnode) {
  57281. if (vnode.tag === 'select') {
  57282. setSelected(el, binding, vnode.context);
  57283. // in case the options rendered by v-for have changed,
  57284. // it's possible that the value is out-of-sync with the rendered options.
  57285. // detect such cases and filter out values that no longer has a matching
  57286. // option in the DOM.
  57287. var prevOptions = el._vOptions;
  57288. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  57289. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  57290. // trigger change event if
  57291. // no matching option found for at least one value
  57292. var needReset = el.multiple
  57293. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  57294. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  57295. if (needReset) {
  57296. trigger(el, 'change');
  57297. }
  57298. }
  57299. }
  57300. }
  57301. };
  57302. function setSelected (el, binding, vm) {
  57303. actuallySetSelected(el, binding, vm);
  57304. /* istanbul ignore if */
  57305. if (isIE || isEdge) {
  57306. setTimeout(function () {
  57307. actuallySetSelected(el, binding, vm);
  57308. }, 0);
  57309. }
  57310. }
  57311. function actuallySetSelected (el, binding, vm) {
  57312. var value = binding.value;
  57313. var isMultiple = el.multiple;
  57314. if (isMultiple && !Array.isArray(value)) {
  57315. warn(
  57316. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  57317. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  57318. vm
  57319. );
  57320. return
  57321. }
  57322. var selected, option;
  57323. for (var i = 0, l = el.options.length; i < l; i++) {
  57324. option = el.options[i];
  57325. if (isMultiple) {
  57326. selected = looseIndexOf(value, getValue(option)) > -1;
  57327. if (option.selected !== selected) {
  57328. option.selected = selected;
  57329. }
  57330. } else {
  57331. if (looseEqual(getValue(option), value)) {
  57332. if (el.selectedIndex !== i) {
  57333. el.selectedIndex = i;
  57334. }
  57335. return
  57336. }
  57337. }
  57338. }
  57339. if (!isMultiple) {
  57340. el.selectedIndex = -1;
  57341. }
  57342. }
  57343. function hasNoMatchingOption (value, options) {
  57344. return options.every(function (o) { return !looseEqual(o, value); })
  57345. }
  57346. function getValue (option) {
  57347. return '_value' in option
  57348. ? option._value
  57349. : option.value
  57350. }
  57351. function onCompositionStart (e) {
  57352. e.target.composing = true;
  57353. }
  57354. function onCompositionEnd (e) {
  57355. // prevent triggering an input event for no reason
  57356. if (!e.target.composing) { return }
  57357. e.target.composing = false;
  57358. trigger(e.target, 'input');
  57359. }
  57360. function trigger (el, type) {
  57361. var e = document.createEvent('HTMLEvents');
  57362. e.initEvent(type, true, true);
  57363. el.dispatchEvent(e);
  57364. }
  57365. /* */
  57366. // recursively search for possible transition defined inside the component root
  57367. function locateNode (vnode) {
  57368. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  57369. ? locateNode(vnode.componentInstance._vnode)
  57370. : vnode
  57371. }
  57372. var show = {
  57373. bind: function bind (el, ref, vnode) {
  57374. var value = ref.value;
  57375. vnode = locateNode(vnode);
  57376. var transition$$1 = vnode.data && vnode.data.transition;
  57377. var originalDisplay = el.__vOriginalDisplay =
  57378. el.style.display === 'none' ? '' : el.style.display;
  57379. if (value && transition$$1) {
  57380. vnode.data.show = true;
  57381. enter(vnode, function () {
  57382. el.style.display = originalDisplay;
  57383. });
  57384. } else {
  57385. el.style.display = value ? originalDisplay : 'none';
  57386. }
  57387. },
  57388. update: function update (el, ref, vnode) {
  57389. var value = ref.value;
  57390. var oldValue = ref.oldValue;
  57391. /* istanbul ignore if */
  57392. if (!value === !oldValue) { return }
  57393. vnode = locateNode(vnode);
  57394. var transition$$1 = vnode.data && vnode.data.transition;
  57395. if (transition$$1) {
  57396. vnode.data.show = true;
  57397. if (value) {
  57398. enter(vnode, function () {
  57399. el.style.display = el.__vOriginalDisplay;
  57400. });
  57401. } else {
  57402. leave(vnode, function () {
  57403. el.style.display = 'none';
  57404. });
  57405. }
  57406. } else {
  57407. el.style.display = value ? el.__vOriginalDisplay : 'none';
  57408. }
  57409. },
  57410. unbind: function unbind (
  57411. el,
  57412. binding,
  57413. vnode,
  57414. oldVnode,
  57415. isDestroy
  57416. ) {
  57417. if (!isDestroy) {
  57418. el.style.display = el.__vOriginalDisplay;
  57419. }
  57420. }
  57421. };
  57422. var platformDirectives = {
  57423. model: directive,
  57424. show: show
  57425. };
  57426. /* */
  57427. var transitionProps = {
  57428. name: String,
  57429. appear: Boolean,
  57430. css: Boolean,
  57431. mode: String,
  57432. type: String,
  57433. enterClass: String,
  57434. leaveClass: String,
  57435. enterToClass: String,
  57436. leaveToClass: String,
  57437. enterActiveClass: String,
  57438. leaveActiveClass: String,
  57439. appearClass: String,
  57440. appearActiveClass: String,
  57441. appearToClass: String,
  57442. duration: [Number, String, Object]
  57443. };
  57444. // in case the child is also an abstract component, e.g. <keep-alive>
  57445. // we want to recursively retrieve the real component to be rendered
  57446. function getRealChild (vnode) {
  57447. var compOptions = vnode && vnode.componentOptions;
  57448. if (compOptions && compOptions.Ctor.options.abstract) {
  57449. return getRealChild(getFirstComponentChild(compOptions.children))
  57450. } else {
  57451. return vnode
  57452. }
  57453. }
  57454. function extractTransitionData (comp) {
  57455. var data = {};
  57456. var options = comp.$options;
  57457. // props
  57458. for (var key in options.propsData) {
  57459. data[key] = comp[key];
  57460. }
  57461. // events.
  57462. // extract listeners and pass them directly to the transition methods
  57463. var listeners = options._parentListeners;
  57464. for (var key$1 in listeners) {
  57465. data[camelize(key$1)] = listeners[key$1];
  57466. }
  57467. return data
  57468. }
  57469. function placeholder (h, rawChild) {
  57470. if (/\d-keep-alive$/.test(rawChild.tag)) {
  57471. return h('keep-alive', {
  57472. props: rawChild.componentOptions.propsData
  57473. })
  57474. }
  57475. }
  57476. function hasParentTransition (vnode) {
  57477. while ((vnode = vnode.parent)) {
  57478. if (vnode.data.transition) {
  57479. return true
  57480. }
  57481. }
  57482. }
  57483. function isSameChild (child, oldChild) {
  57484. return oldChild.key === child.key && oldChild.tag === child.tag
  57485. }
  57486. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  57487. var isVShowDirective = function (d) { return d.name === 'show'; };
  57488. var Transition = {
  57489. name: 'transition',
  57490. props: transitionProps,
  57491. abstract: true,
  57492. render: function render (h) {
  57493. var this$1 = this;
  57494. var children = this.$slots.default;
  57495. if (!children) {
  57496. return
  57497. }
  57498. // filter out text nodes (possible whitespaces)
  57499. children = children.filter(isNotTextNode);
  57500. /* istanbul ignore if */
  57501. if (!children.length) {
  57502. return
  57503. }
  57504. // warn multiple elements
  57505. if (children.length > 1) {
  57506. warn(
  57507. '<transition> can only be used on a single element. Use ' +
  57508. '<transition-group> for lists.',
  57509. this.$parent
  57510. );
  57511. }
  57512. var mode = this.mode;
  57513. // warn invalid mode
  57514. if (mode && mode !== 'in-out' && mode !== 'out-in'
  57515. ) {
  57516. warn(
  57517. 'invalid <transition> mode: ' + mode,
  57518. this.$parent
  57519. );
  57520. }
  57521. var rawChild = children[0];
  57522. // if this is a component root node and the component's
  57523. // parent container node also has transition, skip.
  57524. if (hasParentTransition(this.$vnode)) {
  57525. return rawChild
  57526. }
  57527. // apply transition data to child
  57528. // use getRealChild() to ignore abstract components e.g. keep-alive
  57529. var child = getRealChild(rawChild);
  57530. /* istanbul ignore if */
  57531. if (!child) {
  57532. return rawChild
  57533. }
  57534. if (this._leaving) {
  57535. return placeholder(h, rawChild)
  57536. }
  57537. // ensure a key that is unique to the vnode type and to this transition
  57538. // component instance. This key will be used to remove pending leaving nodes
  57539. // during entering.
  57540. var id = "__transition-" + (this._uid) + "-";
  57541. child.key = child.key == null
  57542. ? child.isComment
  57543. ? id + 'comment'
  57544. : id + child.tag
  57545. : isPrimitive(child.key)
  57546. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  57547. : child.key;
  57548. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  57549. var oldRawChild = this._vnode;
  57550. var oldChild = getRealChild(oldRawChild);
  57551. // mark v-show
  57552. // so that the transition module can hand over the control to the directive
  57553. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  57554. child.data.show = true;
  57555. }
  57556. if (
  57557. oldChild &&
  57558. oldChild.data &&
  57559. !isSameChild(child, oldChild) &&
  57560. !isAsyncPlaceholder(oldChild) &&
  57561. // #6687 component root is a comment node
  57562. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  57563. ) {
  57564. // replace old child transition data with fresh one
  57565. // important for dynamic transitions!
  57566. var oldData = oldChild.data.transition = extend({}, data);
  57567. // handle transition mode
  57568. if (mode === 'out-in') {
  57569. // return placeholder node and queue update when leave finishes
  57570. this._leaving = true;
  57571. mergeVNodeHook(oldData, 'afterLeave', function () {
  57572. this$1._leaving = false;
  57573. this$1.$forceUpdate();
  57574. });
  57575. return placeholder(h, rawChild)
  57576. } else if (mode === 'in-out') {
  57577. if (isAsyncPlaceholder(child)) {
  57578. return oldRawChild
  57579. }
  57580. var delayedLeave;
  57581. var performLeave = function () { delayedLeave(); };
  57582. mergeVNodeHook(data, 'afterEnter', performLeave);
  57583. mergeVNodeHook(data, 'enterCancelled', performLeave);
  57584. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  57585. }
  57586. }
  57587. return rawChild
  57588. }
  57589. };
  57590. /* */
  57591. var props = extend({
  57592. tag: String,
  57593. moveClass: String
  57594. }, transitionProps);
  57595. delete props.mode;
  57596. var TransitionGroup = {
  57597. props: props,
  57598. beforeMount: function beforeMount () {
  57599. var this$1 = this;
  57600. var update = this._update;
  57601. this._update = function (vnode, hydrating) {
  57602. var restoreActiveInstance = setActiveInstance(this$1);
  57603. // force removing pass
  57604. this$1.__patch__(
  57605. this$1._vnode,
  57606. this$1.kept,
  57607. false, // hydrating
  57608. true // removeOnly (!important, avoids unnecessary moves)
  57609. );
  57610. this$1._vnode = this$1.kept;
  57611. restoreActiveInstance();
  57612. update.call(this$1, vnode, hydrating);
  57613. };
  57614. },
  57615. render: function render (h) {
  57616. var tag = this.tag || this.$vnode.data.tag || 'span';
  57617. var map = Object.create(null);
  57618. var prevChildren = this.prevChildren = this.children;
  57619. var rawChildren = this.$slots.default || [];
  57620. var children = this.children = [];
  57621. var transitionData = extractTransitionData(this);
  57622. for (var i = 0; i < rawChildren.length; i++) {
  57623. var c = rawChildren[i];
  57624. if (c.tag) {
  57625. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  57626. children.push(c);
  57627. map[c.key] = c
  57628. ;(c.data || (c.data = {})).transition = transitionData;
  57629. } else {
  57630. var opts = c.componentOptions;
  57631. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  57632. warn(("<transition-group> children must be keyed: <" + name + ">"));
  57633. }
  57634. }
  57635. }
  57636. if (prevChildren) {
  57637. var kept = [];
  57638. var removed = [];
  57639. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  57640. var c$1 = prevChildren[i$1];
  57641. c$1.data.transition = transitionData;
  57642. c$1.data.pos = c$1.elm.getBoundingClientRect();
  57643. if (map[c$1.key]) {
  57644. kept.push(c$1);
  57645. } else {
  57646. removed.push(c$1);
  57647. }
  57648. }
  57649. this.kept = h(tag, null, kept);
  57650. this.removed = removed;
  57651. }
  57652. return h(tag, null, children)
  57653. },
  57654. updated: function updated () {
  57655. var children = this.prevChildren;
  57656. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  57657. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  57658. return
  57659. }
  57660. // we divide the work into three loops to avoid mixing DOM reads and writes
  57661. // in each iteration - which helps prevent layout thrashing.
  57662. children.forEach(callPendingCbs);
  57663. children.forEach(recordPosition);
  57664. children.forEach(applyTranslation);
  57665. // force reflow to put everything in position
  57666. // assign to this to avoid being removed in tree-shaking
  57667. // $flow-disable-line
  57668. this._reflow = document.body.offsetHeight;
  57669. children.forEach(function (c) {
  57670. if (c.data.moved) {
  57671. var el = c.elm;
  57672. var s = el.style;
  57673. addTransitionClass(el, moveClass);
  57674. s.transform = s.WebkitTransform = s.transitionDuration = '';
  57675. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  57676. if (e && e.target !== el) {
  57677. return
  57678. }
  57679. if (!e || /transform$/.test(e.propertyName)) {
  57680. el.removeEventListener(transitionEndEvent, cb);
  57681. el._moveCb = null;
  57682. removeTransitionClass(el, moveClass);
  57683. }
  57684. });
  57685. }
  57686. });
  57687. },
  57688. methods: {
  57689. hasMove: function hasMove (el, moveClass) {
  57690. /* istanbul ignore if */
  57691. if (!hasTransition) {
  57692. return false
  57693. }
  57694. /* istanbul ignore if */
  57695. if (this._hasMove) {
  57696. return this._hasMove
  57697. }
  57698. // Detect whether an element with the move class applied has
  57699. // CSS transitions. Since the element may be inside an entering
  57700. // transition at this very moment, we make a clone of it and remove
  57701. // all other transition classes applied to ensure only the move class
  57702. // is applied.
  57703. var clone = el.cloneNode();
  57704. if (el._transitionClasses) {
  57705. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  57706. }
  57707. addClass(clone, moveClass);
  57708. clone.style.display = 'none';
  57709. this.$el.appendChild(clone);
  57710. var info = getTransitionInfo(clone);
  57711. this.$el.removeChild(clone);
  57712. return (this._hasMove = info.hasTransform)
  57713. }
  57714. }
  57715. };
  57716. function callPendingCbs (c) {
  57717. /* istanbul ignore if */
  57718. if (c.elm._moveCb) {
  57719. c.elm._moveCb();
  57720. }
  57721. /* istanbul ignore if */
  57722. if (c.elm._enterCb) {
  57723. c.elm._enterCb();
  57724. }
  57725. }
  57726. function recordPosition (c) {
  57727. c.data.newPos = c.elm.getBoundingClientRect();
  57728. }
  57729. function applyTranslation (c) {
  57730. var oldPos = c.data.pos;
  57731. var newPos = c.data.newPos;
  57732. var dx = oldPos.left - newPos.left;
  57733. var dy = oldPos.top - newPos.top;
  57734. if (dx || dy) {
  57735. c.data.moved = true;
  57736. var s = c.elm.style;
  57737. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  57738. s.transitionDuration = '0s';
  57739. }
  57740. }
  57741. var platformComponents = {
  57742. Transition: Transition,
  57743. TransitionGroup: TransitionGroup
  57744. };
  57745. /* */
  57746. // install platform specific utils
  57747. Vue.config.mustUseProp = mustUseProp;
  57748. Vue.config.isReservedTag = isReservedTag;
  57749. Vue.config.isReservedAttr = isReservedAttr;
  57750. Vue.config.getTagNamespace = getTagNamespace;
  57751. Vue.config.isUnknownElement = isUnknownElement;
  57752. // install platform runtime directives & components
  57753. extend(Vue.options.directives, platformDirectives);
  57754. extend(Vue.options.components, platformComponents);
  57755. // install platform patch function
  57756. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  57757. // public mount method
  57758. Vue.prototype.$mount = function (
  57759. el,
  57760. hydrating
  57761. ) {
  57762. el = el && inBrowser ? query(el) : undefined;
  57763. return mountComponent(this, el, hydrating)
  57764. };
  57765. // devtools global hook
  57766. /* istanbul ignore next */
  57767. if (inBrowser) {
  57768. setTimeout(function () {
  57769. if (config.devtools) {
  57770. if (devtools) {
  57771. devtools.emit('init', Vue);
  57772. } else {
  57773. console[console.info ? 'info' : 'log'](
  57774. 'Download the Vue Devtools extension for a better development experience:\n' +
  57775. 'https://github.com/vuejs/vue-devtools'
  57776. );
  57777. }
  57778. }
  57779. if (config.productionTip !== false &&
  57780. typeof console !== 'undefined'
  57781. ) {
  57782. console[console.info ? 'info' : 'log'](
  57783. "You are running Vue in development mode.\n" +
  57784. "Make sure to turn on production mode when deploying for production.\n" +
  57785. "See more tips at https://vuejs.org/guide/deployment.html"
  57786. );
  57787. }
  57788. }, 0);
  57789. }
  57790. /* */
  57791. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  57792. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  57793. var buildRegex = cached(function (delimiters) {
  57794. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  57795. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  57796. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  57797. });
  57798. function parseText (
  57799. text,
  57800. delimiters
  57801. ) {
  57802. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  57803. if (!tagRE.test(text)) {
  57804. return
  57805. }
  57806. var tokens = [];
  57807. var rawTokens = [];
  57808. var lastIndex = tagRE.lastIndex = 0;
  57809. var match, index, tokenValue;
  57810. while ((match = tagRE.exec(text))) {
  57811. index = match.index;
  57812. // push text token
  57813. if (index > lastIndex) {
  57814. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  57815. tokens.push(JSON.stringify(tokenValue));
  57816. }
  57817. // tag token
  57818. var exp = parseFilters(match[1].trim());
  57819. tokens.push(("_s(" + exp + ")"));
  57820. rawTokens.push({ '@binding': exp });
  57821. lastIndex = index + match[0].length;
  57822. }
  57823. if (lastIndex < text.length) {
  57824. rawTokens.push(tokenValue = text.slice(lastIndex));
  57825. tokens.push(JSON.stringify(tokenValue));
  57826. }
  57827. return {
  57828. expression: tokens.join('+'),
  57829. tokens: rawTokens
  57830. }
  57831. }
  57832. /* */
  57833. function transformNode (el, options) {
  57834. var warn = options.warn || baseWarn;
  57835. var staticClass = getAndRemoveAttr(el, 'class');
  57836. if (staticClass) {
  57837. var res = parseText(staticClass, options.delimiters);
  57838. if (res) {
  57839. warn(
  57840. "class=\"" + staticClass + "\": " +
  57841. 'Interpolation inside attributes has been removed. ' +
  57842. 'Use v-bind or the colon shorthand instead. For example, ' +
  57843. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  57844. el.rawAttrsMap['class']
  57845. );
  57846. }
  57847. }
  57848. if (staticClass) {
  57849. el.staticClass = JSON.stringify(staticClass);
  57850. }
  57851. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  57852. if (classBinding) {
  57853. el.classBinding = classBinding;
  57854. }
  57855. }
  57856. function genData (el) {
  57857. var data = '';
  57858. if (el.staticClass) {
  57859. data += "staticClass:" + (el.staticClass) + ",";
  57860. }
  57861. if (el.classBinding) {
  57862. data += "class:" + (el.classBinding) + ",";
  57863. }
  57864. return data
  57865. }
  57866. var klass$1 = {
  57867. staticKeys: ['staticClass'],
  57868. transformNode: transformNode,
  57869. genData: genData
  57870. };
  57871. /* */
  57872. function transformNode$1 (el, options) {
  57873. var warn = options.warn || baseWarn;
  57874. var staticStyle = getAndRemoveAttr(el, 'style');
  57875. if (staticStyle) {
  57876. /* istanbul ignore if */
  57877. {
  57878. var res = parseText(staticStyle, options.delimiters);
  57879. if (res) {
  57880. warn(
  57881. "style=\"" + staticStyle + "\": " +
  57882. 'Interpolation inside attributes has been removed. ' +
  57883. 'Use v-bind or the colon shorthand instead. For example, ' +
  57884. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  57885. el.rawAttrsMap['style']
  57886. );
  57887. }
  57888. }
  57889. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  57890. }
  57891. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  57892. if (styleBinding) {
  57893. el.styleBinding = styleBinding;
  57894. }
  57895. }
  57896. function genData$1 (el) {
  57897. var data = '';
  57898. if (el.staticStyle) {
  57899. data += "staticStyle:" + (el.staticStyle) + ",";
  57900. }
  57901. if (el.styleBinding) {
  57902. data += "style:(" + (el.styleBinding) + "),";
  57903. }
  57904. return data
  57905. }
  57906. var style$1 = {
  57907. staticKeys: ['staticStyle'],
  57908. transformNode: transformNode$1,
  57909. genData: genData$1
  57910. };
  57911. /* */
  57912. var decoder;
  57913. var he = {
  57914. decode: function decode (html) {
  57915. decoder = decoder || document.createElement('div');
  57916. decoder.innerHTML = html;
  57917. return decoder.textContent
  57918. }
  57919. };
  57920. /* */
  57921. var isUnaryTag = makeMap(
  57922. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  57923. 'link,meta,param,source,track,wbr'
  57924. );
  57925. // Elements that you can, intentionally, leave open
  57926. // (and which close themselves)
  57927. var canBeLeftOpenTag = makeMap(
  57928. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  57929. );
  57930. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  57931. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  57932. var isNonPhrasingTag = makeMap(
  57933. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  57934. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  57935. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  57936. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  57937. 'title,tr,track'
  57938. );
  57939. /**
  57940. * Not type-checking this file because it's mostly vendor code.
  57941. */
  57942. // Regular Expressions for parsing tags and attributes
  57943. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  57944. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  57945. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  57946. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  57947. var startTagOpen = new RegExp(("^<" + qnameCapture));
  57948. var startTagClose = /^\s*(\/?)>/;
  57949. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  57950. var doctype = /^<!DOCTYPE [^>]+>/i;
  57951. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  57952. var comment = /^<!\--/;
  57953. var conditionalComment = /^<!\[/;
  57954. // Special Elements (can contain anything)
  57955. var isPlainTextElement = makeMap('script,style,textarea', true);
  57956. var reCache = {};
  57957. var decodingMap = {
  57958. '&lt;': '<',
  57959. '&gt;': '>',
  57960. '&quot;': '"',
  57961. '&amp;': '&',
  57962. '&#10;': '\n',
  57963. '&#9;': '\t',
  57964. '&#39;': "'"
  57965. };
  57966. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  57967. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  57968. // #5992
  57969. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  57970. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  57971. function decodeAttr (value, shouldDecodeNewlines) {
  57972. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  57973. return value.replace(re, function (match) { return decodingMap[match]; })
  57974. }
  57975. function parseHTML (html, options) {
  57976. var stack = [];
  57977. var expectHTML = options.expectHTML;
  57978. var isUnaryTag$$1 = options.isUnaryTag || no;
  57979. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  57980. var index = 0;
  57981. var last, lastTag;
  57982. while (html) {
  57983. last = html;
  57984. // Make sure we're not in a plaintext content element like script/style
  57985. if (!lastTag || !isPlainTextElement(lastTag)) {
  57986. var textEnd = html.indexOf('<');
  57987. if (textEnd === 0) {
  57988. // Comment:
  57989. if (comment.test(html)) {
  57990. var commentEnd = html.indexOf('-->');
  57991. if (commentEnd >= 0) {
  57992. if (options.shouldKeepComment) {
  57993. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  57994. }
  57995. advance(commentEnd + 3);
  57996. continue
  57997. }
  57998. }
  57999. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  58000. if (conditionalComment.test(html)) {
  58001. var conditionalEnd = html.indexOf(']>');
  58002. if (conditionalEnd >= 0) {
  58003. advance(conditionalEnd + 2);
  58004. continue
  58005. }
  58006. }
  58007. // Doctype:
  58008. var doctypeMatch = html.match(doctype);
  58009. if (doctypeMatch) {
  58010. advance(doctypeMatch[0].length);
  58011. continue
  58012. }
  58013. // End tag:
  58014. var endTagMatch = html.match(endTag);
  58015. if (endTagMatch) {
  58016. var curIndex = index;
  58017. advance(endTagMatch[0].length);
  58018. parseEndTag(endTagMatch[1], curIndex, index);
  58019. continue
  58020. }
  58021. // Start tag:
  58022. var startTagMatch = parseStartTag();
  58023. if (startTagMatch) {
  58024. handleStartTag(startTagMatch);
  58025. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  58026. advance(1);
  58027. }
  58028. continue
  58029. }
  58030. }
  58031. var text = (void 0), rest = (void 0), next = (void 0);
  58032. if (textEnd >= 0) {
  58033. rest = html.slice(textEnd);
  58034. while (
  58035. !endTag.test(rest) &&
  58036. !startTagOpen.test(rest) &&
  58037. !comment.test(rest) &&
  58038. !conditionalComment.test(rest)
  58039. ) {
  58040. // < in plain text, be forgiving and treat it as text
  58041. next = rest.indexOf('<', 1);
  58042. if (next < 0) { break }
  58043. textEnd += next;
  58044. rest = html.slice(textEnd);
  58045. }
  58046. text = html.substring(0, textEnd);
  58047. }
  58048. if (textEnd < 0) {
  58049. text = html;
  58050. }
  58051. if (text) {
  58052. advance(text.length);
  58053. }
  58054. if (options.chars && text) {
  58055. options.chars(text, index - text.length, index);
  58056. }
  58057. } else {
  58058. var endTagLength = 0;
  58059. var stackedTag = lastTag.toLowerCase();
  58060. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  58061. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  58062. endTagLength = endTag.length;
  58063. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  58064. text = text
  58065. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  58066. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  58067. }
  58068. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  58069. text = text.slice(1);
  58070. }
  58071. if (options.chars) {
  58072. options.chars(text);
  58073. }
  58074. return ''
  58075. });
  58076. index += html.length - rest$1.length;
  58077. html = rest$1;
  58078. parseEndTag(stackedTag, index - endTagLength, index);
  58079. }
  58080. if (html === last) {
  58081. options.chars && options.chars(html);
  58082. if (!stack.length && options.warn) {
  58083. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  58084. }
  58085. break
  58086. }
  58087. }
  58088. // Clean up any remaining tags
  58089. parseEndTag();
  58090. function advance (n) {
  58091. index += n;
  58092. html = html.substring(n);
  58093. }
  58094. function parseStartTag () {
  58095. var start = html.match(startTagOpen);
  58096. if (start) {
  58097. var match = {
  58098. tagName: start[1],
  58099. attrs: [],
  58100. start: index
  58101. };
  58102. advance(start[0].length);
  58103. var end, attr;
  58104. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  58105. attr.start = index;
  58106. advance(attr[0].length);
  58107. attr.end = index;
  58108. match.attrs.push(attr);
  58109. }
  58110. if (end) {
  58111. match.unarySlash = end[1];
  58112. advance(end[0].length);
  58113. match.end = index;
  58114. return match
  58115. }
  58116. }
  58117. }
  58118. function handleStartTag (match) {
  58119. var tagName = match.tagName;
  58120. var unarySlash = match.unarySlash;
  58121. if (expectHTML) {
  58122. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  58123. parseEndTag(lastTag);
  58124. }
  58125. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  58126. parseEndTag(tagName);
  58127. }
  58128. }
  58129. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  58130. var l = match.attrs.length;
  58131. var attrs = new Array(l);
  58132. for (var i = 0; i < l; i++) {
  58133. var args = match.attrs[i];
  58134. var value = args[3] || args[4] || args[5] || '';
  58135. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  58136. ? options.shouldDecodeNewlinesForHref
  58137. : options.shouldDecodeNewlines;
  58138. attrs[i] = {
  58139. name: args[1],
  58140. value: decodeAttr(value, shouldDecodeNewlines)
  58141. };
  58142. if (options.outputSourceRange) {
  58143. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  58144. attrs[i].end = args.end;
  58145. }
  58146. }
  58147. if (!unary) {
  58148. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  58149. lastTag = tagName;
  58150. }
  58151. if (options.start) {
  58152. options.start(tagName, attrs, unary, match.start, match.end);
  58153. }
  58154. }
  58155. function parseEndTag (tagName, start, end) {
  58156. var pos, lowerCasedTagName;
  58157. if (start == null) { start = index; }
  58158. if (end == null) { end = index; }
  58159. // Find the closest opened tag of the same type
  58160. if (tagName) {
  58161. lowerCasedTagName = tagName.toLowerCase();
  58162. for (pos = stack.length - 1; pos >= 0; pos--) {
  58163. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  58164. break
  58165. }
  58166. }
  58167. } else {
  58168. // If no tag name is provided, clean shop
  58169. pos = 0;
  58170. }
  58171. if (pos >= 0) {
  58172. // Close all the open elements, up the stack
  58173. for (var i = stack.length - 1; i >= pos; i--) {
  58174. if (i > pos || !tagName &&
  58175. options.warn
  58176. ) {
  58177. options.warn(
  58178. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  58179. { start: stack[i].start, end: stack[i].end }
  58180. );
  58181. }
  58182. if (options.end) {
  58183. options.end(stack[i].tag, start, end);
  58184. }
  58185. }
  58186. // Remove the open elements from the stack
  58187. stack.length = pos;
  58188. lastTag = pos && stack[pos - 1].tag;
  58189. } else if (lowerCasedTagName === 'br') {
  58190. if (options.start) {
  58191. options.start(tagName, [], true, start, end);
  58192. }
  58193. } else if (lowerCasedTagName === 'p') {
  58194. if (options.start) {
  58195. options.start(tagName, [], false, start, end);
  58196. }
  58197. if (options.end) {
  58198. options.end(tagName, start, end);
  58199. }
  58200. }
  58201. }
  58202. }
  58203. /* */
  58204. var onRE = /^@|^v-on:/;
  58205. var dirRE = /^v-|^@|^:|^#/;
  58206. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  58207. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  58208. var stripParensRE = /^\(|\)$/g;
  58209. var dynamicArgRE = /^\[.*\]$/;
  58210. var argRE = /:(.*)$/;
  58211. var bindRE = /^:|^\.|^v-bind:/;
  58212. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  58213. var slotRE = /^v-slot(:|$)|^#/;
  58214. var lineBreakRE = /[\r\n]/;
  58215. var whitespaceRE$1 = /\s+/g;
  58216. var invalidAttributeRE = /[\s"'<>\/=]/;
  58217. var decodeHTMLCached = cached(he.decode);
  58218. var emptySlotScopeToken = "_empty_";
  58219. // configurable state
  58220. var warn$2;
  58221. var delimiters;
  58222. var transforms;
  58223. var preTransforms;
  58224. var postTransforms;
  58225. var platformIsPreTag;
  58226. var platformMustUseProp;
  58227. var platformGetTagNamespace;
  58228. var maybeComponent;
  58229. function createASTElement (
  58230. tag,
  58231. attrs,
  58232. parent
  58233. ) {
  58234. return {
  58235. type: 1,
  58236. tag: tag,
  58237. attrsList: attrs,
  58238. attrsMap: makeAttrsMap(attrs),
  58239. rawAttrsMap: {},
  58240. parent: parent,
  58241. children: []
  58242. }
  58243. }
  58244. /**
  58245. * Convert HTML string to AST.
  58246. */
  58247. function parse (
  58248. template,
  58249. options
  58250. ) {
  58251. warn$2 = options.warn || baseWarn;
  58252. platformIsPreTag = options.isPreTag || no;
  58253. platformMustUseProp = options.mustUseProp || no;
  58254. platformGetTagNamespace = options.getTagNamespace || no;
  58255. var isReservedTag = options.isReservedTag || no;
  58256. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  58257. transforms = pluckModuleFunction(options.modules, 'transformNode');
  58258. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  58259. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  58260. delimiters = options.delimiters;
  58261. var stack = [];
  58262. var preserveWhitespace = options.preserveWhitespace !== false;
  58263. var whitespaceOption = options.whitespace;
  58264. var root;
  58265. var currentParent;
  58266. var inVPre = false;
  58267. var inPre = false;
  58268. var warned = false;
  58269. function warnOnce (msg, range) {
  58270. if (!warned) {
  58271. warned = true;
  58272. warn$2(msg, range);
  58273. }
  58274. }
  58275. function closeElement (element) {
  58276. trimEndingWhitespace(element);
  58277. if (!inVPre && !element.processed) {
  58278. element = processElement(element, options);
  58279. }
  58280. // tree management
  58281. if (!stack.length && element !== root) {
  58282. // allow root elements with v-if, v-else-if and v-else
  58283. if (root.if && (element.elseif || element.else)) {
  58284. {
  58285. checkRootConstraints(element);
  58286. }
  58287. addIfCondition(root, {
  58288. exp: element.elseif,
  58289. block: element
  58290. });
  58291. } else {
  58292. warnOnce(
  58293. "Component template should contain exactly one root element. " +
  58294. "If you are using v-if on multiple elements, " +
  58295. "use v-else-if to chain them instead.",
  58296. { start: element.start }
  58297. );
  58298. }
  58299. }
  58300. if (currentParent && !element.forbidden) {
  58301. if (element.elseif || element.else) {
  58302. processIfConditions(element, currentParent);
  58303. } else {
  58304. if (element.slotScope) {
  58305. // scoped slot
  58306. // keep it in the children list so that v-else(-if) conditions can
  58307. // find it as the prev node.
  58308. var name = element.slotTarget || '"default"'
  58309. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  58310. }
  58311. currentParent.children.push(element);
  58312. element.parent = currentParent;
  58313. }
  58314. }
  58315. // final children cleanup
  58316. // filter out scoped slots
  58317. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  58318. // remove trailing whitespace node again
  58319. trimEndingWhitespace(element);
  58320. // check pre state
  58321. if (element.pre) {
  58322. inVPre = false;
  58323. }
  58324. if (platformIsPreTag(element.tag)) {
  58325. inPre = false;
  58326. }
  58327. // apply post-transforms
  58328. for (var i = 0; i < postTransforms.length; i++) {
  58329. postTransforms[i](element, options);
  58330. }
  58331. }
  58332. function trimEndingWhitespace (el) {
  58333. // remove trailing whitespace node
  58334. if (!inPre) {
  58335. var lastNode;
  58336. while (
  58337. (lastNode = el.children[el.children.length - 1]) &&
  58338. lastNode.type === 3 &&
  58339. lastNode.text === ' '
  58340. ) {
  58341. el.children.pop();
  58342. }
  58343. }
  58344. }
  58345. function checkRootConstraints (el) {
  58346. if (el.tag === 'slot' || el.tag === 'template') {
  58347. warnOnce(
  58348. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  58349. 'contain multiple nodes.',
  58350. { start: el.start }
  58351. );
  58352. }
  58353. if (el.attrsMap.hasOwnProperty('v-for')) {
  58354. warnOnce(
  58355. 'Cannot use v-for on stateful component root element because ' +
  58356. 'it renders multiple elements.',
  58357. el.rawAttrsMap['v-for']
  58358. );
  58359. }
  58360. }
  58361. parseHTML(template, {
  58362. warn: warn$2,
  58363. expectHTML: options.expectHTML,
  58364. isUnaryTag: options.isUnaryTag,
  58365. canBeLeftOpenTag: options.canBeLeftOpenTag,
  58366. shouldDecodeNewlines: options.shouldDecodeNewlines,
  58367. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  58368. shouldKeepComment: options.comments,
  58369. outputSourceRange: options.outputSourceRange,
  58370. start: function start (tag, attrs, unary, start$1, end) {
  58371. // check namespace.
  58372. // inherit parent ns if there is one
  58373. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  58374. // handle IE svg bug
  58375. /* istanbul ignore if */
  58376. if (isIE && ns === 'svg') {
  58377. attrs = guardIESVGBug(attrs);
  58378. }
  58379. var element = createASTElement(tag, attrs, currentParent);
  58380. if (ns) {
  58381. element.ns = ns;
  58382. }
  58383. {
  58384. if (options.outputSourceRange) {
  58385. element.start = start$1;
  58386. element.end = end;
  58387. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  58388. cumulated[attr.name] = attr;
  58389. return cumulated
  58390. }, {});
  58391. }
  58392. attrs.forEach(function (attr) {
  58393. if (invalidAttributeRE.test(attr.name)) {
  58394. warn$2(
  58395. "Invalid dynamic argument expression: attribute names cannot contain " +
  58396. "spaces, quotes, <, >, / or =.",
  58397. {
  58398. start: attr.start + attr.name.indexOf("["),
  58399. end: attr.start + attr.name.length
  58400. }
  58401. );
  58402. }
  58403. });
  58404. }
  58405. if (isForbiddenTag(element) && !isServerRendering()) {
  58406. element.forbidden = true;
  58407. warn$2(
  58408. 'Templates should only be responsible for mapping the state to the ' +
  58409. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  58410. "<" + tag + ">" + ', as they will not be parsed.',
  58411. { start: element.start }
  58412. );
  58413. }
  58414. // apply pre-transforms
  58415. for (var i = 0; i < preTransforms.length; i++) {
  58416. element = preTransforms[i](element, options) || element;
  58417. }
  58418. if (!inVPre) {
  58419. processPre(element);
  58420. if (element.pre) {
  58421. inVPre = true;
  58422. }
  58423. }
  58424. if (platformIsPreTag(element.tag)) {
  58425. inPre = true;
  58426. }
  58427. if (inVPre) {
  58428. processRawAttrs(element);
  58429. } else if (!element.processed) {
  58430. // structural directives
  58431. processFor(element);
  58432. processIf(element);
  58433. processOnce(element);
  58434. }
  58435. if (!root) {
  58436. root = element;
  58437. {
  58438. checkRootConstraints(root);
  58439. }
  58440. }
  58441. if (!unary) {
  58442. currentParent = element;
  58443. stack.push(element);
  58444. } else {
  58445. closeElement(element);
  58446. }
  58447. },
  58448. end: function end (tag, start, end$1) {
  58449. var element = stack[stack.length - 1];
  58450. // pop stack
  58451. stack.length -= 1;
  58452. currentParent = stack[stack.length - 1];
  58453. if (options.outputSourceRange) {
  58454. element.end = end$1;
  58455. }
  58456. closeElement(element);
  58457. },
  58458. chars: function chars (text, start, end) {
  58459. if (!currentParent) {
  58460. {
  58461. if (text === template) {
  58462. warnOnce(
  58463. 'Component template requires a root element, rather than just text.',
  58464. { start: start }
  58465. );
  58466. } else if ((text = text.trim())) {
  58467. warnOnce(
  58468. ("text \"" + text + "\" outside root element will be ignored."),
  58469. { start: start }
  58470. );
  58471. }
  58472. }
  58473. return
  58474. }
  58475. // IE textarea placeholder bug
  58476. /* istanbul ignore if */
  58477. if (isIE &&
  58478. currentParent.tag === 'textarea' &&
  58479. currentParent.attrsMap.placeholder === text
  58480. ) {
  58481. return
  58482. }
  58483. var children = currentParent.children;
  58484. if (inPre || text.trim()) {
  58485. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  58486. } else if (!children.length) {
  58487. // remove the whitespace-only node right after an opening tag
  58488. text = '';
  58489. } else if (whitespaceOption) {
  58490. if (whitespaceOption === 'condense') {
  58491. // in condense mode, remove the whitespace node if it contains
  58492. // line break, otherwise condense to a single space
  58493. text = lineBreakRE.test(text) ? '' : ' ';
  58494. } else {
  58495. text = ' ';
  58496. }
  58497. } else {
  58498. text = preserveWhitespace ? ' ' : '';
  58499. }
  58500. if (text) {
  58501. if (!inPre && whitespaceOption === 'condense') {
  58502. // condense consecutive whitespaces into single space
  58503. text = text.replace(whitespaceRE$1, ' ');
  58504. }
  58505. var res;
  58506. var child;
  58507. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  58508. child = {
  58509. type: 2,
  58510. expression: res.expression,
  58511. tokens: res.tokens,
  58512. text: text
  58513. };
  58514. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  58515. child = {
  58516. type: 3,
  58517. text: text
  58518. };
  58519. }
  58520. if (child) {
  58521. if (options.outputSourceRange) {
  58522. child.start = start;
  58523. child.end = end;
  58524. }
  58525. children.push(child);
  58526. }
  58527. }
  58528. },
  58529. comment: function comment (text, start, end) {
  58530. // adding anyting as a sibling to the root node is forbidden
  58531. // comments should still be allowed, but ignored
  58532. if (currentParent) {
  58533. var child = {
  58534. type: 3,
  58535. text: text,
  58536. isComment: true
  58537. };
  58538. if (options.outputSourceRange) {
  58539. child.start = start;
  58540. child.end = end;
  58541. }
  58542. currentParent.children.push(child);
  58543. }
  58544. }
  58545. });
  58546. return root
  58547. }
  58548. function processPre (el) {
  58549. if (getAndRemoveAttr(el, 'v-pre') != null) {
  58550. el.pre = true;
  58551. }
  58552. }
  58553. function processRawAttrs (el) {
  58554. var list = el.attrsList;
  58555. var len = list.length;
  58556. if (len) {
  58557. var attrs = el.attrs = new Array(len);
  58558. for (var i = 0; i < len; i++) {
  58559. attrs[i] = {
  58560. name: list[i].name,
  58561. value: JSON.stringify(list[i].value)
  58562. };
  58563. if (list[i].start != null) {
  58564. attrs[i].start = list[i].start;
  58565. attrs[i].end = list[i].end;
  58566. }
  58567. }
  58568. } else if (!el.pre) {
  58569. // non root node in pre blocks with no attributes
  58570. el.plain = true;
  58571. }
  58572. }
  58573. function processElement (
  58574. element,
  58575. options
  58576. ) {
  58577. processKey(element);
  58578. // determine whether this is a plain element after
  58579. // removing structural attributes
  58580. element.plain = (
  58581. !element.key &&
  58582. !element.scopedSlots &&
  58583. !element.attrsList.length
  58584. );
  58585. processRef(element);
  58586. processSlotContent(element);
  58587. processSlotOutlet(element);
  58588. processComponent(element);
  58589. for (var i = 0; i < transforms.length; i++) {
  58590. element = transforms[i](element, options) || element;
  58591. }
  58592. processAttrs(element);
  58593. return element
  58594. }
  58595. function processKey (el) {
  58596. var exp = getBindingAttr(el, 'key');
  58597. if (exp) {
  58598. {
  58599. if (el.tag === 'template') {
  58600. warn$2(
  58601. "<template> cannot be keyed. Place the key on real elements instead.",
  58602. getRawBindingAttr(el, 'key')
  58603. );
  58604. }
  58605. if (el.for) {
  58606. var iterator = el.iterator2 || el.iterator1;
  58607. var parent = el.parent;
  58608. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  58609. warn$2(
  58610. "Do not use v-for index as key on <transition-group> children, " +
  58611. "this is the same as not using keys.",
  58612. getRawBindingAttr(el, 'key'),
  58613. true /* tip */
  58614. );
  58615. }
  58616. }
  58617. }
  58618. el.key = exp;
  58619. }
  58620. }
  58621. function processRef (el) {
  58622. var ref = getBindingAttr(el, 'ref');
  58623. if (ref) {
  58624. el.ref = ref;
  58625. el.refInFor = checkInFor(el);
  58626. }
  58627. }
  58628. function processFor (el) {
  58629. var exp;
  58630. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  58631. var res = parseFor(exp);
  58632. if (res) {
  58633. extend(el, res);
  58634. } else {
  58635. warn$2(
  58636. ("Invalid v-for expression: " + exp),
  58637. el.rawAttrsMap['v-for']
  58638. );
  58639. }
  58640. }
  58641. }
  58642. function parseFor (exp) {
  58643. var inMatch = exp.match(forAliasRE);
  58644. if (!inMatch) { return }
  58645. var res = {};
  58646. res.for = inMatch[2].trim();
  58647. var alias = inMatch[1].trim().replace(stripParensRE, '');
  58648. var iteratorMatch = alias.match(forIteratorRE);
  58649. if (iteratorMatch) {
  58650. res.alias = alias.replace(forIteratorRE, '').trim();
  58651. res.iterator1 = iteratorMatch[1].trim();
  58652. if (iteratorMatch[2]) {
  58653. res.iterator2 = iteratorMatch[2].trim();
  58654. }
  58655. } else {
  58656. res.alias = alias;
  58657. }
  58658. return res
  58659. }
  58660. function processIf (el) {
  58661. var exp = getAndRemoveAttr(el, 'v-if');
  58662. if (exp) {
  58663. el.if = exp;
  58664. addIfCondition(el, {
  58665. exp: exp,
  58666. block: el
  58667. });
  58668. } else {
  58669. if (getAndRemoveAttr(el, 'v-else') != null) {
  58670. el.else = true;
  58671. }
  58672. var elseif = getAndRemoveAttr(el, 'v-else-if');
  58673. if (elseif) {
  58674. el.elseif = elseif;
  58675. }
  58676. }
  58677. }
  58678. function processIfConditions (el, parent) {
  58679. var prev = findPrevElement(parent.children);
  58680. if (prev && prev.if) {
  58681. addIfCondition(prev, {
  58682. exp: el.elseif,
  58683. block: el
  58684. });
  58685. } else {
  58686. warn$2(
  58687. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  58688. "used on element <" + (el.tag) + "> without corresponding v-if.",
  58689. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  58690. );
  58691. }
  58692. }
  58693. function findPrevElement (children) {
  58694. var i = children.length;
  58695. while (i--) {
  58696. if (children[i].type === 1) {
  58697. return children[i]
  58698. } else {
  58699. if (children[i].text !== ' ') {
  58700. warn$2(
  58701. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  58702. "will be ignored.",
  58703. children[i]
  58704. );
  58705. }
  58706. children.pop();
  58707. }
  58708. }
  58709. }
  58710. function addIfCondition (el, condition) {
  58711. if (!el.ifConditions) {
  58712. el.ifConditions = [];
  58713. }
  58714. el.ifConditions.push(condition);
  58715. }
  58716. function processOnce (el) {
  58717. var once$$1 = getAndRemoveAttr(el, 'v-once');
  58718. if (once$$1 != null) {
  58719. el.once = true;
  58720. }
  58721. }
  58722. // handle content being passed to a component as slot,
  58723. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  58724. function processSlotContent (el) {
  58725. var slotScope;
  58726. if (el.tag === 'template') {
  58727. slotScope = getAndRemoveAttr(el, 'scope');
  58728. /* istanbul ignore if */
  58729. if (slotScope) {
  58730. warn$2(
  58731. "the \"scope\" attribute for scoped slots have been deprecated and " +
  58732. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  58733. "can also be used on plain elements in addition to <template> to " +
  58734. "denote scoped slots.",
  58735. el.rawAttrsMap['scope'],
  58736. true
  58737. );
  58738. }
  58739. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  58740. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  58741. /* istanbul ignore if */
  58742. if (el.attrsMap['v-for']) {
  58743. warn$2(
  58744. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  58745. "(v-for takes higher priority). Use a wrapper <template> for the " +
  58746. "scoped slot to make it clearer.",
  58747. el.rawAttrsMap['slot-scope'],
  58748. true
  58749. );
  58750. }
  58751. el.slotScope = slotScope;
  58752. }
  58753. // slot="xxx"
  58754. var slotTarget = getBindingAttr(el, 'slot');
  58755. if (slotTarget) {
  58756. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  58757. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  58758. // preserve slot as an attribute for native shadow DOM compat
  58759. // only for non-scoped slots.
  58760. if (el.tag !== 'template' && !el.slotScope) {
  58761. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  58762. }
  58763. }
  58764. // 2.6 v-slot syntax
  58765. {
  58766. if (el.tag === 'template') {
  58767. // v-slot on <template>
  58768. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  58769. if (slotBinding) {
  58770. {
  58771. if (el.slotTarget || el.slotScope) {
  58772. warn$2(
  58773. "Unexpected mixed usage of different slot syntaxes.",
  58774. el
  58775. );
  58776. }
  58777. if (el.parent && !maybeComponent(el.parent)) {
  58778. warn$2(
  58779. "<template v-slot> can only appear at the root level inside " +
  58780. "the receiving component",
  58781. el
  58782. );
  58783. }
  58784. }
  58785. var ref = getSlotName(slotBinding);
  58786. var name = ref.name;
  58787. var dynamic = ref.dynamic;
  58788. el.slotTarget = name;
  58789. el.slotTargetDynamic = dynamic;
  58790. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  58791. }
  58792. } else {
  58793. // v-slot on component, denotes default slot
  58794. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  58795. if (slotBinding$1) {
  58796. {
  58797. if (!maybeComponent(el)) {
  58798. warn$2(
  58799. "v-slot can only be used on components or <template>.",
  58800. slotBinding$1
  58801. );
  58802. }
  58803. if (el.slotScope || el.slotTarget) {
  58804. warn$2(
  58805. "Unexpected mixed usage of different slot syntaxes.",
  58806. el
  58807. );
  58808. }
  58809. if (el.scopedSlots) {
  58810. warn$2(
  58811. "To avoid scope ambiguity, the default slot should also use " +
  58812. "<template> syntax when there are other named slots.",
  58813. slotBinding$1
  58814. );
  58815. }
  58816. }
  58817. // add the component's children to its default slot
  58818. var slots = el.scopedSlots || (el.scopedSlots = {});
  58819. var ref$1 = getSlotName(slotBinding$1);
  58820. var name$1 = ref$1.name;
  58821. var dynamic$1 = ref$1.dynamic;
  58822. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  58823. slotContainer.slotTarget = name$1;
  58824. slotContainer.slotTargetDynamic = dynamic$1;
  58825. slotContainer.children = el.children.filter(function (c) {
  58826. if (!c.slotScope) {
  58827. c.parent = slotContainer;
  58828. return true
  58829. }
  58830. });
  58831. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  58832. // remove children as they are returned from scopedSlots now
  58833. el.children = [];
  58834. // mark el non-plain so data gets generated
  58835. el.plain = false;
  58836. }
  58837. }
  58838. }
  58839. }
  58840. function getSlotName (binding) {
  58841. var name = binding.name.replace(slotRE, '');
  58842. if (!name) {
  58843. if (binding.name[0] !== '#') {
  58844. name = 'default';
  58845. } else {
  58846. warn$2(
  58847. "v-slot shorthand syntax requires a slot name.",
  58848. binding
  58849. );
  58850. }
  58851. }
  58852. return dynamicArgRE.test(name)
  58853. // dynamic [name]
  58854. ? { name: name.slice(1, -1), dynamic: true }
  58855. // static name
  58856. : { name: ("\"" + name + "\""), dynamic: false }
  58857. }
  58858. // handle <slot/> outlets
  58859. function processSlotOutlet (el) {
  58860. if (el.tag === 'slot') {
  58861. el.slotName = getBindingAttr(el, 'name');
  58862. if (el.key) {
  58863. warn$2(
  58864. "`key` does not work on <slot> because slots are abstract outlets " +
  58865. "and can possibly expand into multiple elements. " +
  58866. "Use the key on a wrapping element instead.",
  58867. getRawBindingAttr(el, 'key')
  58868. );
  58869. }
  58870. }
  58871. }
  58872. function processComponent (el) {
  58873. var binding;
  58874. if ((binding = getBindingAttr(el, 'is'))) {
  58875. el.component = binding;
  58876. }
  58877. if (getAndRemoveAttr(el, 'inline-template') != null) {
  58878. el.inlineTemplate = true;
  58879. }
  58880. }
  58881. function processAttrs (el) {
  58882. var list = el.attrsList;
  58883. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  58884. for (i = 0, l = list.length; i < l; i++) {
  58885. name = rawName = list[i].name;
  58886. value = list[i].value;
  58887. if (dirRE.test(name)) {
  58888. // mark element as dynamic
  58889. el.hasBindings = true;
  58890. // modifiers
  58891. modifiers = parseModifiers(name.replace(dirRE, ''));
  58892. // support .foo shorthand syntax for the .prop modifier
  58893. if (modifiers) {
  58894. name = name.replace(modifierRE, '');
  58895. }
  58896. if (bindRE.test(name)) { // v-bind
  58897. name = name.replace(bindRE, '');
  58898. value = parseFilters(value);
  58899. isDynamic = dynamicArgRE.test(name);
  58900. if (isDynamic) {
  58901. name = name.slice(1, -1);
  58902. }
  58903. if (
  58904. value.trim().length === 0
  58905. ) {
  58906. warn$2(
  58907. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  58908. );
  58909. }
  58910. if (modifiers) {
  58911. if (modifiers.prop && !isDynamic) {
  58912. name = camelize(name);
  58913. if (name === 'innerHtml') { name = 'innerHTML'; }
  58914. }
  58915. if (modifiers.camel && !isDynamic) {
  58916. name = camelize(name);
  58917. }
  58918. if (modifiers.sync) {
  58919. syncGen = genAssignmentCode(value, "$event");
  58920. if (!isDynamic) {
  58921. addHandler(
  58922. el,
  58923. ("update:" + (camelize(name))),
  58924. syncGen,
  58925. null,
  58926. false,
  58927. warn$2,
  58928. list[i]
  58929. );
  58930. if (hyphenate(name) !== camelize(name)) {
  58931. addHandler(
  58932. el,
  58933. ("update:" + (hyphenate(name))),
  58934. syncGen,
  58935. null,
  58936. false,
  58937. warn$2,
  58938. list[i]
  58939. );
  58940. }
  58941. } else {
  58942. // handler w/ dynamic event name
  58943. addHandler(
  58944. el,
  58945. ("\"update:\"+(" + name + ")"),
  58946. syncGen,
  58947. null,
  58948. false,
  58949. warn$2,
  58950. list[i],
  58951. true // dynamic
  58952. );
  58953. }
  58954. }
  58955. }
  58956. if ((modifiers && modifiers.prop) || (
  58957. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  58958. )) {
  58959. addProp(el, name, value, list[i], isDynamic);
  58960. } else {
  58961. addAttr(el, name, value, list[i], isDynamic);
  58962. }
  58963. } else if (onRE.test(name)) { // v-on
  58964. name = name.replace(onRE, '');
  58965. isDynamic = dynamicArgRE.test(name);
  58966. if (isDynamic) {
  58967. name = name.slice(1, -1);
  58968. }
  58969. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  58970. } else { // normal directives
  58971. name = name.replace(dirRE, '');
  58972. // parse arg
  58973. var argMatch = name.match(argRE);
  58974. var arg = argMatch && argMatch[1];
  58975. isDynamic = false;
  58976. if (arg) {
  58977. name = name.slice(0, -(arg.length + 1));
  58978. if (dynamicArgRE.test(arg)) {
  58979. arg = arg.slice(1, -1);
  58980. isDynamic = true;
  58981. }
  58982. }
  58983. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  58984. if (name === 'model') {
  58985. checkForAliasModel(el, value);
  58986. }
  58987. }
  58988. } else {
  58989. // literal attribute
  58990. {
  58991. var res = parseText(value, delimiters);
  58992. if (res) {
  58993. warn$2(
  58994. name + "=\"" + value + "\": " +
  58995. 'Interpolation inside attributes has been removed. ' +
  58996. 'Use v-bind or the colon shorthand instead. For example, ' +
  58997. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  58998. list[i]
  58999. );
  59000. }
  59001. }
  59002. addAttr(el, name, JSON.stringify(value), list[i]);
  59003. // #6887 firefox doesn't update muted state if set via attribute
  59004. // even immediately after element creation
  59005. if (!el.component &&
  59006. name === 'muted' &&
  59007. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  59008. addProp(el, name, 'true', list[i]);
  59009. }
  59010. }
  59011. }
  59012. }
  59013. function checkInFor (el) {
  59014. var parent = el;
  59015. while (parent) {
  59016. if (parent.for !== undefined) {
  59017. return true
  59018. }
  59019. parent = parent.parent;
  59020. }
  59021. return false
  59022. }
  59023. function parseModifiers (name) {
  59024. var match = name.match(modifierRE);
  59025. if (match) {
  59026. var ret = {};
  59027. match.forEach(function (m) { ret[m.slice(1)] = true; });
  59028. return ret
  59029. }
  59030. }
  59031. function makeAttrsMap (attrs) {
  59032. var map = {};
  59033. for (var i = 0, l = attrs.length; i < l; i++) {
  59034. if (
  59035. map[attrs[i].name] && !isIE && !isEdge
  59036. ) {
  59037. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  59038. }
  59039. map[attrs[i].name] = attrs[i].value;
  59040. }
  59041. return map
  59042. }
  59043. // for script (e.g. type="x/template") or style, do not decode content
  59044. function isTextTag (el) {
  59045. return el.tag === 'script' || el.tag === 'style'
  59046. }
  59047. function isForbiddenTag (el) {
  59048. return (
  59049. el.tag === 'style' ||
  59050. (el.tag === 'script' && (
  59051. !el.attrsMap.type ||
  59052. el.attrsMap.type === 'text/javascript'
  59053. ))
  59054. )
  59055. }
  59056. var ieNSBug = /^xmlns:NS\d+/;
  59057. var ieNSPrefix = /^NS\d+:/;
  59058. /* istanbul ignore next */
  59059. function guardIESVGBug (attrs) {
  59060. var res = [];
  59061. for (var i = 0; i < attrs.length; i++) {
  59062. var attr = attrs[i];
  59063. if (!ieNSBug.test(attr.name)) {
  59064. attr.name = attr.name.replace(ieNSPrefix, '');
  59065. res.push(attr);
  59066. }
  59067. }
  59068. return res
  59069. }
  59070. function checkForAliasModel (el, value) {
  59071. var _el = el;
  59072. while (_el) {
  59073. if (_el.for && _el.alias === value) {
  59074. warn$2(
  59075. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  59076. "You are binding v-model directly to a v-for iteration alias. " +
  59077. "This will not be able to modify the v-for source array because " +
  59078. "writing to the alias is like modifying a function local variable. " +
  59079. "Consider using an array of objects and use v-model on an object property instead.",
  59080. el.rawAttrsMap['v-model']
  59081. );
  59082. }
  59083. _el = _el.parent;
  59084. }
  59085. }
  59086. /* */
  59087. function preTransformNode (el, options) {
  59088. if (el.tag === 'input') {
  59089. var map = el.attrsMap;
  59090. if (!map['v-model']) {
  59091. return
  59092. }
  59093. var typeBinding;
  59094. if (map[':type'] || map['v-bind:type']) {
  59095. typeBinding = getBindingAttr(el, 'type');
  59096. }
  59097. if (!map.type && !typeBinding && map['v-bind']) {
  59098. typeBinding = "(" + (map['v-bind']) + ").type";
  59099. }
  59100. if (typeBinding) {
  59101. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  59102. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  59103. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  59104. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  59105. // 1. checkbox
  59106. var branch0 = cloneASTElement(el);
  59107. // process for on the main node
  59108. processFor(branch0);
  59109. addRawAttr(branch0, 'type', 'checkbox');
  59110. processElement(branch0, options);
  59111. branch0.processed = true; // prevent it from double-processed
  59112. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  59113. addIfCondition(branch0, {
  59114. exp: branch0.if,
  59115. block: branch0
  59116. });
  59117. // 2. add radio else-if condition
  59118. var branch1 = cloneASTElement(el);
  59119. getAndRemoveAttr(branch1, 'v-for', true);
  59120. addRawAttr(branch1, 'type', 'radio');
  59121. processElement(branch1, options);
  59122. addIfCondition(branch0, {
  59123. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  59124. block: branch1
  59125. });
  59126. // 3. other
  59127. var branch2 = cloneASTElement(el);
  59128. getAndRemoveAttr(branch2, 'v-for', true);
  59129. addRawAttr(branch2, ':type', typeBinding);
  59130. processElement(branch2, options);
  59131. addIfCondition(branch0, {
  59132. exp: ifCondition,
  59133. block: branch2
  59134. });
  59135. if (hasElse) {
  59136. branch0.else = true;
  59137. } else if (elseIfCondition) {
  59138. branch0.elseif = elseIfCondition;
  59139. }
  59140. return branch0
  59141. }
  59142. }
  59143. }
  59144. function cloneASTElement (el) {
  59145. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  59146. }
  59147. var model$1 = {
  59148. preTransformNode: preTransformNode
  59149. };
  59150. var modules$1 = [
  59151. klass$1,
  59152. style$1,
  59153. model$1
  59154. ];
  59155. /* */
  59156. function text (el, dir) {
  59157. if (dir.value) {
  59158. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  59159. }
  59160. }
  59161. /* */
  59162. function html (el, dir) {
  59163. if (dir.value) {
  59164. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  59165. }
  59166. }
  59167. var directives$1 = {
  59168. model: model,
  59169. text: text,
  59170. html: html
  59171. };
  59172. /* */
  59173. var baseOptions = {
  59174. expectHTML: true,
  59175. modules: modules$1,
  59176. directives: directives$1,
  59177. isPreTag: isPreTag,
  59178. isUnaryTag: isUnaryTag,
  59179. mustUseProp: mustUseProp,
  59180. canBeLeftOpenTag: canBeLeftOpenTag,
  59181. isReservedTag: isReservedTag,
  59182. getTagNamespace: getTagNamespace,
  59183. staticKeys: genStaticKeys(modules$1)
  59184. };
  59185. /* */
  59186. var isStaticKey;
  59187. var isPlatformReservedTag;
  59188. var genStaticKeysCached = cached(genStaticKeys$1);
  59189. /**
  59190. * Goal of the optimizer: walk the generated template AST tree
  59191. * and detect sub-trees that are purely static, i.e. parts of
  59192. * the DOM that never needs to change.
  59193. *
  59194. * Once we detect these sub-trees, we can:
  59195. *
  59196. * 1. Hoist them into constants, so that we no longer need to
  59197. * create fresh nodes for them on each re-render;
  59198. * 2. Completely skip them in the patching process.
  59199. */
  59200. function optimize (root, options) {
  59201. if (!root) { return }
  59202. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  59203. isPlatformReservedTag = options.isReservedTag || no;
  59204. // first pass: mark all non-static nodes.
  59205. markStatic$1(root);
  59206. // second pass: mark static roots.
  59207. markStaticRoots(root, false);
  59208. }
  59209. function genStaticKeys$1 (keys) {
  59210. return makeMap(
  59211. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  59212. (keys ? ',' + keys : '')
  59213. )
  59214. }
  59215. function markStatic$1 (node) {
  59216. node.static = isStatic(node);
  59217. if (node.type === 1) {
  59218. // do not make component slot content static. this avoids
  59219. // 1. components not able to mutate slot nodes
  59220. // 2. static slot content fails for hot-reloading
  59221. if (
  59222. !isPlatformReservedTag(node.tag) &&
  59223. node.tag !== 'slot' &&
  59224. node.attrsMap['inline-template'] == null
  59225. ) {
  59226. return
  59227. }
  59228. for (var i = 0, l = node.children.length; i < l; i++) {
  59229. var child = node.children[i];
  59230. markStatic$1(child);
  59231. if (!child.static) {
  59232. node.static = false;
  59233. }
  59234. }
  59235. if (node.ifConditions) {
  59236. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  59237. var block = node.ifConditions[i$1].block;
  59238. markStatic$1(block);
  59239. if (!block.static) {
  59240. node.static = false;
  59241. }
  59242. }
  59243. }
  59244. }
  59245. }
  59246. function markStaticRoots (node, isInFor) {
  59247. if (node.type === 1) {
  59248. if (node.static || node.once) {
  59249. node.staticInFor = isInFor;
  59250. }
  59251. // For a node to qualify as a static root, it should have children that
  59252. // are not just static text. Otherwise the cost of hoisting out will
  59253. // outweigh the benefits and it's better off to just always render it fresh.
  59254. if (node.static && node.children.length && !(
  59255. node.children.length === 1 &&
  59256. node.children[0].type === 3
  59257. )) {
  59258. node.staticRoot = true;
  59259. return
  59260. } else {
  59261. node.staticRoot = false;
  59262. }
  59263. if (node.children) {
  59264. for (var i = 0, l = node.children.length; i < l; i++) {
  59265. markStaticRoots(node.children[i], isInFor || !!node.for);
  59266. }
  59267. }
  59268. if (node.ifConditions) {
  59269. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  59270. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  59271. }
  59272. }
  59273. }
  59274. }
  59275. function isStatic (node) {
  59276. if (node.type === 2) { // expression
  59277. return false
  59278. }
  59279. if (node.type === 3) { // text
  59280. return true
  59281. }
  59282. return !!(node.pre || (
  59283. !node.hasBindings && // no dynamic bindings
  59284. !node.if && !node.for && // not v-if or v-for or v-else
  59285. !isBuiltInTag(node.tag) && // not a built-in
  59286. isPlatformReservedTag(node.tag) && // not a component
  59287. !isDirectChildOfTemplateFor(node) &&
  59288. Object.keys(node).every(isStaticKey)
  59289. ))
  59290. }
  59291. function isDirectChildOfTemplateFor (node) {
  59292. while (node.parent) {
  59293. node = node.parent;
  59294. if (node.tag !== 'template') {
  59295. return false
  59296. }
  59297. if (node.for) {
  59298. return true
  59299. }
  59300. }
  59301. return false
  59302. }
  59303. /* */
  59304. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  59305. var fnInvokeRE = /\([^)]*?\);*$/;
  59306. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  59307. // KeyboardEvent.keyCode aliases
  59308. var keyCodes = {
  59309. esc: 27,
  59310. tab: 9,
  59311. enter: 13,
  59312. space: 32,
  59313. up: 38,
  59314. left: 37,
  59315. right: 39,
  59316. down: 40,
  59317. 'delete': [8, 46]
  59318. };
  59319. // KeyboardEvent.key aliases
  59320. var keyNames = {
  59321. // #7880: IE11 and Edge use `Esc` for Escape key name.
  59322. esc: ['Esc', 'Escape'],
  59323. tab: 'Tab',
  59324. enter: 'Enter',
  59325. // #9112: IE11 uses `Spacebar` for Space key name.
  59326. space: [' ', 'Spacebar'],
  59327. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  59328. up: ['Up', 'ArrowUp'],
  59329. left: ['Left', 'ArrowLeft'],
  59330. right: ['Right', 'ArrowRight'],
  59331. down: ['Down', 'ArrowDown'],
  59332. // #9112: IE11 uses `Del` for Delete key name.
  59333. 'delete': ['Backspace', 'Delete', 'Del']
  59334. };
  59335. // #4868: modifiers that prevent the execution of the listener
  59336. // need to explicitly return null so that we can determine whether to remove
  59337. // the listener for .once
  59338. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  59339. var modifierCode = {
  59340. stop: '$event.stopPropagation();',
  59341. prevent: '$event.preventDefault();',
  59342. self: genGuard("$event.target !== $event.currentTarget"),
  59343. ctrl: genGuard("!$event.ctrlKey"),
  59344. shift: genGuard("!$event.shiftKey"),
  59345. alt: genGuard("!$event.altKey"),
  59346. meta: genGuard("!$event.metaKey"),
  59347. left: genGuard("'button' in $event && $event.button !== 0"),
  59348. middle: genGuard("'button' in $event && $event.button !== 1"),
  59349. right: genGuard("'button' in $event && $event.button !== 2")
  59350. };
  59351. function genHandlers (
  59352. events,
  59353. isNative
  59354. ) {
  59355. var prefix = isNative ? 'nativeOn:' : 'on:';
  59356. var staticHandlers = "";
  59357. var dynamicHandlers = "";
  59358. for (var name in events) {
  59359. var handlerCode = genHandler(events[name]);
  59360. if (events[name] && events[name].dynamic) {
  59361. dynamicHandlers += name + "," + handlerCode + ",";
  59362. } else {
  59363. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  59364. }
  59365. }
  59366. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  59367. if (dynamicHandlers) {
  59368. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  59369. } else {
  59370. return prefix + staticHandlers
  59371. }
  59372. }
  59373. function genHandler (handler) {
  59374. if (!handler) {
  59375. return 'function(){}'
  59376. }
  59377. if (Array.isArray(handler)) {
  59378. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  59379. }
  59380. var isMethodPath = simplePathRE.test(handler.value);
  59381. var isFunctionExpression = fnExpRE.test(handler.value);
  59382. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  59383. if (!handler.modifiers) {
  59384. if (isMethodPath || isFunctionExpression) {
  59385. return handler.value
  59386. }
  59387. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  59388. } else {
  59389. var code = '';
  59390. var genModifierCode = '';
  59391. var keys = [];
  59392. for (var key in handler.modifiers) {
  59393. if (modifierCode[key]) {
  59394. genModifierCode += modifierCode[key];
  59395. // left/right
  59396. if (keyCodes[key]) {
  59397. keys.push(key);
  59398. }
  59399. } else if (key === 'exact') {
  59400. var modifiers = (handler.modifiers);
  59401. genModifierCode += genGuard(
  59402. ['ctrl', 'shift', 'alt', 'meta']
  59403. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  59404. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  59405. .join('||')
  59406. );
  59407. } else {
  59408. keys.push(key);
  59409. }
  59410. }
  59411. if (keys.length) {
  59412. code += genKeyFilter(keys);
  59413. }
  59414. // Make sure modifiers like prevent and stop get executed after key filtering
  59415. if (genModifierCode) {
  59416. code += genModifierCode;
  59417. }
  59418. var handlerCode = isMethodPath
  59419. ? ("return " + (handler.value) + "($event)")
  59420. : isFunctionExpression
  59421. ? ("return (" + (handler.value) + ")($event)")
  59422. : isFunctionInvocation
  59423. ? ("return " + (handler.value))
  59424. : handler.value;
  59425. return ("function($event){" + code + handlerCode + "}")
  59426. }
  59427. }
  59428. function genKeyFilter (keys) {
  59429. return (
  59430. // make sure the key filters only apply to KeyboardEvents
  59431. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  59432. // key events that do not have keyCode property...
  59433. "if(!$event.type.indexOf('key')&&" +
  59434. (keys.map(genFilterCode).join('&&')) + ")return null;"
  59435. )
  59436. }
  59437. function genFilterCode (key) {
  59438. var keyVal = parseInt(key, 10);
  59439. if (keyVal) {
  59440. return ("$event.keyCode!==" + keyVal)
  59441. }
  59442. var keyCode = keyCodes[key];
  59443. var keyName = keyNames[key];
  59444. return (
  59445. "_k($event.keyCode," +
  59446. (JSON.stringify(key)) + "," +
  59447. (JSON.stringify(keyCode)) + "," +
  59448. "$event.key," +
  59449. "" + (JSON.stringify(keyName)) +
  59450. ")"
  59451. )
  59452. }
  59453. /* */
  59454. function on (el, dir) {
  59455. if (dir.modifiers) {
  59456. warn("v-on without argument does not support modifiers.");
  59457. }
  59458. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  59459. }
  59460. /* */
  59461. function bind$1 (el, dir) {
  59462. el.wrapData = function (code) {
  59463. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  59464. };
  59465. }
  59466. /* */
  59467. var baseDirectives = {
  59468. on: on,
  59469. bind: bind$1,
  59470. cloak: noop
  59471. };
  59472. /* */
  59473. var CodegenState = function CodegenState (options) {
  59474. this.options = options;
  59475. this.warn = options.warn || baseWarn;
  59476. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  59477. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  59478. this.directives = extend(extend({}, baseDirectives), options.directives);
  59479. var isReservedTag = options.isReservedTag || no;
  59480. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  59481. this.onceId = 0;
  59482. this.staticRenderFns = [];
  59483. this.pre = false;
  59484. };
  59485. function generate (
  59486. ast,
  59487. options
  59488. ) {
  59489. var state = new CodegenState(options);
  59490. var code = ast ? genElement(ast, state) : '_c("div")';
  59491. return {
  59492. render: ("with(this){return " + code + "}"),
  59493. staticRenderFns: state.staticRenderFns
  59494. }
  59495. }
  59496. function genElement (el, state) {
  59497. if (el.parent) {
  59498. el.pre = el.pre || el.parent.pre;
  59499. }
  59500. if (el.staticRoot && !el.staticProcessed) {
  59501. return genStatic(el, state)
  59502. } else if (el.once && !el.onceProcessed) {
  59503. return genOnce(el, state)
  59504. } else if (el.for && !el.forProcessed) {
  59505. return genFor(el, state)
  59506. } else if (el.if && !el.ifProcessed) {
  59507. return genIf(el, state)
  59508. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  59509. return genChildren(el, state) || 'void 0'
  59510. } else if (el.tag === 'slot') {
  59511. return genSlot(el, state)
  59512. } else {
  59513. // component or element
  59514. var code;
  59515. if (el.component) {
  59516. code = genComponent(el.component, el, state);
  59517. } else {
  59518. var data;
  59519. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  59520. data = genData$2(el, state);
  59521. }
  59522. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  59523. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  59524. }
  59525. // module transforms
  59526. for (var i = 0; i < state.transforms.length; i++) {
  59527. code = state.transforms[i](el, code);
  59528. }
  59529. return code
  59530. }
  59531. }
  59532. // hoist static sub-trees out
  59533. function genStatic (el, state) {
  59534. el.staticProcessed = true;
  59535. // Some elements (templates) need to behave differently inside of a v-pre
  59536. // node. All pre nodes are static roots, so we can use this as a location to
  59537. // wrap a state change and reset it upon exiting the pre node.
  59538. var originalPreState = state.pre;
  59539. if (el.pre) {
  59540. state.pre = el.pre;
  59541. }
  59542. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  59543. state.pre = originalPreState;
  59544. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  59545. }
  59546. // v-once
  59547. function genOnce (el, state) {
  59548. el.onceProcessed = true;
  59549. if (el.if && !el.ifProcessed) {
  59550. return genIf(el, state)
  59551. } else if (el.staticInFor) {
  59552. var key = '';
  59553. var parent = el.parent;
  59554. while (parent) {
  59555. if (parent.for) {
  59556. key = parent.key;
  59557. break
  59558. }
  59559. parent = parent.parent;
  59560. }
  59561. if (!key) {
  59562. state.warn(
  59563. "v-once can only be used inside v-for that is keyed. ",
  59564. el.rawAttrsMap['v-once']
  59565. );
  59566. return genElement(el, state)
  59567. }
  59568. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  59569. } else {
  59570. return genStatic(el, state)
  59571. }
  59572. }
  59573. function genIf (
  59574. el,
  59575. state,
  59576. altGen,
  59577. altEmpty
  59578. ) {
  59579. el.ifProcessed = true; // avoid recursion
  59580. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  59581. }
  59582. function genIfConditions (
  59583. conditions,
  59584. state,
  59585. altGen,
  59586. altEmpty
  59587. ) {
  59588. if (!conditions.length) {
  59589. return altEmpty || '_e()'
  59590. }
  59591. var condition = conditions.shift();
  59592. if (condition.exp) {
  59593. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  59594. } else {
  59595. return ("" + (genTernaryExp(condition.block)))
  59596. }
  59597. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  59598. function genTernaryExp (el) {
  59599. return altGen
  59600. ? altGen(el, state)
  59601. : el.once
  59602. ? genOnce(el, state)
  59603. : genElement(el, state)
  59604. }
  59605. }
  59606. function genFor (
  59607. el,
  59608. state,
  59609. altGen,
  59610. altHelper
  59611. ) {
  59612. var exp = el.for;
  59613. var alias = el.alias;
  59614. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  59615. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  59616. if (state.maybeComponent(el) &&
  59617. el.tag !== 'slot' &&
  59618. el.tag !== 'template' &&
  59619. !el.key
  59620. ) {
  59621. state.warn(
  59622. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  59623. "v-for should have explicit keys. " +
  59624. "See https://vuejs.org/guide/list.html#key for more info.",
  59625. el.rawAttrsMap['v-for'],
  59626. true /* tip */
  59627. );
  59628. }
  59629. el.forProcessed = true; // avoid recursion
  59630. return (altHelper || '_l') + "((" + exp + ")," +
  59631. "function(" + alias + iterator1 + iterator2 + "){" +
  59632. "return " + ((altGen || genElement)(el, state)) +
  59633. '})'
  59634. }
  59635. function genData$2 (el, state) {
  59636. var data = '{';
  59637. // directives first.
  59638. // directives may mutate the el's other properties before they are generated.
  59639. var dirs = genDirectives(el, state);
  59640. if (dirs) { data += dirs + ','; }
  59641. // key
  59642. if (el.key) {
  59643. data += "key:" + (el.key) + ",";
  59644. }
  59645. // ref
  59646. if (el.ref) {
  59647. data += "ref:" + (el.ref) + ",";
  59648. }
  59649. if (el.refInFor) {
  59650. data += "refInFor:true,";
  59651. }
  59652. // pre
  59653. if (el.pre) {
  59654. data += "pre:true,";
  59655. }
  59656. // record original tag name for components using "is" attribute
  59657. if (el.component) {
  59658. data += "tag:\"" + (el.tag) + "\",";
  59659. }
  59660. // module data generation functions
  59661. for (var i = 0; i < state.dataGenFns.length; i++) {
  59662. data += state.dataGenFns[i](el);
  59663. }
  59664. // attributes
  59665. if (el.attrs) {
  59666. data += "attrs:" + (genProps(el.attrs)) + ",";
  59667. }
  59668. // DOM props
  59669. if (el.props) {
  59670. data += "domProps:" + (genProps(el.props)) + ",";
  59671. }
  59672. // event handlers
  59673. if (el.events) {
  59674. data += (genHandlers(el.events, false)) + ",";
  59675. }
  59676. if (el.nativeEvents) {
  59677. data += (genHandlers(el.nativeEvents, true)) + ",";
  59678. }
  59679. // slot target
  59680. // only for non-scoped slots
  59681. if (el.slotTarget && !el.slotScope) {
  59682. data += "slot:" + (el.slotTarget) + ",";
  59683. }
  59684. // scoped slots
  59685. if (el.scopedSlots) {
  59686. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  59687. }
  59688. // component v-model
  59689. if (el.model) {
  59690. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  59691. }
  59692. // inline-template
  59693. if (el.inlineTemplate) {
  59694. var inlineTemplate = genInlineTemplate(el, state);
  59695. if (inlineTemplate) {
  59696. data += inlineTemplate + ",";
  59697. }
  59698. }
  59699. data = data.replace(/,$/, '') + '}';
  59700. // v-bind dynamic argument wrap
  59701. // v-bind with dynamic arguments must be applied using the same v-bind object
  59702. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  59703. if (el.dynamicAttrs) {
  59704. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  59705. }
  59706. // v-bind data wrap
  59707. if (el.wrapData) {
  59708. data = el.wrapData(data);
  59709. }
  59710. // v-on data wrap
  59711. if (el.wrapListeners) {
  59712. data = el.wrapListeners(data);
  59713. }
  59714. return data
  59715. }
  59716. function genDirectives (el, state) {
  59717. var dirs = el.directives;
  59718. if (!dirs) { return }
  59719. var res = 'directives:[';
  59720. var hasRuntime = false;
  59721. var i, l, dir, needRuntime;
  59722. for (i = 0, l = dirs.length; i < l; i++) {
  59723. dir = dirs[i];
  59724. needRuntime = true;
  59725. var gen = state.directives[dir.name];
  59726. if (gen) {
  59727. // compile-time directive that manipulates AST.
  59728. // returns true if it also needs a runtime counterpart.
  59729. needRuntime = !!gen(el, dir, state.warn);
  59730. }
  59731. if (needRuntime) {
  59732. hasRuntime = true;
  59733. 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))) : '') + "},";
  59734. }
  59735. }
  59736. if (hasRuntime) {
  59737. return res.slice(0, -1) + ']'
  59738. }
  59739. }
  59740. function genInlineTemplate (el, state) {
  59741. var ast = el.children[0];
  59742. if (el.children.length !== 1 || ast.type !== 1) {
  59743. state.warn(
  59744. 'Inline-template components must have exactly one child element.',
  59745. { start: el.start }
  59746. );
  59747. }
  59748. if (ast && ast.type === 1) {
  59749. var inlineRenderFns = generate(ast, state.options);
  59750. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  59751. }
  59752. }
  59753. function genScopedSlots (
  59754. el,
  59755. slots,
  59756. state
  59757. ) {
  59758. // by default scoped slots are considered "stable", this allows child
  59759. // components with only scoped slots to skip forced updates from parent.
  59760. // but in some cases we have to bail-out of this optimization
  59761. // for example if the slot contains dynamic names, has v-if or v-for on them...
  59762. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  59763. var slot = slots[key];
  59764. return (
  59765. slot.slotTargetDynamic ||
  59766. slot.if ||
  59767. slot.for ||
  59768. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  59769. )
  59770. });
  59771. // #9534: if a component with scoped slots is inside a conditional branch,
  59772. // it's possible for the same component to be reused but with different
  59773. // compiled slot content. To avoid that, we generate a unique key based on
  59774. // the generated code of all the slot contents.
  59775. var needsKey = !!el.if;
  59776. // OR when it is inside another scoped slot or v-for (the reactivity may be
  59777. // disconnected due to the intermediate scope variable)
  59778. // #9438, #9506
  59779. // TODO: this can be further optimized by properly analyzing in-scope bindings
  59780. // and skip force updating ones that do not actually use scope variables.
  59781. if (!needsForceUpdate) {
  59782. var parent = el.parent;
  59783. while (parent) {
  59784. if (
  59785. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  59786. parent.for
  59787. ) {
  59788. needsForceUpdate = true;
  59789. break
  59790. }
  59791. if (parent.if) {
  59792. needsKey = true;
  59793. }
  59794. parent = parent.parent;
  59795. }
  59796. }
  59797. var generatedSlots = Object.keys(slots)
  59798. .map(function (key) { return genScopedSlot(slots[key], state); })
  59799. .join(',');
  59800. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  59801. }
  59802. function hash(str) {
  59803. var hash = 5381;
  59804. var i = str.length;
  59805. while(i) {
  59806. hash = (hash * 33) ^ str.charCodeAt(--i);
  59807. }
  59808. return hash >>> 0
  59809. }
  59810. function containsSlotChild (el) {
  59811. if (el.type === 1) {
  59812. if (el.tag === 'slot') {
  59813. return true
  59814. }
  59815. return el.children.some(containsSlotChild)
  59816. }
  59817. return false
  59818. }
  59819. function genScopedSlot (
  59820. el,
  59821. state
  59822. ) {
  59823. var isLegacySyntax = el.attrsMap['slot-scope'];
  59824. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  59825. return genIf(el, state, genScopedSlot, "null")
  59826. }
  59827. if (el.for && !el.forProcessed) {
  59828. return genFor(el, state, genScopedSlot)
  59829. }
  59830. var slotScope = el.slotScope === emptySlotScopeToken
  59831. ? ""
  59832. : String(el.slotScope);
  59833. var fn = "function(" + slotScope + "){" +
  59834. "return " + (el.tag === 'template'
  59835. ? el.if && isLegacySyntax
  59836. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  59837. : genChildren(el, state) || 'undefined'
  59838. : genElement(el, state)) + "}";
  59839. // reverse proxy v-slot without scope on this.$slots
  59840. var reverseProxy = slotScope ? "" : ",proxy:true";
  59841. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  59842. }
  59843. function genChildren (
  59844. el,
  59845. state,
  59846. checkSkip,
  59847. altGenElement,
  59848. altGenNode
  59849. ) {
  59850. var children = el.children;
  59851. if (children.length) {
  59852. var el$1 = children[0];
  59853. // optimize single v-for
  59854. if (children.length === 1 &&
  59855. el$1.for &&
  59856. el$1.tag !== 'template' &&
  59857. el$1.tag !== 'slot'
  59858. ) {
  59859. var normalizationType = checkSkip
  59860. ? state.maybeComponent(el$1) ? ",1" : ",0"
  59861. : "";
  59862. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  59863. }
  59864. var normalizationType$1 = checkSkip
  59865. ? getNormalizationType(children, state.maybeComponent)
  59866. : 0;
  59867. var gen = altGenNode || genNode;
  59868. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  59869. }
  59870. }
  59871. // determine the normalization needed for the children array.
  59872. // 0: no normalization needed
  59873. // 1: simple normalization needed (possible 1-level deep nested array)
  59874. // 2: full normalization needed
  59875. function getNormalizationType (
  59876. children,
  59877. maybeComponent
  59878. ) {
  59879. var res = 0;
  59880. for (var i = 0; i < children.length; i++) {
  59881. var el = children[i];
  59882. if (el.type !== 1) {
  59883. continue
  59884. }
  59885. if (needsNormalization(el) ||
  59886. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  59887. res = 2;
  59888. break
  59889. }
  59890. if (maybeComponent(el) ||
  59891. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  59892. res = 1;
  59893. }
  59894. }
  59895. return res
  59896. }
  59897. function needsNormalization (el) {
  59898. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  59899. }
  59900. function genNode (node, state) {
  59901. if (node.type === 1) {
  59902. return genElement(node, state)
  59903. } else if (node.type === 3 && node.isComment) {
  59904. return genComment(node)
  59905. } else {
  59906. return genText(node)
  59907. }
  59908. }
  59909. function genText (text) {
  59910. return ("_v(" + (text.type === 2
  59911. ? text.expression // no need for () because already wrapped in _s()
  59912. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  59913. }
  59914. function genComment (comment) {
  59915. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  59916. }
  59917. function genSlot (el, state) {
  59918. var slotName = el.slotName || '"default"';
  59919. var children = genChildren(el, state);
  59920. var res = "_t(" + slotName + (children ? ("," + children) : '');
  59921. var attrs = el.attrs || el.dynamicAttrs
  59922. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  59923. // slot props are camelized
  59924. name: camelize(attr.name),
  59925. value: attr.value,
  59926. dynamic: attr.dynamic
  59927. }); }))
  59928. : null;
  59929. var bind$$1 = el.attrsMap['v-bind'];
  59930. if ((attrs || bind$$1) && !children) {
  59931. res += ",null";
  59932. }
  59933. if (attrs) {
  59934. res += "," + attrs;
  59935. }
  59936. if (bind$$1) {
  59937. res += (attrs ? '' : ',null') + "," + bind$$1;
  59938. }
  59939. return res + ')'
  59940. }
  59941. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  59942. function genComponent (
  59943. componentName,
  59944. el,
  59945. state
  59946. ) {
  59947. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  59948. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  59949. }
  59950. function genProps (props) {
  59951. var staticProps = "";
  59952. var dynamicProps = "";
  59953. for (var i = 0; i < props.length; i++) {
  59954. var prop = props[i];
  59955. var value = transformSpecialNewlines(prop.value);
  59956. if (prop.dynamic) {
  59957. dynamicProps += (prop.name) + "," + value + ",";
  59958. } else {
  59959. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  59960. }
  59961. }
  59962. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  59963. if (dynamicProps) {
  59964. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  59965. } else {
  59966. return staticProps
  59967. }
  59968. }
  59969. // #3895, #4268
  59970. function transformSpecialNewlines (text) {
  59971. return text
  59972. .replace(/\u2028/g, '\\u2028')
  59973. .replace(/\u2029/g, '\\u2029')
  59974. }
  59975. /* */
  59976. // these keywords should not appear inside expressions, but operators like
  59977. // typeof, instanceof and in are allowed
  59978. var prohibitedKeywordRE = new RegExp('\\b' + (
  59979. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  59980. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  59981. 'extends,finally,continue,debugger,function,arguments'
  59982. ).split(',').join('\\b|\\b') + '\\b');
  59983. // these unary operators should not be used as property/method names
  59984. var unaryOperatorsRE = new RegExp('\\b' + (
  59985. 'delete,typeof,void'
  59986. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  59987. // strip strings in expressions
  59988. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  59989. // detect problematic expressions in a template
  59990. function detectErrors (ast, warn) {
  59991. if (ast) {
  59992. checkNode(ast, warn);
  59993. }
  59994. }
  59995. function checkNode (node, warn) {
  59996. if (node.type === 1) {
  59997. for (var name in node.attrsMap) {
  59998. if (dirRE.test(name)) {
  59999. var value = node.attrsMap[name];
  60000. if (value) {
  60001. var range = node.rawAttrsMap[name];
  60002. if (name === 'v-for') {
  60003. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  60004. } else if (name === 'v-slot' || name[0] === '#') {
  60005. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  60006. } else if (onRE.test(name)) {
  60007. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  60008. } else {
  60009. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  60010. }
  60011. }
  60012. }
  60013. }
  60014. if (node.children) {
  60015. for (var i = 0; i < node.children.length; i++) {
  60016. checkNode(node.children[i], warn);
  60017. }
  60018. }
  60019. } else if (node.type === 2) {
  60020. checkExpression(node.expression, node.text, warn, node);
  60021. }
  60022. }
  60023. function checkEvent (exp, text, warn, range) {
  60024. var stripped = exp.replace(stripStringRE, '');
  60025. var keywordMatch = stripped.match(unaryOperatorsRE);
  60026. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  60027. warn(
  60028. "avoid using JavaScript unary operator as property name: " +
  60029. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  60030. range
  60031. );
  60032. }
  60033. checkExpression(exp, text, warn, range);
  60034. }
  60035. function checkFor (node, text, warn, range) {
  60036. checkExpression(node.for || '', text, warn, range);
  60037. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  60038. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  60039. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  60040. }
  60041. function checkIdentifier (
  60042. ident,
  60043. type,
  60044. text,
  60045. warn,
  60046. range
  60047. ) {
  60048. if (typeof ident === 'string') {
  60049. try {
  60050. new Function(("var " + ident + "=_"));
  60051. } catch (e) {
  60052. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  60053. }
  60054. }
  60055. }
  60056. function checkExpression (exp, text, warn, range) {
  60057. try {
  60058. new Function(("return " + exp));
  60059. } catch (e) {
  60060. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  60061. if (keywordMatch) {
  60062. warn(
  60063. "avoid using JavaScript keyword as property name: " +
  60064. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  60065. range
  60066. );
  60067. } else {
  60068. warn(
  60069. "invalid expression: " + (e.message) + " in\n\n" +
  60070. " " + exp + "\n\n" +
  60071. " Raw expression: " + (text.trim()) + "\n",
  60072. range
  60073. );
  60074. }
  60075. }
  60076. }
  60077. function checkFunctionParameterExpression (exp, text, warn, range) {
  60078. try {
  60079. new Function(exp, '');
  60080. } catch (e) {
  60081. warn(
  60082. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  60083. " " + exp + "\n\n" +
  60084. " Raw expression: " + (text.trim()) + "\n",
  60085. range
  60086. );
  60087. }
  60088. }
  60089. /* */
  60090. var range = 2;
  60091. function generateCodeFrame (
  60092. source,
  60093. start,
  60094. end
  60095. ) {
  60096. if ( start === void 0 ) start = 0;
  60097. if ( end === void 0 ) end = source.length;
  60098. var lines = source.split(/\r?\n/);
  60099. var count = 0;
  60100. var res = [];
  60101. for (var i = 0; i < lines.length; i++) {
  60102. count += lines[i].length + 1;
  60103. if (count >= start) {
  60104. for (var j = i - range; j <= i + range || end > count; j++) {
  60105. if (j < 0 || j >= lines.length) { continue }
  60106. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  60107. var lineLength = lines[j].length;
  60108. if (j === i) {
  60109. // push underline
  60110. var pad = start - (count - lineLength) + 1;
  60111. var length = end > count ? lineLength - pad : end - start;
  60112. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  60113. } else if (j > i) {
  60114. if (end > count) {
  60115. var length$1 = Math.min(end - count, lineLength);
  60116. res.push(" | " + repeat$1("^", length$1));
  60117. }
  60118. count += lineLength + 1;
  60119. }
  60120. }
  60121. break
  60122. }
  60123. }
  60124. return res.join('\n')
  60125. }
  60126. function repeat$1 (str, n) {
  60127. var result = '';
  60128. if (n > 0) {
  60129. while (true) { // eslint-disable-line
  60130. if (n & 1) { result += str; }
  60131. n >>>= 1;
  60132. if (n <= 0) { break }
  60133. str += str;
  60134. }
  60135. }
  60136. return result
  60137. }
  60138. /* */
  60139. function createFunction (code, errors) {
  60140. try {
  60141. return new Function(code)
  60142. } catch (err) {
  60143. errors.push({ err: err, code: code });
  60144. return noop
  60145. }
  60146. }
  60147. function createCompileToFunctionFn (compile) {
  60148. var cache = Object.create(null);
  60149. return function compileToFunctions (
  60150. template,
  60151. options,
  60152. vm
  60153. ) {
  60154. options = extend({}, options);
  60155. var warn$$1 = options.warn || warn;
  60156. delete options.warn;
  60157. /* istanbul ignore if */
  60158. {
  60159. // detect possible CSP restriction
  60160. try {
  60161. new Function('return 1');
  60162. } catch (e) {
  60163. if (e.toString().match(/unsafe-eval|CSP/)) {
  60164. warn$$1(
  60165. 'It seems you are using the standalone build of Vue.js in an ' +
  60166. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  60167. 'The template compiler cannot work in this environment. Consider ' +
  60168. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  60169. 'templates into render functions.'
  60170. );
  60171. }
  60172. }
  60173. }
  60174. // check cache
  60175. var key = options.delimiters
  60176. ? String(options.delimiters) + template
  60177. : template;
  60178. if (cache[key]) {
  60179. return cache[key]
  60180. }
  60181. // compile
  60182. var compiled = compile(template, options);
  60183. // check compilation errors/tips
  60184. {
  60185. if (compiled.errors && compiled.errors.length) {
  60186. if (options.outputSourceRange) {
  60187. compiled.errors.forEach(function (e) {
  60188. warn$$1(
  60189. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  60190. generateCodeFrame(template, e.start, e.end),
  60191. vm
  60192. );
  60193. });
  60194. } else {
  60195. warn$$1(
  60196. "Error compiling template:\n\n" + template + "\n\n" +
  60197. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  60198. vm
  60199. );
  60200. }
  60201. }
  60202. if (compiled.tips && compiled.tips.length) {
  60203. if (options.outputSourceRange) {
  60204. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  60205. } else {
  60206. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  60207. }
  60208. }
  60209. }
  60210. // turn code into functions
  60211. var res = {};
  60212. var fnGenErrors = [];
  60213. res.render = createFunction(compiled.render, fnGenErrors);
  60214. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  60215. return createFunction(code, fnGenErrors)
  60216. });
  60217. // check function generation errors.
  60218. // this should only happen if there is a bug in the compiler itself.
  60219. // mostly for codegen development use
  60220. /* istanbul ignore if */
  60221. {
  60222. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  60223. warn$$1(
  60224. "Failed to generate render function:\n\n" +
  60225. fnGenErrors.map(function (ref) {
  60226. var err = ref.err;
  60227. var code = ref.code;
  60228. return ((err.toString()) + " in\n\n" + code + "\n");
  60229. }).join('\n'),
  60230. vm
  60231. );
  60232. }
  60233. }
  60234. return (cache[key] = res)
  60235. }
  60236. }
  60237. /* */
  60238. function createCompilerCreator (baseCompile) {
  60239. return function createCompiler (baseOptions) {
  60240. function compile (
  60241. template,
  60242. options
  60243. ) {
  60244. var finalOptions = Object.create(baseOptions);
  60245. var errors = [];
  60246. var tips = [];
  60247. var warn = function (msg, range, tip) {
  60248. (tip ? tips : errors).push(msg);
  60249. };
  60250. if (options) {
  60251. if (options.outputSourceRange) {
  60252. // $flow-disable-line
  60253. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  60254. warn = function (msg, range, tip) {
  60255. var data = { msg: msg };
  60256. if (range) {
  60257. if (range.start != null) {
  60258. data.start = range.start + leadingSpaceLength;
  60259. }
  60260. if (range.end != null) {
  60261. data.end = range.end + leadingSpaceLength;
  60262. }
  60263. }
  60264. (tip ? tips : errors).push(data);
  60265. };
  60266. }
  60267. // merge custom modules
  60268. if (options.modules) {
  60269. finalOptions.modules =
  60270. (baseOptions.modules || []).concat(options.modules);
  60271. }
  60272. // merge custom directives
  60273. if (options.directives) {
  60274. finalOptions.directives = extend(
  60275. Object.create(baseOptions.directives || null),
  60276. options.directives
  60277. );
  60278. }
  60279. // copy other options
  60280. for (var key in options) {
  60281. if (key !== 'modules' && key !== 'directives') {
  60282. finalOptions[key] = options[key];
  60283. }
  60284. }
  60285. }
  60286. finalOptions.warn = warn;
  60287. var compiled = baseCompile(template.trim(), finalOptions);
  60288. {
  60289. detectErrors(compiled.ast, warn);
  60290. }
  60291. compiled.errors = errors;
  60292. compiled.tips = tips;
  60293. return compiled
  60294. }
  60295. return {
  60296. compile: compile,
  60297. compileToFunctions: createCompileToFunctionFn(compile)
  60298. }
  60299. }
  60300. }
  60301. /* */
  60302. // `createCompilerCreator` allows creating compilers that use alternative
  60303. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  60304. // Here we just export a default compiler using the default parts.
  60305. var createCompiler = createCompilerCreator(function baseCompile (
  60306. template,
  60307. options
  60308. ) {
  60309. var ast = parse(template.trim(), options);
  60310. if (options.optimize !== false) {
  60311. optimize(ast, options);
  60312. }
  60313. var code = generate(ast, options);
  60314. return {
  60315. ast: ast,
  60316. render: code.render,
  60317. staticRenderFns: code.staticRenderFns
  60318. }
  60319. });
  60320. /* */
  60321. var ref$1 = createCompiler(baseOptions);
  60322. var compile = ref$1.compile;
  60323. var compileToFunctions = ref$1.compileToFunctions;
  60324. /* */
  60325. // check whether current browser encodes a char inside attribute values
  60326. var div;
  60327. function getShouldDecode (href) {
  60328. div = div || document.createElement('div');
  60329. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  60330. return div.innerHTML.indexOf('&#10;') > 0
  60331. }
  60332. // #3663: IE encodes newlines inside attribute values while other browsers don't
  60333. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  60334. // #6828: chrome encodes content in a[href]
  60335. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  60336. /* */
  60337. var idToTemplate = cached(function (id) {
  60338. var el = query(id);
  60339. return el && el.innerHTML
  60340. });
  60341. var mount = Vue.prototype.$mount;
  60342. Vue.prototype.$mount = function (
  60343. el,
  60344. hydrating
  60345. ) {
  60346. el = el && query(el);
  60347. /* istanbul ignore if */
  60348. if (el === document.body || el === document.documentElement) {
  60349. warn(
  60350. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  60351. );
  60352. return this
  60353. }
  60354. var options = this.$options;
  60355. // resolve template/el and convert to render function
  60356. if (!options.render) {
  60357. var template = options.template;
  60358. if (template) {
  60359. if (typeof template === 'string') {
  60360. if (template.charAt(0) === '#') {
  60361. template = idToTemplate(template);
  60362. /* istanbul ignore if */
  60363. if (!template) {
  60364. warn(
  60365. ("Template element not found or is empty: " + (options.template)),
  60366. this
  60367. );
  60368. }
  60369. }
  60370. } else if (template.nodeType) {
  60371. template = template.innerHTML;
  60372. } else {
  60373. {
  60374. warn('invalid template option:' + template, this);
  60375. }
  60376. return this
  60377. }
  60378. } else if (el) {
  60379. template = getOuterHTML(el);
  60380. }
  60381. if (template) {
  60382. /* istanbul ignore if */
  60383. if (config.performance && mark) {
  60384. mark('compile');
  60385. }
  60386. var ref = compileToFunctions(template, {
  60387. outputSourceRange: "development" !== 'production',
  60388. shouldDecodeNewlines: shouldDecodeNewlines,
  60389. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  60390. delimiters: options.delimiters,
  60391. comments: options.comments
  60392. }, this);
  60393. var render = ref.render;
  60394. var staticRenderFns = ref.staticRenderFns;
  60395. options.render = render;
  60396. options.staticRenderFns = staticRenderFns;
  60397. /* istanbul ignore if */
  60398. if (config.performance && mark) {
  60399. mark('compile end');
  60400. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  60401. }
  60402. }
  60403. }
  60404. return mount.call(this, el, hydrating)
  60405. };
  60406. /**
  60407. * Get outerHTML of elements, taking care
  60408. * of SVG elements in IE as well.
  60409. */
  60410. function getOuterHTML (el) {
  60411. if (el.outerHTML) {
  60412. return el.outerHTML
  60413. } else {
  60414. var container = document.createElement('div');
  60415. container.appendChild(el.cloneNode(true));
  60416. return container.innerHTML
  60417. }
  60418. }
  60419. Vue.compile = compileToFunctions;
  60420. module.exports = Vue;
  60421. /* 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))
  60422. /***/ }),
  60423. /***/ "./node_modules/vue/dist/vue.common.js":
  60424. /*!*********************************************!*\
  60425. !*** ./node_modules/vue/dist/vue.common.js ***!
  60426. \*********************************************/
  60427. /*! no static exports found */
  60428. /***/ (function(module, exports, __webpack_require__) {
  60429. if (false) {} else {
  60430. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  60431. }
  60432. /***/ }),
  60433. /***/ "./node_modules/webpack/buildin/global.js":
  60434. /*!***********************************!*\
  60435. !*** (webpack)/buildin/global.js ***!
  60436. \***********************************/
  60437. /*! no static exports found */
  60438. /***/ (function(module, exports) {
  60439. var g;
  60440. // This works in non-strict mode
  60441. g = (function() {
  60442. return this;
  60443. })();
  60444. try {
  60445. // This works if eval is allowed (see CSP)
  60446. g = g || new Function("return this")();
  60447. } catch (e) {
  60448. // This works if the window reference is available
  60449. if (typeof window === "object") g = window;
  60450. }
  60451. // g can still be undefined, but nothing to do about it...
  60452. // We return undefined, instead of nothing here, so it's
  60453. // easier to handle this case. if(!global) { ...}
  60454. module.exports = g;
  60455. /***/ }),
  60456. /***/ "./node_modules/webpack/buildin/module.js":
  60457. /*!***********************************!*\
  60458. !*** (webpack)/buildin/module.js ***!
  60459. \***********************************/
  60460. /*! no static exports found */
  60461. /***/ (function(module, exports) {
  60462. module.exports = function(module) {
  60463. if (!module.webpackPolyfill) {
  60464. module.deprecate = function() {};
  60465. module.paths = [];
  60466. // module.parent = undefined by default
  60467. if (!module.children) module.children = [];
  60468. Object.defineProperty(module, "loaded", {
  60469. enumerable: true,
  60470. get: function() {
  60471. return module.l;
  60472. }
  60473. });
  60474. Object.defineProperty(module, "id", {
  60475. enumerable: true,
  60476. get: function() {
  60477. return module.i;
  60478. }
  60479. });
  60480. module.webpackPolyfill = 1;
  60481. }
  60482. return module;
  60483. };
  60484. /***/ }),
  60485. /***/ "./resources/js/app.js":
  60486. /*!*****************************!*\
  60487. !*** ./resources/js/app.js ***!
  60488. \*****************************/
  60489. /*! no exports provided */
  60490. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60491. "use strict";
  60492. __webpack_require__.r(__webpack_exports__);
  60493. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  60494. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
  60495. /* harmony import */ var vue_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-router */ "./node_modules/vue-router/dist/vue-router.esm.js");
  60496. /* harmony import */ var _views_App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./views/App */ "./resources/js/views/App.vue");
  60497. /* harmony import */ var _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./views/Dashboard */ "./resources/js/views/Dashboard.vue");
  60498. /* harmony import */ var _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./views/WorkOrder */ "./resources/js/views/WorkOrder.vue");
  60499. /* harmony import */ var _views_Login__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./views/Login */ "./resources/js/views/Login.vue");
  60500. /* harmony import */ var _views_Welcome__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./views/Welcome */ "./resources/js/views/Welcome.vue");
  60501. /**
  60502. * First we will load all of this project's JavaScript dependencies which
  60503. * includes Vue and other libraries. It is a great starting point when
  60504. * building robust, powerful web applications using Vue and Laravel.
  60505. */
  60506. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  60507. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  60508. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  60509. vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]);
  60510. var router = new vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]({
  60511. mode: 'history',
  60512. routes: [{
  60513. path: '/',
  60514. name: 'home',
  60515. component: _views_Welcome__WEBPACK_IMPORTED_MODULE_6__["default"]
  60516. }, {
  60517. path: '/login',
  60518. name: 'login',
  60519. component: _views_Login__WEBPACK_IMPORTED_MODULE_5__["default"]
  60520. }, {
  60521. path: '/dashboard',
  60522. name: 'dashboard',
  60523. component: _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__["default"]
  60524. }, {
  60525. path: '/workorders/:id',
  60526. name: 'workorders',
  60527. component: _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__["default"],
  60528. props: true
  60529. }]
  60530. });
  60531. var app = new vue__WEBPACK_IMPORTED_MODULE_0___default.a({
  60532. el: '#app',
  60533. components: {
  60534. App: _views_App__WEBPACK_IMPORTED_MODULE_2__["default"]
  60535. },
  60536. router: router
  60537. });
  60538. $(function () {
  60539. $('[data-toggle="tooltip"]').tooltip();
  60540. });
  60541. var clipboard = new Clipboard('.btn-clip');
  60542. clipboard.on('success', function (e) {
  60543. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  60544. position: "right",
  60545. className: 'success'
  60546. });
  60547. e.clearSelection();
  60548. });
  60549. /***/ }),
  60550. /***/ "./resources/js/bootstrap.js":
  60551. /*!***********************************!*\
  60552. !*** ./resources/js/bootstrap.js ***!
  60553. \***********************************/
  60554. /*! no exports provided */
  60555. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60556. "use strict";
  60557. __webpack_require__.r(__webpack_exports__);
  60558. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  60559. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  60560. /**
  60561. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  60562. * for JavaScript based Bootstrap features such as modals and tabs. This
  60563. * code may be modified to fit the specific needs of your application.
  60564. */
  60565. try {
  60566. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  60567. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  60568. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  60569. } catch (e) {}
  60570. /**
  60571. * We'll load the axios HTTP library which allows us to easily issue requests
  60572. * to our Laravel back-end. This library automatically handles sending the
  60573. * CSRF token as a header based on the value of the "XSRF" token cookie.
  60574. */
  60575. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  60576. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  60577. /**
  60578. * Echo exposes an expressive API for subscribing to channels and listening
  60579. * for events that are broadcast by Laravel. Echo and event broadcasting
  60580. * allows your team to easily build robust real-time web applications.
  60581. */
  60582. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  60583. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  60584. broadcaster: 'pusher',
  60585. key: "upccrt",
  60586. wsHost: window.location.hostname,
  60587. wsPort: 6001,
  60588. disableStats: true
  60589. });
  60590. /***/ }),
  60591. /***/ "./resources/js/components/AssetInfo.vue":
  60592. /*!***********************************************!*\
  60593. !*** ./resources/js/components/AssetInfo.vue ***!
  60594. \***********************************************/
  60595. /*! exports provided: default */
  60596. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60597. "use strict";
  60598. __webpack_require__.r(__webpack_exports__);
  60599. /* 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&");
  60600. /* 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&");
  60601. /* 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");
  60602. /* normalize component */
  60603. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60604. _AssetInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60605. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["render"],
  60606. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60607. false,
  60608. null,
  60609. null,
  60610. null
  60611. )
  60612. /* hot reload */
  60613. if (false) { var api; }
  60614. component.options.__file = "resources/js/components/AssetInfo.vue"
  60615. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60616. /***/ }),
  60617. /***/ "./resources/js/components/AssetInfo.vue?vue&type=script&lang=js&":
  60618. /*!************************************************************************!*\
  60619. !*** ./resources/js/components/AssetInfo.vue?vue&type=script&lang=js& ***!
  60620. \************************************************************************/
  60621. /*! exports provided: default */
  60622. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60623. "use strict";
  60624. __webpack_require__.r(__webpack_exports__);
  60625. /* 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&");
  60626. /* 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"]);
  60627. /***/ }),
  60628. /***/ "./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&":
  60629. /*!******************************************************************************!*\
  60630. !*** ./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a& ***!
  60631. \******************************************************************************/
  60632. /*! exports provided: render, staticRenderFns */
  60633. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60634. "use strict";
  60635. __webpack_require__.r(__webpack_exports__);
  60636. /* 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&");
  60637. /* 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"]; });
  60638. /* 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"]; });
  60639. /***/ }),
  60640. /***/ "./resources/js/components/AssetInfoEditModal.vue":
  60641. /*!********************************************************!*\
  60642. !*** ./resources/js/components/AssetInfoEditModal.vue ***!
  60643. \********************************************************/
  60644. /*! exports provided: default */
  60645. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60646. "use strict";
  60647. __webpack_require__.r(__webpack_exports__);
  60648. /* 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&");
  60649. /* 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&");
  60650. /* 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");
  60651. /* normalize component */
  60652. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60653. _AssetInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60654. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["render"],
  60655. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60656. false,
  60657. null,
  60658. null,
  60659. null
  60660. )
  60661. /* hot reload */
  60662. if (false) { var api; }
  60663. component.options.__file = "resources/js/components/AssetInfoEditModal.vue"
  60664. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60665. /***/ }),
  60666. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  60667. /*!*********************************************************************************!*\
  60668. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js& ***!
  60669. \*********************************************************************************/
  60670. /*! exports provided: default */
  60671. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60672. "use strict";
  60673. __webpack_require__.r(__webpack_exports__);
  60674. /* 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&");
  60675. /* 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"]);
  60676. /***/ }),
  60677. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&":
  60678. /*!***************************************************************************************!*\
  60679. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& ***!
  60680. \***************************************************************************************/
  60681. /*! exports provided: render, staticRenderFns */
  60682. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60683. "use strict";
  60684. __webpack_require__.r(__webpack_exports__);
  60685. /* 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&");
  60686. /* 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"]; });
  60687. /* 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"]; });
  60688. /***/ }),
  60689. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue":
  60690. /*!****************************************************************!*\
  60691. !*** ./resources/js/components/AutocompleteCustomDropdown.vue ***!
  60692. \****************************************************************/
  60693. /*! exports provided: default */
  60694. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60695. "use strict";
  60696. __webpack_require__.r(__webpack_exports__);
  60697. /* 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&");
  60698. /* 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&");
  60699. /* 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");
  60700. /* normalize component */
  60701. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60702. _AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60703. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["render"],
  60704. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60705. false,
  60706. null,
  60707. null,
  60708. null
  60709. )
  60710. /* hot reload */
  60711. if (false) { var api; }
  60712. component.options.__file = "resources/js/components/AutocompleteCustomDropdown.vue"
  60713. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60714. /***/ }),
  60715. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  60716. /*!*****************************************************************************************!*\
  60717. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js& ***!
  60718. \*****************************************************************************************/
  60719. /*! exports provided: default */
  60720. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60721. "use strict";
  60722. __webpack_require__.r(__webpack_exports__);
  60723. /* 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&");
  60724. /* 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"]);
  60725. /***/ }),
  60726. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&":
  60727. /*!***********************************************************************************************!*\
  60728. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& ***!
  60729. \***********************************************************************************************/
  60730. /*! exports provided: render, staticRenderFns */
  60731. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60732. "use strict";
  60733. __webpack_require__.r(__webpack_exports__);
  60734. /* 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&");
  60735. /* 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"]; });
  60736. /* 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"]; });
  60737. /***/ }),
  60738. /***/ "./resources/js/components/CircleSpinner.vue":
  60739. /*!***************************************************!*\
  60740. !*** ./resources/js/components/CircleSpinner.vue ***!
  60741. \***************************************************/
  60742. /*! exports provided: default */
  60743. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60744. "use strict";
  60745. __webpack_require__.r(__webpack_exports__);
  60746. /* 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&");
  60747. /* 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&");
  60748. /* 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&");
  60749. /* 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");
  60750. /* normalize component */
  60751. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  60752. _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60753. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  60754. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60755. false,
  60756. null,
  60757. "9a543b64",
  60758. null
  60759. )
  60760. /* hot reload */
  60761. if (false) { var api; }
  60762. component.options.__file = "resources/js/components/CircleSpinner.vue"
  60763. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60764. /***/ }),
  60765. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  60766. /*!****************************************************************************!*\
  60767. !*** ./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js& ***!
  60768. \****************************************************************************/
  60769. /*! exports provided: default */
  60770. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60771. "use strict";
  60772. __webpack_require__.r(__webpack_exports__);
  60773. /* 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&");
  60774. /* 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"]);
  60775. /***/ }),
  60776. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  60777. /*!************************************************************************************************************!*\
  60778. !*** ./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  60779. \************************************************************************************************************/
  60780. /*! no static exports found */
  60781. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60782. "use strict";
  60783. __webpack_require__.r(__webpack_exports__);
  60784. /* 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&");
  60785. /* 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__);
  60786. /* 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__));
  60787. /* 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);
  60788. /***/ }),
  60789. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&":
  60790. /*!**********************************************************************************************!*\
  60791. !*** ./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& ***!
  60792. \**********************************************************************************************/
  60793. /*! exports provided: render, staticRenderFns */
  60794. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60795. "use strict";
  60796. __webpack_require__.r(__webpack_exports__);
  60797. /* 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&");
  60798. /* 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"]; });
  60799. /* 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"]; });
  60800. /***/ }),
  60801. /***/ "./resources/js/components/Credential.vue":
  60802. /*!************************************************!*\
  60803. !*** ./resources/js/components/Credential.vue ***!
  60804. \************************************************/
  60805. /*! exports provided: default */
  60806. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60807. "use strict";
  60808. __webpack_require__.r(__webpack_exports__);
  60809. /* 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&");
  60810. /* 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&");
  60811. /* 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");
  60812. /* normalize component */
  60813. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60814. _Credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60815. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["render"],
  60816. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60817. false,
  60818. null,
  60819. null,
  60820. null
  60821. )
  60822. /* hot reload */
  60823. if (false) { var api; }
  60824. component.options.__file = "resources/js/components/Credential.vue"
  60825. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60826. /***/ }),
  60827. /***/ "./resources/js/components/Credential.vue?vue&type=script&lang=js&":
  60828. /*!*************************************************************************!*\
  60829. !*** ./resources/js/components/Credential.vue?vue&type=script&lang=js& ***!
  60830. \*************************************************************************/
  60831. /*! exports provided: default */
  60832. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60833. "use strict";
  60834. __webpack_require__.r(__webpack_exports__);
  60835. /* 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&");
  60836. /* 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"]);
  60837. /***/ }),
  60838. /***/ "./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&":
  60839. /*!*******************************************************************************!*\
  60840. !*** ./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc& ***!
  60841. \*******************************************************************************/
  60842. /*! exports provided: render, staticRenderFns */
  60843. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60844. "use strict";
  60845. __webpack_require__.r(__webpack_exports__);
  60846. /* 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&");
  60847. /* 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"]; });
  60848. /* 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"]; });
  60849. /***/ }),
  60850. /***/ "./resources/js/components/CredentialFormModal.vue":
  60851. /*!*********************************************************!*\
  60852. !*** ./resources/js/components/CredentialFormModal.vue ***!
  60853. \*********************************************************/
  60854. /*! exports provided: default */
  60855. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60856. "use strict";
  60857. __webpack_require__.r(__webpack_exports__);
  60858. /* 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&");
  60859. /* 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&");
  60860. /* 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");
  60861. /* normalize component */
  60862. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60863. _CredentialFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60864. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["render"],
  60865. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60866. false,
  60867. null,
  60868. null,
  60869. null
  60870. )
  60871. /* hot reload */
  60872. if (false) { var api; }
  60873. component.options.__file = "resources/js/components/CredentialFormModal.vue"
  60874. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60875. /***/ }),
  60876. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&":
  60877. /*!**********************************************************************************!*\
  60878. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js& ***!
  60879. \**********************************************************************************/
  60880. /*! exports provided: default */
  60881. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60882. "use strict";
  60883. __webpack_require__.r(__webpack_exports__);
  60884. /* 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&");
  60885. /* 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"]);
  60886. /***/ }),
  60887. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&":
  60888. /*!****************************************************************************************!*\
  60889. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697& ***!
  60890. \****************************************************************************************/
  60891. /*! exports provided: render, staticRenderFns */
  60892. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60893. "use strict";
  60894. __webpack_require__.r(__webpack_exports__);
  60895. /* 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&");
  60896. /* 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"]; });
  60897. /* 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"]; });
  60898. /***/ }),
  60899. /***/ "./resources/js/components/CredentialList.vue":
  60900. /*!****************************************************!*\
  60901. !*** ./resources/js/components/CredentialList.vue ***!
  60902. \****************************************************/
  60903. /*! exports provided: default */
  60904. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60905. "use strict";
  60906. __webpack_require__.r(__webpack_exports__);
  60907. /* 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&");
  60908. /* 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&");
  60909. /* 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");
  60910. /* normalize component */
  60911. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60912. _CredentialList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60913. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["render"],
  60914. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60915. false,
  60916. null,
  60917. null,
  60918. null
  60919. )
  60920. /* hot reload */
  60921. if (false) { var api; }
  60922. component.options.__file = "resources/js/components/CredentialList.vue"
  60923. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60924. /***/ }),
  60925. /***/ "./resources/js/components/CredentialList.vue?vue&type=script&lang=js&":
  60926. /*!*****************************************************************************!*\
  60927. !*** ./resources/js/components/CredentialList.vue?vue&type=script&lang=js& ***!
  60928. \*****************************************************************************/
  60929. /*! exports provided: default */
  60930. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60931. "use strict";
  60932. __webpack_require__.r(__webpack_exports__);
  60933. /* 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&");
  60934. /* 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"]);
  60935. /***/ }),
  60936. /***/ "./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&":
  60937. /*!***********************************************************************************!*\
  60938. !*** ./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80& ***!
  60939. \***********************************************************************************/
  60940. /*! exports provided: render, staticRenderFns */
  60941. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60942. "use strict";
  60943. __webpack_require__.r(__webpack_exports__);
  60944. /* 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&");
  60945. /* 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"]; });
  60946. /* 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"]; });
  60947. /***/ }),
  60948. /***/ "./resources/js/components/ErrorList.vue":
  60949. /*!***********************************************!*\
  60950. !*** ./resources/js/components/ErrorList.vue ***!
  60951. \***********************************************/
  60952. /*! exports provided: default */
  60953. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60954. "use strict";
  60955. __webpack_require__.r(__webpack_exports__);
  60956. /* 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&");
  60957. /* 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&");
  60958. /* 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");
  60959. /* normalize component */
  60960. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60961. _ErrorList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60962. _ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  60963. _ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60964. false,
  60965. null,
  60966. null,
  60967. null
  60968. )
  60969. /* hot reload */
  60970. if (false) { var api; }
  60971. component.options.__file = "resources/js/components/ErrorList.vue"
  60972. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60973. /***/ }),
  60974. /***/ "./resources/js/components/ErrorList.vue?vue&type=script&lang=js&":
  60975. /*!************************************************************************!*\
  60976. !*** ./resources/js/components/ErrorList.vue?vue&type=script&lang=js& ***!
  60977. \************************************************************************/
  60978. /*! exports provided: default */
  60979. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60980. "use strict";
  60981. __webpack_require__.r(__webpack_exports__);
  60982. /* 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&");
  60983. /* 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"]);
  60984. /***/ }),
  60985. /***/ "./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb&":
  60986. /*!******************************************************************************!*\
  60987. !*** ./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb& ***!
  60988. \******************************************************************************/
  60989. /*! exports provided: render, staticRenderFns */
  60990. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60991. "use strict";
  60992. __webpack_require__.r(__webpack_exports__);
  60993. /* 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&");
  60994. /* 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"]; });
  60995. /* 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"]; });
  60996. /***/ }),
  60997. /***/ "./resources/js/components/Modal.vue":
  60998. /*!*******************************************!*\
  60999. !*** ./resources/js/components/Modal.vue ***!
  61000. \*******************************************/
  61001. /*! exports provided: default */
  61002. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61003. "use strict";
  61004. __webpack_require__.r(__webpack_exports__);
  61005. /* 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&");
  61006. /* 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");
  61007. var script = {}
  61008. /* normalize component */
  61009. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  61010. script,
  61011. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["render"],
  61012. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61013. false,
  61014. null,
  61015. null,
  61016. null
  61017. )
  61018. /* hot reload */
  61019. if (false) { var api; }
  61020. component.options.__file = "resources/js/components/Modal.vue"
  61021. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61022. /***/ }),
  61023. /***/ "./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&":
  61024. /*!**************************************************************************!*\
  61025. !*** ./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2& ***!
  61026. \**************************************************************************/
  61027. /*! exports provided: render, staticRenderFns */
  61028. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61029. "use strict";
  61030. __webpack_require__.r(__webpack_exports__);
  61031. /* 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&");
  61032. /* 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"]; });
  61033. /* 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"]; });
  61034. /***/ }),
  61035. /***/ "./resources/js/components/NoteDeleteModal.vue":
  61036. /*!*****************************************************!*\
  61037. !*** ./resources/js/components/NoteDeleteModal.vue ***!
  61038. \*****************************************************/
  61039. /*! exports provided: default */
  61040. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61041. "use strict";
  61042. __webpack_require__.r(__webpack_exports__);
  61043. /* harmony import */ var _NoteDeleteModal_vue_vue_type_template_id_49f798d5___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NoteDeleteModal.vue?vue&type=template&id=49f798d5& */ "./resources/js/components/NoteDeleteModal.vue?vue&type=template&id=49f798d5&");
  61044. /* harmony import */ var _NoteDeleteModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NoteDeleteModal.vue?vue&type=script&lang=js& */ "./resources/js/components/NoteDeleteModal.vue?vue&type=script&lang=js&");
  61045. /* 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");
  61046. /* normalize component */
  61047. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61048. _NoteDeleteModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61049. _NoteDeleteModal_vue_vue_type_template_id_49f798d5___WEBPACK_IMPORTED_MODULE_0__["render"],
  61050. _NoteDeleteModal_vue_vue_type_template_id_49f798d5___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61051. false,
  61052. null,
  61053. null,
  61054. null
  61055. )
  61056. /* hot reload */
  61057. if (false) { var api; }
  61058. component.options.__file = "resources/js/components/NoteDeleteModal.vue"
  61059. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61060. /***/ }),
  61061. /***/ "./resources/js/components/NoteDeleteModal.vue?vue&type=script&lang=js&":
  61062. /*!******************************************************************************!*\
  61063. !*** ./resources/js/components/NoteDeleteModal.vue?vue&type=script&lang=js& ***!
  61064. \******************************************************************************/
  61065. /*! exports provided: default */
  61066. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61067. "use strict";
  61068. __webpack_require__.r(__webpack_exports__);
  61069. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_NoteDeleteModal_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!./NoteDeleteModal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/NoteDeleteModal.vue?vue&type=script&lang=js&");
  61070. /* 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_NoteDeleteModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  61071. /***/ }),
  61072. /***/ "./resources/js/components/NoteDeleteModal.vue?vue&type=template&id=49f798d5&":
  61073. /*!************************************************************************************!*\
  61074. !*** ./resources/js/components/NoteDeleteModal.vue?vue&type=template&id=49f798d5& ***!
  61075. \************************************************************************************/
  61076. /*! exports provided: render, staticRenderFns */
  61077. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61078. "use strict";
  61079. __webpack_require__.r(__webpack_exports__);
  61080. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_NoteDeleteModal_vue_vue_type_template_id_49f798d5___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!./NoteDeleteModal.vue?vue&type=template&id=49f798d5& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/NoteDeleteModal.vue?vue&type=template&id=49f798d5&");
  61081. /* 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_NoteDeleteModal_vue_vue_type_template_id_49f798d5___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  61082. /* 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_NoteDeleteModal_vue_vue_type_template_id_49f798d5___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  61083. /***/ }),
  61084. /***/ "./resources/js/components/NoteFormModal.vue":
  61085. /*!***************************************************!*\
  61086. !*** ./resources/js/components/NoteFormModal.vue ***!
  61087. \***************************************************/
  61088. /*! exports provided: default */
  61089. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61090. "use strict";
  61091. __webpack_require__.r(__webpack_exports__);
  61092. /* 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&");
  61093. /* 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&");
  61094. /* 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");
  61095. /* normalize component */
  61096. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61097. _NoteFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61098. _NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["render"],
  61099. _NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61100. false,
  61101. null,
  61102. null,
  61103. null
  61104. )
  61105. /* hot reload */
  61106. if (false) { var api; }
  61107. component.options.__file = "resources/js/components/NoteFormModal.vue"
  61108. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61109. /***/ }),
  61110. /***/ "./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js&":
  61111. /*!****************************************************************************!*\
  61112. !*** ./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js& ***!
  61113. \****************************************************************************/
  61114. /*! exports provided: default */
  61115. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61116. "use strict";
  61117. __webpack_require__.r(__webpack_exports__);
  61118. /* 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&");
  61119. /* 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"]);
  61120. /***/ }),
  61121. /***/ "./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c&":
  61122. /*!**********************************************************************************!*\
  61123. !*** ./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c& ***!
  61124. \**********************************************************************************/
  61125. /*! exports provided: render, staticRenderFns */
  61126. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61127. "use strict";
  61128. __webpack_require__.r(__webpack_exports__);
  61129. /* 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&");
  61130. /* 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"]; });
  61131. /* 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"]; });
  61132. /***/ }),
  61133. /***/ "./resources/js/components/Notes.vue":
  61134. /*!*******************************************!*\
  61135. !*** ./resources/js/components/Notes.vue ***!
  61136. \*******************************************/
  61137. /*! exports provided: default */
  61138. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61139. "use strict";
  61140. __webpack_require__.r(__webpack_exports__);
  61141. /* 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&");
  61142. /* 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&");
  61143. /* 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");
  61144. /* normalize component */
  61145. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61146. _Notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61147. _Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["render"],
  61148. _Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61149. false,
  61150. null,
  61151. null,
  61152. null
  61153. )
  61154. /* hot reload */
  61155. if (false) { var api; }
  61156. component.options.__file = "resources/js/components/Notes.vue"
  61157. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61158. /***/ }),
  61159. /***/ "./resources/js/components/Notes.vue?vue&type=script&lang=js&":
  61160. /*!********************************************************************!*\
  61161. !*** ./resources/js/components/Notes.vue?vue&type=script&lang=js& ***!
  61162. \********************************************************************/
  61163. /*! exports provided: default */
  61164. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61165. "use strict";
  61166. __webpack_require__.r(__webpack_exports__);
  61167. /* 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&");
  61168. /* 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"]);
  61169. /***/ }),
  61170. /***/ "./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6&":
  61171. /*!**************************************************************************!*\
  61172. !*** ./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6& ***!
  61173. \**************************************************************************/
  61174. /*! exports provided: render, staticRenderFns */
  61175. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61176. "use strict";
  61177. __webpack_require__.r(__webpack_exports__);
  61178. /* 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&");
  61179. /* 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"]; });
  61180. /* 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"]; });
  61181. /***/ }),
  61182. /***/ "./resources/js/components/WoInfoEditModal.vue":
  61183. /*!*****************************************************!*\
  61184. !*** ./resources/js/components/WoInfoEditModal.vue ***!
  61185. \*****************************************************/
  61186. /*! exports provided: default */
  61187. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61188. "use strict";
  61189. __webpack_require__.r(__webpack_exports__);
  61190. /* 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&");
  61191. /* 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&");
  61192. /* 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");
  61193. /* normalize component */
  61194. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61195. _WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61196. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["render"],
  61197. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61198. false,
  61199. null,
  61200. null,
  61201. null
  61202. )
  61203. /* hot reload */
  61204. if (false) { var api; }
  61205. component.options.__file = "resources/js/components/WoInfoEditModal.vue"
  61206. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61207. /***/ }),
  61208. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  61209. /*!******************************************************************************!*\
  61210. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js& ***!
  61211. \******************************************************************************/
  61212. /*! exports provided: default */
  61213. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61214. "use strict";
  61215. __webpack_require__.r(__webpack_exports__);
  61216. /* 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&");
  61217. /* 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"]);
  61218. /***/ }),
  61219. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&":
  61220. /*!************************************************************************************!*\
  61221. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2& ***!
  61222. \************************************************************************************/
  61223. /*! exports provided: render, staticRenderFns */
  61224. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61225. "use strict";
  61226. __webpack_require__.r(__webpack_exports__);
  61227. /* 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&");
  61228. /* 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"]; });
  61229. /* 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"]; });
  61230. /***/ }),
  61231. /***/ "./resources/js/components/WorkOrderInfo.vue":
  61232. /*!***************************************************!*\
  61233. !*** ./resources/js/components/WorkOrderInfo.vue ***!
  61234. \***************************************************/
  61235. /*! exports provided: default */
  61236. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61237. "use strict";
  61238. __webpack_require__.r(__webpack_exports__);
  61239. /* 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&");
  61240. /* 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&");
  61241. /* 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");
  61242. /* normalize component */
  61243. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61244. _WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61245. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["render"],
  61246. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61247. false,
  61248. null,
  61249. null,
  61250. null
  61251. )
  61252. /* hot reload */
  61253. if (false) { var api; }
  61254. component.options.__file = "resources/js/components/WorkOrderInfo.vue"
  61255. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61256. /***/ }),
  61257. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  61258. /*!****************************************************************************!*\
  61259. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js& ***!
  61260. \****************************************************************************/
  61261. /*! exports provided: default */
  61262. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61263. "use strict";
  61264. __webpack_require__.r(__webpack_exports__);
  61265. /* 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&");
  61266. /* 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"]);
  61267. /***/ }),
  61268. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&":
  61269. /*!**********************************************************************************!*\
  61270. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330& ***!
  61271. \**********************************************************************************/
  61272. /*! exports provided: render, staticRenderFns */
  61273. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61274. "use strict";
  61275. __webpack_require__.r(__webpack_exports__);
  61276. /* 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&");
  61277. /* 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"]; });
  61278. /* 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"]; });
  61279. /***/ }),
  61280. /***/ "./resources/js/mixins/dateMixin.js":
  61281. /*!******************************************!*\
  61282. !*** ./resources/js/mixins/dateMixin.js ***!
  61283. \******************************************/
  61284. /*! exports provided: default */
  61285. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61286. "use strict";
  61287. __webpack_require__.r(__webpack_exports__);
  61288. /* harmony default export */ __webpack_exports__["default"] = ({
  61289. methods: {
  61290. treatAsUTC: function treatAsUTC(date) {
  61291. var result = new Date(date);
  61292. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  61293. return result;
  61294. },
  61295. daysSinceToday: function daysSinceToday(date) {
  61296. var currentDate = new Date();
  61297. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  61298. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  61299. },
  61300. getHRDate: function getHRDate(dateString) {
  61301. var date = new Date(dateString);
  61302. return date.toLocaleString('default', {
  61303. month: 'short',
  61304. day: 'numeric',
  61305. year: 'numeric',
  61306. hour: 'numeric',
  61307. minute: 'numeric'
  61308. });
  61309. },
  61310. isZero: function isZero(dateString) {
  61311. return dateString === '0000-00-00 00:00:00';
  61312. }
  61313. }
  61314. });
  61315. /***/ }),
  61316. /***/ "./resources/js/notify.min.js":
  61317. /*!************************************!*\
  61318. !*** ./resources/js/notify.min.js ***!
  61319. \************************************/
  61320. /*! no static exports found */
  61321. /***/ (function(module, exports, __webpack_require__) {
  61322. 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); }
  61323. (function (e) {
  61324. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  61325. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  61326. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  61327. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  61328. })(function (e) {
  61329. function A(t, n, i) {
  61330. typeof i == "string" && (i = {
  61331. className: i
  61332. }), 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);
  61333. }
  61334. var t = [].indexOf || function (e) {
  61335. for (var t = 0, n = this.length; t < n; t++) {
  61336. if (t in this && this[t] === e) return t;
  61337. }
  61338. return -1;
  61339. },
  61340. n = "notify",
  61341. r = n + "js",
  61342. i = n + "!blank",
  61343. s = {
  61344. t: "top",
  61345. m: "middle",
  61346. b: "bottom",
  61347. l: "left",
  61348. c: "center",
  61349. r: "right"
  61350. },
  61351. o = ["l", "c", "r"],
  61352. u = ["t", "m", "b"],
  61353. a = ["t", "b", "l", "r"],
  61354. f = {
  61355. t: "b",
  61356. m: null,
  61357. b: "t",
  61358. l: "r",
  61359. c: null,
  61360. r: "l"
  61361. },
  61362. l = function l(t) {
  61363. var n;
  61364. return n = [], e.each(t.split(/\W+/), function (e, t) {
  61365. var r;
  61366. r = t.toLowerCase().charAt(0);
  61367. if (s[r]) return n.push(r);
  61368. }), n;
  61369. },
  61370. c = {},
  61371. h = {
  61372. name: "core",
  61373. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  61374. 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}"
  61375. },
  61376. p = {
  61377. "border-radius": ["-webkit-", "-moz-"]
  61378. },
  61379. d = function d(e) {
  61380. return c[e];
  61381. },
  61382. v = function v(e) {
  61383. if (!e) throw "Missing Style name";
  61384. c[e] && delete c[e];
  61385. },
  61386. m = function m(t, i) {
  61387. if (!t) throw "Missing Style name";
  61388. if (!i) throw "Missing Style definition";
  61389. if (!i.html) throw "Missing Style HTML";
  61390. var s = c[t];
  61391. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  61392. var o = "";
  61393. i.classes && e.each(i.classes, function (t, n) {
  61394. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  61395. return p[t] && e.each(p[t], function (e, r) {
  61396. return o += " " + r + t + ": " + n + ";\n";
  61397. }), o += " " + t + ": " + n + ";\n";
  61398. }), o += "}\n";
  61399. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  61400. var u = {},
  61401. a = e(i.html);
  61402. y("html", a, u), y("text", a, u), i.fields = u;
  61403. },
  61404. g = function g(t) {
  61405. var n, r, i;
  61406. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  61407. try {
  61408. r.html(t);
  61409. } catch (s) {
  61410. r[0].styleSheet.cssText = t;
  61411. }
  61412. return r;
  61413. },
  61414. y = function y(t, n, r) {
  61415. var s;
  61416. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  61417. var n;
  61418. n = e(this).attr(s), n || (n = i), r[n] = t;
  61419. });
  61420. },
  61421. b = function b(e, t) {
  61422. return e.is(t) ? e : e.find(t);
  61423. },
  61424. w = {
  61425. clickToHide: !0,
  61426. autoHide: !0,
  61427. autoHideDelay: 5e3,
  61428. arrowShow: !0,
  61429. arrowSize: 5,
  61430. breakNewLines: !0,
  61431. elementPosition: "bottom",
  61432. globalPosition: "top right",
  61433. style: "bootstrap",
  61434. className: "error",
  61435. showAnimation: "slideDown",
  61436. showDuration: 400,
  61437. hideAnimation: "slideUp",
  61438. hideDuration: 200,
  61439. gap: 5
  61440. },
  61441. E = function E(t, n) {
  61442. var r;
  61443. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  61444. },
  61445. S = function S(t) {
  61446. return e.extend(w, t);
  61447. },
  61448. x = function x(t) {
  61449. return e("<" + t + "></" + t + ">");
  61450. },
  61451. T = {},
  61452. N = function N(t) {
  61453. var n;
  61454. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  61455. return e(r).attr("name") === t.attr("name");
  61456. }), t = n.first()), t;
  61457. },
  61458. C = function C(e, t, n) {
  61459. var r, i;
  61460. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  61461. if (isNaN(n)) return;
  61462. 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;
  61463. },
  61464. k = function k(e, t, n) {
  61465. if (e === "l" || e === "t") return 0;
  61466. if (e === "c" || e === "m") return n / 2 - t / 2;
  61467. if (e === "r" || e === "b") return n - t;
  61468. throw "Invalid alignment";
  61469. },
  61470. L = function L(e) {
  61471. return L.e = L.e || x("div"), L.e.text(e).html();
  61472. };
  61473. A.prototype.loadHTML = function () {
  61474. var t;
  61475. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  61476. }, A.prototype.show = function (e, t) {
  61477. var n, r, i, s, o;
  61478. r = function (n) {
  61479. return function () {
  61480. !e && !n.elem && n.destroy();
  61481. if (t) return t();
  61482. };
  61483. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  61484. 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 {
  61485. if (!!o || !!e) return r();
  61486. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  61487. }
  61488. return n.push(r), i[s].apply(i, n);
  61489. }, A.prototype.setGlobalPosition = function () {
  61490. var t = this.getPosition(),
  61491. n = t[0],
  61492. i = t[1],
  61493. o = s[n],
  61494. u = s[i],
  61495. a = n + "|" + i,
  61496. f = T[a];
  61497. if (!f || !document.body.contains(f[0])) {
  61498. f = T[a] = x("div");
  61499. var l = {};
  61500. 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);
  61501. }
  61502. return f.prepend(this.wrapper);
  61503. }, A.prototype.setElementPosition = function () {
  61504. 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;
  61505. 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"];
  61506. for (w = 0, S = B.length; w < S; w++) {
  61507. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  61508. }
  61509. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  61510. if (!this.options.arrowShow) this.arrow.hide();else {
  61511. 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";
  61512. for (E = 0, x = a.length; E < x; E++) {
  61513. D = a[E], P = s[D];
  61514. if (D === L) continue;
  61515. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  61516. }
  61517. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  61518. }
  61519. 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);
  61520. if (r) return this.arrow.removeAttr("style").css(r);
  61521. }, A.prototype.getPosition = function () {
  61522. var e, n, r, i, s, f, c, h;
  61523. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  61524. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  61525. 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";
  61526. return e.length === 2 && (e[2] = e[1]), e;
  61527. }, A.prototype.getStyle = function (e) {
  61528. var t;
  61529. e || (e = this.options.style), e || (e = "default"), t = c[e];
  61530. if (!t) throw "Missing style: " + e;
  61531. return t;
  61532. }, A.prototype.updateClasses = function () {
  61533. var t, n;
  61534. 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) {
  61535. return r + "-" + n.name + "-" + e;
  61536. }).join(" "), this.userContainer.attr("class", t);
  61537. }, A.prototype.run = function (t, n) {
  61538. var r, s, o, u, a;
  61539. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  61540. if (this.container && !t) {
  61541. this.show(!1);
  61542. return;
  61543. }
  61544. if (!this.container && !t) return;
  61545. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  61546. for (o in s) {
  61547. r = s[o], u = this.userFields[o];
  61548. if (!u) continue;
  61549. 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);
  61550. }
  61551. 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));
  61552. }, A.prototype.destroy = function () {
  61553. this.wrapper.data(r, null), this.wrapper.remove();
  61554. }, e[n] = function (t, r, i) {
  61555. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  61556. }, e.fn[n] = function (t, n) {
  61557. return e(this).each(function () {
  61558. var i = N(e(this)).data(r);
  61559. i && i.destroy();
  61560. var s = new A(e(this), t, n);
  61561. }), this;
  61562. }, e.extend(e[n], {
  61563. defaults: S,
  61564. addStyle: m,
  61565. removeStyle: v,
  61566. pluginOptions: w,
  61567. getStyle: d,
  61568. insertCSS: g
  61569. }), m("bootstrap", {
  61570. html: "<div>\n<span data-notify-text></span>\n</div>",
  61571. classes: {
  61572. base: {
  61573. "font-weight": "bold",
  61574. padding: "8px 15px 8px 14px",
  61575. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  61576. "background-color": "#fcf8e3",
  61577. border: "1px solid #fbeed5",
  61578. "border-radius": "4px",
  61579. "white-space": "nowrap",
  61580. "padding-left": "25px",
  61581. "background-repeat": "no-repeat",
  61582. "background-position": "3px 7px"
  61583. },
  61584. error: {
  61585. color: "#B94A48",
  61586. "background-color": "#F2DEDE",
  61587. "border-color": "#EED3D7",
  61588. "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=)"
  61589. },
  61590. success: {
  61591. color: "#468847",
  61592. "background-color": "#DFF0D8",
  61593. "border-color": "#D6E9C6",
  61594. "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==)"
  61595. },
  61596. info: {
  61597. color: "#3A87AD",
  61598. "background-color": "#D9EDF7",
  61599. "border-color": "#BCE8F1",
  61600. "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=)"
  61601. },
  61602. warn: {
  61603. color: "#C09853",
  61604. "background-color": "#FCF8E3",
  61605. "border-color": "#FBEED5",
  61606. "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)"
  61607. }
  61608. }
  61609. }), e(function () {
  61610. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  61611. e(this).trigger("notify-hide");
  61612. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  61613. var n = e(this).data(r);
  61614. n && n.show(!1);
  61615. });
  61616. });
  61617. });
  61618. /***/ }),
  61619. /***/ "./resources/js/views/App.vue":
  61620. /*!************************************!*\
  61621. !*** ./resources/js/views/App.vue ***!
  61622. \************************************/
  61623. /*! exports provided: default */
  61624. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61625. "use strict";
  61626. __webpack_require__.r(__webpack_exports__);
  61627. /* 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&");
  61628. /* 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&");
  61629. /* 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");
  61630. /* normalize component */
  61631. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61632. _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61633. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"],
  61634. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61635. false,
  61636. null,
  61637. null,
  61638. null
  61639. )
  61640. /* hot reload */
  61641. if (false) { var api; }
  61642. component.options.__file = "resources/js/views/App.vue"
  61643. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61644. /***/ }),
  61645. /***/ "./resources/js/views/App.vue?vue&type=script&lang=js&":
  61646. /*!*************************************************************!*\
  61647. !*** ./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  61648. \*************************************************************/
  61649. /*! exports provided: default */
  61650. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61651. "use strict";
  61652. __webpack_require__.r(__webpack_exports__);
  61653. /* 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&");
  61654. /* 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"]);
  61655. /***/ }),
  61656. /***/ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  61657. /*!*******************************************************************!*\
  61658. !*** ./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  61659. \*******************************************************************/
  61660. /*! exports provided: render, staticRenderFns */
  61661. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61662. "use strict";
  61663. __webpack_require__.r(__webpack_exports__);
  61664. /* 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&");
  61665. /* 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"]; });
  61666. /* 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"]; });
  61667. /***/ }),
  61668. /***/ "./resources/js/views/Dashboard.vue":
  61669. /*!******************************************!*\
  61670. !*** ./resources/js/views/Dashboard.vue ***!
  61671. \******************************************/
  61672. /*! exports provided: default */
  61673. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61674. "use strict";
  61675. __webpack_require__.r(__webpack_exports__);
  61676. /* 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&");
  61677. /* 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&");
  61678. /* 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");
  61679. /* normalize component */
  61680. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61681. _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61682. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"],
  61683. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61684. false,
  61685. null,
  61686. null,
  61687. null
  61688. )
  61689. /* hot reload */
  61690. if (false) { var api; }
  61691. component.options.__file = "resources/js/views/Dashboard.vue"
  61692. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61693. /***/ }),
  61694. /***/ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  61695. /*!*******************************************************************!*\
  61696. !*** ./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  61697. \*******************************************************************/
  61698. /*! exports provided: default */
  61699. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61700. "use strict";
  61701. __webpack_require__.r(__webpack_exports__);
  61702. /* 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&");
  61703. /* 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"]);
  61704. /***/ }),
  61705. /***/ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  61706. /*!*************************************************************************!*\
  61707. !*** ./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  61708. \*************************************************************************/
  61709. /*! exports provided: render, staticRenderFns */
  61710. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61711. "use strict";
  61712. __webpack_require__.r(__webpack_exports__);
  61713. /* 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&");
  61714. /* 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"]; });
  61715. /* 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"]; });
  61716. /***/ }),
  61717. /***/ "./resources/js/views/Login.vue":
  61718. /*!**************************************!*\
  61719. !*** ./resources/js/views/Login.vue ***!
  61720. \**************************************/
  61721. /*! exports provided: default */
  61722. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61723. "use strict";
  61724. __webpack_require__.r(__webpack_exports__);
  61725. /* 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&");
  61726. /* 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&");
  61727. /* 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");
  61728. /* normalize component */
  61729. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61730. _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61731. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"],
  61732. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61733. false,
  61734. null,
  61735. null,
  61736. null
  61737. )
  61738. /* hot reload */
  61739. if (false) { var api; }
  61740. component.options.__file = "resources/js/views/Login.vue"
  61741. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61742. /***/ }),
  61743. /***/ "./resources/js/views/Login.vue?vue&type=script&lang=js&":
  61744. /*!***************************************************************!*\
  61745. !*** ./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  61746. \***************************************************************/
  61747. /*! exports provided: default */
  61748. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61749. "use strict";
  61750. __webpack_require__.r(__webpack_exports__);
  61751. /* 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&");
  61752. /* 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"]);
  61753. /***/ }),
  61754. /***/ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  61755. /*!*********************************************************************!*\
  61756. !*** ./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  61757. \*********************************************************************/
  61758. /*! exports provided: render, staticRenderFns */
  61759. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61760. "use strict";
  61761. __webpack_require__.r(__webpack_exports__);
  61762. /* 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&");
  61763. /* 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"]; });
  61764. /* 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"]; });
  61765. /***/ }),
  61766. /***/ "./resources/js/views/Welcome.vue":
  61767. /*!****************************************!*\
  61768. !*** ./resources/js/views/Welcome.vue ***!
  61769. \****************************************/
  61770. /*! exports provided: default */
  61771. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61772. "use strict";
  61773. __webpack_require__.r(__webpack_exports__);
  61774. /* 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&");
  61775. /* 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&");
  61776. /* 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&");
  61777. /* 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");
  61778. /* normalize component */
  61779. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  61780. _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61781. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  61782. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61783. false,
  61784. null,
  61785. "1ae8ae93",
  61786. null
  61787. )
  61788. /* hot reload */
  61789. if (false) { var api; }
  61790. component.options.__file = "resources/js/views/Welcome.vue"
  61791. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61792. /***/ }),
  61793. /***/ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  61794. /*!*****************************************************************!*\
  61795. !*** ./resources/js/views/Welcome.vue?vue&type=script&lang=js& ***!
  61796. \*****************************************************************/
  61797. /*! exports provided: default */
  61798. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61799. "use strict";
  61800. __webpack_require__.r(__webpack_exports__);
  61801. /* 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&");
  61802. /* 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"]);
  61803. /***/ }),
  61804. /***/ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  61805. /*!*************************************************************************************************!*\
  61806. !*** ./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  61807. \*************************************************************************************************/
  61808. /*! no static exports found */
  61809. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61810. "use strict";
  61811. __webpack_require__.r(__webpack_exports__);
  61812. /* 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&");
  61813. /* 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__);
  61814. /* 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__));
  61815. /* 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);
  61816. /***/ }),
  61817. /***/ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  61818. /*!***********************************************************************************!*\
  61819. !*** ./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  61820. \***********************************************************************************/
  61821. /*! exports provided: render, staticRenderFns */
  61822. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61823. "use strict";
  61824. __webpack_require__.r(__webpack_exports__);
  61825. /* 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&");
  61826. /* 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"]; });
  61827. /* 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"]; });
  61828. /***/ }),
  61829. /***/ "./resources/js/views/WorkOrder.vue":
  61830. /*!******************************************!*\
  61831. !*** ./resources/js/views/WorkOrder.vue ***!
  61832. \******************************************/
  61833. /*! exports provided: default */
  61834. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61835. "use strict";
  61836. __webpack_require__.r(__webpack_exports__);
  61837. /* 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&");
  61838. /* 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&");
  61839. /* 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");
  61840. /* normalize component */
  61841. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61842. _WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61843. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["render"],
  61844. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61845. false,
  61846. null,
  61847. null,
  61848. null
  61849. )
  61850. /* hot reload */
  61851. if (false) { var api; }
  61852. component.options.__file = "resources/js/views/WorkOrder.vue"
  61853. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61854. /***/ }),
  61855. /***/ "./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  61856. /*!*******************************************************************!*\
  61857. !*** ./resources/js/views/WorkOrder.vue?vue&type=script&lang=js& ***!
  61858. \*******************************************************************/
  61859. /*! exports provided: default */
  61860. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61861. "use strict";
  61862. __webpack_require__.r(__webpack_exports__);
  61863. /* 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&");
  61864. /* 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"]);
  61865. /***/ }),
  61866. /***/ "./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&":
  61867. /*!*************************************************************************!*\
  61868. !*** ./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e& ***!
  61869. \*************************************************************************/
  61870. /*! exports provided: render, staticRenderFns */
  61871. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61872. "use strict";
  61873. __webpack_require__.r(__webpack_exports__);
  61874. /* 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&");
  61875. /* 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"]; });
  61876. /* 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"]; });
  61877. /***/ }),
  61878. /***/ "./resources/sass/app.scss":
  61879. /*!*********************************!*\
  61880. !*** ./resources/sass/app.scss ***!
  61881. \*********************************/
  61882. /*! no static exports found */
  61883. /***/ (function(module, exports) {
  61884. // removed by extract-text-webpack-plugin
  61885. /***/ }),
  61886. /***/ 0:
  61887. /*!*************************************************************!*\
  61888. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  61889. \*************************************************************/
  61890. /*! no static exports found */
  61891. /***/ (function(module, exports, __webpack_require__) {
  61892. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  61893. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  61894. /***/ })
  61895. /******/ });