app.js 2.0 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128
  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. methods: {
  2681. daysOrDate: function daysOrDate(date) {
  2682. if (this.daysSinceToday(date) <= 30) {
  2683. return Math.floor(this.daysSinceToday(date)) + "days ago";
  2684. } else {
  2685. return this.getHRDate(date);
  2686. }
  2687. }
  2688. }
  2689. });
  2690. /***/ }),
  2691. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=script&lang=js&":
  2692. /*!*********************************************************************************************************************************************************!*\
  2693. !*** ./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& ***!
  2694. \*********************************************************************************************************************************************************/
  2695. /*! exports provided: default */
  2696. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2697. "use strict";
  2698. __webpack_require__.r(__webpack_exports__);
  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. //
  2762. //
  2763. //
  2764. //
  2765. //
  2766. //
  2767. //
  2768. //
  2769. //
  2770. /* harmony default export */ __webpack_exports__["default"] = ({
  2771. data: function data() {
  2772. return {
  2773. isLoggedIn: null,
  2774. username: null
  2775. };
  2776. },
  2777. mounted: function mounted() {
  2778. this.isLoggedIn = localStorage.getItem('jwt');
  2779. this.username = localStorage.getItem('user');
  2780. }
  2781. });
  2782. /***/ }),
  2783. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  2784. /*!***************************************************************************************************************************************************************!*\
  2785. !*** ./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& ***!
  2786. \***************************************************************************************************************************************************************/
  2787. /*! exports provided: default */
  2788. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2789. "use strict";
  2790. __webpack_require__.r(__webpack_exports__);
  2791. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2792. //
  2793. //
  2794. //
  2795. //
  2796. //
  2797. //
  2798. //
  2799. //
  2800. //
  2801. //
  2802. //
  2803. //
  2804. //
  2805. //
  2806. //
  2807. //
  2808. //
  2809. //
  2810. //
  2811. //
  2812. //
  2813. //
  2814. //
  2815. //
  2816. //
  2817. //
  2818. /* harmony default export */ __webpack_exports__["default"] = ({
  2819. components: {
  2820. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  2821. },
  2822. data: function data() {
  2823. return {
  2824. workOrders: [],
  2825. isLoading: true
  2826. };
  2827. },
  2828. mounted: function mounted() {
  2829. var _this = this;
  2830. var token = localStorage.getItem('jwt');
  2831. var user = localStorage.getItem('user');
  2832. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2833. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
  2834. axios.get('api/users/' + user + '/workorders').then(function (response) {
  2835. _this.workOrders = response.data;
  2836. _this.isLoading = false;
  2837. })["catch"](function (error) {
  2838. console.log(error);
  2839. });
  2840. },
  2841. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2842. if (!localStorage.getItem('jwt')) {
  2843. return next('login');
  2844. }
  2845. next();
  2846. }
  2847. });
  2848. /***/ }),
  2849. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&":
  2850. /*!***********************************************************************************************************************************************************!*\
  2851. !*** ./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& ***!
  2852. \***********************************************************************************************************************************************************/
  2853. /*! exports provided: default */
  2854. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2855. "use strict";
  2856. __webpack_require__.r(__webpack_exports__);
  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. //
  2888. //
  2889. //
  2890. //
  2891. //
  2892. //
  2893. //
  2894. //
  2895. //
  2896. /* harmony default export */ __webpack_exports__["default"] = ({
  2897. data: function data() {
  2898. return {
  2899. username: "",
  2900. password: ""
  2901. };
  2902. },
  2903. methods: {
  2904. handleSubmit: function handleSubmit(e) {
  2905. var _this = this;
  2906. e.preventDefault();
  2907. if (this.password.length > 0) {
  2908. axios.post('api/login', {
  2909. username: this.username,
  2910. password: this.password
  2911. }).then(function (response) {
  2912. localStorage.setItem('user', response.data.success.username);
  2913. localStorage.setItem('jwt', response.data.success.token);
  2914. if (localStorage.getItem('jwt') != null) {
  2915. _this.$router.go('/dashboard');
  2916. }
  2917. })["catch"](function (error) {
  2918. console.error(error);
  2919. });
  2920. }
  2921. }
  2922. },
  2923. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2924. if (localStorage.getItem('jwt')) {
  2925. return next('dashboard');
  2926. }
  2927. next();
  2928. }
  2929. });
  2930. /***/ }),
  2931. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  2932. /*!*************************************************************************************************************************************************************!*\
  2933. !*** ./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& ***!
  2934. \*************************************************************************************************************************************************************/
  2935. /*! exports provided: default */
  2936. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2937. "use strict";
  2938. __webpack_require__.r(__webpack_exports__);
  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. //
  2982. //
  2983. //
  2984. //
  2985. //
  2986. //
  2987. //
  2988. //
  2989. //
  2990. /* harmony default export */ __webpack_exports__["default"] = ({});
  2991. /***/ }),
  2992. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  2993. /*!***************************************************************************************************************************************************************!*\
  2994. !*** ./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& ***!
  2995. \***************************************************************************************************************************************************************/
  2996. /*! exports provided: default */
  2997. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2998. "use strict";
  2999. __webpack_require__.r(__webpack_exports__);
  3000. /* harmony import */ var _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/WorkOrderInfo.vue */ "./resources/js/components/WorkOrderInfo.vue");
  3001. /* harmony import */ var _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AssetInfo.vue */ "./resources/js/components/AssetInfo.vue");
  3002. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  3003. /* harmony import */ var _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/CredentialList.vue */ "./resources/js/components/CredentialList.vue");
  3004. /* harmony import */ var _components_Notes_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/Notes.vue */ "./resources/js/components/Notes.vue");
  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. //
  3098. //
  3099. //
  3100. //
  3101. //
  3102. //
  3103. //
  3104. //
  3105. //
  3106. /* harmony default export */ __webpack_exports__["default"] = ({
  3107. components: {
  3108. WorkOrderInfo: _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  3109. AssetInfo: _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  3110. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  3111. CredentialList: _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
  3112. Notes: _components_Notes_vue__WEBPACK_IMPORTED_MODULE_4__["default"]
  3113. },
  3114. props: {
  3115. id: {
  3116. type: String,
  3117. required: true
  3118. }
  3119. },
  3120. data: function data() {
  3121. return {
  3122. workOrder: {},
  3123. asset: {},
  3124. stores: {},
  3125. credentials: {},
  3126. credentialDescriptions: {},
  3127. workOrderNotes: [],
  3128. woLoading: true,
  3129. assetLoading: true,
  3130. storesLoading: true,
  3131. credentialsLoading: true,
  3132. credentialDescriptionsLoading: true,
  3133. workOrderNotesLoading: true,
  3134. authUser: localStorage.getItem('user')
  3135. };
  3136. },
  3137. computed: {
  3138. publicNotes: function publicNotes() {
  3139. var notes = [];
  3140. notes = this.workOrderNotes.filter(function (note) {
  3141. return note.notetype === 0;
  3142. });
  3143. return notes;
  3144. },
  3145. privateNotes: function privateNotes() {
  3146. var notes = [];
  3147. notes = this.workOrderNotes.filter(function (note) {
  3148. return note.notetype === 1;
  3149. });
  3150. return notes;
  3151. }
  3152. },
  3153. mounted: function mounted() {
  3154. var _this = this;
  3155. // Get authentication info from current user from local storage
  3156. var token = localStorage.getItem('jwt');
  3157. var user = localStorage.getItem('user'); // Set some axios config options for Content-Type and Authentication.
  3158. axios.defaults.headers.common['Content-Type'] = 'application/json';
  3159. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token; // Get WorkOrder from API
  3160. axios.get('/api/workorders/' + this.id).then(function (response) {
  3161. _this.workOrder = response.data;
  3162. _this.woLoading = false;
  3163. })["catch"](function (error) {
  3164. console.log(error);
  3165. }); // Get list of stores from API
  3166. axios.get('/api/stores/').then(function (response) {
  3167. _this.stores = response.data;
  3168. _this.storesLoading = false;
  3169. })["catch"](function (error) {
  3170. console.log(error);
  3171. }); // Get Asset from API (will most likely be replaced with list of assets
  3172. // in the future. Current each WO can only have one but that is likely
  3173. // to change)
  3174. axios.get("/api/workorders/".concat(this.id, "/asset")).then(function (response) {
  3175. _this.asset = response.data;
  3176. _this.assetLoading = false; // Establish listener for liveupdate broadcasts.
  3177. // Must be done here or we can't guarantee this.asset
  3178. // exists by the time we execute this code.
  3179. Echo.channel('asset.' + _this.asset.pcid).listen('AssetUpdated', function (e) {
  3180. _this.asset = e.data;
  3181. }); // Get Credentials for this asset. May be relocated to be part of asset
  3182. // Component when WOs can have more than one asset.
  3183. axios.get("/api/assets/".concat(_this.asset.pcid, "/credentials")).then(function (response) {
  3184. _this.credentials = response.data;
  3185. _this.credentialsLoading = false;
  3186. })["catch"](function (error) {
  3187. console.log(error);
  3188. }); // Get default list of Credential Descriptions. May be relocated along with
  3189. // the above.
  3190. axios.get('/api/credentials/descriptions').then(function (response) {
  3191. _this.credentialDescriptions = response.data;
  3192. _this.credentialDescriptionsLoading = false;
  3193. })["catch"](function (error) {
  3194. console.log(error);
  3195. });
  3196. })["catch"](function (error) {
  3197. console.log(error);
  3198. });
  3199. axios.get("/api/workorders/".concat(this.id, "/notes")).then(function (response) {
  3200. _this.workOrderNotes = response.data;
  3201. _this.workOrderNotesLoading = false;
  3202. })["catch"](function (error) {
  3203. console.log(error);
  3204. });
  3205. Echo.channel('work-order.' + this.id).listen('WorkOrderUpdated', function (e) {
  3206. _this.workOrder = e.data;
  3207. });
  3208. Echo.channel('wonotes.' + this.id).listen('WorkOrderNoteAdded', function (e) {
  3209. _this.workOrderNotes.push(e.note);
  3210. }).listen('WorkOrderNoteUpdated', function (e) {
  3211. var index = _this.workOrderNotes.findIndex(function (note) {
  3212. return note.noteid === e.note.noteid;
  3213. }); // Sometimes when switching or deleting items from the end of a list,
  3214. // They go away before the modal can be hidden, this will hide the
  3215. // modal in case the component can't hide it itself. There may be
  3216. // a better way to do this.
  3217. $("#note".concat(e.note.noteid, "switchModal")).modal('hide'); // Note has to be edited this way, or else Vue cannot
  3218. // see it to recompute the computed values.
  3219. _this.workOrderNotes.splice(index, 1, e.note);
  3220. }).listen('WorkOrderNoteDeleted', function (e) {
  3221. var index = _this.workOrderNotes.findIndex(function (note) {
  3222. return note.noteid === e.note['noteid'];
  3223. });
  3224. $("#note".concat(e.note['noteid'], "deleteModal")).modal('hide');
  3225. _this.workOrderNotes.splice(index, 1);
  3226. });
  3227. }
  3228. });
  3229. /***/ }),
  3230. /***/ "./node_modules/base64-js/index.js":
  3231. /*!*****************************************!*\
  3232. !*** ./node_modules/base64-js/index.js ***!
  3233. \*****************************************/
  3234. /*! no static exports found */
  3235. /***/ (function(module, exports, __webpack_require__) {
  3236. "use strict";
  3237. exports.byteLength = byteLength
  3238. exports.toByteArray = toByteArray
  3239. exports.fromByteArray = fromByteArray
  3240. var lookup = []
  3241. var revLookup = []
  3242. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  3243. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  3244. for (var i = 0, len = code.length; i < len; ++i) {
  3245. lookup[i] = code[i]
  3246. revLookup[code.charCodeAt(i)] = i
  3247. }
  3248. // Support decoding URL-safe base64 strings, as Node.js does.
  3249. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  3250. revLookup['-'.charCodeAt(0)] = 62
  3251. revLookup['_'.charCodeAt(0)] = 63
  3252. function getLens (b64) {
  3253. var len = b64.length
  3254. if (len % 4 > 0) {
  3255. throw new Error('Invalid string. Length must be a multiple of 4')
  3256. }
  3257. // Trim off extra bytes after placeholder bytes are found
  3258. // See: https://github.com/beatgammit/base64-js/issues/42
  3259. var validLen = b64.indexOf('=')
  3260. if (validLen === -1) validLen = len
  3261. var placeHoldersLen = validLen === len
  3262. ? 0
  3263. : 4 - (validLen % 4)
  3264. return [validLen, placeHoldersLen]
  3265. }
  3266. // base64 is 4/3 + up to two characters of the original data
  3267. function byteLength (b64) {
  3268. var lens = getLens(b64)
  3269. var validLen = lens[0]
  3270. var placeHoldersLen = lens[1]
  3271. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  3272. }
  3273. function _byteLength (b64, validLen, placeHoldersLen) {
  3274. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  3275. }
  3276. function toByteArray (b64) {
  3277. var tmp
  3278. var lens = getLens(b64)
  3279. var validLen = lens[0]
  3280. var placeHoldersLen = lens[1]
  3281. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  3282. var curByte = 0
  3283. // if there are placeholders, only get up to the last complete 4 chars
  3284. var len = placeHoldersLen > 0
  3285. ? validLen - 4
  3286. : validLen
  3287. var i
  3288. for (i = 0; i < len; i += 4) {
  3289. tmp =
  3290. (revLookup[b64.charCodeAt(i)] << 18) |
  3291. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  3292. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  3293. revLookup[b64.charCodeAt(i + 3)]
  3294. arr[curByte++] = (tmp >> 16) & 0xFF
  3295. arr[curByte++] = (tmp >> 8) & 0xFF
  3296. arr[curByte++] = tmp & 0xFF
  3297. }
  3298. if (placeHoldersLen === 2) {
  3299. tmp =
  3300. (revLookup[b64.charCodeAt(i)] << 2) |
  3301. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  3302. arr[curByte++] = tmp & 0xFF
  3303. }
  3304. if (placeHoldersLen === 1) {
  3305. tmp =
  3306. (revLookup[b64.charCodeAt(i)] << 10) |
  3307. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  3308. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  3309. arr[curByte++] = (tmp >> 8) & 0xFF
  3310. arr[curByte++] = tmp & 0xFF
  3311. }
  3312. return arr
  3313. }
  3314. function tripletToBase64 (num) {
  3315. return lookup[num >> 18 & 0x3F] +
  3316. lookup[num >> 12 & 0x3F] +
  3317. lookup[num >> 6 & 0x3F] +
  3318. lookup[num & 0x3F]
  3319. }
  3320. function encodeChunk (uint8, start, end) {
  3321. var tmp
  3322. var output = []
  3323. for (var i = start; i < end; i += 3) {
  3324. tmp =
  3325. ((uint8[i] << 16) & 0xFF0000) +
  3326. ((uint8[i + 1] << 8) & 0xFF00) +
  3327. (uint8[i + 2] & 0xFF)
  3328. output.push(tripletToBase64(tmp))
  3329. }
  3330. return output.join('')
  3331. }
  3332. function fromByteArray (uint8) {
  3333. var tmp
  3334. var len = uint8.length
  3335. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  3336. var parts = []
  3337. var maxChunkLength = 16383 // must be multiple of 3
  3338. // go through the array every three bytes, we'll deal with trailing stuff later
  3339. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  3340. parts.push(encodeChunk(
  3341. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  3342. ))
  3343. }
  3344. // pad the end with zeros, but make sure to not forget the extra bytes
  3345. if (extraBytes === 1) {
  3346. tmp = uint8[len - 1]
  3347. parts.push(
  3348. lookup[tmp >> 2] +
  3349. lookup[(tmp << 4) & 0x3F] +
  3350. '=='
  3351. )
  3352. } else if (extraBytes === 2) {
  3353. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  3354. parts.push(
  3355. lookup[tmp >> 10] +
  3356. lookup[(tmp >> 4) & 0x3F] +
  3357. lookup[(tmp << 2) & 0x3F] +
  3358. '='
  3359. )
  3360. }
  3361. return parts.join('')
  3362. }
  3363. /***/ }),
  3364. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  3365. /*!*****************************************************!*\
  3366. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  3367. \*****************************************************/
  3368. /*! no static exports found */
  3369. /***/ (function(module, exports, __webpack_require__) {
  3370. /*!
  3371. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  3372. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  3373. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3374. */
  3375. (function (global, factory) {
  3376. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  3377. undefined;
  3378. }(this, (function (exports, $, Popper) { 'use strict';
  3379. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  3380. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  3381. function _defineProperties(target, props) {
  3382. for (var i = 0; i < props.length; i++) {
  3383. var descriptor = props[i];
  3384. descriptor.enumerable = descriptor.enumerable || false;
  3385. descriptor.configurable = true;
  3386. if ("value" in descriptor) descriptor.writable = true;
  3387. Object.defineProperty(target, descriptor.key, descriptor);
  3388. }
  3389. }
  3390. function _createClass(Constructor, protoProps, staticProps) {
  3391. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  3392. if (staticProps) _defineProperties(Constructor, staticProps);
  3393. return Constructor;
  3394. }
  3395. function _defineProperty(obj, key, value) {
  3396. if (key in obj) {
  3397. Object.defineProperty(obj, key, {
  3398. value: value,
  3399. enumerable: true,
  3400. configurable: true,
  3401. writable: true
  3402. });
  3403. } else {
  3404. obj[key] = value;
  3405. }
  3406. return obj;
  3407. }
  3408. function ownKeys(object, enumerableOnly) {
  3409. var keys = Object.keys(object);
  3410. if (Object.getOwnPropertySymbols) {
  3411. var symbols = Object.getOwnPropertySymbols(object);
  3412. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  3413. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  3414. });
  3415. keys.push.apply(keys, symbols);
  3416. }
  3417. return keys;
  3418. }
  3419. function _objectSpread2(target) {
  3420. for (var i = 1; i < arguments.length; i++) {
  3421. var source = arguments[i] != null ? arguments[i] : {};
  3422. if (i % 2) {
  3423. ownKeys(Object(source), true).forEach(function (key) {
  3424. _defineProperty(target, key, source[key]);
  3425. });
  3426. } else if (Object.getOwnPropertyDescriptors) {
  3427. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  3428. } else {
  3429. ownKeys(Object(source)).forEach(function (key) {
  3430. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  3431. });
  3432. }
  3433. }
  3434. return target;
  3435. }
  3436. function _inheritsLoose(subClass, superClass) {
  3437. subClass.prototype = Object.create(superClass.prototype);
  3438. subClass.prototype.constructor = subClass;
  3439. subClass.__proto__ = superClass;
  3440. }
  3441. /**
  3442. * --------------------------------------------------------------------------
  3443. * Bootstrap (v4.4.1): util.js
  3444. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3445. * --------------------------------------------------------------------------
  3446. */
  3447. /**
  3448. * ------------------------------------------------------------------------
  3449. * Private TransitionEnd Helpers
  3450. * ------------------------------------------------------------------------
  3451. */
  3452. var TRANSITION_END = 'transitionend';
  3453. var MAX_UID = 1000000;
  3454. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  3455. function toType(obj) {
  3456. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  3457. }
  3458. function getSpecialTransitionEndEvent() {
  3459. return {
  3460. bindType: TRANSITION_END,
  3461. delegateType: TRANSITION_END,
  3462. handle: function handle(event) {
  3463. if ($(event.target).is(this)) {
  3464. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  3465. }
  3466. return undefined; // eslint-disable-line no-undefined
  3467. }
  3468. };
  3469. }
  3470. function transitionEndEmulator(duration) {
  3471. var _this = this;
  3472. var called = false;
  3473. $(this).one(Util.TRANSITION_END, function () {
  3474. called = true;
  3475. });
  3476. setTimeout(function () {
  3477. if (!called) {
  3478. Util.triggerTransitionEnd(_this);
  3479. }
  3480. }, duration);
  3481. return this;
  3482. }
  3483. function setTransitionEndSupport() {
  3484. $.fn.emulateTransitionEnd = transitionEndEmulator;
  3485. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  3486. }
  3487. /**
  3488. * --------------------------------------------------------------------------
  3489. * Public Util Api
  3490. * --------------------------------------------------------------------------
  3491. */
  3492. var Util = {
  3493. TRANSITION_END: 'bsTransitionEnd',
  3494. getUID: function getUID(prefix) {
  3495. do {
  3496. // eslint-disable-next-line no-bitwise
  3497. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  3498. } while (document.getElementById(prefix));
  3499. return prefix;
  3500. },
  3501. getSelectorFromElement: function getSelectorFromElement(element) {
  3502. var selector = element.getAttribute('data-target');
  3503. if (!selector || selector === '#') {
  3504. var hrefAttr = element.getAttribute('href');
  3505. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  3506. }
  3507. try {
  3508. return document.querySelector(selector) ? selector : null;
  3509. } catch (err) {
  3510. return null;
  3511. }
  3512. },
  3513. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  3514. if (!element) {
  3515. return 0;
  3516. } // Get transition-duration of the element
  3517. var transitionDuration = $(element).css('transition-duration');
  3518. var transitionDelay = $(element).css('transition-delay');
  3519. var floatTransitionDuration = parseFloat(transitionDuration);
  3520. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  3521. if (!floatTransitionDuration && !floatTransitionDelay) {
  3522. return 0;
  3523. } // If multiple durations are defined, take the first
  3524. transitionDuration = transitionDuration.split(',')[0];
  3525. transitionDelay = transitionDelay.split(',')[0];
  3526. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  3527. },
  3528. reflow: function reflow(element) {
  3529. return element.offsetHeight;
  3530. },
  3531. triggerTransitionEnd: function triggerTransitionEnd(element) {
  3532. $(element).trigger(TRANSITION_END);
  3533. },
  3534. // TODO: Remove in v5
  3535. supportsTransitionEnd: function supportsTransitionEnd() {
  3536. return Boolean(TRANSITION_END);
  3537. },
  3538. isElement: function isElement(obj) {
  3539. return (obj[0] || obj).nodeType;
  3540. },
  3541. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  3542. for (var property in configTypes) {
  3543. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  3544. var expectedTypes = configTypes[property];
  3545. var value = config[property];
  3546. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  3547. if (!new RegExp(expectedTypes).test(valueType)) {
  3548. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  3549. }
  3550. }
  3551. }
  3552. },
  3553. findShadowRoot: function findShadowRoot(element) {
  3554. if (!document.documentElement.attachShadow) {
  3555. return null;
  3556. } // Can find the shadow root otherwise it'll return the document
  3557. if (typeof element.getRootNode === 'function') {
  3558. var root = element.getRootNode();
  3559. return root instanceof ShadowRoot ? root : null;
  3560. }
  3561. if (element instanceof ShadowRoot) {
  3562. return element;
  3563. } // when we don't find a shadow root
  3564. if (!element.parentNode) {
  3565. return null;
  3566. }
  3567. return Util.findShadowRoot(element.parentNode);
  3568. },
  3569. jQueryDetection: function jQueryDetection() {
  3570. if (typeof $ === 'undefined') {
  3571. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  3572. }
  3573. var version = $.fn.jquery.split(' ')[0].split('.');
  3574. var minMajor = 1;
  3575. var ltMajor = 2;
  3576. var minMinor = 9;
  3577. var minPatch = 1;
  3578. var maxMajor = 4;
  3579. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  3580. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  3581. }
  3582. }
  3583. };
  3584. Util.jQueryDetection();
  3585. setTransitionEndSupport();
  3586. /**
  3587. * ------------------------------------------------------------------------
  3588. * Constants
  3589. * ------------------------------------------------------------------------
  3590. */
  3591. var NAME = 'alert';
  3592. var VERSION = '4.4.1';
  3593. var DATA_KEY = 'bs.alert';
  3594. var EVENT_KEY = "." + DATA_KEY;
  3595. var DATA_API_KEY = '.data-api';
  3596. var JQUERY_NO_CONFLICT = $.fn[NAME];
  3597. var Selector = {
  3598. DISMISS: '[data-dismiss="alert"]'
  3599. };
  3600. var Event = {
  3601. CLOSE: "close" + EVENT_KEY,
  3602. CLOSED: "closed" + EVENT_KEY,
  3603. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  3604. };
  3605. var ClassName = {
  3606. ALERT: 'alert',
  3607. FADE: 'fade',
  3608. SHOW: 'show'
  3609. };
  3610. /**
  3611. * ------------------------------------------------------------------------
  3612. * Class Definition
  3613. * ------------------------------------------------------------------------
  3614. */
  3615. var Alert =
  3616. /*#__PURE__*/
  3617. function () {
  3618. function Alert(element) {
  3619. this._element = element;
  3620. } // Getters
  3621. var _proto = Alert.prototype;
  3622. // Public
  3623. _proto.close = function close(element) {
  3624. var rootElement = this._element;
  3625. if (element) {
  3626. rootElement = this._getRootElement(element);
  3627. }
  3628. var customEvent = this._triggerCloseEvent(rootElement);
  3629. if (customEvent.isDefaultPrevented()) {
  3630. return;
  3631. }
  3632. this._removeElement(rootElement);
  3633. };
  3634. _proto.dispose = function dispose() {
  3635. $.removeData(this._element, DATA_KEY);
  3636. this._element = null;
  3637. } // Private
  3638. ;
  3639. _proto._getRootElement = function _getRootElement(element) {
  3640. var selector = Util.getSelectorFromElement(element);
  3641. var parent = false;
  3642. if (selector) {
  3643. parent = document.querySelector(selector);
  3644. }
  3645. if (!parent) {
  3646. parent = $(element).closest("." + ClassName.ALERT)[0];
  3647. }
  3648. return parent;
  3649. };
  3650. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  3651. var closeEvent = $.Event(Event.CLOSE);
  3652. $(element).trigger(closeEvent);
  3653. return closeEvent;
  3654. };
  3655. _proto._removeElement = function _removeElement(element) {
  3656. var _this = this;
  3657. $(element).removeClass(ClassName.SHOW);
  3658. if (!$(element).hasClass(ClassName.FADE)) {
  3659. this._destroyElement(element);
  3660. return;
  3661. }
  3662. var transitionDuration = Util.getTransitionDurationFromElement(element);
  3663. $(element).one(Util.TRANSITION_END, function (event) {
  3664. return _this._destroyElement(element, event);
  3665. }).emulateTransitionEnd(transitionDuration);
  3666. };
  3667. _proto._destroyElement = function _destroyElement(element) {
  3668. $(element).detach().trigger(Event.CLOSED).remove();
  3669. } // Static
  3670. ;
  3671. Alert._jQueryInterface = function _jQueryInterface(config) {
  3672. return this.each(function () {
  3673. var $element = $(this);
  3674. var data = $element.data(DATA_KEY);
  3675. if (!data) {
  3676. data = new Alert(this);
  3677. $element.data(DATA_KEY, data);
  3678. }
  3679. if (config === 'close') {
  3680. data[config](this);
  3681. }
  3682. });
  3683. };
  3684. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  3685. return function (event) {
  3686. if (event) {
  3687. event.preventDefault();
  3688. }
  3689. alertInstance.close(this);
  3690. };
  3691. };
  3692. _createClass(Alert, null, [{
  3693. key: "VERSION",
  3694. get: function get() {
  3695. return VERSION;
  3696. }
  3697. }]);
  3698. return Alert;
  3699. }();
  3700. /**
  3701. * ------------------------------------------------------------------------
  3702. * Data Api implementation
  3703. * ------------------------------------------------------------------------
  3704. */
  3705. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  3706. /**
  3707. * ------------------------------------------------------------------------
  3708. * jQuery
  3709. * ------------------------------------------------------------------------
  3710. */
  3711. $.fn[NAME] = Alert._jQueryInterface;
  3712. $.fn[NAME].Constructor = Alert;
  3713. $.fn[NAME].noConflict = function () {
  3714. $.fn[NAME] = JQUERY_NO_CONFLICT;
  3715. return Alert._jQueryInterface;
  3716. };
  3717. /**
  3718. * ------------------------------------------------------------------------
  3719. * Constants
  3720. * ------------------------------------------------------------------------
  3721. */
  3722. var NAME$1 = 'button';
  3723. var VERSION$1 = '4.4.1';
  3724. var DATA_KEY$1 = 'bs.button';
  3725. var EVENT_KEY$1 = "." + DATA_KEY$1;
  3726. var DATA_API_KEY$1 = '.data-api';
  3727. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  3728. var ClassName$1 = {
  3729. ACTIVE: 'active',
  3730. BUTTON: 'btn',
  3731. FOCUS: 'focus'
  3732. };
  3733. var Selector$1 = {
  3734. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  3735. DATA_TOGGLES: '[data-toggle="buttons"]',
  3736. DATA_TOGGLE: '[data-toggle="button"]',
  3737. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  3738. INPUT: 'input:not([type="hidden"])',
  3739. ACTIVE: '.active',
  3740. BUTTON: '.btn'
  3741. };
  3742. var Event$1 = {
  3743. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  3744. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  3745. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  3746. };
  3747. /**
  3748. * ------------------------------------------------------------------------
  3749. * Class Definition
  3750. * ------------------------------------------------------------------------
  3751. */
  3752. var Button =
  3753. /*#__PURE__*/
  3754. function () {
  3755. function Button(element) {
  3756. this._element = element;
  3757. } // Getters
  3758. var _proto = Button.prototype;
  3759. // Public
  3760. _proto.toggle = function toggle() {
  3761. var triggerChangeEvent = true;
  3762. var addAriaPressed = true;
  3763. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  3764. if (rootElement) {
  3765. var input = this._element.querySelector(Selector$1.INPUT);
  3766. if (input) {
  3767. if (input.type === 'radio') {
  3768. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  3769. triggerChangeEvent = false;
  3770. } else {
  3771. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  3772. if (activeElement) {
  3773. $(activeElement).removeClass(ClassName$1.ACTIVE);
  3774. }
  3775. }
  3776. } else if (input.type === 'checkbox') {
  3777. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  3778. triggerChangeEvent = false;
  3779. }
  3780. } else {
  3781. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  3782. triggerChangeEvent = false;
  3783. }
  3784. if (triggerChangeEvent) {
  3785. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  3786. $(input).trigger('change');
  3787. }
  3788. input.focus();
  3789. addAriaPressed = false;
  3790. }
  3791. }
  3792. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  3793. if (addAriaPressed) {
  3794. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  3795. }
  3796. if (triggerChangeEvent) {
  3797. $(this._element).toggleClass(ClassName$1.ACTIVE);
  3798. }
  3799. }
  3800. };
  3801. _proto.dispose = function dispose() {
  3802. $.removeData(this._element, DATA_KEY$1);
  3803. this._element = null;
  3804. } // Static
  3805. ;
  3806. Button._jQueryInterface = function _jQueryInterface(config) {
  3807. return this.each(function () {
  3808. var data = $(this).data(DATA_KEY$1);
  3809. if (!data) {
  3810. data = new Button(this);
  3811. $(this).data(DATA_KEY$1, data);
  3812. }
  3813. if (config === 'toggle') {
  3814. data[config]();
  3815. }
  3816. });
  3817. };
  3818. _createClass(Button, null, [{
  3819. key: "VERSION",
  3820. get: function get() {
  3821. return VERSION$1;
  3822. }
  3823. }]);
  3824. return Button;
  3825. }();
  3826. /**
  3827. * ------------------------------------------------------------------------
  3828. * Data Api implementation
  3829. * ------------------------------------------------------------------------
  3830. */
  3831. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3832. var button = event.target;
  3833. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  3834. button = $(button).closest(Selector$1.BUTTON)[0];
  3835. }
  3836. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3837. event.preventDefault(); // work around Firefox bug #1540995
  3838. } else {
  3839. var inputBtn = button.querySelector(Selector$1.INPUT);
  3840. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3841. event.preventDefault(); // work around Firefox bug #1540995
  3842. return;
  3843. }
  3844. Button._jQueryInterface.call($(button), 'toggle');
  3845. }
  3846. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3847. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3848. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3849. });
  3850. $(window).on(Event$1.LOAD_DATA_API, function () {
  3851. // ensure correct active class is set to match the controls' actual values/states
  3852. // find all checkboxes/readio buttons inside data-toggle groups
  3853. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3854. for (var i = 0, len = buttons.length; i < len; i++) {
  3855. var button = buttons[i];
  3856. var input = button.querySelector(Selector$1.INPUT);
  3857. if (input.checked || input.hasAttribute('checked')) {
  3858. button.classList.add(ClassName$1.ACTIVE);
  3859. } else {
  3860. button.classList.remove(ClassName$1.ACTIVE);
  3861. }
  3862. } // find all button toggles
  3863. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3864. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3865. var _button = buttons[_i];
  3866. if (_button.getAttribute('aria-pressed') === 'true') {
  3867. _button.classList.add(ClassName$1.ACTIVE);
  3868. } else {
  3869. _button.classList.remove(ClassName$1.ACTIVE);
  3870. }
  3871. }
  3872. });
  3873. /**
  3874. * ------------------------------------------------------------------------
  3875. * jQuery
  3876. * ------------------------------------------------------------------------
  3877. */
  3878. $.fn[NAME$1] = Button._jQueryInterface;
  3879. $.fn[NAME$1].Constructor = Button;
  3880. $.fn[NAME$1].noConflict = function () {
  3881. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3882. return Button._jQueryInterface;
  3883. };
  3884. /**
  3885. * ------------------------------------------------------------------------
  3886. * Constants
  3887. * ------------------------------------------------------------------------
  3888. */
  3889. var NAME$2 = 'carousel';
  3890. var VERSION$2 = '4.4.1';
  3891. var DATA_KEY$2 = 'bs.carousel';
  3892. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3893. var DATA_API_KEY$2 = '.data-api';
  3894. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3895. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3896. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3897. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3898. var SWIPE_THRESHOLD = 40;
  3899. var Default = {
  3900. interval: 5000,
  3901. keyboard: true,
  3902. slide: false,
  3903. pause: 'hover',
  3904. wrap: true,
  3905. touch: true
  3906. };
  3907. var DefaultType = {
  3908. interval: '(number|boolean)',
  3909. keyboard: 'boolean',
  3910. slide: '(boolean|string)',
  3911. pause: '(string|boolean)',
  3912. wrap: 'boolean',
  3913. touch: 'boolean'
  3914. };
  3915. var Direction = {
  3916. NEXT: 'next',
  3917. PREV: 'prev',
  3918. LEFT: 'left',
  3919. RIGHT: 'right'
  3920. };
  3921. var Event$2 = {
  3922. SLIDE: "slide" + EVENT_KEY$2,
  3923. SLID: "slid" + EVENT_KEY$2,
  3924. KEYDOWN: "keydown" + EVENT_KEY$2,
  3925. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3926. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3927. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3928. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3929. TOUCHEND: "touchend" + EVENT_KEY$2,
  3930. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3931. POINTERUP: "pointerup" + EVENT_KEY$2,
  3932. DRAG_START: "dragstart" + EVENT_KEY$2,
  3933. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3934. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3935. };
  3936. var ClassName$2 = {
  3937. CAROUSEL: 'carousel',
  3938. ACTIVE: 'active',
  3939. SLIDE: 'slide',
  3940. RIGHT: 'carousel-item-right',
  3941. LEFT: 'carousel-item-left',
  3942. NEXT: 'carousel-item-next',
  3943. PREV: 'carousel-item-prev',
  3944. ITEM: 'carousel-item',
  3945. POINTER_EVENT: 'pointer-event'
  3946. };
  3947. var Selector$2 = {
  3948. ACTIVE: '.active',
  3949. ACTIVE_ITEM: '.active.carousel-item',
  3950. ITEM: '.carousel-item',
  3951. ITEM_IMG: '.carousel-item img',
  3952. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3953. INDICATORS: '.carousel-indicators',
  3954. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3955. DATA_RIDE: '[data-ride="carousel"]'
  3956. };
  3957. var PointerType = {
  3958. TOUCH: 'touch',
  3959. PEN: 'pen'
  3960. };
  3961. /**
  3962. * ------------------------------------------------------------------------
  3963. * Class Definition
  3964. * ------------------------------------------------------------------------
  3965. */
  3966. var Carousel =
  3967. /*#__PURE__*/
  3968. function () {
  3969. function Carousel(element, config) {
  3970. this._items = null;
  3971. this._interval = null;
  3972. this._activeElement = null;
  3973. this._isPaused = false;
  3974. this._isSliding = false;
  3975. this.touchTimeout = null;
  3976. this.touchStartX = 0;
  3977. this.touchDeltaX = 0;
  3978. this._config = this._getConfig(config);
  3979. this._element = element;
  3980. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3981. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3982. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3983. this._addEventListeners();
  3984. } // Getters
  3985. var _proto = Carousel.prototype;
  3986. // Public
  3987. _proto.next = function next() {
  3988. if (!this._isSliding) {
  3989. this._slide(Direction.NEXT);
  3990. }
  3991. };
  3992. _proto.nextWhenVisible = function nextWhenVisible() {
  3993. // Don't call next when the page isn't visible
  3994. // or the carousel or its parent isn't visible
  3995. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3996. this.next();
  3997. }
  3998. };
  3999. _proto.prev = function prev() {
  4000. if (!this._isSliding) {
  4001. this._slide(Direction.PREV);
  4002. }
  4003. };
  4004. _proto.pause = function pause(event) {
  4005. if (!event) {
  4006. this._isPaused = true;
  4007. }
  4008. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  4009. Util.triggerTransitionEnd(this._element);
  4010. this.cycle(true);
  4011. }
  4012. clearInterval(this._interval);
  4013. this._interval = null;
  4014. };
  4015. _proto.cycle = function cycle(event) {
  4016. if (!event) {
  4017. this._isPaused = false;
  4018. }
  4019. if (this._interval) {
  4020. clearInterval(this._interval);
  4021. this._interval = null;
  4022. }
  4023. if (this._config.interval && !this._isPaused) {
  4024. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  4025. }
  4026. };
  4027. _proto.to = function to(index) {
  4028. var _this = this;
  4029. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  4030. var activeIndex = this._getItemIndex(this._activeElement);
  4031. if (index > this._items.length - 1 || index < 0) {
  4032. return;
  4033. }
  4034. if (this._isSliding) {
  4035. $(this._element).one(Event$2.SLID, function () {
  4036. return _this.to(index);
  4037. });
  4038. return;
  4039. }
  4040. if (activeIndex === index) {
  4041. this.pause();
  4042. this.cycle();
  4043. return;
  4044. }
  4045. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  4046. this._slide(direction, this._items[index]);
  4047. };
  4048. _proto.dispose = function dispose() {
  4049. $(this._element).off(EVENT_KEY$2);
  4050. $.removeData(this._element, DATA_KEY$2);
  4051. this._items = null;
  4052. this._config = null;
  4053. this._element = null;
  4054. this._interval = null;
  4055. this._isPaused = null;
  4056. this._isSliding = null;
  4057. this._activeElement = null;
  4058. this._indicatorsElement = null;
  4059. } // Private
  4060. ;
  4061. _proto._getConfig = function _getConfig(config) {
  4062. config = _objectSpread2({}, Default, {}, config);
  4063. Util.typeCheckConfig(NAME$2, config, DefaultType);
  4064. return config;
  4065. };
  4066. _proto._handleSwipe = function _handleSwipe() {
  4067. var absDeltax = Math.abs(this.touchDeltaX);
  4068. if (absDeltax <= SWIPE_THRESHOLD) {
  4069. return;
  4070. }
  4071. var direction = absDeltax / this.touchDeltaX;
  4072. this.touchDeltaX = 0; // swipe left
  4073. if (direction > 0) {
  4074. this.prev();
  4075. } // swipe right
  4076. if (direction < 0) {
  4077. this.next();
  4078. }
  4079. };
  4080. _proto._addEventListeners = function _addEventListeners() {
  4081. var _this2 = this;
  4082. if (this._config.keyboard) {
  4083. $(this._element).on(Event$2.KEYDOWN, function (event) {
  4084. return _this2._keydown(event);
  4085. });
  4086. }
  4087. if (this._config.pause === 'hover') {
  4088. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  4089. return _this2.pause(event);
  4090. }).on(Event$2.MOUSELEAVE, function (event) {
  4091. return _this2.cycle(event);
  4092. });
  4093. }
  4094. if (this._config.touch) {
  4095. this._addTouchEventListeners();
  4096. }
  4097. };
  4098. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  4099. var _this3 = this;
  4100. if (!this._touchSupported) {
  4101. return;
  4102. }
  4103. var start = function start(event) {
  4104. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  4105. _this3.touchStartX = event.originalEvent.clientX;
  4106. } else if (!_this3._pointerEvent) {
  4107. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  4108. }
  4109. };
  4110. var move = function move(event) {
  4111. // ensure swiping with one touch and not pinching
  4112. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  4113. _this3.touchDeltaX = 0;
  4114. } else {
  4115. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  4116. }
  4117. };
  4118. var end = function end(event) {
  4119. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  4120. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  4121. }
  4122. _this3._handleSwipe();
  4123. if (_this3._config.pause === 'hover') {
  4124. // If it's a touch-enabled device, mouseenter/leave are fired as
  4125. // part of the mouse compatibility events on first tap - the carousel
  4126. // would stop cycling until user tapped out of it;
  4127. // here, we listen for touchend, explicitly pause the carousel
  4128. // (as if it's the second time we tap on it, mouseenter compat event
  4129. // is NOT fired) and after a timeout (to allow for mouse compatibility
  4130. // events to fire) we explicitly restart cycling
  4131. _this3.pause();
  4132. if (_this3.touchTimeout) {
  4133. clearTimeout(_this3.touchTimeout);
  4134. }
  4135. _this3.touchTimeout = setTimeout(function (event) {
  4136. return _this3.cycle(event);
  4137. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  4138. }
  4139. };
  4140. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  4141. return e.preventDefault();
  4142. });
  4143. if (this._pointerEvent) {
  4144. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  4145. return start(event);
  4146. });
  4147. $(this._element).on(Event$2.POINTERUP, function (event) {
  4148. return end(event);
  4149. });
  4150. this._element.classList.add(ClassName$2.POINTER_EVENT);
  4151. } else {
  4152. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  4153. return start(event);
  4154. });
  4155. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  4156. return move(event);
  4157. });
  4158. $(this._element).on(Event$2.TOUCHEND, function (event) {
  4159. return end(event);
  4160. });
  4161. }
  4162. };
  4163. _proto._keydown = function _keydown(event) {
  4164. if (/input|textarea/i.test(event.target.tagName)) {
  4165. return;
  4166. }
  4167. switch (event.which) {
  4168. case ARROW_LEFT_KEYCODE:
  4169. event.preventDefault();
  4170. this.prev();
  4171. break;
  4172. case ARROW_RIGHT_KEYCODE:
  4173. event.preventDefault();
  4174. this.next();
  4175. break;
  4176. }
  4177. };
  4178. _proto._getItemIndex = function _getItemIndex(element) {
  4179. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  4180. return this._items.indexOf(element);
  4181. };
  4182. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  4183. var isNextDirection = direction === Direction.NEXT;
  4184. var isPrevDirection = direction === Direction.PREV;
  4185. var activeIndex = this._getItemIndex(activeElement);
  4186. var lastItemIndex = this._items.length - 1;
  4187. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  4188. if (isGoingToWrap && !this._config.wrap) {
  4189. return activeElement;
  4190. }
  4191. var delta = direction === Direction.PREV ? -1 : 1;
  4192. var itemIndex = (activeIndex + delta) % this._items.length;
  4193. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  4194. };
  4195. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  4196. var targetIndex = this._getItemIndex(relatedTarget);
  4197. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  4198. var slideEvent = $.Event(Event$2.SLIDE, {
  4199. relatedTarget: relatedTarget,
  4200. direction: eventDirectionName,
  4201. from: fromIndex,
  4202. to: targetIndex
  4203. });
  4204. $(this._element).trigger(slideEvent);
  4205. return slideEvent;
  4206. };
  4207. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  4208. if (this._indicatorsElement) {
  4209. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  4210. $(indicators).removeClass(ClassName$2.ACTIVE);
  4211. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  4212. if (nextIndicator) {
  4213. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  4214. }
  4215. }
  4216. };
  4217. _proto._slide = function _slide(direction, element) {
  4218. var _this4 = this;
  4219. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  4220. var activeElementIndex = this._getItemIndex(activeElement);
  4221. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  4222. var nextElementIndex = this._getItemIndex(nextElement);
  4223. var isCycling = Boolean(this._interval);
  4224. var directionalClassName;
  4225. var orderClassName;
  4226. var eventDirectionName;
  4227. if (direction === Direction.NEXT) {
  4228. directionalClassName = ClassName$2.LEFT;
  4229. orderClassName = ClassName$2.NEXT;
  4230. eventDirectionName = Direction.LEFT;
  4231. } else {
  4232. directionalClassName = ClassName$2.RIGHT;
  4233. orderClassName = ClassName$2.PREV;
  4234. eventDirectionName = Direction.RIGHT;
  4235. }
  4236. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  4237. this._isSliding = false;
  4238. return;
  4239. }
  4240. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  4241. if (slideEvent.isDefaultPrevented()) {
  4242. return;
  4243. }
  4244. if (!activeElement || !nextElement) {
  4245. // Some weirdness is happening, so we bail
  4246. return;
  4247. }
  4248. this._isSliding = true;
  4249. if (isCycling) {
  4250. this.pause();
  4251. }
  4252. this._setActiveIndicatorElement(nextElement);
  4253. var slidEvent = $.Event(Event$2.SLID, {
  4254. relatedTarget: nextElement,
  4255. direction: eventDirectionName,
  4256. from: activeElementIndex,
  4257. to: nextElementIndex
  4258. });
  4259. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  4260. $(nextElement).addClass(orderClassName);
  4261. Util.reflow(nextElement);
  4262. $(activeElement).addClass(directionalClassName);
  4263. $(nextElement).addClass(directionalClassName);
  4264. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  4265. if (nextElementInterval) {
  4266. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  4267. this._config.interval = nextElementInterval;
  4268. } else {
  4269. this._config.interval = this._config.defaultInterval || this._config.interval;
  4270. }
  4271. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  4272. $(activeElement).one(Util.TRANSITION_END, function () {
  4273. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  4274. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  4275. _this4._isSliding = false;
  4276. setTimeout(function () {
  4277. return $(_this4._element).trigger(slidEvent);
  4278. }, 0);
  4279. }).emulateTransitionEnd(transitionDuration);
  4280. } else {
  4281. $(activeElement).removeClass(ClassName$2.ACTIVE);
  4282. $(nextElement).addClass(ClassName$2.ACTIVE);
  4283. this._isSliding = false;
  4284. $(this._element).trigger(slidEvent);
  4285. }
  4286. if (isCycling) {
  4287. this.cycle();
  4288. }
  4289. } // Static
  4290. ;
  4291. Carousel._jQueryInterface = function _jQueryInterface(config) {
  4292. return this.each(function () {
  4293. var data = $(this).data(DATA_KEY$2);
  4294. var _config = _objectSpread2({}, Default, {}, $(this).data());
  4295. if (typeof config === 'object') {
  4296. _config = _objectSpread2({}, _config, {}, config);
  4297. }
  4298. var action = typeof config === 'string' ? config : _config.slide;
  4299. if (!data) {
  4300. data = new Carousel(this, _config);
  4301. $(this).data(DATA_KEY$2, data);
  4302. }
  4303. if (typeof config === 'number') {
  4304. data.to(config);
  4305. } else if (typeof action === 'string') {
  4306. if (typeof data[action] === 'undefined') {
  4307. throw new TypeError("No method named \"" + action + "\"");
  4308. }
  4309. data[action]();
  4310. } else if (_config.interval && _config.ride) {
  4311. data.pause();
  4312. data.cycle();
  4313. }
  4314. });
  4315. };
  4316. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  4317. var selector = Util.getSelectorFromElement(this);
  4318. if (!selector) {
  4319. return;
  4320. }
  4321. var target = $(selector)[0];
  4322. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  4323. return;
  4324. }
  4325. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  4326. var slideIndex = this.getAttribute('data-slide-to');
  4327. if (slideIndex) {
  4328. config.interval = false;
  4329. }
  4330. Carousel._jQueryInterface.call($(target), config);
  4331. if (slideIndex) {
  4332. $(target).data(DATA_KEY$2).to(slideIndex);
  4333. }
  4334. event.preventDefault();
  4335. };
  4336. _createClass(Carousel, null, [{
  4337. key: "VERSION",
  4338. get: function get() {
  4339. return VERSION$2;
  4340. }
  4341. }, {
  4342. key: "Default",
  4343. get: function get() {
  4344. return Default;
  4345. }
  4346. }]);
  4347. return Carousel;
  4348. }();
  4349. /**
  4350. * ------------------------------------------------------------------------
  4351. * Data Api implementation
  4352. * ------------------------------------------------------------------------
  4353. */
  4354. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  4355. $(window).on(Event$2.LOAD_DATA_API, function () {
  4356. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  4357. for (var i = 0, len = carousels.length; i < len; i++) {
  4358. var $carousel = $(carousels[i]);
  4359. Carousel._jQueryInterface.call($carousel, $carousel.data());
  4360. }
  4361. });
  4362. /**
  4363. * ------------------------------------------------------------------------
  4364. * jQuery
  4365. * ------------------------------------------------------------------------
  4366. */
  4367. $.fn[NAME$2] = Carousel._jQueryInterface;
  4368. $.fn[NAME$2].Constructor = Carousel;
  4369. $.fn[NAME$2].noConflict = function () {
  4370. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  4371. return Carousel._jQueryInterface;
  4372. };
  4373. /**
  4374. * ------------------------------------------------------------------------
  4375. * Constants
  4376. * ------------------------------------------------------------------------
  4377. */
  4378. var NAME$3 = 'collapse';
  4379. var VERSION$3 = '4.4.1';
  4380. var DATA_KEY$3 = 'bs.collapse';
  4381. var EVENT_KEY$3 = "." + DATA_KEY$3;
  4382. var DATA_API_KEY$3 = '.data-api';
  4383. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  4384. var Default$1 = {
  4385. toggle: true,
  4386. parent: ''
  4387. };
  4388. var DefaultType$1 = {
  4389. toggle: 'boolean',
  4390. parent: '(string|element)'
  4391. };
  4392. var Event$3 = {
  4393. SHOW: "show" + EVENT_KEY$3,
  4394. SHOWN: "shown" + EVENT_KEY$3,
  4395. HIDE: "hide" + EVENT_KEY$3,
  4396. HIDDEN: "hidden" + EVENT_KEY$3,
  4397. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  4398. };
  4399. var ClassName$3 = {
  4400. SHOW: 'show',
  4401. COLLAPSE: 'collapse',
  4402. COLLAPSING: 'collapsing',
  4403. COLLAPSED: 'collapsed'
  4404. };
  4405. var Dimension = {
  4406. WIDTH: 'width',
  4407. HEIGHT: 'height'
  4408. };
  4409. var Selector$3 = {
  4410. ACTIVES: '.show, .collapsing',
  4411. DATA_TOGGLE: '[data-toggle="collapse"]'
  4412. };
  4413. /**
  4414. * ------------------------------------------------------------------------
  4415. * Class Definition
  4416. * ------------------------------------------------------------------------
  4417. */
  4418. var Collapse =
  4419. /*#__PURE__*/
  4420. function () {
  4421. function Collapse(element, config) {
  4422. this._isTransitioning = false;
  4423. this._element = element;
  4424. this._config = this._getConfig(config);
  4425. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  4426. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  4427. for (var i = 0, len = toggleList.length; i < len; i++) {
  4428. var elem = toggleList[i];
  4429. var selector = Util.getSelectorFromElement(elem);
  4430. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  4431. return foundElem === element;
  4432. });
  4433. if (selector !== null && filterElement.length > 0) {
  4434. this._selector = selector;
  4435. this._triggerArray.push(elem);
  4436. }
  4437. }
  4438. this._parent = this._config.parent ? this._getParent() : null;
  4439. if (!this._config.parent) {
  4440. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  4441. }
  4442. if (this._config.toggle) {
  4443. this.toggle();
  4444. }
  4445. } // Getters
  4446. var _proto = Collapse.prototype;
  4447. // Public
  4448. _proto.toggle = function toggle() {
  4449. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  4450. this.hide();
  4451. } else {
  4452. this.show();
  4453. }
  4454. };
  4455. _proto.show = function show() {
  4456. var _this = this;
  4457. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  4458. return;
  4459. }
  4460. var actives;
  4461. var activesData;
  4462. if (this._parent) {
  4463. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  4464. if (typeof _this._config.parent === 'string') {
  4465. return elem.getAttribute('data-parent') === _this._config.parent;
  4466. }
  4467. return elem.classList.contains(ClassName$3.COLLAPSE);
  4468. });
  4469. if (actives.length === 0) {
  4470. actives = null;
  4471. }
  4472. }
  4473. if (actives) {
  4474. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  4475. if (activesData && activesData._isTransitioning) {
  4476. return;
  4477. }
  4478. }
  4479. var startEvent = $.Event(Event$3.SHOW);
  4480. $(this._element).trigger(startEvent);
  4481. if (startEvent.isDefaultPrevented()) {
  4482. return;
  4483. }
  4484. if (actives) {
  4485. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  4486. if (!activesData) {
  4487. $(actives).data(DATA_KEY$3, null);
  4488. }
  4489. }
  4490. var dimension = this._getDimension();
  4491. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  4492. this._element.style[dimension] = 0;
  4493. if (this._triggerArray.length) {
  4494. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  4495. }
  4496. this.setTransitioning(true);
  4497. var complete = function complete() {
  4498. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  4499. _this._element.style[dimension] = '';
  4500. _this.setTransitioning(false);
  4501. $(_this._element).trigger(Event$3.SHOWN);
  4502. };
  4503. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  4504. var scrollSize = "scroll" + capitalizedDimension;
  4505. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4506. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4507. this._element.style[dimension] = this._element[scrollSize] + "px";
  4508. };
  4509. _proto.hide = function hide() {
  4510. var _this2 = this;
  4511. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  4512. return;
  4513. }
  4514. var startEvent = $.Event(Event$3.HIDE);
  4515. $(this._element).trigger(startEvent);
  4516. if (startEvent.isDefaultPrevented()) {
  4517. return;
  4518. }
  4519. var dimension = this._getDimension();
  4520. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  4521. Util.reflow(this._element);
  4522. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  4523. var triggerArrayLength = this._triggerArray.length;
  4524. if (triggerArrayLength > 0) {
  4525. for (var i = 0; i < triggerArrayLength; i++) {
  4526. var trigger = this._triggerArray[i];
  4527. var selector = Util.getSelectorFromElement(trigger);
  4528. if (selector !== null) {
  4529. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  4530. if (!$elem.hasClass(ClassName$3.SHOW)) {
  4531. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  4532. }
  4533. }
  4534. }
  4535. }
  4536. this.setTransitioning(true);
  4537. var complete = function complete() {
  4538. _this2.setTransitioning(false);
  4539. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  4540. };
  4541. this._element.style[dimension] = '';
  4542. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4543. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4544. };
  4545. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  4546. this._isTransitioning = isTransitioning;
  4547. };
  4548. _proto.dispose = function dispose() {
  4549. $.removeData(this._element, DATA_KEY$3);
  4550. this._config = null;
  4551. this._parent = null;
  4552. this._element = null;
  4553. this._triggerArray = null;
  4554. this._isTransitioning = null;
  4555. } // Private
  4556. ;
  4557. _proto._getConfig = function _getConfig(config) {
  4558. config = _objectSpread2({}, Default$1, {}, config);
  4559. config.toggle = Boolean(config.toggle); // Coerce string values
  4560. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  4561. return config;
  4562. };
  4563. _proto._getDimension = function _getDimension() {
  4564. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  4565. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  4566. };
  4567. _proto._getParent = function _getParent() {
  4568. var _this3 = this;
  4569. var parent;
  4570. if (Util.isElement(this._config.parent)) {
  4571. parent = this._config.parent; // It's a jQuery object
  4572. if (typeof this._config.parent.jquery !== 'undefined') {
  4573. parent = this._config.parent[0];
  4574. }
  4575. } else {
  4576. parent = document.querySelector(this._config.parent);
  4577. }
  4578. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  4579. var children = [].slice.call(parent.querySelectorAll(selector));
  4580. $(children).each(function (i, element) {
  4581. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  4582. });
  4583. return parent;
  4584. };
  4585. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  4586. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  4587. if (triggerArray.length) {
  4588. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  4589. }
  4590. } // Static
  4591. ;
  4592. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  4593. var selector = Util.getSelectorFromElement(element);
  4594. return selector ? document.querySelector(selector) : null;
  4595. };
  4596. Collapse._jQueryInterface = function _jQueryInterface(config) {
  4597. return this.each(function () {
  4598. var $this = $(this);
  4599. var data = $this.data(DATA_KEY$3);
  4600. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  4601. if (!data && _config.toggle && /show|hide/.test(config)) {
  4602. _config.toggle = false;
  4603. }
  4604. if (!data) {
  4605. data = new Collapse(this, _config);
  4606. $this.data(DATA_KEY$3, data);
  4607. }
  4608. if (typeof config === 'string') {
  4609. if (typeof data[config] === 'undefined') {
  4610. throw new TypeError("No method named \"" + config + "\"");
  4611. }
  4612. data[config]();
  4613. }
  4614. });
  4615. };
  4616. _createClass(Collapse, null, [{
  4617. key: "VERSION",
  4618. get: function get() {
  4619. return VERSION$3;
  4620. }
  4621. }, {
  4622. key: "Default",
  4623. get: function get() {
  4624. return Default$1;
  4625. }
  4626. }]);
  4627. return Collapse;
  4628. }();
  4629. /**
  4630. * ------------------------------------------------------------------------
  4631. * Data Api implementation
  4632. * ------------------------------------------------------------------------
  4633. */
  4634. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  4635. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  4636. if (event.currentTarget.tagName === 'A') {
  4637. event.preventDefault();
  4638. }
  4639. var $trigger = $(this);
  4640. var selector = Util.getSelectorFromElement(this);
  4641. var selectors = [].slice.call(document.querySelectorAll(selector));
  4642. $(selectors).each(function () {
  4643. var $target = $(this);
  4644. var data = $target.data(DATA_KEY$3);
  4645. var config = data ? 'toggle' : $trigger.data();
  4646. Collapse._jQueryInterface.call($target, config);
  4647. });
  4648. });
  4649. /**
  4650. * ------------------------------------------------------------------------
  4651. * jQuery
  4652. * ------------------------------------------------------------------------
  4653. */
  4654. $.fn[NAME$3] = Collapse._jQueryInterface;
  4655. $.fn[NAME$3].Constructor = Collapse;
  4656. $.fn[NAME$3].noConflict = function () {
  4657. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  4658. return Collapse._jQueryInterface;
  4659. };
  4660. /**
  4661. * ------------------------------------------------------------------------
  4662. * Constants
  4663. * ------------------------------------------------------------------------
  4664. */
  4665. var NAME$4 = 'dropdown';
  4666. var VERSION$4 = '4.4.1';
  4667. var DATA_KEY$4 = 'bs.dropdown';
  4668. var EVENT_KEY$4 = "." + DATA_KEY$4;
  4669. var DATA_API_KEY$4 = '.data-api';
  4670. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  4671. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  4672. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  4673. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  4674. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  4675. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  4676. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  4677. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  4678. var Event$4 = {
  4679. HIDE: "hide" + EVENT_KEY$4,
  4680. HIDDEN: "hidden" + EVENT_KEY$4,
  4681. SHOW: "show" + EVENT_KEY$4,
  4682. SHOWN: "shown" + EVENT_KEY$4,
  4683. CLICK: "click" + EVENT_KEY$4,
  4684. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  4685. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  4686. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  4687. };
  4688. var ClassName$4 = {
  4689. DISABLED: 'disabled',
  4690. SHOW: 'show',
  4691. DROPUP: 'dropup',
  4692. DROPRIGHT: 'dropright',
  4693. DROPLEFT: 'dropleft',
  4694. MENURIGHT: 'dropdown-menu-right',
  4695. MENULEFT: 'dropdown-menu-left',
  4696. POSITION_STATIC: 'position-static'
  4697. };
  4698. var Selector$4 = {
  4699. DATA_TOGGLE: '[data-toggle="dropdown"]',
  4700. FORM_CHILD: '.dropdown form',
  4701. MENU: '.dropdown-menu',
  4702. NAVBAR_NAV: '.navbar-nav',
  4703. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  4704. };
  4705. var AttachmentMap = {
  4706. TOP: 'top-start',
  4707. TOPEND: 'top-end',
  4708. BOTTOM: 'bottom-start',
  4709. BOTTOMEND: 'bottom-end',
  4710. RIGHT: 'right-start',
  4711. RIGHTEND: 'right-end',
  4712. LEFT: 'left-start',
  4713. LEFTEND: 'left-end'
  4714. };
  4715. var Default$2 = {
  4716. offset: 0,
  4717. flip: true,
  4718. boundary: 'scrollParent',
  4719. reference: 'toggle',
  4720. display: 'dynamic',
  4721. popperConfig: null
  4722. };
  4723. var DefaultType$2 = {
  4724. offset: '(number|string|function)',
  4725. flip: 'boolean',
  4726. boundary: '(string|element)',
  4727. reference: '(string|element)',
  4728. display: 'string',
  4729. popperConfig: '(null|object)'
  4730. };
  4731. /**
  4732. * ------------------------------------------------------------------------
  4733. * Class Definition
  4734. * ------------------------------------------------------------------------
  4735. */
  4736. var Dropdown =
  4737. /*#__PURE__*/
  4738. function () {
  4739. function Dropdown(element, config) {
  4740. this._element = element;
  4741. this._popper = null;
  4742. this._config = this._getConfig(config);
  4743. this._menu = this._getMenuElement();
  4744. this._inNavbar = this._detectNavbar();
  4745. this._addEventListeners();
  4746. } // Getters
  4747. var _proto = Dropdown.prototype;
  4748. // Public
  4749. _proto.toggle = function toggle() {
  4750. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  4751. return;
  4752. }
  4753. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  4754. Dropdown._clearMenus();
  4755. if (isActive) {
  4756. return;
  4757. }
  4758. this.show(true);
  4759. };
  4760. _proto.show = function show(usePopper) {
  4761. if (usePopper === void 0) {
  4762. usePopper = false;
  4763. }
  4764. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  4765. return;
  4766. }
  4767. var relatedTarget = {
  4768. relatedTarget: this._element
  4769. };
  4770. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  4771. var parent = Dropdown._getParentFromElement(this._element);
  4772. $(parent).trigger(showEvent);
  4773. if (showEvent.isDefaultPrevented()) {
  4774. return;
  4775. } // Disable totally Popper.js for Dropdown in Navbar
  4776. if (!this._inNavbar && usePopper) {
  4777. /**
  4778. * Check for Popper dependency
  4779. * Popper - https://popper.js.org
  4780. */
  4781. if (typeof Popper === 'undefined') {
  4782. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  4783. }
  4784. var referenceElement = this._element;
  4785. if (this._config.reference === 'parent') {
  4786. referenceElement = parent;
  4787. } else if (Util.isElement(this._config.reference)) {
  4788. referenceElement = this._config.reference; // Check if it's jQuery element
  4789. if (typeof this._config.reference.jquery !== 'undefined') {
  4790. referenceElement = this._config.reference[0];
  4791. }
  4792. } // If boundary is not `scrollParent`, then set position to `static`
  4793. // to allow the menu to "escape" the scroll parent's boundaries
  4794. // https://github.com/twbs/bootstrap/issues/24251
  4795. if (this._config.boundary !== 'scrollParent') {
  4796. $(parent).addClass(ClassName$4.POSITION_STATIC);
  4797. }
  4798. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  4799. } // If this is a touch-enabled device we add extra
  4800. // empty mouseover listeners to the body's immediate children;
  4801. // only needed because of broken event delegation on iOS
  4802. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4803. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  4804. $(document.body).children().on('mouseover', null, $.noop);
  4805. }
  4806. this._element.focus();
  4807. this._element.setAttribute('aria-expanded', true);
  4808. $(this._menu).toggleClass(ClassName$4.SHOW);
  4809. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  4810. };
  4811. _proto.hide = function hide() {
  4812. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  4813. return;
  4814. }
  4815. var relatedTarget = {
  4816. relatedTarget: this._element
  4817. };
  4818. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4819. var parent = Dropdown._getParentFromElement(this._element);
  4820. $(parent).trigger(hideEvent);
  4821. if (hideEvent.isDefaultPrevented()) {
  4822. return;
  4823. }
  4824. if (this._popper) {
  4825. this._popper.destroy();
  4826. }
  4827. $(this._menu).toggleClass(ClassName$4.SHOW);
  4828. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4829. };
  4830. _proto.dispose = function dispose() {
  4831. $.removeData(this._element, DATA_KEY$4);
  4832. $(this._element).off(EVENT_KEY$4);
  4833. this._element = null;
  4834. this._menu = null;
  4835. if (this._popper !== null) {
  4836. this._popper.destroy();
  4837. this._popper = null;
  4838. }
  4839. };
  4840. _proto.update = function update() {
  4841. this._inNavbar = this._detectNavbar();
  4842. if (this._popper !== null) {
  4843. this._popper.scheduleUpdate();
  4844. }
  4845. } // Private
  4846. ;
  4847. _proto._addEventListeners = function _addEventListeners() {
  4848. var _this = this;
  4849. $(this._element).on(Event$4.CLICK, function (event) {
  4850. event.preventDefault();
  4851. event.stopPropagation();
  4852. _this.toggle();
  4853. });
  4854. };
  4855. _proto._getConfig = function _getConfig(config) {
  4856. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4857. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4858. return config;
  4859. };
  4860. _proto._getMenuElement = function _getMenuElement() {
  4861. if (!this._menu) {
  4862. var parent = Dropdown._getParentFromElement(this._element);
  4863. if (parent) {
  4864. this._menu = parent.querySelector(Selector$4.MENU);
  4865. }
  4866. }
  4867. return this._menu;
  4868. };
  4869. _proto._getPlacement = function _getPlacement() {
  4870. var $parentDropdown = $(this._element.parentNode);
  4871. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4872. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4873. placement = AttachmentMap.TOP;
  4874. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4875. placement = AttachmentMap.TOPEND;
  4876. }
  4877. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4878. placement = AttachmentMap.RIGHT;
  4879. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4880. placement = AttachmentMap.LEFT;
  4881. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4882. placement = AttachmentMap.BOTTOMEND;
  4883. }
  4884. return placement;
  4885. };
  4886. _proto._detectNavbar = function _detectNavbar() {
  4887. return $(this._element).closest('.navbar').length > 0;
  4888. };
  4889. _proto._getOffset = function _getOffset() {
  4890. var _this2 = this;
  4891. var offset = {};
  4892. if (typeof this._config.offset === 'function') {
  4893. offset.fn = function (data) {
  4894. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4895. return data;
  4896. };
  4897. } else {
  4898. offset.offset = this._config.offset;
  4899. }
  4900. return offset;
  4901. };
  4902. _proto._getPopperConfig = function _getPopperConfig() {
  4903. var popperConfig = {
  4904. placement: this._getPlacement(),
  4905. modifiers: {
  4906. offset: this._getOffset(),
  4907. flip: {
  4908. enabled: this._config.flip
  4909. },
  4910. preventOverflow: {
  4911. boundariesElement: this._config.boundary
  4912. }
  4913. }
  4914. }; // Disable Popper.js if we have a static display
  4915. if (this._config.display === 'static') {
  4916. popperConfig.modifiers.applyStyle = {
  4917. enabled: false
  4918. };
  4919. }
  4920. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4921. } // Static
  4922. ;
  4923. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4924. return this.each(function () {
  4925. var data = $(this).data(DATA_KEY$4);
  4926. var _config = typeof config === 'object' ? config : null;
  4927. if (!data) {
  4928. data = new Dropdown(this, _config);
  4929. $(this).data(DATA_KEY$4, data);
  4930. }
  4931. if (typeof config === 'string') {
  4932. if (typeof data[config] === 'undefined') {
  4933. throw new TypeError("No method named \"" + config + "\"");
  4934. }
  4935. data[config]();
  4936. }
  4937. });
  4938. };
  4939. Dropdown._clearMenus = function _clearMenus(event) {
  4940. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4941. return;
  4942. }
  4943. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4944. for (var i = 0, len = toggles.length; i < len; i++) {
  4945. var parent = Dropdown._getParentFromElement(toggles[i]);
  4946. var context = $(toggles[i]).data(DATA_KEY$4);
  4947. var relatedTarget = {
  4948. relatedTarget: toggles[i]
  4949. };
  4950. if (event && event.type === 'click') {
  4951. relatedTarget.clickEvent = event;
  4952. }
  4953. if (!context) {
  4954. continue;
  4955. }
  4956. var dropdownMenu = context._menu;
  4957. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4958. continue;
  4959. }
  4960. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4961. continue;
  4962. }
  4963. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4964. $(parent).trigger(hideEvent);
  4965. if (hideEvent.isDefaultPrevented()) {
  4966. continue;
  4967. } // If this is a touch-enabled device we remove the extra
  4968. // empty mouseover listeners we added for iOS support
  4969. if ('ontouchstart' in document.documentElement) {
  4970. $(document.body).children().off('mouseover', null, $.noop);
  4971. }
  4972. toggles[i].setAttribute('aria-expanded', 'false');
  4973. if (context._popper) {
  4974. context._popper.destroy();
  4975. }
  4976. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4977. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4978. }
  4979. };
  4980. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4981. var parent;
  4982. var selector = Util.getSelectorFromElement(element);
  4983. if (selector) {
  4984. parent = document.querySelector(selector);
  4985. }
  4986. return parent || element.parentNode;
  4987. } // eslint-disable-next-line complexity
  4988. ;
  4989. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4990. // If not input/textarea:
  4991. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4992. // If input/textarea:
  4993. // - If space key => not a dropdown command
  4994. // - If key is other than escape
  4995. // - If key is not up or down => not a dropdown command
  4996. // - If trigger inside the menu => not a dropdown command
  4997. 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)) {
  4998. return;
  4999. }
  5000. event.preventDefault();
  5001. event.stopPropagation();
  5002. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  5003. return;
  5004. }
  5005. var parent = Dropdown._getParentFromElement(this);
  5006. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  5007. if (!isActive && event.which === ESCAPE_KEYCODE) {
  5008. return;
  5009. }
  5010. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  5011. if (event.which === ESCAPE_KEYCODE) {
  5012. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  5013. $(toggle).trigger('focus');
  5014. }
  5015. $(this).trigger('click');
  5016. return;
  5017. }
  5018. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  5019. return $(item).is(':visible');
  5020. });
  5021. if (items.length === 0) {
  5022. return;
  5023. }
  5024. var index = items.indexOf(event.target);
  5025. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  5026. // Up
  5027. index--;
  5028. }
  5029. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  5030. // Down
  5031. index++;
  5032. }
  5033. if (index < 0) {
  5034. index = 0;
  5035. }
  5036. items[index].focus();
  5037. };
  5038. _createClass(Dropdown, null, [{
  5039. key: "VERSION",
  5040. get: function get() {
  5041. return VERSION$4;
  5042. }
  5043. }, {
  5044. key: "Default",
  5045. get: function get() {
  5046. return Default$2;
  5047. }
  5048. }, {
  5049. key: "DefaultType",
  5050. get: function get() {
  5051. return DefaultType$2;
  5052. }
  5053. }]);
  5054. return Dropdown;
  5055. }();
  5056. /**
  5057. * ------------------------------------------------------------------------
  5058. * Data Api implementation
  5059. * ------------------------------------------------------------------------
  5060. */
  5061. $(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) {
  5062. event.preventDefault();
  5063. event.stopPropagation();
  5064. Dropdown._jQueryInterface.call($(this), 'toggle');
  5065. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  5066. e.stopPropagation();
  5067. });
  5068. /**
  5069. * ------------------------------------------------------------------------
  5070. * jQuery
  5071. * ------------------------------------------------------------------------
  5072. */
  5073. $.fn[NAME$4] = Dropdown._jQueryInterface;
  5074. $.fn[NAME$4].Constructor = Dropdown;
  5075. $.fn[NAME$4].noConflict = function () {
  5076. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  5077. return Dropdown._jQueryInterface;
  5078. };
  5079. /**
  5080. * ------------------------------------------------------------------------
  5081. * Constants
  5082. * ------------------------------------------------------------------------
  5083. */
  5084. var NAME$5 = 'modal';
  5085. var VERSION$5 = '4.4.1';
  5086. var DATA_KEY$5 = 'bs.modal';
  5087. var EVENT_KEY$5 = "." + DATA_KEY$5;
  5088. var DATA_API_KEY$5 = '.data-api';
  5089. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  5090. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  5091. var Default$3 = {
  5092. backdrop: true,
  5093. keyboard: true,
  5094. focus: true,
  5095. show: true
  5096. };
  5097. var DefaultType$3 = {
  5098. backdrop: '(boolean|string)',
  5099. keyboard: 'boolean',
  5100. focus: 'boolean',
  5101. show: 'boolean'
  5102. };
  5103. var Event$5 = {
  5104. HIDE: "hide" + EVENT_KEY$5,
  5105. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  5106. HIDDEN: "hidden" + EVENT_KEY$5,
  5107. SHOW: "show" + EVENT_KEY$5,
  5108. SHOWN: "shown" + EVENT_KEY$5,
  5109. FOCUSIN: "focusin" + EVENT_KEY$5,
  5110. RESIZE: "resize" + EVENT_KEY$5,
  5111. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  5112. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  5113. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  5114. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  5115. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  5116. };
  5117. var ClassName$5 = {
  5118. SCROLLABLE: 'modal-dialog-scrollable',
  5119. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  5120. BACKDROP: 'modal-backdrop',
  5121. OPEN: 'modal-open',
  5122. FADE: 'fade',
  5123. SHOW: 'show',
  5124. STATIC: 'modal-static'
  5125. };
  5126. var Selector$5 = {
  5127. DIALOG: '.modal-dialog',
  5128. MODAL_BODY: '.modal-body',
  5129. DATA_TOGGLE: '[data-toggle="modal"]',
  5130. DATA_DISMISS: '[data-dismiss="modal"]',
  5131. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  5132. STICKY_CONTENT: '.sticky-top'
  5133. };
  5134. /**
  5135. * ------------------------------------------------------------------------
  5136. * Class Definition
  5137. * ------------------------------------------------------------------------
  5138. */
  5139. var Modal =
  5140. /*#__PURE__*/
  5141. function () {
  5142. function Modal(element, config) {
  5143. this._config = this._getConfig(config);
  5144. this._element = element;
  5145. this._dialog = element.querySelector(Selector$5.DIALOG);
  5146. this._backdrop = null;
  5147. this._isShown = false;
  5148. this._isBodyOverflowing = false;
  5149. this._ignoreBackdropClick = false;
  5150. this._isTransitioning = false;
  5151. this._scrollbarWidth = 0;
  5152. } // Getters
  5153. var _proto = Modal.prototype;
  5154. // Public
  5155. _proto.toggle = function toggle(relatedTarget) {
  5156. return this._isShown ? this.hide() : this.show(relatedTarget);
  5157. };
  5158. _proto.show = function show(relatedTarget) {
  5159. var _this = this;
  5160. if (this._isShown || this._isTransitioning) {
  5161. return;
  5162. }
  5163. if ($(this._element).hasClass(ClassName$5.FADE)) {
  5164. this._isTransitioning = true;
  5165. }
  5166. var showEvent = $.Event(Event$5.SHOW, {
  5167. relatedTarget: relatedTarget
  5168. });
  5169. $(this._element).trigger(showEvent);
  5170. if (this._isShown || showEvent.isDefaultPrevented()) {
  5171. return;
  5172. }
  5173. this._isShown = true;
  5174. this._checkScrollbar();
  5175. this._setScrollbar();
  5176. this._adjustDialog();
  5177. this._setEscapeEvent();
  5178. this._setResizeEvent();
  5179. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  5180. return _this.hide(event);
  5181. });
  5182. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  5183. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  5184. if ($(event.target).is(_this._element)) {
  5185. _this._ignoreBackdropClick = true;
  5186. }
  5187. });
  5188. });
  5189. this._showBackdrop(function () {
  5190. return _this._showElement(relatedTarget);
  5191. });
  5192. };
  5193. _proto.hide = function hide(event) {
  5194. var _this2 = this;
  5195. if (event) {
  5196. event.preventDefault();
  5197. }
  5198. if (!this._isShown || this._isTransitioning) {
  5199. return;
  5200. }
  5201. var hideEvent = $.Event(Event$5.HIDE);
  5202. $(this._element).trigger(hideEvent);
  5203. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  5204. return;
  5205. }
  5206. this._isShown = false;
  5207. var transition = $(this._element).hasClass(ClassName$5.FADE);
  5208. if (transition) {
  5209. this._isTransitioning = true;
  5210. }
  5211. this._setEscapeEvent();
  5212. this._setResizeEvent();
  5213. $(document).off(Event$5.FOCUSIN);
  5214. $(this._element).removeClass(ClassName$5.SHOW);
  5215. $(this._element).off(Event$5.CLICK_DISMISS);
  5216. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  5217. if (transition) {
  5218. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5219. $(this._element).one(Util.TRANSITION_END, function (event) {
  5220. return _this2._hideModal(event);
  5221. }).emulateTransitionEnd(transitionDuration);
  5222. } else {
  5223. this._hideModal();
  5224. }
  5225. };
  5226. _proto.dispose = function dispose() {
  5227. [window, this._element, this._dialog].forEach(function (htmlElement) {
  5228. return $(htmlElement).off(EVENT_KEY$5);
  5229. });
  5230. /**
  5231. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  5232. * Do not move `document` in `htmlElements` array
  5233. * It will remove `Event.CLICK_DATA_API` event that should remain
  5234. */
  5235. $(document).off(Event$5.FOCUSIN);
  5236. $.removeData(this._element, DATA_KEY$5);
  5237. this._config = null;
  5238. this._element = null;
  5239. this._dialog = null;
  5240. this._backdrop = null;
  5241. this._isShown = null;
  5242. this._isBodyOverflowing = null;
  5243. this._ignoreBackdropClick = null;
  5244. this._isTransitioning = null;
  5245. this._scrollbarWidth = null;
  5246. };
  5247. _proto.handleUpdate = function handleUpdate() {
  5248. this._adjustDialog();
  5249. } // Private
  5250. ;
  5251. _proto._getConfig = function _getConfig(config) {
  5252. config = _objectSpread2({}, Default$3, {}, config);
  5253. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  5254. return config;
  5255. };
  5256. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  5257. var _this3 = this;
  5258. if (this._config.backdrop === 'static') {
  5259. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  5260. $(this._element).trigger(hideEventPrevented);
  5261. if (hideEventPrevented.defaultPrevented) {
  5262. return;
  5263. }
  5264. this._element.classList.add(ClassName$5.STATIC);
  5265. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  5266. $(this._element).one(Util.TRANSITION_END, function () {
  5267. _this3._element.classList.remove(ClassName$5.STATIC);
  5268. }).emulateTransitionEnd(modalTransitionDuration);
  5269. this._element.focus();
  5270. } else {
  5271. this.hide();
  5272. }
  5273. };
  5274. _proto._showElement = function _showElement(relatedTarget) {
  5275. var _this4 = this;
  5276. var transition = $(this._element).hasClass(ClassName$5.FADE);
  5277. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  5278. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  5279. // Don't move modal's DOM position
  5280. document.body.appendChild(this._element);
  5281. }
  5282. this._element.style.display = 'block';
  5283. this._element.removeAttribute('aria-hidden');
  5284. this._element.setAttribute('aria-modal', true);
  5285. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  5286. modalBody.scrollTop = 0;
  5287. } else {
  5288. this._element.scrollTop = 0;
  5289. }
  5290. if (transition) {
  5291. Util.reflow(this._element);
  5292. }
  5293. $(this._element).addClass(ClassName$5.SHOW);
  5294. if (this._config.focus) {
  5295. this._enforceFocus();
  5296. }
  5297. var shownEvent = $.Event(Event$5.SHOWN, {
  5298. relatedTarget: relatedTarget
  5299. });
  5300. var transitionComplete = function transitionComplete() {
  5301. if (_this4._config.focus) {
  5302. _this4._element.focus();
  5303. }
  5304. _this4._isTransitioning = false;
  5305. $(_this4._element).trigger(shownEvent);
  5306. };
  5307. if (transition) {
  5308. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  5309. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  5310. } else {
  5311. transitionComplete();
  5312. }
  5313. };
  5314. _proto._enforceFocus = function _enforceFocus() {
  5315. var _this5 = this;
  5316. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  5317. .on(Event$5.FOCUSIN, function (event) {
  5318. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  5319. _this5._element.focus();
  5320. }
  5321. });
  5322. };
  5323. _proto._setEscapeEvent = function _setEscapeEvent() {
  5324. var _this6 = this;
  5325. if (this._isShown && this._config.keyboard) {
  5326. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  5327. if (event.which === ESCAPE_KEYCODE$1) {
  5328. _this6._triggerBackdropTransition();
  5329. }
  5330. });
  5331. } else if (!this._isShown) {
  5332. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  5333. }
  5334. };
  5335. _proto._setResizeEvent = function _setResizeEvent() {
  5336. var _this7 = this;
  5337. if (this._isShown) {
  5338. $(window).on(Event$5.RESIZE, function (event) {
  5339. return _this7.handleUpdate(event);
  5340. });
  5341. } else {
  5342. $(window).off(Event$5.RESIZE);
  5343. }
  5344. };
  5345. _proto._hideModal = function _hideModal() {
  5346. var _this8 = this;
  5347. this._element.style.display = 'none';
  5348. this._element.setAttribute('aria-hidden', true);
  5349. this._element.removeAttribute('aria-modal');
  5350. this._isTransitioning = false;
  5351. this._showBackdrop(function () {
  5352. $(document.body).removeClass(ClassName$5.OPEN);
  5353. _this8._resetAdjustments();
  5354. _this8._resetScrollbar();
  5355. $(_this8._element).trigger(Event$5.HIDDEN);
  5356. });
  5357. };
  5358. _proto._removeBackdrop = function _removeBackdrop() {
  5359. if (this._backdrop) {
  5360. $(this._backdrop).remove();
  5361. this._backdrop = null;
  5362. }
  5363. };
  5364. _proto._showBackdrop = function _showBackdrop(callback) {
  5365. var _this9 = this;
  5366. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  5367. if (this._isShown && this._config.backdrop) {
  5368. this._backdrop = document.createElement('div');
  5369. this._backdrop.className = ClassName$5.BACKDROP;
  5370. if (animate) {
  5371. this._backdrop.classList.add(animate);
  5372. }
  5373. $(this._backdrop).appendTo(document.body);
  5374. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  5375. if (_this9._ignoreBackdropClick) {
  5376. _this9._ignoreBackdropClick = false;
  5377. return;
  5378. }
  5379. if (event.target !== event.currentTarget) {
  5380. return;
  5381. }
  5382. _this9._triggerBackdropTransition();
  5383. });
  5384. if (animate) {
  5385. Util.reflow(this._backdrop);
  5386. }
  5387. $(this._backdrop).addClass(ClassName$5.SHOW);
  5388. if (!callback) {
  5389. return;
  5390. }
  5391. if (!animate) {
  5392. callback();
  5393. return;
  5394. }
  5395. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  5396. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  5397. } else if (!this._isShown && this._backdrop) {
  5398. $(this._backdrop).removeClass(ClassName$5.SHOW);
  5399. var callbackRemove = function callbackRemove() {
  5400. _this9._removeBackdrop();
  5401. if (callback) {
  5402. callback();
  5403. }
  5404. };
  5405. if ($(this._element).hasClass(ClassName$5.FADE)) {
  5406. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  5407. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  5408. } else {
  5409. callbackRemove();
  5410. }
  5411. } else if (callback) {
  5412. callback();
  5413. }
  5414. } // ----------------------------------------------------------------------
  5415. // the following methods are used to handle overflowing modals
  5416. // todo (fat): these should probably be refactored out of modal.js
  5417. // ----------------------------------------------------------------------
  5418. ;
  5419. _proto._adjustDialog = function _adjustDialog() {
  5420. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  5421. if (!this._isBodyOverflowing && isModalOverflowing) {
  5422. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  5423. }
  5424. if (this._isBodyOverflowing && !isModalOverflowing) {
  5425. this._element.style.paddingRight = this._scrollbarWidth + "px";
  5426. }
  5427. };
  5428. _proto._resetAdjustments = function _resetAdjustments() {
  5429. this._element.style.paddingLeft = '';
  5430. this._element.style.paddingRight = '';
  5431. };
  5432. _proto._checkScrollbar = function _checkScrollbar() {
  5433. var rect = document.body.getBoundingClientRect();
  5434. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  5435. this._scrollbarWidth = this._getScrollbarWidth();
  5436. };
  5437. _proto._setScrollbar = function _setScrollbar() {
  5438. var _this10 = this;
  5439. if (this._isBodyOverflowing) {
  5440. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  5441. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  5442. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  5443. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  5444. $(fixedContent).each(function (index, element) {
  5445. var actualPadding = element.style.paddingRight;
  5446. var calculatedPadding = $(element).css('padding-right');
  5447. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  5448. }); // Adjust sticky content margin
  5449. $(stickyContent).each(function (index, element) {
  5450. var actualMargin = element.style.marginRight;
  5451. var calculatedMargin = $(element).css('margin-right');
  5452. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  5453. }); // Adjust body padding
  5454. var actualPadding = document.body.style.paddingRight;
  5455. var calculatedPadding = $(document.body).css('padding-right');
  5456. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  5457. }
  5458. $(document.body).addClass(ClassName$5.OPEN);
  5459. };
  5460. _proto._resetScrollbar = function _resetScrollbar() {
  5461. // Restore fixed content padding
  5462. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  5463. $(fixedContent).each(function (index, element) {
  5464. var padding = $(element).data('padding-right');
  5465. $(element).removeData('padding-right');
  5466. element.style.paddingRight = padding ? padding : '';
  5467. }); // Restore sticky content
  5468. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  5469. $(elements).each(function (index, element) {
  5470. var margin = $(element).data('margin-right');
  5471. if (typeof margin !== 'undefined') {
  5472. $(element).css('margin-right', margin).removeData('margin-right');
  5473. }
  5474. }); // Restore body padding
  5475. var padding = $(document.body).data('padding-right');
  5476. $(document.body).removeData('padding-right');
  5477. document.body.style.paddingRight = padding ? padding : '';
  5478. };
  5479. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  5480. // thx d.walsh
  5481. var scrollDiv = document.createElement('div');
  5482. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  5483. document.body.appendChild(scrollDiv);
  5484. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  5485. document.body.removeChild(scrollDiv);
  5486. return scrollbarWidth;
  5487. } // Static
  5488. ;
  5489. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  5490. return this.each(function () {
  5491. var data = $(this).data(DATA_KEY$5);
  5492. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  5493. if (!data) {
  5494. data = new Modal(this, _config);
  5495. $(this).data(DATA_KEY$5, data);
  5496. }
  5497. if (typeof config === 'string') {
  5498. if (typeof data[config] === 'undefined') {
  5499. throw new TypeError("No method named \"" + config + "\"");
  5500. }
  5501. data[config](relatedTarget);
  5502. } else if (_config.show) {
  5503. data.show(relatedTarget);
  5504. }
  5505. });
  5506. };
  5507. _createClass(Modal, null, [{
  5508. key: "VERSION",
  5509. get: function get() {
  5510. return VERSION$5;
  5511. }
  5512. }, {
  5513. key: "Default",
  5514. get: function get() {
  5515. return Default$3;
  5516. }
  5517. }]);
  5518. return Modal;
  5519. }();
  5520. /**
  5521. * ------------------------------------------------------------------------
  5522. * Data Api implementation
  5523. * ------------------------------------------------------------------------
  5524. */
  5525. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  5526. var _this11 = this;
  5527. var target;
  5528. var selector = Util.getSelectorFromElement(this);
  5529. if (selector) {
  5530. target = document.querySelector(selector);
  5531. }
  5532. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  5533. if (this.tagName === 'A' || this.tagName === 'AREA') {
  5534. event.preventDefault();
  5535. }
  5536. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  5537. if (showEvent.isDefaultPrevented()) {
  5538. // Only register focus restorer if modal will actually get shown
  5539. return;
  5540. }
  5541. $target.one(Event$5.HIDDEN, function () {
  5542. if ($(_this11).is(':visible')) {
  5543. _this11.focus();
  5544. }
  5545. });
  5546. });
  5547. Modal._jQueryInterface.call($(target), config, this);
  5548. });
  5549. /**
  5550. * ------------------------------------------------------------------------
  5551. * jQuery
  5552. * ------------------------------------------------------------------------
  5553. */
  5554. $.fn[NAME$5] = Modal._jQueryInterface;
  5555. $.fn[NAME$5].Constructor = Modal;
  5556. $.fn[NAME$5].noConflict = function () {
  5557. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  5558. return Modal._jQueryInterface;
  5559. };
  5560. /**
  5561. * --------------------------------------------------------------------------
  5562. * Bootstrap (v4.4.1): tools/sanitizer.js
  5563. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5564. * --------------------------------------------------------------------------
  5565. */
  5566. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  5567. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  5568. var DefaultWhitelist = {
  5569. // Global attributes allowed on any supplied element below.
  5570. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  5571. a: ['target', 'href', 'title', 'rel'],
  5572. area: [],
  5573. b: [],
  5574. br: [],
  5575. col: [],
  5576. code: [],
  5577. div: [],
  5578. em: [],
  5579. hr: [],
  5580. h1: [],
  5581. h2: [],
  5582. h3: [],
  5583. h4: [],
  5584. h5: [],
  5585. h6: [],
  5586. i: [],
  5587. img: ['src', 'alt', 'title', 'width', 'height'],
  5588. li: [],
  5589. ol: [],
  5590. p: [],
  5591. pre: [],
  5592. s: [],
  5593. small: [],
  5594. span: [],
  5595. sub: [],
  5596. sup: [],
  5597. strong: [],
  5598. u: [],
  5599. ul: []
  5600. };
  5601. /**
  5602. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  5603. *
  5604. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5605. */
  5606. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  5607. /**
  5608. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  5609. *
  5610. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5611. */
  5612. 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;
  5613. function allowedAttribute(attr, allowedAttributeList) {
  5614. var attrName = attr.nodeName.toLowerCase();
  5615. if (allowedAttributeList.indexOf(attrName) !== -1) {
  5616. if (uriAttrs.indexOf(attrName) !== -1) {
  5617. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  5618. }
  5619. return true;
  5620. }
  5621. var regExp = allowedAttributeList.filter(function (attrRegex) {
  5622. return attrRegex instanceof RegExp;
  5623. }); // Check if a regular expression validates the attribute.
  5624. for (var i = 0, l = regExp.length; i < l; i++) {
  5625. if (attrName.match(regExp[i])) {
  5626. return true;
  5627. }
  5628. }
  5629. return false;
  5630. }
  5631. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  5632. if (unsafeHtml.length === 0) {
  5633. return unsafeHtml;
  5634. }
  5635. if (sanitizeFn && typeof sanitizeFn === 'function') {
  5636. return sanitizeFn(unsafeHtml);
  5637. }
  5638. var domParser = new window.DOMParser();
  5639. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  5640. var whitelistKeys = Object.keys(whiteList);
  5641. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  5642. var _loop = function _loop(i, len) {
  5643. var el = elements[i];
  5644. var elName = el.nodeName.toLowerCase();
  5645. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  5646. el.parentNode.removeChild(el);
  5647. return "continue";
  5648. }
  5649. var attributeList = [].slice.call(el.attributes);
  5650. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  5651. attributeList.forEach(function (attr) {
  5652. if (!allowedAttribute(attr, whitelistedAttributes)) {
  5653. el.removeAttribute(attr.nodeName);
  5654. }
  5655. });
  5656. };
  5657. for (var i = 0, len = elements.length; i < len; i++) {
  5658. var _ret = _loop(i);
  5659. if (_ret === "continue") continue;
  5660. }
  5661. return createdDocument.body.innerHTML;
  5662. }
  5663. /**
  5664. * ------------------------------------------------------------------------
  5665. * Constants
  5666. * ------------------------------------------------------------------------
  5667. */
  5668. var NAME$6 = 'tooltip';
  5669. var VERSION$6 = '4.4.1';
  5670. var DATA_KEY$6 = 'bs.tooltip';
  5671. var EVENT_KEY$6 = "." + DATA_KEY$6;
  5672. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  5673. var CLASS_PREFIX = 'bs-tooltip';
  5674. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  5675. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  5676. var DefaultType$4 = {
  5677. animation: 'boolean',
  5678. template: 'string',
  5679. title: '(string|element|function)',
  5680. trigger: 'string',
  5681. delay: '(number|object)',
  5682. html: 'boolean',
  5683. selector: '(string|boolean)',
  5684. placement: '(string|function)',
  5685. offset: '(number|string|function)',
  5686. container: '(string|element|boolean)',
  5687. fallbackPlacement: '(string|array)',
  5688. boundary: '(string|element)',
  5689. sanitize: 'boolean',
  5690. sanitizeFn: '(null|function)',
  5691. whiteList: 'object',
  5692. popperConfig: '(null|object)'
  5693. };
  5694. var AttachmentMap$1 = {
  5695. AUTO: 'auto',
  5696. TOP: 'top',
  5697. RIGHT: 'right',
  5698. BOTTOM: 'bottom',
  5699. LEFT: 'left'
  5700. };
  5701. var Default$4 = {
  5702. animation: true,
  5703. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  5704. trigger: 'hover focus',
  5705. title: '',
  5706. delay: 0,
  5707. html: false,
  5708. selector: false,
  5709. placement: 'top',
  5710. offset: 0,
  5711. container: false,
  5712. fallbackPlacement: 'flip',
  5713. boundary: 'scrollParent',
  5714. sanitize: true,
  5715. sanitizeFn: null,
  5716. whiteList: DefaultWhitelist,
  5717. popperConfig: null
  5718. };
  5719. var HoverState = {
  5720. SHOW: 'show',
  5721. OUT: 'out'
  5722. };
  5723. var Event$6 = {
  5724. HIDE: "hide" + EVENT_KEY$6,
  5725. HIDDEN: "hidden" + EVENT_KEY$6,
  5726. SHOW: "show" + EVENT_KEY$6,
  5727. SHOWN: "shown" + EVENT_KEY$6,
  5728. INSERTED: "inserted" + EVENT_KEY$6,
  5729. CLICK: "click" + EVENT_KEY$6,
  5730. FOCUSIN: "focusin" + EVENT_KEY$6,
  5731. FOCUSOUT: "focusout" + EVENT_KEY$6,
  5732. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  5733. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  5734. };
  5735. var ClassName$6 = {
  5736. FADE: 'fade',
  5737. SHOW: 'show'
  5738. };
  5739. var Selector$6 = {
  5740. TOOLTIP: '.tooltip',
  5741. TOOLTIP_INNER: '.tooltip-inner',
  5742. ARROW: '.arrow'
  5743. };
  5744. var Trigger = {
  5745. HOVER: 'hover',
  5746. FOCUS: 'focus',
  5747. CLICK: 'click',
  5748. MANUAL: 'manual'
  5749. };
  5750. /**
  5751. * ------------------------------------------------------------------------
  5752. * Class Definition
  5753. * ------------------------------------------------------------------------
  5754. */
  5755. var Tooltip =
  5756. /*#__PURE__*/
  5757. function () {
  5758. function Tooltip(element, config) {
  5759. if (typeof Popper === 'undefined') {
  5760. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  5761. } // private
  5762. this._isEnabled = true;
  5763. this._timeout = 0;
  5764. this._hoverState = '';
  5765. this._activeTrigger = {};
  5766. this._popper = null; // Protected
  5767. this.element = element;
  5768. this.config = this._getConfig(config);
  5769. this.tip = null;
  5770. this._setListeners();
  5771. } // Getters
  5772. var _proto = Tooltip.prototype;
  5773. // Public
  5774. _proto.enable = function enable() {
  5775. this._isEnabled = true;
  5776. };
  5777. _proto.disable = function disable() {
  5778. this._isEnabled = false;
  5779. };
  5780. _proto.toggleEnabled = function toggleEnabled() {
  5781. this._isEnabled = !this._isEnabled;
  5782. };
  5783. _proto.toggle = function toggle(event) {
  5784. if (!this._isEnabled) {
  5785. return;
  5786. }
  5787. if (event) {
  5788. var dataKey = this.constructor.DATA_KEY;
  5789. var context = $(event.currentTarget).data(dataKey);
  5790. if (!context) {
  5791. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5792. $(event.currentTarget).data(dataKey, context);
  5793. }
  5794. context._activeTrigger.click = !context._activeTrigger.click;
  5795. if (context._isWithActiveTrigger()) {
  5796. context._enter(null, context);
  5797. } else {
  5798. context._leave(null, context);
  5799. }
  5800. } else {
  5801. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  5802. this._leave(null, this);
  5803. return;
  5804. }
  5805. this._enter(null, this);
  5806. }
  5807. };
  5808. _proto.dispose = function dispose() {
  5809. clearTimeout(this._timeout);
  5810. $.removeData(this.element, this.constructor.DATA_KEY);
  5811. $(this.element).off(this.constructor.EVENT_KEY);
  5812. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  5813. if (this.tip) {
  5814. $(this.tip).remove();
  5815. }
  5816. this._isEnabled = null;
  5817. this._timeout = null;
  5818. this._hoverState = null;
  5819. this._activeTrigger = null;
  5820. if (this._popper) {
  5821. this._popper.destroy();
  5822. }
  5823. this._popper = null;
  5824. this.element = null;
  5825. this.config = null;
  5826. this.tip = null;
  5827. };
  5828. _proto.show = function show() {
  5829. var _this = this;
  5830. if ($(this.element).css('display') === 'none') {
  5831. throw new Error('Please use show on visible elements');
  5832. }
  5833. var showEvent = $.Event(this.constructor.Event.SHOW);
  5834. if (this.isWithContent() && this._isEnabled) {
  5835. $(this.element).trigger(showEvent);
  5836. var shadowRoot = Util.findShadowRoot(this.element);
  5837. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5838. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5839. return;
  5840. }
  5841. var tip = this.getTipElement();
  5842. var tipId = Util.getUID(this.constructor.NAME);
  5843. tip.setAttribute('id', tipId);
  5844. this.element.setAttribute('aria-describedby', tipId);
  5845. this.setContent();
  5846. if (this.config.animation) {
  5847. $(tip).addClass(ClassName$6.FADE);
  5848. }
  5849. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5850. var attachment = this._getAttachment(placement);
  5851. this.addAttachmentClass(attachment);
  5852. var container = this._getContainer();
  5853. $(tip).data(this.constructor.DATA_KEY, this);
  5854. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5855. $(tip).appendTo(container);
  5856. }
  5857. $(this.element).trigger(this.constructor.Event.INSERTED);
  5858. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5859. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5860. // empty mouseover listeners to the body's immediate children;
  5861. // only needed because of broken event delegation on iOS
  5862. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5863. if ('ontouchstart' in document.documentElement) {
  5864. $(document.body).children().on('mouseover', null, $.noop);
  5865. }
  5866. var complete = function complete() {
  5867. if (_this.config.animation) {
  5868. _this._fixTransition();
  5869. }
  5870. var prevHoverState = _this._hoverState;
  5871. _this._hoverState = null;
  5872. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5873. if (prevHoverState === HoverState.OUT) {
  5874. _this._leave(null, _this);
  5875. }
  5876. };
  5877. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5878. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5879. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5880. } else {
  5881. complete();
  5882. }
  5883. }
  5884. };
  5885. _proto.hide = function hide(callback) {
  5886. var _this2 = this;
  5887. var tip = this.getTipElement();
  5888. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5889. var complete = function complete() {
  5890. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5891. tip.parentNode.removeChild(tip);
  5892. }
  5893. _this2._cleanTipClass();
  5894. _this2.element.removeAttribute('aria-describedby');
  5895. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5896. if (_this2._popper !== null) {
  5897. _this2._popper.destroy();
  5898. }
  5899. if (callback) {
  5900. callback();
  5901. }
  5902. };
  5903. $(this.element).trigger(hideEvent);
  5904. if (hideEvent.isDefaultPrevented()) {
  5905. return;
  5906. }
  5907. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5908. // empty mouseover listeners we added for iOS support
  5909. if ('ontouchstart' in document.documentElement) {
  5910. $(document.body).children().off('mouseover', null, $.noop);
  5911. }
  5912. this._activeTrigger[Trigger.CLICK] = false;
  5913. this._activeTrigger[Trigger.FOCUS] = false;
  5914. this._activeTrigger[Trigger.HOVER] = false;
  5915. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5916. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5917. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5918. } else {
  5919. complete();
  5920. }
  5921. this._hoverState = '';
  5922. };
  5923. _proto.update = function update() {
  5924. if (this._popper !== null) {
  5925. this._popper.scheduleUpdate();
  5926. }
  5927. } // Protected
  5928. ;
  5929. _proto.isWithContent = function isWithContent() {
  5930. return Boolean(this.getTitle());
  5931. };
  5932. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5933. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5934. };
  5935. _proto.getTipElement = function getTipElement() {
  5936. this.tip = this.tip || $(this.config.template)[0];
  5937. return this.tip;
  5938. };
  5939. _proto.setContent = function setContent() {
  5940. var tip = this.getTipElement();
  5941. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5942. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5943. };
  5944. _proto.setElementContent = function setElementContent($element, content) {
  5945. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5946. // Content is a DOM node or a jQuery
  5947. if (this.config.html) {
  5948. if (!$(content).parent().is($element)) {
  5949. $element.empty().append(content);
  5950. }
  5951. } else {
  5952. $element.text($(content).text());
  5953. }
  5954. return;
  5955. }
  5956. if (this.config.html) {
  5957. if (this.config.sanitize) {
  5958. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5959. }
  5960. $element.html(content);
  5961. } else {
  5962. $element.text(content);
  5963. }
  5964. };
  5965. _proto.getTitle = function getTitle() {
  5966. var title = this.element.getAttribute('data-original-title');
  5967. if (!title) {
  5968. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5969. }
  5970. return title;
  5971. } // Private
  5972. ;
  5973. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5974. var _this3 = this;
  5975. var defaultBsConfig = {
  5976. placement: attachment,
  5977. modifiers: {
  5978. offset: this._getOffset(),
  5979. flip: {
  5980. behavior: this.config.fallbackPlacement
  5981. },
  5982. arrow: {
  5983. element: Selector$6.ARROW
  5984. },
  5985. preventOverflow: {
  5986. boundariesElement: this.config.boundary
  5987. }
  5988. },
  5989. onCreate: function onCreate(data) {
  5990. if (data.originalPlacement !== data.placement) {
  5991. _this3._handlePopperPlacementChange(data);
  5992. }
  5993. },
  5994. onUpdate: function onUpdate(data) {
  5995. return _this3._handlePopperPlacementChange(data);
  5996. }
  5997. };
  5998. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5999. };
  6000. _proto._getOffset = function _getOffset() {
  6001. var _this4 = this;
  6002. var offset = {};
  6003. if (typeof this.config.offset === 'function') {
  6004. offset.fn = function (data) {
  6005. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  6006. return data;
  6007. };
  6008. } else {
  6009. offset.offset = this.config.offset;
  6010. }
  6011. return offset;
  6012. };
  6013. _proto._getContainer = function _getContainer() {
  6014. if (this.config.container === false) {
  6015. return document.body;
  6016. }
  6017. if (Util.isElement(this.config.container)) {
  6018. return $(this.config.container);
  6019. }
  6020. return $(document).find(this.config.container);
  6021. };
  6022. _proto._getAttachment = function _getAttachment(placement) {
  6023. return AttachmentMap$1[placement.toUpperCase()];
  6024. };
  6025. _proto._setListeners = function _setListeners() {
  6026. var _this5 = this;
  6027. var triggers = this.config.trigger.split(' ');
  6028. triggers.forEach(function (trigger) {
  6029. if (trigger === 'click') {
  6030. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  6031. return _this5.toggle(event);
  6032. });
  6033. } else if (trigger !== Trigger.MANUAL) {
  6034. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  6035. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  6036. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  6037. return _this5._enter(event);
  6038. }).on(eventOut, _this5.config.selector, function (event) {
  6039. return _this5._leave(event);
  6040. });
  6041. }
  6042. });
  6043. this._hideModalHandler = function () {
  6044. if (_this5.element) {
  6045. _this5.hide();
  6046. }
  6047. };
  6048. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  6049. if (this.config.selector) {
  6050. this.config = _objectSpread2({}, this.config, {
  6051. trigger: 'manual',
  6052. selector: ''
  6053. });
  6054. } else {
  6055. this._fixTitle();
  6056. }
  6057. };
  6058. _proto._fixTitle = function _fixTitle() {
  6059. var titleType = typeof this.element.getAttribute('data-original-title');
  6060. if (this.element.getAttribute('title') || titleType !== 'string') {
  6061. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  6062. this.element.setAttribute('title', '');
  6063. }
  6064. };
  6065. _proto._enter = function _enter(event, context) {
  6066. var dataKey = this.constructor.DATA_KEY;
  6067. context = context || $(event.currentTarget).data(dataKey);
  6068. if (!context) {
  6069. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  6070. $(event.currentTarget).data(dataKey, context);
  6071. }
  6072. if (event) {
  6073. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  6074. }
  6075. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  6076. context._hoverState = HoverState.SHOW;
  6077. return;
  6078. }
  6079. clearTimeout(context._timeout);
  6080. context._hoverState = HoverState.SHOW;
  6081. if (!context.config.delay || !context.config.delay.show) {
  6082. context.show();
  6083. return;
  6084. }
  6085. context._timeout = setTimeout(function () {
  6086. if (context._hoverState === HoverState.SHOW) {
  6087. context.show();
  6088. }
  6089. }, context.config.delay.show);
  6090. };
  6091. _proto._leave = function _leave(event, context) {
  6092. var dataKey = this.constructor.DATA_KEY;
  6093. context = context || $(event.currentTarget).data(dataKey);
  6094. if (!context) {
  6095. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  6096. $(event.currentTarget).data(dataKey, context);
  6097. }
  6098. if (event) {
  6099. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  6100. }
  6101. if (context._isWithActiveTrigger()) {
  6102. return;
  6103. }
  6104. clearTimeout(context._timeout);
  6105. context._hoverState = HoverState.OUT;
  6106. if (!context.config.delay || !context.config.delay.hide) {
  6107. context.hide();
  6108. return;
  6109. }
  6110. context._timeout = setTimeout(function () {
  6111. if (context._hoverState === HoverState.OUT) {
  6112. context.hide();
  6113. }
  6114. }, context.config.delay.hide);
  6115. };
  6116. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  6117. for (var trigger in this._activeTrigger) {
  6118. if (this._activeTrigger[trigger]) {
  6119. return true;
  6120. }
  6121. }
  6122. return false;
  6123. };
  6124. _proto._getConfig = function _getConfig(config) {
  6125. var dataAttributes = $(this.element).data();
  6126. Object.keys(dataAttributes).forEach(function (dataAttr) {
  6127. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  6128. delete dataAttributes[dataAttr];
  6129. }
  6130. });
  6131. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  6132. if (typeof config.delay === 'number') {
  6133. config.delay = {
  6134. show: config.delay,
  6135. hide: config.delay
  6136. };
  6137. }
  6138. if (typeof config.title === 'number') {
  6139. config.title = config.title.toString();
  6140. }
  6141. if (typeof config.content === 'number') {
  6142. config.content = config.content.toString();
  6143. }
  6144. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  6145. if (config.sanitize) {
  6146. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  6147. }
  6148. return config;
  6149. };
  6150. _proto._getDelegateConfig = function _getDelegateConfig() {
  6151. var config = {};
  6152. if (this.config) {
  6153. for (var key in this.config) {
  6154. if (this.constructor.Default[key] !== this.config[key]) {
  6155. config[key] = this.config[key];
  6156. }
  6157. }
  6158. }
  6159. return config;
  6160. };
  6161. _proto._cleanTipClass = function _cleanTipClass() {
  6162. var $tip = $(this.getTipElement());
  6163. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  6164. if (tabClass !== null && tabClass.length) {
  6165. $tip.removeClass(tabClass.join(''));
  6166. }
  6167. };
  6168. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  6169. var popperInstance = popperData.instance;
  6170. this.tip = popperInstance.popper;
  6171. this._cleanTipClass();
  6172. this.addAttachmentClass(this._getAttachment(popperData.placement));
  6173. };
  6174. _proto._fixTransition = function _fixTransition() {
  6175. var tip = this.getTipElement();
  6176. var initConfigAnimation = this.config.animation;
  6177. if (tip.getAttribute('x-placement') !== null) {
  6178. return;
  6179. }
  6180. $(tip).removeClass(ClassName$6.FADE);
  6181. this.config.animation = false;
  6182. this.hide();
  6183. this.show();
  6184. this.config.animation = initConfigAnimation;
  6185. } // Static
  6186. ;
  6187. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  6188. return this.each(function () {
  6189. var data = $(this).data(DATA_KEY$6);
  6190. var _config = typeof config === 'object' && config;
  6191. if (!data && /dispose|hide/.test(config)) {
  6192. return;
  6193. }
  6194. if (!data) {
  6195. data = new Tooltip(this, _config);
  6196. $(this).data(DATA_KEY$6, data);
  6197. }
  6198. if (typeof config === 'string') {
  6199. if (typeof data[config] === 'undefined') {
  6200. throw new TypeError("No method named \"" + config + "\"");
  6201. }
  6202. data[config]();
  6203. }
  6204. });
  6205. };
  6206. _createClass(Tooltip, null, [{
  6207. key: "VERSION",
  6208. get: function get() {
  6209. return VERSION$6;
  6210. }
  6211. }, {
  6212. key: "Default",
  6213. get: function get() {
  6214. return Default$4;
  6215. }
  6216. }, {
  6217. key: "NAME",
  6218. get: function get() {
  6219. return NAME$6;
  6220. }
  6221. }, {
  6222. key: "DATA_KEY",
  6223. get: function get() {
  6224. return DATA_KEY$6;
  6225. }
  6226. }, {
  6227. key: "Event",
  6228. get: function get() {
  6229. return Event$6;
  6230. }
  6231. }, {
  6232. key: "EVENT_KEY",
  6233. get: function get() {
  6234. return EVENT_KEY$6;
  6235. }
  6236. }, {
  6237. key: "DefaultType",
  6238. get: function get() {
  6239. return DefaultType$4;
  6240. }
  6241. }]);
  6242. return Tooltip;
  6243. }();
  6244. /**
  6245. * ------------------------------------------------------------------------
  6246. * jQuery
  6247. * ------------------------------------------------------------------------
  6248. */
  6249. $.fn[NAME$6] = Tooltip._jQueryInterface;
  6250. $.fn[NAME$6].Constructor = Tooltip;
  6251. $.fn[NAME$6].noConflict = function () {
  6252. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  6253. return Tooltip._jQueryInterface;
  6254. };
  6255. /**
  6256. * ------------------------------------------------------------------------
  6257. * Constants
  6258. * ------------------------------------------------------------------------
  6259. */
  6260. var NAME$7 = 'popover';
  6261. var VERSION$7 = '4.4.1';
  6262. var DATA_KEY$7 = 'bs.popover';
  6263. var EVENT_KEY$7 = "." + DATA_KEY$7;
  6264. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  6265. var CLASS_PREFIX$1 = 'bs-popover';
  6266. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  6267. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  6268. placement: 'right',
  6269. trigger: 'click',
  6270. content: '',
  6271. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  6272. });
  6273. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  6274. content: '(string|element|function)'
  6275. });
  6276. var ClassName$7 = {
  6277. FADE: 'fade',
  6278. SHOW: 'show'
  6279. };
  6280. var Selector$7 = {
  6281. TITLE: '.popover-header',
  6282. CONTENT: '.popover-body'
  6283. };
  6284. var Event$7 = {
  6285. HIDE: "hide" + EVENT_KEY$7,
  6286. HIDDEN: "hidden" + EVENT_KEY$7,
  6287. SHOW: "show" + EVENT_KEY$7,
  6288. SHOWN: "shown" + EVENT_KEY$7,
  6289. INSERTED: "inserted" + EVENT_KEY$7,
  6290. CLICK: "click" + EVENT_KEY$7,
  6291. FOCUSIN: "focusin" + EVENT_KEY$7,
  6292. FOCUSOUT: "focusout" + EVENT_KEY$7,
  6293. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  6294. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  6295. };
  6296. /**
  6297. * ------------------------------------------------------------------------
  6298. * Class Definition
  6299. * ------------------------------------------------------------------------
  6300. */
  6301. var Popover =
  6302. /*#__PURE__*/
  6303. function (_Tooltip) {
  6304. _inheritsLoose(Popover, _Tooltip);
  6305. function Popover() {
  6306. return _Tooltip.apply(this, arguments) || this;
  6307. }
  6308. var _proto = Popover.prototype;
  6309. // Overrides
  6310. _proto.isWithContent = function isWithContent() {
  6311. return this.getTitle() || this._getContent();
  6312. };
  6313. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  6314. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  6315. };
  6316. _proto.getTipElement = function getTipElement() {
  6317. this.tip = this.tip || $(this.config.template)[0];
  6318. return this.tip;
  6319. };
  6320. _proto.setContent = function setContent() {
  6321. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  6322. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  6323. var content = this._getContent();
  6324. if (typeof content === 'function') {
  6325. content = content.call(this.element);
  6326. }
  6327. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  6328. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  6329. } // Private
  6330. ;
  6331. _proto._getContent = function _getContent() {
  6332. return this.element.getAttribute('data-content') || this.config.content;
  6333. };
  6334. _proto._cleanTipClass = function _cleanTipClass() {
  6335. var $tip = $(this.getTipElement());
  6336. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  6337. if (tabClass !== null && tabClass.length > 0) {
  6338. $tip.removeClass(tabClass.join(''));
  6339. }
  6340. } // Static
  6341. ;
  6342. Popover._jQueryInterface = function _jQueryInterface(config) {
  6343. return this.each(function () {
  6344. var data = $(this).data(DATA_KEY$7);
  6345. var _config = typeof config === 'object' ? config : null;
  6346. if (!data && /dispose|hide/.test(config)) {
  6347. return;
  6348. }
  6349. if (!data) {
  6350. data = new Popover(this, _config);
  6351. $(this).data(DATA_KEY$7, data);
  6352. }
  6353. if (typeof config === 'string') {
  6354. if (typeof data[config] === 'undefined') {
  6355. throw new TypeError("No method named \"" + config + "\"");
  6356. }
  6357. data[config]();
  6358. }
  6359. });
  6360. };
  6361. _createClass(Popover, null, [{
  6362. key: "VERSION",
  6363. // Getters
  6364. get: function get() {
  6365. return VERSION$7;
  6366. }
  6367. }, {
  6368. key: "Default",
  6369. get: function get() {
  6370. return Default$5;
  6371. }
  6372. }, {
  6373. key: "NAME",
  6374. get: function get() {
  6375. return NAME$7;
  6376. }
  6377. }, {
  6378. key: "DATA_KEY",
  6379. get: function get() {
  6380. return DATA_KEY$7;
  6381. }
  6382. }, {
  6383. key: "Event",
  6384. get: function get() {
  6385. return Event$7;
  6386. }
  6387. }, {
  6388. key: "EVENT_KEY",
  6389. get: function get() {
  6390. return EVENT_KEY$7;
  6391. }
  6392. }, {
  6393. key: "DefaultType",
  6394. get: function get() {
  6395. return DefaultType$5;
  6396. }
  6397. }]);
  6398. return Popover;
  6399. }(Tooltip);
  6400. /**
  6401. * ------------------------------------------------------------------------
  6402. * jQuery
  6403. * ------------------------------------------------------------------------
  6404. */
  6405. $.fn[NAME$7] = Popover._jQueryInterface;
  6406. $.fn[NAME$7].Constructor = Popover;
  6407. $.fn[NAME$7].noConflict = function () {
  6408. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  6409. return Popover._jQueryInterface;
  6410. };
  6411. /**
  6412. * ------------------------------------------------------------------------
  6413. * Constants
  6414. * ------------------------------------------------------------------------
  6415. */
  6416. var NAME$8 = 'scrollspy';
  6417. var VERSION$8 = '4.4.1';
  6418. var DATA_KEY$8 = 'bs.scrollspy';
  6419. var EVENT_KEY$8 = "." + DATA_KEY$8;
  6420. var DATA_API_KEY$6 = '.data-api';
  6421. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  6422. var Default$6 = {
  6423. offset: 10,
  6424. method: 'auto',
  6425. target: ''
  6426. };
  6427. var DefaultType$6 = {
  6428. offset: 'number',
  6429. method: 'string',
  6430. target: '(string|element)'
  6431. };
  6432. var Event$8 = {
  6433. ACTIVATE: "activate" + EVENT_KEY$8,
  6434. SCROLL: "scroll" + EVENT_KEY$8,
  6435. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  6436. };
  6437. var ClassName$8 = {
  6438. DROPDOWN_ITEM: 'dropdown-item',
  6439. DROPDOWN_MENU: 'dropdown-menu',
  6440. ACTIVE: 'active'
  6441. };
  6442. var Selector$8 = {
  6443. DATA_SPY: '[data-spy="scroll"]',
  6444. ACTIVE: '.active',
  6445. NAV_LIST_GROUP: '.nav, .list-group',
  6446. NAV_LINKS: '.nav-link',
  6447. NAV_ITEMS: '.nav-item',
  6448. LIST_ITEMS: '.list-group-item',
  6449. DROPDOWN: '.dropdown',
  6450. DROPDOWN_ITEMS: '.dropdown-item',
  6451. DROPDOWN_TOGGLE: '.dropdown-toggle'
  6452. };
  6453. var OffsetMethod = {
  6454. OFFSET: 'offset',
  6455. POSITION: 'position'
  6456. };
  6457. /**
  6458. * ------------------------------------------------------------------------
  6459. * Class Definition
  6460. * ------------------------------------------------------------------------
  6461. */
  6462. var ScrollSpy =
  6463. /*#__PURE__*/
  6464. function () {
  6465. function ScrollSpy(element, config) {
  6466. var _this = this;
  6467. this._element = element;
  6468. this._scrollElement = element.tagName === 'BODY' ? window : element;
  6469. this._config = this._getConfig(config);
  6470. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  6471. this._offsets = [];
  6472. this._targets = [];
  6473. this._activeTarget = null;
  6474. this._scrollHeight = 0;
  6475. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  6476. return _this._process(event);
  6477. });
  6478. this.refresh();
  6479. this._process();
  6480. } // Getters
  6481. var _proto = ScrollSpy.prototype;
  6482. // Public
  6483. _proto.refresh = function refresh() {
  6484. var _this2 = this;
  6485. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  6486. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  6487. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  6488. this._offsets = [];
  6489. this._targets = [];
  6490. this._scrollHeight = this._getScrollHeight();
  6491. var targets = [].slice.call(document.querySelectorAll(this._selector));
  6492. targets.map(function (element) {
  6493. var target;
  6494. var targetSelector = Util.getSelectorFromElement(element);
  6495. if (targetSelector) {
  6496. target = document.querySelector(targetSelector);
  6497. }
  6498. if (target) {
  6499. var targetBCR = target.getBoundingClientRect();
  6500. if (targetBCR.width || targetBCR.height) {
  6501. // TODO (fat): remove sketch reliance on jQuery position/offset
  6502. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  6503. }
  6504. }
  6505. return null;
  6506. }).filter(function (item) {
  6507. return item;
  6508. }).sort(function (a, b) {
  6509. return a[0] - b[0];
  6510. }).forEach(function (item) {
  6511. _this2._offsets.push(item[0]);
  6512. _this2._targets.push(item[1]);
  6513. });
  6514. };
  6515. _proto.dispose = function dispose() {
  6516. $.removeData(this._element, DATA_KEY$8);
  6517. $(this._scrollElement).off(EVENT_KEY$8);
  6518. this._element = null;
  6519. this._scrollElement = null;
  6520. this._config = null;
  6521. this._selector = null;
  6522. this._offsets = null;
  6523. this._targets = null;
  6524. this._activeTarget = null;
  6525. this._scrollHeight = null;
  6526. } // Private
  6527. ;
  6528. _proto._getConfig = function _getConfig(config) {
  6529. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  6530. if (typeof config.target !== 'string') {
  6531. var id = $(config.target).attr('id');
  6532. if (!id) {
  6533. id = Util.getUID(NAME$8);
  6534. $(config.target).attr('id', id);
  6535. }
  6536. config.target = "#" + id;
  6537. }
  6538. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  6539. return config;
  6540. };
  6541. _proto._getScrollTop = function _getScrollTop() {
  6542. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  6543. };
  6544. _proto._getScrollHeight = function _getScrollHeight() {
  6545. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  6546. };
  6547. _proto._getOffsetHeight = function _getOffsetHeight() {
  6548. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  6549. };
  6550. _proto._process = function _process() {
  6551. var scrollTop = this._getScrollTop() + this._config.offset;
  6552. var scrollHeight = this._getScrollHeight();
  6553. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  6554. if (this._scrollHeight !== scrollHeight) {
  6555. this.refresh();
  6556. }
  6557. if (scrollTop >= maxScroll) {
  6558. var target = this._targets[this._targets.length - 1];
  6559. if (this._activeTarget !== target) {
  6560. this._activate(target);
  6561. }
  6562. return;
  6563. }
  6564. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  6565. this._activeTarget = null;
  6566. this._clear();
  6567. return;
  6568. }
  6569. var offsetLength = this._offsets.length;
  6570. for (var i = offsetLength; i--;) {
  6571. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  6572. if (isActiveTarget) {
  6573. this._activate(this._targets[i]);
  6574. }
  6575. }
  6576. };
  6577. _proto._activate = function _activate(target) {
  6578. this._activeTarget = target;
  6579. this._clear();
  6580. var queries = this._selector.split(',').map(function (selector) {
  6581. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  6582. });
  6583. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  6584. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  6585. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  6586. $link.addClass(ClassName$8.ACTIVE);
  6587. } else {
  6588. // Set triggered link as active
  6589. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  6590. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  6591. $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
  6592. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  6593. }
  6594. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  6595. relatedTarget: target
  6596. });
  6597. };
  6598. _proto._clear = function _clear() {
  6599. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  6600. return node.classList.contains(ClassName$8.ACTIVE);
  6601. }).forEach(function (node) {
  6602. return node.classList.remove(ClassName$8.ACTIVE);
  6603. });
  6604. } // Static
  6605. ;
  6606. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  6607. return this.each(function () {
  6608. var data = $(this).data(DATA_KEY$8);
  6609. var _config = typeof config === 'object' && config;
  6610. if (!data) {
  6611. data = new ScrollSpy(this, _config);
  6612. $(this).data(DATA_KEY$8, data);
  6613. }
  6614. if (typeof config === 'string') {
  6615. if (typeof data[config] === 'undefined') {
  6616. throw new TypeError("No method named \"" + config + "\"");
  6617. }
  6618. data[config]();
  6619. }
  6620. });
  6621. };
  6622. _createClass(ScrollSpy, null, [{
  6623. key: "VERSION",
  6624. get: function get() {
  6625. return VERSION$8;
  6626. }
  6627. }, {
  6628. key: "Default",
  6629. get: function get() {
  6630. return Default$6;
  6631. }
  6632. }]);
  6633. return ScrollSpy;
  6634. }();
  6635. /**
  6636. * ------------------------------------------------------------------------
  6637. * Data Api implementation
  6638. * ------------------------------------------------------------------------
  6639. */
  6640. $(window).on(Event$8.LOAD_DATA_API, function () {
  6641. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  6642. var scrollSpysLength = scrollSpys.length;
  6643. for (var i = scrollSpysLength; i--;) {
  6644. var $spy = $(scrollSpys[i]);
  6645. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  6646. }
  6647. });
  6648. /**
  6649. * ------------------------------------------------------------------------
  6650. * jQuery
  6651. * ------------------------------------------------------------------------
  6652. */
  6653. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  6654. $.fn[NAME$8].Constructor = ScrollSpy;
  6655. $.fn[NAME$8].noConflict = function () {
  6656. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  6657. return ScrollSpy._jQueryInterface;
  6658. };
  6659. /**
  6660. * ------------------------------------------------------------------------
  6661. * Constants
  6662. * ------------------------------------------------------------------------
  6663. */
  6664. var NAME$9 = 'tab';
  6665. var VERSION$9 = '4.4.1';
  6666. var DATA_KEY$9 = 'bs.tab';
  6667. var EVENT_KEY$9 = "." + DATA_KEY$9;
  6668. var DATA_API_KEY$7 = '.data-api';
  6669. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  6670. var Event$9 = {
  6671. HIDE: "hide" + EVENT_KEY$9,
  6672. HIDDEN: "hidden" + EVENT_KEY$9,
  6673. SHOW: "show" + EVENT_KEY$9,
  6674. SHOWN: "shown" + EVENT_KEY$9,
  6675. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  6676. };
  6677. var ClassName$9 = {
  6678. DROPDOWN_MENU: 'dropdown-menu',
  6679. ACTIVE: 'active',
  6680. DISABLED: 'disabled',
  6681. FADE: 'fade',
  6682. SHOW: 'show'
  6683. };
  6684. var Selector$9 = {
  6685. DROPDOWN: '.dropdown',
  6686. NAV_LIST_GROUP: '.nav, .list-group',
  6687. ACTIVE: '.active',
  6688. ACTIVE_UL: '> li > .active',
  6689. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  6690. DROPDOWN_TOGGLE: '.dropdown-toggle',
  6691. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  6692. };
  6693. /**
  6694. * ------------------------------------------------------------------------
  6695. * Class Definition
  6696. * ------------------------------------------------------------------------
  6697. */
  6698. var Tab =
  6699. /*#__PURE__*/
  6700. function () {
  6701. function Tab(element) {
  6702. this._element = element;
  6703. } // Getters
  6704. var _proto = Tab.prototype;
  6705. // Public
  6706. _proto.show = function show() {
  6707. var _this = this;
  6708. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  6709. return;
  6710. }
  6711. var target;
  6712. var previous;
  6713. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  6714. var selector = Util.getSelectorFromElement(this._element);
  6715. if (listElement) {
  6716. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  6717. previous = $.makeArray($(listElement).find(itemSelector));
  6718. previous = previous[previous.length - 1];
  6719. }
  6720. var hideEvent = $.Event(Event$9.HIDE, {
  6721. relatedTarget: this._element
  6722. });
  6723. var showEvent = $.Event(Event$9.SHOW, {
  6724. relatedTarget: previous
  6725. });
  6726. if (previous) {
  6727. $(previous).trigger(hideEvent);
  6728. }
  6729. $(this._element).trigger(showEvent);
  6730. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  6731. return;
  6732. }
  6733. if (selector) {
  6734. target = document.querySelector(selector);
  6735. }
  6736. this._activate(this._element, listElement);
  6737. var complete = function complete() {
  6738. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  6739. relatedTarget: _this._element
  6740. });
  6741. var shownEvent = $.Event(Event$9.SHOWN, {
  6742. relatedTarget: previous
  6743. });
  6744. $(previous).trigger(hiddenEvent);
  6745. $(_this._element).trigger(shownEvent);
  6746. };
  6747. if (target) {
  6748. this._activate(target, target.parentNode, complete);
  6749. } else {
  6750. complete();
  6751. }
  6752. };
  6753. _proto.dispose = function dispose() {
  6754. $.removeData(this._element, DATA_KEY$9);
  6755. this._element = null;
  6756. } // Private
  6757. ;
  6758. _proto._activate = function _activate(element, container, callback) {
  6759. var _this2 = this;
  6760. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  6761. var active = activeElements[0];
  6762. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  6763. var complete = function complete() {
  6764. return _this2._transitionComplete(element, active, callback);
  6765. };
  6766. if (active && isTransitioning) {
  6767. var transitionDuration = Util.getTransitionDurationFromElement(active);
  6768. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6769. } else {
  6770. complete();
  6771. }
  6772. };
  6773. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  6774. if (active) {
  6775. $(active).removeClass(ClassName$9.ACTIVE);
  6776. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  6777. if (dropdownChild) {
  6778. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  6779. }
  6780. if (active.getAttribute('role') === 'tab') {
  6781. active.setAttribute('aria-selected', false);
  6782. }
  6783. }
  6784. $(element).addClass(ClassName$9.ACTIVE);
  6785. if (element.getAttribute('role') === 'tab') {
  6786. element.setAttribute('aria-selected', true);
  6787. }
  6788. Util.reflow(element);
  6789. if (element.classList.contains(ClassName$9.FADE)) {
  6790. element.classList.add(ClassName$9.SHOW);
  6791. }
  6792. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  6793. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  6794. if (dropdownElement) {
  6795. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  6796. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  6797. }
  6798. element.setAttribute('aria-expanded', true);
  6799. }
  6800. if (callback) {
  6801. callback();
  6802. }
  6803. } // Static
  6804. ;
  6805. Tab._jQueryInterface = function _jQueryInterface(config) {
  6806. return this.each(function () {
  6807. var $this = $(this);
  6808. var data = $this.data(DATA_KEY$9);
  6809. if (!data) {
  6810. data = new Tab(this);
  6811. $this.data(DATA_KEY$9, data);
  6812. }
  6813. if (typeof config === 'string') {
  6814. if (typeof data[config] === 'undefined') {
  6815. throw new TypeError("No method named \"" + config + "\"");
  6816. }
  6817. data[config]();
  6818. }
  6819. });
  6820. };
  6821. _createClass(Tab, null, [{
  6822. key: "VERSION",
  6823. get: function get() {
  6824. return VERSION$9;
  6825. }
  6826. }]);
  6827. return Tab;
  6828. }();
  6829. /**
  6830. * ------------------------------------------------------------------------
  6831. * Data Api implementation
  6832. * ------------------------------------------------------------------------
  6833. */
  6834. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  6835. event.preventDefault();
  6836. Tab._jQueryInterface.call($(this), 'show');
  6837. });
  6838. /**
  6839. * ------------------------------------------------------------------------
  6840. * jQuery
  6841. * ------------------------------------------------------------------------
  6842. */
  6843. $.fn[NAME$9] = Tab._jQueryInterface;
  6844. $.fn[NAME$9].Constructor = Tab;
  6845. $.fn[NAME$9].noConflict = function () {
  6846. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6847. return Tab._jQueryInterface;
  6848. };
  6849. /**
  6850. * ------------------------------------------------------------------------
  6851. * Constants
  6852. * ------------------------------------------------------------------------
  6853. */
  6854. var NAME$a = 'toast';
  6855. var VERSION$a = '4.4.1';
  6856. var DATA_KEY$a = 'bs.toast';
  6857. var EVENT_KEY$a = "." + DATA_KEY$a;
  6858. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6859. var Event$a = {
  6860. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6861. HIDE: "hide" + EVENT_KEY$a,
  6862. HIDDEN: "hidden" + EVENT_KEY$a,
  6863. SHOW: "show" + EVENT_KEY$a,
  6864. SHOWN: "shown" + EVENT_KEY$a
  6865. };
  6866. var ClassName$a = {
  6867. FADE: 'fade',
  6868. HIDE: 'hide',
  6869. SHOW: 'show',
  6870. SHOWING: 'showing'
  6871. };
  6872. var DefaultType$7 = {
  6873. animation: 'boolean',
  6874. autohide: 'boolean',
  6875. delay: 'number'
  6876. };
  6877. var Default$7 = {
  6878. animation: true,
  6879. autohide: true,
  6880. delay: 500
  6881. };
  6882. var Selector$a = {
  6883. DATA_DISMISS: '[data-dismiss="toast"]'
  6884. };
  6885. /**
  6886. * ------------------------------------------------------------------------
  6887. * Class Definition
  6888. * ------------------------------------------------------------------------
  6889. */
  6890. var Toast =
  6891. /*#__PURE__*/
  6892. function () {
  6893. function Toast(element, config) {
  6894. this._element = element;
  6895. this._config = this._getConfig(config);
  6896. this._timeout = null;
  6897. this._setListeners();
  6898. } // Getters
  6899. var _proto = Toast.prototype;
  6900. // Public
  6901. _proto.show = function show() {
  6902. var _this = this;
  6903. var showEvent = $.Event(Event$a.SHOW);
  6904. $(this._element).trigger(showEvent);
  6905. if (showEvent.isDefaultPrevented()) {
  6906. return;
  6907. }
  6908. if (this._config.animation) {
  6909. this._element.classList.add(ClassName$a.FADE);
  6910. }
  6911. var complete = function complete() {
  6912. _this._element.classList.remove(ClassName$a.SHOWING);
  6913. _this._element.classList.add(ClassName$a.SHOW);
  6914. $(_this._element).trigger(Event$a.SHOWN);
  6915. if (_this._config.autohide) {
  6916. _this._timeout = setTimeout(function () {
  6917. _this.hide();
  6918. }, _this._config.delay);
  6919. }
  6920. };
  6921. this._element.classList.remove(ClassName$a.HIDE);
  6922. Util.reflow(this._element);
  6923. this._element.classList.add(ClassName$a.SHOWING);
  6924. if (this._config.animation) {
  6925. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6926. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6927. } else {
  6928. complete();
  6929. }
  6930. };
  6931. _proto.hide = function hide() {
  6932. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6933. return;
  6934. }
  6935. var hideEvent = $.Event(Event$a.HIDE);
  6936. $(this._element).trigger(hideEvent);
  6937. if (hideEvent.isDefaultPrevented()) {
  6938. return;
  6939. }
  6940. this._close();
  6941. };
  6942. _proto.dispose = function dispose() {
  6943. clearTimeout(this._timeout);
  6944. this._timeout = null;
  6945. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6946. this._element.classList.remove(ClassName$a.SHOW);
  6947. }
  6948. $(this._element).off(Event$a.CLICK_DISMISS);
  6949. $.removeData(this._element, DATA_KEY$a);
  6950. this._element = null;
  6951. this._config = null;
  6952. } // Private
  6953. ;
  6954. _proto._getConfig = function _getConfig(config) {
  6955. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6956. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6957. return config;
  6958. };
  6959. _proto._setListeners = function _setListeners() {
  6960. var _this2 = this;
  6961. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6962. return _this2.hide();
  6963. });
  6964. };
  6965. _proto._close = function _close() {
  6966. var _this3 = this;
  6967. var complete = function complete() {
  6968. _this3._element.classList.add(ClassName$a.HIDE);
  6969. $(_this3._element).trigger(Event$a.HIDDEN);
  6970. };
  6971. this._element.classList.remove(ClassName$a.SHOW);
  6972. if (this._config.animation) {
  6973. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6974. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6975. } else {
  6976. complete();
  6977. }
  6978. } // Static
  6979. ;
  6980. Toast._jQueryInterface = function _jQueryInterface(config) {
  6981. return this.each(function () {
  6982. var $element = $(this);
  6983. var data = $element.data(DATA_KEY$a);
  6984. var _config = typeof config === 'object' && config;
  6985. if (!data) {
  6986. data = new Toast(this, _config);
  6987. $element.data(DATA_KEY$a, data);
  6988. }
  6989. if (typeof config === 'string') {
  6990. if (typeof data[config] === 'undefined') {
  6991. throw new TypeError("No method named \"" + config + "\"");
  6992. }
  6993. data[config](this);
  6994. }
  6995. });
  6996. };
  6997. _createClass(Toast, null, [{
  6998. key: "VERSION",
  6999. get: function get() {
  7000. return VERSION$a;
  7001. }
  7002. }, {
  7003. key: "DefaultType",
  7004. get: function get() {
  7005. return DefaultType$7;
  7006. }
  7007. }, {
  7008. key: "Default",
  7009. get: function get() {
  7010. return Default$7;
  7011. }
  7012. }]);
  7013. return Toast;
  7014. }();
  7015. /**
  7016. * ------------------------------------------------------------------------
  7017. * jQuery
  7018. * ------------------------------------------------------------------------
  7019. */
  7020. $.fn[NAME$a] = Toast._jQueryInterface;
  7021. $.fn[NAME$a].Constructor = Toast;
  7022. $.fn[NAME$a].noConflict = function () {
  7023. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  7024. return Toast._jQueryInterface;
  7025. };
  7026. exports.Alert = Alert;
  7027. exports.Button = Button;
  7028. exports.Carousel = Carousel;
  7029. exports.Collapse = Collapse;
  7030. exports.Dropdown = Dropdown;
  7031. exports.Modal = Modal;
  7032. exports.Popover = Popover;
  7033. exports.Scrollspy = ScrollSpy;
  7034. exports.Tab = Tab;
  7035. exports.Toast = Toast;
  7036. exports.Tooltip = Tooltip;
  7037. exports.Util = Util;
  7038. Object.defineProperty(exports, '__esModule', { value: true });
  7039. })));
  7040. //# sourceMappingURL=bootstrap.js.map
  7041. /***/ }),
  7042. /***/ "./node_modules/buffer/index.js":
  7043. /*!**************************************!*\
  7044. !*** ./node_modules/buffer/index.js ***!
  7045. \**************************************/
  7046. /*! no static exports found */
  7047. /***/ (function(module, exports, __webpack_require__) {
  7048. "use strict";
  7049. /* WEBPACK VAR INJECTION */(function(global) {/*!
  7050. * The buffer module from node.js, for the browser.
  7051. *
  7052. * @author Feross Aboukhadijeh <http://feross.org>
  7053. * @license MIT
  7054. */
  7055. /* eslint-disable no-proto */
  7056. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  7057. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  7058. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  7059. exports.Buffer = Buffer
  7060. exports.SlowBuffer = SlowBuffer
  7061. exports.INSPECT_MAX_BYTES = 50
  7062. /**
  7063. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  7064. * === true Use Uint8Array implementation (fastest)
  7065. * === false Use Object implementation (most compatible, even IE6)
  7066. *
  7067. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  7068. * Opera 11.6+, iOS 4.2+.
  7069. *
  7070. * Due to various browser bugs, sometimes the Object implementation will be used even
  7071. * when the browser supports typed arrays.
  7072. *
  7073. * Note:
  7074. *
  7075. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  7076. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  7077. *
  7078. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  7079. *
  7080. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  7081. * incorrect length in some situations.
  7082. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  7083. * get the Object implementation, which is slower but behaves correctly.
  7084. */
  7085. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  7086. ? global.TYPED_ARRAY_SUPPORT
  7087. : typedArraySupport()
  7088. /*
  7089. * Export kMaxLength after typed array support is determined.
  7090. */
  7091. exports.kMaxLength = kMaxLength()
  7092. function typedArraySupport () {
  7093. try {
  7094. var arr = new Uint8Array(1)
  7095. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  7096. return arr.foo() === 42 && // typed array instances can be augmented
  7097. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  7098. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  7099. } catch (e) {
  7100. return false
  7101. }
  7102. }
  7103. function kMaxLength () {
  7104. return Buffer.TYPED_ARRAY_SUPPORT
  7105. ? 0x7fffffff
  7106. : 0x3fffffff
  7107. }
  7108. function createBuffer (that, length) {
  7109. if (kMaxLength() < length) {
  7110. throw new RangeError('Invalid typed array length')
  7111. }
  7112. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7113. // Return an augmented `Uint8Array` instance, for best performance
  7114. that = new Uint8Array(length)
  7115. that.__proto__ = Buffer.prototype
  7116. } else {
  7117. // Fallback: Return an object instance of the Buffer class
  7118. if (that === null) {
  7119. that = new Buffer(length)
  7120. }
  7121. that.length = length
  7122. }
  7123. return that
  7124. }
  7125. /**
  7126. * The Buffer constructor returns instances of `Uint8Array` that have their
  7127. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  7128. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  7129. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  7130. * returns a single octet.
  7131. *
  7132. * The `Uint8Array` prototype remains unmodified.
  7133. */
  7134. function Buffer (arg, encodingOrOffset, length) {
  7135. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  7136. return new Buffer(arg, encodingOrOffset, length)
  7137. }
  7138. // Common case.
  7139. if (typeof arg === 'number') {
  7140. if (typeof encodingOrOffset === 'string') {
  7141. throw new Error(
  7142. 'If encoding is specified then the first argument must be a string'
  7143. )
  7144. }
  7145. return allocUnsafe(this, arg)
  7146. }
  7147. return from(this, arg, encodingOrOffset, length)
  7148. }
  7149. Buffer.poolSize = 8192 // not used by this implementation
  7150. // TODO: Legacy, not needed anymore. Remove in next major version.
  7151. Buffer._augment = function (arr) {
  7152. arr.__proto__ = Buffer.prototype
  7153. return arr
  7154. }
  7155. function from (that, value, encodingOrOffset, length) {
  7156. if (typeof value === 'number') {
  7157. throw new TypeError('"value" argument must not be a number')
  7158. }
  7159. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  7160. return fromArrayBuffer(that, value, encodingOrOffset, length)
  7161. }
  7162. if (typeof value === 'string') {
  7163. return fromString(that, value, encodingOrOffset)
  7164. }
  7165. return fromObject(that, value)
  7166. }
  7167. /**
  7168. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  7169. * if value is a number.
  7170. * Buffer.from(str[, encoding])
  7171. * Buffer.from(array)
  7172. * Buffer.from(buffer)
  7173. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  7174. **/
  7175. Buffer.from = function (value, encodingOrOffset, length) {
  7176. return from(null, value, encodingOrOffset, length)
  7177. }
  7178. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7179. Buffer.prototype.__proto__ = Uint8Array.prototype
  7180. Buffer.__proto__ = Uint8Array
  7181. if (typeof Symbol !== 'undefined' && Symbol.species &&
  7182. Buffer[Symbol.species] === Buffer) {
  7183. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  7184. Object.defineProperty(Buffer, Symbol.species, {
  7185. value: null,
  7186. configurable: true
  7187. })
  7188. }
  7189. }
  7190. function assertSize (size) {
  7191. if (typeof size !== 'number') {
  7192. throw new TypeError('"size" argument must be a number')
  7193. } else if (size < 0) {
  7194. throw new RangeError('"size" argument must not be negative')
  7195. }
  7196. }
  7197. function alloc (that, size, fill, encoding) {
  7198. assertSize(size)
  7199. if (size <= 0) {
  7200. return createBuffer(that, size)
  7201. }
  7202. if (fill !== undefined) {
  7203. // Only pay attention to encoding if it's a string. This
  7204. // prevents accidentally sending in a number that would
  7205. // be interpretted as a start offset.
  7206. return typeof encoding === 'string'
  7207. ? createBuffer(that, size).fill(fill, encoding)
  7208. : createBuffer(that, size).fill(fill)
  7209. }
  7210. return createBuffer(that, size)
  7211. }
  7212. /**
  7213. * Creates a new filled Buffer instance.
  7214. * alloc(size[, fill[, encoding]])
  7215. **/
  7216. Buffer.alloc = function (size, fill, encoding) {
  7217. return alloc(null, size, fill, encoding)
  7218. }
  7219. function allocUnsafe (that, size) {
  7220. assertSize(size)
  7221. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  7222. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  7223. for (var i = 0; i < size; ++i) {
  7224. that[i] = 0
  7225. }
  7226. }
  7227. return that
  7228. }
  7229. /**
  7230. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  7231. * */
  7232. Buffer.allocUnsafe = function (size) {
  7233. return allocUnsafe(null, size)
  7234. }
  7235. /**
  7236. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  7237. */
  7238. Buffer.allocUnsafeSlow = function (size) {
  7239. return allocUnsafe(null, size)
  7240. }
  7241. function fromString (that, string, encoding) {
  7242. if (typeof encoding !== 'string' || encoding === '') {
  7243. encoding = 'utf8'
  7244. }
  7245. if (!Buffer.isEncoding(encoding)) {
  7246. throw new TypeError('"encoding" must be a valid string encoding')
  7247. }
  7248. var length = byteLength(string, encoding) | 0
  7249. that = createBuffer(that, length)
  7250. var actual = that.write(string, encoding)
  7251. if (actual !== length) {
  7252. // Writing a hex string, for example, that contains invalid characters will
  7253. // cause everything after the first invalid character to be ignored. (e.g.
  7254. // 'abxxcd' will be treated as 'ab')
  7255. that = that.slice(0, actual)
  7256. }
  7257. return that
  7258. }
  7259. function fromArrayLike (that, array) {
  7260. var length = array.length < 0 ? 0 : checked(array.length) | 0
  7261. that = createBuffer(that, length)
  7262. for (var i = 0; i < length; i += 1) {
  7263. that[i] = array[i] & 255
  7264. }
  7265. return that
  7266. }
  7267. function fromArrayBuffer (that, array, byteOffset, length) {
  7268. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  7269. if (byteOffset < 0 || array.byteLength < byteOffset) {
  7270. throw new RangeError('\'offset\' is out of bounds')
  7271. }
  7272. if (array.byteLength < byteOffset + (length || 0)) {
  7273. throw new RangeError('\'length\' is out of bounds')
  7274. }
  7275. if (byteOffset === undefined && length === undefined) {
  7276. array = new Uint8Array(array)
  7277. } else if (length === undefined) {
  7278. array = new Uint8Array(array, byteOffset)
  7279. } else {
  7280. array = new Uint8Array(array, byteOffset, length)
  7281. }
  7282. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7283. // Return an augmented `Uint8Array` instance, for best performance
  7284. that = array
  7285. that.__proto__ = Buffer.prototype
  7286. } else {
  7287. // Fallback: Return an object instance of the Buffer class
  7288. that = fromArrayLike(that, array)
  7289. }
  7290. return that
  7291. }
  7292. function fromObject (that, obj) {
  7293. if (Buffer.isBuffer(obj)) {
  7294. var len = checked(obj.length) | 0
  7295. that = createBuffer(that, len)
  7296. if (that.length === 0) {
  7297. return that
  7298. }
  7299. obj.copy(that, 0, 0, len)
  7300. return that
  7301. }
  7302. if (obj) {
  7303. if ((typeof ArrayBuffer !== 'undefined' &&
  7304. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  7305. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  7306. return createBuffer(that, 0)
  7307. }
  7308. return fromArrayLike(that, obj)
  7309. }
  7310. if (obj.type === 'Buffer' && isArray(obj.data)) {
  7311. return fromArrayLike(that, obj.data)
  7312. }
  7313. }
  7314. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  7315. }
  7316. function checked (length) {
  7317. // Note: cannot use `length < kMaxLength()` here because that fails when
  7318. // length is NaN (which is otherwise coerced to zero.)
  7319. if (length >= kMaxLength()) {
  7320. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  7321. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  7322. }
  7323. return length | 0
  7324. }
  7325. function SlowBuffer (length) {
  7326. if (+length != length) { // eslint-disable-line eqeqeq
  7327. length = 0
  7328. }
  7329. return Buffer.alloc(+length)
  7330. }
  7331. Buffer.isBuffer = function isBuffer (b) {
  7332. return !!(b != null && b._isBuffer)
  7333. }
  7334. Buffer.compare = function compare (a, b) {
  7335. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  7336. throw new TypeError('Arguments must be Buffers')
  7337. }
  7338. if (a === b) return 0
  7339. var x = a.length
  7340. var y = b.length
  7341. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  7342. if (a[i] !== b[i]) {
  7343. x = a[i]
  7344. y = b[i]
  7345. break
  7346. }
  7347. }
  7348. if (x < y) return -1
  7349. if (y < x) return 1
  7350. return 0
  7351. }
  7352. Buffer.isEncoding = function isEncoding (encoding) {
  7353. switch (String(encoding).toLowerCase()) {
  7354. case 'hex':
  7355. case 'utf8':
  7356. case 'utf-8':
  7357. case 'ascii':
  7358. case 'latin1':
  7359. case 'binary':
  7360. case 'base64':
  7361. case 'ucs2':
  7362. case 'ucs-2':
  7363. case 'utf16le':
  7364. case 'utf-16le':
  7365. return true
  7366. default:
  7367. return false
  7368. }
  7369. }
  7370. Buffer.concat = function concat (list, length) {
  7371. if (!isArray(list)) {
  7372. throw new TypeError('"list" argument must be an Array of Buffers')
  7373. }
  7374. if (list.length === 0) {
  7375. return Buffer.alloc(0)
  7376. }
  7377. var i
  7378. if (length === undefined) {
  7379. length = 0
  7380. for (i = 0; i < list.length; ++i) {
  7381. length += list[i].length
  7382. }
  7383. }
  7384. var buffer = Buffer.allocUnsafe(length)
  7385. var pos = 0
  7386. for (i = 0; i < list.length; ++i) {
  7387. var buf = list[i]
  7388. if (!Buffer.isBuffer(buf)) {
  7389. throw new TypeError('"list" argument must be an Array of Buffers')
  7390. }
  7391. buf.copy(buffer, pos)
  7392. pos += buf.length
  7393. }
  7394. return buffer
  7395. }
  7396. function byteLength (string, encoding) {
  7397. if (Buffer.isBuffer(string)) {
  7398. return string.length
  7399. }
  7400. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  7401. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  7402. return string.byteLength
  7403. }
  7404. if (typeof string !== 'string') {
  7405. string = '' + string
  7406. }
  7407. var len = string.length
  7408. if (len === 0) return 0
  7409. // Use a for loop to avoid recursion
  7410. var loweredCase = false
  7411. for (;;) {
  7412. switch (encoding) {
  7413. case 'ascii':
  7414. case 'latin1':
  7415. case 'binary':
  7416. return len
  7417. case 'utf8':
  7418. case 'utf-8':
  7419. case undefined:
  7420. return utf8ToBytes(string).length
  7421. case 'ucs2':
  7422. case 'ucs-2':
  7423. case 'utf16le':
  7424. case 'utf-16le':
  7425. return len * 2
  7426. case 'hex':
  7427. return len >>> 1
  7428. case 'base64':
  7429. return base64ToBytes(string).length
  7430. default:
  7431. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  7432. encoding = ('' + encoding).toLowerCase()
  7433. loweredCase = true
  7434. }
  7435. }
  7436. }
  7437. Buffer.byteLength = byteLength
  7438. function slowToString (encoding, start, end) {
  7439. var loweredCase = false
  7440. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  7441. // property of a typed array.
  7442. // This behaves neither like String nor Uint8Array in that we set start/end
  7443. // to their upper/lower bounds if the value passed is out of range.
  7444. // undefined is handled specially as per ECMA-262 6th Edition,
  7445. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  7446. if (start === undefined || start < 0) {
  7447. start = 0
  7448. }
  7449. // Return early if start > this.length. Done here to prevent potential uint32
  7450. // coercion fail below.
  7451. if (start > this.length) {
  7452. return ''
  7453. }
  7454. if (end === undefined || end > this.length) {
  7455. end = this.length
  7456. }
  7457. if (end <= 0) {
  7458. return ''
  7459. }
  7460. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  7461. end >>>= 0
  7462. start >>>= 0
  7463. if (end <= start) {
  7464. return ''
  7465. }
  7466. if (!encoding) encoding = 'utf8'
  7467. while (true) {
  7468. switch (encoding) {
  7469. case 'hex':
  7470. return hexSlice(this, start, end)
  7471. case 'utf8':
  7472. case 'utf-8':
  7473. return utf8Slice(this, start, end)
  7474. case 'ascii':
  7475. return asciiSlice(this, start, end)
  7476. case 'latin1':
  7477. case 'binary':
  7478. return latin1Slice(this, start, end)
  7479. case 'base64':
  7480. return base64Slice(this, start, end)
  7481. case 'ucs2':
  7482. case 'ucs-2':
  7483. case 'utf16le':
  7484. case 'utf-16le':
  7485. return utf16leSlice(this, start, end)
  7486. default:
  7487. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7488. encoding = (encoding + '').toLowerCase()
  7489. loweredCase = true
  7490. }
  7491. }
  7492. }
  7493. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  7494. // Buffer instances.
  7495. Buffer.prototype._isBuffer = true
  7496. function swap (b, n, m) {
  7497. var i = b[n]
  7498. b[n] = b[m]
  7499. b[m] = i
  7500. }
  7501. Buffer.prototype.swap16 = function swap16 () {
  7502. var len = this.length
  7503. if (len % 2 !== 0) {
  7504. throw new RangeError('Buffer size must be a multiple of 16-bits')
  7505. }
  7506. for (var i = 0; i < len; i += 2) {
  7507. swap(this, i, i + 1)
  7508. }
  7509. return this
  7510. }
  7511. Buffer.prototype.swap32 = function swap32 () {
  7512. var len = this.length
  7513. if (len % 4 !== 0) {
  7514. throw new RangeError('Buffer size must be a multiple of 32-bits')
  7515. }
  7516. for (var i = 0; i < len; i += 4) {
  7517. swap(this, i, i + 3)
  7518. swap(this, i + 1, i + 2)
  7519. }
  7520. return this
  7521. }
  7522. Buffer.prototype.swap64 = function swap64 () {
  7523. var len = this.length
  7524. if (len % 8 !== 0) {
  7525. throw new RangeError('Buffer size must be a multiple of 64-bits')
  7526. }
  7527. for (var i = 0; i < len; i += 8) {
  7528. swap(this, i, i + 7)
  7529. swap(this, i + 1, i + 6)
  7530. swap(this, i + 2, i + 5)
  7531. swap(this, i + 3, i + 4)
  7532. }
  7533. return this
  7534. }
  7535. Buffer.prototype.toString = function toString () {
  7536. var length = this.length | 0
  7537. if (length === 0) return ''
  7538. if (arguments.length === 0) return utf8Slice(this, 0, length)
  7539. return slowToString.apply(this, arguments)
  7540. }
  7541. Buffer.prototype.equals = function equals (b) {
  7542. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  7543. if (this === b) return true
  7544. return Buffer.compare(this, b) === 0
  7545. }
  7546. Buffer.prototype.inspect = function inspect () {
  7547. var str = ''
  7548. var max = exports.INSPECT_MAX_BYTES
  7549. if (this.length > 0) {
  7550. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  7551. if (this.length > max) str += ' ... '
  7552. }
  7553. return '<Buffer ' + str + '>'
  7554. }
  7555. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  7556. if (!Buffer.isBuffer(target)) {
  7557. throw new TypeError('Argument must be a Buffer')
  7558. }
  7559. if (start === undefined) {
  7560. start = 0
  7561. }
  7562. if (end === undefined) {
  7563. end = target ? target.length : 0
  7564. }
  7565. if (thisStart === undefined) {
  7566. thisStart = 0
  7567. }
  7568. if (thisEnd === undefined) {
  7569. thisEnd = this.length
  7570. }
  7571. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  7572. throw new RangeError('out of range index')
  7573. }
  7574. if (thisStart >= thisEnd && start >= end) {
  7575. return 0
  7576. }
  7577. if (thisStart >= thisEnd) {
  7578. return -1
  7579. }
  7580. if (start >= end) {
  7581. return 1
  7582. }
  7583. start >>>= 0
  7584. end >>>= 0
  7585. thisStart >>>= 0
  7586. thisEnd >>>= 0
  7587. if (this === target) return 0
  7588. var x = thisEnd - thisStart
  7589. var y = end - start
  7590. var len = Math.min(x, y)
  7591. var thisCopy = this.slice(thisStart, thisEnd)
  7592. var targetCopy = target.slice(start, end)
  7593. for (var i = 0; i < len; ++i) {
  7594. if (thisCopy[i] !== targetCopy[i]) {
  7595. x = thisCopy[i]
  7596. y = targetCopy[i]
  7597. break
  7598. }
  7599. }
  7600. if (x < y) return -1
  7601. if (y < x) return 1
  7602. return 0
  7603. }
  7604. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  7605. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  7606. //
  7607. // Arguments:
  7608. // - buffer - a Buffer to search
  7609. // - val - a string, Buffer, or number
  7610. // - byteOffset - an index into `buffer`; will be clamped to an int32
  7611. // - encoding - an optional encoding, relevant is val is a string
  7612. // - dir - true for indexOf, false for lastIndexOf
  7613. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  7614. // Empty buffer means no match
  7615. if (buffer.length === 0) return -1
  7616. // Normalize byteOffset
  7617. if (typeof byteOffset === 'string') {
  7618. encoding = byteOffset
  7619. byteOffset = 0
  7620. } else if (byteOffset > 0x7fffffff) {
  7621. byteOffset = 0x7fffffff
  7622. } else if (byteOffset < -0x80000000) {
  7623. byteOffset = -0x80000000
  7624. }
  7625. byteOffset = +byteOffset // Coerce to Number.
  7626. if (isNaN(byteOffset)) {
  7627. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  7628. byteOffset = dir ? 0 : (buffer.length - 1)
  7629. }
  7630. // Normalize byteOffset: negative offsets start from the end of the buffer
  7631. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  7632. if (byteOffset >= buffer.length) {
  7633. if (dir) return -1
  7634. else byteOffset = buffer.length - 1
  7635. } else if (byteOffset < 0) {
  7636. if (dir) byteOffset = 0
  7637. else return -1
  7638. }
  7639. // Normalize val
  7640. if (typeof val === 'string') {
  7641. val = Buffer.from(val, encoding)
  7642. }
  7643. // Finally, search either indexOf (if dir is true) or lastIndexOf
  7644. if (Buffer.isBuffer(val)) {
  7645. // Special case: looking for empty string/buffer always fails
  7646. if (val.length === 0) {
  7647. return -1
  7648. }
  7649. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  7650. } else if (typeof val === 'number') {
  7651. val = val & 0xFF // Search for a byte value [0-255]
  7652. if (Buffer.TYPED_ARRAY_SUPPORT &&
  7653. typeof Uint8Array.prototype.indexOf === 'function') {
  7654. if (dir) {
  7655. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  7656. } else {
  7657. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  7658. }
  7659. }
  7660. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  7661. }
  7662. throw new TypeError('val must be string, number or Buffer')
  7663. }
  7664. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  7665. var indexSize = 1
  7666. var arrLength = arr.length
  7667. var valLength = val.length
  7668. if (encoding !== undefined) {
  7669. encoding = String(encoding).toLowerCase()
  7670. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  7671. encoding === 'utf16le' || encoding === 'utf-16le') {
  7672. if (arr.length < 2 || val.length < 2) {
  7673. return -1
  7674. }
  7675. indexSize = 2
  7676. arrLength /= 2
  7677. valLength /= 2
  7678. byteOffset /= 2
  7679. }
  7680. }
  7681. function read (buf, i) {
  7682. if (indexSize === 1) {
  7683. return buf[i]
  7684. } else {
  7685. return buf.readUInt16BE(i * indexSize)
  7686. }
  7687. }
  7688. var i
  7689. if (dir) {
  7690. var foundIndex = -1
  7691. for (i = byteOffset; i < arrLength; i++) {
  7692. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  7693. if (foundIndex === -1) foundIndex = i
  7694. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  7695. } else {
  7696. if (foundIndex !== -1) i -= i - foundIndex
  7697. foundIndex = -1
  7698. }
  7699. }
  7700. } else {
  7701. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  7702. for (i = byteOffset; i >= 0; i--) {
  7703. var found = true
  7704. for (var j = 0; j < valLength; j++) {
  7705. if (read(arr, i + j) !== read(val, j)) {
  7706. found = false
  7707. break
  7708. }
  7709. }
  7710. if (found) return i
  7711. }
  7712. }
  7713. return -1
  7714. }
  7715. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  7716. return this.indexOf(val, byteOffset, encoding) !== -1
  7717. }
  7718. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  7719. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  7720. }
  7721. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  7722. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  7723. }
  7724. function hexWrite (buf, string, offset, length) {
  7725. offset = Number(offset) || 0
  7726. var remaining = buf.length - offset
  7727. if (!length) {
  7728. length = remaining
  7729. } else {
  7730. length = Number(length)
  7731. if (length > remaining) {
  7732. length = remaining
  7733. }
  7734. }
  7735. // must be an even number of digits
  7736. var strLen = string.length
  7737. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  7738. if (length > strLen / 2) {
  7739. length = strLen / 2
  7740. }
  7741. for (var i = 0; i < length; ++i) {
  7742. var parsed = parseInt(string.substr(i * 2, 2), 16)
  7743. if (isNaN(parsed)) return i
  7744. buf[offset + i] = parsed
  7745. }
  7746. return i
  7747. }
  7748. function utf8Write (buf, string, offset, length) {
  7749. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  7750. }
  7751. function asciiWrite (buf, string, offset, length) {
  7752. return blitBuffer(asciiToBytes(string), buf, offset, length)
  7753. }
  7754. function latin1Write (buf, string, offset, length) {
  7755. return asciiWrite(buf, string, offset, length)
  7756. }
  7757. function base64Write (buf, string, offset, length) {
  7758. return blitBuffer(base64ToBytes(string), buf, offset, length)
  7759. }
  7760. function ucs2Write (buf, string, offset, length) {
  7761. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  7762. }
  7763. Buffer.prototype.write = function write (string, offset, length, encoding) {
  7764. // Buffer#write(string)
  7765. if (offset === undefined) {
  7766. encoding = 'utf8'
  7767. length = this.length
  7768. offset = 0
  7769. // Buffer#write(string, encoding)
  7770. } else if (length === undefined && typeof offset === 'string') {
  7771. encoding = offset
  7772. length = this.length
  7773. offset = 0
  7774. // Buffer#write(string, offset[, length][, encoding])
  7775. } else if (isFinite(offset)) {
  7776. offset = offset | 0
  7777. if (isFinite(length)) {
  7778. length = length | 0
  7779. if (encoding === undefined) encoding = 'utf8'
  7780. } else {
  7781. encoding = length
  7782. length = undefined
  7783. }
  7784. // legacy write(string, encoding, offset, length) - remove in v0.13
  7785. } else {
  7786. throw new Error(
  7787. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  7788. )
  7789. }
  7790. var remaining = this.length - offset
  7791. if (length === undefined || length > remaining) length = remaining
  7792. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  7793. throw new RangeError('Attempt to write outside buffer bounds')
  7794. }
  7795. if (!encoding) encoding = 'utf8'
  7796. var loweredCase = false
  7797. for (;;) {
  7798. switch (encoding) {
  7799. case 'hex':
  7800. return hexWrite(this, string, offset, length)
  7801. case 'utf8':
  7802. case 'utf-8':
  7803. return utf8Write(this, string, offset, length)
  7804. case 'ascii':
  7805. return asciiWrite(this, string, offset, length)
  7806. case 'latin1':
  7807. case 'binary':
  7808. return latin1Write(this, string, offset, length)
  7809. case 'base64':
  7810. // Warning: maxLength not taken into account in base64Write
  7811. return base64Write(this, string, offset, length)
  7812. case 'ucs2':
  7813. case 'ucs-2':
  7814. case 'utf16le':
  7815. case 'utf-16le':
  7816. return ucs2Write(this, string, offset, length)
  7817. default:
  7818. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7819. encoding = ('' + encoding).toLowerCase()
  7820. loweredCase = true
  7821. }
  7822. }
  7823. }
  7824. Buffer.prototype.toJSON = function toJSON () {
  7825. return {
  7826. type: 'Buffer',
  7827. data: Array.prototype.slice.call(this._arr || this, 0)
  7828. }
  7829. }
  7830. function base64Slice (buf, start, end) {
  7831. if (start === 0 && end === buf.length) {
  7832. return base64.fromByteArray(buf)
  7833. } else {
  7834. return base64.fromByteArray(buf.slice(start, end))
  7835. }
  7836. }
  7837. function utf8Slice (buf, start, end) {
  7838. end = Math.min(buf.length, end)
  7839. var res = []
  7840. var i = start
  7841. while (i < end) {
  7842. var firstByte = buf[i]
  7843. var codePoint = null
  7844. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7845. : (firstByte > 0xDF) ? 3
  7846. : (firstByte > 0xBF) ? 2
  7847. : 1
  7848. if (i + bytesPerSequence <= end) {
  7849. var secondByte, thirdByte, fourthByte, tempCodePoint
  7850. switch (bytesPerSequence) {
  7851. case 1:
  7852. if (firstByte < 0x80) {
  7853. codePoint = firstByte
  7854. }
  7855. break
  7856. case 2:
  7857. secondByte = buf[i + 1]
  7858. if ((secondByte & 0xC0) === 0x80) {
  7859. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7860. if (tempCodePoint > 0x7F) {
  7861. codePoint = tempCodePoint
  7862. }
  7863. }
  7864. break
  7865. case 3:
  7866. secondByte = buf[i + 1]
  7867. thirdByte = buf[i + 2]
  7868. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7869. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7870. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7871. codePoint = tempCodePoint
  7872. }
  7873. }
  7874. break
  7875. case 4:
  7876. secondByte = buf[i + 1]
  7877. thirdByte = buf[i + 2]
  7878. fourthByte = buf[i + 3]
  7879. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7880. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7881. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7882. codePoint = tempCodePoint
  7883. }
  7884. }
  7885. }
  7886. }
  7887. if (codePoint === null) {
  7888. // we did not generate a valid codePoint so insert a
  7889. // replacement char (U+FFFD) and advance only 1 byte
  7890. codePoint = 0xFFFD
  7891. bytesPerSequence = 1
  7892. } else if (codePoint > 0xFFFF) {
  7893. // encode to utf16 (surrogate pair dance)
  7894. codePoint -= 0x10000
  7895. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7896. codePoint = 0xDC00 | codePoint & 0x3FF
  7897. }
  7898. res.push(codePoint)
  7899. i += bytesPerSequence
  7900. }
  7901. return decodeCodePointsArray(res)
  7902. }
  7903. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7904. // the lowest limit is Chrome, with 0x10000 args.
  7905. // We go 1 magnitude less, for safety
  7906. var MAX_ARGUMENTS_LENGTH = 0x1000
  7907. function decodeCodePointsArray (codePoints) {
  7908. var len = codePoints.length
  7909. if (len <= MAX_ARGUMENTS_LENGTH) {
  7910. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7911. }
  7912. // Decode in chunks to avoid "call stack size exceeded".
  7913. var res = ''
  7914. var i = 0
  7915. while (i < len) {
  7916. res += String.fromCharCode.apply(
  7917. String,
  7918. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7919. )
  7920. }
  7921. return res
  7922. }
  7923. function asciiSlice (buf, start, end) {
  7924. var ret = ''
  7925. end = Math.min(buf.length, end)
  7926. for (var i = start; i < end; ++i) {
  7927. ret += String.fromCharCode(buf[i] & 0x7F)
  7928. }
  7929. return ret
  7930. }
  7931. function latin1Slice (buf, start, end) {
  7932. var ret = ''
  7933. end = Math.min(buf.length, end)
  7934. for (var i = start; i < end; ++i) {
  7935. ret += String.fromCharCode(buf[i])
  7936. }
  7937. return ret
  7938. }
  7939. function hexSlice (buf, start, end) {
  7940. var len = buf.length
  7941. if (!start || start < 0) start = 0
  7942. if (!end || end < 0 || end > len) end = len
  7943. var out = ''
  7944. for (var i = start; i < end; ++i) {
  7945. out += toHex(buf[i])
  7946. }
  7947. return out
  7948. }
  7949. function utf16leSlice (buf, start, end) {
  7950. var bytes = buf.slice(start, end)
  7951. var res = ''
  7952. for (var i = 0; i < bytes.length; i += 2) {
  7953. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7954. }
  7955. return res
  7956. }
  7957. Buffer.prototype.slice = function slice (start, end) {
  7958. var len = this.length
  7959. start = ~~start
  7960. end = end === undefined ? len : ~~end
  7961. if (start < 0) {
  7962. start += len
  7963. if (start < 0) start = 0
  7964. } else if (start > len) {
  7965. start = len
  7966. }
  7967. if (end < 0) {
  7968. end += len
  7969. if (end < 0) end = 0
  7970. } else if (end > len) {
  7971. end = len
  7972. }
  7973. if (end < start) end = start
  7974. var newBuf
  7975. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7976. newBuf = this.subarray(start, end)
  7977. newBuf.__proto__ = Buffer.prototype
  7978. } else {
  7979. var sliceLen = end - start
  7980. newBuf = new Buffer(sliceLen, undefined)
  7981. for (var i = 0; i < sliceLen; ++i) {
  7982. newBuf[i] = this[i + start]
  7983. }
  7984. }
  7985. return newBuf
  7986. }
  7987. /*
  7988. * Need to make sure that buffer isn't trying to write out of bounds.
  7989. */
  7990. function checkOffset (offset, ext, length) {
  7991. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7992. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7993. }
  7994. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7995. offset = offset | 0
  7996. byteLength = byteLength | 0
  7997. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7998. var val = this[offset]
  7999. var mul = 1
  8000. var i = 0
  8001. while (++i < byteLength && (mul *= 0x100)) {
  8002. val += this[offset + i] * mul
  8003. }
  8004. return val
  8005. }
  8006. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  8007. offset = offset | 0
  8008. byteLength = byteLength | 0
  8009. if (!noAssert) {
  8010. checkOffset(offset, byteLength, this.length)
  8011. }
  8012. var val = this[offset + --byteLength]
  8013. var mul = 1
  8014. while (byteLength > 0 && (mul *= 0x100)) {
  8015. val += this[offset + --byteLength] * mul
  8016. }
  8017. return val
  8018. }
  8019. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  8020. if (!noAssert) checkOffset(offset, 1, this.length)
  8021. return this[offset]
  8022. }
  8023. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  8024. if (!noAssert) checkOffset(offset, 2, this.length)
  8025. return this[offset] | (this[offset + 1] << 8)
  8026. }
  8027. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  8028. if (!noAssert) checkOffset(offset, 2, this.length)
  8029. return (this[offset] << 8) | this[offset + 1]
  8030. }
  8031. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  8032. if (!noAssert) checkOffset(offset, 4, this.length)
  8033. return ((this[offset]) |
  8034. (this[offset + 1] << 8) |
  8035. (this[offset + 2] << 16)) +
  8036. (this[offset + 3] * 0x1000000)
  8037. }
  8038. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  8039. if (!noAssert) checkOffset(offset, 4, this.length)
  8040. return (this[offset] * 0x1000000) +
  8041. ((this[offset + 1] << 16) |
  8042. (this[offset + 2] << 8) |
  8043. this[offset + 3])
  8044. }
  8045. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  8046. offset = offset | 0
  8047. byteLength = byteLength | 0
  8048. if (!noAssert) checkOffset(offset, byteLength, this.length)
  8049. var val = this[offset]
  8050. var mul = 1
  8051. var i = 0
  8052. while (++i < byteLength && (mul *= 0x100)) {
  8053. val += this[offset + i] * mul
  8054. }
  8055. mul *= 0x80
  8056. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  8057. return val
  8058. }
  8059. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  8060. offset = offset | 0
  8061. byteLength = byteLength | 0
  8062. if (!noAssert) checkOffset(offset, byteLength, this.length)
  8063. var i = byteLength
  8064. var mul = 1
  8065. var val = this[offset + --i]
  8066. while (i > 0 && (mul *= 0x100)) {
  8067. val += this[offset + --i] * mul
  8068. }
  8069. mul *= 0x80
  8070. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  8071. return val
  8072. }
  8073. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  8074. if (!noAssert) checkOffset(offset, 1, this.length)
  8075. if (!(this[offset] & 0x80)) return (this[offset])
  8076. return ((0xff - this[offset] + 1) * -1)
  8077. }
  8078. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  8079. if (!noAssert) checkOffset(offset, 2, this.length)
  8080. var val = this[offset] | (this[offset + 1] << 8)
  8081. return (val & 0x8000) ? val | 0xFFFF0000 : val
  8082. }
  8083. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  8084. if (!noAssert) checkOffset(offset, 2, this.length)
  8085. var val = this[offset + 1] | (this[offset] << 8)
  8086. return (val & 0x8000) ? val | 0xFFFF0000 : val
  8087. }
  8088. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  8089. if (!noAssert) checkOffset(offset, 4, this.length)
  8090. return (this[offset]) |
  8091. (this[offset + 1] << 8) |
  8092. (this[offset + 2] << 16) |
  8093. (this[offset + 3] << 24)
  8094. }
  8095. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  8096. if (!noAssert) checkOffset(offset, 4, this.length)
  8097. return (this[offset] << 24) |
  8098. (this[offset + 1] << 16) |
  8099. (this[offset + 2] << 8) |
  8100. (this[offset + 3])
  8101. }
  8102. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  8103. if (!noAssert) checkOffset(offset, 4, this.length)
  8104. return ieee754.read(this, offset, true, 23, 4)
  8105. }
  8106. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  8107. if (!noAssert) checkOffset(offset, 4, this.length)
  8108. return ieee754.read(this, offset, false, 23, 4)
  8109. }
  8110. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  8111. if (!noAssert) checkOffset(offset, 8, this.length)
  8112. return ieee754.read(this, offset, true, 52, 8)
  8113. }
  8114. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  8115. if (!noAssert) checkOffset(offset, 8, this.length)
  8116. return ieee754.read(this, offset, false, 52, 8)
  8117. }
  8118. function checkInt (buf, value, offset, ext, max, min) {
  8119. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  8120. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  8121. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  8122. }
  8123. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  8124. value = +value
  8125. offset = offset | 0
  8126. byteLength = byteLength | 0
  8127. if (!noAssert) {
  8128. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  8129. checkInt(this, value, offset, byteLength, maxBytes, 0)
  8130. }
  8131. var mul = 1
  8132. var i = 0
  8133. this[offset] = value & 0xFF
  8134. while (++i < byteLength && (mul *= 0x100)) {
  8135. this[offset + i] = (value / mul) & 0xFF
  8136. }
  8137. return offset + byteLength
  8138. }
  8139. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  8140. value = +value
  8141. offset = offset | 0
  8142. byteLength = byteLength | 0
  8143. if (!noAssert) {
  8144. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  8145. checkInt(this, value, offset, byteLength, maxBytes, 0)
  8146. }
  8147. var i = byteLength - 1
  8148. var mul = 1
  8149. this[offset + i] = value & 0xFF
  8150. while (--i >= 0 && (mul *= 0x100)) {
  8151. this[offset + i] = (value / mul) & 0xFF
  8152. }
  8153. return offset + byteLength
  8154. }
  8155. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  8156. value = +value
  8157. offset = offset | 0
  8158. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  8159. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  8160. this[offset] = (value & 0xff)
  8161. return offset + 1
  8162. }
  8163. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  8164. if (value < 0) value = 0xffff + value + 1
  8165. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  8166. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  8167. (littleEndian ? i : 1 - i) * 8
  8168. }
  8169. }
  8170. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  8171. value = +value
  8172. offset = offset | 0
  8173. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  8174. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8175. this[offset] = (value & 0xff)
  8176. this[offset + 1] = (value >>> 8)
  8177. } else {
  8178. objectWriteUInt16(this, value, offset, true)
  8179. }
  8180. return offset + 2
  8181. }
  8182. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  8183. value = +value
  8184. offset = offset | 0
  8185. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  8186. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8187. this[offset] = (value >>> 8)
  8188. this[offset + 1] = (value & 0xff)
  8189. } else {
  8190. objectWriteUInt16(this, value, offset, false)
  8191. }
  8192. return offset + 2
  8193. }
  8194. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  8195. if (value < 0) value = 0xffffffff + value + 1
  8196. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  8197. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  8198. }
  8199. }
  8200. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  8201. value = +value
  8202. offset = offset | 0
  8203. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8204. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8205. this[offset + 3] = (value >>> 24)
  8206. this[offset + 2] = (value >>> 16)
  8207. this[offset + 1] = (value >>> 8)
  8208. this[offset] = (value & 0xff)
  8209. } else {
  8210. objectWriteUInt32(this, value, offset, true)
  8211. }
  8212. return offset + 4
  8213. }
  8214. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  8215. value = +value
  8216. offset = offset | 0
  8217. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8218. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8219. this[offset] = (value >>> 24)
  8220. this[offset + 1] = (value >>> 16)
  8221. this[offset + 2] = (value >>> 8)
  8222. this[offset + 3] = (value & 0xff)
  8223. } else {
  8224. objectWriteUInt32(this, value, offset, false)
  8225. }
  8226. return offset + 4
  8227. }
  8228. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  8229. value = +value
  8230. offset = offset | 0
  8231. if (!noAssert) {
  8232. var limit = Math.pow(2, 8 * byteLength - 1)
  8233. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8234. }
  8235. var i = 0
  8236. var mul = 1
  8237. var sub = 0
  8238. this[offset] = value & 0xFF
  8239. while (++i < byteLength && (mul *= 0x100)) {
  8240. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  8241. sub = 1
  8242. }
  8243. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8244. }
  8245. return offset + byteLength
  8246. }
  8247. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  8248. value = +value
  8249. offset = offset | 0
  8250. if (!noAssert) {
  8251. var limit = Math.pow(2, 8 * byteLength - 1)
  8252. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8253. }
  8254. var i = byteLength - 1
  8255. var mul = 1
  8256. var sub = 0
  8257. this[offset + i] = value & 0xFF
  8258. while (--i >= 0 && (mul *= 0x100)) {
  8259. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  8260. sub = 1
  8261. }
  8262. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8263. }
  8264. return offset + byteLength
  8265. }
  8266. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  8267. value = +value
  8268. offset = offset | 0
  8269. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  8270. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  8271. if (value < 0) value = 0xff + value + 1
  8272. this[offset] = (value & 0xff)
  8273. return offset + 1
  8274. }
  8275. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  8276. value = +value
  8277. offset = offset | 0
  8278. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8279. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8280. this[offset] = (value & 0xff)
  8281. this[offset + 1] = (value >>> 8)
  8282. } else {
  8283. objectWriteUInt16(this, value, offset, true)
  8284. }
  8285. return offset + 2
  8286. }
  8287. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  8288. value = +value
  8289. offset = offset | 0
  8290. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8291. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8292. this[offset] = (value >>> 8)
  8293. this[offset + 1] = (value & 0xff)
  8294. } else {
  8295. objectWriteUInt16(this, value, offset, false)
  8296. }
  8297. return offset + 2
  8298. }
  8299. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  8300. value = +value
  8301. offset = offset | 0
  8302. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8303. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8304. this[offset] = (value & 0xff)
  8305. this[offset + 1] = (value >>> 8)
  8306. this[offset + 2] = (value >>> 16)
  8307. this[offset + 3] = (value >>> 24)
  8308. } else {
  8309. objectWriteUInt32(this, value, offset, true)
  8310. }
  8311. return offset + 4
  8312. }
  8313. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  8314. value = +value
  8315. offset = offset | 0
  8316. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8317. if (value < 0) value = 0xffffffff + value + 1
  8318. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8319. this[offset] = (value >>> 24)
  8320. this[offset + 1] = (value >>> 16)
  8321. this[offset + 2] = (value >>> 8)
  8322. this[offset + 3] = (value & 0xff)
  8323. } else {
  8324. objectWriteUInt32(this, value, offset, false)
  8325. }
  8326. return offset + 4
  8327. }
  8328. function checkIEEE754 (buf, value, offset, ext, max, min) {
  8329. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  8330. if (offset < 0) throw new RangeError('Index out of range')
  8331. }
  8332. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  8333. if (!noAssert) {
  8334. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  8335. }
  8336. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  8337. return offset + 4
  8338. }
  8339. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  8340. return writeFloat(this, value, offset, true, noAssert)
  8341. }
  8342. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  8343. return writeFloat(this, value, offset, false, noAssert)
  8344. }
  8345. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  8346. if (!noAssert) {
  8347. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  8348. }
  8349. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  8350. return offset + 8
  8351. }
  8352. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  8353. return writeDouble(this, value, offset, true, noAssert)
  8354. }
  8355. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  8356. return writeDouble(this, value, offset, false, noAssert)
  8357. }
  8358. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  8359. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  8360. if (!start) start = 0
  8361. if (!end && end !== 0) end = this.length
  8362. if (targetStart >= target.length) targetStart = target.length
  8363. if (!targetStart) targetStart = 0
  8364. if (end > 0 && end < start) end = start
  8365. // Copy 0 bytes; we're done
  8366. if (end === start) return 0
  8367. if (target.length === 0 || this.length === 0) return 0
  8368. // Fatal error conditions
  8369. if (targetStart < 0) {
  8370. throw new RangeError('targetStart out of bounds')
  8371. }
  8372. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  8373. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  8374. // Are we oob?
  8375. if (end > this.length) end = this.length
  8376. if (target.length - targetStart < end - start) {
  8377. end = target.length - targetStart + start
  8378. }
  8379. var len = end - start
  8380. var i
  8381. if (this === target && start < targetStart && targetStart < end) {
  8382. // descending copy from end
  8383. for (i = len - 1; i >= 0; --i) {
  8384. target[i + targetStart] = this[i + start]
  8385. }
  8386. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  8387. // ascending copy from start
  8388. for (i = 0; i < len; ++i) {
  8389. target[i + targetStart] = this[i + start]
  8390. }
  8391. } else {
  8392. Uint8Array.prototype.set.call(
  8393. target,
  8394. this.subarray(start, start + len),
  8395. targetStart
  8396. )
  8397. }
  8398. return len
  8399. }
  8400. // Usage:
  8401. // buffer.fill(number[, offset[, end]])
  8402. // buffer.fill(buffer[, offset[, end]])
  8403. // buffer.fill(string[, offset[, end]][, encoding])
  8404. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  8405. // Handle string cases:
  8406. if (typeof val === 'string') {
  8407. if (typeof start === 'string') {
  8408. encoding = start
  8409. start = 0
  8410. end = this.length
  8411. } else if (typeof end === 'string') {
  8412. encoding = end
  8413. end = this.length
  8414. }
  8415. if (val.length === 1) {
  8416. var code = val.charCodeAt(0)
  8417. if (code < 256) {
  8418. val = code
  8419. }
  8420. }
  8421. if (encoding !== undefined && typeof encoding !== 'string') {
  8422. throw new TypeError('encoding must be a string')
  8423. }
  8424. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  8425. throw new TypeError('Unknown encoding: ' + encoding)
  8426. }
  8427. } else if (typeof val === 'number') {
  8428. val = val & 255
  8429. }
  8430. // Invalid ranges are not set to a default, so can range check early.
  8431. if (start < 0 || this.length < start || this.length < end) {
  8432. throw new RangeError('Out of range index')
  8433. }
  8434. if (end <= start) {
  8435. return this
  8436. }
  8437. start = start >>> 0
  8438. end = end === undefined ? this.length : end >>> 0
  8439. if (!val) val = 0
  8440. var i
  8441. if (typeof val === 'number') {
  8442. for (i = start; i < end; ++i) {
  8443. this[i] = val
  8444. }
  8445. } else {
  8446. var bytes = Buffer.isBuffer(val)
  8447. ? val
  8448. : utf8ToBytes(new Buffer(val, encoding).toString())
  8449. var len = bytes.length
  8450. for (i = 0; i < end - start; ++i) {
  8451. this[i + start] = bytes[i % len]
  8452. }
  8453. }
  8454. return this
  8455. }
  8456. // HELPER FUNCTIONS
  8457. // ================
  8458. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  8459. function base64clean (str) {
  8460. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  8461. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  8462. // Node converts strings with length < 2 to ''
  8463. if (str.length < 2) return ''
  8464. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  8465. while (str.length % 4 !== 0) {
  8466. str = str + '='
  8467. }
  8468. return str
  8469. }
  8470. function stringtrim (str) {
  8471. if (str.trim) return str.trim()
  8472. return str.replace(/^\s+|\s+$/g, '')
  8473. }
  8474. function toHex (n) {
  8475. if (n < 16) return '0' + n.toString(16)
  8476. return n.toString(16)
  8477. }
  8478. function utf8ToBytes (string, units) {
  8479. units = units || Infinity
  8480. var codePoint
  8481. var length = string.length
  8482. var leadSurrogate = null
  8483. var bytes = []
  8484. for (var i = 0; i < length; ++i) {
  8485. codePoint = string.charCodeAt(i)
  8486. // is surrogate component
  8487. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  8488. // last char was a lead
  8489. if (!leadSurrogate) {
  8490. // no lead yet
  8491. if (codePoint > 0xDBFF) {
  8492. // unexpected trail
  8493. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8494. continue
  8495. } else if (i + 1 === length) {
  8496. // unpaired lead
  8497. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8498. continue
  8499. }
  8500. // valid lead
  8501. leadSurrogate = codePoint
  8502. continue
  8503. }
  8504. // 2 leads in a row
  8505. if (codePoint < 0xDC00) {
  8506. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8507. leadSurrogate = codePoint
  8508. continue
  8509. }
  8510. // valid surrogate pair
  8511. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  8512. } else if (leadSurrogate) {
  8513. // valid bmp char, but last char was a lead
  8514. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8515. }
  8516. leadSurrogate = null
  8517. // encode utf8
  8518. if (codePoint < 0x80) {
  8519. if ((units -= 1) < 0) break
  8520. bytes.push(codePoint)
  8521. } else if (codePoint < 0x800) {
  8522. if ((units -= 2) < 0) break
  8523. bytes.push(
  8524. codePoint >> 0x6 | 0xC0,
  8525. codePoint & 0x3F | 0x80
  8526. )
  8527. } else if (codePoint < 0x10000) {
  8528. if ((units -= 3) < 0) break
  8529. bytes.push(
  8530. codePoint >> 0xC | 0xE0,
  8531. codePoint >> 0x6 & 0x3F | 0x80,
  8532. codePoint & 0x3F | 0x80
  8533. )
  8534. } else if (codePoint < 0x110000) {
  8535. if ((units -= 4) < 0) break
  8536. bytes.push(
  8537. codePoint >> 0x12 | 0xF0,
  8538. codePoint >> 0xC & 0x3F | 0x80,
  8539. codePoint >> 0x6 & 0x3F | 0x80,
  8540. codePoint & 0x3F | 0x80
  8541. )
  8542. } else {
  8543. throw new Error('Invalid code point')
  8544. }
  8545. }
  8546. return bytes
  8547. }
  8548. function asciiToBytes (str) {
  8549. var byteArray = []
  8550. for (var i = 0; i < str.length; ++i) {
  8551. // Node's code seems to be doing this and not & 0x7F..
  8552. byteArray.push(str.charCodeAt(i) & 0xFF)
  8553. }
  8554. return byteArray
  8555. }
  8556. function utf16leToBytes (str, units) {
  8557. var c, hi, lo
  8558. var byteArray = []
  8559. for (var i = 0; i < str.length; ++i) {
  8560. if ((units -= 2) < 0) break
  8561. c = str.charCodeAt(i)
  8562. hi = c >> 8
  8563. lo = c % 256
  8564. byteArray.push(lo)
  8565. byteArray.push(hi)
  8566. }
  8567. return byteArray
  8568. }
  8569. function base64ToBytes (str) {
  8570. return base64.toByteArray(base64clean(str))
  8571. }
  8572. function blitBuffer (src, dst, offset, length) {
  8573. for (var i = 0; i < length; ++i) {
  8574. if ((i + offset >= dst.length) || (i >= src.length)) break
  8575. dst[i + offset] = src[i]
  8576. }
  8577. return i
  8578. }
  8579. function isnan (val) {
  8580. return val !== val // eslint-disable-line no-self-compare
  8581. }
  8582. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  8583. /***/ }),
  8584. /***/ "./node_modules/clipboard/dist/clipboard.js":
  8585. /*!**************************************************!*\
  8586. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  8587. \**************************************************/
  8588. /*! no static exports found */
  8589. /***/ (function(module, exports, __webpack_require__) {
  8590. /*!
  8591. * clipboard.js v2.0.4
  8592. * https://zenorocha.github.io/clipboard.js
  8593. *
  8594. * Licensed MIT © Zeno Rocha
  8595. */
  8596. (function webpackUniversalModuleDefinition(root, factory) {
  8597. if(true)
  8598. module.exports = factory();
  8599. else {}
  8600. })(this, function() {
  8601. return /******/ (function(modules) { // webpackBootstrap
  8602. /******/ // The module cache
  8603. /******/ var installedModules = {};
  8604. /******/
  8605. /******/ // The require function
  8606. /******/ function __webpack_require__(moduleId) {
  8607. /******/
  8608. /******/ // Check if module is in cache
  8609. /******/ if(installedModules[moduleId]) {
  8610. /******/ return installedModules[moduleId].exports;
  8611. /******/ }
  8612. /******/ // Create a new module (and put it into the cache)
  8613. /******/ var module = installedModules[moduleId] = {
  8614. /******/ i: moduleId,
  8615. /******/ l: false,
  8616. /******/ exports: {}
  8617. /******/ };
  8618. /******/
  8619. /******/ // Execute the module function
  8620. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  8621. /******/
  8622. /******/ // Flag the module as loaded
  8623. /******/ module.l = true;
  8624. /******/
  8625. /******/ // Return the exports of the module
  8626. /******/ return module.exports;
  8627. /******/ }
  8628. /******/
  8629. /******/
  8630. /******/ // expose the modules object (__webpack_modules__)
  8631. /******/ __webpack_require__.m = modules;
  8632. /******/
  8633. /******/ // expose the module cache
  8634. /******/ __webpack_require__.c = installedModules;
  8635. /******/
  8636. /******/ // define getter function for harmony exports
  8637. /******/ __webpack_require__.d = function(exports, name, getter) {
  8638. /******/ if(!__webpack_require__.o(exports, name)) {
  8639. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  8640. /******/ }
  8641. /******/ };
  8642. /******/
  8643. /******/ // define __esModule on exports
  8644. /******/ __webpack_require__.r = function(exports) {
  8645. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  8646. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  8647. /******/ }
  8648. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  8649. /******/ };
  8650. /******/
  8651. /******/ // create a fake namespace object
  8652. /******/ // mode & 1: value is a module id, require it
  8653. /******/ // mode & 2: merge all properties of value into the ns
  8654. /******/ // mode & 4: return value when already ns object
  8655. /******/ // mode & 8|1: behave like require
  8656. /******/ __webpack_require__.t = function(value, mode) {
  8657. /******/ if(mode & 1) value = __webpack_require__(value);
  8658. /******/ if(mode & 8) return value;
  8659. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  8660. /******/ var ns = Object.create(null);
  8661. /******/ __webpack_require__.r(ns);
  8662. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  8663. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  8664. /******/ return ns;
  8665. /******/ };
  8666. /******/
  8667. /******/ // getDefaultExport function for compatibility with non-harmony modules
  8668. /******/ __webpack_require__.n = function(module) {
  8669. /******/ var getter = module && module.__esModule ?
  8670. /******/ function getDefault() { return module['default']; } :
  8671. /******/ function getModuleExports() { return module; };
  8672. /******/ __webpack_require__.d(getter, 'a', getter);
  8673. /******/ return getter;
  8674. /******/ };
  8675. /******/
  8676. /******/ // Object.prototype.hasOwnProperty.call
  8677. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  8678. /******/
  8679. /******/ // __webpack_public_path__
  8680. /******/ __webpack_require__.p = "";
  8681. /******/
  8682. /******/
  8683. /******/ // Load entry module and return exports
  8684. /******/ return __webpack_require__(__webpack_require__.s = 0);
  8685. /******/ })
  8686. /************************************************************************/
  8687. /******/ ([
  8688. /* 0 */
  8689. /***/ (function(module, exports, __webpack_require__) {
  8690. "use strict";
  8691. 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; };
  8692. 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; }; }();
  8693. var _clipboardAction = __webpack_require__(1);
  8694. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  8695. var _tinyEmitter = __webpack_require__(3);
  8696. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  8697. var _goodListener = __webpack_require__(4);
  8698. var _goodListener2 = _interopRequireDefault(_goodListener);
  8699. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8700. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8701. 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; }
  8702. 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; }
  8703. /**
  8704. * Base class which takes one or more elements, adds event listeners to them,
  8705. * and instantiates a new `ClipboardAction` on each click.
  8706. */
  8707. var Clipboard = function (_Emitter) {
  8708. _inherits(Clipboard, _Emitter);
  8709. /**
  8710. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8711. * @param {Object} options
  8712. */
  8713. function Clipboard(trigger, options) {
  8714. _classCallCheck(this, Clipboard);
  8715. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  8716. _this.resolveOptions(options);
  8717. _this.listenClick(trigger);
  8718. return _this;
  8719. }
  8720. /**
  8721. * Defines if attributes would be resolved using internal setter functions
  8722. * or custom functions that were passed in the constructor.
  8723. * @param {Object} options
  8724. */
  8725. _createClass(Clipboard, [{
  8726. key: 'resolveOptions',
  8727. value: function resolveOptions() {
  8728. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8729. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  8730. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  8731. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  8732. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  8733. }
  8734. /**
  8735. * Adds a click event listener to the passed trigger.
  8736. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8737. */
  8738. }, {
  8739. key: 'listenClick',
  8740. value: function listenClick(trigger) {
  8741. var _this2 = this;
  8742. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  8743. return _this2.onClick(e);
  8744. });
  8745. }
  8746. /**
  8747. * Defines a new `ClipboardAction` on each click event.
  8748. * @param {Event} e
  8749. */
  8750. }, {
  8751. key: 'onClick',
  8752. value: function onClick(e) {
  8753. var trigger = e.delegateTarget || e.currentTarget;
  8754. if (this.clipboardAction) {
  8755. this.clipboardAction = null;
  8756. }
  8757. this.clipboardAction = new _clipboardAction2.default({
  8758. action: this.action(trigger),
  8759. target: this.target(trigger),
  8760. text: this.text(trigger),
  8761. container: this.container,
  8762. trigger: trigger,
  8763. emitter: this
  8764. });
  8765. }
  8766. /**
  8767. * Default `action` lookup function.
  8768. * @param {Element} trigger
  8769. */
  8770. }, {
  8771. key: 'defaultAction',
  8772. value: function defaultAction(trigger) {
  8773. return getAttributeValue('action', trigger);
  8774. }
  8775. /**
  8776. * Default `target` lookup function.
  8777. * @param {Element} trigger
  8778. */
  8779. }, {
  8780. key: 'defaultTarget',
  8781. value: function defaultTarget(trigger) {
  8782. var selector = getAttributeValue('target', trigger);
  8783. if (selector) {
  8784. return document.querySelector(selector);
  8785. }
  8786. }
  8787. /**
  8788. * Returns the support of the given action, or all actions if no action is
  8789. * given.
  8790. * @param {String} [action]
  8791. */
  8792. }, {
  8793. key: 'defaultText',
  8794. /**
  8795. * Default `text` lookup function.
  8796. * @param {Element} trigger
  8797. */
  8798. value: function defaultText(trigger) {
  8799. return getAttributeValue('text', trigger);
  8800. }
  8801. /**
  8802. * Destroy lifecycle.
  8803. */
  8804. }, {
  8805. key: 'destroy',
  8806. value: function destroy() {
  8807. this.listener.destroy();
  8808. if (this.clipboardAction) {
  8809. this.clipboardAction.destroy();
  8810. this.clipboardAction = null;
  8811. }
  8812. }
  8813. }], [{
  8814. key: 'isSupported',
  8815. value: function isSupported() {
  8816. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  8817. var actions = typeof action === 'string' ? [action] : action;
  8818. var support = !!document.queryCommandSupported;
  8819. actions.forEach(function (action) {
  8820. support = support && !!document.queryCommandSupported(action);
  8821. });
  8822. return support;
  8823. }
  8824. }]);
  8825. return Clipboard;
  8826. }(_tinyEmitter2.default);
  8827. /**
  8828. * Helper function to retrieve attribute value.
  8829. * @param {String} suffix
  8830. * @param {Element} element
  8831. */
  8832. function getAttributeValue(suffix, element) {
  8833. var attribute = 'data-clipboard-' + suffix;
  8834. if (!element.hasAttribute(attribute)) {
  8835. return;
  8836. }
  8837. return element.getAttribute(attribute);
  8838. }
  8839. module.exports = Clipboard;
  8840. /***/ }),
  8841. /* 1 */
  8842. /***/ (function(module, exports, __webpack_require__) {
  8843. "use strict";
  8844. 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; };
  8845. 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; }; }();
  8846. var _select = __webpack_require__(2);
  8847. var _select2 = _interopRequireDefault(_select);
  8848. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8849. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8850. /**
  8851. * Inner class which performs selection from either `text` or `target`
  8852. * properties and then executes copy or cut operations.
  8853. */
  8854. var ClipboardAction = function () {
  8855. /**
  8856. * @param {Object} options
  8857. */
  8858. function ClipboardAction(options) {
  8859. _classCallCheck(this, ClipboardAction);
  8860. this.resolveOptions(options);
  8861. this.initSelection();
  8862. }
  8863. /**
  8864. * Defines base properties passed from constructor.
  8865. * @param {Object} options
  8866. */
  8867. _createClass(ClipboardAction, [{
  8868. key: 'resolveOptions',
  8869. value: function resolveOptions() {
  8870. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8871. this.action = options.action;
  8872. this.container = options.container;
  8873. this.emitter = options.emitter;
  8874. this.target = options.target;
  8875. this.text = options.text;
  8876. this.trigger = options.trigger;
  8877. this.selectedText = '';
  8878. }
  8879. /**
  8880. * Decides which selection strategy is going to be applied based
  8881. * on the existence of `text` and `target` properties.
  8882. */
  8883. }, {
  8884. key: 'initSelection',
  8885. value: function initSelection() {
  8886. if (this.text) {
  8887. this.selectFake();
  8888. } else if (this.target) {
  8889. this.selectTarget();
  8890. }
  8891. }
  8892. /**
  8893. * Creates a fake textarea element, sets its value from `text` property,
  8894. * and makes a selection on it.
  8895. */
  8896. }, {
  8897. key: 'selectFake',
  8898. value: function selectFake() {
  8899. var _this = this;
  8900. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8901. this.removeFake();
  8902. this.fakeHandlerCallback = function () {
  8903. return _this.removeFake();
  8904. };
  8905. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8906. this.fakeElem = document.createElement('textarea');
  8907. // Prevent zooming on iOS
  8908. this.fakeElem.style.fontSize = '12pt';
  8909. // Reset box model
  8910. this.fakeElem.style.border = '0';
  8911. this.fakeElem.style.padding = '0';
  8912. this.fakeElem.style.margin = '0';
  8913. // Move element out of screen horizontally
  8914. this.fakeElem.style.position = 'absolute';
  8915. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8916. // Move element to the same position vertically
  8917. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8918. this.fakeElem.style.top = yPosition + 'px';
  8919. this.fakeElem.setAttribute('readonly', '');
  8920. this.fakeElem.value = this.text;
  8921. this.container.appendChild(this.fakeElem);
  8922. this.selectedText = (0, _select2.default)(this.fakeElem);
  8923. this.copyText();
  8924. }
  8925. /**
  8926. * Only removes the fake element after another click event, that way
  8927. * a user can hit `Ctrl+C` to copy because selection still exists.
  8928. */
  8929. }, {
  8930. key: 'removeFake',
  8931. value: function removeFake() {
  8932. if (this.fakeHandler) {
  8933. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8934. this.fakeHandler = null;
  8935. this.fakeHandlerCallback = null;
  8936. }
  8937. if (this.fakeElem) {
  8938. this.container.removeChild(this.fakeElem);
  8939. this.fakeElem = null;
  8940. }
  8941. }
  8942. /**
  8943. * Selects the content from element passed on `target` property.
  8944. */
  8945. }, {
  8946. key: 'selectTarget',
  8947. value: function selectTarget() {
  8948. this.selectedText = (0, _select2.default)(this.target);
  8949. this.copyText();
  8950. }
  8951. /**
  8952. * Executes the copy operation based on the current selection.
  8953. */
  8954. }, {
  8955. key: 'copyText',
  8956. value: function copyText() {
  8957. var succeeded = void 0;
  8958. try {
  8959. succeeded = document.execCommand(this.action);
  8960. } catch (err) {
  8961. succeeded = false;
  8962. }
  8963. this.handleResult(succeeded);
  8964. }
  8965. /**
  8966. * Fires an event based on the copy operation result.
  8967. * @param {Boolean} succeeded
  8968. */
  8969. }, {
  8970. key: 'handleResult',
  8971. value: function handleResult(succeeded) {
  8972. this.emitter.emit(succeeded ? 'success' : 'error', {
  8973. action: this.action,
  8974. text: this.selectedText,
  8975. trigger: this.trigger,
  8976. clearSelection: this.clearSelection.bind(this)
  8977. });
  8978. }
  8979. /**
  8980. * Moves focus away from `target` and back to the trigger, removes current selection.
  8981. */
  8982. }, {
  8983. key: 'clearSelection',
  8984. value: function clearSelection() {
  8985. if (this.trigger) {
  8986. this.trigger.focus();
  8987. }
  8988. window.getSelection().removeAllRanges();
  8989. }
  8990. /**
  8991. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8992. * @param {String} action
  8993. */
  8994. }, {
  8995. key: 'destroy',
  8996. /**
  8997. * Destroy lifecycle.
  8998. */
  8999. value: function destroy() {
  9000. this.removeFake();
  9001. }
  9002. }, {
  9003. key: 'action',
  9004. set: function set() {
  9005. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  9006. this._action = action;
  9007. if (this._action !== 'copy' && this._action !== 'cut') {
  9008. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  9009. }
  9010. }
  9011. /**
  9012. * Gets the `action` property.
  9013. * @return {String}
  9014. */
  9015. ,
  9016. get: function get() {
  9017. return this._action;
  9018. }
  9019. /**
  9020. * Sets the `target` property using an element
  9021. * that will be have its content copied.
  9022. * @param {Element} target
  9023. */
  9024. }, {
  9025. key: 'target',
  9026. set: function set(target) {
  9027. if (target !== undefined) {
  9028. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  9029. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  9030. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  9031. }
  9032. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  9033. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  9034. }
  9035. this._target = target;
  9036. } else {
  9037. throw new Error('Invalid "target" value, use a valid Element');
  9038. }
  9039. }
  9040. }
  9041. /**
  9042. * Gets the `target` property.
  9043. * @return {String|HTMLElement}
  9044. */
  9045. ,
  9046. get: function get() {
  9047. return this._target;
  9048. }
  9049. }]);
  9050. return ClipboardAction;
  9051. }();
  9052. module.exports = ClipboardAction;
  9053. /***/ }),
  9054. /* 2 */
  9055. /***/ (function(module, exports) {
  9056. function select(element) {
  9057. var selectedText;
  9058. if (element.nodeName === 'SELECT') {
  9059. element.focus();
  9060. selectedText = element.value;
  9061. }
  9062. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  9063. var isReadOnly = element.hasAttribute('readonly');
  9064. if (!isReadOnly) {
  9065. element.setAttribute('readonly', '');
  9066. }
  9067. element.select();
  9068. element.setSelectionRange(0, element.value.length);
  9069. if (!isReadOnly) {
  9070. element.removeAttribute('readonly');
  9071. }
  9072. selectedText = element.value;
  9073. }
  9074. else {
  9075. if (element.hasAttribute('contenteditable')) {
  9076. element.focus();
  9077. }
  9078. var selection = window.getSelection();
  9079. var range = document.createRange();
  9080. range.selectNodeContents(element);
  9081. selection.removeAllRanges();
  9082. selection.addRange(range);
  9083. selectedText = selection.toString();
  9084. }
  9085. return selectedText;
  9086. }
  9087. module.exports = select;
  9088. /***/ }),
  9089. /* 3 */
  9090. /***/ (function(module, exports) {
  9091. function E () {
  9092. // Keep this empty so it's easier to inherit from
  9093. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  9094. }
  9095. E.prototype = {
  9096. on: function (name, callback, ctx) {
  9097. var e = this.e || (this.e = {});
  9098. (e[name] || (e[name] = [])).push({
  9099. fn: callback,
  9100. ctx: ctx
  9101. });
  9102. return this;
  9103. },
  9104. once: function (name, callback, ctx) {
  9105. var self = this;
  9106. function listener () {
  9107. self.off(name, listener);
  9108. callback.apply(ctx, arguments);
  9109. };
  9110. listener._ = callback
  9111. return this.on(name, listener, ctx);
  9112. },
  9113. emit: function (name) {
  9114. var data = [].slice.call(arguments, 1);
  9115. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  9116. var i = 0;
  9117. var len = evtArr.length;
  9118. for (i; i < len; i++) {
  9119. evtArr[i].fn.apply(evtArr[i].ctx, data);
  9120. }
  9121. return this;
  9122. },
  9123. off: function (name, callback) {
  9124. var e = this.e || (this.e = {});
  9125. var evts = e[name];
  9126. var liveEvents = [];
  9127. if (evts && callback) {
  9128. for (var i = 0, len = evts.length; i < len; i++) {
  9129. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  9130. liveEvents.push(evts[i]);
  9131. }
  9132. }
  9133. // Remove event from queue to prevent memory leak
  9134. // Suggested by https://github.com/lazd
  9135. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  9136. (liveEvents.length)
  9137. ? e[name] = liveEvents
  9138. : delete e[name];
  9139. return this;
  9140. }
  9141. };
  9142. module.exports = E;
  9143. /***/ }),
  9144. /* 4 */
  9145. /***/ (function(module, exports, __webpack_require__) {
  9146. var is = __webpack_require__(5);
  9147. var delegate = __webpack_require__(6);
  9148. /**
  9149. * Validates all params and calls the right
  9150. * listener function based on its target type.
  9151. *
  9152. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  9153. * @param {String} type
  9154. * @param {Function} callback
  9155. * @return {Object}
  9156. */
  9157. function listen(target, type, callback) {
  9158. if (!target && !type && !callback) {
  9159. throw new Error('Missing required arguments');
  9160. }
  9161. if (!is.string(type)) {
  9162. throw new TypeError('Second argument must be a String');
  9163. }
  9164. if (!is.fn(callback)) {
  9165. throw new TypeError('Third argument must be a Function');
  9166. }
  9167. if (is.node(target)) {
  9168. return listenNode(target, type, callback);
  9169. }
  9170. else if (is.nodeList(target)) {
  9171. return listenNodeList(target, type, callback);
  9172. }
  9173. else if (is.string(target)) {
  9174. return listenSelector(target, type, callback);
  9175. }
  9176. else {
  9177. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  9178. }
  9179. }
  9180. /**
  9181. * Adds an event listener to a HTML element
  9182. * and returns a remove listener function.
  9183. *
  9184. * @param {HTMLElement} node
  9185. * @param {String} type
  9186. * @param {Function} callback
  9187. * @return {Object}
  9188. */
  9189. function listenNode(node, type, callback) {
  9190. node.addEventListener(type, callback);
  9191. return {
  9192. destroy: function() {
  9193. node.removeEventListener(type, callback);
  9194. }
  9195. }
  9196. }
  9197. /**
  9198. * Add an event listener to a list of HTML elements
  9199. * and returns a remove listener function.
  9200. *
  9201. * @param {NodeList|HTMLCollection} nodeList
  9202. * @param {String} type
  9203. * @param {Function} callback
  9204. * @return {Object}
  9205. */
  9206. function listenNodeList(nodeList, type, callback) {
  9207. Array.prototype.forEach.call(nodeList, function(node) {
  9208. node.addEventListener(type, callback);
  9209. });
  9210. return {
  9211. destroy: function() {
  9212. Array.prototype.forEach.call(nodeList, function(node) {
  9213. node.removeEventListener(type, callback);
  9214. });
  9215. }
  9216. }
  9217. }
  9218. /**
  9219. * Add an event listener to a selector
  9220. * and returns a remove listener function.
  9221. *
  9222. * @param {String} selector
  9223. * @param {String} type
  9224. * @param {Function} callback
  9225. * @return {Object}
  9226. */
  9227. function listenSelector(selector, type, callback) {
  9228. return delegate(document.body, selector, type, callback);
  9229. }
  9230. module.exports = listen;
  9231. /***/ }),
  9232. /* 5 */
  9233. /***/ (function(module, exports) {
  9234. /**
  9235. * Check if argument is a HTML element.
  9236. *
  9237. * @param {Object} value
  9238. * @return {Boolean}
  9239. */
  9240. exports.node = function(value) {
  9241. return value !== undefined
  9242. && value instanceof HTMLElement
  9243. && value.nodeType === 1;
  9244. };
  9245. /**
  9246. * Check if argument is a list of HTML elements.
  9247. *
  9248. * @param {Object} value
  9249. * @return {Boolean}
  9250. */
  9251. exports.nodeList = function(value) {
  9252. var type = Object.prototype.toString.call(value);
  9253. return value !== undefined
  9254. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  9255. && ('length' in value)
  9256. && (value.length === 0 || exports.node(value[0]));
  9257. };
  9258. /**
  9259. * Check if argument is a string.
  9260. *
  9261. * @param {Object} value
  9262. * @return {Boolean}
  9263. */
  9264. exports.string = function(value) {
  9265. return typeof value === 'string'
  9266. || value instanceof String;
  9267. };
  9268. /**
  9269. * Check if argument is a function.
  9270. *
  9271. * @param {Object} value
  9272. * @return {Boolean}
  9273. */
  9274. exports.fn = function(value) {
  9275. var type = Object.prototype.toString.call(value);
  9276. return type === '[object Function]';
  9277. };
  9278. /***/ }),
  9279. /* 6 */
  9280. /***/ (function(module, exports, __webpack_require__) {
  9281. var closest = __webpack_require__(7);
  9282. /**
  9283. * Delegates event to a selector.
  9284. *
  9285. * @param {Element} element
  9286. * @param {String} selector
  9287. * @param {String} type
  9288. * @param {Function} callback
  9289. * @param {Boolean} useCapture
  9290. * @return {Object}
  9291. */
  9292. function _delegate(element, selector, type, callback, useCapture) {
  9293. var listenerFn = listener.apply(this, arguments);
  9294. element.addEventListener(type, listenerFn, useCapture);
  9295. return {
  9296. destroy: function() {
  9297. element.removeEventListener(type, listenerFn, useCapture);
  9298. }
  9299. }
  9300. }
  9301. /**
  9302. * Delegates event to a selector.
  9303. *
  9304. * @param {Element|String|Array} [elements]
  9305. * @param {String} selector
  9306. * @param {String} type
  9307. * @param {Function} callback
  9308. * @param {Boolean} useCapture
  9309. * @return {Object}
  9310. */
  9311. function delegate(elements, selector, type, callback, useCapture) {
  9312. // Handle the regular Element usage
  9313. if (typeof elements.addEventListener === 'function') {
  9314. return _delegate.apply(null, arguments);
  9315. }
  9316. // Handle Element-less usage, it defaults to global delegation
  9317. if (typeof type === 'function') {
  9318. // Use `document` as the first parameter, then apply arguments
  9319. // This is a short way to .unshift `arguments` without running into deoptimizations
  9320. return _delegate.bind(null, document).apply(null, arguments);
  9321. }
  9322. // Handle Selector-based usage
  9323. if (typeof elements === 'string') {
  9324. elements = document.querySelectorAll(elements);
  9325. }
  9326. // Handle Array-like based usage
  9327. return Array.prototype.map.call(elements, function (element) {
  9328. return _delegate(element, selector, type, callback, useCapture);
  9329. });
  9330. }
  9331. /**
  9332. * Finds closest match and invokes callback.
  9333. *
  9334. * @param {Element} element
  9335. * @param {String} selector
  9336. * @param {String} type
  9337. * @param {Function} callback
  9338. * @return {Function}
  9339. */
  9340. function listener(element, selector, type, callback) {
  9341. return function(e) {
  9342. e.delegateTarget = closest(e.target, selector);
  9343. if (e.delegateTarget) {
  9344. callback.call(element, e);
  9345. }
  9346. }
  9347. }
  9348. module.exports = delegate;
  9349. /***/ }),
  9350. /* 7 */
  9351. /***/ (function(module, exports) {
  9352. var DOCUMENT_NODE_TYPE = 9;
  9353. /**
  9354. * A polyfill for Element.matches()
  9355. */
  9356. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  9357. var proto = Element.prototype;
  9358. proto.matches = proto.matchesSelector ||
  9359. proto.mozMatchesSelector ||
  9360. proto.msMatchesSelector ||
  9361. proto.oMatchesSelector ||
  9362. proto.webkitMatchesSelector;
  9363. }
  9364. /**
  9365. * Finds the closest parent that matches a selector.
  9366. *
  9367. * @param {Element} element
  9368. * @param {String} selector
  9369. * @return {Function}
  9370. */
  9371. function closest (element, selector) {
  9372. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  9373. if (typeof element.matches === 'function' &&
  9374. element.matches(selector)) {
  9375. return element;
  9376. }
  9377. element = element.parentNode;
  9378. }
  9379. }
  9380. module.exports = closest;
  9381. /***/ })
  9382. /******/ ]);
  9383. });
  9384. /***/ }),
  9385. /***/ "./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&":
  9386. /*!*******************************************************************************************************************************************************************************************************************************************************************************************************!*\
  9387. !*** ./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& ***!
  9388. \*******************************************************************************************************************************************************************************************************************************************************************************************************/
  9389. /*! no static exports found */
  9390. /***/ (function(module, exports, __webpack_require__) {
  9391. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  9392. // imports
  9393. // module
  9394. 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", ""]);
  9395. // exports
  9396. /***/ }),
  9397. /***/ "./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&":
  9398. /*!********************************************************************************************************************************************************************************************************************************************************************************************!*\
  9399. !*** ./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& ***!
  9400. \********************************************************************************************************************************************************************************************************************************************************************************************/
  9401. /*! no static exports found */
  9402. /***/ (function(module, exports, __webpack_require__) {
  9403. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  9404. // imports
  9405. // module
  9406. 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", ""]);
  9407. // exports
  9408. /***/ }),
  9409. /***/ "./node_modules/css-loader/lib/css-base.js":
  9410. /*!*************************************************!*\
  9411. !*** ./node_modules/css-loader/lib/css-base.js ***!
  9412. \*************************************************/
  9413. /*! no static exports found */
  9414. /***/ (function(module, exports) {
  9415. /*
  9416. MIT License http://www.opensource.org/licenses/mit-license.php
  9417. Author Tobias Koppers @sokra
  9418. */
  9419. // css base code, injected by the css-loader
  9420. module.exports = function(useSourceMap) {
  9421. var list = [];
  9422. // return the list of modules as css string
  9423. list.toString = function toString() {
  9424. return this.map(function (item) {
  9425. var content = cssWithMappingToString(item, useSourceMap);
  9426. if(item[2]) {
  9427. return "@media " + item[2] + "{" + content + "}";
  9428. } else {
  9429. return content;
  9430. }
  9431. }).join("");
  9432. };
  9433. // import a list of modules into the list
  9434. list.i = function(modules, mediaQuery) {
  9435. if(typeof modules === "string")
  9436. modules = [[null, modules, ""]];
  9437. var alreadyImportedModules = {};
  9438. for(var i = 0; i < this.length; i++) {
  9439. var id = this[i][0];
  9440. if(typeof id === "number")
  9441. alreadyImportedModules[id] = true;
  9442. }
  9443. for(i = 0; i < modules.length; i++) {
  9444. var item = modules[i];
  9445. // skip already imported module
  9446. // this implementation is not 100% perfect for weird media query combinations
  9447. // when a module is imported multiple times with different media queries.
  9448. // I hope this will never occur (Hey this way we have smaller bundles)
  9449. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  9450. if(mediaQuery && !item[2]) {
  9451. item[2] = mediaQuery;
  9452. } else if(mediaQuery) {
  9453. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  9454. }
  9455. list.push(item);
  9456. }
  9457. }
  9458. };
  9459. return list;
  9460. };
  9461. function cssWithMappingToString(item, useSourceMap) {
  9462. var content = item[1] || '';
  9463. var cssMapping = item[3];
  9464. if (!cssMapping) {
  9465. return content;
  9466. }
  9467. if (useSourceMap && typeof btoa === 'function') {
  9468. var sourceMapping = toComment(cssMapping);
  9469. var sourceURLs = cssMapping.sources.map(function (source) {
  9470. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
  9471. });
  9472. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  9473. }
  9474. return [content].join('\n');
  9475. }
  9476. // Adapted from convert-source-map (MIT)
  9477. function toComment(sourceMap) {
  9478. // eslint-disable-next-line no-undef
  9479. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  9480. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  9481. return '/*# ' + data + ' */';
  9482. }
  9483. /***/ }),
  9484. /***/ "./node_modules/ieee754/index.js":
  9485. /*!***************************************!*\
  9486. !*** ./node_modules/ieee754/index.js ***!
  9487. \***************************************/
  9488. /*! no static exports found */
  9489. /***/ (function(module, exports) {
  9490. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  9491. var e, m
  9492. var eLen = (nBytes * 8) - mLen - 1
  9493. var eMax = (1 << eLen) - 1
  9494. var eBias = eMax >> 1
  9495. var nBits = -7
  9496. var i = isLE ? (nBytes - 1) : 0
  9497. var d = isLE ? -1 : 1
  9498. var s = buffer[offset + i]
  9499. i += d
  9500. e = s & ((1 << (-nBits)) - 1)
  9501. s >>= (-nBits)
  9502. nBits += eLen
  9503. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9504. m = e & ((1 << (-nBits)) - 1)
  9505. e >>= (-nBits)
  9506. nBits += mLen
  9507. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9508. if (e === 0) {
  9509. e = 1 - eBias
  9510. } else if (e === eMax) {
  9511. return m ? NaN : ((s ? -1 : 1) * Infinity)
  9512. } else {
  9513. m = m + Math.pow(2, mLen)
  9514. e = e - eBias
  9515. }
  9516. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  9517. }
  9518. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  9519. var e, m, c
  9520. var eLen = (nBytes * 8) - mLen - 1
  9521. var eMax = (1 << eLen) - 1
  9522. var eBias = eMax >> 1
  9523. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  9524. var i = isLE ? 0 : (nBytes - 1)
  9525. var d = isLE ? 1 : -1
  9526. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  9527. value = Math.abs(value)
  9528. if (isNaN(value) || value === Infinity) {
  9529. m = isNaN(value) ? 1 : 0
  9530. e = eMax
  9531. } else {
  9532. e = Math.floor(Math.log(value) / Math.LN2)
  9533. if (value * (c = Math.pow(2, -e)) < 1) {
  9534. e--
  9535. c *= 2
  9536. }
  9537. if (e + eBias >= 1) {
  9538. value += rt / c
  9539. } else {
  9540. value += rt * Math.pow(2, 1 - eBias)
  9541. }
  9542. if (value * c >= 2) {
  9543. e++
  9544. c /= 2
  9545. }
  9546. if (e + eBias >= eMax) {
  9547. m = 0
  9548. e = eMax
  9549. } else if (e + eBias >= 1) {
  9550. m = ((value * c) - 1) * Math.pow(2, mLen)
  9551. e = e + eBias
  9552. } else {
  9553. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  9554. e = 0
  9555. }
  9556. }
  9557. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  9558. e = (e << mLen) | m
  9559. eLen += mLen
  9560. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  9561. buffer[offset + i - d] |= s * 128
  9562. }
  9563. /***/ }),
  9564. /***/ "./node_modules/isarray/index.js":
  9565. /*!***************************************!*\
  9566. !*** ./node_modules/isarray/index.js ***!
  9567. \***************************************/
  9568. /*! no static exports found */
  9569. /***/ (function(module, exports) {
  9570. var toString = {}.toString;
  9571. module.exports = Array.isArray || function (arr) {
  9572. return toString.call(arr) == '[object Array]';
  9573. };
  9574. /***/ }),
  9575. /***/ "./node_modules/jquery/dist/jquery.js":
  9576. /*!********************************************!*\
  9577. !*** ./node_modules/jquery/dist/jquery.js ***!
  9578. \********************************************/
  9579. /*! no static exports found */
  9580. /***/ (function(module, exports, __webpack_require__) {
  9581. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  9582. * jQuery JavaScript Library v3.4.1
  9583. * https://jquery.com/
  9584. *
  9585. * Includes Sizzle.js
  9586. * https://sizzlejs.com/
  9587. *
  9588. * Copyright JS Foundation and other contributors
  9589. * Released under the MIT license
  9590. * https://jquery.org/license
  9591. *
  9592. * Date: 2019-05-01T21:04Z
  9593. */
  9594. ( function( global, factory ) {
  9595. "use strict";
  9596. if ( true && typeof module.exports === "object" ) {
  9597. // For CommonJS and CommonJS-like environments where a proper `window`
  9598. // is present, execute the factory and get jQuery.
  9599. // For environments that do not have a `window` with a `document`
  9600. // (such as Node.js), expose a factory as module.exports.
  9601. // This accentuates the need for the creation of a real `window`.
  9602. // e.g. var jQuery = require("jquery")(window);
  9603. // See ticket #14549 for more info.
  9604. module.exports = global.document ?
  9605. factory( global, true ) :
  9606. function( w ) {
  9607. if ( !w.document ) {
  9608. throw new Error( "jQuery requires a window with a document" );
  9609. }
  9610. return factory( w );
  9611. };
  9612. } else {
  9613. factory( global );
  9614. }
  9615. // Pass this if window is not defined yet
  9616. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  9617. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  9618. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  9619. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  9620. // enough that all such attempts are guarded in a try block.
  9621. "use strict";
  9622. var arr = [];
  9623. var document = window.document;
  9624. var getProto = Object.getPrototypeOf;
  9625. var slice = arr.slice;
  9626. var concat = arr.concat;
  9627. var push = arr.push;
  9628. var indexOf = arr.indexOf;
  9629. var class2type = {};
  9630. var toString = class2type.toString;
  9631. var hasOwn = class2type.hasOwnProperty;
  9632. var fnToString = hasOwn.toString;
  9633. var ObjectFunctionString = fnToString.call( Object );
  9634. var support = {};
  9635. var isFunction = function isFunction( obj ) {
  9636. // Support: Chrome <=57, Firefox <=52
  9637. // In some browsers, typeof returns "function" for HTML <object> elements
  9638. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  9639. // We don't want to classify *any* DOM node as a function.
  9640. return typeof obj === "function" && typeof obj.nodeType !== "number";
  9641. };
  9642. var isWindow = function isWindow( obj ) {
  9643. return obj != null && obj === obj.window;
  9644. };
  9645. var preservedScriptAttributes = {
  9646. type: true,
  9647. src: true,
  9648. nonce: true,
  9649. noModule: true
  9650. };
  9651. function DOMEval( code, node, doc ) {
  9652. doc = doc || document;
  9653. var i, val,
  9654. script = doc.createElement( "script" );
  9655. script.text = code;
  9656. if ( node ) {
  9657. for ( i in preservedScriptAttributes ) {
  9658. // Support: Firefox 64+, Edge 18+
  9659. // Some browsers don't support the "nonce" property on scripts.
  9660. // On the other hand, just using `getAttribute` is not enough as
  9661. // the `nonce` attribute is reset to an empty string whenever it
  9662. // becomes browsing-context connected.
  9663. // See https://github.com/whatwg/html/issues/2369
  9664. // See https://html.spec.whatwg.org/#nonce-attributes
  9665. // The `node.getAttribute` check was added for the sake of
  9666. // `jQuery.globalEval` so that it can fake a nonce-containing node
  9667. // via an object.
  9668. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  9669. if ( val ) {
  9670. script.setAttribute( i, val );
  9671. }
  9672. }
  9673. }
  9674. doc.head.appendChild( script ).parentNode.removeChild( script );
  9675. }
  9676. function toType( obj ) {
  9677. if ( obj == null ) {
  9678. return obj + "";
  9679. }
  9680. // Support: Android <=2.3 only (functionish RegExp)
  9681. return typeof obj === "object" || typeof obj === "function" ?
  9682. class2type[ toString.call( obj ) ] || "object" :
  9683. typeof obj;
  9684. }
  9685. /* global Symbol */
  9686. // Defining this global in .eslintrc.json would create a danger of using the global
  9687. // unguarded in another place, it seems safer to define global only for this module
  9688. var
  9689. version = "3.4.1",
  9690. // Define a local copy of jQuery
  9691. jQuery = function( selector, context ) {
  9692. // The jQuery object is actually just the init constructor 'enhanced'
  9693. // Need init if jQuery is called (just allow error to be thrown if not included)
  9694. return new jQuery.fn.init( selector, context );
  9695. },
  9696. // Support: Android <=4.0 only
  9697. // Make sure we trim BOM and NBSP
  9698. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  9699. jQuery.fn = jQuery.prototype = {
  9700. // The current version of jQuery being used
  9701. jquery: version,
  9702. constructor: jQuery,
  9703. // The default length of a jQuery object is 0
  9704. length: 0,
  9705. toArray: function() {
  9706. return slice.call( this );
  9707. },
  9708. // Get the Nth element in the matched element set OR
  9709. // Get the whole matched element set as a clean array
  9710. get: function( num ) {
  9711. // Return all the elements in a clean array
  9712. if ( num == null ) {
  9713. return slice.call( this );
  9714. }
  9715. // Return just the one element from the set
  9716. return num < 0 ? this[ num + this.length ] : this[ num ];
  9717. },
  9718. // Take an array of elements and push it onto the stack
  9719. // (returning the new matched element set)
  9720. pushStack: function( elems ) {
  9721. // Build a new jQuery matched element set
  9722. var ret = jQuery.merge( this.constructor(), elems );
  9723. // Add the old object onto the stack (as a reference)
  9724. ret.prevObject = this;
  9725. // Return the newly-formed element set
  9726. return ret;
  9727. },
  9728. // Execute a callback for every element in the matched set.
  9729. each: function( callback ) {
  9730. return jQuery.each( this, callback );
  9731. },
  9732. map: function( callback ) {
  9733. return this.pushStack( jQuery.map( this, function( elem, i ) {
  9734. return callback.call( elem, i, elem );
  9735. } ) );
  9736. },
  9737. slice: function() {
  9738. return this.pushStack( slice.apply( this, arguments ) );
  9739. },
  9740. first: function() {
  9741. return this.eq( 0 );
  9742. },
  9743. last: function() {
  9744. return this.eq( -1 );
  9745. },
  9746. eq: function( i ) {
  9747. var len = this.length,
  9748. j = +i + ( i < 0 ? len : 0 );
  9749. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  9750. },
  9751. end: function() {
  9752. return this.prevObject || this.constructor();
  9753. },
  9754. // For internal use only.
  9755. // Behaves like an Array's method, not like a jQuery method.
  9756. push: push,
  9757. sort: arr.sort,
  9758. splice: arr.splice
  9759. };
  9760. jQuery.extend = jQuery.fn.extend = function() {
  9761. var options, name, src, copy, copyIsArray, clone,
  9762. target = arguments[ 0 ] || {},
  9763. i = 1,
  9764. length = arguments.length,
  9765. deep = false;
  9766. // Handle a deep copy situation
  9767. if ( typeof target === "boolean" ) {
  9768. deep = target;
  9769. // Skip the boolean and the target
  9770. target = arguments[ i ] || {};
  9771. i++;
  9772. }
  9773. // Handle case when target is a string or something (possible in deep copy)
  9774. if ( typeof target !== "object" && !isFunction( target ) ) {
  9775. target = {};
  9776. }
  9777. // Extend jQuery itself if only one argument is passed
  9778. if ( i === length ) {
  9779. target = this;
  9780. i--;
  9781. }
  9782. for ( ; i < length; i++ ) {
  9783. // Only deal with non-null/undefined values
  9784. if ( ( options = arguments[ i ] ) != null ) {
  9785. // Extend the base object
  9786. for ( name in options ) {
  9787. copy = options[ name ];
  9788. // Prevent Object.prototype pollution
  9789. // Prevent never-ending loop
  9790. if ( name === "__proto__" || target === copy ) {
  9791. continue;
  9792. }
  9793. // Recurse if we're merging plain objects or arrays
  9794. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  9795. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  9796. src = target[ name ];
  9797. // Ensure proper type for the source value
  9798. if ( copyIsArray && !Array.isArray( src ) ) {
  9799. clone = [];
  9800. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  9801. clone = {};
  9802. } else {
  9803. clone = src;
  9804. }
  9805. copyIsArray = false;
  9806. // Never move original objects, clone them
  9807. target[ name ] = jQuery.extend( deep, clone, copy );
  9808. // Don't bring in undefined values
  9809. } else if ( copy !== undefined ) {
  9810. target[ name ] = copy;
  9811. }
  9812. }
  9813. }
  9814. }
  9815. // Return the modified object
  9816. return target;
  9817. };
  9818. jQuery.extend( {
  9819. // Unique for each copy of jQuery on the page
  9820. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  9821. // Assume jQuery is ready without the ready module
  9822. isReady: true,
  9823. error: function( msg ) {
  9824. throw new Error( msg );
  9825. },
  9826. noop: function() {},
  9827. isPlainObject: function( obj ) {
  9828. var proto, Ctor;
  9829. // Detect obvious negatives
  9830. // Use toString instead of jQuery.type to catch host objects
  9831. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  9832. return false;
  9833. }
  9834. proto = getProto( obj );
  9835. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  9836. if ( !proto ) {
  9837. return true;
  9838. }
  9839. // Objects with prototype are plain iff they were constructed by a global Object function
  9840. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  9841. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  9842. },
  9843. isEmptyObject: function( obj ) {
  9844. var name;
  9845. for ( name in obj ) {
  9846. return false;
  9847. }
  9848. return true;
  9849. },
  9850. // Evaluates a script in a global context
  9851. globalEval: function( code, options ) {
  9852. DOMEval( code, { nonce: options && options.nonce } );
  9853. },
  9854. each: function( obj, callback ) {
  9855. var length, i = 0;
  9856. if ( isArrayLike( obj ) ) {
  9857. length = obj.length;
  9858. for ( ; i < length; i++ ) {
  9859. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9860. break;
  9861. }
  9862. }
  9863. } else {
  9864. for ( i in obj ) {
  9865. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9866. break;
  9867. }
  9868. }
  9869. }
  9870. return obj;
  9871. },
  9872. // Support: Android <=4.0 only
  9873. trim: function( text ) {
  9874. return text == null ?
  9875. "" :
  9876. ( text + "" ).replace( rtrim, "" );
  9877. },
  9878. // results is for internal usage only
  9879. makeArray: function( arr, results ) {
  9880. var ret = results || [];
  9881. if ( arr != null ) {
  9882. if ( isArrayLike( Object( arr ) ) ) {
  9883. jQuery.merge( ret,
  9884. typeof arr === "string" ?
  9885. [ arr ] : arr
  9886. );
  9887. } else {
  9888. push.call( ret, arr );
  9889. }
  9890. }
  9891. return ret;
  9892. },
  9893. inArray: function( elem, arr, i ) {
  9894. return arr == null ? -1 : indexOf.call( arr, elem, i );
  9895. },
  9896. // Support: Android <=4.0 only, PhantomJS 1 only
  9897. // push.apply(_, arraylike) throws on ancient WebKit
  9898. merge: function( first, second ) {
  9899. var len = +second.length,
  9900. j = 0,
  9901. i = first.length;
  9902. for ( ; j < len; j++ ) {
  9903. first[ i++ ] = second[ j ];
  9904. }
  9905. first.length = i;
  9906. return first;
  9907. },
  9908. grep: function( elems, callback, invert ) {
  9909. var callbackInverse,
  9910. matches = [],
  9911. i = 0,
  9912. length = elems.length,
  9913. callbackExpect = !invert;
  9914. // Go through the array, only saving the items
  9915. // that pass the validator function
  9916. for ( ; i < length; i++ ) {
  9917. callbackInverse = !callback( elems[ i ], i );
  9918. if ( callbackInverse !== callbackExpect ) {
  9919. matches.push( elems[ i ] );
  9920. }
  9921. }
  9922. return matches;
  9923. },
  9924. // arg is for internal usage only
  9925. map: function( elems, callback, arg ) {
  9926. var length, value,
  9927. i = 0,
  9928. ret = [];
  9929. // Go through the array, translating each of the items to their new values
  9930. if ( isArrayLike( elems ) ) {
  9931. length = elems.length;
  9932. for ( ; i < length; i++ ) {
  9933. value = callback( elems[ i ], i, arg );
  9934. if ( value != null ) {
  9935. ret.push( value );
  9936. }
  9937. }
  9938. // Go through every key on the object,
  9939. } else {
  9940. for ( i in elems ) {
  9941. value = callback( elems[ i ], i, arg );
  9942. if ( value != null ) {
  9943. ret.push( value );
  9944. }
  9945. }
  9946. }
  9947. // Flatten any nested arrays
  9948. return concat.apply( [], ret );
  9949. },
  9950. // A global GUID counter for objects
  9951. guid: 1,
  9952. // jQuery.support is not used in Core but other projects attach their
  9953. // properties to it so it needs to exist.
  9954. support: support
  9955. } );
  9956. if ( typeof Symbol === "function" ) {
  9957. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9958. }
  9959. // Populate the class2type map
  9960. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9961. function( i, name ) {
  9962. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9963. } );
  9964. function isArrayLike( obj ) {
  9965. // Support: real iOS 8.2 only (not reproducible in simulator)
  9966. // `in` check used to prevent JIT error (gh-2145)
  9967. // hasOwn isn't used here due to false negatives
  9968. // regarding Nodelist length in IE
  9969. var length = !!obj && "length" in obj && obj.length,
  9970. type = toType( obj );
  9971. if ( isFunction( obj ) || isWindow( obj ) ) {
  9972. return false;
  9973. }
  9974. return type === "array" || length === 0 ||
  9975. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9976. }
  9977. var Sizzle =
  9978. /*!
  9979. * Sizzle CSS Selector Engine v2.3.4
  9980. * https://sizzlejs.com/
  9981. *
  9982. * Copyright JS Foundation and other contributors
  9983. * Released under the MIT license
  9984. * https://js.foundation/
  9985. *
  9986. * Date: 2019-04-08
  9987. */
  9988. (function( window ) {
  9989. var i,
  9990. support,
  9991. Expr,
  9992. getText,
  9993. isXML,
  9994. tokenize,
  9995. compile,
  9996. select,
  9997. outermostContext,
  9998. sortInput,
  9999. hasDuplicate,
  10000. // Local document vars
  10001. setDocument,
  10002. document,
  10003. docElem,
  10004. documentIsHTML,
  10005. rbuggyQSA,
  10006. rbuggyMatches,
  10007. matches,
  10008. contains,
  10009. // Instance-specific data
  10010. expando = "sizzle" + 1 * new Date(),
  10011. preferredDoc = window.document,
  10012. dirruns = 0,
  10013. done = 0,
  10014. classCache = createCache(),
  10015. tokenCache = createCache(),
  10016. compilerCache = createCache(),
  10017. nonnativeSelectorCache = createCache(),
  10018. sortOrder = function( a, b ) {
  10019. if ( a === b ) {
  10020. hasDuplicate = true;
  10021. }
  10022. return 0;
  10023. },
  10024. // Instance methods
  10025. hasOwn = ({}).hasOwnProperty,
  10026. arr = [],
  10027. pop = arr.pop,
  10028. push_native = arr.push,
  10029. push = arr.push,
  10030. slice = arr.slice,
  10031. // Use a stripped-down indexOf as it's faster than native
  10032. // https://jsperf.com/thor-indexof-vs-for/5
  10033. indexOf = function( list, elem ) {
  10034. var i = 0,
  10035. len = list.length;
  10036. for ( ; i < len; i++ ) {
  10037. if ( list[i] === elem ) {
  10038. return i;
  10039. }
  10040. }
  10041. return -1;
  10042. },
  10043. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  10044. // Regular expressions
  10045. // http://www.w3.org/TR/css3-selectors/#whitespace
  10046. whitespace = "[\\x20\\t\\r\\n\\f]",
  10047. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  10048. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  10049. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  10050. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  10051. // Operator (capture 2)
  10052. "*([*^$|!~]?=)" + whitespace +
  10053. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  10054. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  10055. "*\\]",
  10056. pseudos = ":(" + identifier + ")(?:\\((" +
  10057. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  10058. // 1. quoted (capture 3; capture 4 or capture 5)
  10059. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  10060. // 2. simple (capture 6)
  10061. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  10062. // 3. anything else (capture 2)
  10063. ".*" +
  10064. ")\\)|)",
  10065. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  10066. rwhitespace = new RegExp( whitespace + "+", "g" ),
  10067. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  10068. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  10069. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  10070. rdescend = new RegExp( whitespace + "|>" ),
  10071. rpseudo = new RegExp( pseudos ),
  10072. ridentifier = new RegExp( "^" + identifier + "$" ),
  10073. matchExpr = {
  10074. "ID": new RegExp( "^#(" + identifier + ")" ),
  10075. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  10076. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  10077. "ATTR": new RegExp( "^" + attributes ),
  10078. "PSEUDO": new RegExp( "^" + pseudos ),
  10079. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  10080. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  10081. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  10082. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  10083. // For use in libraries implementing .is()
  10084. // We use this for POS matching in `select`
  10085. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  10086. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  10087. },
  10088. rhtml = /HTML$/i,
  10089. rinputs = /^(?:input|select|textarea|button)$/i,
  10090. rheader = /^h\d$/i,
  10091. rnative = /^[^{]+\{\s*\[native \w/,
  10092. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  10093. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  10094. rsibling = /[+~]/,
  10095. // CSS escapes
  10096. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  10097. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  10098. funescape = function( _, escaped, escapedWhitespace ) {
  10099. var high = "0x" + escaped - 0x10000;
  10100. // NaN means non-codepoint
  10101. // Support: Firefox<24
  10102. // Workaround erroneous numeric interpretation of +"0x"
  10103. return high !== high || escapedWhitespace ?
  10104. escaped :
  10105. high < 0 ?
  10106. // BMP codepoint
  10107. String.fromCharCode( high + 0x10000 ) :
  10108. // Supplemental Plane codepoint (surrogate pair)
  10109. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  10110. },
  10111. // CSS string/identifier serialization
  10112. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  10113. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  10114. fcssescape = function( ch, asCodePoint ) {
  10115. if ( asCodePoint ) {
  10116. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  10117. if ( ch === "\0" ) {
  10118. return "\uFFFD";
  10119. }
  10120. // Control characters and (dependent upon position) numbers get escaped as code points
  10121. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  10122. }
  10123. // Other potentially-special ASCII characters get backslash-escaped
  10124. return "\\" + ch;
  10125. },
  10126. // Used for iframes
  10127. // See setDocument()
  10128. // Removing the function wrapper causes a "Permission Denied"
  10129. // error in IE
  10130. unloadHandler = function() {
  10131. setDocument();
  10132. },
  10133. inDisabledFieldset = addCombinator(
  10134. function( elem ) {
  10135. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  10136. },
  10137. { dir: "parentNode", next: "legend" }
  10138. );
  10139. // Optimize for push.apply( _, NodeList )
  10140. try {
  10141. push.apply(
  10142. (arr = slice.call( preferredDoc.childNodes )),
  10143. preferredDoc.childNodes
  10144. );
  10145. // Support: Android<4.0
  10146. // Detect silently failing push.apply
  10147. arr[ preferredDoc.childNodes.length ].nodeType;
  10148. } catch ( e ) {
  10149. push = { apply: arr.length ?
  10150. // Leverage slice if possible
  10151. function( target, els ) {
  10152. push_native.apply( target, slice.call(els) );
  10153. } :
  10154. // Support: IE<9
  10155. // Otherwise append directly
  10156. function( target, els ) {
  10157. var j = target.length,
  10158. i = 0;
  10159. // Can't trust NodeList.length
  10160. while ( (target[j++] = els[i++]) ) {}
  10161. target.length = j - 1;
  10162. }
  10163. };
  10164. }
  10165. function Sizzle( selector, context, results, seed ) {
  10166. var m, i, elem, nid, match, groups, newSelector,
  10167. newContext = context && context.ownerDocument,
  10168. // nodeType defaults to 9, since context defaults to document
  10169. nodeType = context ? context.nodeType : 9;
  10170. results = results || [];
  10171. // Return early from calls with invalid selector or context
  10172. if ( typeof selector !== "string" || !selector ||
  10173. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  10174. return results;
  10175. }
  10176. // Try to shortcut find operations (as opposed to filters) in HTML documents
  10177. if ( !seed ) {
  10178. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  10179. setDocument( context );
  10180. }
  10181. context = context || document;
  10182. if ( documentIsHTML ) {
  10183. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  10184. // (excepting DocumentFragment context, where the methods don't exist)
  10185. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  10186. // ID selector
  10187. if ( (m = match[1]) ) {
  10188. // Document context
  10189. if ( nodeType === 9 ) {
  10190. if ( (elem = context.getElementById( m )) ) {
  10191. // Support: IE, Opera, Webkit
  10192. // TODO: identify versions
  10193. // getElementById can match elements by name instead of ID
  10194. if ( elem.id === m ) {
  10195. results.push( elem );
  10196. return results;
  10197. }
  10198. } else {
  10199. return results;
  10200. }
  10201. // Element context
  10202. } else {
  10203. // Support: IE, Opera, Webkit
  10204. // TODO: identify versions
  10205. // getElementById can match elements by name instead of ID
  10206. if ( newContext && (elem = newContext.getElementById( m )) &&
  10207. contains( context, elem ) &&
  10208. elem.id === m ) {
  10209. results.push( elem );
  10210. return results;
  10211. }
  10212. }
  10213. // Type selector
  10214. } else if ( match[2] ) {
  10215. push.apply( results, context.getElementsByTagName( selector ) );
  10216. return results;
  10217. // Class selector
  10218. } else if ( (m = match[3]) && support.getElementsByClassName &&
  10219. context.getElementsByClassName ) {
  10220. push.apply( results, context.getElementsByClassName( m ) );
  10221. return results;
  10222. }
  10223. }
  10224. // Take advantage of querySelectorAll
  10225. if ( support.qsa &&
  10226. !nonnativeSelectorCache[ selector + " " ] &&
  10227. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  10228. // Support: IE 8 only
  10229. // Exclude object elements
  10230. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  10231. newSelector = selector;
  10232. newContext = context;
  10233. // qSA considers elements outside a scoping root when evaluating child or
  10234. // descendant combinators, which is not what we want.
  10235. // In such cases, we work around the behavior by prefixing every selector in the
  10236. // list with an ID selector referencing the scope context.
  10237. // Thanks to Andrew Dupont for this technique.
  10238. if ( nodeType === 1 && rdescend.test( selector ) ) {
  10239. // Capture the context ID, setting it first if necessary
  10240. if ( (nid = context.getAttribute( "id" )) ) {
  10241. nid = nid.replace( rcssescape, fcssescape );
  10242. } else {
  10243. context.setAttribute( "id", (nid = expando) );
  10244. }
  10245. // Prefix every selector in the list
  10246. groups = tokenize( selector );
  10247. i = groups.length;
  10248. while ( i-- ) {
  10249. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  10250. }
  10251. newSelector = groups.join( "," );
  10252. // Expand context for sibling selectors
  10253. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  10254. context;
  10255. }
  10256. try {
  10257. push.apply( results,
  10258. newContext.querySelectorAll( newSelector )
  10259. );
  10260. return results;
  10261. } catch ( qsaError ) {
  10262. nonnativeSelectorCache( selector, true );
  10263. } finally {
  10264. if ( nid === expando ) {
  10265. context.removeAttribute( "id" );
  10266. }
  10267. }
  10268. }
  10269. }
  10270. }
  10271. // All others
  10272. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  10273. }
  10274. /**
  10275. * Create key-value caches of limited size
  10276. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  10277. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  10278. * deleting the oldest entry
  10279. */
  10280. function createCache() {
  10281. var keys = [];
  10282. function cache( key, value ) {
  10283. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  10284. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  10285. // Only keep the most recent entries
  10286. delete cache[ keys.shift() ];
  10287. }
  10288. return (cache[ key + " " ] = value);
  10289. }
  10290. return cache;
  10291. }
  10292. /**
  10293. * Mark a function for special use by Sizzle
  10294. * @param {Function} fn The function to mark
  10295. */
  10296. function markFunction( fn ) {
  10297. fn[ expando ] = true;
  10298. return fn;
  10299. }
  10300. /**
  10301. * Support testing using an element
  10302. * @param {Function} fn Passed the created element and returns a boolean result
  10303. */
  10304. function assert( fn ) {
  10305. var el = document.createElement("fieldset");
  10306. try {
  10307. return !!fn( el );
  10308. } catch (e) {
  10309. return false;
  10310. } finally {
  10311. // Remove from its parent by default
  10312. if ( el.parentNode ) {
  10313. el.parentNode.removeChild( el );
  10314. }
  10315. // release memory in IE
  10316. el = null;
  10317. }
  10318. }
  10319. /**
  10320. * Adds the same handler for all of the specified attrs
  10321. * @param {String} attrs Pipe-separated list of attributes
  10322. * @param {Function} handler The method that will be applied
  10323. */
  10324. function addHandle( attrs, handler ) {
  10325. var arr = attrs.split("|"),
  10326. i = arr.length;
  10327. while ( i-- ) {
  10328. Expr.attrHandle[ arr[i] ] = handler;
  10329. }
  10330. }
  10331. /**
  10332. * Checks document order of two siblings
  10333. * @param {Element} a
  10334. * @param {Element} b
  10335. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  10336. */
  10337. function siblingCheck( a, b ) {
  10338. var cur = b && a,
  10339. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  10340. a.sourceIndex - b.sourceIndex;
  10341. // Use IE sourceIndex if available on both nodes
  10342. if ( diff ) {
  10343. return diff;
  10344. }
  10345. // Check if b follows a
  10346. if ( cur ) {
  10347. while ( (cur = cur.nextSibling) ) {
  10348. if ( cur === b ) {
  10349. return -1;
  10350. }
  10351. }
  10352. }
  10353. return a ? 1 : -1;
  10354. }
  10355. /**
  10356. * Returns a function to use in pseudos for input types
  10357. * @param {String} type
  10358. */
  10359. function createInputPseudo( type ) {
  10360. return function( elem ) {
  10361. var name = elem.nodeName.toLowerCase();
  10362. return name === "input" && elem.type === type;
  10363. };
  10364. }
  10365. /**
  10366. * Returns a function to use in pseudos for buttons
  10367. * @param {String} type
  10368. */
  10369. function createButtonPseudo( type ) {
  10370. return function( elem ) {
  10371. var name = elem.nodeName.toLowerCase();
  10372. return (name === "input" || name === "button") && elem.type === type;
  10373. };
  10374. }
  10375. /**
  10376. * Returns a function to use in pseudos for :enabled/:disabled
  10377. * @param {Boolean} disabled true for :disabled; false for :enabled
  10378. */
  10379. function createDisabledPseudo( disabled ) {
  10380. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  10381. return function( elem ) {
  10382. // Only certain elements can match :enabled or :disabled
  10383. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  10384. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  10385. if ( "form" in elem ) {
  10386. // Check for inherited disabledness on relevant non-disabled elements:
  10387. // * listed form-associated elements in a disabled fieldset
  10388. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  10389. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  10390. // * option elements in a disabled optgroup
  10391. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  10392. // All such elements have a "form" property.
  10393. if ( elem.parentNode && elem.disabled === false ) {
  10394. // Option elements defer to a parent optgroup if present
  10395. if ( "label" in elem ) {
  10396. if ( "label" in elem.parentNode ) {
  10397. return elem.parentNode.disabled === disabled;
  10398. } else {
  10399. return elem.disabled === disabled;
  10400. }
  10401. }
  10402. // Support: IE 6 - 11
  10403. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  10404. return elem.isDisabled === disabled ||
  10405. // Where there is no isDisabled, check manually
  10406. /* jshint -W018 */
  10407. elem.isDisabled !== !disabled &&
  10408. inDisabledFieldset( elem ) === disabled;
  10409. }
  10410. return elem.disabled === disabled;
  10411. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  10412. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  10413. // even exist on them, let alone have a boolean value.
  10414. } else if ( "label" in elem ) {
  10415. return elem.disabled === disabled;
  10416. }
  10417. // Remaining elements are neither :enabled nor :disabled
  10418. return false;
  10419. };
  10420. }
  10421. /**
  10422. * Returns a function to use in pseudos for positionals
  10423. * @param {Function} fn
  10424. */
  10425. function createPositionalPseudo( fn ) {
  10426. return markFunction(function( argument ) {
  10427. argument = +argument;
  10428. return markFunction(function( seed, matches ) {
  10429. var j,
  10430. matchIndexes = fn( [], seed.length, argument ),
  10431. i = matchIndexes.length;
  10432. // Match elements found at the specified indexes
  10433. while ( i-- ) {
  10434. if ( seed[ (j = matchIndexes[i]) ] ) {
  10435. seed[j] = !(matches[j] = seed[j]);
  10436. }
  10437. }
  10438. });
  10439. });
  10440. }
  10441. /**
  10442. * Checks a node for validity as a Sizzle context
  10443. * @param {Element|Object=} context
  10444. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  10445. */
  10446. function testContext( context ) {
  10447. return context && typeof context.getElementsByTagName !== "undefined" && context;
  10448. }
  10449. // Expose support vars for convenience
  10450. support = Sizzle.support = {};
  10451. /**
  10452. * Detects XML nodes
  10453. * @param {Element|Object} elem An element or a document
  10454. * @returns {Boolean} True iff elem is a non-HTML XML node
  10455. */
  10456. isXML = Sizzle.isXML = function( elem ) {
  10457. var namespace = elem.namespaceURI,
  10458. docElem = (elem.ownerDocument || elem).documentElement;
  10459. // Support: IE <=8
  10460. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  10461. // https://bugs.jquery.com/ticket/4833
  10462. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  10463. };
  10464. /**
  10465. * Sets document-related variables once based on the current document
  10466. * @param {Element|Object} [doc] An element or document object to use to set the document
  10467. * @returns {Object} Returns the current document
  10468. */
  10469. setDocument = Sizzle.setDocument = function( node ) {
  10470. var hasCompare, subWindow,
  10471. doc = node ? node.ownerDocument || node : preferredDoc;
  10472. // Return early if doc is invalid or already selected
  10473. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  10474. return document;
  10475. }
  10476. // Update global variables
  10477. document = doc;
  10478. docElem = document.documentElement;
  10479. documentIsHTML = !isXML( document );
  10480. // Support: IE 9-11, Edge
  10481. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  10482. if ( preferredDoc !== document &&
  10483. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  10484. // Support: IE 11, Edge
  10485. if ( subWindow.addEventListener ) {
  10486. subWindow.addEventListener( "unload", unloadHandler, false );
  10487. // Support: IE 9 - 10 only
  10488. } else if ( subWindow.attachEvent ) {
  10489. subWindow.attachEvent( "onunload", unloadHandler );
  10490. }
  10491. }
  10492. /* Attributes
  10493. ---------------------------------------------------------------------- */
  10494. // Support: IE<8
  10495. // Verify that getAttribute really returns attributes and not properties
  10496. // (excepting IE8 booleans)
  10497. support.attributes = assert(function( el ) {
  10498. el.className = "i";
  10499. return !el.getAttribute("className");
  10500. });
  10501. /* getElement(s)By*
  10502. ---------------------------------------------------------------------- */
  10503. // Check if getElementsByTagName("*") returns only elements
  10504. support.getElementsByTagName = assert(function( el ) {
  10505. el.appendChild( document.createComment("") );
  10506. return !el.getElementsByTagName("*").length;
  10507. });
  10508. // Support: IE<9
  10509. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  10510. // Support: IE<10
  10511. // Check if getElementById returns elements by name
  10512. // The broken getElementById methods don't pick up programmatically-set names,
  10513. // so use a roundabout getElementsByName test
  10514. support.getById = assert(function( el ) {
  10515. docElem.appendChild( el ).id = expando;
  10516. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  10517. });
  10518. // ID filter and find
  10519. if ( support.getById ) {
  10520. Expr.filter["ID"] = function( id ) {
  10521. var attrId = id.replace( runescape, funescape );
  10522. return function( elem ) {
  10523. return elem.getAttribute("id") === attrId;
  10524. };
  10525. };
  10526. Expr.find["ID"] = function( id, context ) {
  10527. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10528. var elem = context.getElementById( id );
  10529. return elem ? [ elem ] : [];
  10530. }
  10531. };
  10532. } else {
  10533. Expr.filter["ID"] = function( id ) {
  10534. var attrId = id.replace( runescape, funescape );
  10535. return function( elem ) {
  10536. var node = typeof elem.getAttributeNode !== "undefined" &&
  10537. elem.getAttributeNode("id");
  10538. return node && node.value === attrId;
  10539. };
  10540. };
  10541. // Support: IE 6 - 7 only
  10542. // getElementById is not reliable as a find shortcut
  10543. Expr.find["ID"] = function( id, context ) {
  10544. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10545. var node, i, elems,
  10546. elem = context.getElementById( id );
  10547. if ( elem ) {
  10548. // Verify the id attribute
  10549. node = elem.getAttributeNode("id");
  10550. if ( node && node.value === id ) {
  10551. return [ elem ];
  10552. }
  10553. // Fall back on getElementsByName
  10554. elems = context.getElementsByName( id );
  10555. i = 0;
  10556. while ( (elem = elems[i++]) ) {
  10557. node = elem.getAttributeNode("id");
  10558. if ( node && node.value === id ) {
  10559. return [ elem ];
  10560. }
  10561. }
  10562. }
  10563. return [];
  10564. }
  10565. };
  10566. }
  10567. // Tag
  10568. Expr.find["TAG"] = support.getElementsByTagName ?
  10569. function( tag, context ) {
  10570. if ( typeof context.getElementsByTagName !== "undefined" ) {
  10571. return context.getElementsByTagName( tag );
  10572. // DocumentFragment nodes don't have gEBTN
  10573. } else if ( support.qsa ) {
  10574. return context.querySelectorAll( tag );
  10575. }
  10576. } :
  10577. function( tag, context ) {
  10578. var elem,
  10579. tmp = [],
  10580. i = 0,
  10581. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  10582. results = context.getElementsByTagName( tag );
  10583. // Filter out possible comments
  10584. if ( tag === "*" ) {
  10585. while ( (elem = results[i++]) ) {
  10586. if ( elem.nodeType === 1 ) {
  10587. tmp.push( elem );
  10588. }
  10589. }
  10590. return tmp;
  10591. }
  10592. return results;
  10593. };
  10594. // Class
  10595. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  10596. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  10597. return context.getElementsByClassName( className );
  10598. }
  10599. };
  10600. /* QSA/matchesSelector
  10601. ---------------------------------------------------------------------- */
  10602. // QSA and matchesSelector support
  10603. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  10604. rbuggyMatches = [];
  10605. // qSa(:focus) reports false when true (Chrome 21)
  10606. // We allow this because of a bug in IE8/9 that throws an error
  10607. // whenever `document.activeElement` is accessed on an iframe
  10608. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  10609. // See https://bugs.jquery.com/ticket/13378
  10610. rbuggyQSA = [];
  10611. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  10612. // Build QSA regex
  10613. // Regex strategy adopted from Diego Perini
  10614. assert(function( el ) {
  10615. // Select is set to empty string on purpose
  10616. // This is to test IE's treatment of not explicitly
  10617. // setting a boolean content attribute,
  10618. // since its presence should be enough
  10619. // https://bugs.jquery.com/ticket/12359
  10620. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  10621. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  10622. "<option selected=''></option></select>";
  10623. // Support: IE8, Opera 11-12.16
  10624. // Nothing should be selected when empty strings follow ^= or $= or *=
  10625. // The test attribute must be unknown in Opera but "safe" for WinRT
  10626. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  10627. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  10628. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  10629. }
  10630. // Support: IE8
  10631. // Boolean attributes and "value" are not treated correctly
  10632. if ( !el.querySelectorAll("[selected]").length ) {
  10633. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  10634. }
  10635. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  10636. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  10637. rbuggyQSA.push("~=");
  10638. }
  10639. // Webkit/Opera - :checked should return selected option elements
  10640. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10641. // IE8 throws error here and will not see later tests
  10642. if ( !el.querySelectorAll(":checked").length ) {
  10643. rbuggyQSA.push(":checked");
  10644. }
  10645. // Support: Safari 8+, iOS 8+
  10646. // https://bugs.webkit.org/show_bug.cgi?id=136851
  10647. // In-page `selector#id sibling-combinator selector` fails
  10648. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  10649. rbuggyQSA.push(".#.+[+~]");
  10650. }
  10651. });
  10652. assert(function( el ) {
  10653. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  10654. "<select disabled='disabled'><option/></select>";
  10655. // Support: Windows 8 Native Apps
  10656. // The type and name attributes are restricted during .innerHTML assignment
  10657. var input = document.createElement("input");
  10658. input.setAttribute( "type", "hidden" );
  10659. el.appendChild( input ).setAttribute( "name", "D" );
  10660. // Support: IE8
  10661. // Enforce case-sensitivity of name attribute
  10662. if ( el.querySelectorAll("[name=d]").length ) {
  10663. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  10664. }
  10665. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  10666. // IE8 throws error here and will not see later tests
  10667. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  10668. rbuggyQSA.push( ":enabled", ":disabled" );
  10669. }
  10670. // Support: IE9-11+
  10671. // IE's :disabled selector does not pick up the children of disabled fieldsets
  10672. docElem.appendChild( el ).disabled = true;
  10673. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  10674. rbuggyQSA.push( ":enabled", ":disabled" );
  10675. }
  10676. // Opera 10-11 does not throw on post-comma invalid pseudos
  10677. el.querySelectorAll("*,:x");
  10678. rbuggyQSA.push(",.*:");
  10679. });
  10680. }
  10681. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  10682. docElem.webkitMatchesSelector ||
  10683. docElem.mozMatchesSelector ||
  10684. docElem.oMatchesSelector ||
  10685. docElem.msMatchesSelector) )) ) {
  10686. assert(function( el ) {
  10687. // Check to see if it's possible to do matchesSelector
  10688. // on a disconnected node (IE 9)
  10689. support.disconnectedMatch = matches.call( el, "*" );
  10690. // This should fail with an exception
  10691. // Gecko does not error, returns false instead
  10692. matches.call( el, "[s!='']:x" );
  10693. rbuggyMatches.push( "!=", pseudos );
  10694. });
  10695. }
  10696. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  10697. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  10698. /* Contains
  10699. ---------------------------------------------------------------------- */
  10700. hasCompare = rnative.test( docElem.compareDocumentPosition );
  10701. // Element contains another
  10702. // Purposefully self-exclusive
  10703. // As in, an element does not contain itself
  10704. contains = hasCompare || rnative.test( docElem.contains ) ?
  10705. function( a, b ) {
  10706. var adown = a.nodeType === 9 ? a.documentElement : a,
  10707. bup = b && b.parentNode;
  10708. return a === bup || !!( bup && bup.nodeType === 1 && (
  10709. adown.contains ?
  10710. adown.contains( bup ) :
  10711. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  10712. ));
  10713. } :
  10714. function( a, b ) {
  10715. if ( b ) {
  10716. while ( (b = b.parentNode) ) {
  10717. if ( b === a ) {
  10718. return true;
  10719. }
  10720. }
  10721. }
  10722. return false;
  10723. };
  10724. /* Sorting
  10725. ---------------------------------------------------------------------- */
  10726. // Document order sorting
  10727. sortOrder = hasCompare ?
  10728. function( a, b ) {
  10729. // Flag for duplicate removal
  10730. if ( a === b ) {
  10731. hasDuplicate = true;
  10732. return 0;
  10733. }
  10734. // Sort on method existence if only one input has compareDocumentPosition
  10735. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  10736. if ( compare ) {
  10737. return compare;
  10738. }
  10739. // Calculate position if both inputs belong to the same document
  10740. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  10741. a.compareDocumentPosition( b ) :
  10742. // Otherwise we know they are disconnected
  10743. 1;
  10744. // Disconnected nodes
  10745. if ( compare & 1 ||
  10746. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  10747. // Choose the first element that is related to our preferred document
  10748. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  10749. return -1;
  10750. }
  10751. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  10752. return 1;
  10753. }
  10754. // Maintain original order
  10755. return sortInput ?
  10756. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10757. 0;
  10758. }
  10759. return compare & 4 ? -1 : 1;
  10760. } :
  10761. function( a, b ) {
  10762. // Exit early if the nodes are identical
  10763. if ( a === b ) {
  10764. hasDuplicate = true;
  10765. return 0;
  10766. }
  10767. var cur,
  10768. i = 0,
  10769. aup = a.parentNode,
  10770. bup = b.parentNode,
  10771. ap = [ a ],
  10772. bp = [ b ];
  10773. // Parentless nodes are either documents or disconnected
  10774. if ( !aup || !bup ) {
  10775. return a === document ? -1 :
  10776. b === document ? 1 :
  10777. aup ? -1 :
  10778. bup ? 1 :
  10779. sortInput ?
  10780. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10781. 0;
  10782. // If the nodes are siblings, we can do a quick check
  10783. } else if ( aup === bup ) {
  10784. return siblingCheck( a, b );
  10785. }
  10786. // Otherwise we need full lists of their ancestors for comparison
  10787. cur = a;
  10788. while ( (cur = cur.parentNode) ) {
  10789. ap.unshift( cur );
  10790. }
  10791. cur = b;
  10792. while ( (cur = cur.parentNode) ) {
  10793. bp.unshift( cur );
  10794. }
  10795. // Walk down the tree looking for a discrepancy
  10796. while ( ap[i] === bp[i] ) {
  10797. i++;
  10798. }
  10799. return i ?
  10800. // Do a sibling check if the nodes have a common ancestor
  10801. siblingCheck( ap[i], bp[i] ) :
  10802. // Otherwise nodes in our document sort first
  10803. ap[i] === preferredDoc ? -1 :
  10804. bp[i] === preferredDoc ? 1 :
  10805. 0;
  10806. };
  10807. return document;
  10808. };
  10809. Sizzle.matches = function( expr, elements ) {
  10810. return Sizzle( expr, null, null, elements );
  10811. };
  10812. Sizzle.matchesSelector = function( elem, expr ) {
  10813. // Set document vars if needed
  10814. if ( ( elem.ownerDocument || elem ) !== document ) {
  10815. setDocument( elem );
  10816. }
  10817. if ( support.matchesSelector && documentIsHTML &&
  10818. !nonnativeSelectorCache[ expr + " " ] &&
  10819. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  10820. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  10821. try {
  10822. var ret = matches.call( elem, expr );
  10823. // IE 9's matchesSelector returns false on disconnected nodes
  10824. if ( ret || support.disconnectedMatch ||
  10825. // As well, disconnected nodes are said to be in a document
  10826. // fragment in IE 9
  10827. elem.document && elem.document.nodeType !== 11 ) {
  10828. return ret;
  10829. }
  10830. } catch (e) {
  10831. nonnativeSelectorCache( expr, true );
  10832. }
  10833. }
  10834. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  10835. };
  10836. Sizzle.contains = function( context, elem ) {
  10837. // Set document vars if needed
  10838. if ( ( context.ownerDocument || context ) !== document ) {
  10839. setDocument( context );
  10840. }
  10841. return contains( context, elem );
  10842. };
  10843. Sizzle.attr = function( elem, name ) {
  10844. // Set document vars if needed
  10845. if ( ( elem.ownerDocument || elem ) !== document ) {
  10846. setDocument( elem );
  10847. }
  10848. var fn = Expr.attrHandle[ name.toLowerCase() ],
  10849. // Don't get fooled by Object.prototype properties (jQuery #13807)
  10850. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  10851. fn( elem, name, !documentIsHTML ) :
  10852. undefined;
  10853. return val !== undefined ?
  10854. val :
  10855. support.attributes || !documentIsHTML ?
  10856. elem.getAttribute( name ) :
  10857. (val = elem.getAttributeNode(name)) && val.specified ?
  10858. val.value :
  10859. null;
  10860. };
  10861. Sizzle.escape = function( sel ) {
  10862. return (sel + "").replace( rcssescape, fcssescape );
  10863. };
  10864. Sizzle.error = function( msg ) {
  10865. throw new Error( "Syntax error, unrecognized expression: " + msg );
  10866. };
  10867. /**
  10868. * Document sorting and removing duplicates
  10869. * @param {ArrayLike} results
  10870. */
  10871. Sizzle.uniqueSort = function( results ) {
  10872. var elem,
  10873. duplicates = [],
  10874. j = 0,
  10875. i = 0;
  10876. // Unless we *know* we can detect duplicates, assume their presence
  10877. hasDuplicate = !support.detectDuplicates;
  10878. sortInput = !support.sortStable && results.slice( 0 );
  10879. results.sort( sortOrder );
  10880. if ( hasDuplicate ) {
  10881. while ( (elem = results[i++]) ) {
  10882. if ( elem === results[ i ] ) {
  10883. j = duplicates.push( i );
  10884. }
  10885. }
  10886. while ( j-- ) {
  10887. results.splice( duplicates[ j ], 1 );
  10888. }
  10889. }
  10890. // Clear input after sorting to release objects
  10891. // See https://github.com/jquery/sizzle/pull/225
  10892. sortInput = null;
  10893. return results;
  10894. };
  10895. /**
  10896. * Utility function for retrieving the text value of an array of DOM nodes
  10897. * @param {Array|Element} elem
  10898. */
  10899. getText = Sizzle.getText = function( elem ) {
  10900. var node,
  10901. ret = "",
  10902. i = 0,
  10903. nodeType = elem.nodeType;
  10904. if ( !nodeType ) {
  10905. // If no nodeType, this is expected to be an array
  10906. while ( (node = elem[i++]) ) {
  10907. // Do not traverse comment nodes
  10908. ret += getText( node );
  10909. }
  10910. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  10911. // Use textContent for elements
  10912. // innerText usage removed for consistency of new lines (jQuery #11153)
  10913. if ( typeof elem.textContent === "string" ) {
  10914. return elem.textContent;
  10915. } else {
  10916. // Traverse its children
  10917. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10918. ret += getText( elem );
  10919. }
  10920. }
  10921. } else if ( nodeType === 3 || nodeType === 4 ) {
  10922. return elem.nodeValue;
  10923. }
  10924. // Do not include comment or processing instruction nodes
  10925. return ret;
  10926. };
  10927. Expr = Sizzle.selectors = {
  10928. // Can be adjusted by the user
  10929. cacheLength: 50,
  10930. createPseudo: markFunction,
  10931. match: matchExpr,
  10932. attrHandle: {},
  10933. find: {},
  10934. relative: {
  10935. ">": { dir: "parentNode", first: true },
  10936. " ": { dir: "parentNode" },
  10937. "+": { dir: "previousSibling", first: true },
  10938. "~": { dir: "previousSibling" }
  10939. },
  10940. preFilter: {
  10941. "ATTR": function( match ) {
  10942. match[1] = match[1].replace( runescape, funescape );
  10943. // Move the given value to match[3] whether quoted or unquoted
  10944. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10945. if ( match[2] === "~=" ) {
  10946. match[3] = " " + match[3] + " ";
  10947. }
  10948. return match.slice( 0, 4 );
  10949. },
  10950. "CHILD": function( match ) {
  10951. /* matches from matchExpr["CHILD"]
  10952. 1 type (only|nth|...)
  10953. 2 what (child|of-type)
  10954. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10955. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10956. 5 sign of xn-component
  10957. 6 x of xn-component
  10958. 7 sign of y-component
  10959. 8 y of y-component
  10960. */
  10961. match[1] = match[1].toLowerCase();
  10962. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10963. // nth-* requires argument
  10964. if ( !match[3] ) {
  10965. Sizzle.error( match[0] );
  10966. }
  10967. // numeric x and y parameters for Expr.filter.CHILD
  10968. // remember that false/true cast respectively to 0/1
  10969. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10970. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10971. // other types prohibit arguments
  10972. } else if ( match[3] ) {
  10973. Sizzle.error( match[0] );
  10974. }
  10975. return match;
  10976. },
  10977. "PSEUDO": function( match ) {
  10978. var excess,
  10979. unquoted = !match[6] && match[2];
  10980. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10981. return null;
  10982. }
  10983. // Accept quoted arguments as-is
  10984. if ( match[3] ) {
  10985. match[2] = match[4] || match[5] || "";
  10986. // Strip excess characters from unquoted arguments
  10987. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10988. // Get excess from tokenize (recursively)
  10989. (excess = tokenize( unquoted, true )) &&
  10990. // advance to the next closing parenthesis
  10991. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10992. // excess is a negative index
  10993. match[0] = match[0].slice( 0, excess );
  10994. match[2] = unquoted.slice( 0, excess );
  10995. }
  10996. // Return only captures needed by the pseudo filter method (type and argument)
  10997. return match.slice( 0, 3 );
  10998. }
  10999. },
  11000. filter: {
  11001. "TAG": function( nodeNameSelector ) {
  11002. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  11003. return nodeNameSelector === "*" ?
  11004. function() { return true; } :
  11005. function( elem ) {
  11006. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  11007. };
  11008. },
  11009. "CLASS": function( className ) {
  11010. var pattern = classCache[ className + " " ];
  11011. return pattern ||
  11012. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  11013. classCache( className, function( elem ) {
  11014. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  11015. });
  11016. },
  11017. "ATTR": function( name, operator, check ) {
  11018. return function( elem ) {
  11019. var result = Sizzle.attr( elem, name );
  11020. if ( result == null ) {
  11021. return operator === "!=";
  11022. }
  11023. if ( !operator ) {
  11024. return true;
  11025. }
  11026. result += "";
  11027. return operator === "=" ? result === check :
  11028. operator === "!=" ? result !== check :
  11029. operator === "^=" ? check && result.indexOf( check ) === 0 :
  11030. operator === "*=" ? check && result.indexOf( check ) > -1 :
  11031. operator === "$=" ? check && result.slice( -check.length ) === check :
  11032. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  11033. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  11034. false;
  11035. };
  11036. },
  11037. "CHILD": function( type, what, argument, first, last ) {
  11038. var simple = type.slice( 0, 3 ) !== "nth",
  11039. forward = type.slice( -4 ) !== "last",
  11040. ofType = what === "of-type";
  11041. return first === 1 && last === 0 ?
  11042. // Shortcut for :nth-*(n)
  11043. function( elem ) {
  11044. return !!elem.parentNode;
  11045. } :
  11046. function( elem, context, xml ) {
  11047. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  11048. dir = simple !== forward ? "nextSibling" : "previousSibling",
  11049. parent = elem.parentNode,
  11050. name = ofType && elem.nodeName.toLowerCase(),
  11051. useCache = !xml && !ofType,
  11052. diff = false;
  11053. if ( parent ) {
  11054. // :(first|last|only)-(child|of-type)
  11055. if ( simple ) {
  11056. while ( dir ) {
  11057. node = elem;
  11058. while ( (node = node[ dir ]) ) {
  11059. if ( ofType ?
  11060. node.nodeName.toLowerCase() === name :
  11061. node.nodeType === 1 ) {
  11062. return false;
  11063. }
  11064. }
  11065. // Reverse direction for :only-* (if we haven't yet done so)
  11066. start = dir = type === "only" && !start && "nextSibling";
  11067. }
  11068. return true;
  11069. }
  11070. start = [ forward ? parent.firstChild : parent.lastChild ];
  11071. // non-xml :nth-child(...) stores cache data on `parent`
  11072. if ( forward && useCache ) {
  11073. // Seek `elem` from a previously-cached index
  11074. // ...in a gzip-friendly way
  11075. node = parent;
  11076. outerCache = node[ expando ] || (node[ expando ] = {});
  11077. // Support: IE <9 only
  11078. // Defend against cloned attroperties (jQuery gh-1709)
  11079. uniqueCache = outerCache[ node.uniqueID ] ||
  11080. (outerCache[ node.uniqueID ] = {});
  11081. cache = uniqueCache[ type ] || [];
  11082. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  11083. diff = nodeIndex && cache[ 2 ];
  11084. node = nodeIndex && parent.childNodes[ nodeIndex ];
  11085. while ( (node = ++nodeIndex && node && node[ dir ] ||
  11086. // Fallback to seeking `elem` from the start
  11087. (diff = nodeIndex = 0) || start.pop()) ) {
  11088. // When found, cache indexes on `parent` and break
  11089. if ( node.nodeType === 1 && ++diff && node === elem ) {
  11090. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  11091. break;
  11092. }
  11093. }
  11094. } else {
  11095. // Use previously-cached element index if available
  11096. if ( useCache ) {
  11097. // ...in a gzip-friendly way
  11098. node = elem;
  11099. outerCache = node[ expando ] || (node[ expando ] = {});
  11100. // Support: IE <9 only
  11101. // Defend against cloned attroperties (jQuery gh-1709)
  11102. uniqueCache = outerCache[ node.uniqueID ] ||
  11103. (outerCache[ node.uniqueID ] = {});
  11104. cache = uniqueCache[ type ] || [];
  11105. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  11106. diff = nodeIndex;
  11107. }
  11108. // xml :nth-child(...)
  11109. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  11110. if ( diff === false ) {
  11111. // Use the same loop as above to seek `elem` from the start
  11112. while ( (node = ++nodeIndex && node && node[ dir ] ||
  11113. (diff = nodeIndex = 0) || start.pop()) ) {
  11114. if ( ( ofType ?
  11115. node.nodeName.toLowerCase() === name :
  11116. node.nodeType === 1 ) &&
  11117. ++diff ) {
  11118. // Cache the index of each encountered element
  11119. if ( useCache ) {
  11120. outerCache = node[ expando ] || (node[ expando ] = {});
  11121. // Support: IE <9 only
  11122. // Defend against cloned attroperties (jQuery gh-1709)
  11123. uniqueCache = outerCache[ node.uniqueID ] ||
  11124. (outerCache[ node.uniqueID ] = {});
  11125. uniqueCache[ type ] = [ dirruns, diff ];
  11126. }
  11127. if ( node === elem ) {
  11128. break;
  11129. }
  11130. }
  11131. }
  11132. }
  11133. }
  11134. // Incorporate the offset, then check against cycle size
  11135. diff -= last;
  11136. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  11137. }
  11138. };
  11139. },
  11140. "PSEUDO": function( pseudo, argument ) {
  11141. // pseudo-class names are case-insensitive
  11142. // http://www.w3.org/TR/selectors/#pseudo-classes
  11143. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  11144. // Remember that setFilters inherits from pseudos
  11145. var args,
  11146. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  11147. Sizzle.error( "unsupported pseudo: " + pseudo );
  11148. // The user may use createPseudo to indicate that
  11149. // arguments are needed to create the filter function
  11150. // just as Sizzle does
  11151. if ( fn[ expando ] ) {
  11152. return fn( argument );
  11153. }
  11154. // But maintain support for old signatures
  11155. if ( fn.length > 1 ) {
  11156. args = [ pseudo, pseudo, "", argument ];
  11157. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  11158. markFunction(function( seed, matches ) {
  11159. var idx,
  11160. matched = fn( seed, argument ),
  11161. i = matched.length;
  11162. while ( i-- ) {
  11163. idx = indexOf( seed, matched[i] );
  11164. seed[ idx ] = !( matches[ idx ] = matched[i] );
  11165. }
  11166. }) :
  11167. function( elem ) {
  11168. return fn( elem, 0, args );
  11169. };
  11170. }
  11171. return fn;
  11172. }
  11173. },
  11174. pseudos: {
  11175. // Potentially complex pseudos
  11176. "not": markFunction(function( selector ) {
  11177. // Trim the selector passed to compile
  11178. // to avoid treating leading and trailing
  11179. // spaces as combinators
  11180. var input = [],
  11181. results = [],
  11182. matcher = compile( selector.replace( rtrim, "$1" ) );
  11183. return matcher[ expando ] ?
  11184. markFunction(function( seed, matches, context, xml ) {
  11185. var elem,
  11186. unmatched = matcher( seed, null, xml, [] ),
  11187. i = seed.length;
  11188. // Match elements unmatched by `matcher`
  11189. while ( i-- ) {
  11190. if ( (elem = unmatched[i]) ) {
  11191. seed[i] = !(matches[i] = elem);
  11192. }
  11193. }
  11194. }) :
  11195. function( elem, context, xml ) {
  11196. input[0] = elem;
  11197. matcher( input, null, xml, results );
  11198. // Don't keep the element (issue #299)
  11199. input[0] = null;
  11200. return !results.pop();
  11201. };
  11202. }),
  11203. "has": markFunction(function( selector ) {
  11204. return function( elem ) {
  11205. return Sizzle( selector, elem ).length > 0;
  11206. };
  11207. }),
  11208. "contains": markFunction(function( text ) {
  11209. text = text.replace( runescape, funescape );
  11210. return function( elem ) {
  11211. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  11212. };
  11213. }),
  11214. // "Whether an element is represented by a :lang() selector
  11215. // is based solely on the element's language value
  11216. // being equal to the identifier C,
  11217. // or beginning with the identifier C immediately followed by "-".
  11218. // The matching of C against the element's language value is performed case-insensitively.
  11219. // The identifier C does not have to be a valid language name."
  11220. // http://www.w3.org/TR/selectors/#lang-pseudo
  11221. "lang": markFunction( function( lang ) {
  11222. // lang value must be a valid identifier
  11223. if ( !ridentifier.test(lang || "") ) {
  11224. Sizzle.error( "unsupported lang: " + lang );
  11225. }
  11226. lang = lang.replace( runescape, funescape ).toLowerCase();
  11227. return function( elem ) {
  11228. var elemLang;
  11229. do {
  11230. if ( (elemLang = documentIsHTML ?
  11231. elem.lang :
  11232. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  11233. elemLang = elemLang.toLowerCase();
  11234. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  11235. }
  11236. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  11237. return false;
  11238. };
  11239. }),
  11240. // Miscellaneous
  11241. "target": function( elem ) {
  11242. var hash = window.location && window.location.hash;
  11243. return hash && hash.slice( 1 ) === elem.id;
  11244. },
  11245. "root": function( elem ) {
  11246. return elem === docElem;
  11247. },
  11248. "focus": function( elem ) {
  11249. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  11250. },
  11251. // Boolean properties
  11252. "enabled": createDisabledPseudo( false ),
  11253. "disabled": createDisabledPseudo( true ),
  11254. "checked": function( elem ) {
  11255. // In CSS3, :checked should return both checked and selected elements
  11256. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  11257. var nodeName = elem.nodeName.toLowerCase();
  11258. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  11259. },
  11260. "selected": function( elem ) {
  11261. // Accessing this property makes selected-by-default
  11262. // options in Safari work properly
  11263. if ( elem.parentNode ) {
  11264. elem.parentNode.selectedIndex;
  11265. }
  11266. return elem.selected === true;
  11267. },
  11268. // Contents
  11269. "empty": function( elem ) {
  11270. // http://www.w3.org/TR/selectors/#empty-pseudo
  11271. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  11272. // but not by others (comment: 8; processing instruction: 7; etc.)
  11273. // nodeType < 6 works because attributes (2) do not appear as children
  11274. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  11275. if ( elem.nodeType < 6 ) {
  11276. return false;
  11277. }
  11278. }
  11279. return true;
  11280. },
  11281. "parent": function( elem ) {
  11282. return !Expr.pseudos["empty"]( elem );
  11283. },
  11284. // Element/input types
  11285. "header": function( elem ) {
  11286. return rheader.test( elem.nodeName );
  11287. },
  11288. "input": function( elem ) {
  11289. return rinputs.test( elem.nodeName );
  11290. },
  11291. "button": function( elem ) {
  11292. var name = elem.nodeName.toLowerCase();
  11293. return name === "input" && elem.type === "button" || name === "button";
  11294. },
  11295. "text": function( elem ) {
  11296. var attr;
  11297. return elem.nodeName.toLowerCase() === "input" &&
  11298. elem.type === "text" &&
  11299. // Support: IE<8
  11300. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  11301. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  11302. },
  11303. // Position-in-collection
  11304. "first": createPositionalPseudo(function() {
  11305. return [ 0 ];
  11306. }),
  11307. "last": createPositionalPseudo(function( matchIndexes, length ) {
  11308. return [ length - 1 ];
  11309. }),
  11310. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11311. return [ argument < 0 ? argument + length : argument ];
  11312. }),
  11313. "even": createPositionalPseudo(function( matchIndexes, length ) {
  11314. var i = 0;
  11315. for ( ; i < length; i += 2 ) {
  11316. matchIndexes.push( i );
  11317. }
  11318. return matchIndexes;
  11319. }),
  11320. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  11321. var i = 1;
  11322. for ( ; i < length; i += 2 ) {
  11323. matchIndexes.push( i );
  11324. }
  11325. return matchIndexes;
  11326. }),
  11327. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11328. var i = argument < 0 ?
  11329. argument + length :
  11330. argument > length ?
  11331. length :
  11332. argument;
  11333. for ( ; --i >= 0; ) {
  11334. matchIndexes.push( i );
  11335. }
  11336. return matchIndexes;
  11337. }),
  11338. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11339. var i = argument < 0 ? argument + length : argument;
  11340. for ( ; ++i < length; ) {
  11341. matchIndexes.push( i );
  11342. }
  11343. return matchIndexes;
  11344. })
  11345. }
  11346. };
  11347. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  11348. // Add button/input type pseudos
  11349. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  11350. Expr.pseudos[ i ] = createInputPseudo( i );
  11351. }
  11352. for ( i in { submit: true, reset: true } ) {
  11353. Expr.pseudos[ i ] = createButtonPseudo( i );
  11354. }
  11355. // Easy API for creating new setFilters
  11356. function setFilters() {}
  11357. setFilters.prototype = Expr.filters = Expr.pseudos;
  11358. Expr.setFilters = new setFilters();
  11359. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  11360. var matched, match, tokens, type,
  11361. soFar, groups, preFilters,
  11362. cached = tokenCache[ selector + " " ];
  11363. if ( cached ) {
  11364. return parseOnly ? 0 : cached.slice( 0 );
  11365. }
  11366. soFar = selector;
  11367. groups = [];
  11368. preFilters = Expr.preFilter;
  11369. while ( soFar ) {
  11370. // Comma and first run
  11371. if ( !matched || (match = rcomma.exec( soFar )) ) {
  11372. if ( match ) {
  11373. // Don't consume trailing commas as valid
  11374. soFar = soFar.slice( match[0].length ) || soFar;
  11375. }
  11376. groups.push( (tokens = []) );
  11377. }
  11378. matched = false;
  11379. // Combinators
  11380. if ( (match = rcombinators.exec( soFar )) ) {
  11381. matched = match.shift();
  11382. tokens.push({
  11383. value: matched,
  11384. // Cast descendant combinators to space
  11385. type: match[0].replace( rtrim, " " )
  11386. });
  11387. soFar = soFar.slice( matched.length );
  11388. }
  11389. // Filters
  11390. for ( type in Expr.filter ) {
  11391. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  11392. (match = preFilters[ type ]( match ))) ) {
  11393. matched = match.shift();
  11394. tokens.push({
  11395. value: matched,
  11396. type: type,
  11397. matches: match
  11398. });
  11399. soFar = soFar.slice( matched.length );
  11400. }
  11401. }
  11402. if ( !matched ) {
  11403. break;
  11404. }
  11405. }
  11406. // Return the length of the invalid excess
  11407. // if we're just parsing
  11408. // Otherwise, throw an error or return tokens
  11409. return parseOnly ?
  11410. soFar.length :
  11411. soFar ?
  11412. Sizzle.error( selector ) :
  11413. // Cache the tokens
  11414. tokenCache( selector, groups ).slice( 0 );
  11415. };
  11416. function toSelector( tokens ) {
  11417. var i = 0,
  11418. len = tokens.length,
  11419. selector = "";
  11420. for ( ; i < len; i++ ) {
  11421. selector += tokens[i].value;
  11422. }
  11423. return selector;
  11424. }
  11425. function addCombinator( matcher, combinator, base ) {
  11426. var dir = combinator.dir,
  11427. skip = combinator.next,
  11428. key = skip || dir,
  11429. checkNonElements = base && key === "parentNode",
  11430. doneName = done++;
  11431. return combinator.first ?
  11432. // Check against closest ancestor/preceding element
  11433. function( elem, context, xml ) {
  11434. while ( (elem = elem[ dir ]) ) {
  11435. if ( elem.nodeType === 1 || checkNonElements ) {
  11436. return matcher( elem, context, xml );
  11437. }
  11438. }
  11439. return false;
  11440. } :
  11441. // Check against all ancestor/preceding elements
  11442. function( elem, context, xml ) {
  11443. var oldCache, uniqueCache, outerCache,
  11444. newCache = [ dirruns, doneName ];
  11445. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  11446. if ( xml ) {
  11447. while ( (elem = elem[ dir ]) ) {
  11448. if ( elem.nodeType === 1 || checkNonElements ) {
  11449. if ( matcher( elem, context, xml ) ) {
  11450. return true;
  11451. }
  11452. }
  11453. }
  11454. } else {
  11455. while ( (elem = elem[ dir ]) ) {
  11456. if ( elem.nodeType === 1 || checkNonElements ) {
  11457. outerCache = elem[ expando ] || (elem[ expando ] = {});
  11458. // Support: IE <9 only
  11459. // Defend against cloned attroperties (jQuery gh-1709)
  11460. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  11461. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  11462. elem = elem[ dir ] || elem;
  11463. } else if ( (oldCache = uniqueCache[ key ]) &&
  11464. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  11465. // Assign to newCache so results back-propagate to previous elements
  11466. return (newCache[ 2 ] = oldCache[ 2 ]);
  11467. } else {
  11468. // Reuse newcache so results back-propagate to previous elements
  11469. uniqueCache[ key ] = newCache;
  11470. // A match means we're done; a fail means we have to keep checking
  11471. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  11472. return true;
  11473. }
  11474. }
  11475. }
  11476. }
  11477. }
  11478. return false;
  11479. };
  11480. }
  11481. function elementMatcher( matchers ) {
  11482. return matchers.length > 1 ?
  11483. function( elem, context, xml ) {
  11484. var i = matchers.length;
  11485. while ( i-- ) {
  11486. if ( !matchers[i]( elem, context, xml ) ) {
  11487. return false;
  11488. }
  11489. }
  11490. return true;
  11491. } :
  11492. matchers[0];
  11493. }
  11494. function multipleContexts( selector, contexts, results ) {
  11495. var i = 0,
  11496. len = contexts.length;
  11497. for ( ; i < len; i++ ) {
  11498. Sizzle( selector, contexts[i], results );
  11499. }
  11500. return results;
  11501. }
  11502. function condense( unmatched, map, filter, context, xml ) {
  11503. var elem,
  11504. newUnmatched = [],
  11505. i = 0,
  11506. len = unmatched.length,
  11507. mapped = map != null;
  11508. for ( ; i < len; i++ ) {
  11509. if ( (elem = unmatched[i]) ) {
  11510. if ( !filter || filter( elem, context, xml ) ) {
  11511. newUnmatched.push( elem );
  11512. if ( mapped ) {
  11513. map.push( i );
  11514. }
  11515. }
  11516. }
  11517. }
  11518. return newUnmatched;
  11519. }
  11520. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  11521. if ( postFilter && !postFilter[ expando ] ) {
  11522. postFilter = setMatcher( postFilter );
  11523. }
  11524. if ( postFinder && !postFinder[ expando ] ) {
  11525. postFinder = setMatcher( postFinder, postSelector );
  11526. }
  11527. return markFunction(function( seed, results, context, xml ) {
  11528. var temp, i, elem,
  11529. preMap = [],
  11530. postMap = [],
  11531. preexisting = results.length,
  11532. // Get initial elements from seed or context
  11533. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  11534. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  11535. matcherIn = preFilter && ( seed || !selector ) ?
  11536. condense( elems, preMap, preFilter, context, xml ) :
  11537. elems,
  11538. matcherOut = matcher ?
  11539. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  11540. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  11541. // ...intermediate processing is necessary
  11542. [] :
  11543. // ...otherwise use results directly
  11544. results :
  11545. matcherIn;
  11546. // Find primary matches
  11547. if ( matcher ) {
  11548. matcher( matcherIn, matcherOut, context, xml );
  11549. }
  11550. // Apply postFilter
  11551. if ( postFilter ) {
  11552. temp = condense( matcherOut, postMap );
  11553. postFilter( temp, [], context, xml );
  11554. // Un-match failing elements by moving them back to matcherIn
  11555. i = temp.length;
  11556. while ( i-- ) {
  11557. if ( (elem = temp[i]) ) {
  11558. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  11559. }
  11560. }
  11561. }
  11562. if ( seed ) {
  11563. if ( postFinder || preFilter ) {
  11564. if ( postFinder ) {
  11565. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  11566. temp = [];
  11567. i = matcherOut.length;
  11568. while ( i-- ) {
  11569. if ( (elem = matcherOut[i]) ) {
  11570. // Restore matcherIn since elem is not yet a final match
  11571. temp.push( (matcherIn[i] = elem) );
  11572. }
  11573. }
  11574. postFinder( null, (matcherOut = []), temp, xml );
  11575. }
  11576. // Move matched elements from seed to results to keep them synchronized
  11577. i = matcherOut.length;
  11578. while ( i-- ) {
  11579. if ( (elem = matcherOut[i]) &&
  11580. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  11581. seed[temp] = !(results[temp] = elem);
  11582. }
  11583. }
  11584. }
  11585. // Add elements to results, through postFinder if defined
  11586. } else {
  11587. matcherOut = condense(
  11588. matcherOut === results ?
  11589. matcherOut.splice( preexisting, matcherOut.length ) :
  11590. matcherOut
  11591. );
  11592. if ( postFinder ) {
  11593. postFinder( null, results, matcherOut, xml );
  11594. } else {
  11595. push.apply( results, matcherOut );
  11596. }
  11597. }
  11598. });
  11599. }
  11600. function matcherFromTokens( tokens ) {
  11601. var checkContext, matcher, j,
  11602. len = tokens.length,
  11603. leadingRelative = Expr.relative[ tokens[0].type ],
  11604. implicitRelative = leadingRelative || Expr.relative[" "],
  11605. i = leadingRelative ? 1 : 0,
  11606. // The foundational matcher ensures that elements are reachable from top-level context(s)
  11607. matchContext = addCombinator( function( elem ) {
  11608. return elem === checkContext;
  11609. }, implicitRelative, true ),
  11610. matchAnyContext = addCombinator( function( elem ) {
  11611. return indexOf( checkContext, elem ) > -1;
  11612. }, implicitRelative, true ),
  11613. matchers = [ function( elem, context, xml ) {
  11614. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  11615. (checkContext = context).nodeType ?
  11616. matchContext( elem, context, xml ) :
  11617. matchAnyContext( elem, context, xml ) );
  11618. // Avoid hanging onto element (issue #299)
  11619. checkContext = null;
  11620. return ret;
  11621. } ];
  11622. for ( ; i < len; i++ ) {
  11623. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  11624. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  11625. } else {
  11626. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  11627. // Return special upon seeing a positional matcher
  11628. if ( matcher[ expando ] ) {
  11629. // Find the next relative operator (if any) for proper handling
  11630. j = ++i;
  11631. for ( ; j < len; j++ ) {
  11632. if ( Expr.relative[ tokens[j].type ] ) {
  11633. break;
  11634. }
  11635. }
  11636. return setMatcher(
  11637. i > 1 && elementMatcher( matchers ),
  11638. i > 1 && toSelector(
  11639. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  11640. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  11641. ).replace( rtrim, "$1" ),
  11642. matcher,
  11643. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  11644. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  11645. j < len && toSelector( tokens )
  11646. );
  11647. }
  11648. matchers.push( matcher );
  11649. }
  11650. }
  11651. return elementMatcher( matchers );
  11652. }
  11653. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  11654. var bySet = setMatchers.length > 0,
  11655. byElement = elementMatchers.length > 0,
  11656. superMatcher = function( seed, context, xml, results, outermost ) {
  11657. var elem, j, matcher,
  11658. matchedCount = 0,
  11659. i = "0",
  11660. unmatched = seed && [],
  11661. setMatched = [],
  11662. contextBackup = outermostContext,
  11663. // We must always have either seed elements or outermost context
  11664. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  11665. // Use integer dirruns iff this is the outermost matcher
  11666. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  11667. len = elems.length;
  11668. if ( outermost ) {
  11669. outermostContext = context === document || context || outermost;
  11670. }
  11671. // Add elements passing elementMatchers directly to results
  11672. // Support: IE<9, Safari
  11673. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  11674. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  11675. if ( byElement && elem ) {
  11676. j = 0;
  11677. if ( !context && elem.ownerDocument !== document ) {
  11678. setDocument( elem );
  11679. xml = !documentIsHTML;
  11680. }
  11681. while ( (matcher = elementMatchers[j++]) ) {
  11682. if ( matcher( elem, context || document, xml) ) {
  11683. results.push( elem );
  11684. break;
  11685. }
  11686. }
  11687. if ( outermost ) {
  11688. dirruns = dirrunsUnique;
  11689. }
  11690. }
  11691. // Track unmatched elements for set filters
  11692. if ( bySet ) {
  11693. // They will have gone through all possible matchers
  11694. if ( (elem = !matcher && elem) ) {
  11695. matchedCount--;
  11696. }
  11697. // Lengthen the array for every element, matched or not
  11698. if ( seed ) {
  11699. unmatched.push( elem );
  11700. }
  11701. }
  11702. }
  11703. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  11704. // makes the latter nonnegative.
  11705. matchedCount += i;
  11706. // Apply set filters to unmatched elements
  11707. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  11708. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  11709. // no element matchers and no seed.
  11710. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  11711. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  11712. // numerically zero.
  11713. if ( bySet && i !== matchedCount ) {
  11714. j = 0;
  11715. while ( (matcher = setMatchers[j++]) ) {
  11716. matcher( unmatched, setMatched, context, xml );
  11717. }
  11718. if ( seed ) {
  11719. // Reintegrate element matches to eliminate the need for sorting
  11720. if ( matchedCount > 0 ) {
  11721. while ( i-- ) {
  11722. if ( !(unmatched[i] || setMatched[i]) ) {
  11723. setMatched[i] = pop.call( results );
  11724. }
  11725. }
  11726. }
  11727. // Discard index placeholder values to get only actual matches
  11728. setMatched = condense( setMatched );
  11729. }
  11730. // Add matches to results
  11731. push.apply( results, setMatched );
  11732. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  11733. if ( outermost && !seed && setMatched.length > 0 &&
  11734. ( matchedCount + setMatchers.length ) > 1 ) {
  11735. Sizzle.uniqueSort( results );
  11736. }
  11737. }
  11738. // Override manipulation of globals by nested matchers
  11739. if ( outermost ) {
  11740. dirruns = dirrunsUnique;
  11741. outermostContext = contextBackup;
  11742. }
  11743. return unmatched;
  11744. };
  11745. return bySet ?
  11746. markFunction( superMatcher ) :
  11747. superMatcher;
  11748. }
  11749. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  11750. var i,
  11751. setMatchers = [],
  11752. elementMatchers = [],
  11753. cached = compilerCache[ selector + " " ];
  11754. if ( !cached ) {
  11755. // Generate a function of recursive functions that can be used to check each element
  11756. if ( !match ) {
  11757. match = tokenize( selector );
  11758. }
  11759. i = match.length;
  11760. while ( i-- ) {
  11761. cached = matcherFromTokens( match[i] );
  11762. if ( cached[ expando ] ) {
  11763. setMatchers.push( cached );
  11764. } else {
  11765. elementMatchers.push( cached );
  11766. }
  11767. }
  11768. // Cache the compiled function
  11769. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  11770. // Save selector and tokenization
  11771. cached.selector = selector;
  11772. }
  11773. return cached;
  11774. };
  11775. /**
  11776. * A low-level selection function that works with Sizzle's compiled
  11777. * selector functions
  11778. * @param {String|Function} selector A selector or a pre-compiled
  11779. * selector function built with Sizzle.compile
  11780. * @param {Element} context
  11781. * @param {Array} [results]
  11782. * @param {Array} [seed] A set of elements to match against
  11783. */
  11784. select = Sizzle.select = function( selector, context, results, seed ) {
  11785. var i, tokens, token, type, find,
  11786. compiled = typeof selector === "function" && selector,
  11787. match = !seed && tokenize( (selector = compiled.selector || selector) );
  11788. results = results || [];
  11789. // Try to minimize operations if there is only one selector in the list and no seed
  11790. // (the latter of which guarantees us context)
  11791. if ( match.length === 1 ) {
  11792. // Reduce context if the leading compound selector is an ID
  11793. tokens = match[0] = match[0].slice( 0 );
  11794. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  11795. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  11796. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  11797. if ( !context ) {
  11798. return results;
  11799. // Precompiled matchers will still verify ancestry, so step up a level
  11800. } else if ( compiled ) {
  11801. context = context.parentNode;
  11802. }
  11803. selector = selector.slice( tokens.shift().value.length );
  11804. }
  11805. // Fetch a seed set for right-to-left matching
  11806. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  11807. while ( i-- ) {
  11808. token = tokens[i];
  11809. // Abort if we hit a combinator
  11810. if ( Expr.relative[ (type = token.type) ] ) {
  11811. break;
  11812. }
  11813. if ( (find = Expr.find[ type ]) ) {
  11814. // Search, expanding context for leading sibling combinators
  11815. if ( (seed = find(
  11816. token.matches[0].replace( runescape, funescape ),
  11817. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  11818. )) ) {
  11819. // If seed is empty or no tokens remain, we can return early
  11820. tokens.splice( i, 1 );
  11821. selector = seed.length && toSelector( tokens );
  11822. if ( !selector ) {
  11823. push.apply( results, seed );
  11824. return results;
  11825. }
  11826. break;
  11827. }
  11828. }
  11829. }
  11830. }
  11831. // Compile and execute a filtering function if one is not provided
  11832. // Provide `match` to avoid retokenization if we modified the selector above
  11833. ( compiled || compile( selector, match ) )(
  11834. seed,
  11835. context,
  11836. !documentIsHTML,
  11837. results,
  11838. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  11839. );
  11840. return results;
  11841. };
  11842. // One-time assignments
  11843. // Sort stability
  11844. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  11845. // Support: Chrome 14-35+
  11846. // Always assume duplicates if they aren't passed to the comparison function
  11847. support.detectDuplicates = !!hasDuplicate;
  11848. // Initialize against the default document
  11849. setDocument();
  11850. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  11851. // Detached nodes confoundingly follow *each other*
  11852. support.sortDetached = assert(function( el ) {
  11853. // Should return 1, but returns 4 (following)
  11854. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  11855. });
  11856. // Support: IE<8
  11857. // Prevent attribute/property "interpolation"
  11858. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  11859. if ( !assert(function( el ) {
  11860. el.innerHTML = "<a href='#'></a>";
  11861. return el.firstChild.getAttribute("href") === "#" ;
  11862. }) ) {
  11863. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  11864. if ( !isXML ) {
  11865. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  11866. }
  11867. });
  11868. }
  11869. // Support: IE<9
  11870. // Use defaultValue in place of getAttribute("value")
  11871. if ( !support.attributes || !assert(function( el ) {
  11872. el.innerHTML = "<input/>";
  11873. el.firstChild.setAttribute( "value", "" );
  11874. return el.firstChild.getAttribute( "value" ) === "";
  11875. }) ) {
  11876. addHandle( "value", function( elem, name, isXML ) {
  11877. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  11878. return elem.defaultValue;
  11879. }
  11880. });
  11881. }
  11882. // Support: IE<9
  11883. // Use getAttributeNode to fetch booleans when getAttribute lies
  11884. if ( !assert(function( el ) {
  11885. return el.getAttribute("disabled") == null;
  11886. }) ) {
  11887. addHandle( booleans, function( elem, name, isXML ) {
  11888. var val;
  11889. if ( !isXML ) {
  11890. return elem[ name ] === true ? name.toLowerCase() :
  11891. (val = elem.getAttributeNode( name )) && val.specified ?
  11892. val.value :
  11893. null;
  11894. }
  11895. });
  11896. }
  11897. return Sizzle;
  11898. })( window );
  11899. jQuery.find = Sizzle;
  11900. jQuery.expr = Sizzle.selectors;
  11901. // Deprecated
  11902. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  11903. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  11904. jQuery.text = Sizzle.getText;
  11905. jQuery.isXMLDoc = Sizzle.isXML;
  11906. jQuery.contains = Sizzle.contains;
  11907. jQuery.escapeSelector = Sizzle.escape;
  11908. var dir = function( elem, dir, until ) {
  11909. var matched = [],
  11910. truncate = until !== undefined;
  11911. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  11912. if ( elem.nodeType === 1 ) {
  11913. if ( truncate && jQuery( elem ).is( until ) ) {
  11914. break;
  11915. }
  11916. matched.push( elem );
  11917. }
  11918. }
  11919. return matched;
  11920. };
  11921. var siblings = function( n, elem ) {
  11922. var matched = [];
  11923. for ( ; n; n = n.nextSibling ) {
  11924. if ( n.nodeType === 1 && n !== elem ) {
  11925. matched.push( n );
  11926. }
  11927. }
  11928. return matched;
  11929. };
  11930. var rneedsContext = jQuery.expr.match.needsContext;
  11931. function nodeName( elem, name ) {
  11932. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11933. };
  11934. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11935. // Implement the identical functionality for filter and not
  11936. function winnow( elements, qualifier, not ) {
  11937. if ( isFunction( qualifier ) ) {
  11938. return jQuery.grep( elements, function( elem, i ) {
  11939. return !!qualifier.call( elem, i, elem ) !== not;
  11940. } );
  11941. }
  11942. // Single element
  11943. if ( qualifier.nodeType ) {
  11944. return jQuery.grep( elements, function( elem ) {
  11945. return ( elem === qualifier ) !== not;
  11946. } );
  11947. }
  11948. // Arraylike of elements (jQuery, arguments, Array)
  11949. if ( typeof qualifier !== "string" ) {
  11950. return jQuery.grep( elements, function( elem ) {
  11951. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11952. } );
  11953. }
  11954. // Filtered directly for both simple and complex selectors
  11955. return jQuery.filter( qualifier, elements, not );
  11956. }
  11957. jQuery.filter = function( expr, elems, not ) {
  11958. var elem = elems[ 0 ];
  11959. if ( not ) {
  11960. expr = ":not(" + expr + ")";
  11961. }
  11962. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11963. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11964. }
  11965. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11966. return elem.nodeType === 1;
  11967. } ) );
  11968. };
  11969. jQuery.fn.extend( {
  11970. find: function( selector ) {
  11971. var i, ret,
  11972. len = this.length,
  11973. self = this;
  11974. if ( typeof selector !== "string" ) {
  11975. return this.pushStack( jQuery( selector ).filter( function() {
  11976. for ( i = 0; i < len; i++ ) {
  11977. if ( jQuery.contains( self[ i ], this ) ) {
  11978. return true;
  11979. }
  11980. }
  11981. } ) );
  11982. }
  11983. ret = this.pushStack( [] );
  11984. for ( i = 0; i < len; i++ ) {
  11985. jQuery.find( selector, self[ i ], ret );
  11986. }
  11987. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11988. },
  11989. filter: function( selector ) {
  11990. return this.pushStack( winnow( this, selector || [], false ) );
  11991. },
  11992. not: function( selector ) {
  11993. return this.pushStack( winnow( this, selector || [], true ) );
  11994. },
  11995. is: function( selector ) {
  11996. return !!winnow(
  11997. this,
  11998. // If this is a positional/relative selector, check membership in the returned set
  11999. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  12000. typeof selector === "string" && rneedsContext.test( selector ) ?
  12001. jQuery( selector ) :
  12002. selector || [],
  12003. false
  12004. ).length;
  12005. }
  12006. } );
  12007. // Initialize a jQuery object
  12008. // A central reference to the root jQuery(document)
  12009. var rootjQuery,
  12010. // A simple way to check for HTML strings
  12011. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  12012. // Strict HTML recognition (#11290: must start with <)
  12013. // Shortcut simple #id case for speed
  12014. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  12015. init = jQuery.fn.init = function( selector, context, root ) {
  12016. var match, elem;
  12017. // HANDLE: $(""), $(null), $(undefined), $(false)
  12018. if ( !selector ) {
  12019. return this;
  12020. }
  12021. // Method init() accepts an alternate rootjQuery
  12022. // so migrate can support jQuery.sub (gh-2101)
  12023. root = root || rootjQuery;
  12024. // Handle HTML strings
  12025. if ( typeof selector === "string" ) {
  12026. if ( selector[ 0 ] === "<" &&
  12027. selector[ selector.length - 1 ] === ">" &&
  12028. selector.length >= 3 ) {
  12029. // Assume that strings that start and end with <> are HTML and skip the regex check
  12030. match = [ null, selector, null ];
  12031. } else {
  12032. match = rquickExpr.exec( selector );
  12033. }
  12034. // Match html or make sure no context is specified for #id
  12035. if ( match && ( match[ 1 ] || !context ) ) {
  12036. // HANDLE: $(html) -> $(array)
  12037. if ( match[ 1 ] ) {
  12038. context = context instanceof jQuery ? context[ 0 ] : context;
  12039. // Option to run scripts is true for back-compat
  12040. // Intentionally let the error be thrown if parseHTML is not present
  12041. jQuery.merge( this, jQuery.parseHTML(
  12042. match[ 1 ],
  12043. context && context.nodeType ? context.ownerDocument || context : document,
  12044. true
  12045. ) );
  12046. // HANDLE: $(html, props)
  12047. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  12048. for ( match in context ) {
  12049. // Properties of context are called as methods if possible
  12050. if ( isFunction( this[ match ] ) ) {
  12051. this[ match ]( context[ match ] );
  12052. // ...and otherwise set as attributes
  12053. } else {
  12054. this.attr( match, context[ match ] );
  12055. }
  12056. }
  12057. }
  12058. return this;
  12059. // HANDLE: $(#id)
  12060. } else {
  12061. elem = document.getElementById( match[ 2 ] );
  12062. if ( elem ) {
  12063. // Inject the element directly into the jQuery object
  12064. this[ 0 ] = elem;
  12065. this.length = 1;
  12066. }
  12067. return this;
  12068. }
  12069. // HANDLE: $(expr, $(...))
  12070. } else if ( !context || context.jquery ) {
  12071. return ( context || root ).find( selector );
  12072. // HANDLE: $(expr, context)
  12073. // (which is just equivalent to: $(context).find(expr)
  12074. } else {
  12075. return this.constructor( context ).find( selector );
  12076. }
  12077. // HANDLE: $(DOMElement)
  12078. } else if ( selector.nodeType ) {
  12079. this[ 0 ] = selector;
  12080. this.length = 1;
  12081. return this;
  12082. // HANDLE: $(function)
  12083. // Shortcut for document ready
  12084. } else if ( isFunction( selector ) ) {
  12085. return root.ready !== undefined ?
  12086. root.ready( selector ) :
  12087. // Execute immediately if ready is not present
  12088. selector( jQuery );
  12089. }
  12090. return jQuery.makeArray( selector, this );
  12091. };
  12092. // Give the init function the jQuery prototype for later instantiation
  12093. init.prototype = jQuery.fn;
  12094. // Initialize central reference
  12095. rootjQuery = jQuery( document );
  12096. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  12097. // Methods guaranteed to produce a unique set when starting from a unique set
  12098. guaranteedUnique = {
  12099. children: true,
  12100. contents: true,
  12101. next: true,
  12102. prev: true
  12103. };
  12104. jQuery.fn.extend( {
  12105. has: function( target ) {
  12106. var targets = jQuery( target, this ),
  12107. l = targets.length;
  12108. return this.filter( function() {
  12109. var i = 0;
  12110. for ( ; i < l; i++ ) {
  12111. if ( jQuery.contains( this, targets[ i ] ) ) {
  12112. return true;
  12113. }
  12114. }
  12115. } );
  12116. },
  12117. closest: function( selectors, context ) {
  12118. var cur,
  12119. i = 0,
  12120. l = this.length,
  12121. matched = [],
  12122. targets = typeof selectors !== "string" && jQuery( selectors );
  12123. // Positional selectors never match, since there's no _selection_ context
  12124. if ( !rneedsContext.test( selectors ) ) {
  12125. for ( ; i < l; i++ ) {
  12126. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  12127. // Always skip document fragments
  12128. if ( cur.nodeType < 11 && ( targets ?
  12129. targets.index( cur ) > -1 :
  12130. // Don't pass non-elements to Sizzle
  12131. cur.nodeType === 1 &&
  12132. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  12133. matched.push( cur );
  12134. break;
  12135. }
  12136. }
  12137. }
  12138. }
  12139. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  12140. },
  12141. // Determine the position of an element within the set
  12142. index: function( elem ) {
  12143. // No argument, return index in parent
  12144. if ( !elem ) {
  12145. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  12146. }
  12147. // Index in selector
  12148. if ( typeof elem === "string" ) {
  12149. return indexOf.call( jQuery( elem ), this[ 0 ] );
  12150. }
  12151. // Locate the position of the desired element
  12152. return indexOf.call( this,
  12153. // If it receives a jQuery object, the first element is used
  12154. elem.jquery ? elem[ 0 ] : elem
  12155. );
  12156. },
  12157. add: function( selector, context ) {
  12158. return this.pushStack(
  12159. jQuery.uniqueSort(
  12160. jQuery.merge( this.get(), jQuery( selector, context ) )
  12161. )
  12162. );
  12163. },
  12164. addBack: function( selector ) {
  12165. return this.add( selector == null ?
  12166. this.prevObject : this.prevObject.filter( selector )
  12167. );
  12168. }
  12169. } );
  12170. function sibling( cur, dir ) {
  12171. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  12172. return cur;
  12173. }
  12174. jQuery.each( {
  12175. parent: function( elem ) {
  12176. var parent = elem.parentNode;
  12177. return parent && parent.nodeType !== 11 ? parent : null;
  12178. },
  12179. parents: function( elem ) {
  12180. return dir( elem, "parentNode" );
  12181. },
  12182. parentsUntil: function( elem, i, until ) {
  12183. return dir( elem, "parentNode", until );
  12184. },
  12185. next: function( elem ) {
  12186. return sibling( elem, "nextSibling" );
  12187. },
  12188. prev: function( elem ) {
  12189. return sibling( elem, "previousSibling" );
  12190. },
  12191. nextAll: function( elem ) {
  12192. return dir( elem, "nextSibling" );
  12193. },
  12194. prevAll: function( elem ) {
  12195. return dir( elem, "previousSibling" );
  12196. },
  12197. nextUntil: function( elem, i, until ) {
  12198. return dir( elem, "nextSibling", until );
  12199. },
  12200. prevUntil: function( elem, i, until ) {
  12201. return dir( elem, "previousSibling", until );
  12202. },
  12203. siblings: function( elem ) {
  12204. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  12205. },
  12206. children: function( elem ) {
  12207. return siblings( elem.firstChild );
  12208. },
  12209. contents: function( elem ) {
  12210. if ( typeof elem.contentDocument !== "undefined" ) {
  12211. return elem.contentDocument;
  12212. }
  12213. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  12214. // Treat the template element as a regular one in browsers that
  12215. // don't support it.
  12216. if ( nodeName( elem, "template" ) ) {
  12217. elem = elem.content || elem;
  12218. }
  12219. return jQuery.merge( [], elem.childNodes );
  12220. }
  12221. }, function( name, fn ) {
  12222. jQuery.fn[ name ] = function( until, selector ) {
  12223. var matched = jQuery.map( this, fn, until );
  12224. if ( name.slice( -5 ) !== "Until" ) {
  12225. selector = until;
  12226. }
  12227. if ( selector && typeof selector === "string" ) {
  12228. matched = jQuery.filter( selector, matched );
  12229. }
  12230. if ( this.length > 1 ) {
  12231. // Remove duplicates
  12232. if ( !guaranteedUnique[ name ] ) {
  12233. jQuery.uniqueSort( matched );
  12234. }
  12235. // Reverse order for parents* and prev-derivatives
  12236. if ( rparentsprev.test( name ) ) {
  12237. matched.reverse();
  12238. }
  12239. }
  12240. return this.pushStack( matched );
  12241. };
  12242. } );
  12243. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  12244. // Convert String-formatted options into Object-formatted ones
  12245. function createOptions( options ) {
  12246. var object = {};
  12247. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  12248. object[ flag ] = true;
  12249. } );
  12250. return object;
  12251. }
  12252. /*
  12253. * Create a callback list using the following parameters:
  12254. *
  12255. * options: an optional list of space-separated options that will change how
  12256. * the callback list behaves or a more traditional option object
  12257. *
  12258. * By default a callback list will act like an event callback list and can be
  12259. * "fired" multiple times.
  12260. *
  12261. * Possible options:
  12262. *
  12263. * once: will ensure the callback list can only be fired once (like a Deferred)
  12264. *
  12265. * memory: will keep track of previous values and will call any callback added
  12266. * after the list has been fired right away with the latest "memorized"
  12267. * values (like a Deferred)
  12268. *
  12269. * unique: will ensure a callback can only be added once (no duplicate in the list)
  12270. *
  12271. * stopOnFalse: interrupt callings when a callback returns false
  12272. *
  12273. */
  12274. jQuery.Callbacks = function( options ) {
  12275. // Convert options from String-formatted to Object-formatted if needed
  12276. // (we check in cache first)
  12277. options = typeof options === "string" ?
  12278. createOptions( options ) :
  12279. jQuery.extend( {}, options );
  12280. var // Flag to know if list is currently firing
  12281. firing,
  12282. // Last fire value for non-forgettable lists
  12283. memory,
  12284. // Flag to know if list was already fired
  12285. fired,
  12286. // Flag to prevent firing
  12287. locked,
  12288. // Actual callback list
  12289. list = [],
  12290. // Queue of execution data for repeatable lists
  12291. queue = [],
  12292. // Index of currently firing callback (modified by add/remove as needed)
  12293. firingIndex = -1,
  12294. // Fire callbacks
  12295. fire = function() {
  12296. // Enforce single-firing
  12297. locked = locked || options.once;
  12298. // Execute callbacks for all pending executions,
  12299. // respecting firingIndex overrides and runtime changes
  12300. fired = firing = true;
  12301. for ( ; queue.length; firingIndex = -1 ) {
  12302. memory = queue.shift();
  12303. while ( ++firingIndex < list.length ) {
  12304. // Run callback and check for early termination
  12305. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  12306. options.stopOnFalse ) {
  12307. // Jump to end and forget the data so .add doesn't re-fire
  12308. firingIndex = list.length;
  12309. memory = false;
  12310. }
  12311. }
  12312. }
  12313. // Forget the data if we're done with it
  12314. if ( !options.memory ) {
  12315. memory = false;
  12316. }
  12317. firing = false;
  12318. // Clean up if we're done firing for good
  12319. if ( locked ) {
  12320. // Keep an empty list if we have data for future add calls
  12321. if ( memory ) {
  12322. list = [];
  12323. // Otherwise, this object is spent
  12324. } else {
  12325. list = "";
  12326. }
  12327. }
  12328. },
  12329. // Actual Callbacks object
  12330. self = {
  12331. // Add a callback or a collection of callbacks to the list
  12332. add: function() {
  12333. if ( list ) {
  12334. // If we have memory from a past run, we should fire after adding
  12335. if ( memory && !firing ) {
  12336. firingIndex = list.length - 1;
  12337. queue.push( memory );
  12338. }
  12339. ( function add( args ) {
  12340. jQuery.each( args, function( _, arg ) {
  12341. if ( isFunction( arg ) ) {
  12342. if ( !options.unique || !self.has( arg ) ) {
  12343. list.push( arg );
  12344. }
  12345. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  12346. // Inspect recursively
  12347. add( arg );
  12348. }
  12349. } );
  12350. } )( arguments );
  12351. if ( memory && !firing ) {
  12352. fire();
  12353. }
  12354. }
  12355. return this;
  12356. },
  12357. // Remove a callback from the list
  12358. remove: function() {
  12359. jQuery.each( arguments, function( _, arg ) {
  12360. var index;
  12361. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  12362. list.splice( index, 1 );
  12363. // Handle firing indexes
  12364. if ( index <= firingIndex ) {
  12365. firingIndex--;
  12366. }
  12367. }
  12368. } );
  12369. return this;
  12370. },
  12371. // Check if a given callback is in the list.
  12372. // If no argument is given, return whether or not list has callbacks attached.
  12373. has: function( fn ) {
  12374. return fn ?
  12375. jQuery.inArray( fn, list ) > -1 :
  12376. list.length > 0;
  12377. },
  12378. // Remove all callbacks from the list
  12379. empty: function() {
  12380. if ( list ) {
  12381. list = [];
  12382. }
  12383. return this;
  12384. },
  12385. // Disable .fire and .add
  12386. // Abort any current/pending executions
  12387. // Clear all callbacks and values
  12388. disable: function() {
  12389. locked = queue = [];
  12390. list = memory = "";
  12391. return this;
  12392. },
  12393. disabled: function() {
  12394. return !list;
  12395. },
  12396. // Disable .fire
  12397. // Also disable .add unless we have memory (since it would have no effect)
  12398. // Abort any pending executions
  12399. lock: function() {
  12400. locked = queue = [];
  12401. if ( !memory && !firing ) {
  12402. list = memory = "";
  12403. }
  12404. return this;
  12405. },
  12406. locked: function() {
  12407. return !!locked;
  12408. },
  12409. // Call all callbacks with the given context and arguments
  12410. fireWith: function( context, args ) {
  12411. if ( !locked ) {
  12412. args = args || [];
  12413. args = [ context, args.slice ? args.slice() : args ];
  12414. queue.push( args );
  12415. if ( !firing ) {
  12416. fire();
  12417. }
  12418. }
  12419. return this;
  12420. },
  12421. // Call all the callbacks with the given arguments
  12422. fire: function() {
  12423. self.fireWith( this, arguments );
  12424. return this;
  12425. },
  12426. // To know if the callbacks have already been called at least once
  12427. fired: function() {
  12428. return !!fired;
  12429. }
  12430. };
  12431. return self;
  12432. };
  12433. function Identity( v ) {
  12434. return v;
  12435. }
  12436. function Thrower( ex ) {
  12437. throw ex;
  12438. }
  12439. function adoptValue( value, resolve, reject, noValue ) {
  12440. var method;
  12441. try {
  12442. // Check for promise aspect first to privilege synchronous behavior
  12443. if ( value && isFunction( ( method = value.promise ) ) ) {
  12444. method.call( value ).done( resolve ).fail( reject );
  12445. // Other thenables
  12446. } else if ( value && isFunction( ( method = value.then ) ) ) {
  12447. method.call( value, resolve, reject );
  12448. // Other non-thenables
  12449. } else {
  12450. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  12451. // * false: [ value ].slice( 0 ) => resolve( value )
  12452. // * true: [ value ].slice( 1 ) => resolve()
  12453. resolve.apply( undefined, [ value ].slice( noValue ) );
  12454. }
  12455. // For Promises/A+, convert exceptions into rejections
  12456. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  12457. // Deferred#then to conditionally suppress rejection.
  12458. } catch ( value ) {
  12459. // Support: Android 4.0 only
  12460. // Strict mode functions invoked without .call/.apply get global-object context
  12461. reject.apply( undefined, [ value ] );
  12462. }
  12463. }
  12464. jQuery.extend( {
  12465. Deferred: function( func ) {
  12466. var tuples = [
  12467. // action, add listener, callbacks,
  12468. // ... .then handlers, argument index, [final state]
  12469. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  12470. jQuery.Callbacks( "memory" ), 2 ],
  12471. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  12472. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  12473. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  12474. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  12475. ],
  12476. state = "pending",
  12477. promise = {
  12478. state: function() {
  12479. return state;
  12480. },
  12481. always: function() {
  12482. deferred.done( arguments ).fail( arguments );
  12483. return this;
  12484. },
  12485. "catch": function( fn ) {
  12486. return promise.then( null, fn );
  12487. },
  12488. // Keep pipe for back-compat
  12489. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  12490. var fns = arguments;
  12491. return jQuery.Deferred( function( newDefer ) {
  12492. jQuery.each( tuples, function( i, tuple ) {
  12493. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  12494. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  12495. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  12496. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  12497. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  12498. deferred[ tuple[ 1 ] ]( function() {
  12499. var returned = fn && fn.apply( this, arguments );
  12500. if ( returned && isFunction( returned.promise ) ) {
  12501. returned.promise()
  12502. .progress( newDefer.notify )
  12503. .done( newDefer.resolve )
  12504. .fail( newDefer.reject );
  12505. } else {
  12506. newDefer[ tuple[ 0 ] + "With" ](
  12507. this,
  12508. fn ? [ returned ] : arguments
  12509. );
  12510. }
  12511. } );
  12512. } );
  12513. fns = null;
  12514. } ).promise();
  12515. },
  12516. then: function( onFulfilled, onRejected, onProgress ) {
  12517. var maxDepth = 0;
  12518. function resolve( depth, deferred, handler, special ) {
  12519. return function() {
  12520. var that = this,
  12521. args = arguments,
  12522. mightThrow = function() {
  12523. var returned, then;
  12524. // Support: Promises/A+ section 2.3.3.3.3
  12525. // https://promisesaplus.com/#point-59
  12526. // Ignore double-resolution attempts
  12527. if ( depth < maxDepth ) {
  12528. return;
  12529. }
  12530. returned = handler.apply( that, args );
  12531. // Support: Promises/A+ section 2.3.1
  12532. // https://promisesaplus.com/#point-48
  12533. if ( returned === deferred.promise() ) {
  12534. throw new TypeError( "Thenable self-resolution" );
  12535. }
  12536. // Support: Promises/A+ sections 2.3.3.1, 3.5
  12537. // https://promisesaplus.com/#point-54
  12538. // https://promisesaplus.com/#point-75
  12539. // Retrieve `then` only once
  12540. then = returned &&
  12541. // Support: Promises/A+ section 2.3.4
  12542. // https://promisesaplus.com/#point-64
  12543. // Only check objects and functions for thenability
  12544. ( typeof returned === "object" ||
  12545. typeof returned === "function" ) &&
  12546. returned.then;
  12547. // Handle a returned thenable
  12548. if ( isFunction( then ) ) {
  12549. // Special processors (notify) just wait for resolution
  12550. if ( special ) {
  12551. then.call(
  12552. returned,
  12553. resolve( maxDepth, deferred, Identity, special ),
  12554. resolve( maxDepth, deferred, Thrower, special )
  12555. );
  12556. // Normal processors (resolve) also hook into progress
  12557. } else {
  12558. // ...and disregard older resolution values
  12559. maxDepth++;
  12560. then.call(
  12561. returned,
  12562. resolve( maxDepth, deferred, Identity, special ),
  12563. resolve( maxDepth, deferred, Thrower, special ),
  12564. resolve( maxDepth, deferred, Identity,
  12565. deferred.notifyWith )
  12566. );
  12567. }
  12568. // Handle all other returned values
  12569. } else {
  12570. // Only substitute handlers pass on context
  12571. // and multiple values (non-spec behavior)
  12572. if ( handler !== Identity ) {
  12573. that = undefined;
  12574. args = [ returned ];
  12575. }
  12576. // Process the value(s)
  12577. // Default process is resolve
  12578. ( special || deferred.resolveWith )( that, args );
  12579. }
  12580. },
  12581. // Only normal processors (resolve) catch and reject exceptions
  12582. process = special ?
  12583. mightThrow :
  12584. function() {
  12585. try {
  12586. mightThrow();
  12587. } catch ( e ) {
  12588. if ( jQuery.Deferred.exceptionHook ) {
  12589. jQuery.Deferred.exceptionHook( e,
  12590. process.stackTrace );
  12591. }
  12592. // Support: Promises/A+ section 2.3.3.3.4.1
  12593. // https://promisesaplus.com/#point-61
  12594. // Ignore post-resolution exceptions
  12595. if ( depth + 1 >= maxDepth ) {
  12596. // Only substitute handlers pass on context
  12597. // and multiple values (non-spec behavior)
  12598. if ( handler !== Thrower ) {
  12599. that = undefined;
  12600. args = [ e ];
  12601. }
  12602. deferred.rejectWith( that, args );
  12603. }
  12604. }
  12605. };
  12606. // Support: Promises/A+ section 2.3.3.3.1
  12607. // https://promisesaplus.com/#point-57
  12608. // Re-resolve promises immediately to dodge false rejection from
  12609. // subsequent errors
  12610. if ( depth ) {
  12611. process();
  12612. } else {
  12613. // Call an optional hook to record the stack, in case of exception
  12614. // since it's otherwise lost when execution goes async
  12615. if ( jQuery.Deferred.getStackHook ) {
  12616. process.stackTrace = jQuery.Deferred.getStackHook();
  12617. }
  12618. window.setTimeout( process );
  12619. }
  12620. };
  12621. }
  12622. return jQuery.Deferred( function( newDefer ) {
  12623. // progress_handlers.add( ... )
  12624. tuples[ 0 ][ 3 ].add(
  12625. resolve(
  12626. 0,
  12627. newDefer,
  12628. isFunction( onProgress ) ?
  12629. onProgress :
  12630. Identity,
  12631. newDefer.notifyWith
  12632. )
  12633. );
  12634. // fulfilled_handlers.add( ... )
  12635. tuples[ 1 ][ 3 ].add(
  12636. resolve(
  12637. 0,
  12638. newDefer,
  12639. isFunction( onFulfilled ) ?
  12640. onFulfilled :
  12641. Identity
  12642. )
  12643. );
  12644. // rejected_handlers.add( ... )
  12645. tuples[ 2 ][ 3 ].add(
  12646. resolve(
  12647. 0,
  12648. newDefer,
  12649. isFunction( onRejected ) ?
  12650. onRejected :
  12651. Thrower
  12652. )
  12653. );
  12654. } ).promise();
  12655. },
  12656. // Get a promise for this deferred
  12657. // If obj is provided, the promise aspect is added to the object
  12658. promise: function( obj ) {
  12659. return obj != null ? jQuery.extend( obj, promise ) : promise;
  12660. }
  12661. },
  12662. deferred = {};
  12663. // Add list-specific methods
  12664. jQuery.each( tuples, function( i, tuple ) {
  12665. var list = tuple[ 2 ],
  12666. stateString = tuple[ 5 ];
  12667. // promise.progress = list.add
  12668. // promise.done = list.add
  12669. // promise.fail = list.add
  12670. promise[ tuple[ 1 ] ] = list.add;
  12671. // Handle state
  12672. if ( stateString ) {
  12673. list.add(
  12674. function() {
  12675. // state = "resolved" (i.e., fulfilled)
  12676. // state = "rejected"
  12677. state = stateString;
  12678. },
  12679. // rejected_callbacks.disable
  12680. // fulfilled_callbacks.disable
  12681. tuples[ 3 - i ][ 2 ].disable,
  12682. // rejected_handlers.disable
  12683. // fulfilled_handlers.disable
  12684. tuples[ 3 - i ][ 3 ].disable,
  12685. // progress_callbacks.lock
  12686. tuples[ 0 ][ 2 ].lock,
  12687. // progress_handlers.lock
  12688. tuples[ 0 ][ 3 ].lock
  12689. );
  12690. }
  12691. // progress_handlers.fire
  12692. // fulfilled_handlers.fire
  12693. // rejected_handlers.fire
  12694. list.add( tuple[ 3 ].fire );
  12695. // deferred.notify = function() { deferred.notifyWith(...) }
  12696. // deferred.resolve = function() { deferred.resolveWith(...) }
  12697. // deferred.reject = function() { deferred.rejectWith(...) }
  12698. deferred[ tuple[ 0 ] ] = function() {
  12699. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  12700. return this;
  12701. };
  12702. // deferred.notifyWith = list.fireWith
  12703. // deferred.resolveWith = list.fireWith
  12704. // deferred.rejectWith = list.fireWith
  12705. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  12706. } );
  12707. // Make the deferred a promise
  12708. promise.promise( deferred );
  12709. // Call given func if any
  12710. if ( func ) {
  12711. func.call( deferred, deferred );
  12712. }
  12713. // All done!
  12714. return deferred;
  12715. },
  12716. // Deferred helper
  12717. when: function( singleValue ) {
  12718. var
  12719. // count of uncompleted subordinates
  12720. remaining = arguments.length,
  12721. // count of unprocessed arguments
  12722. i = remaining,
  12723. // subordinate fulfillment data
  12724. resolveContexts = Array( i ),
  12725. resolveValues = slice.call( arguments ),
  12726. // the master Deferred
  12727. master = jQuery.Deferred(),
  12728. // subordinate callback factory
  12729. updateFunc = function( i ) {
  12730. return function( value ) {
  12731. resolveContexts[ i ] = this;
  12732. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  12733. if ( !( --remaining ) ) {
  12734. master.resolveWith( resolveContexts, resolveValues );
  12735. }
  12736. };
  12737. };
  12738. // Single- and empty arguments are adopted like Promise.resolve
  12739. if ( remaining <= 1 ) {
  12740. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  12741. !remaining );
  12742. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  12743. if ( master.state() === "pending" ||
  12744. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  12745. return master.then();
  12746. }
  12747. }
  12748. // Multiple arguments are aggregated like Promise.all array elements
  12749. while ( i-- ) {
  12750. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  12751. }
  12752. return master.promise();
  12753. }
  12754. } );
  12755. // These usually indicate a programmer mistake during development,
  12756. // warn about them ASAP rather than swallowing them by default.
  12757. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  12758. jQuery.Deferred.exceptionHook = function( error, stack ) {
  12759. // Support: IE 8 - 9 only
  12760. // Console exists when dev tools are open, which can happen at any time
  12761. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  12762. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  12763. }
  12764. };
  12765. jQuery.readyException = function( error ) {
  12766. window.setTimeout( function() {
  12767. throw error;
  12768. } );
  12769. };
  12770. // The deferred used on DOM ready
  12771. var readyList = jQuery.Deferred();
  12772. jQuery.fn.ready = function( fn ) {
  12773. readyList
  12774. .then( fn )
  12775. // Wrap jQuery.readyException in a function so that the lookup
  12776. // happens at the time of error handling instead of callback
  12777. // registration.
  12778. .catch( function( error ) {
  12779. jQuery.readyException( error );
  12780. } );
  12781. return this;
  12782. };
  12783. jQuery.extend( {
  12784. // Is the DOM ready to be used? Set to true once it occurs.
  12785. isReady: false,
  12786. // A counter to track how many items to wait for before
  12787. // the ready event fires. See #6781
  12788. readyWait: 1,
  12789. // Handle when the DOM is ready
  12790. ready: function( wait ) {
  12791. // Abort if there are pending holds or we're already ready
  12792. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  12793. return;
  12794. }
  12795. // Remember that the DOM is ready
  12796. jQuery.isReady = true;
  12797. // If a normal DOM Ready event fired, decrement, and wait if need be
  12798. if ( wait !== true && --jQuery.readyWait > 0 ) {
  12799. return;
  12800. }
  12801. // If there are functions bound, to execute
  12802. readyList.resolveWith( document, [ jQuery ] );
  12803. }
  12804. } );
  12805. jQuery.ready.then = readyList.then;
  12806. // The ready event handler and self cleanup method
  12807. function completed() {
  12808. document.removeEventListener( "DOMContentLoaded", completed );
  12809. window.removeEventListener( "load", completed );
  12810. jQuery.ready();
  12811. }
  12812. // Catch cases where $(document).ready() is called
  12813. // after the browser event has already occurred.
  12814. // Support: IE <=9 - 10 only
  12815. // Older IE sometimes signals "interactive" too soon
  12816. if ( document.readyState === "complete" ||
  12817. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  12818. // Handle it asynchronously to allow scripts the opportunity to delay ready
  12819. window.setTimeout( jQuery.ready );
  12820. } else {
  12821. // Use the handy event callback
  12822. document.addEventListener( "DOMContentLoaded", completed );
  12823. // A fallback to window.onload, that will always work
  12824. window.addEventListener( "load", completed );
  12825. }
  12826. // Multifunctional method to get and set values of a collection
  12827. // The value/s can optionally be executed if it's a function
  12828. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  12829. var i = 0,
  12830. len = elems.length,
  12831. bulk = key == null;
  12832. // Sets many values
  12833. if ( toType( key ) === "object" ) {
  12834. chainable = true;
  12835. for ( i in key ) {
  12836. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  12837. }
  12838. // Sets one value
  12839. } else if ( value !== undefined ) {
  12840. chainable = true;
  12841. if ( !isFunction( value ) ) {
  12842. raw = true;
  12843. }
  12844. if ( bulk ) {
  12845. // Bulk operations run against the entire set
  12846. if ( raw ) {
  12847. fn.call( elems, value );
  12848. fn = null;
  12849. // ...except when executing function values
  12850. } else {
  12851. bulk = fn;
  12852. fn = function( elem, key, value ) {
  12853. return bulk.call( jQuery( elem ), value );
  12854. };
  12855. }
  12856. }
  12857. if ( fn ) {
  12858. for ( ; i < len; i++ ) {
  12859. fn(
  12860. elems[ i ], key, raw ?
  12861. value :
  12862. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  12863. );
  12864. }
  12865. }
  12866. }
  12867. if ( chainable ) {
  12868. return elems;
  12869. }
  12870. // Gets
  12871. if ( bulk ) {
  12872. return fn.call( elems );
  12873. }
  12874. return len ? fn( elems[ 0 ], key ) : emptyGet;
  12875. };
  12876. // Matches dashed string for camelizing
  12877. var rmsPrefix = /^-ms-/,
  12878. rdashAlpha = /-([a-z])/g;
  12879. // Used by camelCase as callback to replace()
  12880. function fcamelCase( all, letter ) {
  12881. return letter.toUpperCase();
  12882. }
  12883. // Convert dashed to camelCase; used by the css and data modules
  12884. // Support: IE <=9 - 11, Edge 12 - 15
  12885. // Microsoft forgot to hump their vendor prefix (#9572)
  12886. function camelCase( string ) {
  12887. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  12888. }
  12889. var acceptData = function( owner ) {
  12890. // Accepts only:
  12891. // - Node
  12892. // - Node.ELEMENT_NODE
  12893. // - Node.DOCUMENT_NODE
  12894. // - Object
  12895. // - Any
  12896. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  12897. };
  12898. function Data() {
  12899. this.expando = jQuery.expando + Data.uid++;
  12900. }
  12901. Data.uid = 1;
  12902. Data.prototype = {
  12903. cache: function( owner ) {
  12904. // Check if the owner object already has a cache
  12905. var value = owner[ this.expando ];
  12906. // If not, create one
  12907. if ( !value ) {
  12908. value = {};
  12909. // We can accept data for non-element nodes in modern browsers,
  12910. // but we should not, see #8335.
  12911. // Always return an empty object.
  12912. if ( acceptData( owner ) ) {
  12913. // If it is a node unlikely to be stringify-ed or looped over
  12914. // use plain assignment
  12915. if ( owner.nodeType ) {
  12916. owner[ this.expando ] = value;
  12917. // Otherwise secure it in a non-enumerable property
  12918. // configurable must be true to allow the property to be
  12919. // deleted when data is removed
  12920. } else {
  12921. Object.defineProperty( owner, this.expando, {
  12922. value: value,
  12923. configurable: true
  12924. } );
  12925. }
  12926. }
  12927. }
  12928. return value;
  12929. },
  12930. set: function( owner, data, value ) {
  12931. var prop,
  12932. cache = this.cache( owner );
  12933. // Handle: [ owner, key, value ] args
  12934. // Always use camelCase key (gh-2257)
  12935. if ( typeof data === "string" ) {
  12936. cache[ camelCase( data ) ] = value;
  12937. // Handle: [ owner, { properties } ] args
  12938. } else {
  12939. // Copy the properties one-by-one to the cache object
  12940. for ( prop in data ) {
  12941. cache[ camelCase( prop ) ] = data[ prop ];
  12942. }
  12943. }
  12944. return cache;
  12945. },
  12946. get: function( owner, key ) {
  12947. return key === undefined ?
  12948. this.cache( owner ) :
  12949. // Always use camelCase key (gh-2257)
  12950. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12951. },
  12952. access: function( owner, key, value ) {
  12953. // In cases where either:
  12954. //
  12955. // 1. No key was specified
  12956. // 2. A string key was specified, but no value provided
  12957. //
  12958. // Take the "read" path and allow the get method to determine
  12959. // which value to return, respectively either:
  12960. //
  12961. // 1. The entire cache object
  12962. // 2. The data stored at the key
  12963. //
  12964. if ( key === undefined ||
  12965. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12966. return this.get( owner, key );
  12967. }
  12968. // When the key is not a string, or both a key and value
  12969. // are specified, set or extend (existing objects) with either:
  12970. //
  12971. // 1. An object of properties
  12972. // 2. A key and value
  12973. //
  12974. this.set( owner, key, value );
  12975. // Since the "set" path can have two possible entry points
  12976. // return the expected data based on which path was taken[*]
  12977. return value !== undefined ? value : key;
  12978. },
  12979. remove: function( owner, key ) {
  12980. var i,
  12981. cache = owner[ this.expando ];
  12982. if ( cache === undefined ) {
  12983. return;
  12984. }
  12985. if ( key !== undefined ) {
  12986. // Support array or space separated string of keys
  12987. if ( Array.isArray( key ) ) {
  12988. // If key is an array of keys...
  12989. // We always set camelCase keys, so remove that.
  12990. key = key.map( camelCase );
  12991. } else {
  12992. key = camelCase( key );
  12993. // If a key with the spaces exists, use it.
  12994. // Otherwise, create an array by matching non-whitespace
  12995. key = key in cache ?
  12996. [ key ] :
  12997. ( key.match( rnothtmlwhite ) || [] );
  12998. }
  12999. i = key.length;
  13000. while ( i-- ) {
  13001. delete cache[ key[ i ] ];
  13002. }
  13003. }
  13004. // Remove the expando if there's no more data
  13005. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  13006. // Support: Chrome <=35 - 45
  13007. // Webkit & Blink performance suffers when deleting properties
  13008. // from DOM nodes, so set to undefined instead
  13009. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  13010. if ( owner.nodeType ) {
  13011. owner[ this.expando ] = undefined;
  13012. } else {
  13013. delete owner[ this.expando ];
  13014. }
  13015. }
  13016. },
  13017. hasData: function( owner ) {
  13018. var cache = owner[ this.expando ];
  13019. return cache !== undefined && !jQuery.isEmptyObject( cache );
  13020. }
  13021. };
  13022. var dataPriv = new Data();
  13023. var dataUser = new Data();
  13024. // Implementation Summary
  13025. //
  13026. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  13027. // 2. Improve the module's maintainability by reducing the storage
  13028. // paths to a single mechanism.
  13029. // 3. Use the same single mechanism to support "private" and "user" data.
  13030. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  13031. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  13032. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  13033. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  13034. rmultiDash = /[A-Z]/g;
  13035. function getData( data ) {
  13036. if ( data === "true" ) {
  13037. return true;
  13038. }
  13039. if ( data === "false" ) {
  13040. return false;
  13041. }
  13042. if ( data === "null" ) {
  13043. return null;
  13044. }
  13045. // Only convert to a number if it doesn't change the string
  13046. if ( data === +data + "" ) {
  13047. return +data;
  13048. }
  13049. if ( rbrace.test( data ) ) {
  13050. return JSON.parse( data );
  13051. }
  13052. return data;
  13053. }
  13054. function dataAttr( elem, key, data ) {
  13055. var name;
  13056. // If nothing was found internally, try to fetch any
  13057. // data from the HTML5 data-* attribute
  13058. if ( data === undefined && elem.nodeType === 1 ) {
  13059. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  13060. data = elem.getAttribute( name );
  13061. if ( typeof data === "string" ) {
  13062. try {
  13063. data = getData( data );
  13064. } catch ( e ) {}
  13065. // Make sure we set the data so it isn't changed later
  13066. dataUser.set( elem, key, data );
  13067. } else {
  13068. data = undefined;
  13069. }
  13070. }
  13071. return data;
  13072. }
  13073. jQuery.extend( {
  13074. hasData: function( elem ) {
  13075. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  13076. },
  13077. data: function( elem, name, data ) {
  13078. return dataUser.access( elem, name, data );
  13079. },
  13080. removeData: function( elem, name ) {
  13081. dataUser.remove( elem, name );
  13082. },
  13083. // TODO: Now that all calls to _data and _removeData have been replaced
  13084. // with direct calls to dataPriv methods, these can be deprecated.
  13085. _data: function( elem, name, data ) {
  13086. return dataPriv.access( elem, name, data );
  13087. },
  13088. _removeData: function( elem, name ) {
  13089. dataPriv.remove( elem, name );
  13090. }
  13091. } );
  13092. jQuery.fn.extend( {
  13093. data: function( key, value ) {
  13094. var i, name, data,
  13095. elem = this[ 0 ],
  13096. attrs = elem && elem.attributes;
  13097. // Gets all values
  13098. if ( key === undefined ) {
  13099. if ( this.length ) {
  13100. data = dataUser.get( elem );
  13101. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  13102. i = attrs.length;
  13103. while ( i-- ) {
  13104. // Support: IE 11 only
  13105. // The attrs elements can be null (#14894)
  13106. if ( attrs[ i ] ) {
  13107. name = attrs[ i ].name;
  13108. if ( name.indexOf( "data-" ) === 0 ) {
  13109. name = camelCase( name.slice( 5 ) );
  13110. dataAttr( elem, name, data[ name ] );
  13111. }
  13112. }
  13113. }
  13114. dataPriv.set( elem, "hasDataAttrs", true );
  13115. }
  13116. }
  13117. return data;
  13118. }
  13119. // Sets multiple values
  13120. if ( typeof key === "object" ) {
  13121. return this.each( function() {
  13122. dataUser.set( this, key );
  13123. } );
  13124. }
  13125. return access( this, function( value ) {
  13126. var data;
  13127. // The calling jQuery object (element matches) is not empty
  13128. // (and therefore has an element appears at this[ 0 ]) and the
  13129. // `value` parameter was not undefined. An empty jQuery object
  13130. // will result in `undefined` for elem = this[ 0 ] which will
  13131. // throw an exception if an attempt to read a data cache is made.
  13132. if ( elem && value === undefined ) {
  13133. // Attempt to get data from the cache
  13134. // The key will always be camelCased in Data
  13135. data = dataUser.get( elem, key );
  13136. if ( data !== undefined ) {
  13137. return data;
  13138. }
  13139. // Attempt to "discover" the data in
  13140. // HTML5 custom data-* attrs
  13141. data = dataAttr( elem, key );
  13142. if ( data !== undefined ) {
  13143. return data;
  13144. }
  13145. // We tried really hard, but the data doesn't exist.
  13146. return;
  13147. }
  13148. // Set the data...
  13149. this.each( function() {
  13150. // We always store the camelCased key
  13151. dataUser.set( this, key, value );
  13152. } );
  13153. }, null, value, arguments.length > 1, null, true );
  13154. },
  13155. removeData: function( key ) {
  13156. return this.each( function() {
  13157. dataUser.remove( this, key );
  13158. } );
  13159. }
  13160. } );
  13161. jQuery.extend( {
  13162. queue: function( elem, type, data ) {
  13163. var queue;
  13164. if ( elem ) {
  13165. type = ( type || "fx" ) + "queue";
  13166. queue = dataPriv.get( elem, type );
  13167. // Speed up dequeue by getting out quickly if this is just a lookup
  13168. if ( data ) {
  13169. if ( !queue || Array.isArray( data ) ) {
  13170. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  13171. } else {
  13172. queue.push( data );
  13173. }
  13174. }
  13175. return queue || [];
  13176. }
  13177. },
  13178. dequeue: function( elem, type ) {
  13179. type = type || "fx";
  13180. var queue = jQuery.queue( elem, type ),
  13181. startLength = queue.length,
  13182. fn = queue.shift(),
  13183. hooks = jQuery._queueHooks( elem, type ),
  13184. next = function() {
  13185. jQuery.dequeue( elem, type );
  13186. };
  13187. // If the fx queue is dequeued, always remove the progress sentinel
  13188. if ( fn === "inprogress" ) {
  13189. fn = queue.shift();
  13190. startLength--;
  13191. }
  13192. if ( fn ) {
  13193. // Add a progress sentinel to prevent the fx queue from being
  13194. // automatically dequeued
  13195. if ( type === "fx" ) {
  13196. queue.unshift( "inprogress" );
  13197. }
  13198. // Clear up the last queue stop function
  13199. delete hooks.stop;
  13200. fn.call( elem, next, hooks );
  13201. }
  13202. if ( !startLength && hooks ) {
  13203. hooks.empty.fire();
  13204. }
  13205. },
  13206. // Not public - generate a queueHooks object, or return the current one
  13207. _queueHooks: function( elem, type ) {
  13208. var key = type + "queueHooks";
  13209. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  13210. empty: jQuery.Callbacks( "once memory" ).add( function() {
  13211. dataPriv.remove( elem, [ type + "queue", key ] );
  13212. } )
  13213. } );
  13214. }
  13215. } );
  13216. jQuery.fn.extend( {
  13217. queue: function( type, data ) {
  13218. var setter = 2;
  13219. if ( typeof type !== "string" ) {
  13220. data = type;
  13221. type = "fx";
  13222. setter--;
  13223. }
  13224. if ( arguments.length < setter ) {
  13225. return jQuery.queue( this[ 0 ], type );
  13226. }
  13227. return data === undefined ?
  13228. this :
  13229. this.each( function() {
  13230. var queue = jQuery.queue( this, type, data );
  13231. // Ensure a hooks for this queue
  13232. jQuery._queueHooks( this, type );
  13233. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  13234. jQuery.dequeue( this, type );
  13235. }
  13236. } );
  13237. },
  13238. dequeue: function( type ) {
  13239. return this.each( function() {
  13240. jQuery.dequeue( this, type );
  13241. } );
  13242. },
  13243. clearQueue: function( type ) {
  13244. return this.queue( type || "fx", [] );
  13245. },
  13246. // Get a promise resolved when queues of a certain type
  13247. // are emptied (fx is the type by default)
  13248. promise: function( type, obj ) {
  13249. var tmp,
  13250. count = 1,
  13251. defer = jQuery.Deferred(),
  13252. elements = this,
  13253. i = this.length,
  13254. resolve = function() {
  13255. if ( !( --count ) ) {
  13256. defer.resolveWith( elements, [ elements ] );
  13257. }
  13258. };
  13259. if ( typeof type !== "string" ) {
  13260. obj = type;
  13261. type = undefined;
  13262. }
  13263. type = type || "fx";
  13264. while ( i-- ) {
  13265. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  13266. if ( tmp && tmp.empty ) {
  13267. count++;
  13268. tmp.empty.add( resolve );
  13269. }
  13270. }
  13271. resolve();
  13272. return defer.promise( obj );
  13273. }
  13274. } );
  13275. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  13276. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  13277. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  13278. var documentElement = document.documentElement;
  13279. var isAttached = function( elem ) {
  13280. return jQuery.contains( elem.ownerDocument, elem );
  13281. },
  13282. composed = { composed: true };
  13283. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  13284. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  13285. // Support: iOS 10.0-10.2 only
  13286. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  13287. // leading to errors. We need to check for `getRootNode`.
  13288. if ( documentElement.getRootNode ) {
  13289. isAttached = function( elem ) {
  13290. return jQuery.contains( elem.ownerDocument, elem ) ||
  13291. elem.getRootNode( composed ) === elem.ownerDocument;
  13292. };
  13293. }
  13294. var isHiddenWithinTree = function( elem, el ) {
  13295. // isHiddenWithinTree might be called from jQuery#filter function;
  13296. // in that case, element will be second argument
  13297. elem = el || elem;
  13298. // Inline style trumps all
  13299. return elem.style.display === "none" ||
  13300. elem.style.display === "" &&
  13301. // Otherwise, check computed style
  13302. // Support: Firefox <=43 - 45
  13303. // Disconnected elements can have computed display: none, so first confirm that elem is
  13304. // in the document.
  13305. isAttached( elem ) &&
  13306. jQuery.css( elem, "display" ) === "none";
  13307. };
  13308. var swap = function( elem, options, callback, args ) {
  13309. var ret, name,
  13310. old = {};
  13311. // Remember the old values, and insert the new ones
  13312. for ( name in options ) {
  13313. old[ name ] = elem.style[ name ];
  13314. elem.style[ name ] = options[ name ];
  13315. }
  13316. ret = callback.apply( elem, args || [] );
  13317. // Revert the old values
  13318. for ( name in options ) {
  13319. elem.style[ name ] = old[ name ];
  13320. }
  13321. return ret;
  13322. };
  13323. function adjustCSS( elem, prop, valueParts, tween ) {
  13324. var adjusted, scale,
  13325. maxIterations = 20,
  13326. currentValue = tween ?
  13327. function() {
  13328. return tween.cur();
  13329. } :
  13330. function() {
  13331. return jQuery.css( elem, prop, "" );
  13332. },
  13333. initial = currentValue(),
  13334. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  13335. // Starting value computation is required for potential unit mismatches
  13336. initialInUnit = elem.nodeType &&
  13337. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  13338. rcssNum.exec( jQuery.css( elem, prop ) );
  13339. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  13340. // Support: Firefox <=54
  13341. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  13342. initial = initial / 2;
  13343. // Trust units reported by jQuery.css
  13344. unit = unit || initialInUnit[ 3 ];
  13345. // Iteratively approximate from a nonzero starting point
  13346. initialInUnit = +initial || 1;
  13347. while ( maxIterations-- ) {
  13348. // Evaluate and update our best guess (doubling guesses that zero out).
  13349. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  13350. jQuery.style( elem, prop, initialInUnit + unit );
  13351. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  13352. maxIterations = 0;
  13353. }
  13354. initialInUnit = initialInUnit / scale;
  13355. }
  13356. initialInUnit = initialInUnit * 2;
  13357. jQuery.style( elem, prop, initialInUnit + unit );
  13358. // Make sure we update the tween properties later on
  13359. valueParts = valueParts || [];
  13360. }
  13361. if ( valueParts ) {
  13362. initialInUnit = +initialInUnit || +initial || 0;
  13363. // Apply relative offset (+=/-=) if specified
  13364. adjusted = valueParts[ 1 ] ?
  13365. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  13366. +valueParts[ 2 ];
  13367. if ( tween ) {
  13368. tween.unit = unit;
  13369. tween.start = initialInUnit;
  13370. tween.end = adjusted;
  13371. }
  13372. }
  13373. return adjusted;
  13374. }
  13375. var defaultDisplayMap = {};
  13376. function getDefaultDisplay( elem ) {
  13377. var temp,
  13378. doc = elem.ownerDocument,
  13379. nodeName = elem.nodeName,
  13380. display = defaultDisplayMap[ nodeName ];
  13381. if ( display ) {
  13382. return display;
  13383. }
  13384. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  13385. display = jQuery.css( temp, "display" );
  13386. temp.parentNode.removeChild( temp );
  13387. if ( display === "none" ) {
  13388. display = "block";
  13389. }
  13390. defaultDisplayMap[ nodeName ] = display;
  13391. return display;
  13392. }
  13393. function showHide( elements, show ) {
  13394. var display, elem,
  13395. values = [],
  13396. index = 0,
  13397. length = elements.length;
  13398. // Determine new display value for elements that need to change
  13399. for ( ; index < length; index++ ) {
  13400. elem = elements[ index ];
  13401. if ( !elem.style ) {
  13402. continue;
  13403. }
  13404. display = elem.style.display;
  13405. if ( show ) {
  13406. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  13407. // check is required in this first loop unless we have a nonempty display value (either
  13408. // inline or about-to-be-restored)
  13409. if ( display === "none" ) {
  13410. values[ index ] = dataPriv.get( elem, "display" ) || null;
  13411. if ( !values[ index ] ) {
  13412. elem.style.display = "";
  13413. }
  13414. }
  13415. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  13416. values[ index ] = getDefaultDisplay( elem );
  13417. }
  13418. } else {
  13419. if ( display !== "none" ) {
  13420. values[ index ] = "none";
  13421. // Remember what we're overwriting
  13422. dataPriv.set( elem, "display", display );
  13423. }
  13424. }
  13425. }
  13426. // Set the display of the elements in a second loop to avoid constant reflow
  13427. for ( index = 0; index < length; index++ ) {
  13428. if ( values[ index ] != null ) {
  13429. elements[ index ].style.display = values[ index ];
  13430. }
  13431. }
  13432. return elements;
  13433. }
  13434. jQuery.fn.extend( {
  13435. show: function() {
  13436. return showHide( this, true );
  13437. },
  13438. hide: function() {
  13439. return showHide( this );
  13440. },
  13441. toggle: function( state ) {
  13442. if ( typeof state === "boolean" ) {
  13443. return state ? this.show() : this.hide();
  13444. }
  13445. return this.each( function() {
  13446. if ( isHiddenWithinTree( this ) ) {
  13447. jQuery( this ).show();
  13448. } else {
  13449. jQuery( this ).hide();
  13450. }
  13451. } );
  13452. }
  13453. } );
  13454. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  13455. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  13456. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  13457. // We have to close these tags to support XHTML (#13200)
  13458. var wrapMap = {
  13459. // Support: IE <=9 only
  13460. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  13461. // XHTML parsers do not magically insert elements in the
  13462. // same way that tag soup parsers do. So we cannot shorten
  13463. // this by omitting <tbody> or other required elements.
  13464. thead: [ 1, "<table>", "</table>" ],
  13465. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  13466. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  13467. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  13468. _default: [ 0, "", "" ]
  13469. };
  13470. // Support: IE <=9 only
  13471. wrapMap.optgroup = wrapMap.option;
  13472. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  13473. wrapMap.th = wrapMap.td;
  13474. function getAll( context, tag ) {
  13475. // Support: IE <=9 - 11 only
  13476. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  13477. var ret;
  13478. if ( typeof context.getElementsByTagName !== "undefined" ) {
  13479. ret = context.getElementsByTagName( tag || "*" );
  13480. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  13481. ret = context.querySelectorAll( tag || "*" );
  13482. } else {
  13483. ret = [];
  13484. }
  13485. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  13486. return jQuery.merge( [ context ], ret );
  13487. }
  13488. return ret;
  13489. }
  13490. // Mark scripts as having already been evaluated
  13491. function setGlobalEval( elems, refElements ) {
  13492. var i = 0,
  13493. l = elems.length;
  13494. for ( ; i < l; i++ ) {
  13495. dataPriv.set(
  13496. elems[ i ],
  13497. "globalEval",
  13498. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  13499. );
  13500. }
  13501. }
  13502. var rhtml = /<|&#?\w+;/;
  13503. function buildFragment( elems, context, scripts, selection, ignored ) {
  13504. var elem, tmp, tag, wrap, attached, j,
  13505. fragment = context.createDocumentFragment(),
  13506. nodes = [],
  13507. i = 0,
  13508. l = elems.length;
  13509. for ( ; i < l; i++ ) {
  13510. elem = elems[ i ];
  13511. if ( elem || elem === 0 ) {
  13512. // Add nodes directly
  13513. if ( toType( elem ) === "object" ) {
  13514. // Support: Android <=4.0 only, PhantomJS 1 only
  13515. // push.apply(_, arraylike) throws on ancient WebKit
  13516. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  13517. // Convert non-html into a text node
  13518. } else if ( !rhtml.test( elem ) ) {
  13519. nodes.push( context.createTextNode( elem ) );
  13520. // Convert html into DOM nodes
  13521. } else {
  13522. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  13523. // Deserialize a standard representation
  13524. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  13525. wrap = wrapMap[ tag ] || wrapMap._default;
  13526. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  13527. // Descend through wrappers to the right content
  13528. j = wrap[ 0 ];
  13529. while ( j-- ) {
  13530. tmp = tmp.lastChild;
  13531. }
  13532. // Support: Android <=4.0 only, PhantomJS 1 only
  13533. // push.apply(_, arraylike) throws on ancient WebKit
  13534. jQuery.merge( nodes, tmp.childNodes );
  13535. // Remember the top-level container
  13536. tmp = fragment.firstChild;
  13537. // Ensure the created nodes are orphaned (#12392)
  13538. tmp.textContent = "";
  13539. }
  13540. }
  13541. }
  13542. // Remove wrapper from fragment
  13543. fragment.textContent = "";
  13544. i = 0;
  13545. while ( ( elem = nodes[ i++ ] ) ) {
  13546. // Skip elements already in the context collection (trac-4087)
  13547. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  13548. if ( ignored ) {
  13549. ignored.push( elem );
  13550. }
  13551. continue;
  13552. }
  13553. attached = isAttached( elem );
  13554. // Append to fragment
  13555. tmp = getAll( fragment.appendChild( elem ), "script" );
  13556. // Preserve script evaluation history
  13557. if ( attached ) {
  13558. setGlobalEval( tmp );
  13559. }
  13560. // Capture executables
  13561. if ( scripts ) {
  13562. j = 0;
  13563. while ( ( elem = tmp[ j++ ] ) ) {
  13564. if ( rscriptType.test( elem.type || "" ) ) {
  13565. scripts.push( elem );
  13566. }
  13567. }
  13568. }
  13569. }
  13570. return fragment;
  13571. }
  13572. ( function() {
  13573. var fragment = document.createDocumentFragment(),
  13574. div = fragment.appendChild( document.createElement( "div" ) ),
  13575. input = document.createElement( "input" );
  13576. // Support: Android 4.0 - 4.3 only
  13577. // Check state lost if the name is set (#11217)
  13578. // Support: Windows Web Apps (WWA)
  13579. // `name` and `type` must use .setAttribute for WWA (#14901)
  13580. input.setAttribute( "type", "radio" );
  13581. input.setAttribute( "checked", "checked" );
  13582. input.setAttribute( "name", "t" );
  13583. div.appendChild( input );
  13584. // Support: Android <=4.1 only
  13585. // Older WebKit doesn't clone checked state correctly in fragments
  13586. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  13587. // Support: IE <=11 only
  13588. // Make sure textarea (and checkbox) defaultValue is properly cloned
  13589. div.innerHTML = "<textarea>x</textarea>";
  13590. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  13591. } )();
  13592. var
  13593. rkeyEvent = /^key/,
  13594. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  13595. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  13596. function returnTrue() {
  13597. return true;
  13598. }
  13599. function returnFalse() {
  13600. return false;
  13601. }
  13602. // Support: IE <=9 - 11+
  13603. // focus() and blur() are asynchronous, except when they are no-op.
  13604. // So expect focus to be synchronous when the element is already active,
  13605. // and blur to be synchronous when the element is not already active.
  13606. // (focus and blur are always synchronous in other supported browsers,
  13607. // this just defines when we can count on it).
  13608. function expectSync( elem, type ) {
  13609. return ( elem === safeActiveElement() ) === ( type === "focus" );
  13610. }
  13611. // Support: IE <=9 only
  13612. // Accessing document.activeElement can throw unexpectedly
  13613. // https://bugs.jquery.com/ticket/13393
  13614. function safeActiveElement() {
  13615. try {
  13616. return document.activeElement;
  13617. } catch ( err ) { }
  13618. }
  13619. function on( elem, types, selector, data, fn, one ) {
  13620. var origFn, type;
  13621. // Types can be a map of types/handlers
  13622. if ( typeof types === "object" ) {
  13623. // ( types-Object, selector, data )
  13624. if ( typeof selector !== "string" ) {
  13625. // ( types-Object, data )
  13626. data = data || selector;
  13627. selector = undefined;
  13628. }
  13629. for ( type in types ) {
  13630. on( elem, type, selector, data, types[ type ], one );
  13631. }
  13632. return elem;
  13633. }
  13634. if ( data == null && fn == null ) {
  13635. // ( types, fn )
  13636. fn = selector;
  13637. data = selector = undefined;
  13638. } else if ( fn == null ) {
  13639. if ( typeof selector === "string" ) {
  13640. // ( types, selector, fn )
  13641. fn = data;
  13642. data = undefined;
  13643. } else {
  13644. // ( types, data, fn )
  13645. fn = data;
  13646. data = selector;
  13647. selector = undefined;
  13648. }
  13649. }
  13650. if ( fn === false ) {
  13651. fn = returnFalse;
  13652. } else if ( !fn ) {
  13653. return elem;
  13654. }
  13655. if ( one === 1 ) {
  13656. origFn = fn;
  13657. fn = function( event ) {
  13658. // Can use an empty set, since event contains the info
  13659. jQuery().off( event );
  13660. return origFn.apply( this, arguments );
  13661. };
  13662. // Use same guid so caller can remove using origFn
  13663. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  13664. }
  13665. return elem.each( function() {
  13666. jQuery.event.add( this, types, fn, data, selector );
  13667. } );
  13668. }
  13669. /*
  13670. * Helper functions for managing events -- not part of the public interface.
  13671. * Props to Dean Edwards' addEvent library for many of the ideas.
  13672. */
  13673. jQuery.event = {
  13674. global: {},
  13675. add: function( elem, types, handler, data, selector ) {
  13676. var handleObjIn, eventHandle, tmp,
  13677. events, t, handleObj,
  13678. special, handlers, type, namespaces, origType,
  13679. elemData = dataPriv.get( elem );
  13680. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  13681. if ( !elemData ) {
  13682. return;
  13683. }
  13684. // Caller can pass in an object of custom data in lieu of the handler
  13685. if ( handler.handler ) {
  13686. handleObjIn = handler;
  13687. handler = handleObjIn.handler;
  13688. selector = handleObjIn.selector;
  13689. }
  13690. // Ensure that invalid selectors throw exceptions at attach time
  13691. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  13692. if ( selector ) {
  13693. jQuery.find.matchesSelector( documentElement, selector );
  13694. }
  13695. // Make sure that the handler has a unique ID, used to find/remove it later
  13696. if ( !handler.guid ) {
  13697. handler.guid = jQuery.guid++;
  13698. }
  13699. // Init the element's event structure and main handler, if this is the first
  13700. if ( !( events = elemData.events ) ) {
  13701. events = elemData.events = {};
  13702. }
  13703. if ( !( eventHandle = elemData.handle ) ) {
  13704. eventHandle = elemData.handle = function( e ) {
  13705. // Discard the second event of a jQuery.event.trigger() and
  13706. // when an event is called after a page has unloaded
  13707. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  13708. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  13709. };
  13710. }
  13711. // Handle multiple events separated by a space
  13712. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13713. t = types.length;
  13714. while ( t-- ) {
  13715. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13716. type = origType = tmp[ 1 ];
  13717. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13718. // There *must* be a type, no attaching namespace-only handlers
  13719. if ( !type ) {
  13720. continue;
  13721. }
  13722. // If event changes its type, use the special event handlers for the changed type
  13723. special = jQuery.event.special[ type ] || {};
  13724. // If selector defined, determine special event api type, otherwise given type
  13725. type = ( selector ? special.delegateType : special.bindType ) || type;
  13726. // Update special based on newly reset type
  13727. special = jQuery.event.special[ type ] || {};
  13728. // handleObj is passed to all event handlers
  13729. handleObj = jQuery.extend( {
  13730. type: type,
  13731. origType: origType,
  13732. data: data,
  13733. handler: handler,
  13734. guid: handler.guid,
  13735. selector: selector,
  13736. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  13737. namespace: namespaces.join( "." )
  13738. }, handleObjIn );
  13739. // Init the event handler queue if we're the first
  13740. if ( !( handlers = events[ type ] ) ) {
  13741. handlers = events[ type ] = [];
  13742. handlers.delegateCount = 0;
  13743. // Only use addEventListener if the special events handler returns false
  13744. if ( !special.setup ||
  13745. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  13746. if ( elem.addEventListener ) {
  13747. elem.addEventListener( type, eventHandle );
  13748. }
  13749. }
  13750. }
  13751. if ( special.add ) {
  13752. special.add.call( elem, handleObj );
  13753. if ( !handleObj.handler.guid ) {
  13754. handleObj.handler.guid = handler.guid;
  13755. }
  13756. }
  13757. // Add to the element's handler list, delegates in front
  13758. if ( selector ) {
  13759. handlers.splice( handlers.delegateCount++, 0, handleObj );
  13760. } else {
  13761. handlers.push( handleObj );
  13762. }
  13763. // Keep track of which events have ever been used, for event optimization
  13764. jQuery.event.global[ type ] = true;
  13765. }
  13766. },
  13767. // Detach an event or set of events from an element
  13768. remove: function( elem, types, handler, selector, mappedTypes ) {
  13769. var j, origCount, tmp,
  13770. events, t, handleObj,
  13771. special, handlers, type, namespaces, origType,
  13772. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  13773. if ( !elemData || !( events = elemData.events ) ) {
  13774. return;
  13775. }
  13776. // Once for each type.namespace in types; type may be omitted
  13777. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13778. t = types.length;
  13779. while ( t-- ) {
  13780. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13781. type = origType = tmp[ 1 ];
  13782. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13783. // Unbind all events (on this namespace, if provided) for the element
  13784. if ( !type ) {
  13785. for ( type in events ) {
  13786. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  13787. }
  13788. continue;
  13789. }
  13790. special = jQuery.event.special[ type ] || {};
  13791. type = ( selector ? special.delegateType : special.bindType ) || type;
  13792. handlers = events[ type ] || [];
  13793. tmp = tmp[ 2 ] &&
  13794. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  13795. // Remove matching events
  13796. origCount = j = handlers.length;
  13797. while ( j-- ) {
  13798. handleObj = handlers[ j ];
  13799. if ( ( mappedTypes || origType === handleObj.origType ) &&
  13800. ( !handler || handler.guid === handleObj.guid ) &&
  13801. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  13802. ( !selector || selector === handleObj.selector ||
  13803. selector === "**" && handleObj.selector ) ) {
  13804. handlers.splice( j, 1 );
  13805. if ( handleObj.selector ) {
  13806. handlers.delegateCount--;
  13807. }
  13808. if ( special.remove ) {
  13809. special.remove.call( elem, handleObj );
  13810. }
  13811. }
  13812. }
  13813. // Remove generic event handler if we removed something and no more handlers exist
  13814. // (avoids potential for endless recursion during removal of special event handlers)
  13815. if ( origCount && !handlers.length ) {
  13816. if ( !special.teardown ||
  13817. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  13818. jQuery.removeEvent( elem, type, elemData.handle );
  13819. }
  13820. delete events[ type ];
  13821. }
  13822. }
  13823. // Remove data and the expando if it's no longer used
  13824. if ( jQuery.isEmptyObject( events ) ) {
  13825. dataPriv.remove( elem, "handle events" );
  13826. }
  13827. },
  13828. dispatch: function( nativeEvent ) {
  13829. // Make a writable jQuery.Event from the native event object
  13830. var event = jQuery.event.fix( nativeEvent );
  13831. var i, j, ret, matched, handleObj, handlerQueue,
  13832. args = new Array( arguments.length ),
  13833. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  13834. special = jQuery.event.special[ event.type ] || {};
  13835. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  13836. args[ 0 ] = event;
  13837. for ( i = 1; i < arguments.length; i++ ) {
  13838. args[ i ] = arguments[ i ];
  13839. }
  13840. event.delegateTarget = this;
  13841. // Call the preDispatch hook for the mapped type, and let it bail if desired
  13842. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  13843. return;
  13844. }
  13845. // Determine handlers
  13846. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  13847. // Run delegates first; they may want to stop propagation beneath us
  13848. i = 0;
  13849. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  13850. event.currentTarget = matched.elem;
  13851. j = 0;
  13852. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  13853. !event.isImmediatePropagationStopped() ) {
  13854. // If the event is namespaced, then each handler is only invoked if it is
  13855. // specially universal or its namespaces are a superset of the event's.
  13856. if ( !event.rnamespace || handleObj.namespace === false ||
  13857. event.rnamespace.test( handleObj.namespace ) ) {
  13858. event.handleObj = handleObj;
  13859. event.data = handleObj.data;
  13860. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  13861. handleObj.handler ).apply( matched.elem, args );
  13862. if ( ret !== undefined ) {
  13863. if ( ( event.result = ret ) === false ) {
  13864. event.preventDefault();
  13865. event.stopPropagation();
  13866. }
  13867. }
  13868. }
  13869. }
  13870. }
  13871. // Call the postDispatch hook for the mapped type
  13872. if ( special.postDispatch ) {
  13873. special.postDispatch.call( this, event );
  13874. }
  13875. return event.result;
  13876. },
  13877. handlers: function( event, handlers ) {
  13878. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  13879. handlerQueue = [],
  13880. delegateCount = handlers.delegateCount,
  13881. cur = event.target;
  13882. // Find delegate handlers
  13883. if ( delegateCount &&
  13884. // Support: IE <=9
  13885. // Black-hole SVG <use> instance trees (trac-13180)
  13886. cur.nodeType &&
  13887. // Support: Firefox <=42
  13888. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  13889. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  13890. // Support: IE 11 only
  13891. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  13892. !( event.type === "click" && event.button >= 1 ) ) {
  13893. for ( ; cur !== this; cur = cur.parentNode || this ) {
  13894. // Don't check non-elements (#13208)
  13895. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  13896. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  13897. matchedHandlers = [];
  13898. matchedSelectors = {};
  13899. for ( i = 0; i < delegateCount; i++ ) {
  13900. handleObj = handlers[ i ];
  13901. // Don't conflict with Object.prototype properties (#13203)
  13902. sel = handleObj.selector + " ";
  13903. if ( matchedSelectors[ sel ] === undefined ) {
  13904. matchedSelectors[ sel ] = handleObj.needsContext ?
  13905. jQuery( sel, this ).index( cur ) > -1 :
  13906. jQuery.find( sel, this, null, [ cur ] ).length;
  13907. }
  13908. if ( matchedSelectors[ sel ] ) {
  13909. matchedHandlers.push( handleObj );
  13910. }
  13911. }
  13912. if ( matchedHandlers.length ) {
  13913. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  13914. }
  13915. }
  13916. }
  13917. }
  13918. // Add the remaining (directly-bound) handlers
  13919. cur = this;
  13920. if ( delegateCount < handlers.length ) {
  13921. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  13922. }
  13923. return handlerQueue;
  13924. },
  13925. addProp: function( name, hook ) {
  13926. Object.defineProperty( jQuery.Event.prototype, name, {
  13927. enumerable: true,
  13928. configurable: true,
  13929. get: isFunction( hook ) ?
  13930. function() {
  13931. if ( this.originalEvent ) {
  13932. return hook( this.originalEvent );
  13933. }
  13934. } :
  13935. function() {
  13936. if ( this.originalEvent ) {
  13937. return this.originalEvent[ name ];
  13938. }
  13939. },
  13940. set: function( value ) {
  13941. Object.defineProperty( this, name, {
  13942. enumerable: true,
  13943. configurable: true,
  13944. writable: true,
  13945. value: value
  13946. } );
  13947. }
  13948. } );
  13949. },
  13950. fix: function( originalEvent ) {
  13951. return originalEvent[ jQuery.expando ] ?
  13952. originalEvent :
  13953. new jQuery.Event( originalEvent );
  13954. },
  13955. special: {
  13956. load: {
  13957. // Prevent triggered image.load events from bubbling to window.load
  13958. noBubble: true
  13959. },
  13960. click: {
  13961. // Utilize native event to ensure correct state for checkable inputs
  13962. setup: function( data ) {
  13963. // For mutual compressibility with _default, replace `this` access with a local var.
  13964. // `|| data` is dead code meant only to preserve the variable through minification.
  13965. var el = this || data;
  13966. // Claim the first handler
  13967. if ( rcheckableType.test( el.type ) &&
  13968. el.click && nodeName( el, "input" ) ) {
  13969. // dataPriv.set( el, "click", ... )
  13970. leverageNative( el, "click", returnTrue );
  13971. }
  13972. // Return false to allow normal processing in the caller
  13973. return false;
  13974. },
  13975. trigger: function( data ) {
  13976. // For mutual compressibility with _default, replace `this` access with a local var.
  13977. // `|| data` is dead code meant only to preserve the variable through minification.
  13978. var el = this || data;
  13979. // Force setup before triggering a click
  13980. if ( rcheckableType.test( el.type ) &&
  13981. el.click && nodeName( el, "input" ) ) {
  13982. leverageNative( el, "click" );
  13983. }
  13984. // Return non-false to allow normal event-path propagation
  13985. return true;
  13986. },
  13987. // For cross-browser consistency, suppress native .click() on links
  13988. // Also prevent it if we're currently inside a leveraged native-event stack
  13989. _default: function( event ) {
  13990. var target = event.target;
  13991. return rcheckableType.test( target.type ) &&
  13992. target.click && nodeName( target, "input" ) &&
  13993. dataPriv.get( target, "click" ) ||
  13994. nodeName( target, "a" );
  13995. }
  13996. },
  13997. beforeunload: {
  13998. postDispatch: function( event ) {
  13999. // Support: Firefox 20+
  14000. // Firefox doesn't alert if the returnValue field is not set.
  14001. if ( event.result !== undefined && event.originalEvent ) {
  14002. event.originalEvent.returnValue = event.result;
  14003. }
  14004. }
  14005. }
  14006. }
  14007. };
  14008. // Ensure the presence of an event listener that handles manually-triggered
  14009. // synthetic events by interrupting progress until reinvoked in response to
  14010. // *native* events that it fires directly, ensuring that state changes have
  14011. // already occurred before other listeners are invoked.
  14012. function leverageNative( el, type, expectSync ) {
  14013. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  14014. if ( !expectSync ) {
  14015. if ( dataPriv.get( el, type ) === undefined ) {
  14016. jQuery.event.add( el, type, returnTrue );
  14017. }
  14018. return;
  14019. }
  14020. // Register the controller as a special universal handler for all event namespaces
  14021. dataPriv.set( el, type, false );
  14022. jQuery.event.add( el, type, {
  14023. namespace: false,
  14024. handler: function( event ) {
  14025. var notAsync, result,
  14026. saved = dataPriv.get( this, type );
  14027. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  14028. // Interrupt processing of the outer synthetic .trigger()ed event
  14029. // Saved data should be false in such cases, but might be a leftover capture object
  14030. // from an async native handler (gh-4350)
  14031. if ( !saved.length ) {
  14032. // Store arguments for use when handling the inner native event
  14033. // There will always be at least one argument (an event object), so this array
  14034. // will not be confused with a leftover capture object.
  14035. saved = slice.call( arguments );
  14036. dataPriv.set( this, type, saved );
  14037. // Trigger the native event and capture its result
  14038. // Support: IE <=9 - 11+
  14039. // focus() and blur() are asynchronous
  14040. notAsync = expectSync( this, type );
  14041. this[ type ]();
  14042. result = dataPriv.get( this, type );
  14043. if ( saved !== result || notAsync ) {
  14044. dataPriv.set( this, type, false );
  14045. } else {
  14046. result = {};
  14047. }
  14048. if ( saved !== result ) {
  14049. // Cancel the outer synthetic event
  14050. event.stopImmediatePropagation();
  14051. event.preventDefault();
  14052. return result.value;
  14053. }
  14054. // If this is an inner synthetic event for an event with a bubbling surrogate
  14055. // (focus or blur), assume that the surrogate already propagated from triggering the
  14056. // native event and prevent that from happening again here.
  14057. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  14058. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  14059. // less bad than duplication.
  14060. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  14061. event.stopPropagation();
  14062. }
  14063. // If this is a native event triggered above, everything is now in order
  14064. // Fire an inner synthetic event with the original arguments
  14065. } else if ( saved.length ) {
  14066. // ...and capture the result
  14067. dataPriv.set( this, type, {
  14068. value: jQuery.event.trigger(
  14069. // Support: IE <=9 - 11+
  14070. // Extend with the prototype to reset the above stopImmediatePropagation()
  14071. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  14072. saved.slice( 1 ),
  14073. this
  14074. )
  14075. } );
  14076. // Abort handling of the native event
  14077. event.stopImmediatePropagation();
  14078. }
  14079. }
  14080. } );
  14081. }
  14082. jQuery.removeEvent = function( elem, type, handle ) {
  14083. // This "if" is needed for plain objects
  14084. if ( elem.removeEventListener ) {
  14085. elem.removeEventListener( type, handle );
  14086. }
  14087. };
  14088. jQuery.Event = function( src, props ) {
  14089. // Allow instantiation without the 'new' keyword
  14090. if ( !( this instanceof jQuery.Event ) ) {
  14091. return new jQuery.Event( src, props );
  14092. }
  14093. // Event object
  14094. if ( src && src.type ) {
  14095. this.originalEvent = src;
  14096. this.type = src.type;
  14097. // Events bubbling up the document may have been marked as prevented
  14098. // by a handler lower down the tree; reflect the correct value.
  14099. this.isDefaultPrevented = src.defaultPrevented ||
  14100. src.defaultPrevented === undefined &&
  14101. // Support: Android <=2.3 only
  14102. src.returnValue === false ?
  14103. returnTrue :
  14104. returnFalse;
  14105. // Create target properties
  14106. // Support: Safari <=6 - 7 only
  14107. // Target should not be a text node (#504, #13143)
  14108. this.target = ( src.target && src.target.nodeType === 3 ) ?
  14109. src.target.parentNode :
  14110. src.target;
  14111. this.currentTarget = src.currentTarget;
  14112. this.relatedTarget = src.relatedTarget;
  14113. // Event type
  14114. } else {
  14115. this.type = src;
  14116. }
  14117. // Put explicitly provided properties onto the event object
  14118. if ( props ) {
  14119. jQuery.extend( this, props );
  14120. }
  14121. // Create a timestamp if incoming event doesn't have one
  14122. this.timeStamp = src && src.timeStamp || Date.now();
  14123. // Mark it as fixed
  14124. this[ jQuery.expando ] = true;
  14125. };
  14126. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  14127. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  14128. jQuery.Event.prototype = {
  14129. constructor: jQuery.Event,
  14130. isDefaultPrevented: returnFalse,
  14131. isPropagationStopped: returnFalse,
  14132. isImmediatePropagationStopped: returnFalse,
  14133. isSimulated: false,
  14134. preventDefault: function() {
  14135. var e = this.originalEvent;
  14136. this.isDefaultPrevented = returnTrue;
  14137. if ( e && !this.isSimulated ) {
  14138. e.preventDefault();
  14139. }
  14140. },
  14141. stopPropagation: function() {
  14142. var e = this.originalEvent;
  14143. this.isPropagationStopped = returnTrue;
  14144. if ( e && !this.isSimulated ) {
  14145. e.stopPropagation();
  14146. }
  14147. },
  14148. stopImmediatePropagation: function() {
  14149. var e = this.originalEvent;
  14150. this.isImmediatePropagationStopped = returnTrue;
  14151. if ( e && !this.isSimulated ) {
  14152. e.stopImmediatePropagation();
  14153. }
  14154. this.stopPropagation();
  14155. }
  14156. };
  14157. // Includes all common event props including KeyEvent and MouseEvent specific props
  14158. jQuery.each( {
  14159. altKey: true,
  14160. bubbles: true,
  14161. cancelable: true,
  14162. changedTouches: true,
  14163. ctrlKey: true,
  14164. detail: true,
  14165. eventPhase: true,
  14166. metaKey: true,
  14167. pageX: true,
  14168. pageY: true,
  14169. shiftKey: true,
  14170. view: true,
  14171. "char": true,
  14172. code: true,
  14173. charCode: true,
  14174. key: true,
  14175. keyCode: true,
  14176. button: true,
  14177. buttons: true,
  14178. clientX: true,
  14179. clientY: true,
  14180. offsetX: true,
  14181. offsetY: true,
  14182. pointerId: true,
  14183. pointerType: true,
  14184. screenX: true,
  14185. screenY: true,
  14186. targetTouches: true,
  14187. toElement: true,
  14188. touches: true,
  14189. which: function( event ) {
  14190. var button = event.button;
  14191. // Add which for key events
  14192. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  14193. return event.charCode != null ? event.charCode : event.keyCode;
  14194. }
  14195. // Add which for click: 1 === left; 2 === middle; 3 === right
  14196. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  14197. if ( button & 1 ) {
  14198. return 1;
  14199. }
  14200. if ( button & 2 ) {
  14201. return 3;
  14202. }
  14203. if ( button & 4 ) {
  14204. return 2;
  14205. }
  14206. return 0;
  14207. }
  14208. return event.which;
  14209. }
  14210. }, jQuery.event.addProp );
  14211. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  14212. jQuery.event.special[ type ] = {
  14213. // Utilize native event if possible so blur/focus sequence is correct
  14214. setup: function() {
  14215. // Claim the first handler
  14216. // dataPriv.set( this, "focus", ... )
  14217. // dataPriv.set( this, "blur", ... )
  14218. leverageNative( this, type, expectSync );
  14219. // Return false to allow normal processing in the caller
  14220. return false;
  14221. },
  14222. trigger: function() {
  14223. // Force setup before trigger
  14224. leverageNative( this, type );
  14225. // Return non-false to allow normal event-path propagation
  14226. return true;
  14227. },
  14228. delegateType: delegateType
  14229. };
  14230. } );
  14231. // Create mouseenter/leave events using mouseover/out and event-time checks
  14232. // so that event delegation works in jQuery.
  14233. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  14234. //
  14235. // Support: Safari 7 only
  14236. // Safari sends mouseenter too often; see:
  14237. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  14238. // for the description of the bug (it existed in older Chrome versions as well).
  14239. jQuery.each( {
  14240. mouseenter: "mouseover",
  14241. mouseleave: "mouseout",
  14242. pointerenter: "pointerover",
  14243. pointerleave: "pointerout"
  14244. }, function( orig, fix ) {
  14245. jQuery.event.special[ orig ] = {
  14246. delegateType: fix,
  14247. bindType: fix,
  14248. handle: function( event ) {
  14249. var ret,
  14250. target = this,
  14251. related = event.relatedTarget,
  14252. handleObj = event.handleObj;
  14253. // For mouseenter/leave call the handler if related is outside the target.
  14254. // NB: No relatedTarget if the mouse left/entered the browser window
  14255. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  14256. event.type = handleObj.origType;
  14257. ret = handleObj.handler.apply( this, arguments );
  14258. event.type = fix;
  14259. }
  14260. return ret;
  14261. }
  14262. };
  14263. } );
  14264. jQuery.fn.extend( {
  14265. on: function( types, selector, data, fn ) {
  14266. return on( this, types, selector, data, fn );
  14267. },
  14268. one: function( types, selector, data, fn ) {
  14269. return on( this, types, selector, data, fn, 1 );
  14270. },
  14271. off: function( types, selector, fn ) {
  14272. var handleObj, type;
  14273. if ( types && types.preventDefault && types.handleObj ) {
  14274. // ( event ) dispatched jQuery.Event
  14275. handleObj = types.handleObj;
  14276. jQuery( types.delegateTarget ).off(
  14277. handleObj.namespace ?
  14278. handleObj.origType + "." + handleObj.namespace :
  14279. handleObj.origType,
  14280. handleObj.selector,
  14281. handleObj.handler
  14282. );
  14283. return this;
  14284. }
  14285. if ( typeof types === "object" ) {
  14286. // ( types-object [, selector] )
  14287. for ( type in types ) {
  14288. this.off( type, selector, types[ type ] );
  14289. }
  14290. return this;
  14291. }
  14292. if ( selector === false || typeof selector === "function" ) {
  14293. // ( types [, fn] )
  14294. fn = selector;
  14295. selector = undefined;
  14296. }
  14297. if ( fn === false ) {
  14298. fn = returnFalse;
  14299. }
  14300. return this.each( function() {
  14301. jQuery.event.remove( this, types, fn, selector );
  14302. } );
  14303. }
  14304. } );
  14305. var
  14306. /* eslint-disable max-len */
  14307. // See https://github.com/eslint/eslint/issues/3229
  14308. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  14309. /* eslint-enable */
  14310. // Support: IE <=10 - 11, Edge 12 - 13 only
  14311. // In IE/Edge using regex groups here causes severe slowdowns.
  14312. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  14313. rnoInnerhtml = /<script|<style|<link/i,
  14314. // checked="checked" or checked
  14315. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  14316. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  14317. // Prefer a tbody over its parent table for containing new rows
  14318. function manipulationTarget( elem, content ) {
  14319. if ( nodeName( elem, "table" ) &&
  14320. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  14321. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  14322. }
  14323. return elem;
  14324. }
  14325. // Replace/restore the type attribute of script elements for safe DOM manipulation
  14326. function disableScript( elem ) {
  14327. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  14328. return elem;
  14329. }
  14330. function restoreScript( elem ) {
  14331. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  14332. elem.type = elem.type.slice( 5 );
  14333. } else {
  14334. elem.removeAttribute( "type" );
  14335. }
  14336. return elem;
  14337. }
  14338. function cloneCopyEvent( src, dest ) {
  14339. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  14340. if ( dest.nodeType !== 1 ) {
  14341. return;
  14342. }
  14343. // 1. Copy private data: events, handlers, etc.
  14344. if ( dataPriv.hasData( src ) ) {
  14345. pdataOld = dataPriv.access( src );
  14346. pdataCur = dataPriv.set( dest, pdataOld );
  14347. events = pdataOld.events;
  14348. if ( events ) {
  14349. delete pdataCur.handle;
  14350. pdataCur.events = {};
  14351. for ( type in events ) {
  14352. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  14353. jQuery.event.add( dest, type, events[ type ][ i ] );
  14354. }
  14355. }
  14356. }
  14357. }
  14358. // 2. Copy user data
  14359. if ( dataUser.hasData( src ) ) {
  14360. udataOld = dataUser.access( src );
  14361. udataCur = jQuery.extend( {}, udataOld );
  14362. dataUser.set( dest, udataCur );
  14363. }
  14364. }
  14365. // Fix IE bugs, see support tests
  14366. function fixInput( src, dest ) {
  14367. var nodeName = dest.nodeName.toLowerCase();
  14368. // Fails to persist the checked state of a cloned checkbox or radio button.
  14369. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  14370. dest.checked = src.checked;
  14371. // Fails to return the selected option to the default selected state when cloning options
  14372. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  14373. dest.defaultValue = src.defaultValue;
  14374. }
  14375. }
  14376. function domManip( collection, args, callback, ignored ) {
  14377. // Flatten any nested arrays
  14378. args = concat.apply( [], args );
  14379. var fragment, first, scripts, hasScripts, node, doc,
  14380. i = 0,
  14381. l = collection.length,
  14382. iNoClone = l - 1,
  14383. value = args[ 0 ],
  14384. valueIsFunction = isFunction( value );
  14385. // We can't cloneNode fragments that contain checked, in WebKit
  14386. if ( valueIsFunction ||
  14387. ( l > 1 && typeof value === "string" &&
  14388. !support.checkClone && rchecked.test( value ) ) ) {
  14389. return collection.each( function( index ) {
  14390. var self = collection.eq( index );
  14391. if ( valueIsFunction ) {
  14392. args[ 0 ] = value.call( this, index, self.html() );
  14393. }
  14394. domManip( self, args, callback, ignored );
  14395. } );
  14396. }
  14397. if ( l ) {
  14398. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  14399. first = fragment.firstChild;
  14400. if ( fragment.childNodes.length === 1 ) {
  14401. fragment = first;
  14402. }
  14403. // Require either new content or an interest in ignored elements to invoke the callback
  14404. if ( first || ignored ) {
  14405. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  14406. hasScripts = scripts.length;
  14407. // Use the original fragment for the last item
  14408. // instead of the first because it can end up
  14409. // being emptied incorrectly in certain situations (#8070).
  14410. for ( ; i < l; i++ ) {
  14411. node = fragment;
  14412. if ( i !== iNoClone ) {
  14413. node = jQuery.clone( node, true, true );
  14414. // Keep references to cloned scripts for later restoration
  14415. if ( hasScripts ) {
  14416. // Support: Android <=4.0 only, PhantomJS 1 only
  14417. // push.apply(_, arraylike) throws on ancient WebKit
  14418. jQuery.merge( scripts, getAll( node, "script" ) );
  14419. }
  14420. }
  14421. callback.call( collection[ i ], node, i );
  14422. }
  14423. if ( hasScripts ) {
  14424. doc = scripts[ scripts.length - 1 ].ownerDocument;
  14425. // Reenable scripts
  14426. jQuery.map( scripts, restoreScript );
  14427. // Evaluate executable scripts on first document insertion
  14428. for ( i = 0; i < hasScripts; i++ ) {
  14429. node = scripts[ i ];
  14430. if ( rscriptType.test( node.type || "" ) &&
  14431. !dataPriv.access( node, "globalEval" ) &&
  14432. jQuery.contains( doc, node ) ) {
  14433. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  14434. // Optional AJAX dependency, but won't run scripts if not present
  14435. if ( jQuery._evalUrl && !node.noModule ) {
  14436. jQuery._evalUrl( node.src, {
  14437. nonce: node.nonce || node.getAttribute( "nonce" )
  14438. } );
  14439. }
  14440. } else {
  14441. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  14442. }
  14443. }
  14444. }
  14445. }
  14446. }
  14447. }
  14448. return collection;
  14449. }
  14450. function remove( elem, selector, keepData ) {
  14451. var node,
  14452. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  14453. i = 0;
  14454. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  14455. if ( !keepData && node.nodeType === 1 ) {
  14456. jQuery.cleanData( getAll( node ) );
  14457. }
  14458. if ( node.parentNode ) {
  14459. if ( keepData && isAttached( node ) ) {
  14460. setGlobalEval( getAll( node, "script" ) );
  14461. }
  14462. node.parentNode.removeChild( node );
  14463. }
  14464. }
  14465. return elem;
  14466. }
  14467. jQuery.extend( {
  14468. htmlPrefilter: function( html ) {
  14469. return html.replace( rxhtmlTag, "<$1></$2>" );
  14470. },
  14471. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  14472. var i, l, srcElements, destElements,
  14473. clone = elem.cloneNode( true ),
  14474. inPage = isAttached( elem );
  14475. // Fix IE cloning issues
  14476. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  14477. !jQuery.isXMLDoc( elem ) ) {
  14478. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  14479. destElements = getAll( clone );
  14480. srcElements = getAll( elem );
  14481. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14482. fixInput( srcElements[ i ], destElements[ i ] );
  14483. }
  14484. }
  14485. // Copy the events from the original to the clone
  14486. if ( dataAndEvents ) {
  14487. if ( deepDataAndEvents ) {
  14488. srcElements = srcElements || getAll( elem );
  14489. destElements = destElements || getAll( clone );
  14490. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14491. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  14492. }
  14493. } else {
  14494. cloneCopyEvent( elem, clone );
  14495. }
  14496. }
  14497. // Preserve script evaluation history
  14498. destElements = getAll( clone, "script" );
  14499. if ( destElements.length > 0 ) {
  14500. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  14501. }
  14502. // Return the cloned set
  14503. return clone;
  14504. },
  14505. cleanData: function( elems ) {
  14506. var data, elem, type,
  14507. special = jQuery.event.special,
  14508. i = 0;
  14509. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  14510. if ( acceptData( elem ) ) {
  14511. if ( ( data = elem[ dataPriv.expando ] ) ) {
  14512. if ( data.events ) {
  14513. for ( type in data.events ) {
  14514. if ( special[ type ] ) {
  14515. jQuery.event.remove( elem, type );
  14516. // This is a shortcut to avoid jQuery.event.remove's overhead
  14517. } else {
  14518. jQuery.removeEvent( elem, type, data.handle );
  14519. }
  14520. }
  14521. }
  14522. // Support: Chrome <=35 - 45+
  14523. // Assign undefined instead of using delete, see Data#remove
  14524. elem[ dataPriv.expando ] = undefined;
  14525. }
  14526. if ( elem[ dataUser.expando ] ) {
  14527. // Support: Chrome <=35 - 45+
  14528. // Assign undefined instead of using delete, see Data#remove
  14529. elem[ dataUser.expando ] = undefined;
  14530. }
  14531. }
  14532. }
  14533. }
  14534. } );
  14535. jQuery.fn.extend( {
  14536. detach: function( selector ) {
  14537. return remove( this, selector, true );
  14538. },
  14539. remove: function( selector ) {
  14540. return remove( this, selector );
  14541. },
  14542. text: function( value ) {
  14543. return access( this, function( value ) {
  14544. return value === undefined ?
  14545. jQuery.text( this ) :
  14546. this.empty().each( function() {
  14547. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14548. this.textContent = value;
  14549. }
  14550. } );
  14551. }, null, value, arguments.length );
  14552. },
  14553. append: function() {
  14554. return domManip( this, arguments, function( elem ) {
  14555. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14556. var target = manipulationTarget( this, elem );
  14557. target.appendChild( elem );
  14558. }
  14559. } );
  14560. },
  14561. prepend: function() {
  14562. return domManip( this, arguments, function( elem ) {
  14563. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14564. var target = manipulationTarget( this, elem );
  14565. target.insertBefore( elem, target.firstChild );
  14566. }
  14567. } );
  14568. },
  14569. before: function() {
  14570. return domManip( this, arguments, function( elem ) {
  14571. if ( this.parentNode ) {
  14572. this.parentNode.insertBefore( elem, this );
  14573. }
  14574. } );
  14575. },
  14576. after: function() {
  14577. return domManip( this, arguments, function( elem ) {
  14578. if ( this.parentNode ) {
  14579. this.parentNode.insertBefore( elem, this.nextSibling );
  14580. }
  14581. } );
  14582. },
  14583. empty: function() {
  14584. var elem,
  14585. i = 0;
  14586. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  14587. if ( elem.nodeType === 1 ) {
  14588. // Prevent memory leaks
  14589. jQuery.cleanData( getAll( elem, false ) );
  14590. // Remove any remaining nodes
  14591. elem.textContent = "";
  14592. }
  14593. }
  14594. return this;
  14595. },
  14596. clone: function( dataAndEvents, deepDataAndEvents ) {
  14597. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  14598. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  14599. return this.map( function() {
  14600. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  14601. } );
  14602. },
  14603. html: function( value ) {
  14604. return access( this, function( value ) {
  14605. var elem = this[ 0 ] || {},
  14606. i = 0,
  14607. l = this.length;
  14608. if ( value === undefined && elem.nodeType === 1 ) {
  14609. return elem.innerHTML;
  14610. }
  14611. // See if we can take a shortcut and just use innerHTML
  14612. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  14613. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  14614. value = jQuery.htmlPrefilter( value );
  14615. try {
  14616. for ( ; i < l; i++ ) {
  14617. elem = this[ i ] || {};
  14618. // Remove element nodes and prevent memory leaks
  14619. if ( elem.nodeType === 1 ) {
  14620. jQuery.cleanData( getAll( elem, false ) );
  14621. elem.innerHTML = value;
  14622. }
  14623. }
  14624. elem = 0;
  14625. // If using innerHTML throws an exception, use the fallback method
  14626. } catch ( e ) {}
  14627. }
  14628. if ( elem ) {
  14629. this.empty().append( value );
  14630. }
  14631. }, null, value, arguments.length );
  14632. },
  14633. replaceWith: function() {
  14634. var ignored = [];
  14635. // Make the changes, replacing each non-ignored context element with the new content
  14636. return domManip( this, arguments, function( elem ) {
  14637. var parent = this.parentNode;
  14638. if ( jQuery.inArray( this, ignored ) < 0 ) {
  14639. jQuery.cleanData( getAll( this ) );
  14640. if ( parent ) {
  14641. parent.replaceChild( elem, this );
  14642. }
  14643. }
  14644. // Force callback invocation
  14645. }, ignored );
  14646. }
  14647. } );
  14648. jQuery.each( {
  14649. appendTo: "append",
  14650. prependTo: "prepend",
  14651. insertBefore: "before",
  14652. insertAfter: "after",
  14653. replaceAll: "replaceWith"
  14654. }, function( name, original ) {
  14655. jQuery.fn[ name ] = function( selector ) {
  14656. var elems,
  14657. ret = [],
  14658. insert = jQuery( selector ),
  14659. last = insert.length - 1,
  14660. i = 0;
  14661. for ( ; i <= last; i++ ) {
  14662. elems = i === last ? this : this.clone( true );
  14663. jQuery( insert[ i ] )[ original ]( elems );
  14664. // Support: Android <=4.0 only, PhantomJS 1 only
  14665. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  14666. push.apply( ret, elems.get() );
  14667. }
  14668. return this.pushStack( ret );
  14669. };
  14670. } );
  14671. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  14672. var getStyles = function( elem ) {
  14673. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  14674. // IE throws on elements created in popups
  14675. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  14676. var view = elem.ownerDocument.defaultView;
  14677. if ( !view || !view.opener ) {
  14678. view = window;
  14679. }
  14680. return view.getComputedStyle( elem );
  14681. };
  14682. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  14683. ( function() {
  14684. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  14685. // so they're executed at the same time to save the second computation.
  14686. function computeStyleTests() {
  14687. // This is a singleton, we need to execute it only once
  14688. if ( !div ) {
  14689. return;
  14690. }
  14691. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  14692. "margin-top:1px;padding:0;border:0";
  14693. div.style.cssText =
  14694. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  14695. "margin:auto;border:1px;padding:1px;" +
  14696. "width:60%;top:1%";
  14697. documentElement.appendChild( container ).appendChild( div );
  14698. var divStyle = window.getComputedStyle( div );
  14699. pixelPositionVal = divStyle.top !== "1%";
  14700. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  14701. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  14702. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  14703. // Some styles come back with percentage values, even though they shouldn't
  14704. div.style.right = "60%";
  14705. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  14706. // Support: IE 9 - 11 only
  14707. // Detect misreporting of content dimensions for box-sizing:border-box elements
  14708. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  14709. // Support: IE 9 only
  14710. // Detect overflow:scroll screwiness (gh-3699)
  14711. // Support: Chrome <=64
  14712. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  14713. div.style.position = "absolute";
  14714. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  14715. documentElement.removeChild( container );
  14716. // Nullify the div so it wouldn't be stored in the memory and
  14717. // it will also be a sign that checks already performed
  14718. div = null;
  14719. }
  14720. function roundPixelMeasures( measure ) {
  14721. return Math.round( parseFloat( measure ) );
  14722. }
  14723. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  14724. reliableMarginLeftVal,
  14725. container = document.createElement( "div" ),
  14726. div = document.createElement( "div" );
  14727. // Finish early in limited (non-browser) environments
  14728. if ( !div.style ) {
  14729. return;
  14730. }
  14731. // Support: IE <=9 - 11 only
  14732. // Style of cloned element affects source element cloned (#8908)
  14733. div.style.backgroundClip = "content-box";
  14734. div.cloneNode( true ).style.backgroundClip = "";
  14735. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  14736. jQuery.extend( support, {
  14737. boxSizingReliable: function() {
  14738. computeStyleTests();
  14739. return boxSizingReliableVal;
  14740. },
  14741. pixelBoxStyles: function() {
  14742. computeStyleTests();
  14743. return pixelBoxStylesVal;
  14744. },
  14745. pixelPosition: function() {
  14746. computeStyleTests();
  14747. return pixelPositionVal;
  14748. },
  14749. reliableMarginLeft: function() {
  14750. computeStyleTests();
  14751. return reliableMarginLeftVal;
  14752. },
  14753. scrollboxSize: function() {
  14754. computeStyleTests();
  14755. return scrollboxSizeVal;
  14756. }
  14757. } );
  14758. } )();
  14759. function curCSS( elem, name, computed ) {
  14760. var width, minWidth, maxWidth, ret,
  14761. // Support: Firefox 51+
  14762. // Retrieving style before computed somehow
  14763. // fixes an issue with getting wrong values
  14764. // on detached elements
  14765. style = elem.style;
  14766. computed = computed || getStyles( elem );
  14767. // getPropertyValue is needed for:
  14768. // .css('filter') (IE 9 only, #12537)
  14769. // .css('--customProperty) (#3144)
  14770. if ( computed ) {
  14771. ret = computed.getPropertyValue( name ) || computed[ name ];
  14772. if ( ret === "" && !isAttached( elem ) ) {
  14773. ret = jQuery.style( elem, name );
  14774. }
  14775. // A tribute to the "awesome hack by Dean Edwards"
  14776. // Android Browser returns percentage for some values,
  14777. // but width seems to be reliably pixels.
  14778. // This is against the CSSOM draft spec:
  14779. // https://drafts.csswg.org/cssom/#resolved-values
  14780. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  14781. // Remember the original values
  14782. width = style.width;
  14783. minWidth = style.minWidth;
  14784. maxWidth = style.maxWidth;
  14785. // Put in the new values to get a computed value out
  14786. style.minWidth = style.maxWidth = style.width = ret;
  14787. ret = computed.width;
  14788. // Revert the changed values
  14789. style.width = width;
  14790. style.minWidth = minWidth;
  14791. style.maxWidth = maxWidth;
  14792. }
  14793. }
  14794. return ret !== undefined ?
  14795. // Support: IE <=9 - 11 only
  14796. // IE returns zIndex value as an integer.
  14797. ret + "" :
  14798. ret;
  14799. }
  14800. function addGetHookIf( conditionFn, hookFn ) {
  14801. // Define the hook, we'll check on the first run if it's really needed.
  14802. return {
  14803. get: function() {
  14804. if ( conditionFn() ) {
  14805. // Hook not needed (or it's not possible to use it due
  14806. // to missing dependency), remove it.
  14807. delete this.get;
  14808. return;
  14809. }
  14810. // Hook needed; redefine it so that the support test is not executed again.
  14811. return ( this.get = hookFn ).apply( this, arguments );
  14812. }
  14813. };
  14814. }
  14815. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  14816. emptyStyle = document.createElement( "div" ).style,
  14817. vendorProps = {};
  14818. // Return a vendor-prefixed property or undefined
  14819. function vendorPropName( name ) {
  14820. // Check for vendor prefixed names
  14821. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  14822. i = cssPrefixes.length;
  14823. while ( i-- ) {
  14824. name = cssPrefixes[ i ] + capName;
  14825. if ( name in emptyStyle ) {
  14826. return name;
  14827. }
  14828. }
  14829. }
  14830. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  14831. function finalPropName( name ) {
  14832. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  14833. if ( final ) {
  14834. return final;
  14835. }
  14836. if ( name in emptyStyle ) {
  14837. return name;
  14838. }
  14839. return vendorProps[ name ] = vendorPropName( name ) || name;
  14840. }
  14841. var
  14842. // Swappable if display is none or starts with table
  14843. // except "table", "table-cell", or "table-caption"
  14844. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  14845. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  14846. rcustomProp = /^--/,
  14847. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  14848. cssNormalTransform = {
  14849. letterSpacing: "0",
  14850. fontWeight: "400"
  14851. };
  14852. function setPositiveNumber( elem, value, subtract ) {
  14853. // Any relative (+/-) values have already been
  14854. // normalized at this point
  14855. var matches = rcssNum.exec( value );
  14856. return matches ?
  14857. // Guard against undefined "subtract", e.g., when used as in cssHooks
  14858. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  14859. value;
  14860. }
  14861. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  14862. var i = dimension === "width" ? 1 : 0,
  14863. extra = 0,
  14864. delta = 0;
  14865. // Adjustment may not be necessary
  14866. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  14867. return 0;
  14868. }
  14869. for ( ; i < 4; i += 2 ) {
  14870. // Both box models exclude margin
  14871. if ( box === "margin" ) {
  14872. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  14873. }
  14874. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  14875. if ( !isBorderBox ) {
  14876. // Add padding
  14877. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14878. // For "border" or "margin", add border
  14879. if ( box !== "padding" ) {
  14880. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14881. // But still keep track of it otherwise
  14882. } else {
  14883. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14884. }
  14885. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  14886. // "padding" or "margin"
  14887. } else {
  14888. // For "content", subtract padding
  14889. if ( box === "content" ) {
  14890. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14891. }
  14892. // For "content" or "padding", subtract border
  14893. if ( box !== "margin" ) {
  14894. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14895. }
  14896. }
  14897. }
  14898. // Account for positive content-box scroll gutter when requested by providing computedVal
  14899. if ( !isBorderBox && computedVal >= 0 ) {
  14900. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  14901. // Assuming integer scroll gutter, subtract the rest and round down
  14902. delta += Math.max( 0, Math.ceil(
  14903. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14904. computedVal -
  14905. delta -
  14906. extra -
  14907. 0.5
  14908. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  14909. // Use an explicit zero to avoid NaN (gh-3964)
  14910. ) ) || 0;
  14911. }
  14912. return delta;
  14913. }
  14914. function getWidthOrHeight( elem, dimension, extra ) {
  14915. // Start with computed style
  14916. var styles = getStyles( elem ),
  14917. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  14918. // Fake content-box until we know it's needed to know the true value.
  14919. boxSizingNeeded = !support.boxSizingReliable() || extra,
  14920. isBorderBox = boxSizingNeeded &&
  14921. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14922. valueIsBorderBox = isBorderBox,
  14923. val = curCSS( elem, dimension, styles ),
  14924. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  14925. // Support: Firefox <=54
  14926. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  14927. if ( rnumnonpx.test( val ) ) {
  14928. if ( !extra ) {
  14929. return val;
  14930. }
  14931. val = "auto";
  14932. }
  14933. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14934. // This happens for inline elements with no explicit setting (gh-3571)
  14935. // Support: Android <=4.1 - 4.3 only
  14936. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14937. // Support: IE 9-11 only
  14938. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14939. // We use getClientRects() to check for hidden/disconnected.
  14940. // In those cases, the computed value can be trusted to be border-box
  14941. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14942. val === "auto" ||
  14943. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14944. elem.getClientRects().length ) {
  14945. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14946. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14947. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14948. // retrieved value as a content box dimension.
  14949. valueIsBorderBox = offsetProp in elem;
  14950. if ( valueIsBorderBox ) {
  14951. val = elem[ offsetProp ];
  14952. }
  14953. }
  14954. // Normalize "" and auto
  14955. val = parseFloat( val ) || 0;
  14956. // Adjust for the element's box model
  14957. return ( val +
  14958. boxModelAdjustment(
  14959. elem,
  14960. dimension,
  14961. extra || ( isBorderBox ? "border" : "content" ),
  14962. valueIsBorderBox,
  14963. styles,
  14964. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14965. val
  14966. )
  14967. ) + "px";
  14968. }
  14969. jQuery.extend( {
  14970. // Add in style property hooks for overriding the default
  14971. // behavior of getting and setting a style property
  14972. cssHooks: {
  14973. opacity: {
  14974. get: function( elem, computed ) {
  14975. if ( computed ) {
  14976. // We should always get a number back from opacity
  14977. var ret = curCSS( elem, "opacity" );
  14978. return ret === "" ? "1" : ret;
  14979. }
  14980. }
  14981. }
  14982. },
  14983. // Don't automatically add "px" to these possibly-unitless properties
  14984. cssNumber: {
  14985. "animationIterationCount": true,
  14986. "columnCount": true,
  14987. "fillOpacity": true,
  14988. "flexGrow": true,
  14989. "flexShrink": true,
  14990. "fontWeight": true,
  14991. "gridArea": true,
  14992. "gridColumn": true,
  14993. "gridColumnEnd": true,
  14994. "gridColumnStart": true,
  14995. "gridRow": true,
  14996. "gridRowEnd": true,
  14997. "gridRowStart": true,
  14998. "lineHeight": true,
  14999. "opacity": true,
  15000. "order": true,
  15001. "orphans": true,
  15002. "widows": true,
  15003. "zIndex": true,
  15004. "zoom": true
  15005. },
  15006. // Add in properties whose names you wish to fix before
  15007. // setting or getting the value
  15008. cssProps: {},
  15009. // Get and set the style property on a DOM Node
  15010. style: function( elem, name, value, extra ) {
  15011. // Don't set styles on text and comment nodes
  15012. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  15013. return;
  15014. }
  15015. // Make sure that we're working with the right name
  15016. var ret, type, hooks,
  15017. origName = camelCase( name ),
  15018. isCustomProp = rcustomProp.test( name ),
  15019. style = elem.style;
  15020. // Make sure that we're working with the right name. We don't
  15021. // want to query the value if it is a CSS custom property
  15022. // since they are user-defined.
  15023. if ( !isCustomProp ) {
  15024. name = finalPropName( origName );
  15025. }
  15026. // Gets hook for the prefixed version, then unprefixed version
  15027. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  15028. // Check if we're setting a value
  15029. if ( value !== undefined ) {
  15030. type = typeof value;
  15031. // Convert "+=" or "-=" to relative numbers (#7345)
  15032. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  15033. value = adjustCSS( elem, name, ret );
  15034. // Fixes bug #9237
  15035. type = "number";
  15036. }
  15037. // Make sure that null and NaN values aren't set (#7116)
  15038. if ( value == null || value !== value ) {
  15039. return;
  15040. }
  15041. // If a number was passed in, add the unit (except for certain CSS properties)
  15042. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  15043. // "px" to a few hardcoded values.
  15044. if ( type === "number" && !isCustomProp ) {
  15045. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  15046. }
  15047. // background-* props affect original clone's values
  15048. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  15049. style[ name ] = "inherit";
  15050. }
  15051. // If a hook was provided, use that value, otherwise just set the specified value
  15052. if ( !hooks || !( "set" in hooks ) ||
  15053. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  15054. if ( isCustomProp ) {
  15055. style.setProperty( name, value );
  15056. } else {
  15057. style[ name ] = value;
  15058. }
  15059. }
  15060. } else {
  15061. // If a hook was provided get the non-computed value from there
  15062. if ( hooks && "get" in hooks &&
  15063. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  15064. return ret;
  15065. }
  15066. // Otherwise just get the value from the style object
  15067. return style[ name ];
  15068. }
  15069. },
  15070. css: function( elem, name, extra, styles ) {
  15071. var val, num, hooks,
  15072. origName = camelCase( name ),
  15073. isCustomProp = rcustomProp.test( name );
  15074. // Make sure that we're working with the right name. We don't
  15075. // want to modify the value if it is a CSS custom property
  15076. // since they are user-defined.
  15077. if ( !isCustomProp ) {
  15078. name = finalPropName( origName );
  15079. }
  15080. // Try prefixed name followed by the unprefixed name
  15081. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  15082. // If a hook was provided get the computed value from there
  15083. if ( hooks && "get" in hooks ) {
  15084. val = hooks.get( elem, true, extra );
  15085. }
  15086. // Otherwise, if a way to get the computed value exists, use that
  15087. if ( val === undefined ) {
  15088. val = curCSS( elem, name, styles );
  15089. }
  15090. // Convert "normal" to computed value
  15091. if ( val === "normal" && name in cssNormalTransform ) {
  15092. val = cssNormalTransform[ name ];
  15093. }
  15094. // Make numeric if forced or a qualifier was provided and val looks numeric
  15095. if ( extra === "" || extra ) {
  15096. num = parseFloat( val );
  15097. return extra === true || isFinite( num ) ? num || 0 : val;
  15098. }
  15099. return val;
  15100. }
  15101. } );
  15102. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  15103. jQuery.cssHooks[ dimension ] = {
  15104. get: function( elem, computed, extra ) {
  15105. if ( computed ) {
  15106. // Certain elements can have dimension info if we invisibly show them
  15107. // but it must have a current display style that would benefit
  15108. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  15109. // Support: Safari 8+
  15110. // Table columns in Safari have non-zero offsetWidth & zero
  15111. // getBoundingClientRect().width unless display is changed.
  15112. // Support: IE <=11 only
  15113. // Running getBoundingClientRect on a disconnected node
  15114. // in IE throws an error.
  15115. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  15116. swap( elem, cssShow, function() {
  15117. return getWidthOrHeight( elem, dimension, extra );
  15118. } ) :
  15119. getWidthOrHeight( elem, dimension, extra );
  15120. }
  15121. },
  15122. set: function( elem, value, extra ) {
  15123. var matches,
  15124. styles = getStyles( elem ),
  15125. // Only read styles.position if the test has a chance to fail
  15126. // to avoid forcing a reflow.
  15127. scrollboxSizeBuggy = !support.scrollboxSize() &&
  15128. styles.position === "absolute",
  15129. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  15130. boxSizingNeeded = scrollboxSizeBuggy || extra,
  15131. isBorderBox = boxSizingNeeded &&
  15132. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  15133. subtract = extra ?
  15134. boxModelAdjustment(
  15135. elem,
  15136. dimension,
  15137. extra,
  15138. isBorderBox,
  15139. styles
  15140. ) :
  15141. 0;
  15142. // Account for unreliable border-box dimensions by comparing offset* to computed and
  15143. // faking a content-box to get border and padding (gh-3699)
  15144. if ( isBorderBox && scrollboxSizeBuggy ) {
  15145. subtract -= Math.ceil(
  15146. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  15147. parseFloat( styles[ dimension ] ) -
  15148. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  15149. 0.5
  15150. );
  15151. }
  15152. // Convert to pixels if value adjustment is needed
  15153. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  15154. ( matches[ 3 ] || "px" ) !== "px" ) {
  15155. elem.style[ dimension ] = value;
  15156. value = jQuery.css( elem, dimension );
  15157. }
  15158. return setPositiveNumber( elem, value, subtract );
  15159. }
  15160. };
  15161. } );
  15162. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  15163. function( elem, computed ) {
  15164. if ( computed ) {
  15165. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  15166. elem.getBoundingClientRect().left -
  15167. swap( elem, { marginLeft: 0 }, function() {
  15168. return elem.getBoundingClientRect().left;
  15169. } )
  15170. ) + "px";
  15171. }
  15172. }
  15173. );
  15174. // These hooks are used by animate to expand properties
  15175. jQuery.each( {
  15176. margin: "",
  15177. padding: "",
  15178. border: "Width"
  15179. }, function( prefix, suffix ) {
  15180. jQuery.cssHooks[ prefix + suffix ] = {
  15181. expand: function( value ) {
  15182. var i = 0,
  15183. expanded = {},
  15184. // Assumes a single number if not a string
  15185. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  15186. for ( ; i < 4; i++ ) {
  15187. expanded[ prefix + cssExpand[ i ] + suffix ] =
  15188. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  15189. }
  15190. return expanded;
  15191. }
  15192. };
  15193. if ( prefix !== "margin" ) {
  15194. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  15195. }
  15196. } );
  15197. jQuery.fn.extend( {
  15198. css: function( name, value ) {
  15199. return access( this, function( elem, name, value ) {
  15200. var styles, len,
  15201. map = {},
  15202. i = 0;
  15203. if ( Array.isArray( name ) ) {
  15204. styles = getStyles( elem );
  15205. len = name.length;
  15206. for ( ; i < len; i++ ) {
  15207. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  15208. }
  15209. return map;
  15210. }
  15211. return value !== undefined ?
  15212. jQuery.style( elem, name, value ) :
  15213. jQuery.css( elem, name );
  15214. }, name, value, arguments.length > 1 );
  15215. }
  15216. } );
  15217. function Tween( elem, options, prop, end, easing ) {
  15218. return new Tween.prototype.init( elem, options, prop, end, easing );
  15219. }
  15220. jQuery.Tween = Tween;
  15221. Tween.prototype = {
  15222. constructor: Tween,
  15223. init: function( elem, options, prop, end, easing, unit ) {
  15224. this.elem = elem;
  15225. this.prop = prop;
  15226. this.easing = easing || jQuery.easing._default;
  15227. this.options = options;
  15228. this.start = this.now = this.cur();
  15229. this.end = end;
  15230. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  15231. },
  15232. cur: function() {
  15233. var hooks = Tween.propHooks[ this.prop ];
  15234. return hooks && hooks.get ?
  15235. hooks.get( this ) :
  15236. Tween.propHooks._default.get( this );
  15237. },
  15238. run: function( percent ) {
  15239. var eased,
  15240. hooks = Tween.propHooks[ this.prop ];
  15241. if ( this.options.duration ) {
  15242. this.pos = eased = jQuery.easing[ this.easing ](
  15243. percent, this.options.duration * percent, 0, 1, this.options.duration
  15244. );
  15245. } else {
  15246. this.pos = eased = percent;
  15247. }
  15248. this.now = ( this.end - this.start ) * eased + this.start;
  15249. if ( this.options.step ) {
  15250. this.options.step.call( this.elem, this.now, this );
  15251. }
  15252. if ( hooks && hooks.set ) {
  15253. hooks.set( this );
  15254. } else {
  15255. Tween.propHooks._default.set( this );
  15256. }
  15257. return this;
  15258. }
  15259. };
  15260. Tween.prototype.init.prototype = Tween.prototype;
  15261. Tween.propHooks = {
  15262. _default: {
  15263. get: function( tween ) {
  15264. var result;
  15265. // Use a property on the element directly when it is not a DOM element,
  15266. // or when there is no matching style property that exists.
  15267. if ( tween.elem.nodeType !== 1 ||
  15268. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  15269. return tween.elem[ tween.prop ];
  15270. }
  15271. // Passing an empty string as a 3rd parameter to .css will automatically
  15272. // attempt a parseFloat and fallback to a string if the parse fails.
  15273. // Simple values such as "10px" are parsed to Float;
  15274. // complex values such as "rotate(1rad)" are returned as-is.
  15275. result = jQuery.css( tween.elem, tween.prop, "" );
  15276. // Empty strings, null, undefined and "auto" are converted to 0.
  15277. return !result || result === "auto" ? 0 : result;
  15278. },
  15279. set: function( tween ) {
  15280. // Use step hook for back compat.
  15281. // Use cssHook if its there.
  15282. // Use .style if available and use plain properties where available.
  15283. if ( jQuery.fx.step[ tween.prop ] ) {
  15284. jQuery.fx.step[ tween.prop ]( tween );
  15285. } else if ( tween.elem.nodeType === 1 && (
  15286. jQuery.cssHooks[ tween.prop ] ||
  15287. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  15288. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  15289. } else {
  15290. tween.elem[ tween.prop ] = tween.now;
  15291. }
  15292. }
  15293. }
  15294. };
  15295. // Support: IE <=9 only
  15296. // Panic based approach to setting things on disconnected nodes
  15297. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  15298. set: function( tween ) {
  15299. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  15300. tween.elem[ tween.prop ] = tween.now;
  15301. }
  15302. }
  15303. };
  15304. jQuery.easing = {
  15305. linear: function( p ) {
  15306. return p;
  15307. },
  15308. swing: function( p ) {
  15309. return 0.5 - Math.cos( p * Math.PI ) / 2;
  15310. },
  15311. _default: "swing"
  15312. };
  15313. jQuery.fx = Tween.prototype.init;
  15314. // Back compat <1.8 extension point
  15315. jQuery.fx.step = {};
  15316. var
  15317. fxNow, inProgress,
  15318. rfxtypes = /^(?:toggle|show|hide)$/,
  15319. rrun = /queueHooks$/;
  15320. function schedule() {
  15321. if ( inProgress ) {
  15322. if ( document.hidden === false && window.requestAnimationFrame ) {
  15323. window.requestAnimationFrame( schedule );
  15324. } else {
  15325. window.setTimeout( schedule, jQuery.fx.interval );
  15326. }
  15327. jQuery.fx.tick();
  15328. }
  15329. }
  15330. // Animations created synchronously will run synchronously
  15331. function createFxNow() {
  15332. window.setTimeout( function() {
  15333. fxNow = undefined;
  15334. } );
  15335. return ( fxNow = Date.now() );
  15336. }
  15337. // Generate parameters to create a standard animation
  15338. function genFx( type, includeWidth ) {
  15339. var which,
  15340. i = 0,
  15341. attrs = { height: type };
  15342. // If we include width, step value is 1 to do all cssExpand values,
  15343. // otherwise step value is 2 to skip over Left and Right
  15344. includeWidth = includeWidth ? 1 : 0;
  15345. for ( ; i < 4; i += 2 - includeWidth ) {
  15346. which = cssExpand[ i ];
  15347. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  15348. }
  15349. if ( includeWidth ) {
  15350. attrs.opacity = attrs.width = type;
  15351. }
  15352. return attrs;
  15353. }
  15354. function createTween( value, prop, animation ) {
  15355. var tween,
  15356. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  15357. index = 0,
  15358. length = collection.length;
  15359. for ( ; index < length; index++ ) {
  15360. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  15361. // We're done with this property
  15362. return tween;
  15363. }
  15364. }
  15365. }
  15366. function defaultPrefilter( elem, props, opts ) {
  15367. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  15368. isBox = "width" in props || "height" in props,
  15369. anim = this,
  15370. orig = {},
  15371. style = elem.style,
  15372. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  15373. dataShow = dataPriv.get( elem, "fxshow" );
  15374. // Queue-skipping animations hijack the fx hooks
  15375. if ( !opts.queue ) {
  15376. hooks = jQuery._queueHooks( elem, "fx" );
  15377. if ( hooks.unqueued == null ) {
  15378. hooks.unqueued = 0;
  15379. oldfire = hooks.empty.fire;
  15380. hooks.empty.fire = function() {
  15381. if ( !hooks.unqueued ) {
  15382. oldfire();
  15383. }
  15384. };
  15385. }
  15386. hooks.unqueued++;
  15387. anim.always( function() {
  15388. // Ensure the complete handler is called before this completes
  15389. anim.always( function() {
  15390. hooks.unqueued--;
  15391. if ( !jQuery.queue( elem, "fx" ).length ) {
  15392. hooks.empty.fire();
  15393. }
  15394. } );
  15395. } );
  15396. }
  15397. // Detect show/hide animations
  15398. for ( prop in props ) {
  15399. value = props[ prop ];
  15400. if ( rfxtypes.test( value ) ) {
  15401. delete props[ prop ];
  15402. toggle = toggle || value === "toggle";
  15403. if ( value === ( hidden ? "hide" : "show" ) ) {
  15404. // Pretend to be hidden if this is a "show" and
  15405. // there is still data from a stopped show/hide
  15406. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  15407. hidden = true;
  15408. // Ignore all other no-op show/hide data
  15409. } else {
  15410. continue;
  15411. }
  15412. }
  15413. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  15414. }
  15415. }
  15416. // Bail out if this is a no-op like .hide().hide()
  15417. propTween = !jQuery.isEmptyObject( props );
  15418. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  15419. return;
  15420. }
  15421. // Restrict "overflow" and "display" styles during box animations
  15422. if ( isBox && elem.nodeType === 1 ) {
  15423. // Support: IE <=9 - 11, Edge 12 - 15
  15424. // Record all 3 overflow attributes because IE does not infer the shorthand
  15425. // from identically-valued overflowX and overflowY and Edge just mirrors
  15426. // the overflowX value there.
  15427. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  15428. // Identify a display type, preferring old show/hide data over the CSS cascade
  15429. restoreDisplay = dataShow && dataShow.display;
  15430. if ( restoreDisplay == null ) {
  15431. restoreDisplay = dataPriv.get( elem, "display" );
  15432. }
  15433. display = jQuery.css( elem, "display" );
  15434. if ( display === "none" ) {
  15435. if ( restoreDisplay ) {
  15436. display = restoreDisplay;
  15437. } else {
  15438. // Get nonempty value(s) by temporarily forcing visibility
  15439. showHide( [ elem ], true );
  15440. restoreDisplay = elem.style.display || restoreDisplay;
  15441. display = jQuery.css( elem, "display" );
  15442. showHide( [ elem ] );
  15443. }
  15444. }
  15445. // Animate inline elements as inline-block
  15446. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  15447. if ( jQuery.css( elem, "float" ) === "none" ) {
  15448. // Restore the original display value at the end of pure show/hide animations
  15449. if ( !propTween ) {
  15450. anim.done( function() {
  15451. style.display = restoreDisplay;
  15452. } );
  15453. if ( restoreDisplay == null ) {
  15454. display = style.display;
  15455. restoreDisplay = display === "none" ? "" : display;
  15456. }
  15457. }
  15458. style.display = "inline-block";
  15459. }
  15460. }
  15461. }
  15462. if ( opts.overflow ) {
  15463. style.overflow = "hidden";
  15464. anim.always( function() {
  15465. style.overflow = opts.overflow[ 0 ];
  15466. style.overflowX = opts.overflow[ 1 ];
  15467. style.overflowY = opts.overflow[ 2 ];
  15468. } );
  15469. }
  15470. // Implement show/hide animations
  15471. propTween = false;
  15472. for ( prop in orig ) {
  15473. // General show/hide setup for this element animation
  15474. if ( !propTween ) {
  15475. if ( dataShow ) {
  15476. if ( "hidden" in dataShow ) {
  15477. hidden = dataShow.hidden;
  15478. }
  15479. } else {
  15480. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  15481. }
  15482. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  15483. if ( toggle ) {
  15484. dataShow.hidden = !hidden;
  15485. }
  15486. // Show elements before animating them
  15487. if ( hidden ) {
  15488. showHide( [ elem ], true );
  15489. }
  15490. /* eslint-disable no-loop-func */
  15491. anim.done( function() {
  15492. /* eslint-enable no-loop-func */
  15493. // The final step of a "hide" animation is actually hiding the element
  15494. if ( !hidden ) {
  15495. showHide( [ elem ] );
  15496. }
  15497. dataPriv.remove( elem, "fxshow" );
  15498. for ( prop in orig ) {
  15499. jQuery.style( elem, prop, orig[ prop ] );
  15500. }
  15501. } );
  15502. }
  15503. // Per-property setup
  15504. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  15505. if ( !( prop in dataShow ) ) {
  15506. dataShow[ prop ] = propTween.start;
  15507. if ( hidden ) {
  15508. propTween.end = propTween.start;
  15509. propTween.start = 0;
  15510. }
  15511. }
  15512. }
  15513. }
  15514. function propFilter( props, specialEasing ) {
  15515. var index, name, easing, value, hooks;
  15516. // camelCase, specialEasing and expand cssHook pass
  15517. for ( index in props ) {
  15518. name = camelCase( index );
  15519. easing = specialEasing[ name ];
  15520. value = props[ index ];
  15521. if ( Array.isArray( value ) ) {
  15522. easing = value[ 1 ];
  15523. value = props[ index ] = value[ 0 ];
  15524. }
  15525. if ( index !== name ) {
  15526. props[ name ] = value;
  15527. delete props[ index ];
  15528. }
  15529. hooks = jQuery.cssHooks[ name ];
  15530. if ( hooks && "expand" in hooks ) {
  15531. value = hooks.expand( value );
  15532. delete props[ name ];
  15533. // Not quite $.extend, this won't overwrite existing keys.
  15534. // Reusing 'index' because we have the correct "name"
  15535. for ( index in value ) {
  15536. if ( !( index in props ) ) {
  15537. props[ index ] = value[ index ];
  15538. specialEasing[ index ] = easing;
  15539. }
  15540. }
  15541. } else {
  15542. specialEasing[ name ] = easing;
  15543. }
  15544. }
  15545. }
  15546. function Animation( elem, properties, options ) {
  15547. var result,
  15548. stopped,
  15549. index = 0,
  15550. length = Animation.prefilters.length,
  15551. deferred = jQuery.Deferred().always( function() {
  15552. // Don't match elem in the :animated selector
  15553. delete tick.elem;
  15554. } ),
  15555. tick = function() {
  15556. if ( stopped ) {
  15557. return false;
  15558. }
  15559. var currentTime = fxNow || createFxNow(),
  15560. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  15561. // Support: Android 2.3 only
  15562. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  15563. temp = remaining / animation.duration || 0,
  15564. percent = 1 - temp,
  15565. index = 0,
  15566. length = animation.tweens.length;
  15567. for ( ; index < length; index++ ) {
  15568. animation.tweens[ index ].run( percent );
  15569. }
  15570. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  15571. // If there's more to do, yield
  15572. if ( percent < 1 && length ) {
  15573. return remaining;
  15574. }
  15575. // If this was an empty animation, synthesize a final progress notification
  15576. if ( !length ) {
  15577. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15578. }
  15579. // Resolve the animation and report its conclusion
  15580. deferred.resolveWith( elem, [ animation ] );
  15581. return false;
  15582. },
  15583. animation = deferred.promise( {
  15584. elem: elem,
  15585. props: jQuery.extend( {}, properties ),
  15586. opts: jQuery.extend( true, {
  15587. specialEasing: {},
  15588. easing: jQuery.easing._default
  15589. }, options ),
  15590. originalProperties: properties,
  15591. originalOptions: options,
  15592. startTime: fxNow || createFxNow(),
  15593. duration: options.duration,
  15594. tweens: [],
  15595. createTween: function( prop, end ) {
  15596. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  15597. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  15598. animation.tweens.push( tween );
  15599. return tween;
  15600. },
  15601. stop: function( gotoEnd ) {
  15602. var index = 0,
  15603. // If we are going to the end, we want to run all the tweens
  15604. // otherwise we skip this part
  15605. length = gotoEnd ? animation.tweens.length : 0;
  15606. if ( stopped ) {
  15607. return this;
  15608. }
  15609. stopped = true;
  15610. for ( ; index < length; index++ ) {
  15611. animation.tweens[ index ].run( 1 );
  15612. }
  15613. // Resolve when we played the last frame; otherwise, reject
  15614. if ( gotoEnd ) {
  15615. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15616. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  15617. } else {
  15618. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  15619. }
  15620. return this;
  15621. }
  15622. } ),
  15623. props = animation.props;
  15624. propFilter( props, animation.opts.specialEasing );
  15625. for ( ; index < length; index++ ) {
  15626. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  15627. if ( result ) {
  15628. if ( isFunction( result.stop ) ) {
  15629. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  15630. result.stop.bind( result );
  15631. }
  15632. return result;
  15633. }
  15634. }
  15635. jQuery.map( props, createTween, animation );
  15636. if ( isFunction( animation.opts.start ) ) {
  15637. animation.opts.start.call( elem, animation );
  15638. }
  15639. // Attach callbacks from options
  15640. animation
  15641. .progress( animation.opts.progress )
  15642. .done( animation.opts.done, animation.opts.complete )
  15643. .fail( animation.opts.fail )
  15644. .always( animation.opts.always );
  15645. jQuery.fx.timer(
  15646. jQuery.extend( tick, {
  15647. elem: elem,
  15648. anim: animation,
  15649. queue: animation.opts.queue
  15650. } )
  15651. );
  15652. return animation;
  15653. }
  15654. jQuery.Animation = jQuery.extend( Animation, {
  15655. tweeners: {
  15656. "*": [ function( prop, value ) {
  15657. var tween = this.createTween( prop, value );
  15658. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  15659. return tween;
  15660. } ]
  15661. },
  15662. tweener: function( props, callback ) {
  15663. if ( isFunction( props ) ) {
  15664. callback = props;
  15665. props = [ "*" ];
  15666. } else {
  15667. props = props.match( rnothtmlwhite );
  15668. }
  15669. var prop,
  15670. index = 0,
  15671. length = props.length;
  15672. for ( ; index < length; index++ ) {
  15673. prop = props[ index ];
  15674. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  15675. Animation.tweeners[ prop ].unshift( callback );
  15676. }
  15677. },
  15678. prefilters: [ defaultPrefilter ],
  15679. prefilter: function( callback, prepend ) {
  15680. if ( prepend ) {
  15681. Animation.prefilters.unshift( callback );
  15682. } else {
  15683. Animation.prefilters.push( callback );
  15684. }
  15685. }
  15686. } );
  15687. jQuery.speed = function( speed, easing, fn ) {
  15688. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  15689. complete: fn || !fn && easing ||
  15690. isFunction( speed ) && speed,
  15691. duration: speed,
  15692. easing: fn && easing || easing && !isFunction( easing ) && easing
  15693. };
  15694. // Go to the end state if fx are off
  15695. if ( jQuery.fx.off ) {
  15696. opt.duration = 0;
  15697. } else {
  15698. if ( typeof opt.duration !== "number" ) {
  15699. if ( opt.duration in jQuery.fx.speeds ) {
  15700. opt.duration = jQuery.fx.speeds[ opt.duration ];
  15701. } else {
  15702. opt.duration = jQuery.fx.speeds._default;
  15703. }
  15704. }
  15705. }
  15706. // Normalize opt.queue - true/undefined/null -> "fx"
  15707. if ( opt.queue == null || opt.queue === true ) {
  15708. opt.queue = "fx";
  15709. }
  15710. // Queueing
  15711. opt.old = opt.complete;
  15712. opt.complete = function() {
  15713. if ( isFunction( opt.old ) ) {
  15714. opt.old.call( this );
  15715. }
  15716. if ( opt.queue ) {
  15717. jQuery.dequeue( this, opt.queue );
  15718. }
  15719. };
  15720. return opt;
  15721. };
  15722. jQuery.fn.extend( {
  15723. fadeTo: function( speed, to, easing, callback ) {
  15724. // Show any hidden elements after setting opacity to 0
  15725. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  15726. // Animate to the value specified
  15727. .end().animate( { opacity: to }, speed, easing, callback );
  15728. },
  15729. animate: function( prop, speed, easing, callback ) {
  15730. var empty = jQuery.isEmptyObject( prop ),
  15731. optall = jQuery.speed( speed, easing, callback ),
  15732. doAnimation = function() {
  15733. // Operate on a copy of prop so per-property easing won't be lost
  15734. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  15735. // Empty animations, or finishing resolves immediately
  15736. if ( empty || dataPriv.get( this, "finish" ) ) {
  15737. anim.stop( true );
  15738. }
  15739. };
  15740. doAnimation.finish = doAnimation;
  15741. return empty || optall.queue === false ?
  15742. this.each( doAnimation ) :
  15743. this.queue( optall.queue, doAnimation );
  15744. },
  15745. stop: function( type, clearQueue, gotoEnd ) {
  15746. var stopQueue = function( hooks ) {
  15747. var stop = hooks.stop;
  15748. delete hooks.stop;
  15749. stop( gotoEnd );
  15750. };
  15751. if ( typeof type !== "string" ) {
  15752. gotoEnd = clearQueue;
  15753. clearQueue = type;
  15754. type = undefined;
  15755. }
  15756. if ( clearQueue && type !== false ) {
  15757. this.queue( type || "fx", [] );
  15758. }
  15759. return this.each( function() {
  15760. var dequeue = true,
  15761. index = type != null && type + "queueHooks",
  15762. timers = jQuery.timers,
  15763. data = dataPriv.get( this );
  15764. if ( index ) {
  15765. if ( data[ index ] && data[ index ].stop ) {
  15766. stopQueue( data[ index ] );
  15767. }
  15768. } else {
  15769. for ( index in data ) {
  15770. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  15771. stopQueue( data[ index ] );
  15772. }
  15773. }
  15774. }
  15775. for ( index = timers.length; index--; ) {
  15776. if ( timers[ index ].elem === this &&
  15777. ( type == null || timers[ index ].queue === type ) ) {
  15778. timers[ index ].anim.stop( gotoEnd );
  15779. dequeue = false;
  15780. timers.splice( index, 1 );
  15781. }
  15782. }
  15783. // Start the next in the queue if the last step wasn't forced.
  15784. // Timers currently will call their complete callbacks, which
  15785. // will dequeue but only if they were gotoEnd.
  15786. if ( dequeue || !gotoEnd ) {
  15787. jQuery.dequeue( this, type );
  15788. }
  15789. } );
  15790. },
  15791. finish: function( type ) {
  15792. if ( type !== false ) {
  15793. type = type || "fx";
  15794. }
  15795. return this.each( function() {
  15796. var index,
  15797. data = dataPriv.get( this ),
  15798. queue = data[ type + "queue" ],
  15799. hooks = data[ type + "queueHooks" ],
  15800. timers = jQuery.timers,
  15801. length = queue ? queue.length : 0;
  15802. // Enable finishing flag on private data
  15803. data.finish = true;
  15804. // Empty the queue first
  15805. jQuery.queue( this, type, [] );
  15806. if ( hooks && hooks.stop ) {
  15807. hooks.stop.call( this, true );
  15808. }
  15809. // Look for any active animations, and finish them
  15810. for ( index = timers.length; index--; ) {
  15811. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  15812. timers[ index ].anim.stop( true );
  15813. timers.splice( index, 1 );
  15814. }
  15815. }
  15816. // Look for any animations in the old queue and finish them
  15817. for ( index = 0; index < length; index++ ) {
  15818. if ( queue[ index ] && queue[ index ].finish ) {
  15819. queue[ index ].finish.call( this );
  15820. }
  15821. }
  15822. // Turn off finishing flag
  15823. delete data.finish;
  15824. } );
  15825. }
  15826. } );
  15827. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  15828. var cssFn = jQuery.fn[ name ];
  15829. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15830. return speed == null || typeof speed === "boolean" ?
  15831. cssFn.apply( this, arguments ) :
  15832. this.animate( genFx( name, true ), speed, easing, callback );
  15833. };
  15834. } );
  15835. // Generate shortcuts for custom animations
  15836. jQuery.each( {
  15837. slideDown: genFx( "show" ),
  15838. slideUp: genFx( "hide" ),
  15839. slideToggle: genFx( "toggle" ),
  15840. fadeIn: { opacity: "show" },
  15841. fadeOut: { opacity: "hide" },
  15842. fadeToggle: { opacity: "toggle" }
  15843. }, function( name, props ) {
  15844. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15845. return this.animate( props, speed, easing, callback );
  15846. };
  15847. } );
  15848. jQuery.timers = [];
  15849. jQuery.fx.tick = function() {
  15850. var timer,
  15851. i = 0,
  15852. timers = jQuery.timers;
  15853. fxNow = Date.now();
  15854. for ( ; i < timers.length; i++ ) {
  15855. timer = timers[ i ];
  15856. // Run the timer and safely remove it when done (allowing for external removal)
  15857. if ( !timer() && timers[ i ] === timer ) {
  15858. timers.splice( i--, 1 );
  15859. }
  15860. }
  15861. if ( !timers.length ) {
  15862. jQuery.fx.stop();
  15863. }
  15864. fxNow = undefined;
  15865. };
  15866. jQuery.fx.timer = function( timer ) {
  15867. jQuery.timers.push( timer );
  15868. jQuery.fx.start();
  15869. };
  15870. jQuery.fx.interval = 13;
  15871. jQuery.fx.start = function() {
  15872. if ( inProgress ) {
  15873. return;
  15874. }
  15875. inProgress = true;
  15876. schedule();
  15877. };
  15878. jQuery.fx.stop = function() {
  15879. inProgress = null;
  15880. };
  15881. jQuery.fx.speeds = {
  15882. slow: 600,
  15883. fast: 200,
  15884. // Default speed
  15885. _default: 400
  15886. };
  15887. // Based off of the plugin by Clint Helfers, with permission.
  15888. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  15889. jQuery.fn.delay = function( time, type ) {
  15890. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  15891. type = type || "fx";
  15892. return this.queue( type, function( next, hooks ) {
  15893. var timeout = window.setTimeout( next, time );
  15894. hooks.stop = function() {
  15895. window.clearTimeout( timeout );
  15896. };
  15897. } );
  15898. };
  15899. ( function() {
  15900. var input = document.createElement( "input" ),
  15901. select = document.createElement( "select" ),
  15902. opt = select.appendChild( document.createElement( "option" ) );
  15903. input.type = "checkbox";
  15904. // Support: Android <=4.3 only
  15905. // Default value for a checkbox should be "on"
  15906. support.checkOn = input.value !== "";
  15907. // Support: IE <=11 only
  15908. // Must access selectedIndex to make default options select
  15909. support.optSelected = opt.selected;
  15910. // Support: IE <=11 only
  15911. // An input loses its value after becoming a radio
  15912. input = document.createElement( "input" );
  15913. input.value = "t";
  15914. input.type = "radio";
  15915. support.radioValue = input.value === "t";
  15916. } )();
  15917. var boolHook,
  15918. attrHandle = jQuery.expr.attrHandle;
  15919. jQuery.fn.extend( {
  15920. attr: function( name, value ) {
  15921. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  15922. },
  15923. removeAttr: function( name ) {
  15924. return this.each( function() {
  15925. jQuery.removeAttr( this, name );
  15926. } );
  15927. }
  15928. } );
  15929. jQuery.extend( {
  15930. attr: function( elem, name, value ) {
  15931. var ret, hooks,
  15932. nType = elem.nodeType;
  15933. // Don't get/set attributes on text, comment and attribute nodes
  15934. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15935. return;
  15936. }
  15937. // Fallback to prop when attributes are not supported
  15938. if ( typeof elem.getAttribute === "undefined" ) {
  15939. return jQuery.prop( elem, name, value );
  15940. }
  15941. // Attribute hooks are determined by the lowercase version
  15942. // Grab necessary hook if one is defined
  15943. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15944. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15945. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15946. }
  15947. if ( value !== undefined ) {
  15948. if ( value === null ) {
  15949. jQuery.removeAttr( elem, name );
  15950. return;
  15951. }
  15952. if ( hooks && "set" in hooks &&
  15953. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15954. return ret;
  15955. }
  15956. elem.setAttribute( name, value + "" );
  15957. return value;
  15958. }
  15959. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15960. return ret;
  15961. }
  15962. ret = jQuery.find.attr( elem, name );
  15963. // Non-existent attributes return null, we normalize to undefined
  15964. return ret == null ? undefined : ret;
  15965. },
  15966. attrHooks: {
  15967. type: {
  15968. set: function( elem, value ) {
  15969. if ( !support.radioValue && value === "radio" &&
  15970. nodeName( elem, "input" ) ) {
  15971. var val = elem.value;
  15972. elem.setAttribute( "type", value );
  15973. if ( val ) {
  15974. elem.value = val;
  15975. }
  15976. return value;
  15977. }
  15978. }
  15979. }
  15980. },
  15981. removeAttr: function( elem, value ) {
  15982. var name,
  15983. i = 0,
  15984. // Attribute names can contain non-HTML whitespace characters
  15985. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15986. attrNames = value && value.match( rnothtmlwhite );
  15987. if ( attrNames && elem.nodeType === 1 ) {
  15988. while ( ( name = attrNames[ i++ ] ) ) {
  15989. elem.removeAttribute( name );
  15990. }
  15991. }
  15992. }
  15993. } );
  15994. // Hooks for boolean attributes
  15995. boolHook = {
  15996. set: function( elem, value, name ) {
  15997. if ( value === false ) {
  15998. // Remove boolean attributes when set to false
  15999. jQuery.removeAttr( elem, name );
  16000. } else {
  16001. elem.setAttribute( name, name );
  16002. }
  16003. return name;
  16004. }
  16005. };
  16006. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  16007. var getter = attrHandle[ name ] || jQuery.find.attr;
  16008. attrHandle[ name ] = function( elem, name, isXML ) {
  16009. var ret, handle,
  16010. lowercaseName = name.toLowerCase();
  16011. if ( !isXML ) {
  16012. // Avoid an infinite loop by temporarily removing this function from the getter
  16013. handle = attrHandle[ lowercaseName ];
  16014. attrHandle[ lowercaseName ] = ret;
  16015. ret = getter( elem, name, isXML ) != null ?
  16016. lowercaseName :
  16017. null;
  16018. attrHandle[ lowercaseName ] = handle;
  16019. }
  16020. return ret;
  16021. };
  16022. } );
  16023. var rfocusable = /^(?:input|select|textarea|button)$/i,
  16024. rclickable = /^(?:a|area)$/i;
  16025. jQuery.fn.extend( {
  16026. prop: function( name, value ) {
  16027. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  16028. },
  16029. removeProp: function( name ) {
  16030. return this.each( function() {
  16031. delete this[ jQuery.propFix[ name ] || name ];
  16032. } );
  16033. }
  16034. } );
  16035. jQuery.extend( {
  16036. prop: function( elem, name, value ) {
  16037. var ret, hooks,
  16038. nType = elem.nodeType;
  16039. // Don't get/set properties on text, comment and attribute nodes
  16040. if ( nType === 3 || nType === 8 || nType === 2 ) {
  16041. return;
  16042. }
  16043. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  16044. // Fix name and attach hooks
  16045. name = jQuery.propFix[ name ] || name;
  16046. hooks = jQuery.propHooks[ name ];
  16047. }
  16048. if ( value !== undefined ) {
  16049. if ( hooks && "set" in hooks &&
  16050. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  16051. return ret;
  16052. }
  16053. return ( elem[ name ] = value );
  16054. }
  16055. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  16056. return ret;
  16057. }
  16058. return elem[ name ];
  16059. },
  16060. propHooks: {
  16061. tabIndex: {
  16062. get: function( elem ) {
  16063. // Support: IE <=9 - 11 only
  16064. // elem.tabIndex doesn't always return the
  16065. // correct value when it hasn't been explicitly set
  16066. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  16067. // Use proper attribute retrieval(#12072)
  16068. var tabindex = jQuery.find.attr( elem, "tabindex" );
  16069. if ( tabindex ) {
  16070. return parseInt( tabindex, 10 );
  16071. }
  16072. if (
  16073. rfocusable.test( elem.nodeName ) ||
  16074. rclickable.test( elem.nodeName ) &&
  16075. elem.href
  16076. ) {
  16077. return 0;
  16078. }
  16079. return -1;
  16080. }
  16081. }
  16082. },
  16083. propFix: {
  16084. "for": "htmlFor",
  16085. "class": "className"
  16086. }
  16087. } );
  16088. // Support: IE <=11 only
  16089. // Accessing the selectedIndex property
  16090. // forces the browser to respect setting selected
  16091. // on the option
  16092. // The getter ensures a default option is selected
  16093. // when in an optgroup
  16094. // eslint rule "no-unused-expressions" is disabled for this code
  16095. // since it considers such accessions noop
  16096. if ( !support.optSelected ) {
  16097. jQuery.propHooks.selected = {
  16098. get: function( elem ) {
  16099. /* eslint no-unused-expressions: "off" */
  16100. var parent = elem.parentNode;
  16101. if ( parent && parent.parentNode ) {
  16102. parent.parentNode.selectedIndex;
  16103. }
  16104. return null;
  16105. },
  16106. set: function( elem ) {
  16107. /* eslint no-unused-expressions: "off" */
  16108. var parent = elem.parentNode;
  16109. if ( parent ) {
  16110. parent.selectedIndex;
  16111. if ( parent.parentNode ) {
  16112. parent.parentNode.selectedIndex;
  16113. }
  16114. }
  16115. }
  16116. };
  16117. }
  16118. jQuery.each( [
  16119. "tabIndex",
  16120. "readOnly",
  16121. "maxLength",
  16122. "cellSpacing",
  16123. "cellPadding",
  16124. "rowSpan",
  16125. "colSpan",
  16126. "useMap",
  16127. "frameBorder",
  16128. "contentEditable"
  16129. ], function() {
  16130. jQuery.propFix[ this.toLowerCase() ] = this;
  16131. } );
  16132. // Strip and collapse whitespace according to HTML spec
  16133. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  16134. function stripAndCollapse( value ) {
  16135. var tokens = value.match( rnothtmlwhite ) || [];
  16136. return tokens.join( " " );
  16137. }
  16138. function getClass( elem ) {
  16139. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  16140. }
  16141. function classesToArray( value ) {
  16142. if ( Array.isArray( value ) ) {
  16143. return value;
  16144. }
  16145. if ( typeof value === "string" ) {
  16146. return value.match( rnothtmlwhite ) || [];
  16147. }
  16148. return [];
  16149. }
  16150. jQuery.fn.extend( {
  16151. addClass: function( value ) {
  16152. var classes, elem, cur, curValue, clazz, j, finalValue,
  16153. i = 0;
  16154. if ( isFunction( value ) ) {
  16155. return this.each( function( j ) {
  16156. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  16157. } );
  16158. }
  16159. classes = classesToArray( value );
  16160. if ( classes.length ) {
  16161. while ( ( elem = this[ i++ ] ) ) {
  16162. curValue = getClass( elem );
  16163. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  16164. if ( cur ) {
  16165. j = 0;
  16166. while ( ( clazz = classes[ j++ ] ) ) {
  16167. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  16168. cur += clazz + " ";
  16169. }
  16170. }
  16171. // Only assign if different to avoid unneeded rendering.
  16172. finalValue = stripAndCollapse( cur );
  16173. if ( curValue !== finalValue ) {
  16174. elem.setAttribute( "class", finalValue );
  16175. }
  16176. }
  16177. }
  16178. }
  16179. return this;
  16180. },
  16181. removeClass: function( value ) {
  16182. var classes, elem, cur, curValue, clazz, j, finalValue,
  16183. i = 0;
  16184. if ( isFunction( value ) ) {
  16185. return this.each( function( j ) {
  16186. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  16187. } );
  16188. }
  16189. if ( !arguments.length ) {
  16190. return this.attr( "class", "" );
  16191. }
  16192. classes = classesToArray( value );
  16193. if ( classes.length ) {
  16194. while ( ( elem = this[ i++ ] ) ) {
  16195. curValue = getClass( elem );
  16196. // This expression is here for better compressibility (see addClass)
  16197. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  16198. if ( cur ) {
  16199. j = 0;
  16200. while ( ( clazz = classes[ j++ ] ) ) {
  16201. // Remove *all* instances
  16202. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  16203. cur = cur.replace( " " + clazz + " ", " " );
  16204. }
  16205. }
  16206. // Only assign if different to avoid unneeded rendering.
  16207. finalValue = stripAndCollapse( cur );
  16208. if ( curValue !== finalValue ) {
  16209. elem.setAttribute( "class", finalValue );
  16210. }
  16211. }
  16212. }
  16213. }
  16214. return this;
  16215. },
  16216. toggleClass: function( value, stateVal ) {
  16217. var type = typeof value,
  16218. isValidValue = type === "string" || Array.isArray( value );
  16219. if ( typeof stateVal === "boolean" && isValidValue ) {
  16220. return stateVal ? this.addClass( value ) : this.removeClass( value );
  16221. }
  16222. if ( isFunction( value ) ) {
  16223. return this.each( function( i ) {
  16224. jQuery( this ).toggleClass(
  16225. value.call( this, i, getClass( this ), stateVal ),
  16226. stateVal
  16227. );
  16228. } );
  16229. }
  16230. return this.each( function() {
  16231. var className, i, self, classNames;
  16232. if ( isValidValue ) {
  16233. // Toggle individual class names
  16234. i = 0;
  16235. self = jQuery( this );
  16236. classNames = classesToArray( value );
  16237. while ( ( className = classNames[ i++ ] ) ) {
  16238. // Check each className given, space separated list
  16239. if ( self.hasClass( className ) ) {
  16240. self.removeClass( className );
  16241. } else {
  16242. self.addClass( className );
  16243. }
  16244. }
  16245. // Toggle whole class name
  16246. } else if ( value === undefined || type === "boolean" ) {
  16247. className = getClass( this );
  16248. if ( className ) {
  16249. // Store className if set
  16250. dataPriv.set( this, "__className__", className );
  16251. }
  16252. // If the element has a class name or if we're passed `false`,
  16253. // then remove the whole classname (if there was one, the above saved it).
  16254. // Otherwise bring back whatever was previously saved (if anything),
  16255. // falling back to the empty string if nothing was stored.
  16256. if ( this.setAttribute ) {
  16257. this.setAttribute( "class",
  16258. className || value === false ?
  16259. "" :
  16260. dataPriv.get( this, "__className__" ) || ""
  16261. );
  16262. }
  16263. }
  16264. } );
  16265. },
  16266. hasClass: function( selector ) {
  16267. var className, elem,
  16268. i = 0;
  16269. className = " " + selector + " ";
  16270. while ( ( elem = this[ i++ ] ) ) {
  16271. if ( elem.nodeType === 1 &&
  16272. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  16273. return true;
  16274. }
  16275. }
  16276. return false;
  16277. }
  16278. } );
  16279. var rreturn = /\r/g;
  16280. jQuery.fn.extend( {
  16281. val: function( value ) {
  16282. var hooks, ret, valueIsFunction,
  16283. elem = this[ 0 ];
  16284. if ( !arguments.length ) {
  16285. if ( elem ) {
  16286. hooks = jQuery.valHooks[ elem.type ] ||
  16287. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  16288. if ( hooks &&
  16289. "get" in hooks &&
  16290. ( ret = hooks.get( elem, "value" ) ) !== undefined
  16291. ) {
  16292. return ret;
  16293. }
  16294. ret = elem.value;
  16295. // Handle most common string cases
  16296. if ( typeof ret === "string" ) {
  16297. return ret.replace( rreturn, "" );
  16298. }
  16299. // Handle cases where value is null/undef or number
  16300. return ret == null ? "" : ret;
  16301. }
  16302. return;
  16303. }
  16304. valueIsFunction = isFunction( value );
  16305. return this.each( function( i ) {
  16306. var val;
  16307. if ( this.nodeType !== 1 ) {
  16308. return;
  16309. }
  16310. if ( valueIsFunction ) {
  16311. val = value.call( this, i, jQuery( this ).val() );
  16312. } else {
  16313. val = value;
  16314. }
  16315. // Treat null/undefined as ""; convert numbers to string
  16316. if ( val == null ) {
  16317. val = "";
  16318. } else if ( typeof val === "number" ) {
  16319. val += "";
  16320. } else if ( Array.isArray( val ) ) {
  16321. val = jQuery.map( val, function( value ) {
  16322. return value == null ? "" : value + "";
  16323. } );
  16324. }
  16325. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  16326. // If set returns undefined, fall back to normal setting
  16327. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  16328. this.value = val;
  16329. }
  16330. } );
  16331. }
  16332. } );
  16333. jQuery.extend( {
  16334. valHooks: {
  16335. option: {
  16336. get: function( elem ) {
  16337. var val = jQuery.find.attr( elem, "value" );
  16338. return val != null ?
  16339. val :
  16340. // Support: IE <=10 - 11 only
  16341. // option.text throws exceptions (#14686, #14858)
  16342. // Strip and collapse whitespace
  16343. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  16344. stripAndCollapse( jQuery.text( elem ) );
  16345. }
  16346. },
  16347. select: {
  16348. get: function( elem ) {
  16349. var value, option, i,
  16350. options = elem.options,
  16351. index = elem.selectedIndex,
  16352. one = elem.type === "select-one",
  16353. values = one ? null : [],
  16354. max = one ? index + 1 : options.length;
  16355. if ( index < 0 ) {
  16356. i = max;
  16357. } else {
  16358. i = one ? index : 0;
  16359. }
  16360. // Loop through all the selected options
  16361. for ( ; i < max; i++ ) {
  16362. option = options[ i ];
  16363. // Support: IE <=9 only
  16364. // IE8-9 doesn't update selected after form reset (#2551)
  16365. if ( ( option.selected || i === index ) &&
  16366. // Don't return options that are disabled or in a disabled optgroup
  16367. !option.disabled &&
  16368. ( !option.parentNode.disabled ||
  16369. !nodeName( option.parentNode, "optgroup" ) ) ) {
  16370. // Get the specific value for the option
  16371. value = jQuery( option ).val();
  16372. // We don't need an array for one selects
  16373. if ( one ) {
  16374. return value;
  16375. }
  16376. // Multi-Selects return an array
  16377. values.push( value );
  16378. }
  16379. }
  16380. return values;
  16381. },
  16382. set: function( elem, value ) {
  16383. var optionSet, option,
  16384. options = elem.options,
  16385. values = jQuery.makeArray( value ),
  16386. i = options.length;
  16387. while ( i-- ) {
  16388. option = options[ i ];
  16389. /* eslint-disable no-cond-assign */
  16390. if ( option.selected =
  16391. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  16392. ) {
  16393. optionSet = true;
  16394. }
  16395. /* eslint-enable no-cond-assign */
  16396. }
  16397. // Force browsers to behave consistently when non-matching value is set
  16398. if ( !optionSet ) {
  16399. elem.selectedIndex = -1;
  16400. }
  16401. return values;
  16402. }
  16403. }
  16404. }
  16405. } );
  16406. // Radios and checkboxes getter/setter
  16407. jQuery.each( [ "radio", "checkbox" ], function() {
  16408. jQuery.valHooks[ this ] = {
  16409. set: function( elem, value ) {
  16410. if ( Array.isArray( value ) ) {
  16411. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  16412. }
  16413. }
  16414. };
  16415. if ( !support.checkOn ) {
  16416. jQuery.valHooks[ this ].get = function( elem ) {
  16417. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  16418. };
  16419. }
  16420. } );
  16421. // Return jQuery for attributes-only inclusion
  16422. support.focusin = "onfocusin" in window;
  16423. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  16424. stopPropagationCallback = function( e ) {
  16425. e.stopPropagation();
  16426. };
  16427. jQuery.extend( jQuery.event, {
  16428. trigger: function( event, data, elem, onlyHandlers ) {
  16429. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  16430. eventPath = [ elem || document ],
  16431. type = hasOwn.call( event, "type" ) ? event.type : event,
  16432. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  16433. cur = lastElement = tmp = elem = elem || document;
  16434. // Don't do events on text and comment nodes
  16435. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  16436. return;
  16437. }
  16438. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  16439. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  16440. return;
  16441. }
  16442. if ( type.indexOf( "." ) > -1 ) {
  16443. // Namespaced trigger; create a regexp to match event type in handle()
  16444. namespaces = type.split( "." );
  16445. type = namespaces.shift();
  16446. namespaces.sort();
  16447. }
  16448. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  16449. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  16450. event = event[ jQuery.expando ] ?
  16451. event :
  16452. new jQuery.Event( type, typeof event === "object" && event );
  16453. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  16454. event.isTrigger = onlyHandlers ? 2 : 3;
  16455. event.namespace = namespaces.join( "." );
  16456. event.rnamespace = event.namespace ?
  16457. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  16458. null;
  16459. // Clean up the event in case it is being reused
  16460. event.result = undefined;
  16461. if ( !event.target ) {
  16462. event.target = elem;
  16463. }
  16464. // Clone any incoming data and prepend the event, creating the handler arg list
  16465. data = data == null ?
  16466. [ event ] :
  16467. jQuery.makeArray( data, [ event ] );
  16468. // Allow special events to draw outside the lines
  16469. special = jQuery.event.special[ type ] || {};
  16470. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  16471. return;
  16472. }
  16473. // Determine event propagation path in advance, per W3C events spec (#9951)
  16474. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  16475. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  16476. bubbleType = special.delegateType || type;
  16477. if ( !rfocusMorph.test( bubbleType + type ) ) {
  16478. cur = cur.parentNode;
  16479. }
  16480. for ( ; cur; cur = cur.parentNode ) {
  16481. eventPath.push( cur );
  16482. tmp = cur;
  16483. }
  16484. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  16485. if ( tmp === ( elem.ownerDocument || document ) ) {
  16486. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  16487. }
  16488. }
  16489. // Fire handlers on the event path
  16490. i = 0;
  16491. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  16492. lastElement = cur;
  16493. event.type = i > 1 ?
  16494. bubbleType :
  16495. special.bindType || type;
  16496. // jQuery handler
  16497. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  16498. dataPriv.get( cur, "handle" );
  16499. if ( handle ) {
  16500. handle.apply( cur, data );
  16501. }
  16502. // Native handler
  16503. handle = ontype && cur[ ontype ];
  16504. if ( handle && handle.apply && acceptData( cur ) ) {
  16505. event.result = handle.apply( cur, data );
  16506. if ( event.result === false ) {
  16507. event.preventDefault();
  16508. }
  16509. }
  16510. }
  16511. event.type = type;
  16512. // If nobody prevented the default action, do it now
  16513. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  16514. if ( ( !special._default ||
  16515. special._default.apply( eventPath.pop(), data ) === false ) &&
  16516. acceptData( elem ) ) {
  16517. // Call a native DOM method on the target with the same name as the event.
  16518. // Don't do default actions on window, that's where global variables be (#6170)
  16519. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  16520. // Don't re-trigger an onFOO event when we call its FOO() method
  16521. tmp = elem[ ontype ];
  16522. if ( tmp ) {
  16523. elem[ ontype ] = null;
  16524. }
  16525. // Prevent re-triggering of the same event, since we already bubbled it above
  16526. jQuery.event.triggered = type;
  16527. if ( event.isPropagationStopped() ) {
  16528. lastElement.addEventListener( type, stopPropagationCallback );
  16529. }
  16530. elem[ type ]();
  16531. if ( event.isPropagationStopped() ) {
  16532. lastElement.removeEventListener( type, stopPropagationCallback );
  16533. }
  16534. jQuery.event.triggered = undefined;
  16535. if ( tmp ) {
  16536. elem[ ontype ] = tmp;
  16537. }
  16538. }
  16539. }
  16540. }
  16541. return event.result;
  16542. },
  16543. // Piggyback on a donor event to simulate a different one
  16544. // Used only for `focus(in | out)` events
  16545. simulate: function( type, elem, event ) {
  16546. var e = jQuery.extend(
  16547. new jQuery.Event(),
  16548. event,
  16549. {
  16550. type: type,
  16551. isSimulated: true
  16552. }
  16553. );
  16554. jQuery.event.trigger( e, null, elem );
  16555. }
  16556. } );
  16557. jQuery.fn.extend( {
  16558. trigger: function( type, data ) {
  16559. return this.each( function() {
  16560. jQuery.event.trigger( type, data, this );
  16561. } );
  16562. },
  16563. triggerHandler: function( type, data ) {
  16564. var elem = this[ 0 ];
  16565. if ( elem ) {
  16566. return jQuery.event.trigger( type, data, elem, true );
  16567. }
  16568. }
  16569. } );
  16570. // Support: Firefox <=44
  16571. // Firefox doesn't have focus(in | out) events
  16572. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  16573. //
  16574. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  16575. // focus(in | out) events fire after focus & blur events,
  16576. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  16577. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  16578. if ( !support.focusin ) {
  16579. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  16580. // Attach a single capturing handler on the document while someone wants focusin/focusout
  16581. var handler = function( event ) {
  16582. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  16583. };
  16584. jQuery.event.special[ fix ] = {
  16585. setup: function() {
  16586. var doc = this.ownerDocument || this,
  16587. attaches = dataPriv.access( doc, fix );
  16588. if ( !attaches ) {
  16589. doc.addEventListener( orig, handler, true );
  16590. }
  16591. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  16592. },
  16593. teardown: function() {
  16594. var doc = this.ownerDocument || this,
  16595. attaches = dataPriv.access( doc, fix ) - 1;
  16596. if ( !attaches ) {
  16597. doc.removeEventListener( orig, handler, true );
  16598. dataPriv.remove( doc, fix );
  16599. } else {
  16600. dataPriv.access( doc, fix, attaches );
  16601. }
  16602. }
  16603. };
  16604. } );
  16605. }
  16606. var location = window.location;
  16607. var nonce = Date.now();
  16608. var rquery = ( /\?/ );
  16609. // Cross-browser xml parsing
  16610. jQuery.parseXML = function( data ) {
  16611. var xml;
  16612. if ( !data || typeof data !== "string" ) {
  16613. return null;
  16614. }
  16615. // Support: IE 9 - 11 only
  16616. // IE throws on parseFromString with invalid input.
  16617. try {
  16618. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  16619. } catch ( e ) {
  16620. xml = undefined;
  16621. }
  16622. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  16623. jQuery.error( "Invalid XML: " + data );
  16624. }
  16625. return xml;
  16626. };
  16627. var
  16628. rbracket = /\[\]$/,
  16629. rCRLF = /\r?\n/g,
  16630. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  16631. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  16632. function buildParams( prefix, obj, traditional, add ) {
  16633. var name;
  16634. if ( Array.isArray( obj ) ) {
  16635. // Serialize array item.
  16636. jQuery.each( obj, function( i, v ) {
  16637. if ( traditional || rbracket.test( prefix ) ) {
  16638. // Treat each array item as a scalar.
  16639. add( prefix, v );
  16640. } else {
  16641. // Item is non-scalar (array or object), encode its numeric index.
  16642. buildParams(
  16643. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  16644. v,
  16645. traditional,
  16646. add
  16647. );
  16648. }
  16649. } );
  16650. } else if ( !traditional && toType( obj ) === "object" ) {
  16651. // Serialize object item.
  16652. for ( name in obj ) {
  16653. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  16654. }
  16655. } else {
  16656. // Serialize scalar item.
  16657. add( prefix, obj );
  16658. }
  16659. }
  16660. // Serialize an array of form elements or a set of
  16661. // key/values into a query string
  16662. jQuery.param = function( a, traditional ) {
  16663. var prefix,
  16664. s = [],
  16665. add = function( key, valueOrFunction ) {
  16666. // If value is a function, invoke it and use its return value
  16667. var value = isFunction( valueOrFunction ) ?
  16668. valueOrFunction() :
  16669. valueOrFunction;
  16670. s[ s.length ] = encodeURIComponent( key ) + "=" +
  16671. encodeURIComponent( value == null ? "" : value );
  16672. };
  16673. if ( a == null ) {
  16674. return "";
  16675. }
  16676. // If an array was passed in, assume that it is an array of form elements.
  16677. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  16678. // Serialize the form elements
  16679. jQuery.each( a, function() {
  16680. add( this.name, this.value );
  16681. } );
  16682. } else {
  16683. // If traditional, encode the "old" way (the way 1.3.2 or older
  16684. // did it), otherwise encode params recursively.
  16685. for ( prefix in a ) {
  16686. buildParams( prefix, a[ prefix ], traditional, add );
  16687. }
  16688. }
  16689. // Return the resulting serialization
  16690. return s.join( "&" );
  16691. };
  16692. jQuery.fn.extend( {
  16693. serialize: function() {
  16694. return jQuery.param( this.serializeArray() );
  16695. },
  16696. serializeArray: function() {
  16697. return this.map( function() {
  16698. // Can add propHook for "elements" to filter or add form elements
  16699. var elements = jQuery.prop( this, "elements" );
  16700. return elements ? jQuery.makeArray( elements ) : this;
  16701. } )
  16702. .filter( function() {
  16703. var type = this.type;
  16704. // Use .is( ":disabled" ) so that fieldset[disabled] works
  16705. return this.name && !jQuery( this ).is( ":disabled" ) &&
  16706. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  16707. ( this.checked || !rcheckableType.test( type ) );
  16708. } )
  16709. .map( function( i, elem ) {
  16710. var val = jQuery( this ).val();
  16711. if ( val == null ) {
  16712. return null;
  16713. }
  16714. if ( Array.isArray( val ) ) {
  16715. return jQuery.map( val, function( val ) {
  16716. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16717. } );
  16718. }
  16719. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16720. } ).get();
  16721. }
  16722. } );
  16723. var
  16724. r20 = /%20/g,
  16725. rhash = /#.*$/,
  16726. rantiCache = /([?&])_=[^&]*/,
  16727. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  16728. // #7653, #8125, #8152: local protocol detection
  16729. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  16730. rnoContent = /^(?:GET|HEAD)$/,
  16731. rprotocol = /^\/\//,
  16732. /* Prefilters
  16733. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  16734. * 2) These are called:
  16735. * - BEFORE asking for a transport
  16736. * - AFTER param serialization (s.data is a string if s.processData is true)
  16737. * 3) key is the dataType
  16738. * 4) the catchall symbol "*" can be used
  16739. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  16740. */
  16741. prefilters = {},
  16742. /* Transports bindings
  16743. * 1) key is the dataType
  16744. * 2) the catchall symbol "*" can be used
  16745. * 3) selection will start with transport dataType and THEN go to "*" if needed
  16746. */
  16747. transports = {},
  16748. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  16749. allTypes = "*/".concat( "*" ),
  16750. // Anchor tag for parsing the document origin
  16751. originAnchor = document.createElement( "a" );
  16752. originAnchor.href = location.href;
  16753. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  16754. function addToPrefiltersOrTransports( structure ) {
  16755. // dataTypeExpression is optional and defaults to "*"
  16756. return function( dataTypeExpression, func ) {
  16757. if ( typeof dataTypeExpression !== "string" ) {
  16758. func = dataTypeExpression;
  16759. dataTypeExpression = "*";
  16760. }
  16761. var dataType,
  16762. i = 0,
  16763. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  16764. if ( isFunction( func ) ) {
  16765. // For each dataType in the dataTypeExpression
  16766. while ( ( dataType = dataTypes[ i++ ] ) ) {
  16767. // Prepend if requested
  16768. if ( dataType[ 0 ] === "+" ) {
  16769. dataType = dataType.slice( 1 ) || "*";
  16770. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  16771. // Otherwise append
  16772. } else {
  16773. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  16774. }
  16775. }
  16776. }
  16777. };
  16778. }
  16779. // Base inspection function for prefilters and transports
  16780. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  16781. var inspected = {},
  16782. seekingTransport = ( structure === transports );
  16783. function inspect( dataType ) {
  16784. var selected;
  16785. inspected[ dataType ] = true;
  16786. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  16787. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  16788. if ( typeof dataTypeOrTransport === "string" &&
  16789. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  16790. options.dataTypes.unshift( dataTypeOrTransport );
  16791. inspect( dataTypeOrTransport );
  16792. return false;
  16793. } else if ( seekingTransport ) {
  16794. return !( selected = dataTypeOrTransport );
  16795. }
  16796. } );
  16797. return selected;
  16798. }
  16799. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  16800. }
  16801. // A special extend for ajax options
  16802. // that takes "flat" options (not to be deep extended)
  16803. // Fixes #9887
  16804. function ajaxExtend( target, src ) {
  16805. var key, deep,
  16806. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  16807. for ( key in src ) {
  16808. if ( src[ key ] !== undefined ) {
  16809. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  16810. }
  16811. }
  16812. if ( deep ) {
  16813. jQuery.extend( true, target, deep );
  16814. }
  16815. return target;
  16816. }
  16817. /* Handles responses to an ajax request:
  16818. * - finds the right dataType (mediates between content-type and expected dataType)
  16819. * - returns the corresponding response
  16820. */
  16821. function ajaxHandleResponses( s, jqXHR, responses ) {
  16822. var ct, type, finalDataType, firstDataType,
  16823. contents = s.contents,
  16824. dataTypes = s.dataTypes;
  16825. // Remove auto dataType and get content-type in the process
  16826. while ( dataTypes[ 0 ] === "*" ) {
  16827. dataTypes.shift();
  16828. if ( ct === undefined ) {
  16829. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  16830. }
  16831. }
  16832. // Check if we're dealing with a known content-type
  16833. if ( ct ) {
  16834. for ( type in contents ) {
  16835. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  16836. dataTypes.unshift( type );
  16837. break;
  16838. }
  16839. }
  16840. }
  16841. // Check to see if we have a response for the expected dataType
  16842. if ( dataTypes[ 0 ] in responses ) {
  16843. finalDataType = dataTypes[ 0 ];
  16844. } else {
  16845. // Try convertible dataTypes
  16846. for ( type in responses ) {
  16847. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  16848. finalDataType = type;
  16849. break;
  16850. }
  16851. if ( !firstDataType ) {
  16852. firstDataType = type;
  16853. }
  16854. }
  16855. // Or just use first one
  16856. finalDataType = finalDataType || firstDataType;
  16857. }
  16858. // If we found a dataType
  16859. // We add the dataType to the list if needed
  16860. // and return the corresponding response
  16861. if ( finalDataType ) {
  16862. if ( finalDataType !== dataTypes[ 0 ] ) {
  16863. dataTypes.unshift( finalDataType );
  16864. }
  16865. return responses[ finalDataType ];
  16866. }
  16867. }
  16868. /* Chain conversions given the request and the original response
  16869. * Also sets the responseXXX fields on the jqXHR instance
  16870. */
  16871. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  16872. var conv2, current, conv, tmp, prev,
  16873. converters = {},
  16874. // Work with a copy of dataTypes in case we need to modify it for conversion
  16875. dataTypes = s.dataTypes.slice();
  16876. // Create converters map with lowercased keys
  16877. if ( dataTypes[ 1 ] ) {
  16878. for ( conv in s.converters ) {
  16879. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  16880. }
  16881. }
  16882. current = dataTypes.shift();
  16883. // Convert to each sequential dataType
  16884. while ( current ) {
  16885. if ( s.responseFields[ current ] ) {
  16886. jqXHR[ s.responseFields[ current ] ] = response;
  16887. }
  16888. // Apply the dataFilter if provided
  16889. if ( !prev && isSuccess && s.dataFilter ) {
  16890. response = s.dataFilter( response, s.dataType );
  16891. }
  16892. prev = current;
  16893. current = dataTypes.shift();
  16894. if ( current ) {
  16895. // There's only work to do if current dataType is non-auto
  16896. if ( current === "*" ) {
  16897. current = prev;
  16898. // Convert response if prev dataType is non-auto and differs from current
  16899. } else if ( prev !== "*" && prev !== current ) {
  16900. // Seek a direct converter
  16901. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  16902. // If none found, seek a pair
  16903. if ( !conv ) {
  16904. for ( conv2 in converters ) {
  16905. // If conv2 outputs current
  16906. tmp = conv2.split( " " );
  16907. if ( tmp[ 1 ] === current ) {
  16908. // If prev can be converted to accepted input
  16909. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  16910. converters[ "* " + tmp[ 0 ] ];
  16911. if ( conv ) {
  16912. // Condense equivalence converters
  16913. if ( conv === true ) {
  16914. conv = converters[ conv2 ];
  16915. // Otherwise, insert the intermediate dataType
  16916. } else if ( converters[ conv2 ] !== true ) {
  16917. current = tmp[ 0 ];
  16918. dataTypes.unshift( tmp[ 1 ] );
  16919. }
  16920. break;
  16921. }
  16922. }
  16923. }
  16924. }
  16925. // Apply converter (if not an equivalence)
  16926. if ( conv !== true ) {
  16927. // Unless errors are allowed to bubble, catch and return them
  16928. if ( conv && s.throws ) {
  16929. response = conv( response );
  16930. } else {
  16931. try {
  16932. response = conv( response );
  16933. } catch ( e ) {
  16934. return {
  16935. state: "parsererror",
  16936. error: conv ? e : "No conversion from " + prev + " to " + current
  16937. };
  16938. }
  16939. }
  16940. }
  16941. }
  16942. }
  16943. }
  16944. return { state: "success", data: response };
  16945. }
  16946. jQuery.extend( {
  16947. // Counter for holding the number of active queries
  16948. active: 0,
  16949. // Last-Modified header cache for next request
  16950. lastModified: {},
  16951. etag: {},
  16952. ajaxSettings: {
  16953. url: location.href,
  16954. type: "GET",
  16955. isLocal: rlocalProtocol.test( location.protocol ),
  16956. global: true,
  16957. processData: true,
  16958. async: true,
  16959. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16960. /*
  16961. timeout: 0,
  16962. data: null,
  16963. dataType: null,
  16964. username: null,
  16965. password: null,
  16966. cache: null,
  16967. throws: false,
  16968. traditional: false,
  16969. headers: {},
  16970. */
  16971. accepts: {
  16972. "*": allTypes,
  16973. text: "text/plain",
  16974. html: "text/html",
  16975. xml: "application/xml, text/xml",
  16976. json: "application/json, text/javascript"
  16977. },
  16978. contents: {
  16979. xml: /\bxml\b/,
  16980. html: /\bhtml/,
  16981. json: /\bjson\b/
  16982. },
  16983. responseFields: {
  16984. xml: "responseXML",
  16985. text: "responseText",
  16986. json: "responseJSON"
  16987. },
  16988. // Data converters
  16989. // Keys separate source (or catchall "*") and destination types with a single space
  16990. converters: {
  16991. // Convert anything to text
  16992. "* text": String,
  16993. // Text to html (true = no transformation)
  16994. "text html": true,
  16995. // Evaluate text as a json expression
  16996. "text json": JSON.parse,
  16997. // Parse text as xml
  16998. "text xml": jQuery.parseXML
  16999. },
  17000. // For options that shouldn't be deep extended:
  17001. // you can add your own custom options here if
  17002. // and when you create one that shouldn't be
  17003. // deep extended (see ajaxExtend)
  17004. flatOptions: {
  17005. url: true,
  17006. context: true
  17007. }
  17008. },
  17009. // Creates a full fledged settings object into target
  17010. // with both ajaxSettings and settings fields.
  17011. // If target is omitted, writes into ajaxSettings.
  17012. ajaxSetup: function( target, settings ) {
  17013. return settings ?
  17014. // Building a settings object
  17015. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  17016. // Extending ajaxSettings
  17017. ajaxExtend( jQuery.ajaxSettings, target );
  17018. },
  17019. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  17020. ajaxTransport: addToPrefiltersOrTransports( transports ),
  17021. // Main method
  17022. ajax: function( url, options ) {
  17023. // If url is an object, simulate pre-1.5 signature
  17024. if ( typeof url === "object" ) {
  17025. options = url;
  17026. url = undefined;
  17027. }
  17028. // Force options to be an object
  17029. options = options || {};
  17030. var transport,
  17031. // URL without anti-cache param
  17032. cacheURL,
  17033. // Response headers
  17034. responseHeadersString,
  17035. responseHeaders,
  17036. // timeout handle
  17037. timeoutTimer,
  17038. // Url cleanup var
  17039. urlAnchor,
  17040. // Request state (becomes false upon send and true upon completion)
  17041. completed,
  17042. // To know if global events are to be dispatched
  17043. fireGlobals,
  17044. // Loop variable
  17045. i,
  17046. // uncached part of the url
  17047. uncached,
  17048. // Create the final options object
  17049. s = jQuery.ajaxSetup( {}, options ),
  17050. // Callbacks context
  17051. callbackContext = s.context || s,
  17052. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  17053. globalEventContext = s.context &&
  17054. ( callbackContext.nodeType || callbackContext.jquery ) ?
  17055. jQuery( callbackContext ) :
  17056. jQuery.event,
  17057. // Deferreds
  17058. deferred = jQuery.Deferred(),
  17059. completeDeferred = jQuery.Callbacks( "once memory" ),
  17060. // Status-dependent callbacks
  17061. statusCode = s.statusCode || {},
  17062. // Headers (they are sent all at once)
  17063. requestHeaders = {},
  17064. requestHeadersNames = {},
  17065. // Default abort message
  17066. strAbort = "canceled",
  17067. // Fake xhr
  17068. jqXHR = {
  17069. readyState: 0,
  17070. // Builds headers hashtable if needed
  17071. getResponseHeader: function( key ) {
  17072. var match;
  17073. if ( completed ) {
  17074. if ( !responseHeaders ) {
  17075. responseHeaders = {};
  17076. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  17077. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  17078. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  17079. .concat( match[ 2 ] );
  17080. }
  17081. }
  17082. match = responseHeaders[ key.toLowerCase() + " " ];
  17083. }
  17084. return match == null ? null : match.join( ", " );
  17085. },
  17086. // Raw string
  17087. getAllResponseHeaders: function() {
  17088. return completed ? responseHeadersString : null;
  17089. },
  17090. // Caches the header
  17091. setRequestHeader: function( name, value ) {
  17092. if ( completed == null ) {
  17093. name = requestHeadersNames[ name.toLowerCase() ] =
  17094. requestHeadersNames[ name.toLowerCase() ] || name;
  17095. requestHeaders[ name ] = value;
  17096. }
  17097. return this;
  17098. },
  17099. // Overrides response content-type header
  17100. overrideMimeType: function( type ) {
  17101. if ( completed == null ) {
  17102. s.mimeType = type;
  17103. }
  17104. return this;
  17105. },
  17106. // Status-dependent callbacks
  17107. statusCode: function( map ) {
  17108. var code;
  17109. if ( map ) {
  17110. if ( completed ) {
  17111. // Execute the appropriate callbacks
  17112. jqXHR.always( map[ jqXHR.status ] );
  17113. } else {
  17114. // Lazy-add the new callbacks in a way that preserves old ones
  17115. for ( code in map ) {
  17116. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  17117. }
  17118. }
  17119. }
  17120. return this;
  17121. },
  17122. // Cancel the request
  17123. abort: function( statusText ) {
  17124. var finalText = statusText || strAbort;
  17125. if ( transport ) {
  17126. transport.abort( finalText );
  17127. }
  17128. done( 0, finalText );
  17129. return this;
  17130. }
  17131. };
  17132. // Attach deferreds
  17133. deferred.promise( jqXHR );
  17134. // Add protocol if not provided (prefilters might expect it)
  17135. // Handle falsy url in the settings object (#10093: consistency with old signature)
  17136. // We also use the url parameter if available
  17137. s.url = ( ( url || s.url || location.href ) + "" )
  17138. .replace( rprotocol, location.protocol + "//" );
  17139. // Alias method option to type as per ticket #12004
  17140. s.type = options.method || options.type || s.method || s.type;
  17141. // Extract dataTypes list
  17142. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  17143. // A cross-domain request is in order when the origin doesn't match the current origin.
  17144. if ( s.crossDomain == null ) {
  17145. urlAnchor = document.createElement( "a" );
  17146. // Support: IE <=8 - 11, Edge 12 - 15
  17147. // IE throws exception on accessing the href property if url is malformed,
  17148. // e.g. http://example.com:80x/
  17149. try {
  17150. urlAnchor.href = s.url;
  17151. // Support: IE <=8 - 11 only
  17152. // Anchor's host property isn't correctly set when s.url is relative
  17153. urlAnchor.href = urlAnchor.href;
  17154. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  17155. urlAnchor.protocol + "//" + urlAnchor.host;
  17156. } catch ( e ) {
  17157. // If there is an error parsing the URL, assume it is crossDomain,
  17158. // it can be rejected by the transport if it is invalid
  17159. s.crossDomain = true;
  17160. }
  17161. }
  17162. // Convert data if not already a string
  17163. if ( s.data && s.processData && typeof s.data !== "string" ) {
  17164. s.data = jQuery.param( s.data, s.traditional );
  17165. }
  17166. // Apply prefilters
  17167. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  17168. // If request was aborted inside a prefilter, stop there
  17169. if ( completed ) {
  17170. return jqXHR;
  17171. }
  17172. // We can fire global events as of now if asked to
  17173. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  17174. fireGlobals = jQuery.event && s.global;
  17175. // Watch for a new set of requests
  17176. if ( fireGlobals && jQuery.active++ === 0 ) {
  17177. jQuery.event.trigger( "ajaxStart" );
  17178. }
  17179. // Uppercase the type
  17180. s.type = s.type.toUpperCase();
  17181. // Determine if request has content
  17182. s.hasContent = !rnoContent.test( s.type );
  17183. // Save the URL in case we're toying with the If-Modified-Since
  17184. // and/or If-None-Match header later on
  17185. // Remove hash to simplify url manipulation
  17186. cacheURL = s.url.replace( rhash, "" );
  17187. // More options handling for requests with no content
  17188. if ( !s.hasContent ) {
  17189. // Remember the hash so we can put it back
  17190. uncached = s.url.slice( cacheURL.length );
  17191. // If data is available and should be processed, append data to url
  17192. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  17193. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  17194. // #9682: remove data so that it's not used in an eventual retry
  17195. delete s.data;
  17196. }
  17197. // Add or update anti-cache param if needed
  17198. if ( s.cache === false ) {
  17199. cacheURL = cacheURL.replace( rantiCache, "$1" );
  17200. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  17201. }
  17202. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  17203. s.url = cacheURL + uncached;
  17204. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  17205. } else if ( s.data && s.processData &&
  17206. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  17207. s.data = s.data.replace( r20, "+" );
  17208. }
  17209. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  17210. if ( s.ifModified ) {
  17211. if ( jQuery.lastModified[ cacheURL ] ) {
  17212. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  17213. }
  17214. if ( jQuery.etag[ cacheURL ] ) {
  17215. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  17216. }
  17217. }
  17218. // Set the correct header, if data is being sent
  17219. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  17220. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  17221. }
  17222. // Set the Accepts header for the server, depending on the dataType
  17223. jqXHR.setRequestHeader(
  17224. "Accept",
  17225. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  17226. s.accepts[ s.dataTypes[ 0 ] ] +
  17227. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  17228. s.accepts[ "*" ]
  17229. );
  17230. // Check for headers option
  17231. for ( i in s.headers ) {
  17232. jqXHR.setRequestHeader( i, s.headers[ i ] );
  17233. }
  17234. // Allow custom headers/mimetypes and early abort
  17235. if ( s.beforeSend &&
  17236. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  17237. // Abort if not done already and return
  17238. return jqXHR.abort();
  17239. }
  17240. // Aborting is no longer a cancellation
  17241. strAbort = "abort";
  17242. // Install callbacks on deferreds
  17243. completeDeferred.add( s.complete );
  17244. jqXHR.done( s.success );
  17245. jqXHR.fail( s.error );
  17246. // Get transport
  17247. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  17248. // If no transport, we auto-abort
  17249. if ( !transport ) {
  17250. done( -1, "No Transport" );
  17251. } else {
  17252. jqXHR.readyState = 1;
  17253. // Send global event
  17254. if ( fireGlobals ) {
  17255. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  17256. }
  17257. // If request was aborted inside ajaxSend, stop there
  17258. if ( completed ) {
  17259. return jqXHR;
  17260. }
  17261. // Timeout
  17262. if ( s.async && s.timeout > 0 ) {
  17263. timeoutTimer = window.setTimeout( function() {
  17264. jqXHR.abort( "timeout" );
  17265. }, s.timeout );
  17266. }
  17267. try {
  17268. completed = false;
  17269. transport.send( requestHeaders, done );
  17270. } catch ( e ) {
  17271. // Rethrow post-completion exceptions
  17272. if ( completed ) {
  17273. throw e;
  17274. }
  17275. // Propagate others as results
  17276. done( -1, e );
  17277. }
  17278. }
  17279. // Callback for when everything is done
  17280. function done( status, nativeStatusText, responses, headers ) {
  17281. var isSuccess, success, error, response, modified,
  17282. statusText = nativeStatusText;
  17283. // Ignore repeat invocations
  17284. if ( completed ) {
  17285. return;
  17286. }
  17287. completed = true;
  17288. // Clear timeout if it exists
  17289. if ( timeoutTimer ) {
  17290. window.clearTimeout( timeoutTimer );
  17291. }
  17292. // Dereference transport for early garbage collection
  17293. // (no matter how long the jqXHR object will be used)
  17294. transport = undefined;
  17295. // Cache response headers
  17296. responseHeadersString = headers || "";
  17297. // Set readyState
  17298. jqXHR.readyState = status > 0 ? 4 : 0;
  17299. // Determine if successful
  17300. isSuccess = status >= 200 && status < 300 || status === 304;
  17301. // Get response data
  17302. if ( responses ) {
  17303. response = ajaxHandleResponses( s, jqXHR, responses );
  17304. }
  17305. // Convert no matter what (that way responseXXX fields are always set)
  17306. response = ajaxConvert( s, response, jqXHR, isSuccess );
  17307. // If successful, handle type chaining
  17308. if ( isSuccess ) {
  17309. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  17310. if ( s.ifModified ) {
  17311. modified = jqXHR.getResponseHeader( "Last-Modified" );
  17312. if ( modified ) {
  17313. jQuery.lastModified[ cacheURL ] = modified;
  17314. }
  17315. modified = jqXHR.getResponseHeader( "etag" );
  17316. if ( modified ) {
  17317. jQuery.etag[ cacheURL ] = modified;
  17318. }
  17319. }
  17320. // if no content
  17321. if ( status === 204 || s.type === "HEAD" ) {
  17322. statusText = "nocontent";
  17323. // if not modified
  17324. } else if ( status === 304 ) {
  17325. statusText = "notmodified";
  17326. // If we have data, let's convert it
  17327. } else {
  17328. statusText = response.state;
  17329. success = response.data;
  17330. error = response.error;
  17331. isSuccess = !error;
  17332. }
  17333. } else {
  17334. // Extract error from statusText and normalize for non-aborts
  17335. error = statusText;
  17336. if ( status || !statusText ) {
  17337. statusText = "error";
  17338. if ( status < 0 ) {
  17339. status = 0;
  17340. }
  17341. }
  17342. }
  17343. // Set data for the fake xhr object
  17344. jqXHR.status = status;
  17345. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  17346. // Success/Error
  17347. if ( isSuccess ) {
  17348. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  17349. } else {
  17350. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  17351. }
  17352. // Status-dependent callbacks
  17353. jqXHR.statusCode( statusCode );
  17354. statusCode = undefined;
  17355. if ( fireGlobals ) {
  17356. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  17357. [ jqXHR, s, isSuccess ? success : error ] );
  17358. }
  17359. // Complete
  17360. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  17361. if ( fireGlobals ) {
  17362. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  17363. // Handle the global AJAX counter
  17364. if ( !( --jQuery.active ) ) {
  17365. jQuery.event.trigger( "ajaxStop" );
  17366. }
  17367. }
  17368. }
  17369. return jqXHR;
  17370. },
  17371. getJSON: function( url, data, callback ) {
  17372. return jQuery.get( url, data, callback, "json" );
  17373. },
  17374. getScript: function( url, callback ) {
  17375. return jQuery.get( url, undefined, callback, "script" );
  17376. }
  17377. } );
  17378. jQuery.each( [ "get", "post" ], function( i, method ) {
  17379. jQuery[ method ] = function( url, data, callback, type ) {
  17380. // Shift arguments if data argument was omitted
  17381. if ( isFunction( data ) ) {
  17382. type = type || callback;
  17383. callback = data;
  17384. data = undefined;
  17385. }
  17386. // The url can be an options object (which then must have .url)
  17387. return jQuery.ajax( jQuery.extend( {
  17388. url: url,
  17389. type: method,
  17390. dataType: type,
  17391. data: data,
  17392. success: callback
  17393. }, jQuery.isPlainObject( url ) && url ) );
  17394. };
  17395. } );
  17396. jQuery._evalUrl = function( url, options ) {
  17397. return jQuery.ajax( {
  17398. url: url,
  17399. // Make this explicit, since user can override this through ajaxSetup (#11264)
  17400. type: "GET",
  17401. dataType: "script",
  17402. cache: true,
  17403. async: false,
  17404. global: false,
  17405. // Only evaluate the response if it is successful (gh-4126)
  17406. // dataFilter is not invoked for failure responses, so using it instead
  17407. // of the default converter is kludgy but it works.
  17408. converters: {
  17409. "text script": function() {}
  17410. },
  17411. dataFilter: function( response ) {
  17412. jQuery.globalEval( response, options );
  17413. }
  17414. } );
  17415. };
  17416. jQuery.fn.extend( {
  17417. wrapAll: function( html ) {
  17418. var wrap;
  17419. if ( this[ 0 ] ) {
  17420. if ( isFunction( html ) ) {
  17421. html = html.call( this[ 0 ] );
  17422. }
  17423. // The elements to wrap the target around
  17424. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  17425. if ( this[ 0 ].parentNode ) {
  17426. wrap.insertBefore( this[ 0 ] );
  17427. }
  17428. wrap.map( function() {
  17429. var elem = this;
  17430. while ( elem.firstElementChild ) {
  17431. elem = elem.firstElementChild;
  17432. }
  17433. return elem;
  17434. } ).append( this );
  17435. }
  17436. return this;
  17437. },
  17438. wrapInner: function( html ) {
  17439. if ( isFunction( html ) ) {
  17440. return this.each( function( i ) {
  17441. jQuery( this ).wrapInner( html.call( this, i ) );
  17442. } );
  17443. }
  17444. return this.each( function() {
  17445. var self = jQuery( this ),
  17446. contents = self.contents();
  17447. if ( contents.length ) {
  17448. contents.wrapAll( html );
  17449. } else {
  17450. self.append( html );
  17451. }
  17452. } );
  17453. },
  17454. wrap: function( html ) {
  17455. var htmlIsFunction = isFunction( html );
  17456. return this.each( function( i ) {
  17457. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  17458. } );
  17459. },
  17460. unwrap: function( selector ) {
  17461. this.parent( selector ).not( "body" ).each( function() {
  17462. jQuery( this ).replaceWith( this.childNodes );
  17463. } );
  17464. return this;
  17465. }
  17466. } );
  17467. jQuery.expr.pseudos.hidden = function( elem ) {
  17468. return !jQuery.expr.pseudos.visible( elem );
  17469. };
  17470. jQuery.expr.pseudos.visible = function( elem ) {
  17471. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  17472. };
  17473. jQuery.ajaxSettings.xhr = function() {
  17474. try {
  17475. return new window.XMLHttpRequest();
  17476. } catch ( e ) {}
  17477. };
  17478. var xhrSuccessStatus = {
  17479. // File protocol always yields status code 0, assume 200
  17480. 0: 200,
  17481. // Support: IE <=9 only
  17482. // #1450: sometimes IE returns 1223 when it should be 204
  17483. 1223: 204
  17484. },
  17485. xhrSupported = jQuery.ajaxSettings.xhr();
  17486. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  17487. support.ajax = xhrSupported = !!xhrSupported;
  17488. jQuery.ajaxTransport( function( options ) {
  17489. var callback, errorCallback;
  17490. // Cross domain only allowed if supported through XMLHttpRequest
  17491. if ( support.cors || xhrSupported && !options.crossDomain ) {
  17492. return {
  17493. send: function( headers, complete ) {
  17494. var i,
  17495. xhr = options.xhr();
  17496. xhr.open(
  17497. options.type,
  17498. options.url,
  17499. options.async,
  17500. options.username,
  17501. options.password
  17502. );
  17503. // Apply custom fields if provided
  17504. if ( options.xhrFields ) {
  17505. for ( i in options.xhrFields ) {
  17506. xhr[ i ] = options.xhrFields[ i ];
  17507. }
  17508. }
  17509. // Override mime type if needed
  17510. if ( options.mimeType && xhr.overrideMimeType ) {
  17511. xhr.overrideMimeType( options.mimeType );
  17512. }
  17513. // X-Requested-With header
  17514. // For cross-domain requests, seeing as conditions for a preflight are
  17515. // akin to a jigsaw puzzle, we simply never set it to be sure.
  17516. // (it can always be set on a per-request basis or even using ajaxSetup)
  17517. // For same-domain requests, won't change header if already provided.
  17518. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  17519. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  17520. }
  17521. // Set headers
  17522. for ( i in headers ) {
  17523. xhr.setRequestHeader( i, headers[ i ] );
  17524. }
  17525. // Callback
  17526. callback = function( type ) {
  17527. return function() {
  17528. if ( callback ) {
  17529. callback = errorCallback = xhr.onload =
  17530. xhr.onerror = xhr.onabort = xhr.ontimeout =
  17531. xhr.onreadystatechange = null;
  17532. if ( type === "abort" ) {
  17533. xhr.abort();
  17534. } else if ( type === "error" ) {
  17535. // Support: IE <=9 only
  17536. // On a manual native abort, IE9 throws
  17537. // errors on any property access that is not readyState
  17538. if ( typeof xhr.status !== "number" ) {
  17539. complete( 0, "error" );
  17540. } else {
  17541. complete(
  17542. // File: protocol always yields status 0; see #8605, #14207
  17543. xhr.status,
  17544. xhr.statusText
  17545. );
  17546. }
  17547. } else {
  17548. complete(
  17549. xhrSuccessStatus[ xhr.status ] || xhr.status,
  17550. xhr.statusText,
  17551. // Support: IE <=9 only
  17552. // IE9 has no XHR2 but throws on binary (trac-11426)
  17553. // For XHR2 non-text, let the caller handle it (gh-2498)
  17554. ( xhr.responseType || "text" ) !== "text" ||
  17555. typeof xhr.responseText !== "string" ?
  17556. { binary: xhr.response } :
  17557. { text: xhr.responseText },
  17558. xhr.getAllResponseHeaders()
  17559. );
  17560. }
  17561. }
  17562. };
  17563. };
  17564. // Listen to events
  17565. xhr.onload = callback();
  17566. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  17567. // Support: IE 9 only
  17568. // Use onreadystatechange to replace onabort
  17569. // to handle uncaught aborts
  17570. if ( xhr.onabort !== undefined ) {
  17571. xhr.onabort = errorCallback;
  17572. } else {
  17573. xhr.onreadystatechange = function() {
  17574. // Check readyState before timeout as it changes
  17575. if ( xhr.readyState === 4 ) {
  17576. // Allow onerror to be called first,
  17577. // but that will not handle a native abort
  17578. // Also, save errorCallback to a variable
  17579. // as xhr.onerror cannot be accessed
  17580. window.setTimeout( function() {
  17581. if ( callback ) {
  17582. errorCallback();
  17583. }
  17584. } );
  17585. }
  17586. };
  17587. }
  17588. // Create the abort callback
  17589. callback = callback( "abort" );
  17590. try {
  17591. // Do send the request (this may raise an exception)
  17592. xhr.send( options.hasContent && options.data || null );
  17593. } catch ( e ) {
  17594. // #14683: Only rethrow if this hasn't been notified as an error yet
  17595. if ( callback ) {
  17596. throw e;
  17597. }
  17598. }
  17599. },
  17600. abort: function() {
  17601. if ( callback ) {
  17602. callback();
  17603. }
  17604. }
  17605. };
  17606. }
  17607. } );
  17608. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  17609. jQuery.ajaxPrefilter( function( s ) {
  17610. if ( s.crossDomain ) {
  17611. s.contents.script = false;
  17612. }
  17613. } );
  17614. // Install script dataType
  17615. jQuery.ajaxSetup( {
  17616. accepts: {
  17617. script: "text/javascript, application/javascript, " +
  17618. "application/ecmascript, application/x-ecmascript"
  17619. },
  17620. contents: {
  17621. script: /\b(?:java|ecma)script\b/
  17622. },
  17623. converters: {
  17624. "text script": function( text ) {
  17625. jQuery.globalEval( text );
  17626. return text;
  17627. }
  17628. }
  17629. } );
  17630. // Handle cache's special case and crossDomain
  17631. jQuery.ajaxPrefilter( "script", function( s ) {
  17632. if ( s.cache === undefined ) {
  17633. s.cache = false;
  17634. }
  17635. if ( s.crossDomain ) {
  17636. s.type = "GET";
  17637. }
  17638. } );
  17639. // Bind script tag hack transport
  17640. jQuery.ajaxTransport( "script", function( s ) {
  17641. // This transport only deals with cross domain or forced-by-attrs requests
  17642. if ( s.crossDomain || s.scriptAttrs ) {
  17643. var script, callback;
  17644. return {
  17645. send: function( _, complete ) {
  17646. script = jQuery( "<script>" )
  17647. .attr( s.scriptAttrs || {} )
  17648. .prop( { charset: s.scriptCharset, src: s.url } )
  17649. .on( "load error", callback = function( evt ) {
  17650. script.remove();
  17651. callback = null;
  17652. if ( evt ) {
  17653. complete( evt.type === "error" ? 404 : 200, evt.type );
  17654. }
  17655. } );
  17656. // Use native DOM manipulation to avoid our domManip AJAX trickery
  17657. document.head.appendChild( script[ 0 ] );
  17658. },
  17659. abort: function() {
  17660. if ( callback ) {
  17661. callback();
  17662. }
  17663. }
  17664. };
  17665. }
  17666. } );
  17667. var oldCallbacks = [],
  17668. rjsonp = /(=)\?(?=&|$)|\?\?/;
  17669. // Default jsonp settings
  17670. jQuery.ajaxSetup( {
  17671. jsonp: "callback",
  17672. jsonpCallback: function() {
  17673. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  17674. this[ callback ] = true;
  17675. return callback;
  17676. }
  17677. } );
  17678. // Detect, normalize options and install callbacks for jsonp requests
  17679. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  17680. var callbackName, overwritten, responseContainer,
  17681. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  17682. "url" :
  17683. typeof s.data === "string" &&
  17684. ( s.contentType || "" )
  17685. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  17686. rjsonp.test( s.data ) && "data"
  17687. );
  17688. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  17689. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  17690. // Get callback name, remembering preexisting value associated with it
  17691. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  17692. s.jsonpCallback() :
  17693. s.jsonpCallback;
  17694. // Insert callback into url or form data
  17695. if ( jsonProp ) {
  17696. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  17697. } else if ( s.jsonp !== false ) {
  17698. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  17699. }
  17700. // Use data converter to retrieve json after script execution
  17701. s.converters[ "script json" ] = function() {
  17702. if ( !responseContainer ) {
  17703. jQuery.error( callbackName + " was not called" );
  17704. }
  17705. return responseContainer[ 0 ];
  17706. };
  17707. // Force json dataType
  17708. s.dataTypes[ 0 ] = "json";
  17709. // Install callback
  17710. overwritten = window[ callbackName ];
  17711. window[ callbackName ] = function() {
  17712. responseContainer = arguments;
  17713. };
  17714. // Clean-up function (fires after converters)
  17715. jqXHR.always( function() {
  17716. // If previous value didn't exist - remove it
  17717. if ( overwritten === undefined ) {
  17718. jQuery( window ).removeProp( callbackName );
  17719. // Otherwise restore preexisting value
  17720. } else {
  17721. window[ callbackName ] = overwritten;
  17722. }
  17723. // Save back as free
  17724. if ( s[ callbackName ] ) {
  17725. // Make sure that re-using the options doesn't screw things around
  17726. s.jsonpCallback = originalSettings.jsonpCallback;
  17727. // Save the callback name for future use
  17728. oldCallbacks.push( callbackName );
  17729. }
  17730. // Call if it was a function and we have a response
  17731. if ( responseContainer && isFunction( overwritten ) ) {
  17732. overwritten( responseContainer[ 0 ] );
  17733. }
  17734. responseContainer = overwritten = undefined;
  17735. } );
  17736. // Delegate to script
  17737. return "script";
  17738. }
  17739. } );
  17740. // Support: Safari 8 only
  17741. // In Safari 8 documents created via document.implementation.createHTMLDocument
  17742. // collapse sibling forms: the second one becomes a child of the first one.
  17743. // Because of that, this security measure has to be disabled in Safari 8.
  17744. // https://bugs.webkit.org/show_bug.cgi?id=137337
  17745. support.createHTMLDocument = ( function() {
  17746. var body = document.implementation.createHTMLDocument( "" ).body;
  17747. body.innerHTML = "<form></form><form></form>";
  17748. return body.childNodes.length === 2;
  17749. } )();
  17750. // Argument "data" should be string of html
  17751. // context (optional): If specified, the fragment will be created in this context,
  17752. // defaults to document
  17753. // keepScripts (optional): If true, will include scripts passed in the html string
  17754. jQuery.parseHTML = function( data, context, keepScripts ) {
  17755. if ( typeof data !== "string" ) {
  17756. return [];
  17757. }
  17758. if ( typeof context === "boolean" ) {
  17759. keepScripts = context;
  17760. context = false;
  17761. }
  17762. var base, parsed, scripts;
  17763. if ( !context ) {
  17764. // Stop scripts or inline event handlers from being executed immediately
  17765. // by using document.implementation
  17766. if ( support.createHTMLDocument ) {
  17767. context = document.implementation.createHTMLDocument( "" );
  17768. // Set the base href for the created document
  17769. // so any parsed elements with URLs
  17770. // are based on the document's URL (gh-2965)
  17771. base = context.createElement( "base" );
  17772. base.href = document.location.href;
  17773. context.head.appendChild( base );
  17774. } else {
  17775. context = document;
  17776. }
  17777. }
  17778. parsed = rsingleTag.exec( data );
  17779. scripts = !keepScripts && [];
  17780. // Single tag
  17781. if ( parsed ) {
  17782. return [ context.createElement( parsed[ 1 ] ) ];
  17783. }
  17784. parsed = buildFragment( [ data ], context, scripts );
  17785. if ( scripts && scripts.length ) {
  17786. jQuery( scripts ).remove();
  17787. }
  17788. return jQuery.merge( [], parsed.childNodes );
  17789. };
  17790. /**
  17791. * Load a url into a page
  17792. */
  17793. jQuery.fn.load = function( url, params, callback ) {
  17794. var selector, type, response,
  17795. self = this,
  17796. off = url.indexOf( " " );
  17797. if ( off > -1 ) {
  17798. selector = stripAndCollapse( url.slice( off ) );
  17799. url = url.slice( 0, off );
  17800. }
  17801. // If it's a function
  17802. if ( isFunction( params ) ) {
  17803. // We assume that it's the callback
  17804. callback = params;
  17805. params = undefined;
  17806. // Otherwise, build a param string
  17807. } else if ( params && typeof params === "object" ) {
  17808. type = "POST";
  17809. }
  17810. // If we have elements to modify, make the request
  17811. if ( self.length > 0 ) {
  17812. jQuery.ajax( {
  17813. url: url,
  17814. // If "type" variable is undefined, then "GET" method will be used.
  17815. // Make value of this field explicit since
  17816. // user can override it through ajaxSetup method
  17817. type: type || "GET",
  17818. dataType: "html",
  17819. data: params
  17820. } ).done( function( responseText ) {
  17821. // Save response for use in complete callback
  17822. response = arguments;
  17823. self.html( selector ?
  17824. // If a selector was specified, locate the right elements in a dummy div
  17825. // Exclude scripts to avoid IE 'Permission Denied' errors
  17826. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  17827. // Otherwise use the full result
  17828. responseText );
  17829. // If the request succeeds, this function gets "data", "status", "jqXHR"
  17830. // but they are ignored because response was set above.
  17831. // If it fails, this function gets "jqXHR", "status", "error"
  17832. } ).always( callback && function( jqXHR, status ) {
  17833. self.each( function() {
  17834. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  17835. } );
  17836. } );
  17837. }
  17838. return this;
  17839. };
  17840. // Attach a bunch of functions for handling common AJAX events
  17841. jQuery.each( [
  17842. "ajaxStart",
  17843. "ajaxStop",
  17844. "ajaxComplete",
  17845. "ajaxError",
  17846. "ajaxSuccess",
  17847. "ajaxSend"
  17848. ], function( i, type ) {
  17849. jQuery.fn[ type ] = function( fn ) {
  17850. return this.on( type, fn );
  17851. };
  17852. } );
  17853. jQuery.expr.pseudos.animated = function( elem ) {
  17854. return jQuery.grep( jQuery.timers, function( fn ) {
  17855. return elem === fn.elem;
  17856. } ).length;
  17857. };
  17858. jQuery.offset = {
  17859. setOffset: function( elem, options, i ) {
  17860. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  17861. position = jQuery.css( elem, "position" ),
  17862. curElem = jQuery( elem ),
  17863. props = {};
  17864. // Set position first, in-case top/left are set even on static elem
  17865. if ( position === "static" ) {
  17866. elem.style.position = "relative";
  17867. }
  17868. curOffset = curElem.offset();
  17869. curCSSTop = jQuery.css( elem, "top" );
  17870. curCSSLeft = jQuery.css( elem, "left" );
  17871. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  17872. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  17873. // Need to be able to calculate position if either
  17874. // top or left is auto and position is either absolute or fixed
  17875. if ( calculatePosition ) {
  17876. curPosition = curElem.position();
  17877. curTop = curPosition.top;
  17878. curLeft = curPosition.left;
  17879. } else {
  17880. curTop = parseFloat( curCSSTop ) || 0;
  17881. curLeft = parseFloat( curCSSLeft ) || 0;
  17882. }
  17883. if ( isFunction( options ) ) {
  17884. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  17885. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  17886. }
  17887. if ( options.top != null ) {
  17888. props.top = ( options.top - curOffset.top ) + curTop;
  17889. }
  17890. if ( options.left != null ) {
  17891. props.left = ( options.left - curOffset.left ) + curLeft;
  17892. }
  17893. if ( "using" in options ) {
  17894. options.using.call( elem, props );
  17895. } else {
  17896. curElem.css( props );
  17897. }
  17898. }
  17899. };
  17900. jQuery.fn.extend( {
  17901. // offset() relates an element's border box to the document origin
  17902. offset: function( options ) {
  17903. // Preserve chaining for setter
  17904. if ( arguments.length ) {
  17905. return options === undefined ?
  17906. this :
  17907. this.each( function( i ) {
  17908. jQuery.offset.setOffset( this, options, i );
  17909. } );
  17910. }
  17911. var rect, win,
  17912. elem = this[ 0 ];
  17913. if ( !elem ) {
  17914. return;
  17915. }
  17916. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  17917. // Support: IE <=11 only
  17918. // Running getBoundingClientRect on a
  17919. // disconnected node in IE throws an error
  17920. if ( !elem.getClientRects().length ) {
  17921. return { top: 0, left: 0 };
  17922. }
  17923. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  17924. rect = elem.getBoundingClientRect();
  17925. win = elem.ownerDocument.defaultView;
  17926. return {
  17927. top: rect.top + win.pageYOffset,
  17928. left: rect.left + win.pageXOffset
  17929. };
  17930. },
  17931. // position() relates an element's margin box to its offset parent's padding box
  17932. // This corresponds to the behavior of CSS absolute positioning
  17933. position: function() {
  17934. if ( !this[ 0 ] ) {
  17935. return;
  17936. }
  17937. var offsetParent, offset, doc,
  17938. elem = this[ 0 ],
  17939. parentOffset = { top: 0, left: 0 };
  17940. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17941. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17942. // Assume position:fixed implies availability of getBoundingClientRect
  17943. offset = elem.getBoundingClientRect();
  17944. } else {
  17945. offset = this.offset();
  17946. // Account for the *real* offset parent, which can be the document or its root element
  17947. // when a statically positioned element is identified
  17948. doc = elem.ownerDocument;
  17949. offsetParent = elem.offsetParent || doc.documentElement;
  17950. while ( offsetParent &&
  17951. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17952. jQuery.css( offsetParent, "position" ) === "static" ) {
  17953. offsetParent = offsetParent.parentNode;
  17954. }
  17955. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17956. // Incorporate borders into its offset, since they are outside its content origin
  17957. parentOffset = jQuery( offsetParent ).offset();
  17958. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17959. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17960. }
  17961. }
  17962. // Subtract parent offsets and element margins
  17963. return {
  17964. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17965. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17966. };
  17967. },
  17968. // This method will return documentElement in the following cases:
  17969. // 1) For the element inside the iframe without offsetParent, this method will return
  17970. // documentElement of the parent window
  17971. // 2) For the hidden or detached element
  17972. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17973. //
  17974. // but those exceptions were never presented as a real life use-cases
  17975. // and might be considered as more preferable results.
  17976. //
  17977. // This logic, however, is not guaranteed and can change at any point in the future
  17978. offsetParent: function() {
  17979. return this.map( function() {
  17980. var offsetParent = this.offsetParent;
  17981. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17982. offsetParent = offsetParent.offsetParent;
  17983. }
  17984. return offsetParent || documentElement;
  17985. } );
  17986. }
  17987. } );
  17988. // Create scrollLeft and scrollTop methods
  17989. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17990. var top = "pageYOffset" === prop;
  17991. jQuery.fn[ method ] = function( val ) {
  17992. return access( this, function( elem, method, val ) {
  17993. // Coalesce documents and windows
  17994. var win;
  17995. if ( isWindow( elem ) ) {
  17996. win = elem;
  17997. } else if ( elem.nodeType === 9 ) {
  17998. win = elem.defaultView;
  17999. }
  18000. if ( val === undefined ) {
  18001. return win ? win[ prop ] : elem[ method ];
  18002. }
  18003. if ( win ) {
  18004. win.scrollTo(
  18005. !top ? val : win.pageXOffset,
  18006. top ? val : win.pageYOffset
  18007. );
  18008. } else {
  18009. elem[ method ] = val;
  18010. }
  18011. }, method, val, arguments.length );
  18012. };
  18013. } );
  18014. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  18015. // Add the top/left cssHooks using jQuery.fn.position
  18016. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  18017. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  18018. // getComputedStyle returns percent when specified for top/left/bottom/right;
  18019. // rather than make the css module depend on the offset module, just check for it here
  18020. jQuery.each( [ "top", "left" ], function( i, prop ) {
  18021. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  18022. function( elem, computed ) {
  18023. if ( computed ) {
  18024. computed = curCSS( elem, prop );
  18025. // If curCSS returns percentage, fallback to offset
  18026. return rnumnonpx.test( computed ) ?
  18027. jQuery( elem ).position()[ prop ] + "px" :
  18028. computed;
  18029. }
  18030. }
  18031. );
  18032. } );
  18033. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  18034. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  18035. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  18036. function( defaultExtra, funcName ) {
  18037. // Margin is only for outerHeight, outerWidth
  18038. jQuery.fn[ funcName ] = function( margin, value ) {
  18039. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  18040. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  18041. return access( this, function( elem, type, value ) {
  18042. var doc;
  18043. if ( isWindow( elem ) ) {
  18044. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  18045. return funcName.indexOf( "outer" ) === 0 ?
  18046. elem[ "inner" + name ] :
  18047. elem.document.documentElement[ "client" + name ];
  18048. }
  18049. // Get document width or height
  18050. if ( elem.nodeType === 9 ) {
  18051. doc = elem.documentElement;
  18052. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  18053. // whichever is greatest
  18054. return Math.max(
  18055. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  18056. elem.body[ "offset" + name ], doc[ "offset" + name ],
  18057. doc[ "client" + name ]
  18058. );
  18059. }
  18060. return value === undefined ?
  18061. // Get width or height on the element, requesting but not forcing parseFloat
  18062. jQuery.css( elem, type, extra ) :
  18063. // Set width or height on the element
  18064. jQuery.style( elem, type, value, extra );
  18065. }, type, chainable ? margin : undefined, chainable );
  18066. };
  18067. } );
  18068. } );
  18069. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  18070. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  18071. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  18072. function( i, name ) {
  18073. // Handle event binding
  18074. jQuery.fn[ name ] = function( data, fn ) {
  18075. return arguments.length > 0 ?
  18076. this.on( name, null, data, fn ) :
  18077. this.trigger( name );
  18078. };
  18079. } );
  18080. jQuery.fn.extend( {
  18081. hover: function( fnOver, fnOut ) {
  18082. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  18083. }
  18084. } );
  18085. jQuery.fn.extend( {
  18086. bind: function( types, data, fn ) {
  18087. return this.on( types, null, data, fn );
  18088. },
  18089. unbind: function( types, fn ) {
  18090. return this.off( types, null, fn );
  18091. },
  18092. delegate: function( selector, types, data, fn ) {
  18093. return this.on( types, selector, data, fn );
  18094. },
  18095. undelegate: function( selector, types, fn ) {
  18096. // ( namespace ) or ( selector, types [, fn] )
  18097. return arguments.length === 1 ?
  18098. this.off( selector, "**" ) :
  18099. this.off( types, selector || "**", fn );
  18100. }
  18101. } );
  18102. // Bind a function to a context, optionally partially applying any
  18103. // arguments.
  18104. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  18105. // However, it is not slated for removal any time soon
  18106. jQuery.proxy = function( fn, context ) {
  18107. var tmp, args, proxy;
  18108. if ( typeof context === "string" ) {
  18109. tmp = fn[ context ];
  18110. context = fn;
  18111. fn = tmp;
  18112. }
  18113. // Quick check to determine if target is callable, in the spec
  18114. // this throws a TypeError, but we will just return undefined.
  18115. if ( !isFunction( fn ) ) {
  18116. return undefined;
  18117. }
  18118. // Simulated bind
  18119. args = slice.call( arguments, 2 );
  18120. proxy = function() {
  18121. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  18122. };
  18123. // Set the guid of unique handler to the same of original handler, so it can be removed
  18124. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  18125. return proxy;
  18126. };
  18127. jQuery.holdReady = function( hold ) {
  18128. if ( hold ) {
  18129. jQuery.readyWait++;
  18130. } else {
  18131. jQuery.ready( true );
  18132. }
  18133. };
  18134. jQuery.isArray = Array.isArray;
  18135. jQuery.parseJSON = JSON.parse;
  18136. jQuery.nodeName = nodeName;
  18137. jQuery.isFunction = isFunction;
  18138. jQuery.isWindow = isWindow;
  18139. jQuery.camelCase = camelCase;
  18140. jQuery.type = toType;
  18141. jQuery.now = Date.now;
  18142. jQuery.isNumeric = function( obj ) {
  18143. // As of jQuery 3.0, isNumeric is limited to
  18144. // strings and numbers (primitives or objects)
  18145. // that can be coerced to finite numbers (gh-2662)
  18146. var type = jQuery.type( obj );
  18147. return ( type === "number" || type === "string" ) &&
  18148. // parseFloat NaNs numeric-cast false positives ("")
  18149. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  18150. // subtraction forces infinities to NaN
  18151. !isNaN( obj - parseFloat( obj ) );
  18152. };
  18153. // Register as a named AMD module, since jQuery can be concatenated with other
  18154. // files that may use define, but not via a proper concatenation script that
  18155. // understands anonymous AMD modules. A named AMD is safest and most robust
  18156. // way to register. Lowercase jquery is used because AMD module names are
  18157. // derived from file names, and jQuery is normally delivered in a lowercase
  18158. // file name. Do this after creating the global so that if an AMD module wants
  18159. // to call noConflict to hide this version of jQuery, it will work.
  18160. // Note that for maximum portability, libraries that are not jQuery should
  18161. // declare themselves as anonymous modules, and avoid setting a global if an
  18162. // AMD loader is present. jQuery is a special case. For more information, see
  18163. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  18164. if ( true ) {
  18165. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  18166. return jQuery;
  18167. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  18168. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  18169. }
  18170. var
  18171. // Map over jQuery in case of overwrite
  18172. _jQuery = window.jQuery,
  18173. // Map over the $ in case of overwrite
  18174. _$ = window.$;
  18175. jQuery.noConflict = function( deep ) {
  18176. if ( window.$ === jQuery ) {
  18177. window.$ = _$;
  18178. }
  18179. if ( deep && window.jQuery === jQuery ) {
  18180. window.jQuery = _jQuery;
  18181. }
  18182. return jQuery;
  18183. };
  18184. // Expose jQuery and $ identifiers, even in AMD
  18185. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  18186. // and CommonJS for browser emulators (#13566)
  18187. if ( !noGlobal ) {
  18188. window.jQuery = window.$ = jQuery;
  18189. }
  18190. return jQuery;
  18191. } );
  18192. /***/ }),
  18193. /***/ "./node_modules/laravel-echo/dist/echo.js":
  18194. /*!************************************************!*\
  18195. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  18196. \************************************************/
  18197. /*! exports provided: default */
  18198. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  18199. "use strict";
  18200. __webpack_require__.r(__webpack_exports__);
  18201. var classCallCheck = function (instance, Constructor) {
  18202. if (!(instance instanceof Constructor)) {
  18203. throw new TypeError("Cannot call a class as a function");
  18204. }
  18205. };
  18206. var createClass = function () {
  18207. function defineProperties(target, props) {
  18208. for (var i = 0; i < props.length; i++) {
  18209. var descriptor = props[i];
  18210. descriptor.enumerable = descriptor.enumerable || false;
  18211. descriptor.configurable = true;
  18212. if ("value" in descriptor) descriptor.writable = true;
  18213. Object.defineProperty(target, descriptor.key, descriptor);
  18214. }
  18215. }
  18216. return function (Constructor, protoProps, staticProps) {
  18217. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  18218. if (staticProps) defineProperties(Constructor, staticProps);
  18219. return Constructor;
  18220. };
  18221. }();
  18222. var _extends = Object.assign || function (target) {
  18223. for (var i = 1; i < arguments.length; i++) {
  18224. var source = arguments[i];
  18225. for (var key in source) {
  18226. if (Object.prototype.hasOwnProperty.call(source, key)) {
  18227. target[key] = source[key];
  18228. }
  18229. }
  18230. }
  18231. return target;
  18232. };
  18233. var inherits = function (subClass, superClass) {
  18234. if (typeof superClass !== "function" && superClass !== null) {
  18235. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  18236. }
  18237. subClass.prototype = Object.create(superClass && superClass.prototype, {
  18238. constructor: {
  18239. value: subClass,
  18240. enumerable: false,
  18241. writable: true,
  18242. configurable: true
  18243. }
  18244. });
  18245. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  18246. };
  18247. var possibleConstructorReturn = function (self, call) {
  18248. if (!self) {
  18249. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  18250. }
  18251. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  18252. };
  18253. var Connector = function () {
  18254. /**
  18255. * Create a new class instance.
  18256. */
  18257. function Connector(options) {
  18258. classCallCheck(this, Connector);
  18259. /**
  18260. * Default connector options.
  18261. */
  18262. this._defaultOptions = {
  18263. auth: {
  18264. headers: {}
  18265. },
  18266. authEndpoint: '/broadcasting/auth',
  18267. broadcaster: 'pusher',
  18268. csrfToken: null,
  18269. host: null,
  18270. key: null,
  18271. namespace: 'App.Events'
  18272. };
  18273. this.setOptions(options);
  18274. this.connect();
  18275. }
  18276. /**
  18277. * Merge the custom options with the defaults.
  18278. */
  18279. createClass(Connector, [{
  18280. key: 'setOptions',
  18281. value: function setOptions(options) {
  18282. this.options = _extends(this._defaultOptions, options);
  18283. if (this.csrfToken()) {
  18284. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  18285. }
  18286. return options;
  18287. }
  18288. /**
  18289. * Extract the CSRF token from the page.
  18290. */
  18291. }, {
  18292. key: 'csrfToken',
  18293. value: function csrfToken() {
  18294. var selector = void 0;
  18295. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  18296. return window['Laravel'].csrfToken;
  18297. } else if (this.options.csrfToken) {
  18298. return this.options.csrfToken;
  18299. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  18300. return selector.getAttribute('content');
  18301. }
  18302. return null;
  18303. }
  18304. }]);
  18305. return Connector;
  18306. }();
  18307. /**
  18308. * This class represents a basic channel.
  18309. */
  18310. var Channel = function () {
  18311. function Channel() {
  18312. classCallCheck(this, Channel);
  18313. }
  18314. createClass(Channel, [{
  18315. key: 'listenForWhisper',
  18316. /**
  18317. * Listen for a whisper event on the channel instance.
  18318. */
  18319. value: function listenForWhisper(event, callback) {
  18320. return this.listen('.client-' + event, callback);
  18321. }
  18322. /**
  18323. * Listen for an event on the channel instance.
  18324. */
  18325. }, {
  18326. key: 'notification',
  18327. value: function notification(callback) {
  18328. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  18329. }
  18330. /**
  18331. * Stop listening for a whispser event on the channel instance.
  18332. */
  18333. }, {
  18334. key: 'stopListeningForWhisper',
  18335. value: function stopListeningForWhisper(event) {
  18336. return this.stopListening('.client-' + event);
  18337. }
  18338. }]);
  18339. return Channel;
  18340. }();
  18341. /**
  18342. * Event name formatter
  18343. */
  18344. var EventFormatter = function () {
  18345. /**
  18346. * Create a new class instance.
  18347. */
  18348. function EventFormatter(namespace) {
  18349. classCallCheck(this, EventFormatter);
  18350. this.setNamespace(namespace);
  18351. }
  18352. /**
  18353. * Format the given event name.
  18354. */
  18355. createClass(EventFormatter, [{
  18356. key: 'format',
  18357. value: function format(event) {
  18358. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  18359. return event.substr(1);
  18360. } else if (this.namespace) {
  18361. event = this.namespace + '.' + event;
  18362. }
  18363. return event.replace(/\./g, '\\');
  18364. }
  18365. /**
  18366. * Set the event namespace.
  18367. */
  18368. }, {
  18369. key: 'setNamespace',
  18370. value: function setNamespace(value) {
  18371. this.namespace = value;
  18372. }
  18373. }]);
  18374. return EventFormatter;
  18375. }();
  18376. /**
  18377. * This class represents a Pusher channel.
  18378. */
  18379. var PusherChannel = function (_Channel) {
  18380. inherits(PusherChannel, _Channel);
  18381. /**
  18382. * Create a new class instance.
  18383. */
  18384. function PusherChannel(pusher, name, options) {
  18385. classCallCheck(this, PusherChannel);
  18386. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  18387. _this.name = name;
  18388. _this.pusher = pusher;
  18389. _this.options = options;
  18390. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  18391. _this.subscribe();
  18392. return _this;
  18393. }
  18394. /**
  18395. * Subscribe to a Pusher channel.
  18396. */
  18397. createClass(PusherChannel, [{
  18398. key: 'subscribe',
  18399. value: function subscribe() {
  18400. this.subscription = this.pusher.subscribe(this.name);
  18401. }
  18402. /**
  18403. * Unsubscribe from a Pusher channel.
  18404. */
  18405. }, {
  18406. key: 'unsubscribe',
  18407. value: function unsubscribe() {
  18408. this.pusher.unsubscribe(this.name);
  18409. }
  18410. /**
  18411. * Listen for an event on the channel instance.
  18412. */
  18413. }, {
  18414. key: 'listen',
  18415. value: function listen(event, callback) {
  18416. this.on(this.eventFormatter.format(event), callback);
  18417. return this;
  18418. }
  18419. /**
  18420. * Stop listening for an event on the channel instance.
  18421. */
  18422. }, {
  18423. key: 'stopListening',
  18424. value: function stopListening(event) {
  18425. this.subscription.unbind(this.eventFormatter.format(event));
  18426. return this;
  18427. }
  18428. /**
  18429. * Bind a channel to an event.
  18430. */
  18431. }, {
  18432. key: 'on',
  18433. value: function on(event, callback) {
  18434. this.subscription.bind(event, callback);
  18435. return this;
  18436. }
  18437. }]);
  18438. return PusherChannel;
  18439. }(Channel);
  18440. /**
  18441. * This class represents a Pusher private channel.
  18442. */
  18443. var PusherPrivateChannel = function (_PusherChannel) {
  18444. inherits(PusherPrivateChannel, _PusherChannel);
  18445. function PusherPrivateChannel() {
  18446. classCallCheck(this, PusherPrivateChannel);
  18447. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  18448. }
  18449. createClass(PusherPrivateChannel, [{
  18450. key: 'whisper',
  18451. /**
  18452. * Trigger client event on the channel.
  18453. */
  18454. value: function whisper(eventName, data) {
  18455. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18456. return this;
  18457. }
  18458. }]);
  18459. return PusherPrivateChannel;
  18460. }(PusherChannel);
  18461. /**
  18462. * This class represents a Pusher presence channel.
  18463. */
  18464. var PusherPresenceChannel = function (_PusherChannel) {
  18465. inherits(PusherPresenceChannel, _PusherChannel);
  18466. function PusherPresenceChannel() {
  18467. classCallCheck(this, PusherPresenceChannel);
  18468. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  18469. }
  18470. createClass(PusherPresenceChannel, [{
  18471. key: 'here',
  18472. /**
  18473. * Register a callback to be called anytime the member list changes.
  18474. */
  18475. value: function here(callback) {
  18476. this.on('pusher:subscription_succeeded', function (data) {
  18477. callback(Object.keys(data.members).map(function (k) {
  18478. return data.members[k];
  18479. }));
  18480. });
  18481. return this;
  18482. }
  18483. /**
  18484. * Listen for someone joining the channel.
  18485. */
  18486. }, {
  18487. key: 'joining',
  18488. value: function joining(callback) {
  18489. this.on('pusher:member_added', function (member) {
  18490. callback(member.info);
  18491. });
  18492. return this;
  18493. }
  18494. /**
  18495. * Listen for someone leaving the channel.
  18496. */
  18497. }, {
  18498. key: 'leaving',
  18499. value: function leaving(callback) {
  18500. this.on('pusher:member_removed', function (member) {
  18501. callback(member.info);
  18502. });
  18503. return this;
  18504. }
  18505. /**
  18506. * Trigger client event on the channel.
  18507. */
  18508. }, {
  18509. key: 'whisper',
  18510. value: function whisper(eventName, data) {
  18511. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18512. return this;
  18513. }
  18514. }]);
  18515. return PusherPresenceChannel;
  18516. }(PusherChannel);
  18517. /**
  18518. * This class represents a Socket.io channel.
  18519. */
  18520. var SocketIoChannel = function (_Channel) {
  18521. inherits(SocketIoChannel, _Channel);
  18522. /**
  18523. * Create a new class instance.
  18524. */
  18525. function SocketIoChannel(socket, name, options) {
  18526. classCallCheck(this, SocketIoChannel);
  18527. /**
  18528. * The event callbacks applied to the channel.
  18529. */
  18530. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  18531. _this.events = {};
  18532. _this.name = name;
  18533. _this.socket = socket;
  18534. _this.options = options;
  18535. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  18536. _this.subscribe();
  18537. _this.configureReconnector();
  18538. return _this;
  18539. }
  18540. /**
  18541. * Subscribe to a Socket.io channel.
  18542. */
  18543. createClass(SocketIoChannel, [{
  18544. key: 'subscribe',
  18545. value: function subscribe() {
  18546. this.socket.emit('subscribe', {
  18547. channel: this.name,
  18548. auth: this.options.auth || {}
  18549. });
  18550. }
  18551. /**
  18552. * Unsubscribe from channel and ubind event callbacks.
  18553. */
  18554. }, {
  18555. key: 'unsubscribe',
  18556. value: function unsubscribe() {
  18557. this.unbind();
  18558. this.socket.emit('unsubscribe', {
  18559. channel: this.name,
  18560. auth: this.options.auth || {}
  18561. });
  18562. }
  18563. /**
  18564. * Listen for an event on the channel instance.
  18565. */
  18566. }, {
  18567. key: 'listen',
  18568. value: function listen(event, callback) {
  18569. this.on(this.eventFormatter.format(event), callback);
  18570. return this;
  18571. }
  18572. /**
  18573. * Stop listening for an event on the channel instance.
  18574. */
  18575. }, {
  18576. key: 'stopListening',
  18577. value: function stopListening(event) {
  18578. var name = this.eventFormatter.format(event);
  18579. this.socket.removeListener(name);
  18580. delete this.events[name];
  18581. return this;
  18582. }
  18583. /**
  18584. * Bind the channel's socket to an event and store the callback.
  18585. */
  18586. }, {
  18587. key: 'on',
  18588. value: function on(event, callback) {
  18589. var _this2 = this;
  18590. var listener = function listener(channel, data) {
  18591. if (_this2.name == channel) {
  18592. callback(data);
  18593. }
  18594. };
  18595. this.socket.on(event, listener);
  18596. this.bind(event, listener);
  18597. }
  18598. /**
  18599. * Attach a 'reconnect' listener and bind the event.
  18600. */
  18601. }, {
  18602. key: 'configureReconnector',
  18603. value: function configureReconnector() {
  18604. var _this3 = this;
  18605. var listener = function listener() {
  18606. _this3.subscribe();
  18607. };
  18608. this.socket.on('reconnect', listener);
  18609. this.bind('reconnect', listener);
  18610. }
  18611. /**
  18612. * Bind the channel's socket to an event and store the callback.
  18613. */
  18614. }, {
  18615. key: 'bind',
  18616. value: function bind(event, callback) {
  18617. this.events[event] = this.events[event] || [];
  18618. this.events[event].push(callback);
  18619. }
  18620. /**
  18621. * Unbind the channel's socket from all stored event callbacks.
  18622. */
  18623. }, {
  18624. key: 'unbind',
  18625. value: function unbind() {
  18626. var _this4 = this;
  18627. Object.keys(this.events).forEach(function (event) {
  18628. _this4.events[event].forEach(function (callback) {
  18629. _this4.socket.removeListener(event, callback);
  18630. });
  18631. delete _this4.events[event];
  18632. });
  18633. }
  18634. }]);
  18635. return SocketIoChannel;
  18636. }(Channel);
  18637. /**
  18638. * This class represents a Socket.io presence channel.
  18639. */
  18640. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  18641. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  18642. function SocketIoPrivateChannel() {
  18643. classCallCheck(this, SocketIoPrivateChannel);
  18644. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  18645. }
  18646. createClass(SocketIoPrivateChannel, [{
  18647. key: 'whisper',
  18648. /**
  18649. * Trigger client event on the channel.
  18650. */
  18651. value: function whisper(eventName, data) {
  18652. this.socket.emit('client event', {
  18653. channel: this.name,
  18654. event: 'client-' + eventName,
  18655. data: data
  18656. });
  18657. return this;
  18658. }
  18659. }]);
  18660. return SocketIoPrivateChannel;
  18661. }(SocketIoChannel);
  18662. /**
  18663. * This class represents a Socket.io presence channel.
  18664. */
  18665. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  18666. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  18667. function SocketIoPresenceChannel() {
  18668. classCallCheck(this, SocketIoPresenceChannel);
  18669. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  18670. }
  18671. createClass(SocketIoPresenceChannel, [{
  18672. key: 'here',
  18673. /**
  18674. * Register a callback to be called anytime the member list changes.
  18675. */
  18676. value: function here(callback) {
  18677. this.on('presence:subscribed', function (members) {
  18678. callback(members.map(function (m) {
  18679. return m.user_info;
  18680. }));
  18681. });
  18682. return this;
  18683. }
  18684. /**
  18685. * Listen for someone joining the channel.
  18686. */
  18687. }, {
  18688. key: 'joining',
  18689. value: function joining(callback) {
  18690. this.on('presence:joining', function (member) {
  18691. return callback(member.user_info);
  18692. });
  18693. return this;
  18694. }
  18695. /**
  18696. * Listen for someone leaving the channel.
  18697. */
  18698. }, {
  18699. key: 'leaving',
  18700. value: function leaving(callback) {
  18701. this.on('presence:leaving', function (member) {
  18702. return callback(member.user_info);
  18703. });
  18704. return this;
  18705. }
  18706. }]);
  18707. return SocketIoPresenceChannel;
  18708. }(SocketIoPrivateChannel);
  18709. /**
  18710. * This class represents a null channel.
  18711. */
  18712. var NullChannel = function (_Channel) {
  18713. inherits(NullChannel, _Channel);
  18714. function NullChannel() {
  18715. classCallCheck(this, NullChannel);
  18716. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  18717. }
  18718. createClass(NullChannel, [{
  18719. key: 'subscribe',
  18720. /**
  18721. * Subscribe to a channel.
  18722. */
  18723. value: function subscribe() {}
  18724. //
  18725. /**
  18726. * Unsubscribe from a channel.
  18727. */
  18728. }, {
  18729. key: 'unsubscribe',
  18730. value: function unsubscribe() {}
  18731. //
  18732. /**
  18733. * Listen for an event on the channel instance.
  18734. */
  18735. }, {
  18736. key: 'listen',
  18737. value: function listen(event, callback) {
  18738. return this;
  18739. }
  18740. /**
  18741. * Stop listening for an event on the channel instance.
  18742. */
  18743. }, {
  18744. key: 'stopListening',
  18745. value: function stopListening(event) {
  18746. return this;
  18747. }
  18748. /**
  18749. * Bind a channel to an event.
  18750. */
  18751. }, {
  18752. key: 'on',
  18753. value: function on(event, callback) {
  18754. return this;
  18755. }
  18756. }]);
  18757. return NullChannel;
  18758. }(Channel);
  18759. /**
  18760. * This class represents a null private channel.
  18761. */
  18762. var NullPrivateChannel = function (_NullChannel) {
  18763. inherits(NullPrivateChannel, _NullChannel);
  18764. function NullPrivateChannel() {
  18765. classCallCheck(this, NullPrivateChannel);
  18766. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  18767. }
  18768. createClass(NullPrivateChannel, [{
  18769. key: 'whisper',
  18770. /**
  18771. * Trigger client event on the channel.
  18772. */
  18773. value: function whisper(eventName, data) {
  18774. return this;
  18775. }
  18776. }]);
  18777. return NullPrivateChannel;
  18778. }(NullChannel);
  18779. /**
  18780. * This class represents a null presence channel.
  18781. */
  18782. var NullPresenceChannel = function (_NullChannel) {
  18783. inherits(NullPresenceChannel, _NullChannel);
  18784. function NullPresenceChannel() {
  18785. classCallCheck(this, NullPresenceChannel);
  18786. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  18787. }
  18788. createClass(NullPresenceChannel, [{
  18789. key: 'here',
  18790. /**
  18791. * Register a callback to be called anytime the member list changes.
  18792. */
  18793. value: function here(callback) {
  18794. return this;
  18795. }
  18796. /**
  18797. * Listen for someone joining the channel.
  18798. */
  18799. }, {
  18800. key: 'joining',
  18801. value: function joining(callback) {
  18802. return this;
  18803. }
  18804. /**
  18805. * Listen for someone leaving the channel.
  18806. */
  18807. }, {
  18808. key: 'leaving',
  18809. value: function leaving(callback) {
  18810. return this;
  18811. }
  18812. /**
  18813. * Trigger client event on the channel.
  18814. */
  18815. }, {
  18816. key: 'whisper',
  18817. value: function whisper(eventName, data) {
  18818. return this;
  18819. }
  18820. }]);
  18821. return NullPresenceChannel;
  18822. }(NullChannel);
  18823. /**
  18824. * This class creates a connector to Pusher.
  18825. */
  18826. var PusherConnector = function (_Connector) {
  18827. inherits(PusherConnector, _Connector);
  18828. function PusherConnector() {
  18829. classCallCheck(this, PusherConnector);
  18830. /**
  18831. * All of the subscribed channel names.
  18832. */
  18833. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  18834. _this.channels = {};
  18835. return _this;
  18836. }
  18837. /**
  18838. * Create a fresh Pusher connection.
  18839. */
  18840. createClass(PusherConnector, [{
  18841. key: 'connect',
  18842. value: function connect() {
  18843. if (typeof this.options.client !== 'undefined') {
  18844. this.pusher = this.options.client;
  18845. } else {
  18846. this.pusher = new Pusher(this.options.key, this.options);
  18847. }
  18848. }
  18849. /**
  18850. * Listen for an event on a channel instance.
  18851. */
  18852. }, {
  18853. key: 'listen',
  18854. value: function listen(name, event, callback) {
  18855. return this.channel(name).listen(event, callback);
  18856. }
  18857. /**
  18858. * Get a channel instance by name.
  18859. */
  18860. }, {
  18861. key: 'channel',
  18862. value: function channel(name) {
  18863. if (!this.channels[name]) {
  18864. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  18865. }
  18866. return this.channels[name];
  18867. }
  18868. /**
  18869. * Get a private channel instance by name.
  18870. */
  18871. }, {
  18872. key: 'privateChannel',
  18873. value: function privateChannel(name) {
  18874. if (!this.channels['private-' + name]) {
  18875. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  18876. }
  18877. return this.channels['private-' + name];
  18878. }
  18879. /**
  18880. * Get a presence channel instance by name.
  18881. */
  18882. }, {
  18883. key: 'presenceChannel',
  18884. value: function presenceChannel(name) {
  18885. if (!this.channels['presence-' + name]) {
  18886. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  18887. }
  18888. return this.channels['presence-' + name];
  18889. }
  18890. /**
  18891. * Leave the given channel, as well as its private and presence variants.
  18892. */
  18893. }, {
  18894. key: 'leave',
  18895. value: function leave(name) {
  18896. var _this2 = this;
  18897. var channels = [name, 'private-' + name, 'presence-' + name];
  18898. channels.forEach(function (name, index) {
  18899. _this2.leaveChannel(name);
  18900. });
  18901. }
  18902. /**
  18903. * Leave the given channel.
  18904. */
  18905. }, {
  18906. key: 'leaveChannel',
  18907. value: function leaveChannel(name) {
  18908. if (this.channels[name]) {
  18909. this.channels[name].unsubscribe();
  18910. delete this.channels[name];
  18911. }
  18912. }
  18913. /**
  18914. * Get the socket ID for the connection.
  18915. */
  18916. }, {
  18917. key: 'socketId',
  18918. value: function socketId() {
  18919. return this.pusher.connection.socket_id;
  18920. }
  18921. /**
  18922. * Disconnect Pusher connection.
  18923. */
  18924. }, {
  18925. key: 'disconnect',
  18926. value: function disconnect() {
  18927. this.pusher.disconnect();
  18928. }
  18929. }]);
  18930. return PusherConnector;
  18931. }(Connector);
  18932. /**
  18933. * This class creates a connnector to a Socket.io server.
  18934. */
  18935. var SocketIoConnector = function (_Connector) {
  18936. inherits(SocketIoConnector, _Connector);
  18937. function SocketIoConnector() {
  18938. classCallCheck(this, SocketIoConnector);
  18939. /**
  18940. * All of the subscribed channel names.
  18941. */
  18942. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18943. _this.channels = {};
  18944. return _this;
  18945. }
  18946. /**
  18947. * Create a fresh Socket.io connection.
  18948. */
  18949. createClass(SocketIoConnector, [{
  18950. key: 'connect',
  18951. value: function connect() {
  18952. var io = this.getSocketIO();
  18953. this.socket = io(this.options.host, this.options);
  18954. return this.socket;
  18955. }
  18956. /**
  18957. * Get socket.io module from global scope or options.
  18958. */
  18959. }, {
  18960. key: 'getSocketIO',
  18961. value: function getSocketIO() {
  18962. if (typeof this.options.client !== 'undefined') {
  18963. return this.options.client;
  18964. }
  18965. if (typeof io !== 'undefined') {
  18966. return io;
  18967. }
  18968. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18969. }
  18970. /**
  18971. * Listen for an event on a channel instance.
  18972. */
  18973. }, {
  18974. key: 'listen',
  18975. value: function listen(name, event, callback) {
  18976. return this.channel(name).listen(event, callback);
  18977. }
  18978. /**
  18979. * Get a channel instance by name.
  18980. */
  18981. }, {
  18982. key: 'channel',
  18983. value: function channel(name) {
  18984. if (!this.channels[name]) {
  18985. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18986. }
  18987. return this.channels[name];
  18988. }
  18989. /**
  18990. * Get a private channel instance by name.
  18991. */
  18992. }, {
  18993. key: 'privateChannel',
  18994. value: function privateChannel(name) {
  18995. if (!this.channels['private-' + name]) {
  18996. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18997. }
  18998. return this.channels['private-' + name];
  18999. }
  19000. /**
  19001. * Get a presence channel instance by name.
  19002. */
  19003. }, {
  19004. key: 'presenceChannel',
  19005. value: function presenceChannel(name) {
  19006. if (!this.channels['presence-' + name]) {
  19007. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  19008. }
  19009. return this.channels['presence-' + name];
  19010. }
  19011. /**
  19012. * Leave the given channel, as well as its private and presence variants.
  19013. */
  19014. }, {
  19015. key: 'leave',
  19016. value: function leave(name) {
  19017. var _this2 = this;
  19018. var channels = [name, 'private-' + name, 'presence-' + name];
  19019. channels.forEach(function (name) {
  19020. _this2.leaveChannel(name);
  19021. });
  19022. }
  19023. /**
  19024. * Leave the given channel.
  19025. */
  19026. }, {
  19027. key: 'leaveChannel',
  19028. value: function leaveChannel(name) {
  19029. if (this.channels[name]) {
  19030. this.channels[name].unsubscribe();
  19031. delete this.channels[name];
  19032. }
  19033. }
  19034. /**
  19035. * Get the socket ID for the connection.
  19036. */
  19037. }, {
  19038. key: 'socketId',
  19039. value: function socketId() {
  19040. return this.socket.id;
  19041. }
  19042. /**
  19043. * Disconnect Socketio connection.
  19044. */
  19045. }, {
  19046. key: 'disconnect',
  19047. value: function disconnect() {
  19048. this.socket.disconnect();
  19049. }
  19050. }]);
  19051. return SocketIoConnector;
  19052. }(Connector);
  19053. /**
  19054. * This class creates a null connector.
  19055. */
  19056. var NullConnector = function (_Connector) {
  19057. inherits(NullConnector, _Connector);
  19058. function NullConnector() {
  19059. classCallCheck(this, NullConnector);
  19060. /**
  19061. * All of the subscribed channel names.
  19062. */
  19063. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  19064. _this.channels = {};
  19065. return _this;
  19066. }
  19067. /**
  19068. * Create a fresh connection.
  19069. */
  19070. createClass(NullConnector, [{
  19071. key: 'connect',
  19072. value: function connect() {}
  19073. //
  19074. /**
  19075. * Listen for an event on a channel instance.
  19076. */
  19077. }, {
  19078. key: 'listen',
  19079. value: function listen(name, event, callback) {
  19080. return new NullChannel();
  19081. }
  19082. /**
  19083. * Get a channel instance by name.
  19084. */
  19085. }, {
  19086. key: 'channel',
  19087. value: function channel(name) {
  19088. return new NullChannel();
  19089. }
  19090. /**
  19091. * Get a private channel instance by name.
  19092. */
  19093. }, {
  19094. key: 'privateChannel',
  19095. value: function privateChannel(name) {
  19096. return new NullPrivateChannel();
  19097. }
  19098. /**
  19099. * Get a presence channel instance by name.
  19100. */
  19101. }, {
  19102. key: 'presenceChannel',
  19103. value: function presenceChannel(name) {
  19104. return new NullPresenceChannel();
  19105. }
  19106. /**
  19107. * Leave the given channel, as well as its private and presence variants.
  19108. */
  19109. }, {
  19110. key: 'leave',
  19111. value: function leave(name) {}
  19112. //
  19113. /**
  19114. * Leave the given channel.
  19115. */
  19116. }, {
  19117. key: 'leaveChannel',
  19118. value: function leaveChannel(name) {}
  19119. //
  19120. /**
  19121. * Get the socket ID for the connection.
  19122. */
  19123. }, {
  19124. key: 'socketId',
  19125. value: function socketId() {
  19126. return 'fake-socket-id';
  19127. }
  19128. /**
  19129. * Disconnect the connection.
  19130. */
  19131. }, {
  19132. key: 'disconnect',
  19133. value: function disconnect() {
  19134. //
  19135. }
  19136. }]);
  19137. return NullConnector;
  19138. }(Connector);
  19139. /**
  19140. * This class is the primary API for interacting with broadcasting.
  19141. */
  19142. var Echo = function () {
  19143. /**
  19144. * Create a new class instance.
  19145. */
  19146. function Echo(options) {
  19147. classCallCheck(this, Echo);
  19148. this.options = options;
  19149. this.connect();
  19150. if (!this.options.withoutInterceptors) {
  19151. this.registerInterceptors();
  19152. }
  19153. }
  19154. /**
  19155. * Get a channel instance by name.
  19156. */
  19157. createClass(Echo, [{
  19158. key: 'channel',
  19159. value: function channel(_channel) {
  19160. return this.connector.channel(_channel);
  19161. }
  19162. /**
  19163. * Create a new connection.
  19164. */
  19165. }, {
  19166. key: 'connect',
  19167. value: function connect() {
  19168. if (this.options.broadcaster == 'pusher') {
  19169. this.connector = new PusherConnector(this.options);
  19170. } else if (this.options.broadcaster == 'socket.io') {
  19171. this.connector = new SocketIoConnector(this.options);
  19172. } else if (this.options.broadcaster == 'null') {
  19173. this.connector = new NullConnector(this.options);
  19174. } else if (typeof this.options.broadcaster == 'function') {
  19175. this.connector = new this.options.broadcaster(this.options);
  19176. }
  19177. }
  19178. /**
  19179. * Disconnect from the Echo server.
  19180. */
  19181. }, {
  19182. key: 'disconnect',
  19183. value: function disconnect() {
  19184. this.connector.disconnect();
  19185. }
  19186. /**
  19187. * Get a presence channel instance by name.
  19188. */
  19189. }, {
  19190. key: 'join',
  19191. value: function join(channel) {
  19192. return this.connector.presenceChannel(channel);
  19193. }
  19194. /**
  19195. * Leave the given channel, as well as its private and presence variants.
  19196. */
  19197. }, {
  19198. key: 'leave',
  19199. value: function leave(channel) {
  19200. this.connector.leave(channel);
  19201. }
  19202. /**
  19203. * Leave the given channel.
  19204. */
  19205. }, {
  19206. key: 'leaveChannel',
  19207. value: function leaveChannel(channel) {
  19208. this.connector.leaveChannel(channel);
  19209. }
  19210. /**
  19211. * Listen for an event on a channel instance.
  19212. */
  19213. }, {
  19214. key: 'listen',
  19215. value: function listen(channel, event, callback) {
  19216. return this.connector.listen(channel, event, callback);
  19217. }
  19218. /**
  19219. * Get a private channel instance by name.
  19220. */
  19221. }, {
  19222. key: 'private',
  19223. value: function _private(channel) {
  19224. return this.connector.privateChannel(channel);
  19225. }
  19226. /**
  19227. * Get the Socket ID for the connection.
  19228. */
  19229. }, {
  19230. key: 'socketId',
  19231. value: function socketId() {
  19232. return this.connector.socketId();
  19233. }
  19234. /**
  19235. * Register 3rd party request interceptiors. These are used to automatically
  19236. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  19237. */
  19238. }, {
  19239. key: 'registerInterceptors',
  19240. value: function registerInterceptors() {
  19241. if (typeof Vue === 'function' && Vue.http) {
  19242. this.registerVueRequestInterceptor();
  19243. }
  19244. if (typeof axios === 'function') {
  19245. this.registerAxiosRequestInterceptor();
  19246. }
  19247. if (typeof jQuery === 'function') {
  19248. this.registerjQueryAjaxSetup();
  19249. }
  19250. }
  19251. /**
  19252. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  19253. */
  19254. }, {
  19255. key: 'registerVueRequestInterceptor',
  19256. value: function registerVueRequestInterceptor() {
  19257. var _this = this;
  19258. Vue.http.interceptors.push(function (request, next) {
  19259. if (_this.socketId()) {
  19260. request.headers.set('X-Socket-ID', _this.socketId());
  19261. }
  19262. next();
  19263. });
  19264. }
  19265. /**
  19266. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  19267. */
  19268. }, {
  19269. key: 'registerAxiosRequestInterceptor',
  19270. value: function registerAxiosRequestInterceptor() {
  19271. var _this2 = this;
  19272. axios.interceptors.request.use(function (config) {
  19273. if (_this2.socketId()) {
  19274. config.headers['X-Socket-Id'] = _this2.socketId();
  19275. }
  19276. return config;
  19277. });
  19278. }
  19279. /**
  19280. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  19281. */
  19282. }, {
  19283. key: 'registerjQueryAjaxSetup',
  19284. value: function registerjQueryAjaxSetup() {
  19285. var _this3 = this;
  19286. if (typeof jQuery.ajax != 'undefined') {
  19287. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  19288. if (_this3.socketId()) {
  19289. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  19290. }
  19291. });
  19292. }
  19293. }
  19294. }]);
  19295. return Echo;
  19296. }();
  19297. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  19298. /***/ }),
  19299. /***/ "./node_modules/lodash/lodash.js":
  19300. /*!***************************************!*\
  19301. !*** ./node_modules/lodash/lodash.js ***!
  19302. \***************************************/
  19303. /*! no static exports found */
  19304. /***/ (function(module, exports, __webpack_require__) {
  19305. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  19306. * @license
  19307. * Lodash <https://lodash.com/>
  19308. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  19309. * Released under MIT license <https://lodash.com/license>
  19310. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  19311. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  19312. */
  19313. ;(function() {
  19314. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  19315. var undefined;
  19316. /** Used as the semantic version number. */
  19317. var VERSION = '4.17.15';
  19318. /** Used as the size to enable large array optimizations. */
  19319. var LARGE_ARRAY_SIZE = 200;
  19320. /** Error message constants. */
  19321. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  19322. FUNC_ERROR_TEXT = 'Expected a function';
  19323. /** Used to stand-in for `undefined` hash values. */
  19324. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  19325. /** Used as the maximum memoize cache size. */
  19326. var MAX_MEMOIZE_SIZE = 500;
  19327. /** Used as the internal argument placeholder. */
  19328. var PLACEHOLDER = '__lodash_placeholder__';
  19329. /** Used to compose bitmasks for cloning. */
  19330. var CLONE_DEEP_FLAG = 1,
  19331. CLONE_FLAT_FLAG = 2,
  19332. CLONE_SYMBOLS_FLAG = 4;
  19333. /** Used to compose bitmasks for value comparisons. */
  19334. var COMPARE_PARTIAL_FLAG = 1,
  19335. COMPARE_UNORDERED_FLAG = 2;
  19336. /** Used to compose bitmasks for function metadata. */
  19337. var WRAP_BIND_FLAG = 1,
  19338. WRAP_BIND_KEY_FLAG = 2,
  19339. WRAP_CURRY_BOUND_FLAG = 4,
  19340. WRAP_CURRY_FLAG = 8,
  19341. WRAP_CURRY_RIGHT_FLAG = 16,
  19342. WRAP_PARTIAL_FLAG = 32,
  19343. WRAP_PARTIAL_RIGHT_FLAG = 64,
  19344. WRAP_ARY_FLAG = 128,
  19345. WRAP_REARG_FLAG = 256,
  19346. WRAP_FLIP_FLAG = 512;
  19347. /** Used as default options for `_.truncate`. */
  19348. var DEFAULT_TRUNC_LENGTH = 30,
  19349. DEFAULT_TRUNC_OMISSION = '...';
  19350. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  19351. var HOT_COUNT = 800,
  19352. HOT_SPAN = 16;
  19353. /** Used to indicate the type of lazy iteratees. */
  19354. var LAZY_FILTER_FLAG = 1,
  19355. LAZY_MAP_FLAG = 2,
  19356. LAZY_WHILE_FLAG = 3;
  19357. /** Used as references for various `Number` constants. */
  19358. var INFINITY = 1 / 0,
  19359. MAX_SAFE_INTEGER = 9007199254740991,
  19360. MAX_INTEGER = 1.7976931348623157e+308,
  19361. NAN = 0 / 0;
  19362. /** Used as references for the maximum length and index of an array. */
  19363. var MAX_ARRAY_LENGTH = 4294967295,
  19364. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  19365. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  19366. /** Used to associate wrap methods with their bit flags. */
  19367. var wrapFlags = [
  19368. ['ary', WRAP_ARY_FLAG],
  19369. ['bind', WRAP_BIND_FLAG],
  19370. ['bindKey', WRAP_BIND_KEY_FLAG],
  19371. ['curry', WRAP_CURRY_FLAG],
  19372. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  19373. ['flip', WRAP_FLIP_FLAG],
  19374. ['partial', WRAP_PARTIAL_FLAG],
  19375. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  19376. ['rearg', WRAP_REARG_FLAG]
  19377. ];
  19378. /** `Object#toString` result references. */
  19379. var argsTag = '[object Arguments]',
  19380. arrayTag = '[object Array]',
  19381. asyncTag = '[object AsyncFunction]',
  19382. boolTag = '[object Boolean]',
  19383. dateTag = '[object Date]',
  19384. domExcTag = '[object DOMException]',
  19385. errorTag = '[object Error]',
  19386. funcTag = '[object Function]',
  19387. genTag = '[object GeneratorFunction]',
  19388. mapTag = '[object Map]',
  19389. numberTag = '[object Number]',
  19390. nullTag = '[object Null]',
  19391. objectTag = '[object Object]',
  19392. promiseTag = '[object Promise]',
  19393. proxyTag = '[object Proxy]',
  19394. regexpTag = '[object RegExp]',
  19395. setTag = '[object Set]',
  19396. stringTag = '[object String]',
  19397. symbolTag = '[object Symbol]',
  19398. undefinedTag = '[object Undefined]',
  19399. weakMapTag = '[object WeakMap]',
  19400. weakSetTag = '[object WeakSet]';
  19401. var arrayBufferTag = '[object ArrayBuffer]',
  19402. dataViewTag = '[object DataView]',
  19403. float32Tag = '[object Float32Array]',
  19404. float64Tag = '[object Float64Array]',
  19405. int8Tag = '[object Int8Array]',
  19406. int16Tag = '[object Int16Array]',
  19407. int32Tag = '[object Int32Array]',
  19408. uint8Tag = '[object Uint8Array]',
  19409. uint8ClampedTag = '[object Uint8ClampedArray]',
  19410. uint16Tag = '[object Uint16Array]',
  19411. uint32Tag = '[object Uint32Array]';
  19412. /** Used to match empty string literals in compiled template source. */
  19413. var reEmptyStringLeading = /\b__p \+= '';/g,
  19414. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  19415. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  19416. /** Used to match HTML entities and HTML characters. */
  19417. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  19418. reUnescapedHtml = /[&<>"']/g,
  19419. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  19420. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  19421. /** Used to match template delimiters. */
  19422. var reEscape = /<%-([\s\S]+?)%>/g,
  19423. reEvaluate = /<%([\s\S]+?)%>/g,
  19424. reInterpolate = /<%=([\s\S]+?)%>/g;
  19425. /** Used to match property names within property paths. */
  19426. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  19427. reIsPlainProp = /^\w*$/,
  19428. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  19429. /**
  19430. * Used to match `RegExp`
  19431. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  19432. */
  19433. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  19434. reHasRegExpChar = RegExp(reRegExpChar.source);
  19435. /** Used to match leading and trailing whitespace. */
  19436. var reTrim = /^\s+|\s+$/g,
  19437. reTrimStart = /^\s+/,
  19438. reTrimEnd = /\s+$/;
  19439. /** Used to match wrap detail comments. */
  19440. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  19441. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  19442. reSplitDetails = /,? & /;
  19443. /** Used to match words composed of alphanumeric characters. */
  19444. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  19445. /** Used to match backslashes in property paths. */
  19446. var reEscapeChar = /\\(\\)?/g;
  19447. /**
  19448. * Used to match
  19449. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  19450. */
  19451. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  19452. /** Used to match `RegExp` flags from their coerced string values. */
  19453. var reFlags = /\w*$/;
  19454. /** Used to detect bad signed hexadecimal string values. */
  19455. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  19456. /** Used to detect binary string values. */
  19457. var reIsBinary = /^0b[01]+$/i;
  19458. /** Used to detect host constructors (Safari). */
  19459. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  19460. /** Used to detect octal string values. */
  19461. var reIsOctal = /^0o[0-7]+$/i;
  19462. /** Used to detect unsigned integer values. */
  19463. var reIsUint = /^(?:0|[1-9]\d*)$/;
  19464. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  19465. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  19466. /** Used to ensure capturing order of template delimiters. */
  19467. var reNoMatch = /($^)/;
  19468. /** Used to match unescaped characters in compiled string literals. */
  19469. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  19470. /** Used to compose unicode character classes. */
  19471. var rsAstralRange = '\\ud800-\\udfff',
  19472. rsComboMarksRange = '\\u0300-\\u036f',
  19473. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  19474. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  19475. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  19476. rsDingbatRange = '\\u2700-\\u27bf',
  19477. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  19478. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  19479. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  19480. rsPunctuationRange = '\\u2000-\\u206f',
  19481. 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',
  19482. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  19483. rsVarRange = '\\ufe0e\\ufe0f',
  19484. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  19485. /** Used to compose unicode capture groups. */
  19486. var rsApos = "['\u2019]",
  19487. rsAstral = '[' + rsAstralRange + ']',
  19488. rsBreak = '[' + rsBreakRange + ']',
  19489. rsCombo = '[' + rsComboRange + ']',
  19490. rsDigits = '\\d+',
  19491. rsDingbat = '[' + rsDingbatRange + ']',
  19492. rsLower = '[' + rsLowerRange + ']',
  19493. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  19494. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  19495. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  19496. rsNonAstral = '[^' + rsAstralRange + ']',
  19497. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  19498. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  19499. rsUpper = '[' + rsUpperRange + ']',
  19500. rsZWJ = '\\u200d';
  19501. /** Used to compose unicode regexes. */
  19502. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  19503. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  19504. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  19505. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  19506. reOptMod = rsModifier + '?',
  19507. rsOptVar = '[' + rsVarRange + ']?',
  19508. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  19509. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  19510. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  19511. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  19512. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  19513. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  19514. /** Used to match apostrophes. */
  19515. var reApos = RegExp(rsApos, 'g');
  19516. /**
  19517. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  19518. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  19519. */
  19520. var reComboMark = RegExp(rsCombo, 'g');
  19521. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  19522. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  19523. /** Used to match complex or compound words. */
  19524. var reUnicodeWord = RegExp([
  19525. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  19526. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  19527. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  19528. rsUpper + '+' + rsOptContrUpper,
  19529. rsOrdUpper,
  19530. rsOrdLower,
  19531. rsDigits,
  19532. rsEmoji
  19533. ].join('|'), 'g');
  19534. /** 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/). */
  19535. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  19536. /** Used to detect strings that need a more robust regexp to match words. */
  19537. 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 ]/;
  19538. /** Used to assign default `context` object properties. */
  19539. var contextProps = [
  19540. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  19541. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  19542. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  19543. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  19544. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  19545. ];
  19546. /** Used to make template sourceURLs easier to identify. */
  19547. var templateCounter = -1;
  19548. /** Used to identify `toStringTag` values of typed arrays. */
  19549. var typedArrayTags = {};
  19550. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  19551. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  19552. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  19553. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  19554. typedArrayTags[uint32Tag] = true;
  19555. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  19556. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  19557. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  19558. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  19559. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  19560. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  19561. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  19562. typedArrayTags[weakMapTag] = false;
  19563. /** Used to identify `toStringTag` values supported by `_.clone`. */
  19564. var cloneableTags = {};
  19565. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  19566. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  19567. cloneableTags[boolTag] = cloneableTags[dateTag] =
  19568. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  19569. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  19570. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  19571. cloneableTags[numberTag] = cloneableTags[objectTag] =
  19572. cloneableTags[regexpTag] = cloneableTags[setTag] =
  19573. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  19574. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  19575. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  19576. cloneableTags[errorTag] = cloneableTags[funcTag] =
  19577. cloneableTags[weakMapTag] = false;
  19578. /** Used to map Latin Unicode letters to basic Latin letters. */
  19579. var deburredLetters = {
  19580. // Latin-1 Supplement block.
  19581. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  19582. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  19583. '\xc7': 'C', '\xe7': 'c',
  19584. '\xd0': 'D', '\xf0': 'd',
  19585. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  19586. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  19587. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  19588. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  19589. '\xd1': 'N', '\xf1': 'n',
  19590. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  19591. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  19592. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  19593. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  19594. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  19595. '\xc6': 'Ae', '\xe6': 'ae',
  19596. '\xde': 'Th', '\xfe': 'th',
  19597. '\xdf': 'ss',
  19598. // Latin Extended-A block.
  19599. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  19600. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  19601. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  19602. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  19603. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  19604. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  19605. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  19606. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  19607. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  19608. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  19609. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  19610. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  19611. '\u0134': 'J', '\u0135': 'j',
  19612. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  19613. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  19614. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  19615. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  19616. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  19617. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  19618. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  19619. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  19620. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  19621. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  19622. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  19623. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  19624. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  19625. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  19626. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  19627. '\u0174': 'W', '\u0175': 'w',
  19628. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  19629. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  19630. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  19631. '\u0132': 'IJ', '\u0133': 'ij',
  19632. '\u0152': 'Oe', '\u0153': 'oe',
  19633. '\u0149': "'n", '\u017f': 's'
  19634. };
  19635. /** Used to map characters to HTML entities. */
  19636. var htmlEscapes = {
  19637. '&': '&amp;',
  19638. '<': '&lt;',
  19639. '>': '&gt;',
  19640. '"': '&quot;',
  19641. "'": '&#39;'
  19642. };
  19643. /** Used to map HTML entities to characters. */
  19644. var htmlUnescapes = {
  19645. '&amp;': '&',
  19646. '&lt;': '<',
  19647. '&gt;': '>',
  19648. '&quot;': '"',
  19649. '&#39;': "'"
  19650. };
  19651. /** Used to escape characters for inclusion in compiled string literals. */
  19652. var stringEscapes = {
  19653. '\\': '\\',
  19654. "'": "'",
  19655. '\n': 'n',
  19656. '\r': 'r',
  19657. '\u2028': 'u2028',
  19658. '\u2029': 'u2029'
  19659. };
  19660. /** Built-in method references without a dependency on `root`. */
  19661. var freeParseFloat = parseFloat,
  19662. freeParseInt = parseInt;
  19663. /** Detect free variable `global` from Node.js. */
  19664. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  19665. /** Detect free variable `self`. */
  19666. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  19667. /** Used as a reference to the global object. */
  19668. var root = freeGlobal || freeSelf || Function('return this')();
  19669. /** Detect free variable `exports`. */
  19670. var freeExports = true && exports && !exports.nodeType && exports;
  19671. /** Detect free variable `module`. */
  19672. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  19673. /** Detect the popular CommonJS extension `module.exports`. */
  19674. var moduleExports = freeModule && freeModule.exports === freeExports;
  19675. /** Detect free variable `process` from Node.js. */
  19676. var freeProcess = moduleExports && freeGlobal.process;
  19677. /** Used to access faster Node.js helpers. */
  19678. var nodeUtil = (function() {
  19679. try {
  19680. // Use `util.types` for Node.js 10+.
  19681. var types = freeModule && freeModule.require && freeModule.require('util').types;
  19682. if (types) {
  19683. return types;
  19684. }
  19685. // Legacy `process.binding('util')` for Node.js < 10.
  19686. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  19687. } catch (e) {}
  19688. }());
  19689. /* Node.js helper references. */
  19690. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  19691. nodeIsDate = nodeUtil && nodeUtil.isDate,
  19692. nodeIsMap = nodeUtil && nodeUtil.isMap,
  19693. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  19694. nodeIsSet = nodeUtil && nodeUtil.isSet,
  19695. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  19696. /*--------------------------------------------------------------------------*/
  19697. /**
  19698. * A faster alternative to `Function#apply`, this function invokes `func`
  19699. * with the `this` binding of `thisArg` and the arguments of `args`.
  19700. *
  19701. * @private
  19702. * @param {Function} func The function to invoke.
  19703. * @param {*} thisArg The `this` binding of `func`.
  19704. * @param {Array} args The arguments to invoke `func` with.
  19705. * @returns {*} Returns the result of `func`.
  19706. */
  19707. function apply(func, thisArg, args) {
  19708. switch (args.length) {
  19709. case 0: return func.call(thisArg);
  19710. case 1: return func.call(thisArg, args[0]);
  19711. case 2: return func.call(thisArg, args[0], args[1]);
  19712. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  19713. }
  19714. return func.apply(thisArg, args);
  19715. }
  19716. /**
  19717. * A specialized version of `baseAggregator` for arrays.
  19718. *
  19719. * @private
  19720. * @param {Array} [array] The array to iterate over.
  19721. * @param {Function} setter The function to set `accumulator` values.
  19722. * @param {Function} iteratee The iteratee to transform keys.
  19723. * @param {Object} accumulator The initial aggregated object.
  19724. * @returns {Function} Returns `accumulator`.
  19725. */
  19726. function arrayAggregator(array, setter, iteratee, accumulator) {
  19727. var index = -1,
  19728. length = array == null ? 0 : array.length;
  19729. while (++index < length) {
  19730. var value = array[index];
  19731. setter(accumulator, value, iteratee(value), array);
  19732. }
  19733. return accumulator;
  19734. }
  19735. /**
  19736. * A specialized version of `_.forEach` for arrays without support for
  19737. * iteratee shorthands.
  19738. *
  19739. * @private
  19740. * @param {Array} [array] The array to iterate over.
  19741. * @param {Function} iteratee The function invoked per iteration.
  19742. * @returns {Array} Returns `array`.
  19743. */
  19744. function arrayEach(array, iteratee) {
  19745. var index = -1,
  19746. length = array == null ? 0 : array.length;
  19747. while (++index < length) {
  19748. if (iteratee(array[index], index, array) === false) {
  19749. break;
  19750. }
  19751. }
  19752. return array;
  19753. }
  19754. /**
  19755. * A specialized version of `_.forEachRight` for arrays without support for
  19756. * iteratee shorthands.
  19757. *
  19758. * @private
  19759. * @param {Array} [array] The array to iterate over.
  19760. * @param {Function} iteratee The function invoked per iteration.
  19761. * @returns {Array} Returns `array`.
  19762. */
  19763. function arrayEachRight(array, iteratee) {
  19764. var length = array == null ? 0 : array.length;
  19765. while (length--) {
  19766. if (iteratee(array[length], length, array) === false) {
  19767. break;
  19768. }
  19769. }
  19770. return array;
  19771. }
  19772. /**
  19773. * A specialized version of `_.every` for arrays without support for
  19774. * iteratee shorthands.
  19775. *
  19776. * @private
  19777. * @param {Array} [array] The array to iterate over.
  19778. * @param {Function} predicate The function invoked per iteration.
  19779. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  19780. * else `false`.
  19781. */
  19782. function arrayEvery(array, predicate) {
  19783. var index = -1,
  19784. length = array == null ? 0 : array.length;
  19785. while (++index < length) {
  19786. if (!predicate(array[index], index, array)) {
  19787. return false;
  19788. }
  19789. }
  19790. return true;
  19791. }
  19792. /**
  19793. * A specialized version of `_.filter` for arrays without support for
  19794. * iteratee shorthands.
  19795. *
  19796. * @private
  19797. * @param {Array} [array] The array to iterate over.
  19798. * @param {Function} predicate The function invoked per iteration.
  19799. * @returns {Array} Returns the new filtered array.
  19800. */
  19801. function arrayFilter(array, predicate) {
  19802. var index = -1,
  19803. length = array == null ? 0 : array.length,
  19804. resIndex = 0,
  19805. result = [];
  19806. while (++index < length) {
  19807. var value = array[index];
  19808. if (predicate(value, index, array)) {
  19809. result[resIndex++] = value;
  19810. }
  19811. }
  19812. return result;
  19813. }
  19814. /**
  19815. * A specialized version of `_.includes` for arrays without support for
  19816. * specifying an index to search from.
  19817. *
  19818. * @private
  19819. * @param {Array} [array] The array to inspect.
  19820. * @param {*} target The value to search for.
  19821. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19822. */
  19823. function arrayIncludes(array, value) {
  19824. var length = array == null ? 0 : array.length;
  19825. return !!length && baseIndexOf(array, value, 0) > -1;
  19826. }
  19827. /**
  19828. * This function is like `arrayIncludes` except that it accepts a comparator.
  19829. *
  19830. * @private
  19831. * @param {Array} [array] The array to inspect.
  19832. * @param {*} target The value to search for.
  19833. * @param {Function} comparator The comparator invoked per element.
  19834. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19835. */
  19836. function arrayIncludesWith(array, value, comparator) {
  19837. var index = -1,
  19838. length = array == null ? 0 : array.length;
  19839. while (++index < length) {
  19840. if (comparator(value, array[index])) {
  19841. return true;
  19842. }
  19843. }
  19844. return false;
  19845. }
  19846. /**
  19847. * A specialized version of `_.map` for arrays without support for iteratee
  19848. * shorthands.
  19849. *
  19850. * @private
  19851. * @param {Array} [array] The array to iterate over.
  19852. * @param {Function} iteratee The function invoked per iteration.
  19853. * @returns {Array} Returns the new mapped array.
  19854. */
  19855. function arrayMap(array, iteratee) {
  19856. var index = -1,
  19857. length = array == null ? 0 : array.length,
  19858. result = Array(length);
  19859. while (++index < length) {
  19860. result[index] = iteratee(array[index], index, array);
  19861. }
  19862. return result;
  19863. }
  19864. /**
  19865. * Appends the elements of `values` to `array`.
  19866. *
  19867. * @private
  19868. * @param {Array} array The array to modify.
  19869. * @param {Array} values The values to append.
  19870. * @returns {Array} Returns `array`.
  19871. */
  19872. function arrayPush(array, values) {
  19873. var index = -1,
  19874. length = values.length,
  19875. offset = array.length;
  19876. while (++index < length) {
  19877. array[offset + index] = values[index];
  19878. }
  19879. return array;
  19880. }
  19881. /**
  19882. * A specialized version of `_.reduce` for arrays without support for
  19883. * iteratee shorthands.
  19884. *
  19885. * @private
  19886. * @param {Array} [array] The array to iterate over.
  19887. * @param {Function} iteratee The function invoked per iteration.
  19888. * @param {*} [accumulator] The initial value.
  19889. * @param {boolean} [initAccum] Specify using the first element of `array` as
  19890. * the initial value.
  19891. * @returns {*} Returns the accumulated value.
  19892. */
  19893. function arrayReduce(array, iteratee, accumulator, initAccum) {
  19894. var index = -1,
  19895. length = array == null ? 0 : array.length;
  19896. if (initAccum && length) {
  19897. accumulator = array[++index];
  19898. }
  19899. while (++index < length) {
  19900. accumulator = iteratee(accumulator, array[index], index, array);
  19901. }
  19902. return accumulator;
  19903. }
  19904. /**
  19905. * A specialized version of `_.reduceRight` for arrays without support for
  19906. * iteratee shorthands.
  19907. *
  19908. * @private
  19909. * @param {Array} [array] The array to iterate over.
  19910. * @param {Function} iteratee The function invoked per iteration.
  19911. * @param {*} [accumulator] The initial value.
  19912. * @param {boolean} [initAccum] Specify using the last element of `array` as
  19913. * the initial value.
  19914. * @returns {*} Returns the accumulated value.
  19915. */
  19916. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  19917. var length = array == null ? 0 : array.length;
  19918. if (initAccum && length) {
  19919. accumulator = array[--length];
  19920. }
  19921. while (length--) {
  19922. accumulator = iteratee(accumulator, array[length], length, array);
  19923. }
  19924. return accumulator;
  19925. }
  19926. /**
  19927. * A specialized version of `_.some` for arrays without support for iteratee
  19928. * shorthands.
  19929. *
  19930. * @private
  19931. * @param {Array} [array] The array to iterate over.
  19932. * @param {Function} predicate The function invoked per iteration.
  19933. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19934. * else `false`.
  19935. */
  19936. function arraySome(array, predicate) {
  19937. var index = -1,
  19938. length = array == null ? 0 : array.length;
  19939. while (++index < length) {
  19940. if (predicate(array[index], index, array)) {
  19941. return true;
  19942. }
  19943. }
  19944. return false;
  19945. }
  19946. /**
  19947. * Gets the size of an ASCII `string`.
  19948. *
  19949. * @private
  19950. * @param {string} string The string inspect.
  19951. * @returns {number} Returns the string size.
  19952. */
  19953. var asciiSize = baseProperty('length');
  19954. /**
  19955. * Converts an ASCII `string` to an array.
  19956. *
  19957. * @private
  19958. * @param {string} string The string to convert.
  19959. * @returns {Array} Returns the converted array.
  19960. */
  19961. function asciiToArray(string) {
  19962. return string.split('');
  19963. }
  19964. /**
  19965. * Splits an ASCII `string` into an array of its words.
  19966. *
  19967. * @private
  19968. * @param {string} The string to inspect.
  19969. * @returns {Array} Returns the words of `string`.
  19970. */
  19971. function asciiWords(string) {
  19972. return string.match(reAsciiWord) || [];
  19973. }
  19974. /**
  19975. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19976. * without support for iteratee shorthands, which iterates over `collection`
  19977. * using `eachFunc`.
  19978. *
  19979. * @private
  19980. * @param {Array|Object} collection The collection to inspect.
  19981. * @param {Function} predicate The function invoked per iteration.
  19982. * @param {Function} eachFunc The function to iterate over `collection`.
  19983. * @returns {*} Returns the found element or its key, else `undefined`.
  19984. */
  19985. function baseFindKey(collection, predicate, eachFunc) {
  19986. var result;
  19987. eachFunc(collection, function(value, key, collection) {
  19988. if (predicate(value, key, collection)) {
  19989. result = key;
  19990. return false;
  19991. }
  19992. });
  19993. return result;
  19994. }
  19995. /**
  19996. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19997. * support for iteratee shorthands.
  19998. *
  19999. * @private
  20000. * @param {Array} array The array to inspect.
  20001. * @param {Function} predicate The function invoked per iteration.
  20002. * @param {number} fromIndex The index to search from.
  20003. * @param {boolean} [fromRight] Specify iterating from right to left.
  20004. * @returns {number} Returns the index of the matched value, else `-1`.
  20005. */
  20006. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  20007. var length = array.length,
  20008. index = fromIndex + (fromRight ? 1 : -1);
  20009. while ((fromRight ? index-- : ++index < length)) {
  20010. if (predicate(array[index], index, array)) {
  20011. return index;
  20012. }
  20013. }
  20014. return -1;
  20015. }
  20016. /**
  20017. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  20018. *
  20019. * @private
  20020. * @param {Array} array The array to inspect.
  20021. * @param {*} value The value to search for.
  20022. * @param {number} fromIndex The index to search from.
  20023. * @returns {number} Returns the index of the matched value, else `-1`.
  20024. */
  20025. function baseIndexOf(array, value, fromIndex) {
  20026. return value === value
  20027. ? strictIndexOf(array, value, fromIndex)
  20028. : baseFindIndex(array, baseIsNaN, fromIndex);
  20029. }
  20030. /**
  20031. * This function is like `baseIndexOf` except that it accepts a comparator.
  20032. *
  20033. * @private
  20034. * @param {Array} array The array to inspect.
  20035. * @param {*} value The value to search for.
  20036. * @param {number} fromIndex The index to search from.
  20037. * @param {Function} comparator The comparator invoked per element.
  20038. * @returns {number} Returns the index of the matched value, else `-1`.
  20039. */
  20040. function baseIndexOfWith(array, value, fromIndex, comparator) {
  20041. var index = fromIndex - 1,
  20042. length = array.length;
  20043. while (++index < length) {
  20044. if (comparator(array[index], value)) {
  20045. return index;
  20046. }
  20047. }
  20048. return -1;
  20049. }
  20050. /**
  20051. * The base implementation of `_.isNaN` without support for number objects.
  20052. *
  20053. * @private
  20054. * @param {*} value The value to check.
  20055. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  20056. */
  20057. function baseIsNaN(value) {
  20058. return value !== value;
  20059. }
  20060. /**
  20061. * The base implementation of `_.mean` and `_.meanBy` without support for
  20062. * iteratee shorthands.
  20063. *
  20064. * @private
  20065. * @param {Array} array The array to iterate over.
  20066. * @param {Function} iteratee The function invoked per iteration.
  20067. * @returns {number} Returns the mean.
  20068. */
  20069. function baseMean(array, iteratee) {
  20070. var length = array == null ? 0 : array.length;
  20071. return length ? (baseSum(array, iteratee) / length) : NAN;
  20072. }
  20073. /**
  20074. * The base implementation of `_.property` without support for deep paths.
  20075. *
  20076. * @private
  20077. * @param {string} key The key of the property to get.
  20078. * @returns {Function} Returns the new accessor function.
  20079. */
  20080. function baseProperty(key) {
  20081. return function(object) {
  20082. return object == null ? undefined : object[key];
  20083. };
  20084. }
  20085. /**
  20086. * The base implementation of `_.propertyOf` without support for deep paths.
  20087. *
  20088. * @private
  20089. * @param {Object} object The object to query.
  20090. * @returns {Function} Returns the new accessor function.
  20091. */
  20092. function basePropertyOf(object) {
  20093. return function(key) {
  20094. return object == null ? undefined : object[key];
  20095. };
  20096. }
  20097. /**
  20098. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  20099. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  20100. *
  20101. * @private
  20102. * @param {Array|Object} collection The collection to iterate over.
  20103. * @param {Function} iteratee The function invoked per iteration.
  20104. * @param {*} accumulator The initial value.
  20105. * @param {boolean} initAccum Specify using the first or last element of
  20106. * `collection` as the initial value.
  20107. * @param {Function} eachFunc The function to iterate over `collection`.
  20108. * @returns {*} Returns the accumulated value.
  20109. */
  20110. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  20111. eachFunc(collection, function(value, index, collection) {
  20112. accumulator = initAccum
  20113. ? (initAccum = false, value)
  20114. : iteratee(accumulator, value, index, collection);
  20115. });
  20116. return accumulator;
  20117. }
  20118. /**
  20119. * The base implementation of `_.sortBy` which uses `comparer` to define the
  20120. * sort order of `array` and replaces criteria objects with their corresponding
  20121. * values.
  20122. *
  20123. * @private
  20124. * @param {Array} array The array to sort.
  20125. * @param {Function} comparer The function to define sort order.
  20126. * @returns {Array} Returns `array`.
  20127. */
  20128. function baseSortBy(array, comparer) {
  20129. var length = array.length;
  20130. array.sort(comparer);
  20131. while (length--) {
  20132. array[length] = array[length].value;
  20133. }
  20134. return array;
  20135. }
  20136. /**
  20137. * The base implementation of `_.sum` and `_.sumBy` without support for
  20138. * iteratee shorthands.
  20139. *
  20140. * @private
  20141. * @param {Array} array The array to iterate over.
  20142. * @param {Function} iteratee The function invoked per iteration.
  20143. * @returns {number} Returns the sum.
  20144. */
  20145. function baseSum(array, iteratee) {
  20146. var result,
  20147. index = -1,
  20148. length = array.length;
  20149. while (++index < length) {
  20150. var current = iteratee(array[index]);
  20151. if (current !== undefined) {
  20152. result = result === undefined ? current : (result + current);
  20153. }
  20154. }
  20155. return result;
  20156. }
  20157. /**
  20158. * The base implementation of `_.times` without support for iteratee shorthands
  20159. * or max array length checks.
  20160. *
  20161. * @private
  20162. * @param {number} n The number of times to invoke `iteratee`.
  20163. * @param {Function} iteratee The function invoked per iteration.
  20164. * @returns {Array} Returns the array of results.
  20165. */
  20166. function baseTimes(n, iteratee) {
  20167. var index = -1,
  20168. result = Array(n);
  20169. while (++index < n) {
  20170. result[index] = iteratee(index);
  20171. }
  20172. return result;
  20173. }
  20174. /**
  20175. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  20176. * of key-value pairs for `object` corresponding to the property names of `props`.
  20177. *
  20178. * @private
  20179. * @param {Object} object The object to query.
  20180. * @param {Array} props The property names to get values for.
  20181. * @returns {Object} Returns the key-value pairs.
  20182. */
  20183. function baseToPairs(object, props) {
  20184. return arrayMap(props, function(key) {
  20185. return [key, object[key]];
  20186. });
  20187. }
  20188. /**
  20189. * The base implementation of `_.unary` without support for storing metadata.
  20190. *
  20191. * @private
  20192. * @param {Function} func The function to cap arguments for.
  20193. * @returns {Function} Returns the new capped function.
  20194. */
  20195. function baseUnary(func) {
  20196. return function(value) {
  20197. return func(value);
  20198. };
  20199. }
  20200. /**
  20201. * The base implementation of `_.values` and `_.valuesIn` which creates an
  20202. * array of `object` property values corresponding to the property names
  20203. * of `props`.
  20204. *
  20205. * @private
  20206. * @param {Object} object The object to query.
  20207. * @param {Array} props The property names to get values for.
  20208. * @returns {Object} Returns the array of property values.
  20209. */
  20210. function baseValues(object, props) {
  20211. return arrayMap(props, function(key) {
  20212. return object[key];
  20213. });
  20214. }
  20215. /**
  20216. * Checks if a `cache` value for `key` exists.
  20217. *
  20218. * @private
  20219. * @param {Object} cache The cache to query.
  20220. * @param {string} key The key of the entry to check.
  20221. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20222. */
  20223. function cacheHas(cache, key) {
  20224. return cache.has(key);
  20225. }
  20226. /**
  20227. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  20228. * that is not found in the character symbols.
  20229. *
  20230. * @private
  20231. * @param {Array} strSymbols The string symbols to inspect.
  20232. * @param {Array} chrSymbols The character symbols to find.
  20233. * @returns {number} Returns the index of the first unmatched string symbol.
  20234. */
  20235. function charsStartIndex(strSymbols, chrSymbols) {
  20236. var index = -1,
  20237. length = strSymbols.length;
  20238. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  20239. return index;
  20240. }
  20241. /**
  20242. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  20243. * that is not found in the character symbols.
  20244. *
  20245. * @private
  20246. * @param {Array} strSymbols The string symbols to inspect.
  20247. * @param {Array} chrSymbols The character symbols to find.
  20248. * @returns {number} Returns the index of the last unmatched string symbol.
  20249. */
  20250. function charsEndIndex(strSymbols, chrSymbols) {
  20251. var index = strSymbols.length;
  20252. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  20253. return index;
  20254. }
  20255. /**
  20256. * Gets the number of `placeholder` occurrences in `array`.
  20257. *
  20258. * @private
  20259. * @param {Array} array The array to inspect.
  20260. * @param {*} placeholder The placeholder to search for.
  20261. * @returns {number} Returns the placeholder count.
  20262. */
  20263. function countHolders(array, placeholder) {
  20264. var length = array.length,
  20265. result = 0;
  20266. while (length--) {
  20267. if (array[length] === placeholder) {
  20268. ++result;
  20269. }
  20270. }
  20271. return result;
  20272. }
  20273. /**
  20274. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  20275. * letters to basic Latin letters.
  20276. *
  20277. * @private
  20278. * @param {string} letter The matched letter to deburr.
  20279. * @returns {string} Returns the deburred letter.
  20280. */
  20281. var deburrLetter = basePropertyOf(deburredLetters);
  20282. /**
  20283. * Used by `_.escape` to convert characters to HTML entities.
  20284. *
  20285. * @private
  20286. * @param {string} chr The matched character to escape.
  20287. * @returns {string} Returns the escaped character.
  20288. */
  20289. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  20290. /**
  20291. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  20292. *
  20293. * @private
  20294. * @param {string} chr The matched character to escape.
  20295. * @returns {string} Returns the escaped character.
  20296. */
  20297. function escapeStringChar(chr) {
  20298. return '\\' + stringEscapes[chr];
  20299. }
  20300. /**
  20301. * Gets the value at `key` of `object`.
  20302. *
  20303. * @private
  20304. * @param {Object} [object] The object to query.
  20305. * @param {string} key The key of the property to get.
  20306. * @returns {*} Returns the property value.
  20307. */
  20308. function getValue(object, key) {
  20309. return object == null ? undefined : object[key];
  20310. }
  20311. /**
  20312. * Checks if `string` contains Unicode symbols.
  20313. *
  20314. * @private
  20315. * @param {string} string The string to inspect.
  20316. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  20317. */
  20318. function hasUnicode(string) {
  20319. return reHasUnicode.test(string);
  20320. }
  20321. /**
  20322. * Checks if `string` contains a word composed of Unicode symbols.
  20323. *
  20324. * @private
  20325. * @param {string} string The string to inspect.
  20326. * @returns {boolean} Returns `true` if a word is found, else `false`.
  20327. */
  20328. function hasUnicodeWord(string) {
  20329. return reHasUnicodeWord.test(string);
  20330. }
  20331. /**
  20332. * Converts `iterator` to an array.
  20333. *
  20334. * @private
  20335. * @param {Object} iterator The iterator to convert.
  20336. * @returns {Array} Returns the converted array.
  20337. */
  20338. function iteratorToArray(iterator) {
  20339. var data,
  20340. result = [];
  20341. while (!(data = iterator.next()).done) {
  20342. result.push(data.value);
  20343. }
  20344. return result;
  20345. }
  20346. /**
  20347. * Converts `map` to its key-value pairs.
  20348. *
  20349. * @private
  20350. * @param {Object} map The map to convert.
  20351. * @returns {Array} Returns the key-value pairs.
  20352. */
  20353. function mapToArray(map) {
  20354. var index = -1,
  20355. result = Array(map.size);
  20356. map.forEach(function(value, key) {
  20357. result[++index] = [key, value];
  20358. });
  20359. return result;
  20360. }
  20361. /**
  20362. * Creates a unary function that invokes `func` with its argument transformed.
  20363. *
  20364. * @private
  20365. * @param {Function} func The function to wrap.
  20366. * @param {Function} transform The argument transform.
  20367. * @returns {Function} Returns the new function.
  20368. */
  20369. function overArg(func, transform) {
  20370. return function(arg) {
  20371. return func(transform(arg));
  20372. };
  20373. }
  20374. /**
  20375. * Replaces all `placeholder` elements in `array` with an internal placeholder
  20376. * and returns an array of their indexes.
  20377. *
  20378. * @private
  20379. * @param {Array} array The array to modify.
  20380. * @param {*} placeholder The placeholder to replace.
  20381. * @returns {Array} Returns the new array of placeholder indexes.
  20382. */
  20383. function replaceHolders(array, placeholder) {
  20384. var index = -1,
  20385. length = array.length,
  20386. resIndex = 0,
  20387. result = [];
  20388. while (++index < length) {
  20389. var value = array[index];
  20390. if (value === placeholder || value === PLACEHOLDER) {
  20391. array[index] = PLACEHOLDER;
  20392. result[resIndex++] = index;
  20393. }
  20394. }
  20395. return result;
  20396. }
  20397. /**
  20398. * Converts `set` to an array of its values.
  20399. *
  20400. * @private
  20401. * @param {Object} set The set to convert.
  20402. * @returns {Array} Returns the values.
  20403. */
  20404. function setToArray(set) {
  20405. var index = -1,
  20406. result = Array(set.size);
  20407. set.forEach(function(value) {
  20408. result[++index] = value;
  20409. });
  20410. return result;
  20411. }
  20412. /**
  20413. * Converts `set` to its value-value pairs.
  20414. *
  20415. * @private
  20416. * @param {Object} set The set to convert.
  20417. * @returns {Array} Returns the value-value pairs.
  20418. */
  20419. function setToPairs(set) {
  20420. var index = -1,
  20421. result = Array(set.size);
  20422. set.forEach(function(value) {
  20423. result[++index] = [value, value];
  20424. });
  20425. return result;
  20426. }
  20427. /**
  20428. * A specialized version of `_.indexOf` which performs strict equality
  20429. * comparisons of values, i.e. `===`.
  20430. *
  20431. * @private
  20432. * @param {Array} array The array to inspect.
  20433. * @param {*} value The value to search for.
  20434. * @param {number} fromIndex The index to search from.
  20435. * @returns {number} Returns the index of the matched value, else `-1`.
  20436. */
  20437. function strictIndexOf(array, value, fromIndex) {
  20438. var index = fromIndex - 1,
  20439. length = array.length;
  20440. while (++index < length) {
  20441. if (array[index] === value) {
  20442. return index;
  20443. }
  20444. }
  20445. return -1;
  20446. }
  20447. /**
  20448. * A specialized version of `_.lastIndexOf` which performs strict equality
  20449. * comparisons of values, i.e. `===`.
  20450. *
  20451. * @private
  20452. * @param {Array} array The array to inspect.
  20453. * @param {*} value The value to search for.
  20454. * @param {number} fromIndex The index to search from.
  20455. * @returns {number} Returns the index of the matched value, else `-1`.
  20456. */
  20457. function strictLastIndexOf(array, value, fromIndex) {
  20458. var index = fromIndex + 1;
  20459. while (index--) {
  20460. if (array[index] === value) {
  20461. return index;
  20462. }
  20463. }
  20464. return index;
  20465. }
  20466. /**
  20467. * Gets the number of symbols in `string`.
  20468. *
  20469. * @private
  20470. * @param {string} string The string to inspect.
  20471. * @returns {number} Returns the string size.
  20472. */
  20473. function stringSize(string) {
  20474. return hasUnicode(string)
  20475. ? unicodeSize(string)
  20476. : asciiSize(string);
  20477. }
  20478. /**
  20479. * Converts `string` to an array.
  20480. *
  20481. * @private
  20482. * @param {string} string The string to convert.
  20483. * @returns {Array} Returns the converted array.
  20484. */
  20485. function stringToArray(string) {
  20486. return hasUnicode(string)
  20487. ? unicodeToArray(string)
  20488. : asciiToArray(string);
  20489. }
  20490. /**
  20491. * Used by `_.unescape` to convert HTML entities to characters.
  20492. *
  20493. * @private
  20494. * @param {string} chr The matched character to unescape.
  20495. * @returns {string} Returns the unescaped character.
  20496. */
  20497. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  20498. /**
  20499. * Gets the size of a Unicode `string`.
  20500. *
  20501. * @private
  20502. * @param {string} string The string inspect.
  20503. * @returns {number} Returns the string size.
  20504. */
  20505. function unicodeSize(string) {
  20506. var result = reUnicode.lastIndex = 0;
  20507. while (reUnicode.test(string)) {
  20508. ++result;
  20509. }
  20510. return result;
  20511. }
  20512. /**
  20513. * Converts a Unicode `string` to an array.
  20514. *
  20515. * @private
  20516. * @param {string} string The string to convert.
  20517. * @returns {Array} Returns the converted array.
  20518. */
  20519. function unicodeToArray(string) {
  20520. return string.match(reUnicode) || [];
  20521. }
  20522. /**
  20523. * Splits a Unicode `string` into an array of its words.
  20524. *
  20525. * @private
  20526. * @param {string} The string to inspect.
  20527. * @returns {Array} Returns the words of `string`.
  20528. */
  20529. function unicodeWords(string) {
  20530. return string.match(reUnicodeWord) || [];
  20531. }
  20532. /*--------------------------------------------------------------------------*/
  20533. /**
  20534. * Create a new pristine `lodash` function using the `context` object.
  20535. *
  20536. * @static
  20537. * @memberOf _
  20538. * @since 1.1.0
  20539. * @category Util
  20540. * @param {Object} [context=root] The context object.
  20541. * @returns {Function} Returns a new `lodash` function.
  20542. * @example
  20543. *
  20544. * _.mixin({ 'foo': _.constant('foo') });
  20545. *
  20546. * var lodash = _.runInContext();
  20547. * lodash.mixin({ 'bar': lodash.constant('bar') });
  20548. *
  20549. * _.isFunction(_.foo);
  20550. * // => true
  20551. * _.isFunction(_.bar);
  20552. * // => false
  20553. *
  20554. * lodash.isFunction(lodash.foo);
  20555. * // => false
  20556. * lodash.isFunction(lodash.bar);
  20557. * // => true
  20558. *
  20559. * // Create a suped-up `defer` in Node.js.
  20560. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  20561. */
  20562. var runInContext = (function runInContext(context) {
  20563. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  20564. /** Built-in constructor references. */
  20565. var Array = context.Array,
  20566. Date = context.Date,
  20567. Error = context.Error,
  20568. Function = context.Function,
  20569. Math = context.Math,
  20570. Object = context.Object,
  20571. RegExp = context.RegExp,
  20572. String = context.String,
  20573. TypeError = context.TypeError;
  20574. /** Used for built-in method references. */
  20575. var arrayProto = Array.prototype,
  20576. funcProto = Function.prototype,
  20577. objectProto = Object.prototype;
  20578. /** Used to detect overreaching core-js shims. */
  20579. var coreJsData = context['__core-js_shared__'];
  20580. /** Used to resolve the decompiled source of functions. */
  20581. var funcToString = funcProto.toString;
  20582. /** Used to check objects for own properties. */
  20583. var hasOwnProperty = objectProto.hasOwnProperty;
  20584. /** Used to generate unique IDs. */
  20585. var idCounter = 0;
  20586. /** Used to detect methods masquerading as native. */
  20587. var maskSrcKey = (function() {
  20588. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  20589. return uid ? ('Symbol(src)_1.' + uid) : '';
  20590. }());
  20591. /**
  20592. * Used to resolve the
  20593. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  20594. * of values.
  20595. */
  20596. var nativeObjectToString = objectProto.toString;
  20597. /** Used to infer the `Object` constructor. */
  20598. var objectCtorString = funcToString.call(Object);
  20599. /** Used to restore the original `_` reference in `_.noConflict`. */
  20600. var oldDash = root._;
  20601. /** Used to detect if a method is native. */
  20602. var reIsNative = RegExp('^' +
  20603. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  20604. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  20605. );
  20606. /** Built-in value references. */
  20607. var Buffer = moduleExports ? context.Buffer : undefined,
  20608. Symbol = context.Symbol,
  20609. Uint8Array = context.Uint8Array,
  20610. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  20611. getPrototype = overArg(Object.getPrototypeOf, Object),
  20612. objectCreate = Object.create,
  20613. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  20614. splice = arrayProto.splice,
  20615. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  20616. symIterator = Symbol ? Symbol.iterator : undefined,
  20617. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  20618. var defineProperty = (function() {
  20619. try {
  20620. var func = getNative(Object, 'defineProperty');
  20621. func({}, '', {});
  20622. return func;
  20623. } catch (e) {}
  20624. }());
  20625. /** Mocked built-ins. */
  20626. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  20627. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  20628. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  20629. /* Built-in method references for those with the same name as other `lodash` methods. */
  20630. var nativeCeil = Math.ceil,
  20631. nativeFloor = Math.floor,
  20632. nativeGetSymbols = Object.getOwnPropertySymbols,
  20633. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  20634. nativeIsFinite = context.isFinite,
  20635. nativeJoin = arrayProto.join,
  20636. nativeKeys = overArg(Object.keys, Object),
  20637. nativeMax = Math.max,
  20638. nativeMin = Math.min,
  20639. nativeNow = Date.now,
  20640. nativeParseInt = context.parseInt,
  20641. nativeRandom = Math.random,
  20642. nativeReverse = arrayProto.reverse;
  20643. /* Built-in method references that are verified to be native. */
  20644. var DataView = getNative(context, 'DataView'),
  20645. Map = getNative(context, 'Map'),
  20646. Promise = getNative(context, 'Promise'),
  20647. Set = getNative(context, 'Set'),
  20648. WeakMap = getNative(context, 'WeakMap'),
  20649. nativeCreate = getNative(Object, 'create');
  20650. /** Used to store function metadata. */
  20651. var metaMap = WeakMap && new WeakMap;
  20652. /** Used to lookup unminified function names. */
  20653. var realNames = {};
  20654. /** Used to detect maps, sets, and weakmaps. */
  20655. var dataViewCtorString = toSource(DataView),
  20656. mapCtorString = toSource(Map),
  20657. promiseCtorString = toSource(Promise),
  20658. setCtorString = toSource(Set),
  20659. weakMapCtorString = toSource(WeakMap);
  20660. /** Used to convert symbols to primitives and strings. */
  20661. var symbolProto = Symbol ? Symbol.prototype : undefined,
  20662. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  20663. symbolToString = symbolProto ? symbolProto.toString : undefined;
  20664. /*------------------------------------------------------------------------*/
  20665. /**
  20666. * Creates a `lodash` object which wraps `value` to enable implicit method
  20667. * chain sequences. Methods that operate on and return arrays, collections,
  20668. * and functions can be chained together. Methods that retrieve a single value
  20669. * or may return a primitive value will automatically end the chain sequence
  20670. * and return the unwrapped value. Otherwise, the value must be unwrapped
  20671. * with `_#value`.
  20672. *
  20673. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  20674. * enabled using `_.chain`.
  20675. *
  20676. * The execution of chained methods is lazy, that is, it's deferred until
  20677. * `_#value` is implicitly or explicitly called.
  20678. *
  20679. * Lazy evaluation allows several methods to support shortcut fusion.
  20680. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  20681. * the creation of intermediate arrays and can greatly reduce the number of
  20682. * iteratee executions. Sections of a chain sequence qualify for shortcut
  20683. * fusion if the section is applied to an array and iteratees accept only
  20684. * one argument. The heuristic for whether a section qualifies for shortcut
  20685. * fusion is subject to change.
  20686. *
  20687. * Chaining is supported in custom builds as long as the `_#value` method is
  20688. * directly or indirectly included in the build.
  20689. *
  20690. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  20691. *
  20692. * The wrapper `Array` methods are:
  20693. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  20694. *
  20695. * The wrapper `String` methods are:
  20696. * `replace` and `split`
  20697. *
  20698. * The wrapper methods that support shortcut fusion are:
  20699. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  20700. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  20701. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  20702. *
  20703. * The chainable wrapper methods are:
  20704. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  20705. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  20706. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  20707. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  20708. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  20709. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  20710. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  20711. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  20712. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  20713. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  20714. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  20715. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  20716. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  20717. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  20718. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  20719. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  20720. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  20721. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  20722. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  20723. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  20724. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  20725. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  20726. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  20727. * `zipObject`, `zipObjectDeep`, and `zipWith`
  20728. *
  20729. * The wrapper methods that are **not** chainable by default are:
  20730. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  20731. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  20732. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  20733. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  20734. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  20735. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  20736. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  20737. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  20738. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  20739. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  20740. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  20741. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  20742. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  20743. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  20744. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  20745. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  20746. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  20747. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  20748. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  20749. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  20750. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  20751. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  20752. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  20753. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  20754. * `upperFirst`, `value`, and `words`
  20755. *
  20756. * @name _
  20757. * @constructor
  20758. * @category Seq
  20759. * @param {*} value The value to wrap in a `lodash` instance.
  20760. * @returns {Object} Returns the new `lodash` wrapper instance.
  20761. * @example
  20762. *
  20763. * function square(n) {
  20764. * return n * n;
  20765. * }
  20766. *
  20767. * var wrapped = _([1, 2, 3]);
  20768. *
  20769. * // Returns an unwrapped value.
  20770. * wrapped.reduce(_.add);
  20771. * // => 6
  20772. *
  20773. * // Returns a wrapped value.
  20774. * var squares = wrapped.map(square);
  20775. *
  20776. * _.isArray(squares);
  20777. * // => false
  20778. *
  20779. * _.isArray(squares.value());
  20780. * // => true
  20781. */
  20782. function lodash(value) {
  20783. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  20784. if (value instanceof LodashWrapper) {
  20785. return value;
  20786. }
  20787. if (hasOwnProperty.call(value, '__wrapped__')) {
  20788. return wrapperClone(value);
  20789. }
  20790. }
  20791. return new LodashWrapper(value);
  20792. }
  20793. /**
  20794. * The base implementation of `_.create` without support for assigning
  20795. * properties to the created object.
  20796. *
  20797. * @private
  20798. * @param {Object} proto The object to inherit from.
  20799. * @returns {Object} Returns the new object.
  20800. */
  20801. var baseCreate = (function() {
  20802. function object() {}
  20803. return function(proto) {
  20804. if (!isObject(proto)) {
  20805. return {};
  20806. }
  20807. if (objectCreate) {
  20808. return objectCreate(proto);
  20809. }
  20810. object.prototype = proto;
  20811. var result = new object;
  20812. object.prototype = undefined;
  20813. return result;
  20814. };
  20815. }());
  20816. /**
  20817. * The function whose prototype chain sequence wrappers inherit from.
  20818. *
  20819. * @private
  20820. */
  20821. function baseLodash() {
  20822. // No operation performed.
  20823. }
  20824. /**
  20825. * The base constructor for creating `lodash` wrapper objects.
  20826. *
  20827. * @private
  20828. * @param {*} value The value to wrap.
  20829. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  20830. */
  20831. function LodashWrapper(value, chainAll) {
  20832. this.__wrapped__ = value;
  20833. this.__actions__ = [];
  20834. this.__chain__ = !!chainAll;
  20835. this.__index__ = 0;
  20836. this.__values__ = undefined;
  20837. }
  20838. /**
  20839. * By default, the template delimiters used by lodash are like those in
  20840. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  20841. * following template settings to use alternative delimiters.
  20842. *
  20843. * @static
  20844. * @memberOf _
  20845. * @type {Object}
  20846. */
  20847. lodash.templateSettings = {
  20848. /**
  20849. * Used to detect `data` property values to be HTML-escaped.
  20850. *
  20851. * @memberOf _.templateSettings
  20852. * @type {RegExp}
  20853. */
  20854. 'escape': reEscape,
  20855. /**
  20856. * Used to detect code to be evaluated.
  20857. *
  20858. * @memberOf _.templateSettings
  20859. * @type {RegExp}
  20860. */
  20861. 'evaluate': reEvaluate,
  20862. /**
  20863. * Used to detect `data` property values to inject.
  20864. *
  20865. * @memberOf _.templateSettings
  20866. * @type {RegExp}
  20867. */
  20868. 'interpolate': reInterpolate,
  20869. /**
  20870. * Used to reference the data object in the template text.
  20871. *
  20872. * @memberOf _.templateSettings
  20873. * @type {string}
  20874. */
  20875. 'variable': '',
  20876. /**
  20877. * Used to import variables into the compiled template.
  20878. *
  20879. * @memberOf _.templateSettings
  20880. * @type {Object}
  20881. */
  20882. 'imports': {
  20883. /**
  20884. * A reference to the `lodash` function.
  20885. *
  20886. * @memberOf _.templateSettings.imports
  20887. * @type {Function}
  20888. */
  20889. '_': lodash
  20890. }
  20891. };
  20892. // Ensure wrappers are instances of `baseLodash`.
  20893. lodash.prototype = baseLodash.prototype;
  20894. lodash.prototype.constructor = lodash;
  20895. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  20896. LodashWrapper.prototype.constructor = LodashWrapper;
  20897. /*------------------------------------------------------------------------*/
  20898. /**
  20899. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  20900. *
  20901. * @private
  20902. * @constructor
  20903. * @param {*} value The value to wrap.
  20904. */
  20905. function LazyWrapper(value) {
  20906. this.__wrapped__ = value;
  20907. this.__actions__ = [];
  20908. this.__dir__ = 1;
  20909. this.__filtered__ = false;
  20910. this.__iteratees__ = [];
  20911. this.__takeCount__ = MAX_ARRAY_LENGTH;
  20912. this.__views__ = [];
  20913. }
  20914. /**
  20915. * Creates a clone of the lazy wrapper object.
  20916. *
  20917. * @private
  20918. * @name clone
  20919. * @memberOf LazyWrapper
  20920. * @returns {Object} Returns the cloned `LazyWrapper` object.
  20921. */
  20922. function lazyClone() {
  20923. var result = new LazyWrapper(this.__wrapped__);
  20924. result.__actions__ = copyArray(this.__actions__);
  20925. result.__dir__ = this.__dir__;
  20926. result.__filtered__ = this.__filtered__;
  20927. result.__iteratees__ = copyArray(this.__iteratees__);
  20928. result.__takeCount__ = this.__takeCount__;
  20929. result.__views__ = copyArray(this.__views__);
  20930. return result;
  20931. }
  20932. /**
  20933. * Reverses the direction of lazy iteration.
  20934. *
  20935. * @private
  20936. * @name reverse
  20937. * @memberOf LazyWrapper
  20938. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20939. */
  20940. function lazyReverse() {
  20941. if (this.__filtered__) {
  20942. var result = new LazyWrapper(this);
  20943. result.__dir__ = -1;
  20944. result.__filtered__ = true;
  20945. } else {
  20946. result = this.clone();
  20947. result.__dir__ *= -1;
  20948. }
  20949. return result;
  20950. }
  20951. /**
  20952. * Extracts the unwrapped value from its lazy wrapper.
  20953. *
  20954. * @private
  20955. * @name value
  20956. * @memberOf LazyWrapper
  20957. * @returns {*} Returns the unwrapped value.
  20958. */
  20959. function lazyValue() {
  20960. var array = this.__wrapped__.value(),
  20961. dir = this.__dir__,
  20962. isArr = isArray(array),
  20963. isRight = dir < 0,
  20964. arrLength = isArr ? array.length : 0,
  20965. view = getView(0, arrLength, this.__views__),
  20966. start = view.start,
  20967. end = view.end,
  20968. length = end - start,
  20969. index = isRight ? end : (start - 1),
  20970. iteratees = this.__iteratees__,
  20971. iterLength = iteratees.length,
  20972. resIndex = 0,
  20973. takeCount = nativeMin(length, this.__takeCount__);
  20974. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20975. return baseWrapperValue(array, this.__actions__);
  20976. }
  20977. var result = [];
  20978. outer:
  20979. while (length-- && resIndex < takeCount) {
  20980. index += dir;
  20981. var iterIndex = -1,
  20982. value = array[index];
  20983. while (++iterIndex < iterLength) {
  20984. var data = iteratees[iterIndex],
  20985. iteratee = data.iteratee,
  20986. type = data.type,
  20987. computed = iteratee(value);
  20988. if (type == LAZY_MAP_FLAG) {
  20989. value = computed;
  20990. } else if (!computed) {
  20991. if (type == LAZY_FILTER_FLAG) {
  20992. continue outer;
  20993. } else {
  20994. break outer;
  20995. }
  20996. }
  20997. }
  20998. result[resIndex++] = value;
  20999. }
  21000. return result;
  21001. }
  21002. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  21003. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  21004. LazyWrapper.prototype.constructor = LazyWrapper;
  21005. /*------------------------------------------------------------------------*/
  21006. /**
  21007. * Creates a hash object.
  21008. *
  21009. * @private
  21010. * @constructor
  21011. * @param {Array} [entries] The key-value pairs to cache.
  21012. */
  21013. function Hash(entries) {
  21014. var index = -1,
  21015. length = entries == null ? 0 : entries.length;
  21016. this.clear();
  21017. while (++index < length) {
  21018. var entry = entries[index];
  21019. this.set(entry[0], entry[1]);
  21020. }
  21021. }
  21022. /**
  21023. * Removes all key-value entries from the hash.
  21024. *
  21025. * @private
  21026. * @name clear
  21027. * @memberOf Hash
  21028. */
  21029. function hashClear() {
  21030. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  21031. this.size = 0;
  21032. }
  21033. /**
  21034. * Removes `key` and its value from the hash.
  21035. *
  21036. * @private
  21037. * @name delete
  21038. * @memberOf Hash
  21039. * @param {Object} hash The hash to modify.
  21040. * @param {string} key The key of the value to remove.
  21041. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21042. */
  21043. function hashDelete(key) {
  21044. var result = this.has(key) && delete this.__data__[key];
  21045. this.size -= result ? 1 : 0;
  21046. return result;
  21047. }
  21048. /**
  21049. * Gets the hash value for `key`.
  21050. *
  21051. * @private
  21052. * @name get
  21053. * @memberOf Hash
  21054. * @param {string} key The key of the value to get.
  21055. * @returns {*} Returns the entry value.
  21056. */
  21057. function hashGet(key) {
  21058. var data = this.__data__;
  21059. if (nativeCreate) {
  21060. var result = data[key];
  21061. return result === HASH_UNDEFINED ? undefined : result;
  21062. }
  21063. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  21064. }
  21065. /**
  21066. * Checks if a hash value for `key` exists.
  21067. *
  21068. * @private
  21069. * @name has
  21070. * @memberOf Hash
  21071. * @param {string} key The key of the entry to check.
  21072. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21073. */
  21074. function hashHas(key) {
  21075. var data = this.__data__;
  21076. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  21077. }
  21078. /**
  21079. * Sets the hash `key` to `value`.
  21080. *
  21081. * @private
  21082. * @name set
  21083. * @memberOf Hash
  21084. * @param {string} key The key of the value to set.
  21085. * @param {*} value The value to set.
  21086. * @returns {Object} Returns the hash instance.
  21087. */
  21088. function hashSet(key, value) {
  21089. var data = this.__data__;
  21090. this.size += this.has(key) ? 0 : 1;
  21091. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  21092. return this;
  21093. }
  21094. // Add methods to `Hash`.
  21095. Hash.prototype.clear = hashClear;
  21096. Hash.prototype['delete'] = hashDelete;
  21097. Hash.prototype.get = hashGet;
  21098. Hash.prototype.has = hashHas;
  21099. Hash.prototype.set = hashSet;
  21100. /*------------------------------------------------------------------------*/
  21101. /**
  21102. * Creates an list cache object.
  21103. *
  21104. * @private
  21105. * @constructor
  21106. * @param {Array} [entries] The key-value pairs to cache.
  21107. */
  21108. function ListCache(entries) {
  21109. var index = -1,
  21110. length = entries == null ? 0 : entries.length;
  21111. this.clear();
  21112. while (++index < length) {
  21113. var entry = entries[index];
  21114. this.set(entry[0], entry[1]);
  21115. }
  21116. }
  21117. /**
  21118. * Removes all key-value entries from the list cache.
  21119. *
  21120. * @private
  21121. * @name clear
  21122. * @memberOf ListCache
  21123. */
  21124. function listCacheClear() {
  21125. this.__data__ = [];
  21126. this.size = 0;
  21127. }
  21128. /**
  21129. * Removes `key` and its value from the list cache.
  21130. *
  21131. * @private
  21132. * @name delete
  21133. * @memberOf ListCache
  21134. * @param {string} key The key of the value to remove.
  21135. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21136. */
  21137. function listCacheDelete(key) {
  21138. var data = this.__data__,
  21139. index = assocIndexOf(data, key);
  21140. if (index < 0) {
  21141. return false;
  21142. }
  21143. var lastIndex = data.length - 1;
  21144. if (index == lastIndex) {
  21145. data.pop();
  21146. } else {
  21147. splice.call(data, index, 1);
  21148. }
  21149. --this.size;
  21150. return true;
  21151. }
  21152. /**
  21153. * Gets the list cache value for `key`.
  21154. *
  21155. * @private
  21156. * @name get
  21157. * @memberOf ListCache
  21158. * @param {string} key The key of the value to get.
  21159. * @returns {*} Returns the entry value.
  21160. */
  21161. function listCacheGet(key) {
  21162. var data = this.__data__,
  21163. index = assocIndexOf(data, key);
  21164. return index < 0 ? undefined : data[index][1];
  21165. }
  21166. /**
  21167. * Checks if a list cache value for `key` exists.
  21168. *
  21169. * @private
  21170. * @name has
  21171. * @memberOf ListCache
  21172. * @param {string} key The key of the entry to check.
  21173. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21174. */
  21175. function listCacheHas(key) {
  21176. return assocIndexOf(this.__data__, key) > -1;
  21177. }
  21178. /**
  21179. * Sets the list cache `key` to `value`.
  21180. *
  21181. * @private
  21182. * @name set
  21183. * @memberOf ListCache
  21184. * @param {string} key The key of the value to set.
  21185. * @param {*} value The value to set.
  21186. * @returns {Object} Returns the list cache instance.
  21187. */
  21188. function listCacheSet(key, value) {
  21189. var data = this.__data__,
  21190. index = assocIndexOf(data, key);
  21191. if (index < 0) {
  21192. ++this.size;
  21193. data.push([key, value]);
  21194. } else {
  21195. data[index][1] = value;
  21196. }
  21197. return this;
  21198. }
  21199. // Add methods to `ListCache`.
  21200. ListCache.prototype.clear = listCacheClear;
  21201. ListCache.prototype['delete'] = listCacheDelete;
  21202. ListCache.prototype.get = listCacheGet;
  21203. ListCache.prototype.has = listCacheHas;
  21204. ListCache.prototype.set = listCacheSet;
  21205. /*------------------------------------------------------------------------*/
  21206. /**
  21207. * Creates a map cache object to store key-value pairs.
  21208. *
  21209. * @private
  21210. * @constructor
  21211. * @param {Array} [entries] The key-value pairs to cache.
  21212. */
  21213. function MapCache(entries) {
  21214. var index = -1,
  21215. length = entries == null ? 0 : entries.length;
  21216. this.clear();
  21217. while (++index < length) {
  21218. var entry = entries[index];
  21219. this.set(entry[0], entry[1]);
  21220. }
  21221. }
  21222. /**
  21223. * Removes all key-value entries from the map.
  21224. *
  21225. * @private
  21226. * @name clear
  21227. * @memberOf MapCache
  21228. */
  21229. function mapCacheClear() {
  21230. this.size = 0;
  21231. this.__data__ = {
  21232. 'hash': new Hash,
  21233. 'map': new (Map || ListCache),
  21234. 'string': new Hash
  21235. };
  21236. }
  21237. /**
  21238. * Removes `key` and its value from the map.
  21239. *
  21240. * @private
  21241. * @name delete
  21242. * @memberOf MapCache
  21243. * @param {string} key The key of the value to remove.
  21244. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21245. */
  21246. function mapCacheDelete(key) {
  21247. var result = getMapData(this, key)['delete'](key);
  21248. this.size -= result ? 1 : 0;
  21249. return result;
  21250. }
  21251. /**
  21252. * Gets the map value for `key`.
  21253. *
  21254. * @private
  21255. * @name get
  21256. * @memberOf MapCache
  21257. * @param {string} key The key of the value to get.
  21258. * @returns {*} Returns the entry value.
  21259. */
  21260. function mapCacheGet(key) {
  21261. return getMapData(this, key).get(key);
  21262. }
  21263. /**
  21264. * Checks if a map value for `key` exists.
  21265. *
  21266. * @private
  21267. * @name has
  21268. * @memberOf MapCache
  21269. * @param {string} key The key of the entry to check.
  21270. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21271. */
  21272. function mapCacheHas(key) {
  21273. return getMapData(this, key).has(key);
  21274. }
  21275. /**
  21276. * Sets the map `key` to `value`.
  21277. *
  21278. * @private
  21279. * @name set
  21280. * @memberOf MapCache
  21281. * @param {string} key The key of the value to set.
  21282. * @param {*} value The value to set.
  21283. * @returns {Object} Returns the map cache instance.
  21284. */
  21285. function mapCacheSet(key, value) {
  21286. var data = getMapData(this, key),
  21287. size = data.size;
  21288. data.set(key, value);
  21289. this.size += data.size == size ? 0 : 1;
  21290. return this;
  21291. }
  21292. // Add methods to `MapCache`.
  21293. MapCache.prototype.clear = mapCacheClear;
  21294. MapCache.prototype['delete'] = mapCacheDelete;
  21295. MapCache.prototype.get = mapCacheGet;
  21296. MapCache.prototype.has = mapCacheHas;
  21297. MapCache.prototype.set = mapCacheSet;
  21298. /*------------------------------------------------------------------------*/
  21299. /**
  21300. *
  21301. * Creates an array cache object to store unique values.
  21302. *
  21303. * @private
  21304. * @constructor
  21305. * @param {Array} [values] The values to cache.
  21306. */
  21307. function SetCache(values) {
  21308. var index = -1,
  21309. length = values == null ? 0 : values.length;
  21310. this.__data__ = new MapCache;
  21311. while (++index < length) {
  21312. this.add(values[index]);
  21313. }
  21314. }
  21315. /**
  21316. * Adds `value` to the array cache.
  21317. *
  21318. * @private
  21319. * @name add
  21320. * @memberOf SetCache
  21321. * @alias push
  21322. * @param {*} value The value to cache.
  21323. * @returns {Object} Returns the cache instance.
  21324. */
  21325. function setCacheAdd(value) {
  21326. this.__data__.set(value, HASH_UNDEFINED);
  21327. return this;
  21328. }
  21329. /**
  21330. * Checks if `value` is in the array cache.
  21331. *
  21332. * @private
  21333. * @name has
  21334. * @memberOf SetCache
  21335. * @param {*} value The value to search for.
  21336. * @returns {number} Returns `true` if `value` is found, else `false`.
  21337. */
  21338. function setCacheHas(value) {
  21339. return this.__data__.has(value);
  21340. }
  21341. // Add methods to `SetCache`.
  21342. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  21343. SetCache.prototype.has = setCacheHas;
  21344. /*------------------------------------------------------------------------*/
  21345. /**
  21346. * Creates a stack cache object to store key-value pairs.
  21347. *
  21348. * @private
  21349. * @constructor
  21350. * @param {Array} [entries] The key-value pairs to cache.
  21351. */
  21352. function Stack(entries) {
  21353. var data = this.__data__ = new ListCache(entries);
  21354. this.size = data.size;
  21355. }
  21356. /**
  21357. * Removes all key-value entries from the stack.
  21358. *
  21359. * @private
  21360. * @name clear
  21361. * @memberOf Stack
  21362. */
  21363. function stackClear() {
  21364. this.__data__ = new ListCache;
  21365. this.size = 0;
  21366. }
  21367. /**
  21368. * Removes `key` and its value from the stack.
  21369. *
  21370. * @private
  21371. * @name delete
  21372. * @memberOf Stack
  21373. * @param {string} key The key of the value to remove.
  21374. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21375. */
  21376. function stackDelete(key) {
  21377. var data = this.__data__,
  21378. result = data['delete'](key);
  21379. this.size = data.size;
  21380. return result;
  21381. }
  21382. /**
  21383. * Gets the stack value for `key`.
  21384. *
  21385. * @private
  21386. * @name get
  21387. * @memberOf Stack
  21388. * @param {string} key The key of the value to get.
  21389. * @returns {*} Returns the entry value.
  21390. */
  21391. function stackGet(key) {
  21392. return this.__data__.get(key);
  21393. }
  21394. /**
  21395. * Checks if a stack value for `key` exists.
  21396. *
  21397. * @private
  21398. * @name has
  21399. * @memberOf Stack
  21400. * @param {string} key The key of the entry to check.
  21401. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21402. */
  21403. function stackHas(key) {
  21404. return this.__data__.has(key);
  21405. }
  21406. /**
  21407. * Sets the stack `key` to `value`.
  21408. *
  21409. * @private
  21410. * @name set
  21411. * @memberOf Stack
  21412. * @param {string} key The key of the value to set.
  21413. * @param {*} value The value to set.
  21414. * @returns {Object} Returns the stack cache instance.
  21415. */
  21416. function stackSet(key, value) {
  21417. var data = this.__data__;
  21418. if (data instanceof ListCache) {
  21419. var pairs = data.__data__;
  21420. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  21421. pairs.push([key, value]);
  21422. this.size = ++data.size;
  21423. return this;
  21424. }
  21425. data = this.__data__ = new MapCache(pairs);
  21426. }
  21427. data.set(key, value);
  21428. this.size = data.size;
  21429. return this;
  21430. }
  21431. // Add methods to `Stack`.
  21432. Stack.prototype.clear = stackClear;
  21433. Stack.prototype['delete'] = stackDelete;
  21434. Stack.prototype.get = stackGet;
  21435. Stack.prototype.has = stackHas;
  21436. Stack.prototype.set = stackSet;
  21437. /*------------------------------------------------------------------------*/
  21438. /**
  21439. * Creates an array of the enumerable property names of the array-like `value`.
  21440. *
  21441. * @private
  21442. * @param {*} value The value to query.
  21443. * @param {boolean} inherited Specify returning inherited property names.
  21444. * @returns {Array} Returns the array of property names.
  21445. */
  21446. function arrayLikeKeys(value, inherited) {
  21447. var isArr = isArray(value),
  21448. isArg = !isArr && isArguments(value),
  21449. isBuff = !isArr && !isArg && isBuffer(value),
  21450. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  21451. skipIndexes = isArr || isArg || isBuff || isType,
  21452. result = skipIndexes ? baseTimes(value.length, String) : [],
  21453. length = result.length;
  21454. for (var key in value) {
  21455. if ((inherited || hasOwnProperty.call(value, key)) &&
  21456. !(skipIndexes && (
  21457. // Safari 9 has enumerable `arguments.length` in strict mode.
  21458. key == 'length' ||
  21459. // Node.js 0.10 has enumerable non-index properties on buffers.
  21460. (isBuff && (key == 'offset' || key == 'parent')) ||
  21461. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  21462. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  21463. // Skip index properties.
  21464. isIndex(key, length)
  21465. ))) {
  21466. result.push(key);
  21467. }
  21468. }
  21469. return result;
  21470. }
  21471. /**
  21472. * A specialized version of `_.sample` for arrays.
  21473. *
  21474. * @private
  21475. * @param {Array} array The array to sample.
  21476. * @returns {*} Returns the random element.
  21477. */
  21478. function arraySample(array) {
  21479. var length = array.length;
  21480. return length ? array[baseRandom(0, length - 1)] : undefined;
  21481. }
  21482. /**
  21483. * A specialized version of `_.sampleSize` for arrays.
  21484. *
  21485. * @private
  21486. * @param {Array} array The array to sample.
  21487. * @param {number} n The number of elements to sample.
  21488. * @returns {Array} Returns the random elements.
  21489. */
  21490. function arraySampleSize(array, n) {
  21491. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  21492. }
  21493. /**
  21494. * A specialized version of `_.shuffle` for arrays.
  21495. *
  21496. * @private
  21497. * @param {Array} array The array to shuffle.
  21498. * @returns {Array} Returns the new shuffled array.
  21499. */
  21500. function arrayShuffle(array) {
  21501. return shuffleSelf(copyArray(array));
  21502. }
  21503. /**
  21504. * This function is like `assignValue` except that it doesn't assign
  21505. * `undefined` values.
  21506. *
  21507. * @private
  21508. * @param {Object} object The object to modify.
  21509. * @param {string} key The key of the property to assign.
  21510. * @param {*} value The value to assign.
  21511. */
  21512. function assignMergeValue(object, key, value) {
  21513. if ((value !== undefined && !eq(object[key], value)) ||
  21514. (value === undefined && !(key in object))) {
  21515. baseAssignValue(object, key, value);
  21516. }
  21517. }
  21518. /**
  21519. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  21520. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21521. * for equality comparisons.
  21522. *
  21523. * @private
  21524. * @param {Object} object The object to modify.
  21525. * @param {string} key The key of the property to assign.
  21526. * @param {*} value The value to assign.
  21527. */
  21528. function assignValue(object, key, value) {
  21529. var objValue = object[key];
  21530. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  21531. (value === undefined && !(key in object))) {
  21532. baseAssignValue(object, key, value);
  21533. }
  21534. }
  21535. /**
  21536. * Gets the index at which the `key` is found in `array` of key-value pairs.
  21537. *
  21538. * @private
  21539. * @param {Array} array The array to inspect.
  21540. * @param {*} key The key to search for.
  21541. * @returns {number} Returns the index of the matched value, else `-1`.
  21542. */
  21543. function assocIndexOf(array, key) {
  21544. var length = array.length;
  21545. while (length--) {
  21546. if (eq(array[length][0], key)) {
  21547. return length;
  21548. }
  21549. }
  21550. return -1;
  21551. }
  21552. /**
  21553. * Aggregates elements of `collection` on `accumulator` with keys transformed
  21554. * by `iteratee` and values set by `setter`.
  21555. *
  21556. * @private
  21557. * @param {Array|Object} collection The collection to iterate over.
  21558. * @param {Function} setter The function to set `accumulator` values.
  21559. * @param {Function} iteratee The iteratee to transform keys.
  21560. * @param {Object} accumulator The initial aggregated object.
  21561. * @returns {Function} Returns `accumulator`.
  21562. */
  21563. function baseAggregator(collection, setter, iteratee, accumulator) {
  21564. baseEach(collection, function(value, key, collection) {
  21565. setter(accumulator, value, iteratee(value), collection);
  21566. });
  21567. return accumulator;
  21568. }
  21569. /**
  21570. * The base implementation of `_.assign` without support for multiple sources
  21571. * or `customizer` functions.
  21572. *
  21573. * @private
  21574. * @param {Object} object The destination object.
  21575. * @param {Object} source The source object.
  21576. * @returns {Object} Returns `object`.
  21577. */
  21578. function baseAssign(object, source) {
  21579. return object && copyObject(source, keys(source), object);
  21580. }
  21581. /**
  21582. * The base implementation of `_.assignIn` without support for multiple sources
  21583. * or `customizer` functions.
  21584. *
  21585. * @private
  21586. * @param {Object} object The destination object.
  21587. * @param {Object} source The source object.
  21588. * @returns {Object} Returns `object`.
  21589. */
  21590. function baseAssignIn(object, source) {
  21591. return object && copyObject(source, keysIn(source), object);
  21592. }
  21593. /**
  21594. * The base implementation of `assignValue` and `assignMergeValue` without
  21595. * value checks.
  21596. *
  21597. * @private
  21598. * @param {Object} object The object to modify.
  21599. * @param {string} key The key of the property to assign.
  21600. * @param {*} value The value to assign.
  21601. */
  21602. function baseAssignValue(object, key, value) {
  21603. if (key == '__proto__' && defineProperty) {
  21604. defineProperty(object, key, {
  21605. 'configurable': true,
  21606. 'enumerable': true,
  21607. 'value': value,
  21608. 'writable': true
  21609. });
  21610. } else {
  21611. object[key] = value;
  21612. }
  21613. }
  21614. /**
  21615. * The base implementation of `_.at` without support for individual paths.
  21616. *
  21617. * @private
  21618. * @param {Object} object The object to iterate over.
  21619. * @param {string[]} paths The property paths to pick.
  21620. * @returns {Array} Returns the picked elements.
  21621. */
  21622. function baseAt(object, paths) {
  21623. var index = -1,
  21624. length = paths.length,
  21625. result = Array(length),
  21626. skip = object == null;
  21627. while (++index < length) {
  21628. result[index] = skip ? undefined : get(object, paths[index]);
  21629. }
  21630. return result;
  21631. }
  21632. /**
  21633. * The base implementation of `_.clamp` which doesn't coerce arguments.
  21634. *
  21635. * @private
  21636. * @param {number} number The number to clamp.
  21637. * @param {number} [lower] The lower bound.
  21638. * @param {number} upper The upper bound.
  21639. * @returns {number} Returns the clamped number.
  21640. */
  21641. function baseClamp(number, lower, upper) {
  21642. if (number === number) {
  21643. if (upper !== undefined) {
  21644. number = number <= upper ? number : upper;
  21645. }
  21646. if (lower !== undefined) {
  21647. number = number >= lower ? number : lower;
  21648. }
  21649. }
  21650. return number;
  21651. }
  21652. /**
  21653. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  21654. * traversed objects.
  21655. *
  21656. * @private
  21657. * @param {*} value The value to clone.
  21658. * @param {boolean} bitmask The bitmask flags.
  21659. * 1 - Deep clone
  21660. * 2 - Flatten inherited properties
  21661. * 4 - Clone symbols
  21662. * @param {Function} [customizer] The function to customize cloning.
  21663. * @param {string} [key] The key of `value`.
  21664. * @param {Object} [object] The parent object of `value`.
  21665. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  21666. * @returns {*} Returns the cloned value.
  21667. */
  21668. function baseClone(value, bitmask, customizer, key, object, stack) {
  21669. var result,
  21670. isDeep = bitmask & CLONE_DEEP_FLAG,
  21671. isFlat = bitmask & CLONE_FLAT_FLAG,
  21672. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  21673. if (customizer) {
  21674. result = object ? customizer(value, key, object, stack) : customizer(value);
  21675. }
  21676. if (result !== undefined) {
  21677. return result;
  21678. }
  21679. if (!isObject(value)) {
  21680. return value;
  21681. }
  21682. var isArr = isArray(value);
  21683. if (isArr) {
  21684. result = initCloneArray(value);
  21685. if (!isDeep) {
  21686. return copyArray(value, result);
  21687. }
  21688. } else {
  21689. var tag = getTag(value),
  21690. isFunc = tag == funcTag || tag == genTag;
  21691. if (isBuffer(value)) {
  21692. return cloneBuffer(value, isDeep);
  21693. }
  21694. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  21695. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  21696. if (!isDeep) {
  21697. return isFlat
  21698. ? copySymbolsIn(value, baseAssignIn(result, value))
  21699. : copySymbols(value, baseAssign(result, value));
  21700. }
  21701. } else {
  21702. if (!cloneableTags[tag]) {
  21703. return object ? value : {};
  21704. }
  21705. result = initCloneByTag(value, tag, isDeep);
  21706. }
  21707. }
  21708. // Check for circular references and return its corresponding clone.
  21709. stack || (stack = new Stack);
  21710. var stacked = stack.get(value);
  21711. if (stacked) {
  21712. return stacked;
  21713. }
  21714. stack.set(value, result);
  21715. if (isSet(value)) {
  21716. value.forEach(function(subValue) {
  21717. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  21718. });
  21719. } else if (isMap(value)) {
  21720. value.forEach(function(subValue, key) {
  21721. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21722. });
  21723. }
  21724. var keysFunc = isFull
  21725. ? (isFlat ? getAllKeysIn : getAllKeys)
  21726. : (isFlat ? keysIn : keys);
  21727. var props = isArr ? undefined : keysFunc(value);
  21728. arrayEach(props || value, function(subValue, key) {
  21729. if (props) {
  21730. key = subValue;
  21731. subValue = value[key];
  21732. }
  21733. // Recursively populate clone (susceptible to call stack limits).
  21734. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21735. });
  21736. return result;
  21737. }
  21738. /**
  21739. * The base implementation of `_.conforms` which doesn't clone `source`.
  21740. *
  21741. * @private
  21742. * @param {Object} source The object of property predicates to conform to.
  21743. * @returns {Function} Returns the new spec function.
  21744. */
  21745. function baseConforms(source) {
  21746. var props = keys(source);
  21747. return function(object) {
  21748. return baseConformsTo(object, source, props);
  21749. };
  21750. }
  21751. /**
  21752. * The base implementation of `_.conformsTo` which accepts `props` to check.
  21753. *
  21754. * @private
  21755. * @param {Object} object The object to inspect.
  21756. * @param {Object} source The object of property predicates to conform to.
  21757. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  21758. */
  21759. function baseConformsTo(object, source, props) {
  21760. var length = props.length;
  21761. if (object == null) {
  21762. return !length;
  21763. }
  21764. object = Object(object);
  21765. while (length--) {
  21766. var key = props[length],
  21767. predicate = source[key],
  21768. value = object[key];
  21769. if ((value === undefined && !(key in object)) || !predicate(value)) {
  21770. return false;
  21771. }
  21772. }
  21773. return true;
  21774. }
  21775. /**
  21776. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  21777. * to provide to `func`.
  21778. *
  21779. * @private
  21780. * @param {Function} func The function to delay.
  21781. * @param {number} wait The number of milliseconds to delay invocation.
  21782. * @param {Array} args The arguments to provide to `func`.
  21783. * @returns {number|Object} Returns the timer id or timeout object.
  21784. */
  21785. function baseDelay(func, wait, args) {
  21786. if (typeof func != 'function') {
  21787. throw new TypeError(FUNC_ERROR_TEXT);
  21788. }
  21789. return setTimeout(function() { func.apply(undefined, args); }, wait);
  21790. }
  21791. /**
  21792. * The base implementation of methods like `_.difference` without support
  21793. * for excluding multiple arrays or iteratee shorthands.
  21794. *
  21795. * @private
  21796. * @param {Array} array The array to inspect.
  21797. * @param {Array} values The values to exclude.
  21798. * @param {Function} [iteratee] The iteratee invoked per element.
  21799. * @param {Function} [comparator] The comparator invoked per element.
  21800. * @returns {Array} Returns the new array of filtered values.
  21801. */
  21802. function baseDifference(array, values, iteratee, comparator) {
  21803. var index = -1,
  21804. includes = arrayIncludes,
  21805. isCommon = true,
  21806. length = array.length,
  21807. result = [],
  21808. valuesLength = values.length;
  21809. if (!length) {
  21810. return result;
  21811. }
  21812. if (iteratee) {
  21813. values = arrayMap(values, baseUnary(iteratee));
  21814. }
  21815. if (comparator) {
  21816. includes = arrayIncludesWith;
  21817. isCommon = false;
  21818. }
  21819. else if (values.length >= LARGE_ARRAY_SIZE) {
  21820. includes = cacheHas;
  21821. isCommon = false;
  21822. values = new SetCache(values);
  21823. }
  21824. outer:
  21825. while (++index < length) {
  21826. var value = array[index],
  21827. computed = iteratee == null ? value : iteratee(value);
  21828. value = (comparator || value !== 0) ? value : 0;
  21829. if (isCommon && computed === computed) {
  21830. var valuesIndex = valuesLength;
  21831. while (valuesIndex--) {
  21832. if (values[valuesIndex] === computed) {
  21833. continue outer;
  21834. }
  21835. }
  21836. result.push(value);
  21837. }
  21838. else if (!includes(values, computed, comparator)) {
  21839. result.push(value);
  21840. }
  21841. }
  21842. return result;
  21843. }
  21844. /**
  21845. * The base implementation of `_.forEach` 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 baseEach = createBaseEach(baseForOwn);
  21853. /**
  21854. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  21855. *
  21856. * @private
  21857. * @param {Array|Object} collection The collection to iterate over.
  21858. * @param {Function} iteratee The function invoked per iteration.
  21859. * @returns {Array|Object} Returns `collection`.
  21860. */
  21861. var baseEachRight = createBaseEach(baseForOwnRight, true);
  21862. /**
  21863. * The base implementation of `_.every` without support for iteratee shorthands.
  21864. *
  21865. * @private
  21866. * @param {Array|Object} collection The collection to iterate over.
  21867. * @param {Function} predicate The function invoked per iteration.
  21868. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  21869. * else `false`
  21870. */
  21871. function baseEvery(collection, predicate) {
  21872. var result = true;
  21873. baseEach(collection, function(value, index, collection) {
  21874. result = !!predicate(value, index, collection);
  21875. return result;
  21876. });
  21877. return result;
  21878. }
  21879. /**
  21880. * The base implementation of methods like `_.max` and `_.min` which accepts a
  21881. * `comparator` to determine the extremum value.
  21882. *
  21883. * @private
  21884. * @param {Array} array The array to iterate over.
  21885. * @param {Function} iteratee The iteratee invoked per iteration.
  21886. * @param {Function} comparator The comparator used to compare values.
  21887. * @returns {*} Returns the extremum value.
  21888. */
  21889. function baseExtremum(array, iteratee, comparator) {
  21890. var index = -1,
  21891. length = array.length;
  21892. while (++index < length) {
  21893. var value = array[index],
  21894. current = iteratee(value);
  21895. if (current != null && (computed === undefined
  21896. ? (current === current && !isSymbol(current))
  21897. : comparator(current, computed)
  21898. )) {
  21899. var computed = current,
  21900. result = value;
  21901. }
  21902. }
  21903. return result;
  21904. }
  21905. /**
  21906. * The base implementation of `_.fill` without an iteratee call guard.
  21907. *
  21908. * @private
  21909. * @param {Array} array The array to fill.
  21910. * @param {*} value The value to fill `array` with.
  21911. * @param {number} [start=0] The start position.
  21912. * @param {number} [end=array.length] The end position.
  21913. * @returns {Array} Returns `array`.
  21914. */
  21915. function baseFill(array, value, start, end) {
  21916. var length = array.length;
  21917. start = toInteger(start);
  21918. if (start < 0) {
  21919. start = -start > length ? 0 : (length + start);
  21920. }
  21921. end = (end === undefined || end > length) ? length : toInteger(end);
  21922. if (end < 0) {
  21923. end += length;
  21924. }
  21925. end = start > end ? 0 : toLength(end);
  21926. while (start < end) {
  21927. array[start++] = value;
  21928. }
  21929. return array;
  21930. }
  21931. /**
  21932. * The base implementation of `_.filter` without support for iteratee shorthands.
  21933. *
  21934. * @private
  21935. * @param {Array|Object} collection The collection to iterate over.
  21936. * @param {Function} predicate The function invoked per iteration.
  21937. * @returns {Array} Returns the new filtered array.
  21938. */
  21939. function baseFilter(collection, predicate) {
  21940. var result = [];
  21941. baseEach(collection, function(value, index, collection) {
  21942. if (predicate(value, index, collection)) {
  21943. result.push(value);
  21944. }
  21945. });
  21946. return result;
  21947. }
  21948. /**
  21949. * The base implementation of `_.flatten` with support for restricting flattening.
  21950. *
  21951. * @private
  21952. * @param {Array} array The array to flatten.
  21953. * @param {number} depth The maximum recursion depth.
  21954. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21955. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21956. * @param {Array} [result=[]] The initial result value.
  21957. * @returns {Array} Returns the new flattened array.
  21958. */
  21959. function baseFlatten(array, depth, predicate, isStrict, result) {
  21960. var index = -1,
  21961. length = array.length;
  21962. predicate || (predicate = isFlattenable);
  21963. result || (result = []);
  21964. while (++index < length) {
  21965. var value = array[index];
  21966. if (depth > 0 && predicate(value)) {
  21967. if (depth > 1) {
  21968. // Recursively flatten arrays (susceptible to call stack limits).
  21969. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21970. } else {
  21971. arrayPush(result, value);
  21972. }
  21973. } else if (!isStrict) {
  21974. result[result.length] = value;
  21975. }
  21976. }
  21977. return result;
  21978. }
  21979. /**
  21980. * The base implementation of `baseForOwn` which iterates over `object`
  21981. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21982. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21983. *
  21984. * @private
  21985. * @param {Object} object The object to iterate over.
  21986. * @param {Function} iteratee The function invoked per iteration.
  21987. * @param {Function} keysFunc The function to get the keys of `object`.
  21988. * @returns {Object} Returns `object`.
  21989. */
  21990. var baseFor = createBaseFor();
  21991. /**
  21992. * This function is like `baseFor` except that it iterates over properties
  21993. * in the opposite order.
  21994. *
  21995. * @private
  21996. * @param {Object} object The object to iterate over.
  21997. * @param {Function} iteratee The function invoked per iteration.
  21998. * @param {Function} keysFunc The function to get the keys of `object`.
  21999. * @returns {Object} Returns `object`.
  22000. */
  22001. var baseForRight = createBaseFor(true);
  22002. /**
  22003. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  22004. *
  22005. * @private
  22006. * @param {Object} object The object to iterate over.
  22007. * @param {Function} iteratee The function invoked per iteration.
  22008. * @returns {Object} Returns `object`.
  22009. */
  22010. function baseForOwn(object, iteratee) {
  22011. return object && baseFor(object, iteratee, keys);
  22012. }
  22013. /**
  22014. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  22015. *
  22016. * @private
  22017. * @param {Object} object The object to iterate over.
  22018. * @param {Function} iteratee The function invoked per iteration.
  22019. * @returns {Object} Returns `object`.
  22020. */
  22021. function baseForOwnRight(object, iteratee) {
  22022. return object && baseForRight(object, iteratee, keys);
  22023. }
  22024. /**
  22025. * The base implementation of `_.functions` which creates an array of
  22026. * `object` function property names filtered from `props`.
  22027. *
  22028. * @private
  22029. * @param {Object} object The object to inspect.
  22030. * @param {Array} props The property names to filter.
  22031. * @returns {Array} Returns the function names.
  22032. */
  22033. function baseFunctions(object, props) {
  22034. return arrayFilter(props, function(key) {
  22035. return isFunction(object[key]);
  22036. });
  22037. }
  22038. /**
  22039. * The base implementation of `_.get` without support for default values.
  22040. *
  22041. * @private
  22042. * @param {Object} object The object to query.
  22043. * @param {Array|string} path The path of the property to get.
  22044. * @returns {*} Returns the resolved value.
  22045. */
  22046. function baseGet(object, path) {
  22047. path = castPath(path, object);
  22048. var index = 0,
  22049. length = path.length;
  22050. while (object != null && index < length) {
  22051. object = object[toKey(path[index++])];
  22052. }
  22053. return (index && index == length) ? object : undefined;
  22054. }
  22055. /**
  22056. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  22057. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  22058. * symbols of `object`.
  22059. *
  22060. * @private
  22061. * @param {Object} object The object to query.
  22062. * @param {Function} keysFunc The function to get the keys of `object`.
  22063. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  22064. * @returns {Array} Returns the array of property names and symbols.
  22065. */
  22066. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  22067. var result = keysFunc(object);
  22068. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  22069. }
  22070. /**
  22071. * The base implementation of `getTag` without fallbacks for buggy environments.
  22072. *
  22073. * @private
  22074. * @param {*} value The value to query.
  22075. * @returns {string} Returns the `toStringTag`.
  22076. */
  22077. function baseGetTag(value) {
  22078. if (value == null) {
  22079. return value === undefined ? undefinedTag : nullTag;
  22080. }
  22081. return (symToStringTag && symToStringTag in Object(value))
  22082. ? getRawTag(value)
  22083. : objectToString(value);
  22084. }
  22085. /**
  22086. * The base implementation of `_.gt` which doesn't coerce arguments.
  22087. *
  22088. * @private
  22089. * @param {*} value The value to compare.
  22090. * @param {*} other The other value to compare.
  22091. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  22092. * else `false`.
  22093. */
  22094. function baseGt(value, other) {
  22095. return value > other;
  22096. }
  22097. /**
  22098. * The base implementation of `_.has` without support for deep paths.
  22099. *
  22100. * @private
  22101. * @param {Object} [object] The object to query.
  22102. * @param {Array|string} key The key to check.
  22103. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  22104. */
  22105. function baseHas(object, key) {
  22106. return object != null && hasOwnProperty.call(object, key);
  22107. }
  22108. /**
  22109. * The base implementation of `_.hasIn` without support for deep paths.
  22110. *
  22111. * @private
  22112. * @param {Object} [object] The object to query.
  22113. * @param {Array|string} key The key to check.
  22114. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  22115. */
  22116. function baseHasIn(object, key) {
  22117. return object != null && key in Object(object);
  22118. }
  22119. /**
  22120. * The base implementation of `_.inRange` which doesn't coerce arguments.
  22121. *
  22122. * @private
  22123. * @param {number} number The number to check.
  22124. * @param {number} start The start of the range.
  22125. * @param {number} end The end of the range.
  22126. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  22127. */
  22128. function baseInRange(number, start, end) {
  22129. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  22130. }
  22131. /**
  22132. * The base implementation of methods like `_.intersection`, without support
  22133. * for iteratee shorthands, that accepts an array of arrays to inspect.
  22134. *
  22135. * @private
  22136. * @param {Array} arrays The arrays to inspect.
  22137. * @param {Function} [iteratee] The iteratee invoked per element.
  22138. * @param {Function} [comparator] The comparator invoked per element.
  22139. * @returns {Array} Returns the new array of shared values.
  22140. */
  22141. function baseIntersection(arrays, iteratee, comparator) {
  22142. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  22143. length = arrays[0].length,
  22144. othLength = arrays.length,
  22145. othIndex = othLength,
  22146. caches = Array(othLength),
  22147. maxLength = Infinity,
  22148. result = [];
  22149. while (othIndex--) {
  22150. var array = arrays[othIndex];
  22151. if (othIndex && iteratee) {
  22152. array = arrayMap(array, baseUnary(iteratee));
  22153. }
  22154. maxLength = nativeMin(array.length, maxLength);
  22155. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  22156. ? new SetCache(othIndex && array)
  22157. : undefined;
  22158. }
  22159. array = arrays[0];
  22160. var index = -1,
  22161. seen = caches[0];
  22162. outer:
  22163. while (++index < length && result.length < maxLength) {
  22164. var value = array[index],
  22165. computed = iteratee ? iteratee(value) : value;
  22166. value = (comparator || value !== 0) ? value : 0;
  22167. if (!(seen
  22168. ? cacheHas(seen, computed)
  22169. : includes(result, computed, comparator)
  22170. )) {
  22171. othIndex = othLength;
  22172. while (--othIndex) {
  22173. var cache = caches[othIndex];
  22174. if (!(cache
  22175. ? cacheHas(cache, computed)
  22176. : includes(arrays[othIndex], computed, comparator))
  22177. ) {
  22178. continue outer;
  22179. }
  22180. }
  22181. if (seen) {
  22182. seen.push(computed);
  22183. }
  22184. result.push(value);
  22185. }
  22186. }
  22187. return result;
  22188. }
  22189. /**
  22190. * The base implementation of `_.invert` and `_.invertBy` which inverts
  22191. * `object` with values transformed by `iteratee` and set by `setter`.
  22192. *
  22193. * @private
  22194. * @param {Object} object The object to iterate over.
  22195. * @param {Function} setter The function to set `accumulator` values.
  22196. * @param {Function} iteratee The iteratee to transform values.
  22197. * @param {Object} accumulator The initial inverted object.
  22198. * @returns {Function} Returns `accumulator`.
  22199. */
  22200. function baseInverter(object, setter, iteratee, accumulator) {
  22201. baseForOwn(object, function(value, key, object) {
  22202. setter(accumulator, iteratee(value), key, object);
  22203. });
  22204. return accumulator;
  22205. }
  22206. /**
  22207. * The base implementation of `_.invoke` without support for individual
  22208. * method arguments.
  22209. *
  22210. * @private
  22211. * @param {Object} object The object to query.
  22212. * @param {Array|string} path The path of the method to invoke.
  22213. * @param {Array} args The arguments to invoke the method with.
  22214. * @returns {*} Returns the result of the invoked method.
  22215. */
  22216. function baseInvoke(object, path, args) {
  22217. path = castPath(path, object);
  22218. object = parent(object, path);
  22219. var func = object == null ? object : object[toKey(last(path))];
  22220. return func == null ? undefined : apply(func, object, args);
  22221. }
  22222. /**
  22223. * The base implementation of `_.isArguments`.
  22224. *
  22225. * @private
  22226. * @param {*} value The value to check.
  22227. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  22228. */
  22229. function baseIsArguments(value) {
  22230. return isObjectLike(value) && baseGetTag(value) == argsTag;
  22231. }
  22232. /**
  22233. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  22234. *
  22235. * @private
  22236. * @param {*} value The value to check.
  22237. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  22238. */
  22239. function baseIsArrayBuffer(value) {
  22240. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  22241. }
  22242. /**
  22243. * The base implementation of `_.isDate` without Node.js optimizations.
  22244. *
  22245. * @private
  22246. * @param {*} value The value to check.
  22247. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  22248. */
  22249. function baseIsDate(value) {
  22250. return isObjectLike(value) && baseGetTag(value) == dateTag;
  22251. }
  22252. /**
  22253. * The base implementation of `_.isEqual` which supports partial comparisons
  22254. * and tracks traversed objects.
  22255. *
  22256. * @private
  22257. * @param {*} value The value to compare.
  22258. * @param {*} other The other value to compare.
  22259. * @param {boolean} bitmask The bitmask flags.
  22260. * 1 - Unordered comparison
  22261. * 2 - Partial comparison
  22262. * @param {Function} [customizer] The function to customize comparisons.
  22263. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  22264. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  22265. */
  22266. function baseIsEqual(value, other, bitmask, customizer, stack) {
  22267. if (value === other) {
  22268. return true;
  22269. }
  22270. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  22271. return value !== value && other !== other;
  22272. }
  22273. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  22274. }
  22275. /**
  22276. * A specialized version of `baseIsEqual` for arrays and objects which performs
  22277. * deep comparisons and tracks traversed objects enabling objects with circular
  22278. * references to be compared.
  22279. *
  22280. * @private
  22281. * @param {Object} object The object to compare.
  22282. * @param {Object} other The other object to compare.
  22283. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  22284. * @param {Function} customizer The function to customize comparisons.
  22285. * @param {Function} equalFunc The function to determine equivalents of values.
  22286. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  22287. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  22288. */
  22289. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  22290. var objIsArr = isArray(object),
  22291. othIsArr = isArray(other),
  22292. objTag = objIsArr ? arrayTag : getTag(object),
  22293. othTag = othIsArr ? arrayTag : getTag(other);
  22294. objTag = objTag == argsTag ? objectTag : objTag;
  22295. othTag = othTag == argsTag ? objectTag : othTag;
  22296. var objIsObj = objTag == objectTag,
  22297. othIsObj = othTag == objectTag,
  22298. isSameTag = objTag == othTag;
  22299. if (isSameTag && isBuffer(object)) {
  22300. if (!isBuffer(other)) {
  22301. return false;
  22302. }
  22303. objIsArr = true;
  22304. objIsObj = false;
  22305. }
  22306. if (isSameTag && !objIsObj) {
  22307. stack || (stack = new Stack);
  22308. return (objIsArr || isTypedArray(object))
  22309. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  22310. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  22311. }
  22312. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  22313. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  22314. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  22315. if (objIsWrapped || othIsWrapped) {
  22316. var objUnwrapped = objIsWrapped ? object.value() : object,
  22317. othUnwrapped = othIsWrapped ? other.value() : other;
  22318. stack || (stack = new Stack);
  22319. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  22320. }
  22321. }
  22322. if (!isSameTag) {
  22323. return false;
  22324. }
  22325. stack || (stack = new Stack);
  22326. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  22327. }
  22328. /**
  22329. * The base implementation of `_.isMap` without Node.js optimizations.
  22330. *
  22331. * @private
  22332. * @param {*} value The value to check.
  22333. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  22334. */
  22335. function baseIsMap(value) {
  22336. return isObjectLike(value) && getTag(value) == mapTag;
  22337. }
  22338. /**
  22339. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  22340. *
  22341. * @private
  22342. * @param {Object} object The object to inspect.
  22343. * @param {Object} source The object of property values to match.
  22344. * @param {Array} matchData The property names, values, and compare flags to match.
  22345. * @param {Function} [customizer] The function to customize comparisons.
  22346. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  22347. */
  22348. function baseIsMatch(object, source, matchData, customizer) {
  22349. var index = matchData.length,
  22350. length = index,
  22351. noCustomizer = !customizer;
  22352. if (object == null) {
  22353. return !length;
  22354. }
  22355. object = Object(object);
  22356. while (index--) {
  22357. var data = matchData[index];
  22358. if ((noCustomizer && data[2])
  22359. ? data[1] !== object[data[0]]
  22360. : !(data[0] in object)
  22361. ) {
  22362. return false;
  22363. }
  22364. }
  22365. while (++index < length) {
  22366. data = matchData[index];
  22367. var key = data[0],
  22368. objValue = object[key],
  22369. srcValue = data[1];
  22370. if (noCustomizer && data[2]) {
  22371. if (objValue === undefined && !(key in object)) {
  22372. return false;
  22373. }
  22374. } else {
  22375. var stack = new Stack;
  22376. if (customizer) {
  22377. var result = customizer(objValue, srcValue, key, object, source, stack);
  22378. }
  22379. if (!(result === undefined
  22380. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  22381. : result
  22382. )) {
  22383. return false;
  22384. }
  22385. }
  22386. }
  22387. return true;
  22388. }
  22389. /**
  22390. * The base implementation of `_.isNative` without bad shim checks.
  22391. *
  22392. * @private
  22393. * @param {*} value The value to check.
  22394. * @returns {boolean} Returns `true` if `value` is a native function,
  22395. * else `false`.
  22396. */
  22397. function baseIsNative(value) {
  22398. if (!isObject(value) || isMasked(value)) {
  22399. return false;
  22400. }
  22401. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  22402. return pattern.test(toSource(value));
  22403. }
  22404. /**
  22405. * The base implementation of `_.isRegExp` without Node.js optimizations.
  22406. *
  22407. * @private
  22408. * @param {*} value The value to check.
  22409. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  22410. */
  22411. function baseIsRegExp(value) {
  22412. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  22413. }
  22414. /**
  22415. * The base implementation of `_.isSet` without Node.js optimizations.
  22416. *
  22417. * @private
  22418. * @param {*} value The value to check.
  22419. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  22420. */
  22421. function baseIsSet(value) {
  22422. return isObjectLike(value) && getTag(value) == setTag;
  22423. }
  22424. /**
  22425. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  22426. *
  22427. * @private
  22428. * @param {*} value The value to check.
  22429. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  22430. */
  22431. function baseIsTypedArray(value) {
  22432. return isObjectLike(value) &&
  22433. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  22434. }
  22435. /**
  22436. * The base implementation of `_.iteratee`.
  22437. *
  22438. * @private
  22439. * @param {*} [value=_.identity] The value to convert to an iteratee.
  22440. * @returns {Function} Returns the iteratee.
  22441. */
  22442. function baseIteratee(value) {
  22443. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  22444. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  22445. if (typeof value == 'function') {
  22446. return value;
  22447. }
  22448. if (value == null) {
  22449. return identity;
  22450. }
  22451. if (typeof value == 'object') {
  22452. return isArray(value)
  22453. ? baseMatchesProperty(value[0], value[1])
  22454. : baseMatches(value);
  22455. }
  22456. return property(value);
  22457. }
  22458. /**
  22459. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  22460. *
  22461. * @private
  22462. * @param {Object} object The object to query.
  22463. * @returns {Array} Returns the array of property names.
  22464. */
  22465. function baseKeys(object) {
  22466. if (!isPrototype(object)) {
  22467. return nativeKeys(object);
  22468. }
  22469. var result = [];
  22470. for (var key in Object(object)) {
  22471. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  22472. result.push(key);
  22473. }
  22474. }
  22475. return result;
  22476. }
  22477. /**
  22478. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  22479. *
  22480. * @private
  22481. * @param {Object} object The object to query.
  22482. * @returns {Array} Returns the array of property names.
  22483. */
  22484. function baseKeysIn(object) {
  22485. if (!isObject(object)) {
  22486. return nativeKeysIn(object);
  22487. }
  22488. var isProto = isPrototype(object),
  22489. result = [];
  22490. for (var key in object) {
  22491. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  22492. result.push(key);
  22493. }
  22494. }
  22495. return result;
  22496. }
  22497. /**
  22498. * The base implementation of `_.lt` which doesn't coerce arguments.
  22499. *
  22500. * @private
  22501. * @param {*} value The value to compare.
  22502. * @param {*} other The other value to compare.
  22503. * @returns {boolean} Returns `true` if `value` is less than `other`,
  22504. * else `false`.
  22505. */
  22506. function baseLt(value, other) {
  22507. return value < other;
  22508. }
  22509. /**
  22510. * The base implementation of `_.map` without support for iteratee shorthands.
  22511. *
  22512. * @private
  22513. * @param {Array|Object} collection The collection to iterate over.
  22514. * @param {Function} iteratee The function invoked per iteration.
  22515. * @returns {Array} Returns the new mapped array.
  22516. */
  22517. function baseMap(collection, iteratee) {
  22518. var index = -1,
  22519. result = isArrayLike(collection) ? Array(collection.length) : [];
  22520. baseEach(collection, function(value, key, collection) {
  22521. result[++index] = iteratee(value, key, collection);
  22522. });
  22523. return result;
  22524. }
  22525. /**
  22526. * The base implementation of `_.matches` which doesn't clone `source`.
  22527. *
  22528. * @private
  22529. * @param {Object} source The object of property values to match.
  22530. * @returns {Function} Returns the new spec function.
  22531. */
  22532. function baseMatches(source) {
  22533. var matchData = getMatchData(source);
  22534. if (matchData.length == 1 && matchData[0][2]) {
  22535. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  22536. }
  22537. return function(object) {
  22538. return object === source || baseIsMatch(object, source, matchData);
  22539. };
  22540. }
  22541. /**
  22542. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  22543. *
  22544. * @private
  22545. * @param {string} path The path of the property to get.
  22546. * @param {*} srcValue The value to match.
  22547. * @returns {Function} Returns the new spec function.
  22548. */
  22549. function baseMatchesProperty(path, srcValue) {
  22550. if (isKey(path) && isStrictComparable(srcValue)) {
  22551. return matchesStrictComparable(toKey(path), srcValue);
  22552. }
  22553. return function(object) {
  22554. var objValue = get(object, path);
  22555. return (objValue === undefined && objValue === srcValue)
  22556. ? hasIn(object, path)
  22557. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  22558. };
  22559. }
  22560. /**
  22561. * The base implementation of `_.merge` without support for multiple sources.
  22562. *
  22563. * @private
  22564. * @param {Object} object The destination object.
  22565. * @param {Object} source The source object.
  22566. * @param {number} srcIndex The index of `source`.
  22567. * @param {Function} [customizer] The function to customize merged values.
  22568. * @param {Object} [stack] Tracks traversed source values and their merged
  22569. * counterparts.
  22570. */
  22571. function baseMerge(object, source, srcIndex, customizer, stack) {
  22572. if (object === source) {
  22573. return;
  22574. }
  22575. baseFor(source, function(srcValue, key) {
  22576. stack || (stack = new Stack);
  22577. if (isObject(srcValue)) {
  22578. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  22579. }
  22580. else {
  22581. var newValue = customizer
  22582. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  22583. : undefined;
  22584. if (newValue === undefined) {
  22585. newValue = srcValue;
  22586. }
  22587. assignMergeValue(object, key, newValue);
  22588. }
  22589. }, keysIn);
  22590. }
  22591. /**
  22592. * A specialized version of `baseMerge` for arrays and objects which performs
  22593. * deep merges and tracks traversed objects enabling objects with circular
  22594. * references to be merged.
  22595. *
  22596. * @private
  22597. * @param {Object} object The destination object.
  22598. * @param {Object} source The source object.
  22599. * @param {string} key The key of the value to merge.
  22600. * @param {number} srcIndex The index of `source`.
  22601. * @param {Function} mergeFunc The function to merge values.
  22602. * @param {Function} [customizer] The function to customize assigned values.
  22603. * @param {Object} [stack] Tracks traversed source values and their merged
  22604. * counterparts.
  22605. */
  22606. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  22607. var objValue = safeGet(object, key),
  22608. srcValue = safeGet(source, key),
  22609. stacked = stack.get(srcValue);
  22610. if (stacked) {
  22611. assignMergeValue(object, key, stacked);
  22612. return;
  22613. }
  22614. var newValue = customizer
  22615. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  22616. : undefined;
  22617. var isCommon = newValue === undefined;
  22618. if (isCommon) {
  22619. var isArr = isArray(srcValue),
  22620. isBuff = !isArr && isBuffer(srcValue),
  22621. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  22622. newValue = srcValue;
  22623. if (isArr || isBuff || isTyped) {
  22624. if (isArray(objValue)) {
  22625. newValue = objValue;
  22626. }
  22627. else if (isArrayLikeObject(objValue)) {
  22628. newValue = copyArray(objValue);
  22629. }
  22630. else if (isBuff) {
  22631. isCommon = false;
  22632. newValue = cloneBuffer(srcValue, true);
  22633. }
  22634. else if (isTyped) {
  22635. isCommon = false;
  22636. newValue = cloneTypedArray(srcValue, true);
  22637. }
  22638. else {
  22639. newValue = [];
  22640. }
  22641. }
  22642. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  22643. newValue = objValue;
  22644. if (isArguments(objValue)) {
  22645. newValue = toPlainObject(objValue);
  22646. }
  22647. else if (!isObject(objValue) || isFunction(objValue)) {
  22648. newValue = initCloneObject(srcValue);
  22649. }
  22650. }
  22651. else {
  22652. isCommon = false;
  22653. }
  22654. }
  22655. if (isCommon) {
  22656. // Recursively merge objects and arrays (susceptible to call stack limits).
  22657. stack.set(srcValue, newValue);
  22658. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  22659. stack['delete'](srcValue);
  22660. }
  22661. assignMergeValue(object, key, newValue);
  22662. }
  22663. /**
  22664. * The base implementation of `_.nth` which doesn't coerce arguments.
  22665. *
  22666. * @private
  22667. * @param {Array} array The array to query.
  22668. * @param {number} n The index of the element to return.
  22669. * @returns {*} Returns the nth element of `array`.
  22670. */
  22671. function baseNth(array, n) {
  22672. var length = array.length;
  22673. if (!length) {
  22674. return;
  22675. }
  22676. n += n < 0 ? length : 0;
  22677. return isIndex(n, length) ? array[n] : undefined;
  22678. }
  22679. /**
  22680. * The base implementation of `_.orderBy` without param guards.
  22681. *
  22682. * @private
  22683. * @param {Array|Object} collection The collection to iterate over.
  22684. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  22685. * @param {string[]} orders The sort orders of `iteratees`.
  22686. * @returns {Array} Returns the new sorted array.
  22687. */
  22688. function baseOrderBy(collection, iteratees, orders) {
  22689. var index = -1;
  22690. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  22691. var result = baseMap(collection, function(value, key, collection) {
  22692. var criteria = arrayMap(iteratees, function(iteratee) {
  22693. return iteratee(value);
  22694. });
  22695. return { 'criteria': criteria, 'index': ++index, 'value': value };
  22696. });
  22697. return baseSortBy(result, function(object, other) {
  22698. return compareMultiple(object, other, orders);
  22699. });
  22700. }
  22701. /**
  22702. * The base implementation of `_.pick` without support for individual
  22703. * property identifiers.
  22704. *
  22705. * @private
  22706. * @param {Object} object The source object.
  22707. * @param {string[]} paths The property paths to pick.
  22708. * @returns {Object} Returns the new object.
  22709. */
  22710. function basePick(object, paths) {
  22711. return basePickBy(object, paths, function(value, path) {
  22712. return hasIn(object, path);
  22713. });
  22714. }
  22715. /**
  22716. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  22717. *
  22718. * @private
  22719. * @param {Object} object The source object.
  22720. * @param {string[]} paths The property paths to pick.
  22721. * @param {Function} predicate The function invoked per property.
  22722. * @returns {Object} Returns the new object.
  22723. */
  22724. function basePickBy(object, paths, predicate) {
  22725. var index = -1,
  22726. length = paths.length,
  22727. result = {};
  22728. while (++index < length) {
  22729. var path = paths[index],
  22730. value = baseGet(object, path);
  22731. if (predicate(value, path)) {
  22732. baseSet(result, castPath(path, object), value);
  22733. }
  22734. }
  22735. return result;
  22736. }
  22737. /**
  22738. * A specialized version of `baseProperty` which supports deep paths.
  22739. *
  22740. * @private
  22741. * @param {Array|string} path The path of the property to get.
  22742. * @returns {Function} Returns the new accessor function.
  22743. */
  22744. function basePropertyDeep(path) {
  22745. return function(object) {
  22746. return baseGet(object, path);
  22747. };
  22748. }
  22749. /**
  22750. * The base implementation of `_.pullAllBy` without support for iteratee
  22751. * shorthands.
  22752. *
  22753. * @private
  22754. * @param {Array} array The array to modify.
  22755. * @param {Array} values The values to remove.
  22756. * @param {Function} [iteratee] The iteratee invoked per element.
  22757. * @param {Function} [comparator] The comparator invoked per element.
  22758. * @returns {Array} Returns `array`.
  22759. */
  22760. function basePullAll(array, values, iteratee, comparator) {
  22761. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  22762. index = -1,
  22763. length = values.length,
  22764. seen = array;
  22765. if (array === values) {
  22766. values = copyArray(values);
  22767. }
  22768. if (iteratee) {
  22769. seen = arrayMap(array, baseUnary(iteratee));
  22770. }
  22771. while (++index < length) {
  22772. var fromIndex = 0,
  22773. value = values[index],
  22774. computed = iteratee ? iteratee(value) : value;
  22775. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  22776. if (seen !== array) {
  22777. splice.call(seen, fromIndex, 1);
  22778. }
  22779. splice.call(array, fromIndex, 1);
  22780. }
  22781. }
  22782. return array;
  22783. }
  22784. /**
  22785. * The base implementation of `_.pullAt` without support for individual
  22786. * indexes or capturing the removed elements.
  22787. *
  22788. * @private
  22789. * @param {Array} array The array to modify.
  22790. * @param {number[]} indexes The indexes of elements to remove.
  22791. * @returns {Array} Returns `array`.
  22792. */
  22793. function basePullAt(array, indexes) {
  22794. var length = array ? indexes.length : 0,
  22795. lastIndex = length - 1;
  22796. while (length--) {
  22797. var index = indexes[length];
  22798. if (length == lastIndex || index !== previous) {
  22799. var previous = index;
  22800. if (isIndex(index)) {
  22801. splice.call(array, index, 1);
  22802. } else {
  22803. baseUnset(array, index);
  22804. }
  22805. }
  22806. }
  22807. return array;
  22808. }
  22809. /**
  22810. * The base implementation of `_.random` without support for returning
  22811. * floating-point numbers.
  22812. *
  22813. * @private
  22814. * @param {number} lower The lower bound.
  22815. * @param {number} upper The upper bound.
  22816. * @returns {number} Returns the random number.
  22817. */
  22818. function baseRandom(lower, upper) {
  22819. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  22820. }
  22821. /**
  22822. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  22823. * coerce arguments.
  22824. *
  22825. * @private
  22826. * @param {number} start The start of the range.
  22827. * @param {number} end The end of the range.
  22828. * @param {number} step The value to increment or decrement by.
  22829. * @param {boolean} [fromRight] Specify iterating from right to left.
  22830. * @returns {Array} Returns the range of numbers.
  22831. */
  22832. function baseRange(start, end, step, fromRight) {
  22833. var index = -1,
  22834. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  22835. result = Array(length);
  22836. while (length--) {
  22837. result[fromRight ? length : ++index] = start;
  22838. start += step;
  22839. }
  22840. return result;
  22841. }
  22842. /**
  22843. * The base implementation of `_.repeat` which doesn't coerce arguments.
  22844. *
  22845. * @private
  22846. * @param {string} string The string to repeat.
  22847. * @param {number} n The number of times to repeat the string.
  22848. * @returns {string} Returns the repeated string.
  22849. */
  22850. function baseRepeat(string, n) {
  22851. var result = '';
  22852. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  22853. return result;
  22854. }
  22855. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  22856. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  22857. do {
  22858. if (n % 2) {
  22859. result += string;
  22860. }
  22861. n = nativeFloor(n / 2);
  22862. if (n) {
  22863. string += string;
  22864. }
  22865. } while (n);
  22866. return result;
  22867. }
  22868. /**
  22869. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  22870. *
  22871. * @private
  22872. * @param {Function} func The function to apply a rest parameter to.
  22873. * @param {number} [start=func.length-1] The start position of the rest parameter.
  22874. * @returns {Function} Returns the new function.
  22875. */
  22876. function baseRest(func, start) {
  22877. return setToString(overRest(func, start, identity), func + '');
  22878. }
  22879. /**
  22880. * The base implementation of `_.sample`.
  22881. *
  22882. * @private
  22883. * @param {Array|Object} collection The collection to sample.
  22884. * @returns {*} Returns the random element.
  22885. */
  22886. function baseSample(collection) {
  22887. return arraySample(values(collection));
  22888. }
  22889. /**
  22890. * The base implementation of `_.sampleSize` without param guards.
  22891. *
  22892. * @private
  22893. * @param {Array|Object} collection The collection to sample.
  22894. * @param {number} n The number of elements to sample.
  22895. * @returns {Array} Returns the random elements.
  22896. */
  22897. function baseSampleSize(collection, n) {
  22898. var array = values(collection);
  22899. return shuffleSelf(array, baseClamp(n, 0, array.length));
  22900. }
  22901. /**
  22902. * The base implementation of `_.set`.
  22903. *
  22904. * @private
  22905. * @param {Object} object The object to modify.
  22906. * @param {Array|string} path The path of the property to set.
  22907. * @param {*} value The value to set.
  22908. * @param {Function} [customizer] The function to customize path creation.
  22909. * @returns {Object} Returns `object`.
  22910. */
  22911. function baseSet(object, path, value, customizer) {
  22912. if (!isObject(object)) {
  22913. return object;
  22914. }
  22915. path = castPath(path, object);
  22916. var index = -1,
  22917. length = path.length,
  22918. lastIndex = length - 1,
  22919. nested = object;
  22920. while (nested != null && ++index < length) {
  22921. var key = toKey(path[index]),
  22922. newValue = value;
  22923. if (index != lastIndex) {
  22924. var objValue = nested[key];
  22925. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  22926. if (newValue === undefined) {
  22927. newValue = isObject(objValue)
  22928. ? objValue
  22929. : (isIndex(path[index + 1]) ? [] : {});
  22930. }
  22931. }
  22932. assignValue(nested, key, newValue);
  22933. nested = nested[key];
  22934. }
  22935. return object;
  22936. }
  22937. /**
  22938. * The base implementation of `setData` without support for hot loop shorting.
  22939. *
  22940. * @private
  22941. * @param {Function} func The function to associate metadata with.
  22942. * @param {*} data The metadata.
  22943. * @returns {Function} Returns `func`.
  22944. */
  22945. var baseSetData = !metaMap ? identity : function(func, data) {
  22946. metaMap.set(func, data);
  22947. return func;
  22948. };
  22949. /**
  22950. * The base implementation of `setToString` without support for hot loop shorting.
  22951. *
  22952. * @private
  22953. * @param {Function} func The function to modify.
  22954. * @param {Function} string The `toString` result.
  22955. * @returns {Function} Returns `func`.
  22956. */
  22957. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22958. return defineProperty(func, 'toString', {
  22959. 'configurable': true,
  22960. 'enumerable': false,
  22961. 'value': constant(string),
  22962. 'writable': true
  22963. });
  22964. };
  22965. /**
  22966. * The base implementation of `_.shuffle`.
  22967. *
  22968. * @private
  22969. * @param {Array|Object} collection The collection to shuffle.
  22970. * @returns {Array} Returns the new shuffled array.
  22971. */
  22972. function baseShuffle(collection) {
  22973. return shuffleSelf(values(collection));
  22974. }
  22975. /**
  22976. * The base implementation of `_.slice` without an iteratee call guard.
  22977. *
  22978. * @private
  22979. * @param {Array} array The array to slice.
  22980. * @param {number} [start=0] The start position.
  22981. * @param {number} [end=array.length] The end position.
  22982. * @returns {Array} Returns the slice of `array`.
  22983. */
  22984. function baseSlice(array, start, end) {
  22985. var index = -1,
  22986. length = array.length;
  22987. if (start < 0) {
  22988. start = -start > length ? 0 : (length + start);
  22989. }
  22990. end = end > length ? length : end;
  22991. if (end < 0) {
  22992. end += length;
  22993. }
  22994. length = start > end ? 0 : ((end - start) >>> 0);
  22995. start >>>= 0;
  22996. var result = Array(length);
  22997. while (++index < length) {
  22998. result[index] = array[index + start];
  22999. }
  23000. return result;
  23001. }
  23002. /**
  23003. * The base implementation of `_.some` without support for iteratee shorthands.
  23004. *
  23005. * @private
  23006. * @param {Array|Object} collection The collection to iterate over.
  23007. * @param {Function} predicate The function invoked per iteration.
  23008. * @returns {boolean} Returns `true` if any element passes the predicate check,
  23009. * else `false`.
  23010. */
  23011. function baseSome(collection, predicate) {
  23012. var result;
  23013. baseEach(collection, function(value, index, collection) {
  23014. result = predicate(value, index, collection);
  23015. return !result;
  23016. });
  23017. return !!result;
  23018. }
  23019. /**
  23020. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  23021. * performs a binary search of `array` to determine the index at which `value`
  23022. * should be inserted into `array` in order to maintain its sort order.
  23023. *
  23024. * @private
  23025. * @param {Array} array The sorted array to inspect.
  23026. * @param {*} value The value to evaluate.
  23027. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  23028. * @returns {number} Returns the index at which `value` should be inserted
  23029. * into `array`.
  23030. */
  23031. function baseSortedIndex(array, value, retHighest) {
  23032. var low = 0,
  23033. high = array == null ? low : array.length;
  23034. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  23035. while (low < high) {
  23036. var mid = (low + high) >>> 1,
  23037. computed = array[mid];
  23038. if (computed !== null && !isSymbol(computed) &&
  23039. (retHighest ? (computed <= value) : (computed < value))) {
  23040. low = mid + 1;
  23041. } else {
  23042. high = mid;
  23043. }
  23044. }
  23045. return high;
  23046. }
  23047. return baseSortedIndexBy(array, value, identity, retHighest);
  23048. }
  23049. /**
  23050. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  23051. * which invokes `iteratee` for `value` and each element of `array` to compute
  23052. * their sort ranking. The iteratee is invoked with one argument; (value).
  23053. *
  23054. * @private
  23055. * @param {Array} array The sorted array to inspect.
  23056. * @param {*} value The value to evaluate.
  23057. * @param {Function} iteratee The iteratee invoked per element.
  23058. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  23059. * @returns {number} Returns the index at which `value` should be inserted
  23060. * into `array`.
  23061. */
  23062. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  23063. value = iteratee(value);
  23064. var low = 0,
  23065. high = array == null ? 0 : array.length,
  23066. valIsNaN = value !== value,
  23067. valIsNull = value === null,
  23068. valIsSymbol = isSymbol(value),
  23069. valIsUndefined = value === undefined;
  23070. while (low < high) {
  23071. var mid = nativeFloor((low + high) / 2),
  23072. computed = iteratee(array[mid]),
  23073. othIsDefined = computed !== undefined,
  23074. othIsNull = computed === null,
  23075. othIsReflexive = computed === computed,
  23076. othIsSymbol = isSymbol(computed);
  23077. if (valIsNaN) {
  23078. var setLow = retHighest || othIsReflexive;
  23079. } else if (valIsUndefined) {
  23080. setLow = othIsReflexive && (retHighest || othIsDefined);
  23081. } else if (valIsNull) {
  23082. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  23083. } else if (valIsSymbol) {
  23084. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  23085. } else if (othIsNull || othIsSymbol) {
  23086. setLow = false;
  23087. } else {
  23088. setLow = retHighest ? (computed <= value) : (computed < value);
  23089. }
  23090. if (setLow) {
  23091. low = mid + 1;
  23092. } else {
  23093. high = mid;
  23094. }
  23095. }
  23096. return nativeMin(high, MAX_ARRAY_INDEX);
  23097. }
  23098. /**
  23099. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  23100. * support for iteratee shorthands.
  23101. *
  23102. * @private
  23103. * @param {Array} array The array to inspect.
  23104. * @param {Function} [iteratee] The iteratee invoked per element.
  23105. * @returns {Array} Returns the new duplicate free array.
  23106. */
  23107. function baseSortedUniq(array, iteratee) {
  23108. var index = -1,
  23109. length = array.length,
  23110. resIndex = 0,
  23111. result = [];
  23112. while (++index < length) {
  23113. var value = array[index],
  23114. computed = iteratee ? iteratee(value) : value;
  23115. if (!index || !eq(computed, seen)) {
  23116. var seen = computed;
  23117. result[resIndex++] = value === 0 ? 0 : value;
  23118. }
  23119. }
  23120. return result;
  23121. }
  23122. /**
  23123. * The base implementation of `_.toNumber` which doesn't ensure correct
  23124. * conversions of binary, hexadecimal, or octal string values.
  23125. *
  23126. * @private
  23127. * @param {*} value The value to process.
  23128. * @returns {number} Returns the number.
  23129. */
  23130. function baseToNumber(value) {
  23131. if (typeof value == 'number') {
  23132. return value;
  23133. }
  23134. if (isSymbol(value)) {
  23135. return NAN;
  23136. }
  23137. return +value;
  23138. }
  23139. /**
  23140. * The base implementation of `_.toString` which doesn't convert nullish
  23141. * values to empty strings.
  23142. *
  23143. * @private
  23144. * @param {*} value The value to process.
  23145. * @returns {string} Returns the string.
  23146. */
  23147. function baseToString(value) {
  23148. // Exit early for strings to avoid a performance hit in some environments.
  23149. if (typeof value == 'string') {
  23150. return value;
  23151. }
  23152. if (isArray(value)) {
  23153. // Recursively convert values (susceptible to call stack limits).
  23154. return arrayMap(value, baseToString) + '';
  23155. }
  23156. if (isSymbol(value)) {
  23157. return symbolToString ? symbolToString.call(value) : '';
  23158. }
  23159. var result = (value + '');
  23160. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  23161. }
  23162. /**
  23163. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  23164. *
  23165. * @private
  23166. * @param {Array} array The array to inspect.
  23167. * @param {Function} [iteratee] The iteratee invoked per element.
  23168. * @param {Function} [comparator] The comparator invoked per element.
  23169. * @returns {Array} Returns the new duplicate free array.
  23170. */
  23171. function baseUniq(array, iteratee, comparator) {
  23172. var index = -1,
  23173. includes = arrayIncludes,
  23174. length = array.length,
  23175. isCommon = true,
  23176. result = [],
  23177. seen = result;
  23178. if (comparator) {
  23179. isCommon = false;
  23180. includes = arrayIncludesWith;
  23181. }
  23182. else if (length >= LARGE_ARRAY_SIZE) {
  23183. var set = iteratee ? null : createSet(array);
  23184. if (set) {
  23185. return setToArray(set);
  23186. }
  23187. isCommon = false;
  23188. includes = cacheHas;
  23189. seen = new SetCache;
  23190. }
  23191. else {
  23192. seen = iteratee ? [] : result;
  23193. }
  23194. outer:
  23195. while (++index < length) {
  23196. var value = array[index],
  23197. computed = iteratee ? iteratee(value) : value;
  23198. value = (comparator || value !== 0) ? value : 0;
  23199. if (isCommon && computed === computed) {
  23200. var seenIndex = seen.length;
  23201. while (seenIndex--) {
  23202. if (seen[seenIndex] === computed) {
  23203. continue outer;
  23204. }
  23205. }
  23206. if (iteratee) {
  23207. seen.push(computed);
  23208. }
  23209. result.push(value);
  23210. }
  23211. else if (!includes(seen, computed, comparator)) {
  23212. if (seen !== result) {
  23213. seen.push(computed);
  23214. }
  23215. result.push(value);
  23216. }
  23217. }
  23218. return result;
  23219. }
  23220. /**
  23221. * The base implementation of `_.unset`.
  23222. *
  23223. * @private
  23224. * @param {Object} object The object to modify.
  23225. * @param {Array|string} path The property path to unset.
  23226. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  23227. */
  23228. function baseUnset(object, path) {
  23229. path = castPath(path, object);
  23230. object = parent(object, path);
  23231. return object == null || delete object[toKey(last(path))];
  23232. }
  23233. /**
  23234. * The base implementation of `_.update`.
  23235. *
  23236. * @private
  23237. * @param {Object} object The object to modify.
  23238. * @param {Array|string} path The path of the property to update.
  23239. * @param {Function} updater The function to produce the updated value.
  23240. * @param {Function} [customizer] The function to customize path creation.
  23241. * @returns {Object} Returns `object`.
  23242. */
  23243. function baseUpdate(object, path, updater, customizer) {
  23244. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  23245. }
  23246. /**
  23247. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  23248. * without support for iteratee shorthands.
  23249. *
  23250. * @private
  23251. * @param {Array} array The array to query.
  23252. * @param {Function} predicate The function invoked per iteration.
  23253. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  23254. * @param {boolean} [fromRight] Specify iterating from right to left.
  23255. * @returns {Array} Returns the slice of `array`.
  23256. */
  23257. function baseWhile(array, predicate, isDrop, fromRight) {
  23258. var length = array.length,
  23259. index = fromRight ? length : -1;
  23260. while ((fromRight ? index-- : ++index < length) &&
  23261. predicate(array[index], index, array)) {}
  23262. return isDrop
  23263. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  23264. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  23265. }
  23266. /**
  23267. * The base implementation of `wrapperValue` which returns the result of
  23268. * performing a sequence of actions on the unwrapped `value`, where each
  23269. * successive action is supplied the return value of the previous.
  23270. *
  23271. * @private
  23272. * @param {*} value The unwrapped value.
  23273. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  23274. * @returns {*} Returns the resolved value.
  23275. */
  23276. function baseWrapperValue(value, actions) {
  23277. var result = value;
  23278. if (result instanceof LazyWrapper) {
  23279. result = result.value();
  23280. }
  23281. return arrayReduce(actions, function(result, action) {
  23282. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  23283. }, result);
  23284. }
  23285. /**
  23286. * The base implementation of methods like `_.xor`, without support for
  23287. * iteratee shorthands, that accepts an array of arrays to inspect.
  23288. *
  23289. * @private
  23290. * @param {Array} arrays The arrays to inspect.
  23291. * @param {Function} [iteratee] The iteratee invoked per element.
  23292. * @param {Function} [comparator] The comparator invoked per element.
  23293. * @returns {Array} Returns the new array of values.
  23294. */
  23295. function baseXor(arrays, iteratee, comparator) {
  23296. var length = arrays.length;
  23297. if (length < 2) {
  23298. return length ? baseUniq(arrays[0]) : [];
  23299. }
  23300. var index = -1,
  23301. result = Array(length);
  23302. while (++index < length) {
  23303. var array = arrays[index],
  23304. othIndex = -1;
  23305. while (++othIndex < length) {
  23306. if (othIndex != index) {
  23307. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  23308. }
  23309. }
  23310. }
  23311. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  23312. }
  23313. /**
  23314. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  23315. *
  23316. * @private
  23317. * @param {Array} props The property identifiers.
  23318. * @param {Array} values The property values.
  23319. * @param {Function} assignFunc The function to assign values.
  23320. * @returns {Object} Returns the new object.
  23321. */
  23322. function baseZipObject(props, values, assignFunc) {
  23323. var index = -1,
  23324. length = props.length,
  23325. valsLength = values.length,
  23326. result = {};
  23327. while (++index < length) {
  23328. var value = index < valsLength ? values[index] : undefined;
  23329. assignFunc(result, props[index], value);
  23330. }
  23331. return result;
  23332. }
  23333. /**
  23334. * Casts `value` to an empty array if it's not an array like object.
  23335. *
  23336. * @private
  23337. * @param {*} value The value to inspect.
  23338. * @returns {Array|Object} Returns the cast array-like object.
  23339. */
  23340. function castArrayLikeObject(value) {
  23341. return isArrayLikeObject(value) ? value : [];
  23342. }
  23343. /**
  23344. * Casts `value` to `identity` if it's not a function.
  23345. *
  23346. * @private
  23347. * @param {*} value The value to inspect.
  23348. * @returns {Function} Returns cast function.
  23349. */
  23350. function castFunction(value) {
  23351. return typeof value == 'function' ? value : identity;
  23352. }
  23353. /**
  23354. * Casts `value` to a path array if it's not one.
  23355. *
  23356. * @private
  23357. * @param {*} value The value to inspect.
  23358. * @param {Object} [object] The object to query keys on.
  23359. * @returns {Array} Returns the cast property path array.
  23360. */
  23361. function castPath(value, object) {
  23362. if (isArray(value)) {
  23363. return value;
  23364. }
  23365. return isKey(value, object) ? [value] : stringToPath(toString(value));
  23366. }
  23367. /**
  23368. * A `baseRest` alias which can be replaced with `identity` by module
  23369. * replacement plugins.
  23370. *
  23371. * @private
  23372. * @type {Function}
  23373. * @param {Function} func The function to apply a rest parameter to.
  23374. * @returns {Function} Returns the new function.
  23375. */
  23376. var castRest = baseRest;
  23377. /**
  23378. * Casts `array` to a slice if it's needed.
  23379. *
  23380. * @private
  23381. * @param {Array} array The array to inspect.
  23382. * @param {number} start The start position.
  23383. * @param {number} [end=array.length] The end position.
  23384. * @returns {Array} Returns the cast slice.
  23385. */
  23386. function castSlice(array, start, end) {
  23387. var length = array.length;
  23388. end = end === undefined ? length : end;
  23389. return (!start && end >= length) ? array : baseSlice(array, start, end);
  23390. }
  23391. /**
  23392. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  23393. *
  23394. * @private
  23395. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  23396. */
  23397. var clearTimeout = ctxClearTimeout || function(id) {
  23398. return root.clearTimeout(id);
  23399. };
  23400. /**
  23401. * Creates a clone of `buffer`.
  23402. *
  23403. * @private
  23404. * @param {Buffer} buffer The buffer to clone.
  23405. * @param {boolean} [isDeep] Specify a deep clone.
  23406. * @returns {Buffer} Returns the cloned buffer.
  23407. */
  23408. function cloneBuffer(buffer, isDeep) {
  23409. if (isDeep) {
  23410. return buffer.slice();
  23411. }
  23412. var length = buffer.length,
  23413. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  23414. buffer.copy(result);
  23415. return result;
  23416. }
  23417. /**
  23418. * Creates a clone of `arrayBuffer`.
  23419. *
  23420. * @private
  23421. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  23422. * @returns {ArrayBuffer} Returns the cloned array buffer.
  23423. */
  23424. function cloneArrayBuffer(arrayBuffer) {
  23425. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  23426. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  23427. return result;
  23428. }
  23429. /**
  23430. * Creates a clone of `dataView`.
  23431. *
  23432. * @private
  23433. * @param {Object} dataView The data view to clone.
  23434. * @param {boolean} [isDeep] Specify a deep clone.
  23435. * @returns {Object} Returns the cloned data view.
  23436. */
  23437. function cloneDataView(dataView, isDeep) {
  23438. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  23439. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  23440. }
  23441. /**
  23442. * Creates a clone of `regexp`.
  23443. *
  23444. * @private
  23445. * @param {Object} regexp The regexp to clone.
  23446. * @returns {Object} Returns the cloned regexp.
  23447. */
  23448. function cloneRegExp(regexp) {
  23449. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  23450. result.lastIndex = regexp.lastIndex;
  23451. return result;
  23452. }
  23453. /**
  23454. * Creates a clone of the `symbol` object.
  23455. *
  23456. * @private
  23457. * @param {Object} symbol The symbol object to clone.
  23458. * @returns {Object} Returns the cloned symbol object.
  23459. */
  23460. function cloneSymbol(symbol) {
  23461. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  23462. }
  23463. /**
  23464. * Creates a clone of `typedArray`.
  23465. *
  23466. * @private
  23467. * @param {Object} typedArray The typed array to clone.
  23468. * @param {boolean} [isDeep] Specify a deep clone.
  23469. * @returns {Object} Returns the cloned typed array.
  23470. */
  23471. function cloneTypedArray(typedArray, isDeep) {
  23472. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  23473. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  23474. }
  23475. /**
  23476. * Compares values to sort them in ascending order.
  23477. *
  23478. * @private
  23479. * @param {*} value The value to compare.
  23480. * @param {*} other The other value to compare.
  23481. * @returns {number} Returns the sort order indicator for `value`.
  23482. */
  23483. function compareAscending(value, other) {
  23484. if (value !== other) {
  23485. var valIsDefined = value !== undefined,
  23486. valIsNull = value === null,
  23487. valIsReflexive = value === value,
  23488. valIsSymbol = isSymbol(value);
  23489. var othIsDefined = other !== undefined,
  23490. othIsNull = other === null,
  23491. othIsReflexive = other === other,
  23492. othIsSymbol = isSymbol(other);
  23493. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  23494. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  23495. (valIsNull && othIsDefined && othIsReflexive) ||
  23496. (!valIsDefined && othIsReflexive) ||
  23497. !valIsReflexive) {
  23498. return 1;
  23499. }
  23500. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  23501. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  23502. (othIsNull && valIsDefined && valIsReflexive) ||
  23503. (!othIsDefined && valIsReflexive) ||
  23504. !othIsReflexive) {
  23505. return -1;
  23506. }
  23507. }
  23508. return 0;
  23509. }
  23510. /**
  23511. * Used by `_.orderBy` to compare multiple properties of a value to another
  23512. * and stable sort them.
  23513. *
  23514. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  23515. * specify an order of "desc" for descending or "asc" for ascending sort order
  23516. * of corresponding values.
  23517. *
  23518. * @private
  23519. * @param {Object} object The object to compare.
  23520. * @param {Object} other The other object to compare.
  23521. * @param {boolean[]|string[]} orders The order to sort by for each property.
  23522. * @returns {number} Returns the sort order indicator for `object`.
  23523. */
  23524. function compareMultiple(object, other, orders) {
  23525. var index = -1,
  23526. objCriteria = object.criteria,
  23527. othCriteria = other.criteria,
  23528. length = objCriteria.length,
  23529. ordersLength = orders.length;
  23530. while (++index < length) {
  23531. var result = compareAscending(objCriteria[index], othCriteria[index]);
  23532. if (result) {
  23533. if (index >= ordersLength) {
  23534. return result;
  23535. }
  23536. var order = orders[index];
  23537. return result * (order == 'desc' ? -1 : 1);
  23538. }
  23539. }
  23540. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  23541. // that causes it, under certain circumstances, to provide the same value for
  23542. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  23543. // for more details.
  23544. //
  23545. // This also ensures a stable sort in V8 and other engines.
  23546. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  23547. return object.index - other.index;
  23548. }
  23549. /**
  23550. * Creates an array that is the composition of partially applied arguments,
  23551. * placeholders, and provided arguments into a single array of arguments.
  23552. *
  23553. * @private
  23554. * @param {Array} args The provided arguments.
  23555. * @param {Array} partials The arguments to prepend to those provided.
  23556. * @param {Array} holders The `partials` placeholder indexes.
  23557. * @params {boolean} [isCurried] Specify composing for a curried function.
  23558. * @returns {Array} Returns the new array of composed arguments.
  23559. */
  23560. function composeArgs(args, partials, holders, isCurried) {
  23561. var argsIndex = -1,
  23562. argsLength = args.length,
  23563. holdersLength = holders.length,
  23564. leftIndex = -1,
  23565. leftLength = partials.length,
  23566. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23567. result = Array(leftLength + rangeLength),
  23568. isUncurried = !isCurried;
  23569. while (++leftIndex < leftLength) {
  23570. result[leftIndex] = partials[leftIndex];
  23571. }
  23572. while (++argsIndex < holdersLength) {
  23573. if (isUncurried || argsIndex < argsLength) {
  23574. result[holders[argsIndex]] = args[argsIndex];
  23575. }
  23576. }
  23577. while (rangeLength--) {
  23578. result[leftIndex++] = args[argsIndex++];
  23579. }
  23580. return result;
  23581. }
  23582. /**
  23583. * This function is like `composeArgs` except that the arguments composition
  23584. * is tailored for `_.partialRight`.
  23585. *
  23586. * @private
  23587. * @param {Array} args The provided arguments.
  23588. * @param {Array} partials The arguments to append to those provided.
  23589. * @param {Array} holders The `partials` placeholder indexes.
  23590. * @params {boolean} [isCurried] Specify composing for a curried function.
  23591. * @returns {Array} Returns the new array of composed arguments.
  23592. */
  23593. function composeArgsRight(args, partials, holders, isCurried) {
  23594. var argsIndex = -1,
  23595. argsLength = args.length,
  23596. holdersIndex = -1,
  23597. holdersLength = holders.length,
  23598. rightIndex = -1,
  23599. rightLength = partials.length,
  23600. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23601. result = Array(rangeLength + rightLength),
  23602. isUncurried = !isCurried;
  23603. while (++argsIndex < rangeLength) {
  23604. result[argsIndex] = args[argsIndex];
  23605. }
  23606. var offset = argsIndex;
  23607. while (++rightIndex < rightLength) {
  23608. result[offset + rightIndex] = partials[rightIndex];
  23609. }
  23610. while (++holdersIndex < holdersLength) {
  23611. if (isUncurried || argsIndex < argsLength) {
  23612. result[offset + holders[holdersIndex]] = args[argsIndex++];
  23613. }
  23614. }
  23615. return result;
  23616. }
  23617. /**
  23618. * Copies the values of `source` to `array`.
  23619. *
  23620. * @private
  23621. * @param {Array} source The array to copy values from.
  23622. * @param {Array} [array=[]] The array to copy values to.
  23623. * @returns {Array} Returns `array`.
  23624. */
  23625. function copyArray(source, array) {
  23626. var index = -1,
  23627. length = source.length;
  23628. array || (array = Array(length));
  23629. while (++index < length) {
  23630. array[index] = source[index];
  23631. }
  23632. return array;
  23633. }
  23634. /**
  23635. * Copies properties of `source` to `object`.
  23636. *
  23637. * @private
  23638. * @param {Object} source The object to copy properties from.
  23639. * @param {Array} props The property identifiers to copy.
  23640. * @param {Object} [object={}] The object to copy properties to.
  23641. * @param {Function} [customizer] The function to customize copied values.
  23642. * @returns {Object} Returns `object`.
  23643. */
  23644. function copyObject(source, props, object, customizer) {
  23645. var isNew = !object;
  23646. object || (object = {});
  23647. var index = -1,
  23648. length = props.length;
  23649. while (++index < length) {
  23650. var key = props[index];
  23651. var newValue = customizer
  23652. ? customizer(object[key], source[key], key, object, source)
  23653. : undefined;
  23654. if (newValue === undefined) {
  23655. newValue = source[key];
  23656. }
  23657. if (isNew) {
  23658. baseAssignValue(object, key, newValue);
  23659. } else {
  23660. assignValue(object, key, newValue);
  23661. }
  23662. }
  23663. return object;
  23664. }
  23665. /**
  23666. * Copies own symbols of `source` to `object`.
  23667. *
  23668. * @private
  23669. * @param {Object} source The object to copy symbols from.
  23670. * @param {Object} [object={}] The object to copy symbols to.
  23671. * @returns {Object} Returns `object`.
  23672. */
  23673. function copySymbols(source, object) {
  23674. return copyObject(source, getSymbols(source), object);
  23675. }
  23676. /**
  23677. * Copies own and inherited symbols of `source` to `object`.
  23678. *
  23679. * @private
  23680. * @param {Object} source The object to copy symbols from.
  23681. * @param {Object} [object={}] The object to copy symbols to.
  23682. * @returns {Object} Returns `object`.
  23683. */
  23684. function copySymbolsIn(source, object) {
  23685. return copyObject(source, getSymbolsIn(source), object);
  23686. }
  23687. /**
  23688. * Creates a function like `_.groupBy`.
  23689. *
  23690. * @private
  23691. * @param {Function} setter The function to set accumulator values.
  23692. * @param {Function} [initializer] The accumulator object initializer.
  23693. * @returns {Function} Returns the new aggregator function.
  23694. */
  23695. function createAggregator(setter, initializer) {
  23696. return function(collection, iteratee) {
  23697. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  23698. accumulator = initializer ? initializer() : {};
  23699. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  23700. };
  23701. }
  23702. /**
  23703. * Creates a function like `_.assign`.
  23704. *
  23705. * @private
  23706. * @param {Function} assigner The function to assign values.
  23707. * @returns {Function} Returns the new assigner function.
  23708. */
  23709. function createAssigner(assigner) {
  23710. return baseRest(function(object, sources) {
  23711. var index = -1,
  23712. length = sources.length,
  23713. customizer = length > 1 ? sources[length - 1] : undefined,
  23714. guard = length > 2 ? sources[2] : undefined;
  23715. customizer = (assigner.length > 3 && typeof customizer == 'function')
  23716. ? (length--, customizer)
  23717. : undefined;
  23718. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  23719. customizer = length < 3 ? undefined : customizer;
  23720. length = 1;
  23721. }
  23722. object = Object(object);
  23723. while (++index < length) {
  23724. var source = sources[index];
  23725. if (source) {
  23726. assigner(object, source, index, customizer);
  23727. }
  23728. }
  23729. return object;
  23730. });
  23731. }
  23732. /**
  23733. * Creates a `baseEach` or `baseEachRight` function.
  23734. *
  23735. * @private
  23736. * @param {Function} eachFunc The function to iterate over a collection.
  23737. * @param {boolean} [fromRight] Specify iterating from right to left.
  23738. * @returns {Function} Returns the new base function.
  23739. */
  23740. function createBaseEach(eachFunc, fromRight) {
  23741. return function(collection, iteratee) {
  23742. if (collection == null) {
  23743. return collection;
  23744. }
  23745. if (!isArrayLike(collection)) {
  23746. return eachFunc(collection, iteratee);
  23747. }
  23748. var length = collection.length,
  23749. index = fromRight ? length : -1,
  23750. iterable = Object(collection);
  23751. while ((fromRight ? index-- : ++index < length)) {
  23752. if (iteratee(iterable[index], index, iterable) === false) {
  23753. break;
  23754. }
  23755. }
  23756. return collection;
  23757. };
  23758. }
  23759. /**
  23760. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  23761. *
  23762. * @private
  23763. * @param {boolean} [fromRight] Specify iterating from right to left.
  23764. * @returns {Function} Returns the new base function.
  23765. */
  23766. function createBaseFor(fromRight) {
  23767. return function(object, iteratee, keysFunc) {
  23768. var index = -1,
  23769. iterable = Object(object),
  23770. props = keysFunc(object),
  23771. length = props.length;
  23772. while (length--) {
  23773. var key = props[fromRight ? length : ++index];
  23774. if (iteratee(iterable[key], key, iterable) === false) {
  23775. break;
  23776. }
  23777. }
  23778. return object;
  23779. };
  23780. }
  23781. /**
  23782. * Creates a function that wraps `func` to invoke it with the optional `this`
  23783. * binding of `thisArg`.
  23784. *
  23785. * @private
  23786. * @param {Function} func The function to wrap.
  23787. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23788. * @param {*} [thisArg] The `this` binding of `func`.
  23789. * @returns {Function} Returns the new wrapped function.
  23790. */
  23791. function createBind(func, bitmask, thisArg) {
  23792. var isBind = bitmask & WRAP_BIND_FLAG,
  23793. Ctor = createCtor(func);
  23794. function wrapper() {
  23795. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23796. return fn.apply(isBind ? thisArg : this, arguments);
  23797. }
  23798. return wrapper;
  23799. }
  23800. /**
  23801. * Creates a function like `_.lowerFirst`.
  23802. *
  23803. * @private
  23804. * @param {string} methodName The name of the `String` case method to use.
  23805. * @returns {Function} Returns the new case function.
  23806. */
  23807. function createCaseFirst(methodName) {
  23808. return function(string) {
  23809. string = toString(string);
  23810. var strSymbols = hasUnicode(string)
  23811. ? stringToArray(string)
  23812. : undefined;
  23813. var chr = strSymbols
  23814. ? strSymbols[0]
  23815. : string.charAt(0);
  23816. var trailing = strSymbols
  23817. ? castSlice(strSymbols, 1).join('')
  23818. : string.slice(1);
  23819. return chr[methodName]() + trailing;
  23820. };
  23821. }
  23822. /**
  23823. * Creates a function like `_.camelCase`.
  23824. *
  23825. * @private
  23826. * @param {Function} callback The function to combine each word.
  23827. * @returns {Function} Returns the new compounder function.
  23828. */
  23829. function createCompounder(callback) {
  23830. return function(string) {
  23831. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  23832. };
  23833. }
  23834. /**
  23835. * Creates a function that produces an instance of `Ctor` regardless of
  23836. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  23837. *
  23838. * @private
  23839. * @param {Function} Ctor The constructor to wrap.
  23840. * @returns {Function} Returns the new wrapped function.
  23841. */
  23842. function createCtor(Ctor) {
  23843. return function() {
  23844. // Use a `switch` statement to work with class constructors. See
  23845. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  23846. // for more details.
  23847. var args = arguments;
  23848. switch (args.length) {
  23849. case 0: return new Ctor;
  23850. case 1: return new Ctor(args[0]);
  23851. case 2: return new Ctor(args[0], args[1]);
  23852. case 3: return new Ctor(args[0], args[1], args[2]);
  23853. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  23854. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  23855. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  23856. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  23857. }
  23858. var thisBinding = baseCreate(Ctor.prototype),
  23859. result = Ctor.apply(thisBinding, args);
  23860. // Mimic the constructor's `return` behavior.
  23861. // See https://es5.github.io/#x13.2.2 for more details.
  23862. return isObject(result) ? result : thisBinding;
  23863. };
  23864. }
  23865. /**
  23866. * Creates a function that wraps `func` to enable currying.
  23867. *
  23868. * @private
  23869. * @param {Function} func The function to wrap.
  23870. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23871. * @param {number} arity The arity of `func`.
  23872. * @returns {Function} Returns the new wrapped function.
  23873. */
  23874. function createCurry(func, bitmask, arity) {
  23875. var Ctor = createCtor(func);
  23876. function wrapper() {
  23877. var length = arguments.length,
  23878. args = Array(length),
  23879. index = length,
  23880. placeholder = getHolder(wrapper);
  23881. while (index--) {
  23882. args[index] = arguments[index];
  23883. }
  23884. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  23885. ? []
  23886. : replaceHolders(args, placeholder);
  23887. length -= holders.length;
  23888. if (length < arity) {
  23889. return createRecurry(
  23890. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  23891. args, holders, undefined, undefined, arity - length);
  23892. }
  23893. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23894. return apply(fn, this, args);
  23895. }
  23896. return wrapper;
  23897. }
  23898. /**
  23899. * Creates a `_.find` or `_.findLast` function.
  23900. *
  23901. * @private
  23902. * @param {Function} findIndexFunc The function to find the collection index.
  23903. * @returns {Function} Returns the new find function.
  23904. */
  23905. function createFind(findIndexFunc) {
  23906. return function(collection, predicate, fromIndex) {
  23907. var iterable = Object(collection);
  23908. if (!isArrayLike(collection)) {
  23909. var iteratee = getIteratee(predicate, 3);
  23910. collection = keys(collection);
  23911. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  23912. }
  23913. var index = findIndexFunc(collection, predicate, fromIndex);
  23914. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  23915. };
  23916. }
  23917. /**
  23918. * Creates a `_.flow` or `_.flowRight` function.
  23919. *
  23920. * @private
  23921. * @param {boolean} [fromRight] Specify iterating from right to left.
  23922. * @returns {Function} Returns the new flow function.
  23923. */
  23924. function createFlow(fromRight) {
  23925. return flatRest(function(funcs) {
  23926. var length = funcs.length,
  23927. index = length,
  23928. prereq = LodashWrapper.prototype.thru;
  23929. if (fromRight) {
  23930. funcs.reverse();
  23931. }
  23932. while (index--) {
  23933. var func = funcs[index];
  23934. if (typeof func != 'function') {
  23935. throw new TypeError(FUNC_ERROR_TEXT);
  23936. }
  23937. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23938. var wrapper = new LodashWrapper([], true);
  23939. }
  23940. }
  23941. index = wrapper ? index : length;
  23942. while (++index < length) {
  23943. func = funcs[index];
  23944. var funcName = getFuncName(func),
  23945. data = funcName == 'wrapper' ? getData(func) : undefined;
  23946. if (data && isLaziable(data[0]) &&
  23947. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23948. !data[4].length && data[9] == 1
  23949. ) {
  23950. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23951. } else {
  23952. wrapper = (func.length == 1 && isLaziable(func))
  23953. ? wrapper[funcName]()
  23954. : wrapper.thru(func);
  23955. }
  23956. }
  23957. return function() {
  23958. var args = arguments,
  23959. value = args[0];
  23960. if (wrapper && args.length == 1 && isArray(value)) {
  23961. return wrapper.plant(value).value();
  23962. }
  23963. var index = 0,
  23964. result = length ? funcs[index].apply(this, args) : value;
  23965. while (++index < length) {
  23966. result = funcs[index].call(this, result);
  23967. }
  23968. return result;
  23969. };
  23970. });
  23971. }
  23972. /**
  23973. * Creates a function that wraps `func` to invoke it with optional `this`
  23974. * binding of `thisArg`, partial application, and currying.
  23975. *
  23976. * @private
  23977. * @param {Function|string} func The function or method name to wrap.
  23978. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23979. * @param {*} [thisArg] The `this` binding of `func`.
  23980. * @param {Array} [partials] The arguments to prepend to those provided to
  23981. * the new function.
  23982. * @param {Array} [holders] The `partials` placeholder indexes.
  23983. * @param {Array} [partialsRight] The arguments to append to those provided
  23984. * to the new function.
  23985. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23986. * @param {Array} [argPos] The argument positions of the new function.
  23987. * @param {number} [ary] The arity cap of `func`.
  23988. * @param {number} [arity] The arity of `func`.
  23989. * @returns {Function} Returns the new wrapped function.
  23990. */
  23991. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23992. var isAry = bitmask & WRAP_ARY_FLAG,
  23993. isBind = bitmask & WRAP_BIND_FLAG,
  23994. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23995. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23996. isFlip = bitmask & WRAP_FLIP_FLAG,
  23997. Ctor = isBindKey ? undefined : createCtor(func);
  23998. function wrapper() {
  23999. var length = arguments.length,
  24000. args = Array(length),
  24001. index = length;
  24002. while (index--) {
  24003. args[index] = arguments[index];
  24004. }
  24005. if (isCurried) {
  24006. var placeholder = getHolder(wrapper),
  24007. holdersCount = countHolders(args, placeholder);
  24008. }
  24009. if (partials) {
  24010. args = composeArgs(args, partials, holders, isCurried);
  24011. }
  24012. if (partialsRight) {
  24013. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  24014. }
  24015. length -= holdersCount;
  24016. if (isCurried && length < arity) {
  24017. var newHolders = replaceHolders(args, placeholder);
  24018. return createRecurry(
  24019. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  24020. args, newHolders, argPos, ary, arity - length
  24021. );
  24022. }
  24023. var thisBinding = isBind ? thisArg : this,
  24024. fn = isBindKey ? thisBinding[func] : func;
  24025. length = args.length;
  24026. if (argPos) {
  24027. args = reorder(args, argPos);
  24028. } else if (isFlip && length > 1) {
  24029. args.reverse();
  24030. }
  24031. if (isAry && ary < length) {
  24032. args.length = ary;
  24033. }
  24034. if (this && this !== root && this instanceof wrapper) {
  24035. fn = Ctor || createCtor(fn);
  24036. }
  24037. return fn.apply(thisBinding, args);
  24038. }
  24039. return wrapper;
  24040. }
  24041. /**
  24042. * Creates a function like `_.invertBy`.
  24043. *
  24044. * @private
  24045. * @param {Function} setter The function to set accumulator values.
  24046. * @param {Function} toIteratee The function to resolve iteratees.
  24047. * @returns {Function} Returns the new inverter function.
  24048. */
  24049. function createInverter(setter, toIteratee) {
  24050. return function(object, iteratee) {
  24051. return baseInverter(object, setter, toIteratee(iteratee), {});
  24052. };
  24053. }
  24054. /**
  24055. * Creates a function that performs a mathematical operation on two values.
  24056. *
  24057. * @private
  24058. * @param {Function} operator The function to perform the operation.
  24059. * @param {number} [defaultValue] The value used for `undefined` arguments.
  24060. * @returns {Function} Returns the new mathematical operation function.
  24061. */
  24062. function createMathOperation(operator, defaultValue) {
  24063. return function(value, other) {
  24064. var result;
  24065. if (value === undefined && other === undefined) {
  24066. return defaultValue;
  24067. }
  24068. if (value !== undefined) {
  24069. result = value;
  24070. }
  24071. if (other !== undefined) {
  24072. if (result === undefined) {
  24073. return other;
  24074. }
  24075. if (typeof value == 'string' || typeof other == 'string') {
  24076. value = baseToString(value);
  24077. other = baseToString(other);
  24078. } else {
  24079. value = baseToNumber(value);
  24080. other = baseToNumber(other);
  24081. }
  24082. result = operator(value, other);
  24083. }
  24084. return result;
  24085. };
  24086. }
  24087. /**
  24088. * Creates a function like `_.over`.
  24089. *
  24090. * @private
  24091. * @param {Function} arrayFunc The function to iterate over iteratees.
  24092. * @returns {Function} Returns the new over function.
  24093. */
  24094. function createOver(arrayFunc) {
  24095. return flatRest(function(iteratees) {
  24096. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  24097. return baseRest(function(args) {
  24098. var thisArg = this;
  24099. return arrayFunc(iteratees, function(iteratee) {
  24100. return apply(iteratee, thisArg, args);
  24101. });
  24102. });
  24103. });
  24104. }
  24105. /**
  24106. * Creates the padding for `string` based on `length`. The `chars` string
  24107. * is truncated if the number of characters exceeds `length`.
  24108. *
  24109. * @private
  24110. * @param {number} length The padding length.
  24111. * @param {string} [chars=' '] The string used as padding.
  24112. * @returns {string} Returns the padding for `string`.
  24113. */
  24114. function createPadding(length, chars) {
  24115. chars = chars === undefined ? ' ' : baseToString(chars);
  24116. var charsLength = chars.length;
  24117. if (charsLength < 2) {
  24118. return charsLength ? baseRepeat(chars, length) : chars;
  24119. }
  24120. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  24121. return hasUnicode(chars)
  24122. ? castSlice(stringToArray(result), 0, length).join('')
  24123. : result.slice(0, length);
  24124. }
  24125. /**
  24126. * Creates a function that wraps `func` to invoke it with the `this` binding
  24127. * of `thisArg` and `partials` prepended to the arguments it receives.
  24128. *
  24129. * @private
  24130. * @param {Function} func The function to wrap.
  24131. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24132. * @param {*} thisArg The `this` binding of `func`.
  24133. * @param {Array} partials The arguments to prepend to those provided to
  24134. * the new function.
  24135. * @returns {Function} Returns the new wrapped function.
  24136. */
  24137. function createPartial(func, bitmask, thisArg, partials) {
  24138. var isBind = bitmask & WRAP_BIND_FLAG,
  24139. Ctor = createCtor(func);
  24140. function wrapper() {
  24141. var argsIndex = -1,
  24142. argsLength = arguments.length,
  24143. leftIndex = -1,
  24144. leftLength = partials.length,
  24145. args = Array(leftLength + argsLength),
  24146. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  24147. while (++leftIndex < leftLength) {
  24148. args[leftIndex] = partials[leftIndex];
  24149. }
  24150. while (argsLength--) {
  24151. args[leftIndex++] = arguments[++argsIndex];
  24152. }
  24153. return apply(fn, isBind ? thisArg : this, args);
  24154. }
  24155. return wrapper;
  24156. }
  24157. /**
  24158. * Creates a `_.range` or `_.rangeRight` function.
  24159. *
  24160. * @private
  24161. * @param {boolean} [fromRight] Specify iterating from right to left.
  24162. * @returns {Function} Returns the new range function.
  24163. */
  24164. function createRange(fromRight) {
  24165. return function(start, end, step) {
  24166. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  24167. end = step = undefined;
  24168. }
  24169. // Ensure the sign of `-0` is preserved.
  24170. start = toFinite(start);
  24171. if (end === undefined) {
  24172. end = start;
  24173. start = 0;
  24174. } else {
  24175. end = toFinite(end);
  24176. }
  24177. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  24178. return baseRange(start, end, step, fromRight);
  24179. };
  24180. }
  24181. /**
  24182. * Creates a function that performs a relational operation on two values.
  24183. *
  24184. * @private
  24185. * @param {Function} operator The function to perform the operation.
  24186. * @returns {Function} Returns the new relational operation function.
  24187. */
  24188. function createRelationalOperation(operator) {
  24189. return function(value, other) {
  24190. if (!(typeof value == 'string' && typeof other == 'string')) {
  24191. value = toNumber(value);
  24192. other = toNumber(other);
  24193. }
  24194. return operator(value, other);
  24195. };
  24196. }
  24197. /**
  24198. * Creates a function that wraps `func` to continue currying.
  24199. *
  24200. * @private
  24201. * @param {Function} func The function to wrap.
  24202. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24203. * @param {Function} wrapFunc The function to create the `func` wrapper.
  24204. * @param {*} placeholder The placeholder value.
  24205. * @param {*} [thisArg] The `this` binding of `func`.
  24206. * @param {Array} [partials] The arguments to prepend to those provided to
  24207. * the new function.
  24208. * @param {Array} [holders] The `partials` placeholder indexes.
  24209. * @param {Array} [argPos] The argument positions of the new function.
  24210. * @param {number} [ary] The arity cap of `func`.
  24211. * @param {number} [arity] The arity of `func`.
  24212. * @returns {Function} Returns the new wrapped function.
  24213. */
  24214. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  24215. var isCurry = bitmask & WRAP_CURRY_FLAG,
  24216. newHolders = isCurry ? holders : undefined,
  24217. newHoldersRight = isCurry ? undefined : holders,
  24218. newPartials = isCurry ? partials : undefined,
  24219. newPartialsRight = isCurry ? undefined : partials;
  24220. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  24221. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  24222. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  24223. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  24224. }
  24225. var newData = [
  24226. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  24227. newHoldersRight, argPos, ary, arity
  24228. ];
  24229. var result = wrapFunc.apply(undefined, newData);
  24230. if (isLaziable(func)) {
  24231. setData(result, newData);
  24232. }
  24233. result.placeholder = placeholder;
  24234. return setWrapToString(result, func, bitmask);
  24235. }
  24236. /**
  24237. * Creates a function like `_.round`.
  24238. *
  24239. * @private
  24240. * @param {string} methodName The name of the `Math` method to use when rounding.
  24241. * @returns {Function} Returns the new round function.
  24242. */
  24243. function createRound(methodName) {
  24244. var func = Math[methodName];
  24245. return function(number, precision) {
  24246. number = toNumber(number);
  24247. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  24248. if (precision && nativeIsFinite(number)) {
  24249. // Shift with exponential notation to avoid floating-point issues.
  24250. // See [MDN](https://mdn.io/round#Examples) for more details.
  24251. var pair = (toString(number) + 'e').split('e'),
  24252. value = func(pair[0] + 'e' + (+pair[1] + precision));
  24253. pair = (toString(value) + 'e').split('e');
  24254. return +(pair[0] + 'e' + (+pair[1] - precision));
  24255. }
  24256. return func(number);
  24257. };
  24258. }
  24259. /**
  24260. * Creates a set object of `values`.
  24261. *
  24262. * @private
  24263. * @param {Array} values The values to add to the set.
  24264. * @returns {Object} Returns the new set.
  24265. */
  24266. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  24267. return new Set(values);
  24268. };
  24269. /**
  24270. * Creates a `_.toPairs` or `_.toPairsIn` function.
  24271. *
  24272. * @private
  24273. * @param {Function} keysFunc The function to get the keys of a given object.
  24274. * @returns {Function} Returns the new pairs function.
  24275. */
  24276. function createToPairs(keysFunc) {
  24277. return function(object) {
  24278. var tag = getTag(object);
  24279. if (tag == mapTag) {
  24280. return mapToArray(object);
  24281. }
  24282. if (tag == setTag) {
  24283. return setToPairs(object);
  24284. }
  24285. return baseToPairs(object, keysFunc(object));
  24286. };
  24287. }
  24288. /**
  24289. * Creates a function that either curries or invokes `func` with optional
  24290. * `this` binding and partially applied arguments.
  24291. *
  24292. * @private
  24293. * @param {Function|string} func The function or method name to wrap.
  24294. * @param {number} bitmask The bitmask flags.
  24295. * 1 - `_.bind`
  24296. * 2 - `_.bindKey`
  24297. * 4 - `_.curry` or `_.curryRight` of a bound function
  24298. * 8 - `_.curry`
  24299. * 16 - `_.curryRight`
  24300. * 32 - `_.partial`
  24301. * 64 - `_.partialRight`
  24302. * 128 - `_.rearg`
  24303. * 256 - `_.ary`
  24304. * 512 - `_.flip`
  24305. * @param {*} [thisArg] The `this` binding of `func`.
  24306. * @param {Array} [partials] The arguments to be partially applied.
  24307. * @param {Array} [holders] The `partials` placeholder indexes.
  24308. * @param {Array} [argPos] The argument positions of the new function.
  24309. * @param {number} [ary] The arity cap of `func`.
  24310. * @param {number} [arity] The arity of `func`.
  24311. * @returns {Function} Returns the new wrapped function.
  24312. */
  24313. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  24314. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  24315. if (!isBindKey && typeof func != 'function') {
  24316. throw new TypeError(FUNC_ERROR_TEXT);
  24317. }
  24318. var length = partials ? partials.length : 0;
  24319. if (!length) {
  24320. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  24321. partials = holders = undefined;
  24322. }
  24323. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  24324. arity = arity === undefined ? arity : toInteger(arity);
  24325. length -= holders ? holders.length : 0;
  24326. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  24327. var partialsRight = partials,
  24328. holdersRight = holders;
  24329. partials = holders = undefined;
  24330. }
  24331. var data = isBindKey ? undefined : getData(func);
  24332. var newData = [
  24333. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  24334. argPos, ary, arity
  24335. ];
  24336. if (data) {
  24337. mergeData(newData, data);
  24338. }
  24339. func = newData[0];
  24340. bitmask = newData[1];
  24341. thisArg = newData[2];
  24342. partials = newData[3];
  24343. holders = newData[4];
  24344. arity = newData[9] = newData[9] === undefined
  24345. ? (isBindKey ? 0 : func.length)
  24346. : nativeMax(newData[9] - length, 0);
  24347. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  24348. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  24349. }
  24350. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  24351. var result = createBind(func, bitmask, thisArg);
  24352. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  24353. result = createCurry(func, bitmask, arity);
  24354. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  24355. result = createPartial(func, bitmask, thisArg, partials);
  24356. } else {
  24357. result = createHybrid.apply(undefined, newData);
  24358. }
  24359. var setter = data ? baseSetData : setData;
  24360. return setWrapToString(setter(result, newData), func, bitmask);
  24361. }
  24362. /**
  24363. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  24364. * of source objects to the destination object for all destination properties
  24365. * that resolve to `undefined`.
  24366. *
  24367. * @private
  24368. * @param {*} objValue The destination value.
  24369. * @param {*} srcValue The source value.
  24370. * @param {string} key The key of the property to assign.
  24371. * @param {Object} object The parent object of `objValue`.
  24372. * @returns {*} Returns the value to assign.
  24373. */
  24374. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  24375. if (objValue === undefined ||
  24376. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  24377. return srcValue;
  24378. }
  24379. return objValue;
  24380. }
  24381. /**
  24382. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  24383. * objects into destination objects that are passed thru.
  24384. *
  24385. * @private
  24386. * @param {*} objValue The destination value.
  24387. * @param {*} srcValue The source value.
  24388. * @param {string} key The key of the property to merge.
  24389. * @param {Object} object The parent object of `objValue`.
  24390. * @param {Object} source The parent object of `srcValue`.
  24391. * @param {Object} [stack] Tracks traversed source values and their merged
  24392. * counterparts.
  24393. * @returns {*} Returns the value to assign.
  24394. */
  24395. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  24396. if (isObject(objValue) && isObject(srcValue)) {
  24397. // Recursively merge objects and arrays (susceptible to call stack limits).
  24398. stack.set(srcValue, objValue);
  24399. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  24400. stack['delete'](srcValue);
  24401. }
  24402. return objValue;
  24403. }
  24404. /**
  24405. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  24406. * objects.
  24407. *
  24408. * @private
  24409. * @param {*} value The value to inspect.
  24410. * @param {string} key The key of the property to inspect.
  24411. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  24412. */
  24413. function customOmitClone(value) {
  24414. return isPlainObject(value) ? undefined : value;
  24415. }
  24416. /**
  24417. * A specialized version of `baseIsEqualDeep` for arrays with support for
  24418. * partial deep comparisons.
  24419. *
  24420. * @private
  24421. * @param {Array} array The array to compare.
  24422. * @param {Array} other The other array to compare.
  24423. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24424. * @param {Function} customizer The function to customize comparisons.
  24425. * @param {Function} equalFunc The function to determine equivalents of values.
  24426. * @param {Object} stack Tracks traversed `array` and `other` objects.
  24427. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  24428. */
  24429. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  24430. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  24431. arrLength = array.length,
  24432. othLength = other.length;
  24433. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  24434. return false;
  24435. }
  24436. // Assume cyclic values are equal.
  24437. var stacked = stack.get(array);
  24438. if (stacked && stack.get(other)) {
  24439. return stacked == other;
  24440. }
  24441. var index = -1,
  24442. result = true,
  24443. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  24444. stack.set(array, other);
  24445. stack.set(other, array);
  24446. // Ignore non-index properties.
  24447. while (++index < arrLength) {
  24448. var arrValue = array[index],
  24449. othValue = other[index];
  24450. if (customizer) {
  24451. var compared = isPartial
  24452. ? customizer(othValue, arrValue, index, other, array, stack)
  24453. : customizer(arrValue, othValue, index, array, other, stack);
  24454. }
  24455. if (compared !== undefined) {
  24456. if (compared) {
  24457. continue;
  24458. }
  24459. result = false;
  24460. break;
  24461. }
  24462. // Recursively compare arrays (susceptible to call stack limits).
  24463. if (seen) {
  24464. if (!arraySome(other, function(othValue, othIndex) {
  24465. if (!cacheHas(seen, othIndex) &&
  24466. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  24467. return seen.push(othIndex);
  24468. }
  24469. })) {
  24470. result = false;
  24471. break;
  24472. }
  24473. } else if (!(
  24474. arrValue === othValue ||
  24475. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  24476. )) {
  24477. result = false;
  24478. break;
  24479. }
  24480. }
  24481. stack['delete'](array);
  24482. stack['delete'](other);
  24483. return result;
  24484. }
  24485. /**
  24486. * A specialized version of `baseIsEqualDeep` for comparing objects of
  24487. * the same `toStringTag`.
  24488. *
  24489. * **Note:** This function only supports comparing values with tags of
  24490. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  24491. *
  24492. * @private
  24493. * @param {Object} object The object to compare.
  24494. * @param {Object} other The other object to compare.
  24495. * @param {string} tag The `toStringTag` of the objects to compare.
  24496. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24497. * @param {Function} customizer The function to customize comparisons.
  24498. * @param {Function} equalFunc The function to determine equivalents of values.
  24499. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24500. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24501. */
  24502. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  24503. switch (tag) {
  24504. case dataViewTag:
  24505. if ((object.byteLength != other.byteLength) ||
  24506. (object.byteOffset != other.byteOffset)) {
  24507. return false;
  24508. }
  24509. object = object.buffer;
  24510. other = other.buffer;
  24511. case arrayBufferTag:
  24512. if ((object.byteLength != other.byteLength) ||
  24513. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  24514. return false;
  24515. }
  24516. return true;
  24517. case boolTag:
  24518. case dateTag:
  24519. case numberTag:
  24520. // Coerce booleans to `1` or `0` and dates to milliseconds.
  24521. // Invalid dates are coerced to `NaN`.
  24522. return eq(+object, +other);
  24523. case errorTag:
  24524. return object.name == other.name && object.message == other.message;
  24525. case regexpTag:
  24526. case stringTag:
  24527. // Coerce regexes to strings and treat strings, primitives and objects,
  24528. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  24529. // for more details.
  24530. return object == (other + '');
  24531. case mapTag:
  24532. var convert = mapToArray;
  24533. case setTag:
  24534. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  24535. convert || (convert = setToArray);
  24536. if (object.size != other.size && !isPartial) {
  24537. return false;
  24538. }
  24539. // Assume cyclic values are equal.
  24540. var stacked = stack.get(object);
  24541. if (stacked) {
  24542. return stacked == other;
  24543. }
  24544. bitmask |= COMPARE_UNORDERED_FLAG;
  24545. // Recursively compare objects (susceptible to call stack limits).
  24546. stack.set(object, other);
  24547. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  24548. stack['delete'](object);
  24549. return result;
  24550. case symbolTag:
  24551. if (symbolValueOf) {
  24552. return symbolValueOf.call(object) == symbolValueOf.call(other);
  24553. }
  24554. }
  24555. return false;
  24556. }
  24557. /**
  24558. * A specialized version of `baseIsEqualDeep` for objects with support for
  24559. * partial deep comparisons.
  24560. *
  24561. * @private
  24562. * @param {Object} object The object to compare.
  24563. * @param {Object} other The other object to compare.
  24564. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24565. * @param {Function} customizer The function to customize comparisons.
  24566. * @param {Function} equalFunc The function to determine equivalents of values.
  24567. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24568. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24569. */
  24570. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  24571. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  24572. objProps = getAllKeys(object),
  24573. objLength = objProps.length,
  24574. othProps = getAllKeys(other),
  24575. othLength = othProps.length;
  24576. if (objLength != othLength && !isPartial) {
  24577. return false;
  24578. }
  24579. var index = objLength;
  24580. while (index--) {
  24581. var key = objProps[index];
  24582. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  24583. return false;
  24584. }
  24585. }
  24586. // Assume cyclic values are equal.
  24587. var stacked = stack.get(object);
  24588. if (stacked && stack.get(other)) {
  24589. return stacked == other;
  24590. }
  24591. var result = true;
  24592. stack.set(object, other);
  24593. stack.set(other, object);
  24594. var skipCtor = isPartial;
  24595. while (++index < objLength) {
  24596. key = objProps[index];
  24597. var objValue = object[key],
  24598. othValue = other[key];
  24599. if (customizer) {
  24600. var compared = isPartial
  24601. ? customizer(othValue, objValue, key, other, object, stack)
  24602. : customizer(objValue, othValue, key, object, other, stack);
  24603. }
  24604. // Recursively compare objects (susceptible to call stack limits).
  24605. if (!(compared === undefined
  24606. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  24607. : compared
  24608. )) {
  24609. result = false;
  24610. break;
  24611. }
  24612. skipCtor || (skipCtor = key == 'constructor');
  24613. }
  24614. if (result && !skipCtor) {
  24615. var objCtor = object.constructor,
  24616. othCtor = other.constructor;
  24617. // Non `Object` object instances with different constructors are not equal.
  24618. if (objCtor != othCtor &&
  24619. ('constructor' in object && 'constructor' in other) &&
  24620. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  24621. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  24622. result = false;
  24623. }
  24624. }
  24625. stack['delete'](object);
  24626. stack['delete'](other);
  24627. return result;
  24628. }
  24629. /**
  24630. * A specialized version of `baseRest` which flattens the rest array.
  24631. *
  24632. * @private
  24633. * @param {Function} func The function to apply a rest parameter to.
  24634. * @returns {Function} Returns the new function.
  24635. */
  24636. function flatRest(func) {
  24637. return setToString(overRest(func, undefined, flatten), func + '');
  24638. }
  24639. /**
  24640. * Creates an array of own enumerable property names and symbols of `object`.
  24641. *
  24642. * @private
  24643. * @param {Object} object The object to query.
  24644. * @returns {Array} Returns the array of property names and symbols.
  24645. */
  24646. function getAllKeys(object) {
  24647. return baseGetAllKeys(object, keys, getSymbols);
  24648. }
  24649. /**
  24650. * Creates an array of own and inherited enumerable property names and
  24651. * symbols of `object`.
  24652. *
  24653. * @private
  24654. * @param {Object} object The object to query.
  24655. * @returns {Array} Returns the array of property names and symbols.
  24656. */
  24657. function getAllKeysIn(object) {
  24658. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  24659. }
  24660. /**
  24661. * Gets metadata for `func`.
  24662. *
  24663. * @private
  24664. * @param {Function} func The function to query.
  24665. * @returns {*} Returns the metadata for `func`.
  24666. */
  24667. var getData = !metaMap ? noop : function(func) {
  24668. return metaMap.get(func);
  24669. };
  24670. /**
  24671. * Gets the name of `func`.
  24672. *
  24673. * @private
  24674. * @param {Function} func The function to query.
  24675. * @returns {string} Returns the function name.
  24676. */
  24677. function getFuncName(func) {
  24678. var result = (func.name + ''),
  24679. array = realNames[result],
  24680. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  24681. while (length--) {
  24682. var data = array[length],
  24683. otherFunc = data.func;
  24684. if (otherFunc == null || otherFunc == func) {
  24685. return data.name;
  24686. }
  24687. }
  24688. return result;
  24689. }
  24690. /**
  24691. * Gets the argument placeholder value for `func`.
  24692. *
  24693. * @private
  24694. * @param {Function} func The function to inspect.
  24695. * @returns {*} Returns the placeholder value.
  24696. */
  24697. function getHolder(func) {
  24698. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  24699. return object.placeholder;
  24700. }
  24701. /**
  24702. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  24703. * this function returns the custom method, otherwise it returns `baseIteratee`.
  24704. * If arguments are provided, the chosen function is invoked with them and
  24705. * its result is returned.
  24706. *
  24707. * @private
  24708. * @param {*} [value] The value to convert to an iteratee.
  24709. * @param {number} [arity] The arity of the created iteratee.
  24710. * @returns {Function} Returns the chosen function or its result.
  24711. */
  24712. function getIteratee() {
  24713. var result = lodash.iteratee || iteratee;
  24714. result = result === iteratee ? baseIteratee : result;
  24715. return arguments.length ? result(arguments[0], arguments[1]) : result;
  24716. }
  24717. /**
  24718. * Gets the data for `map`.
  24719. *
  24720. * @private
  24721. * @param {Object} map The map to query.
  24722. * @param {string} key The reference key.
  24723. * @returns {*} Returns the map data.
  24724. */
  24725. function getMapData(map, key) {
  24726. var data = map.__data__;
  24727. return isKeyable(key)
  24728. ? data[typeof key == 'string' ? 'string' : 'hash']
  24729. : data.map;
  24730. }
  24731. /**
  24732. * Gets the property names, values, and compare flags of `object`.
  24733. *
  24734. * @private
  24735. * @param {Object} object The object to query.
  24736. * @returns {Array} Returns the match data of `object`.
  24737. */
  24738. function getMatchData(object) {
  24739. var result = keys(object),
  24740. length = result.length;
  24741. while (length--) {
  24742. var key = result[length],
  24743. value = object[key];
  24744. result[length] = [key, value, isStrictComparable(value)];
  24745. }
  24746. return result;
  24747. }
  24748. /**
  24749. * Gets the native function at `key` of `object`.
  24750. *
  24751. * @private
  24752. * @param {Object} object The object to query.
  24753. * @param {string} key The key of the method to get.
  24754. * @returns {*} Returns the function if it's native, else `undefined`.
  24755. */
  24756. function getNative(object, key) {
  24757. var value = getValue(object, key);
  24758. return baseIsNative(value) ? value : undefined;
  24759. }
  24760. /**
  24761. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  24762. *
  24763. * @private
  24764. * @param {*} value The value to query.
  24765. * @returns {string} Returns the raw `toStringTag`.
  24766. */
  24767. function getRawTag(value) {
  24768. var isOwn = hasOwnProperty.call(value, symToStringTag),
  24769. tag = value[symToStringTag];
  24770. try {
  24771. value[symToStringTag] = undefined;
  24772. var unmasked = true;
  24773. } catch (e) {}
  24774. var result = nativeObjectToString.call(value);
  24775. if (unmasked) {
  24776. if (isOwn) {
  24777. value[symToStringTag] = tag;
  24778. } else {
  24779. delete value[symToStringTag];
  24780. }
  24781. }
  24782. return result;
  24783. }
  24784. /**
  24785. * Creates an array of the own enumerable symbols of `object`.
  24786. *
  24787. * @private
  24788. * @param {Object} object The object to query.
  24789. * @returns {Array} Returns the array of symbols.
  24790. */
  24791. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  24792. if (object == null) {
  24793. return [];
  24794. }
  24795. object = Object(object);
  24796. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  24797. return propertyIsEnumerable.call(object, symbol);
  24798. });
  24799. };
  24800. /**
  24801. * Creates an array of the own and inherited enumerable symbols of `object`.
  24802. *
  24803. * @private
  24804. * @param {Object} object The object to query.
  24805. * @returns {Array} Returns the array of symbols.
  24806. */
  24807. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  24808. var result = [];
  24809. while (object) {
  24810. arrayPush(result, getSymbols(object));
  24811. object = getPrototype(object);
  24812. }
  24813. return result;
  24814. };
  24815. /**
  24816. * Gets the `toStringTag` of `value`.
  24817. *
  24818. * @private
  24819. * @param {*} value The value to query.
  24820. * @returns {string} Returns the `toStringTag`.
  24821. */
  24822. var getTag = baseGetTag;
  24823. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  24824. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  24825. (Map && getTag(new Map) != mapTag) ||
  24826. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  24827. (Set && getTag(new Set) != setTag) ||
  24828. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  24829. getTag = function(value) {
  24830. var result = baseGetTag(value),
  24831. Ctor = result == objectTag ? value.constructor : undefined,
  24832. ctorString = Ctor ? toSource(Ctor) : '';
  24833. if (ctorString) {
  24834. switch (ctorString) {
  24835. case dataViewCtorString: return dataViewTag;
  24836. case mapCtorString: return mapTag;
  24837. case promiseCtorString: return promiseTag;
  24838. case setCtorString: return setTag;
  24839. case weakMapCtorString: return weakMapTag;
  24840. }
  24841. }
  24842. return result;
  24843. };
  24844. }
  24845. /**
  24846. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  24847. *
  24848. * @private
  24849. * @param {number} start The start of the view.
  24850. * @param {number} end The end of the view.
  24851. * @param {Array} transforms The transformations to apply to the view.
  24852. * @returns {Object} Returns an object containing the `start` and `end`
  24853. * positions of the view.
  24854. */
  24855. function getView(start, end, transforms) {
  24856. var index = -1,
  24857. length = transforms.length;
  24858. while (++index < length) {
  24859. var data = transforms[index],
  24860. size = data.size;
  24861. switch (data.type) {
  24862. case 'drop': start += size; break;
  24863. case 'dropRight': end -= size; break;
  24864. case 'take': end = nativeMin(end, start + size); break;
  24865. case 'takeRight': start = nativeMax(start, end - size); break;
  24866. }
  24867. }
  24868. return { 'start': start, 'end': end };
  24869. }
  24870. /**
  24871. * Extracts wrapper details from the `source` body comment.
  24872. *
  24873. * @private
  24874. * @param {string} source The source to inspect.
  24875. * @returns {Array} Returns the wrapper details.
  24876. */
  24877. function getWrapDetails(source) {
  24878. var match = source.match(reWrapDetails);
  24879. return match ? match[1].split(reSplitDetails) : [];
  24880. }
  24881. /**
  24882. * Checks if `path` exists on `object`.
  24883. *
  24884. * @private
  24885. * @param {Object} object The object to query.
  24886. * @param {Array|string} path The path to check.
  24887. * @param {Function} hasFunc The function to check properties.
  24888. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  24889. */
  24890. function hasPath(object, path, hasFunc) {
  24891. path = castPath(path, object);
  24892. var index = -1,
  24893. length = path.length,
  24894. result = false;
  24895. while (++index < length) {
  24896. var key = toKey(path[index]);
  24897. if (!(result = object != null && hasFunc(object, key))) {
  24898. break;
  24899. }
  24900. object = object[key];
  24901. }
  24902. if (result || ++index != length) {
  24903. return result;
  24904. }
  24905. length = object == null ? 0 : object.length;
  24906. return !!length && isLength(length) && isIndex(key, length) &&
  24907. (isArray(object) || isArguments(object));
  24908. }
  24909. /**
  24910. * Initializes an array clone.
  24911. *
  24912. * @private
  24913. * @param {Array} array The array to clone.
  24914. * @returns {Array} Returns the initialized clone.
  24915. */
  24916. function initCloneArray(array) {
  24917. var length = array.length,
  24918. result = new array.constructor(length);
  24919. // Add properties assigned by `RegExp#exec`.
  24920. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  24921. result.index = array.index;
  24922. result.input = array.input;
  24923. }
  24924. return result;
  24925. }
  24926. /**
  24927. * Initializes an object clone.
  24928. *
  24929. * @private
  24930. * @param {Object} object The object to clone.
  24931. * @returns {Object} Returns the initialized clone.
  24932. */
  24933. function initCloneObject(object) {
  24934. return (typeof object.constructor == 'function' && !isPrototype(object))
  24935. ? baseCreate(getPrototype(object))
  24936. : {};
  24937. }
  24938. /**
  24939. * Initializes an object clone based on its `toStringTag`.
  24940. *
  24941. * **Note:** This function only supports cloning values with tags of
  24942. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24943. *
  24944. * @private
  24945. * @param {Object} object The object to clone.
  24946. * @param {string} tag The `toStringTag` of the object to clone.
  24947. * @param {boolean} [isDeep] Specify a deep clone.
  24948. * @returns {Object} Returns the initialized clone.
  24949. */
  24950. function initCloneByTag(object, tag, isDeep) {
  24951. var Ctor = object.constructor;
  24952. switch (tag) {
  24953. case arrayBufferTag:
  24954. return cloneArrayBuffer(object);
  24955. case boolTag:
  24956. case dateTag:
  24957. return new Ctor(+object);
  24958. case dataViewTag:
  24959. return cloneDataView(object, isDeep);
  24960. case float32Tag: case float64Tag:
  24961. case int8Tag: case int16Tag: case int32Tag:
  24962. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24963. return cloneTypedArray(object, isDeep);
  24964. case mapTag:
  24965. return new Ctor;
  24966. case numberTag:
  24967. case stringTag:
  24968. return new Ctor(object);
  24969. case regexpTag:
  24970. return cloneRegExp(object);
  24971. case setTag:
  24972. return new Ctor;
  24973. case symbolTag:
  24974. return cloneSymbol(object);
  24975. }
  24976. }
  24977. /**
  24978. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24979. *
  24980. * @private
  24981. * @param {string} source The source to modify.
  24982. * @returns {Array} details The details to insert.
  24983. * @returns {string} Returns the modified source.
  24984. */
  24985. function insertWrapDetails(source, details) {
  24986. var length = details.length;
  24987. if (!length) {
  24988. return source;
  24989. }
  24990. var lastIndex = length - 1;
  24991. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24992. details = details.join(length > 2 ? ', ' : ' ');
  24993. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24994. }
  24995. /**
  24996. * Checks if `value` is a flattenable `arguments` object or array.
  24997. *
  24998. * @private
  24999. * @param {*} value The value to check.
  25000. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  25001. */
  25002. function isFlattenable(value) {
  25003. return isArray(value) || isArguments(value) ||
  25004. !!(spreadableSymbol && value && value[spreadableSymbol]);
  25005. }
  25006. /**
  25007. * Checks if `value` is a valid array-like index.
  25008. *
  25009. * @private
  25010. * @param {*} value The value to check.
  25011. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  25012. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  25013. */
  25014. function isIndex(value, length) {
  25015. var type = typeof value;
  25016. length = length == null ? MAX_SAFE_INTEGER : length;
  25017. return !!length &&
  25018. (type == 'number' ||
  25019. (type != 'symbol' && reIsUint.test(value))) &&
  25020. (value > -1 && value % 1 == 0 && value < length);
  25021. }
  25022. /**
  25023. * Checks if the given arguments are from an iteratee call.
  25024. *
  25025. * @private
  25026. * @param {*} value The potential iteratee value argument.
  25027. * @param {*} index The potential iteratee index or key argument.
  25028. * @param {*} object The potential iteratee object argument.
  25029. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  25030. * else `false`.
  25031. */
  25032. function isIterateeCall(value, index, object) {
  25033. if (!isObject(object)) {
  25034. return false;
  25035. }
  25036. var type = typeof index;
  25037. if (type == 'number'
  25038. ? (isArrayLike(object) && isIndex(index, object.length))
  25039. : (type == 'string' && index in object)
  25040. ) {
  25041. return eq(object[index], value);
  25042. }
  25043. return false;
  25044. }
  25045. /**
  25046. * Checks if `value` is a property name and not a property path.
  25047. *
  25048. * @private
  25049. * @param {*} value The value to check.
  25050. * @param {Object} [object] The object to query keys on.
  25051. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  25052. */
  25053. function isKey(value, object) {
  25054. if (isArray(value)) {
  25055. return false;
  25056. }
  25057. var type = typeof value;
  25058. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  25059. value == null || isSymbol(value)) {
  25060. return true;
  25061. }
  25062. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  25063. (object != null && value in Object(object));
  25064. }
  25065. /**
  25066. * Checks if `value` is suitable for use as unique object key.
  25067. *
  25068. * @private
  25069. * @param {*} value The value to check.
  25070. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  25071. */
  25072. function isKeyable(value) {
  25073. var type = typeof value;
  25074. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  25075. ? (value !== '__proto__')
  25076. : (value === null);
  25077. }
  25078. /**
  25079. * Checks if `func` has a lazy counterpart.
  25080. *
  25081. * @private
  25082. * @param {Function} func The function to check.
  25083. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  25084. * else `false`.
  25085. */
  25086. function isLaziable(func) {
  25087. var funcName = getFuncName(func),
  25088. other = lodash[funcName];
  25089. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  25090. return false;
  25091. }
  25092. if (func === other) {
  25093. return true;
  25094. }
  25095. var data = getData(other);
  25096. return !!data && func === data[0];
  25097. }
  25098. /**
  25099. * Checks if `func` has its source masked.
  25100. *
  25101. * @private
  25102. * @param {Function} func The function to check.
  25103. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  25104. */
  25105. function isMasked(func) {
  25106. return !!maskSrcKey && (maskSrcKey in func);
  25107. }
  25108. /**
  25109. * Checks if `func` is capable of being masked.
  25110. *
  25111. * @private
  25112. * @param {*} value The value to check.
  25113. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  25114. */
  25115. var isMaskable = coreJsData ? isFunction : stubFalse;
  25116. /**
  25117. * Checks if `value` is likely a prototype object.
  25118. *
  25119. * @private
  25120. * @param {*} value The value to check.
  25121. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  25122. */
  25123. function isPrototype(value) {
  25124. var Ctor = value && value.constructor,
  25125. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  25126. return value === proto;
  25127. }
  25128. /**
  25129. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  25130. *
  25131. * @private
  25132. * @param {*} value The value to check.
  25133. * @returns {boolean} Returns `true` if `value` if suitable for strict
  25134. * equality comparisons, else `false`.
  25135. */
  25136. function isStrictComparable(value) {
  25137. return value === value && !isObject(value);
  25138. }
  25139. /**
  25140. * A specialized version of `matchesProperty` for source values suitable
  25141. * for strict equality comparisons, i.e. `===`.
  25142. *
  25143. * @private
  25144. * @param {string} key The key of the property to get.
  25145. * @param {*} srcValue The value to match.
  25146. * @returns {Function} Returns the new spec function.
  25147. */
  25148. function matchesStrictComparable(key, srcValue) {
  25149. return function(object) {
  25150. if (object == null) {
  25151. return false;
  25152. }
  25153. return object[key] === srcValue &&
  25154. (srcValue !== undefined || (key in Object(object)));
  25155. };
  25156. }
  25157. /**
  25158. * A specialized version of `_.memoize` which clears the memoized function's
  25159. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  25160. *
  25161. * @private
  25162. * @param {Function} func The function to have its output memoized.
  25163. * @returns {Function} Returns the new memoized function.
  25164. */
  25165. function memoizeCapped(func) {
  25166. var result = memoize(func, function(key) {
  25167. if (cache.size === MAX_MEMOIZE_SIZE) {
  25168. cache.clear();
  25169. }
  25170. return key;
  25171. });
  25172. var cache = result.cache;
  25173. return result;
  25174. }
  25175. /**
  25176. * Merges the function metadata of `source` into `data`.
  25177. *
  25178. * Merging metadata reduces the number of wrappers used to invoke a function.
  25179. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  25180. * may be applied regardless of execution order. Methods like `_.ary` and
  25181. * `_.rearg` modify function arguments, making the order in which they are
  25182. * executed important, preventing the merging of metadata. However, we make
  25183. * an exception for a safe combined case where curried functions have `_.ary`
  25184. * and or `_.rearg` applied.
  25185. *
  25186. * @private
  25187. * @param {Array} data The destination metadata.
  25188. * @param {Array} source The source metadata.
  25189. * @returns {Array} Returns `data`.
  25190. */
  25191. function mergeData(data, source) {
  25192. var bitmask = data[1],
  25193. srcBitmask = source[1],
  25194. newBitmask = bitmask | srcBitmask,
  25195. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  25196. var isCombo =
  25197. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  25198. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  25199. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  25200. // Exit early if metadata can't be merged.
  25201. if (!(isCommon || isCombo)) {
  25202. return data;
  25203. }
  25204. // Use source `thisArg` if available.
  25205. if (srcBitmask & WRAP_BIND_FLAG) {
  25206. data[2] = source[2];
  25207. // Set when currying a bound function.
  25208. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  25209. }
  25210. // Compose partial arguments.
  25211. var value = source[3];
  25212. if (value) {
  25213. var partials = data[3];
  25214. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  25215. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  25216. }
  25217. // Compose partial right arguments.
  25218. value = source[5];
  25219. if (value) {
  25220. partials = data[5];
  25221. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  25222. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  25223. }
  25224. // Use source `argPos` if available.
  25225. value = source[7];
  25226. if (value) {
  25227. data[7] = value;
  25228. }
  25229. // Use source `ary` if it's smaller.
  25230. if (srcBitmask & WRAP_ARY_FLAG) {
  25231. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  25232. }
  25233. // Use source `arity` if one is not provided.
  25234. if (data[9] == null) {
  25235. data[9] = source[9];
  25236. }
  25237. // Use source `func` and merge bitmasks.
  25238. data[0] = source[0];
  25239. data[1] = newBitmask;
  25240. return data;
  25241. }
  25242. /**
  25243. * This function is like
  25244. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  25245. * except that it includes inherited enumerable properties.
  25246. *
  25247. * @private
  25248. * @param {Object} object The object to query.
  25249. * @returns {Array} Returns the array of property names.
  25250. */
  25251. function nativeKeysIn(object) {
  25252. var result = [];
  25253. if (object != null) {
  25254. for (var key in Object(object)) {
  25255. result.push(key);
  25256. }
  25257. }
  25258. return result;
  25259. }
  25260. /**
  25261. * Converts `value` to a string using `Object.prototype.toString`.
  25262. *
  25263. * @private
  25264. * @param {*} value The value to convert.
  25265. * @returns {string} Returns the converted string.
  25266. */
  25267. function objectToString(value) {
  25268. return nativeObjectToString.call(value);
  25269. }
  25270. /**
  25271. * A specialized version of `baseRest` which transforms the rest array.
  25272. *
  25273. * @private
  25274. * @param {Function} func The function to apply a rest parameter to.
  25275. * @param {number} [start=func.length-1] The start position of the rest parameter.
  25276. * @param {Function} transform The rest array transform.
  25277. * @returns {Function} Returns the new function.
  25278. */
  25279. function overRest(func, start, transform) {
  25280. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  25281. return function() {
  25282. var args = arguments,
  25283. index = -1,
  25284. length = nativeMax(args.length - start, 0),
  25285. array = Array(length);
  25286. while (++index < length) {
  25287. array[index] = args[start + index];
  25288. }
  25289. index = -1;
  25290. var otherArgs = Array(start + 1);
  25291. while (++index < start) {
  25292. otherArgs[index] = args[index];
  25293. }
  25294. otherArgs[start] = transform(array);
  25295. return apply(func, this, otherArgs);
  25296. };
  25297. }
  25298. /**
  25299. * Gets the parent value at `path` of `object`.
  25300. *
  25301. * @private
  25302. * @param {Object} object The object to query.
  25303. * @param {Array} path The path to get the parent value of.
  25304. * @returns {*} Returns the parent value.
  25305. */
  25306. function parent(object, path) {
  25307. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  25308. }
  25309. /**
  25310. * Reorder `array` according to the specified indexes where the element at
  25311. * the first index is assigned as the first element, the element at
  25312. * the second index is assigned as the second element, and so on.
  25313. *
  25314. * @private
  25315. * @param {Array} array The array to reorder.
  25316. * @param {Array} indexes The arranged array indexes.
  25317. * @returns {Array} Returns `array`.
  25318. */
  25319. function reorder(array, indexes) {
  25320. var arrLength = array.length,
  25321. length = nativeMin(indexes.length, arrLength),
  25322. oldArray = copyArray(array);
  25323. while (length--) {
  25324. var index = indexes[length];
  25325. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  25326. }
  25327. return array;
  25328. }
  25329. /**
  25330. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  25331. *
  25332. * @private
  25333. * @param {Object} object The object to query.
  25334. * @param {string} key The key of the property to get.
  25335. * @returns {*} Returns the property value.
  25336. */
  25337. function safeGet(object, key) {
  25338. if (key === 'constructor' && typeof object[key] === 'function') {
  25339. return;
  25340. }
  25341. if (key == '__proto__') {
  25342. return;
  25343. }
  25344. return object[key];
  25345. }
  25346. /**
  25347. * Sets metadata for `func`.
  25348. *
  25349. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  25350. * period of time, it will trip its breaker and transition to an identity
  25351. * function to avoid garbage collection pauses in V8. See
  25352. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  25353. * for more details.
  25354. *
  25355. * @private
  25356. * @param {Function} func The function to associate metadata with.
  25357. * @param {*} data The metadata.
  25358. * @returns {Function} Returns `func`.
  25359. */
  25360. var setData = shortOut(baseSetData);
  25361. /**
  25362. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  25363. *
  25364. * @private
  25365. * @param {Function} func The function to delay.
  25366. * @param {number} wait The number of milliseconds to delay invocation.
  25367. * @returns {number|Object} Returns the timer id or timeout object.
  25368. */
  25369. var setTimeout = ctxSetTimeout || function(func, wait) {
  25370. return root.setTimeout(func, wait);
  25371. };
  25372. /**
  25373. * Sets the `toString` method of `func` to return `string`.
  25374. *
  25375. * @private
  25376. * @param {Function} func The function to modify.
  25377. * @param {Function} string The `toString` result.
  25378. * @returns {Function} Returns `func`.
  25379. */
  25380. var setToString = shortOut(baseSetToString);
  25381. /**
  25382. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  25383. * with wrapper details in a comment at the top of the source body.
  25384. *
  25385. * @private
  25386. * @param {Function} wrapper The function to modify.
  25387. * @param {Function} reference The reference function.
  25388. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25389. * @returns {Function} Returns `wrapper`.
  25390. */
  25391. function setWrapToString(wrapper, reference, bitmask) {
  25392. var source = (reference + '');
  25393. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  25394. }
  25395. /**
  25396. * Creates a function that'll short out and invoke `identity` instead
  25397. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  25398. * milliseconds.
  25399. *
  25400. * @private
  25401. * @param {Function} func The function to restrict.
  25402. * @returns {Function} Returns the new shortable function.
  25403. */
  25404. function shortOut(func) {
  25405. var count = 0,
  25406. lastCalled = 0;
  25407. return function() {
  25408. var stamp = nativeNow(),
  25409. remaining = HOT_SPAN - (stamp - lastCalled);
  25410. lastCalled = stamp;
  25411. if (remaining > 0) {
  25412. if (++count >= HOT_COUNT) {
  25413. return arguments[0];
  25414. }
  25415. } else {
  25416. count = 0;
  25417. }
  25418. return func.apply(undefined, arguments);
  25419. };
  25420. }
  25421. /**
  25422. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  25423. *
  25424. * @private
  25425. * @param {Array} array The array to shuffle.
  25426. * @param {number} [size=array.length] The size of `array`.
  25427. * @returns {Array} Returns `array`.
  25428. */
  25429. function shuffleSelf(array, size) {
  25430. var index = -1,
  25431. length = array.length,
  25432. lastIndex = length - 1;
  25433. size = size === undefined ? length : size;
  25434. while (++index < size) {
  25435. var rand = baseRandom(index, lastIndex),
  25436. value = array[rand];
  25437. array[rand] = array[index];
  25438. array[index] = value;
  25439. }
  25440. array.length = size;
  25441. return array;
  25442. }
  25443. /**
  25444. * Converts `string` to a property path array.
  25445. *
  25446. * @private
  25447. * @param {string} string The string to convert.
  25448. * @returns {Array} Returns the property path array.
  25449. */
  25450. var stringToPath = memoizeCapped(function(string) {
  25451. var result = [];
  25452. if (string.charCodeAt(0) === 46 /* . */) {
  25453. result.push('');
  25454. }
  25455. string.replace(rePropName, function(match, number, quote, subString) {
  25456. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  25457. });
  25458. return result;
  25459. });
  25460. /**
  25461. * Converts `value` to a string key if it's not a string or symbol.
  25462. *
  25463. * @private
  25464. * @param {*} value The value to inspect.
  25465. * @returns {string|symbol} Returns the key.
  25466. */
  25467. function toKey(value) {
  25468. if (typeof value == 'string' || isSymbol(value)) {
  25469. return value;
  25470. }
  25471. var result = (value + '');
  25472. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  25473. }
  25474. /**
  25475. * Converts `func` to its source code.
  25476. *
  25477. * @private
  25478. * @param {Function} func The function to convert.
  25479. * @returns {string} Returns the source code.
  25480. */
  25481. function toSource(func) {
  25482. if (func != null) {
  25483. try {
  25484. return funcToString.call(func);
  25485. } catch (e) {}
  25486. try {
  25487. return (func + '');
  25488. } catch (e) {}
  25489. }
  25490. return '';
  25491. }
  25492. /**
  25493. * Updates wrapper `details` based on `bitmask` flags.
  25494. *
  25495. * @private
  25496. * @returns {Array} details The details to modify.
  25497. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25498. * @returns {Array} Returns `details`.
  25499. */
  25500. function updateWrapDetails(details, bitmask) {
  25501. arrayEach(wrapFlags, function(pair) {
  25502. var value = '_.' + pair[0];
  25503. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  25504. details.push(value);
  25505. }
  25506. });
  25507. return details.sort();
  25508. }
  25509. /**
  25510. * Creates a clone of `wrapper`.
  25511. *
  25512. * @private
  25513. * @param {Object} wrapper The wrapper to clone.
  25514. * @returns {Object} Returns the cloned wrapper.
  25515. */
  25516. function wrapperClone(wrapper) {
  25517. if (wrapper instanceof LazyWrapper) {
  25518. return wrapper.clone();
  25519. }
  25520. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  25521. result.__actions__ = copyArray(wrapper.__actions__);
  25522. result.__index__ = wrapper.__index__;
  25523. result.__values__ = wrapper.__values__;
  25524. return result;
  25525. }
  25526. /*------------------------------------------------------------------------*/
  25527. /**
  25528. * Creates an array of elements split into groups the length of `size`.
  25529. * If `array` can't be split evenly, the final chunk will be the remaining
  25530. * elements.
  25531. *
  25532. * @static
  25533. * @memberOf _
  25534. * @since 3.0.0
  25535. * @category Array
  25536. * @param {Array} array The array to process.
  25537. * @param {number} [size=1] The length of each chunk
  25538. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25539. * @returns {Array} Returns the new array of chunks.
  25540. * @example
  25541. *
  25542. * _.chunk(['a', 'b', 'c', 'd'], 2);
  25543. * // => [['a', 'b'], ['c', 'd']]
  25544. *
  25545. * _.chunk(['a', 'b', 'c', 'd'], 3);
  25546. * // => [['a', 'b', 'c'], ['d']]
  25547. */
  25548. function chunk(array, size, guard) {
  25549. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  25550. size = 1;
  25551. } else {
  25552. size = nativeMax(toInteger(size), 0);
  25553. }
  25554. var length = array == null ? 0 : array.length;
  25555. if (!length || size < 1) {
  25556. return [];
  25557. }
  25558. var index = 0,
  25559. resIndex = 0,
  25560. result = Array(nativeCeil(length / size));
  25561. while (index < length) {
  25562. result[resIndex++] = baseSlice(array, index, (index += size));
  25563. }
  25564. return result;
  25565. }
  25566. /**
  25567. * Creates an array with all falsey values removed. The values `false`, `null`,
  25568. * `0`, `""`, `undefined`, and `NaN` are falsey.
  25569. *
  25570. * @static
  25571. * @memberOf _
  25572. * @since 0.1.0
  25573. * @category Array
  25574. * @param {Array} array The array to compact.
  25575. * @returns {Array} Returns the new array of filtered values.
  25576. * @example
  25577. *
  25578. * _.compact([0, 1, false, 2, '', 3]);
  25579. * // => [1, 2, 3]
  25580. */
  25581. function compact(array) {
  25582. var index = -1,
  25583. length = array == null ? 0 : array.length,
  25584. resIndex = 0,
  25585. result = [];
  25586. while (++index < length) {
  25587. var value = array[index];
  25588. if (value) {
  25589. result[resIndex++] = value;
  25590. }
  25591. }
  25592. return result;
  25593. }
  25594. /**
  25595. * Creates a new array concatenating `array` with any additional arrays
  25596. * and/or values.
  25597. *
  25598. * @static
  25599. * @memberOf _
  25600. * @since 4.0.0
  25601. * @category Array
  25602. * @param {Array} array The array to concatenate.
  25603. * @param {...*} [values] The values to concatenate.
  25604. * @returns {Array} Returns the new concatenated array.
  25605. * @example
  25606. *
  25607. * var array = [1];
  25608. * var other = _.concat(array, 2, [3], [[4]]);
  25609. *
  25610. * console.log(other);
  25611. * // => [1, 2, 3, [4]]
  25612. *
  25613. * console.log(array);
  25614. * // => [1]
  25615. */
  25616. function concat() {
  25617. var length = arguments.length;
  25618. if (!length) {
  25619. return [];
  25620. }
  25621. var args = Array(length - 1),
  25622. array = arguments[0],
  25623. index = length;
  25624. while (index--) {
  25625. args[index - 1] = arguments[index];
  25626. }
  25627. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  25628. }
  25629. /**
  25630. * Creates an array of `array` values not included in the other given arrays
  25631. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25632. * for equality comparisons. The order and references of result values are
  25633. * determined by the first array.
  25634. *
  25635. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  25636. *
  25637. * @static
  25638. * @memberOf _
  25639. * @since 0.1.0
  25640. * @category Array
  25641. * @param {Array} array The array to inspect.
  25642. * @param {...Array} [values] The values to exclude.
  25643. * @returns {Array} Returns the new array of filtered values.
  25644. * @see _.without, _.xor
  25645. * @example
  25646. *
  25647. * _.difference([2, 1], [2, 3]);
  25648. * // => [1]
  25649. */
  25650. var difference = baseRest(function(array, values) {
  25651. return isArrayLikeObject(array)
  25652. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  25653. : [];
  25654. });
  25655. /**
  25656. * This method is like `_.difference` except that it accepts `iteratee` which
  25657. * is invoked for each element of `array` and `values` to generate the criterion
  25658. * by which they're compared. The order and references of result values are
  25659. * determined by the first array. The iteratee is invoked with one argument:
  25660. * (value).
  25661. *
  25662. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  25663. *
  25664. * @static
  25665. * @memberOf _
  25666. * @since 4.0.0
  25667. * @category Array
  25668. * @param {Array} array The array to inspect.
  25669. * @param {...Array} [values] The values to exclude.
  25670. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25671. * @returns {Array} Returns the new array of filtered values.
  25672. * @example
  25673. *
  25674. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25675. * // => [1.2]
  25676. *
  25677. * // The `_.property` iteratee shorthand.
  25678. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  25679. * // => [{ 'x': 2 }]
  25680. */
  25681. var differenceBy = baseRest(function(array, values) {
  25682. var iteratee = last(values);
  25683. if (isArrayLikeObject(iteratee)) {
  25684. iteratee = undefined;
  25685. }
  25686. return isArrayLikeObject(array)
  25687. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  25688. : [];
  25689. });
  25690. /**
  25691. * This method is like `_.difference` except that it accepts `comparator`
  25692. * which is invoked to compare elements of `array` to `values`. The order and
  25693. * references of result values are determined by the first array. The comparator
  25694. * is invoked with two arguments: (arrVal, othVal).
  25695. *
  25696. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  25697. *
  25698. * @static
  25699. * @memberOf _
  25700. * @since 4.0.0
  25701. * @category Array
  25702. * @param {Array} array The array to inspect.
  25703. * @param {...Array} [values] The values to exclude.
  25704. * @param {Function} [comparator] The comparator invoked per element.
  25705. * @returns {Array} Returns the new array of filtered values.
  25706. * @example
  25707. *
  25708. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25709. *
  25710. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  25711. * // => [{ 'x': 2, 'y': 1 }]
  25712. */
  25713. var differenceWith = baseRest(function(array, values) {
  25714. var comparator = last(values);
  25715. if (isArrayLikeObject(comparator)) {
  25716. comparator = undefined;
  25717. }
  25718. return isArrayLikeObject(array)
  25719. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  25720. : [];
  25721. });
  25722. /**
  25723. * Creates a slice of `array` with `n` elements dropped from the beginning.
  25724. *
  25725. * @static
  25726. * @memberOf _
  25727. * @since 0.5.0
  25728. * @category Array
  25729. * @param {Array} array The array to query.
  25730. * @param {number} [n=1] The number of elements to drop.
  25731. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25732. * @returns {Array} Returns the slice of `array`.
  25733. * @example
  25734. *
  25735. * _.drop([1, 2, 3]);
  25736. * // => [2, 3]
  25737. *
  25738. * _.drop([1, 2, 3], 2);
  25739. * // => [3]
  25740. *
  25741. * _.drop([1, 2, 3], 5);
  25742. * // => []
  25743. *
  25744. * _.drop([1, 2, 3], 0);
  25745. * // => [1, 2, 3]
  25746. */
  25747. function drop(array, n, guard) {
  25748. var length = array == null ? 0 : array.length;
  25749. if (!length) {
  25750. return [];
  25751. }
  25752. n = (guard || n === undefined) ? 1 : toInteger(n);
  25753. return baseSlice(array, n < 0 ? 0 : n, length);
  25754. }
  25755. /**
  25756. * Creates a slice of `array` with `n` elements dropped from the end.
  25757. *
  25758. * @static
  25759. * @memberOf _
  25760. * @since 3.0.0
  25761. * @category Array
  25762. * @param {Array} array The array to query.
  25763. * @param {number} [n=1] The number of elements to drop.
  25764. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25765. * @returns {Array} Returns the slice of `array`.
  25766. * @example
  25767. *
  25768. * _.dropRight([1, 2, 3]);
  25769. * // => [1, 2]
  25770. *
  25771. * _.dropRight([1, 2, 3], 2);
  25772. * // => [1]
  25773. *
  25774. * _.dropRight([1, 2, 3], 5);
  25775. * // => []
  25776. *
  25777. * _.dropRight([1, 2, 3], 0);
  25778. * // => [1, 2, 3]
  25779. */
  25780. function dropRight(array, n, guard) {
  25781. var length = array == null ? 0 : array.length;
  25782. if (!length) {
  25783. return [];
  25784. }
  25785. n = (guard || n === undefined) ? 1 : toInteger(n);
  25786. n = length - n;
  25787. return baseSlice(array, 0, n < 0 ? 0 : n);
  25788. }
  25789. /**
  25790. * Creates a slice of `array` excluding elements dropped from the end.
  25791. * Elements are dropped until `predicate` returns falsey. The predicate is
  25792. * invoked with three arguments: (value, index, array).
  25793. *
  25794. * @static
  25795. * @memberOf _
  25796. * @since 3.0.0
  25797. * @category Array
  25798. * @param {Array} array The array to query.
  25799. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25800. * @returns {Array} Returns the slice of `array`.
  25801. * @example
  25802. *
  25803. * var users = [
  25804. * { 'user': 'barney', 'active': true },
  25805. * { 'user': 'fred', 'active': false },
  25806. * { 'user': 'pebbles', 'active': false }
  25807. * ];
  25808. *
  25809. * _.dropRightWhile(users, function(o) { return !o.active; });
  25810. * // => objects for ['barney']
  25811. *
  25812. * // The `_.matches` iteratee shorthand.
  25813. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  25814. * // => objects for ['barney', 'fred']
  25815. *
  25816. * // The `_.matchesProperty` iteratee shorthand.
  25817. * _.dropRightWhile(users, ['active', false]);
  25818. * // => objects for ['barney']
  25819. *
  25820. * // The `_.property` iteratee shorthand.
  25821. * _.dropRightWhile(users, 'active');
  25822. * // => objects for ['barney', 'fred', 'pebbles']
  25823. */
  25824. function dropRightWhile(array, predicate) {
  25825. return (array && array.length)
  25826. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  25827. : [];
  25828. }
  25829. /**
  25830. * Creates a slice of `array` excluding elements dropped from the beginning.
  25831. * Elements are dropped until `predicate` returns falsey. The predicate is
  25832. * invoked with three arguments: (value, index, array).
  25833. *
  25834. * @static
  25835. * @memberOf _
  25836. * @since 3.0.0
  25837. * @category Array
  25838. * @param {Array} array The array to query.
  25839. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25840. * @returns {Array} Returns the slice of `array`.
  25841. * @example
  25842. *
  25843. * var users = [
  25844. * { 'user': 'barney', 'active': false },
  25845. * { 'user': 'fred', 'active': false },
  25846. * { 'user': 'pebbles', 'active': true }
  25847. * ];
  25848. *
  25849. * _.dropWhile(users, function(o) { return !o.active; });
  25850. * // => objects for ['pebbles']
  25851. *
  25852. * // The `_.matches` iteratee shorthand.
  25853. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  25854. * // => objects for ['fred', 'pebbles']
  25855. *
  25856. * // The `_.matchesProperty` iteratee shorthand.
  25857. * _.dropWhile(users, ['active', false]);
  25858. * // => objects for ['pebbles']
  25859. *
  25860. * // The `_.property` iteratee shorthand.
  25861. * _.dropWhile(users, 'active');
  25862. * // => objects for ['barney', 'fred', 'pebbles']
  25863. */
  25864. function dropWhile(array, predicate) {
  25865. return (array && array.length)
  25866. ? baseWhile(array, getIteratee(predicate, 3), true)
  25867. : [];
  25868. }
  25869. /**
  25870. * Fills elements of `array` with `value` from `start` up to, but not
  25871. * including, `end`.
  25872. *
  25873. * **Note:** This method mutates `array`.
  25874. *
  25875. * @static
  25876. * @memberOf _
  25877. * @since 3.2.0
  25878. * @category Array
  25879. * @param {Array} array The array to fill.
  25880. * @param {*} value The value to fill `array` with.
  25881. * @param {number} [start=0] The start position.
  25882. * @param {number} [end=array.length] The end position.
  25883. * @returns {Array} Returns `array`.
  25884. * @example
  25885. *
  25886. * var array = [1, 2, 3];
  25887. *
  25888. * _.fill(array, 'a');
  25889. * console.log(array);
  25890. * // => ['a', 'a', 'a']
  25891. *
  25892. * _.fill(Array(3), 2);
  25893. * // => [2, 2, 2]
  25894. *
  25895. * _.fill([4, 6, 8, 10], '*', 1, 3);
  25896. * // => [4, '*', '*', 10]
  25897. */
  25898. function fill(array, value, start, end) {
  25899. var length = array == null ? 0 : array.length;
  25900. if (!length) {
  25901. return [];
  25902. }
  25903. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  25904. start = 0;
  25905. end = length;
  25906. }
  25907. return baseFill(array, value, start, end);
  25908. }
  25909. /**
  25910. * This method is like `_.find` except that it returns the index of the first
  25911. * element `predicate` returns truthy for instead of the element itself.
  25912. *
  25913. * @static
  25914. * @memberOf _
  25915. * @since 1.1.0
  25916. * @category Array
  25917. * @param {Array} array The array to inspect.
  25918. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25919. * @param {number} [fromIndex=0] The index to search from.
  25920. * @returns {number} Returns the index of the found element, else `-1`.
  25921. * @example
  25922. *
  25923. * var users = [
  25924. * { 'user': 'barney', 'active': false },
  25925. * { 'user': 'fred', 'active': false },
  25926. * { 'user': 'pebbles', 'active': true }
  25927. * ];
  25928. *
  25929. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  25930. * // => 0
  25931. *
  25932. * // The `_.matches` iteratee shorthand.
  25933. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25934. * // => 1
  25935. *
  25936. * // The `_.matchesProperty` iteratee shorthand.
  25937. * _.findIndex(users, ['active', false]);
  25938. * // => 0
  25939. *
  25940. * // The `_.property` iteratee shorthand.
  25941. * _.findIndex(users, 'active');
  25942. * // => 2
  25943. */
  25944. function findIndex(array, predicate, fromIndex) {
  25945. var length = array == null ? 0 : array.length;
  25946. if (!length) {
  25947. return -1;
  25948. }
  25949. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25950. if (index < 0) {
  25951. index = nativeMax(length + index, 0);
  25952. }
  25953. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25954. }
  25955. /**
  25956. * This method is like `_.findIndex` except that it iterates over elements
  25957. * of `collection` from right to left.
  25958. *
  25959. * @static
  25960. * @memberOf _
  25961. * @since 2.0.0
  25962. * @category Array
  25963. * @param {Array} array The array to inspect.
  25964. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25965. * @param {number} [fromIndex=array.length-1] The index to search from.
  25966. * @returns {number} Returns the index of the found element, else `-1`.
  25967. * @example
  25968. *
  25969. * var users = [
  25970. * { 'user': 'barney', 'active': true },
  25971. * { 'user': 'fred', 'active': false },
  25972. * { 'user': 'pebbles', 'active': false }
  25973. * ];
  25974. *
  25975. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25976. * // => 2
  25977. *
  25978. * // The `_.matches` iteratee shorthand.
  25979. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25980. * // => 0
  25981. *
  25982. * // The `_.matchesProperty` iteratee shorthand.
  25983. * _.findLastIndex(users, ['active', false]);
  25984. * // => 2
  25985. *
  25986. * // The `_.property` iteratee shorthand.
  25987. * _.findLastIndex(users, 'active');
  25988. * // => 0
  25989. */
  25990. function findLastIndex(array, predicate, fromIndex) {
  25991. var length = array == null ? 0 : array.length;
  25992. if (!length) {
  25993. return -1;
  25994. }
  25995. var index = length - 1;
  25996. if (fromIndex !== undefined) {
  25997. index = toInteger(fromIndex);
  25998. index = fromIndex < 0
  25999. ? nativeMax(length + index, 0)
  26000. : nativeMin(index, length - 1);
  26001. }
  26002. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  26003. }
  26004. /**
  26005. * Flattens `array` a single level deep.
  26006. *
  26007. * @static
  26008. * @memberOf _
  26009. * @since 0.1.0
  26010. * @category Array
  26011. * @param {Array} array The array to flatten.
  26012. * @returns {Array} Returns the new flattened array.
  26013. * @example
  26014. *
  26015. * _.flatten([1, [2, [3, [4]], 5]]);
  26016. * // => [1, 2, [3, [4]], 5]
  26017. */
  26018. function flatten(array) {
  26019. var length = array == null ? 0 : array.length;
  26020. return length ? baseFlatten(array, 1) : [];
  26021. }
  26022. /**
  26023. * Recursively flattens `array`.
  26024. *
  26025. * @static
  26026. * @memberOf _
  26027. * @since 3.0.0
  26028. * @category Array
  26029. * @param {Array} array The array to flatten.
  26030. * @returns {Array} Returns the new flattened array.
  26031. * @example
  26032. *
  26033. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  26034. * // => [1, 2, 3, 4, 5]
  26035. */
  26036. function flattenDeep(array) {
  26037. var length = array == null ? 0 : array.length;
  26038. return length ? baseFlatten(array, INFINITY) : [];
  26039. }
  26040. /**
  26041. * Recursively flatten `array` up to `depth` times.
  26042. *
  26043. * @static
  26044. * @memberOf _
  26045. * @since 4.4.0
  26046. * @category Array
  26047. * @param {Array} array The array to flatten.
  26048. * @param {number} [depth=1] The maximum recursion depth.
  26049. * @returns {Array} Returns the new flattened array.
  26050. * @example
  26051. *
  26052. * var array = [1, [2, [3, [4]], 5]];
  26053. *
  26054. * _.flattenDepth(array, 1);
  26055. * // => [1, 2, [3, [4]], 5]
  26056. *
  26057. * _.flattenDepth(array, 2);
  26058. * // => [1, 2, 3, [4], 5]
  26059. */
  26060. function flattenDepth(array, depth) {
  26061. var length = array == null ? 0 : array.length;
  26062. if (!length) {
  26063. return [];
  26064. }
  26065. depth = depth === undefined ? 1 : toInteger(depth);
  26066. return baseFlatten(array, depth);
  26067. }
  26068. /**
  26069. * The inverse of `_.toPairs`; this method returns an object composed
  26070. * from key-value `pairs`.
  26071. *
  26072. * @static
  26073. * @memberOf _
  26074. * @since 4.0.0
  26075. * @category Array
  26076. * @param {Array} pairs The key-value pairs.
  26077. * @returns {Object} Returns the new object.
  26078. * @example
  26079. *
  26080. * _.fromPairs([['a', 1], ['b', 2]]);
  26081. * // => { 'a': 1, 'b': 2 }
  26082. */
  26083. function fromPairs(pairs) {
  26084. var index = -1,
  26085. length = pairs == null ? 0 : pairs.length,
  26086. result = {};
  26087. while (++index < length) {
  26088. var pair = pairs[index];
  26089. result[pair[0]] = pair[1];
  26090. }
  26091. return result;
  26092. }
  26093. /**
  26094. * Gets the first element of `array`.
  26095. *
  26096. * @static
  26097. * @memberOf _
  26098. * @since 0.1.0
  26099. * @alias first
  26100. * @category Array
  26101. * @param {Array} array The array to query.
  26102. * @returns {*} Returns the first element of `array`.
  26103. * @example
  26104. *
  26105. * _.head([1, 2, 3]);
  26106. * // => 1
  26107. *
  26108. * _.head([]);
  26109. * // => undefined
  26110. */
  26111. function head(array) {
  26112. return (array && array.length) ? array[0] : undefined;
  26113. }
  26114. /**
  26115. * Gets the index at which the first occurrence of `value` is found in `array`
  26116. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26117. * for equality comparisons. If `fromIndex` is negative, it's used as the
  26118. * offset from the end of `array`.
  26119. *
  26120. * @static
  26121. * @memberOf _
  26122. * @since 0.1.0
  26123. * @category Array
  26124. * @param {Array} array The array to inspect.
  26125. * @param {*} value The value to search for.
  26126. * @param {number} [fromIndex=0] The index to search from.
  26127. * @returns {number} Returns the index of the matched value, else `-1`.
  26128. * @example
  26129. *
  26130. * _.indexOf([1, 2, 1, 2], 2);
  26131. * // => 1
  26132. *
  26133. * // Search from the `fromIndex`.
  26134. * _.indexOf([1, 2, 1, 2], 2, 2);
  26135. * // => 3
  26136. */
  26137. function indexOf(array, value, fromIndex) {
  26138. var length = array == null ? 0 : array.length;
  26139. if (!length) {
  26140. return -1;
  26141. }
  26142. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  26143. if (index < 0) {
  26144. index = nativeMax(length + index, 0);
  26145. }
  26146. return baseIndexOf(array, value, index);
  26147. }
  26148. /**
  26149. * Gets all but the last element of `array`.
  26150. *
  26151. * @static
  26152. * @memberOf _
  26153. * @since 0.1.0
  26154. * @category Array
  26155. * @param {Array} array The array to query.
  26156. * @returns {Array} Returns the slice of `array`.
  26157. * @example
  26158. *
  26159. * _.initial([1, 2, 3]);
  26160. * // => [1, 2]
  26161. */
  26162. function initial(array) {
  26163. var length = array == null ? 0 : array.length;
  26164. return length ? baseSlice(array, 0, -1) : [];
  26165. }
  26166. /**
  26167. * Creates an array of unique values that are included in all given arrays
  26168. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26169. * for equality comparisons. The order and references of result values are
  26170. * determined by the first array.
  26171. *
  26172. * @static
  26173. * @memberOf _
  26174. * @since 0.1.0
  26175. * @category Array
  26176. * @param {...Array} [arrays] The arrays to inspect.
  26177. * @returns {Array} Returns the new array of intersecting values.
  26178. * @example
  26179. *
  26180. * _.intersection([2, 1], [2, 3]);
  26181. * // => [2]
  26182. */
  26183. var intersection = baseRest(function(arrays) {
  26184. var mapped = arrayMap(arrays, castArrayLikeObject);
  26185. return (mapped.length && mapped[0] === arrays[0])
  26186. ? baseIntersection(mapped)
  26187. : [];
  26188. });
  26189. /**
  26190. * This method is like `_.intersection` except that it accepts `iteratee`
  26191. * which is invoked for each element of each `arrays` to generate the criterion
  26192. * by which they're compared. The order and references of result values are
  26193. * determined by the first array. The iteratee is invoked with one argument:
  26194. * (value).
  26195. *
  26196. * @static
  26197. * @memberOf _
  26198. * @since 4.0.0
  26199. * @category Array
  26200. * @param {...Array} [arrays] The arrays to inspect.
  26201. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26202. * @returns {Array} Returns the new array of intersecting values.
  26203. * @example
  26204. *
  26205. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26206. * // => [2.1]
  26207. *
  26208. * // The `_.property` iteratee shorthand.
  26209. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26210. * // => [{ 'x': 1 }]
  26211. */
  26212. var intersectionBy = baseRest(function(arrays) {
  26213. var iteratee = last(arrays),
  26214. mapped = arrayMap(arrays, castArrayLikeObject);
  26215. if (iteratee === last(mapped)) {
  26216. iteratee = undefined;
  26217. } else {
  26218. mapped.pop();
  26219. }
  26220. return (mapped.length && mapped[0] === arrays[0])
  26221. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  26222. : [];
  26223. });
  26224. /**
  26225. * This method is like `_.intersection` except that it accepts `comparator`
  26226. * which is invoked to compare elements of `arrays`. The order and references
  26227. * of result values are determined by the first array. The comparator is
  26228. * invoked with two arguments: (arrVal, othVal).
  26229. *
  26230. * @static
  26231. * @memberOf _
  26232. * @since 4.0.0
  26233. * @category Array
  26234. * @param {...Array} [arrays] The arrays to inspect.
  26235. * @param {Function} [comparator] The comparator invoked per element.
  26236. * @returns {Array} Returns the new array of intersecting values.
  26237. * @example
  26238. *
  26239. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26240. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26241. *
  26242. * _.intersectionWith(objects, others, _.isEqual);
  26243. * // => [{ 'x': 1, 'y': 2 }]
  26244. */
  26245. var intersectionWith = baseRest(function(arrays) {
  26246. var comparator = last(arrays),
  26247. mapped = arrayMap(arrays, castArrayLikeObject);
  26248. comparator = typeof comparator == 'function' ? comparator : undefined;
  26249. if (comparator) {
  26250. mapped.pop();
  26251. }
  26252. return (mapped.length && mapped[0] === arrays[0])
  26253. ? baseIntersection(mapped, undefined, comparator)
  26254. : [];
  26255. });
  26256. /**
  26257. * Converts all elements in `array` into a string separated by `separator`.
  26258. *
  26259. * @static
  26260. * @memberOf _
  26261. * @since 4.0.0
  26262. * @category Array
  26263. * @param {Array} array The array to convert.
  26264. * @param {string} [separator=','] The element separator.
  26265. * @returns {string} Returns the joined string.
  26266. * @example
  26267. *
  26268. * _.join(['a', 'b', 'c'], '~');
  26269. * // => 'a~b~c'
  26270. */
  26271. function join(array, separator) {
  26272. return array == null ? '' : nativeJoin.call(array, separator);
  26273. }
  26274. /**
  26275. * Gets the last element of `array`.
  26276. *
  26277. * @static
  26278. * @memberOf _
  26279. * @since 0.1.0
  26280. * @category Array
  26281. * @param {Array} array The array to query.
  26282. * @returns {*} Returns the last element of `array`.
  26283. * @example
  26284. *
  26285. * _.last([1, 2, 3]);
  26286. * // => 3
  26287. */
  26288. function last(array) {
  26289. var length = array == null ? 0 : array.length;
  26290. return length ? array[length - 1] : undefined;
  26291. }
  26292. /**
  26293. * This method is like `_.indexOf` except that it iterates over elements of
  26294. * `array` from right to left.
  26295. *
  26296. * @static
  26297. * @memberOf _
  26298. * @since 0.1.0
  26299. * @category Array
  26300. * @param {Array} array The array to inspect.
  26301. * @param {*} value The value to search for.
  26302. * @param {number} [fromIndex=array.length-1] The index to search from.
  26303. * @returns {number} Returns the index of the matched value, else `-1`.
  26304. * @example
  26305. *
  26306. * _.lastIndexOf([1, 2, 1, 2], 2);
  26307. * // => 3
  26308. *
  26309. * // Search from the `fromIndex`.
  26310. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  26311. * // => 1
  26312. */
  26313. function lastIndexOf(array, value, fromIndex) {
  26314. var length = array == null ? 0 : array.length;
  26315. if (!length) {
  26316. return -1;
  26317. }
  26318. var index = length;
  26319. if (fromIndex !== undefined) {
  26320. index = toInteger(fromIndex);
  26321. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  26322. }
  26323. return value === value
  26324. ? strictLastIndexOf(array, value, index)
  26325. : baseFindIndex(array, baseIsNaN, index, true);
  26326. }
  26327. /**
  26328. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  26329. * element from the end is returned.
  26330. *
  26331. * @static
  26332. * @memberOf _
  26333. * @since 4.11.0
  26334. * @category Array
  26335. * @param {Array} array The array to query.
  26336. * @param {number} [n=0] The index of the element to return.
  26337. * @returns {*} Returns the nth element of `array`.
  26338. * @example
  26339. *
  26340. * var array = ['a', 'b', 'c', 'd'];
  26341. *
  26342. * _.nth(array, 1);
  26343. * // => 'b'
  26344. *
  26345. * _.nth(array, -2);
  26346. * // => 'c';
  26347. */
  26348. function nth(array, n) {
  26349. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  26350. }
  26351. /**
  26352. * Removes all given values from `array` using
  26353. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26354. * for equality comparisons.
  26355. *
  26356. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  26357. * to remove elements from an array by predicate.
  26358. *
  26359. * @static
  26360. * @memberOf _
  26361. * @since 2.0.0
  26362. * @category Array
  26363. * @param {Array} array The array to modify.
  26364. * @param {...*} [values] The values to remove.
  26365. * @returns {Array} Returns `array`.
  26366. * @example
  26367. *
  26368. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  26369. *
  26370. * _.pull(array, 'a', 'c');
  26371. * console.log(array);
  26372. * // => ['b', 'b']
  26373. */
  26374. var pull = baseRest(pullAll);
  26375. /**
  26376. * This method is like `_.pull` except that it accepts an array of values to remove.
  26377. *
  26378. * **Note:** Unlike `_.difference`, this method mutates `array`.
  26379. *
  26380. * @static
  26381. * @memberOf _
  26382. * @since 4.0.0
  26383. * @category Array
  26384. * @param {Array} array The array to modify.
  26385. * @param {Array} values The values to remove.
  26386. * @returns {Array} Returns `array`.
  26387. * @example
  26388. *
  26389. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  26390. *
  26391. * _.pullAll(array, ['a', 'c']);
  26392. * console.log(array);
  26393. * // => ['b', 'b']
  26394. */
  26395. function pullAll(array, values) {
  26396. return (array && array.length && values && values.length)
  26397. ? basePullAll(array, values)
  26398. : array;
  26399. }
  26400. /**
  26401. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  26402. * invoked for each element of `array` and `values` to generate the criterion
  26403. * by which they're compared. The iteratee is invoked with one argument: (value).
  26404. *
  26405. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  26406. *
  26407. * @static
  26408. * @memberOf _
  26409. * @since 4.0.0
  26410. * @category Array
  26411. * @param {Array} array The array to modify.
  26412. * @param {Array} values The values to remove.
  26413. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26414. * @returns {Array} Returns `array`.
  26415. * @example
  26416. *
  26417. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  26418. *
  26419. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  26420. * console.log(array);
  26421. * // => [{ 'x': 2 }]
  26422. */
  26423. function pullAllBy(array, values, iteratee) {
  26424. return (array && array.length && values && values.length)
  26425. ? basePullAll(array, values, getIteratee(iteratee, 2))
  26426. : array;
  26427. }
  26428. /**
  26429. * This method is like `_.pullAll` except that it accepts `comparator` which
  26430. * is invoked to compare elements of `array` to `values`. The comparator is
  26431. * invoked with two arguments: (arrVal, othVal).
  26432. *
  26433. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  26434. *
  26435. * @static
  26436. * @memberOf _
  26437. * @since 4.6.0
  26438. * @category Array
  26439. * @param {Array} array The array to modify.
  26440. * @param {Array} values The values to remove.
  26441. * @param {Function} [comparator] The comparator invoked per element.
  26442. * @returns {Array} Returns `array`.
  26443. * @example
  26444. *
  26445. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  26446. *
  26447. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  26448. * console.log(array);
  26449. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  26450. */
  26451. function pullAllWith(array, values, comparator) {
  26452. return (array && array.length && values && values.length)
  26453. ? basePullAll(array, values, undefined, comparator)
  26454. : array;
  26455. }
  26456. /**
  26457. * Removes elements from `array` corresponding to `indexes` and returns an
  26458. * array of removed elements.
  26459. *
  26460. * **Note:** Unlike `_.at`, this method mutates `array`.
  26461. *
  26462. * @static
  26463. * @memberOf _
  26464. * @since 3.0.0
  26465. * @category Array
  26466. * @param {Array} array The array to modify.
  26467. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  26468. * @returns {Array} Returns the new array of removed elements.
  26469. * @example
  26470. *
  26471. * var array = ['a', 'b', 'c', 'd'];
  26472. * var pulled = _.pullAt(array, [1, 3]);
  26473. *
  26474. * console.log(array);
  26475. * // => ['a', 'c']
  26476. *
  26477. * console.log(pulled);
  26478. * // => ['b', 'd']
  26479. */
  26480. var pullAt = flatRest(function(array, indexes) {
  26481. var length = array == null ? 0 : array.length,
  26482. result = baseAt(array, indexes);
  26483. basePullAt(array, arrayMap(indexes, function(index) {
  26484. return isIndex(index, length) ? +index : index;
  26485. }).sort(compareAscending));
  26486. return result;
  26487. });
  26488. /**
  26489. * Removes all elements from `array` that `predicate` returns truthy for
  26490. * and returns an array of the removed elements. The predicate is invoked
  26491. * with three arguments: (value, index, array).
  26492. *
  26493. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  26494. * to pull elements from an array by value.
  26495. *
  26496. * @static
  26497. * @memberOf _
  26498. * @since 2.0.0
  26499. * @category Array
  26500. * @param {Array} array The array to modify.
  26501. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26502. * @returns {Array} Returns the new array of removed elements.
  26503. * @example
  26504. *
  26505. * var array = [1, 2, 3, 4];
  26506. * var evens = _.remove(array, function(n) {
  26507. * return n % 2 == 0;
  26508. * });
  26509. *
  26510. * console.log(array);
  26511. * // => [1, 3]
  26512. *
  26513. * console.log(evens);
  26514. * // => [2, 4]
  26515. */
  26516. function remove(array, predicate) {
  26517. var result = [];
  26518. if (!(array && array.length)) {
  26519. return result;
  26520. }
  26521. var index = -1,
  26522. indexes = [],
  26523. length = array.length;
  26524. predicate = getIteratee(predicate, 3);
  26525. while (++index < length) {
  26526. var value = array[index];
  26527. if (predicate(value, index, array)) {
  26528. result.push(value);
  26529. indexes.push(index);
  26530. }
  26531. }
  26532. basePullAt(array, indexes);
  26533. return result;
  26534. }
  26535. /**
  26536. * Reverses `array` so that the first element becomes the last, the second
  26537. * element becomes the second to last, and so on.
  26538. *
  26539. * **Note:** This method mutates `array` and is based on
  26540. * [`Array#reverse`](https://mdn.io/Array/reverse).
  26541. *
  26542. * @static
  26543. * @memberOf _
  26544. * @since 4.0.0
  26545. * @category Array
  26546. * @param {Array} array The array to modify.
  26547. * @returns {Array} Returns `array`.
  26548. * @example
  26549. *
  26550. * var array = [1, 2, 3];
  26551. *
  26552. * _.reverse(array);
  26553. * // => [3, 2, 1]
  26554. *
  26555. * console.log(array);
  26556. * // => [3, 2, 1]
  26557. */
  26558. function reverse(array) {
  26559. return array == null ? array : nativeReverse.call(array);
  26560. }
  26561. /**
  26562. * Creates a slice of `array` from `start` up to, but not including, `end`.
  26563. *
  26564. * **Note:** This method is used instead of
  26565. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  26566. * returned.
  26567. *
  26568. * @static
  26569. * @memberOf _
  26570. * @since 3.0.0
  26571. * @category Array
  26572. * @param {Array} array The array to slice.
  26573. * @param {number} [start=0] The start position.
  26574. * @param {number} [end=array.length] The end position.
  26575. * @returns {Array} Returns the slice of `array`.
  26576. */
  26577. function slice(array, start, end) {
  26578. var length = array == null ? 0 : array.length;
  26579. if (!length) {
  26580. return [];
  26581. }
  26582. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  26583. start = 0;
  26584. end = length;
  26585. }
  26586. else {
  26587. start = start == null ? 0 : toInteger(start);
  26588. end = end === undefined ? length : toInteger(end);
  26589. }
  26590. return baseSlice(array, start, end);
  26591. }
  26592. /**
  26593. * Uses a binary search to determine the lowest index at which `value`
  26594. * should be inserted into `array` in order to maintain its sort order.
  26595. *
  26596. * @static
  26597. * @memberOf _
  26598. * @since 0.1.0
  26599. * @category Array
  26600. * @param {Array} array The sorted array to inspect.
  26601. * @param {*} value The value to evaluate.
  26602. * @returns {number} Returns the index at which `value` should be inserted
  26603. * into `array`.
  26604. * @example
  26605. *
  26606. * _.sortedIndex([30, 50], 40);
  26607. * // => 1
  26608. */
  26609. function sortedIndex(array, value) {
  26610. return baseSortedIndex(array, value);
  26611. }
  26612. /**
  26613. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  26614. * which is invoked for `value` and each element of `array` to compute their
  26615. * sort ranking. The iteratee is invoked with one argument: (value).
  26616. *
  26617. * @static
  26618. * @memberOf _
  26619. * @since 4.0.0
  26620. * @category Array
  26621. * @param {Array} array The sorted array to inspect.
  26622. * @param {*} value The value to evaluate.
  26623. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26624. * @returns {number} Returns the index at which `value` should be inserted
  26625. * into `array`.
  26626. * @example
  26627. *
  26628. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26629. *
  26630. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26631. * // => 0
  26632. *
  26633. * // The `_.property` iteratee shorthand.
  26634. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  26635. * // => 0
  26636. */
  26637. function sortedIndexBy(array, value, iteratee) {
  26638. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  26639. }
  26640. /**
  26641. * This method is like `_.indexOf` except that it performs a binary
  26642. * search on a sorted `array`.
  26643. *
  26644. * @static
  26645. * @memberOf _
  26646. * @since 4.0.0
  26647. * @category Array
  26648. * @param {Array} array The array to inspect.
  26649. * @param {*} value The value to search for.
  26650. * @returns {number} Returns the index of the matched value, else `-1`.
  26651. * @example
  26652. *
  26653. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  26654. * // => 1
  26655. */
  26656. function sortedIndexOf(array, value) {
  26657. var length = array == null ? 0 : array.length;
  26658. if (length) {
  26659. var index = baseSortedIndex(array, value);
  26660. if (index < length && eq(array[index], value)) {
  26661. return index;
  26662. }
  26663. }
  26664. return -1;
  26665. }
  26666. /**
  26667. * This method is like `_.sortedIndex` except that it returns the highest
  26668. * index at which `value` should be inserted into `array` in order to
  26669. * maintain its sort order.
  26670. *
  26671. * @static
  26672. * @memberOf _
  26673. * @since 3.0.0
  26674. * @category Array
  26675. * @param {Array} array The sorted array to inspect.
  26676. * @param {*} value The value to evaluate.
  26677. * @returns {number} Returns the index at which `value` should be inserted
  26678. * into `array`.
  26679. * @example
  26680. *
  26681. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  26682. * // => 4
  26683. */
  26684. function sortedLastIndex(array, value) {
  26685. return baseSortedIndex(array, value, true);
  26686. }
  26687. /**
  26688. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  26689. * which is invoked for `value` and each element of `array` to compute their
  26690. * sort ranking. The iteratee is invoked with one argument: (value).
  26691. *
  26692. * @static
  26693. * @memberOf _
  26694. * @since 4.0.0
  26695. * @category Array
  26696. * @param {Array} array The sorted array to inspect.
  26697. * @param {*} value The value to evaluate.
  26698. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26699. * @returns {number} Returns the index at which `value` should be inserted
  26700. * into `array`.
  26701. * @example
  26702. *
  26703. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26704. *
  26705. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26706. * // => 1
  26707. *
  26708. * // The `_.property` iteratee shorthand.
  26709. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  26710. * // => 1
  26711. */
  26712. function sortedLastIndexBy(array, value, iteratee) {
  26713. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  26714. }
  26715. /**
  26716. * This method is like `_.lastIndexOf` except that it performs a binary
  26717. * search on a sorted `array`.
  26718. *
  26719. * @static
  26720. * @memberOf _
  26721. * @since 4.0.0
  26722. * @category Array
  26723. * @param {Array} array The array to inspect.
  26724. * @param {*} value The value to search for.
  26725. * @returns {number} Returns the index of the matched value, else `-1`.
  26726. * @example
  26727. *
  26728. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  26729. * // => 3
  26730. */
  26731. function sortedLastIndexOf(array, value) {
  26732. var length = array == null ? 0 : array.length;
  26733. if (length) {
  26734. var index = baseSortedIndex(array, value, true) - 1;
  26735. if (eq(array[index], value)) {
  26736. return index;
  26737. }
  26738. }
  26739. return -1;
  26740. }
  26741. /**
  26742. * This method is like `_.uniq` except that it's designed and optimized
  26743. * for sorted arrays.
  26744. *
  26745. * @static
  26746. * @memberOf _
  26747. * @since 4.0.0
  26748. * @category Array
  26749. * @param {Array} array The array to inspect.
  26750. * @returns {Array} Returns the new duplicate free array.
  26751. * @example
  26752. *
  26753. * _.sortedUniq([1, 1, 2]);
  26754. * // => [1, 2]
  26755. */
  26756. function sortedUniq(array) {
  26757. return (array && array.length)
  26758. ? baseSortedUniq(array)
  26759. : [];
  26760. }
  26761. /**
  26762. * This method is like `_.uniqBy` except that it's designed and optimized
  26763. * for sorted arrays.
  26764. *
  26765. * @static
  26766. * @memberOf _
  26767. * @since 4.0.0
  26768. * @category Array
  26769. * @param {Array} array The array to inspect.
  26770. * @param {Function} [iteratee] The iteratee invoked per element.
  26771. * @returns {Array} Returns the new duplicate free array.
  26772. * @example
  26773. *
  26774. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  26775. * // => [1.1, 2.3]
  26776. */
  26777. function sortedUniqBy(array, iteratee) {
  26778. return (array && array.length)
  26779. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  26780. : [];
  26781. }
  26782. /**
  26783. * Gets all but the first element of `array`.
  26784. *
  26785. * @static
  26786. * @memberOf _
  26787. * @since 4.0.0
  26788. * @category Array
  26789. * @param {Array} array The array to query.
  26790. * @returns {Array} Returns the slice of `array`.
  26791. * @example
  26792. *
  26793. * _.tail([1, 2, 3]);
  26794. * // => [2, 3]
  26795. */
  26796. function tail(array) {
  26797. var length = array == null ? 0 : array.length;
  26798. return length ? baseSlice(array, 1, length) : [];
  26799. }
  26800. /**
  26801. * Creates a slice of `array` with `n` elements taken from the beginning.
  26802. *
  26803. * @static
  26804. * @memberOf _
  26805. * @since 0.1.0
  26806. * @category Array
  26807. * @param {Array} array The array to query.
  26808. * @param {number} [n=1] The number of elements to take.
  26809. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26810. * @returns {Array} Returns the slice of `array`.
  26811. * @example
  26812. *
  26813. * _.take([1, 2, 3]);
  26814. * // => [1]
  26815. *
  26816. * _.take([1, 2, 3], 2);
  26817. * // => [1, 2]
  26818. *
  26819. * _.take([1, 2, 3], 5);
  26820. * // => [1, 2, 3]
  26821. *
  26822. * _.take([1, 2, 3], 0);
  26823. * // => []
  26824. */
  26825. function take(array, n, guard) {
  26826. if (!(array && array.length)) {
  26827. return [];
  26828. }
  26829. n = (guard || n === undefined) ? 1 : toInteger(n);
  26830. return baseSlice(array, 0, n < 0 ? 0 : n);
  26831. }
  26832. /**
  26833. * Creates a slice of `array` with `n` elements taken from the end.
  26834. *
  26835. * @static
  26836. * @memberOf _
  26837. * @since 3.0.0
  26838. * @category Array
  26839. * @param {Array} array The array to query.
  26840. * @param {number} [n=1] The number of elements to take.
  26841. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26842. * @returns {Array} Returns the slice of `array`.
  26843. * @example
  26844. *
  26845. * _.takeRight([1, 2, 3]);
  26846. * // => [3]
  26847. *
  26848. * _.takeRight([1, 2, 3], 2);
  26849. * // => [2, 3]
  26850. *
  26851. * _.takeRight([1, 2, 3], 5);
  26852. * // => [1, 2, 3]
  26853. *
  26854. * _.takeRight([1, 2, 3], 0);
  26855. * // => []
  26856. */
  26857. function takeRight(array, n, guard) {
  26858. var length = array == null ? 0 : array.length;
  26859. if (!length) {
  26860. return [];
  26861. }
  26862. n = (guard || n === undefined) ? 1 : toInteger(n);
  26863. n = length - n;
  26864. return baseSlice(array, n < 0 ? 0 : n, length);
  26865. }
  26866. /**
  26867. * Creates a slice of `array` with elements taken from the end. Elements are
  26868. * taken until `predicate` returns falsey. The predicate is invoked with
  26869. * three arguments: (value, index, array).
  26870. *
  26871. * @static
  26872. * @memberOf _
  26873. * @since 3.0.0
  26874. * @category Array
  26875. * @param {Array} array The array to query.
  26876. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26877. * @returns {Array} Returns the slice of `array`.
  26878. * @example
  26879. *
  26880. * var users = [
  26881. * { 'user': 'barney', 'active': true },
  26882. * { 'user': 'fred', 'active': false },
  26883. * { 'user': 'pebbles', 'active': false }
  26884. * ];
  26885. *
  26886. * _.takeRightWhile(users, function(o) { return !o.active; });
  26887. * // => objects for ['fred', 'pebbles']
  26888. *
  26889. * // The `_.matches` iteratee shorthand.
  26890. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  26891. * // => objects for ['pebbles']
  26892. *
  26893. * // The `_.matchesProperty` iteratee shorthand.
  26894. * _.takeRightWhile(users, ['active', false]);
  26895. * // => objects for ['fred', 'pebbles']
  26896. *
  26897. * // The `_.property` iteratee shorthand.
  26898. * _.takeRightWhile(users, 'active');
  26899. * // => []
  26900. */
  26901. function takeRightWhile(array, predicate) {
  26902. return (array && array.length)
  26903. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  26904. : [];
  26905. }
  26906. /**
  26907. * Creates a slice of `array` with elements taken from the beginning. Elements
  26908. * are taken until `predicate` returns falsey. The predicate is invoked with
  26909. * three arguments: (value, index, array).
  26910. *
  26911. * @static
  26912. * @memberOf _
  26913. * @since 3.0.0
  26914. * @category Array
  26915. * @param {Array} array The array to query.
  26916. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26917. * @returns {Array} Returns the slice of `array`.
  26918. * @example
  26919. *
  26920. * var users = [
  26921. * { 'user': 'barney', 'active': false },
  26922. * { 'user': 'fred', 'active': false },
  26923. * { 'user': 'pebbles', 'active': true }
  26924. * ];
  26925. *
  26926. * _.takeWhile(users, function(o) { return !o.active; });
  26927. * // => objects for ['barney', 'fred']
  26928. *
  26929. * // The `_.matches` iteratee shorthand.
  26930. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26931. * // => objects for ['barney']
  26932. *
  26933. * // The `_.matchesProperty` iteratee shorthand.
  26934. * _.takeWhile(users, ['active', false]);
  26935. * // => objects for ['barney', 'fred']
  26936. *
  26937. * // The `_.property` iteratee shorthand.
  26938. * _.takeWhile(users, 'active');
  26939. * // => []
  26940. */
  26941. function takeWhile(array, predicate) {
  26942. return (array && array.length)
  26943. ? baseWhile(array, getIteratee(predicate, 3))
  26944. : [];
  26945. }
  26946. /**
  26947. * Creates an array of unique values, in order, from all given arrays using
  26948. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26949. * for equality comparisons.
  26950. *
  26951. * @static
  26952. * @memberOf _
  26953. * @since 0.1.0
  26954. * @category Array
  26955. * @param {...Array} [arrays] The arrays to inspect.
  26956. * @returns {Array} Returns the new array of combined values.
  26957. * @example
  26958. *
  26959. * _.union([2], [1, 2]);
  26960. * // => [2, 1]
  26961. */
  26962. var union = baseRest(function(arrays) {
  26963. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26964. });
  26965. /**
  26966. * This method is like `_.union` except that it accepts `iteratee` which is
  26967. * invoked for each element of each `arrays` to generate the criterion by
  26968. * which uniqueness is computed. Result values are chosen from the first
  26969. * array in which the value occurs. The iteratee is invoked with one argument:
  26970. * (value).
  26971. *
  26972. * @static
  26973. * @memberOf _
  26974. * @since 4.0.0
  26975. * @category Array
  26976. * @param {...Array} [arrays] The arrays to inspect.
  26977. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26978. * @returns {Array} Returns the new array of combined values.
  26979. * @example
  26980. *
  26981. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26982. * // => [2.1, 1.2]
  26983. *
  26984. * // The `_.property` iteratee shorthand.
  26985. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26986. * // => [{ 'x': 1 }, { 'x': 2 }]
  26987. */
  26988. var unionBy = baseRest(function(arrays) {
  26989. var iteratee = last(arrays);
  26990. if (isArrayLikeObject(iteratee)) {
  26991. iteratee = undefined;
  26992. }
  26993. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26994. });
  26995. /**
  26996. * This method is like `_.union` except that it accepts `comparator` which
  26997. * is invoked to compare elements of `arrays`. Result values are chosen from
  26998. * the first array in which the value occurs. The comparator is invoked
  26999. * with two arguments: (arrVal, othVal).
  27000. *
  27001. * @static
  27002. * @memberOf _
  27003. * @since 4.0.0
  27004. * @category Array
  27005. * @param {...Array} [arrays] The arrays to inspect.
  27006. * @param {Function} [comparator] The comparator invoked per element.
  27007. * @returns {Array} Returns the new array of combined values.
  27008. * @example
  27009. *
  27010. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  27011. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  27012. *
  27013. * _.unionWith(objects, others, _.isEqual);
  27014. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  27015. */
  27016. var unionWith = baseRest(function(arrays) {
  27017. var comparator = last(arrays);
  27018. comparator = typeof comparator == 'function' ? comparator : undefined;
  27019. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  27020. });
  27021. /**
  27022. * Creates a duplicate-free version of an array, using
  27023. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27024. * for equality comparisons, in which only the first occurrence of each element
  27025. * is kept. The order of result values is determined by the order they occur
  27026. * in the array.
  27027. *
  27028. * @static
  27029. * @memberOf _
  27030. * @since 0.1.0
  27031. * @category Array
  27032. * @param {Array} array The array to inspect.
  27033. * @returns {Array} Returns the new duplicate free array.
  27034. * @example
  27035. *
  27036. * _.uniq([2, 1, 2]);
  27037. * // => [2, 1]
  27038. */
  27039. function uniq(array) {
  27040. return (array && array.length) ? baseUniq(array) : [];
  27041. }
  27042. /**
  27043. * This method is like `_.uniq` except that it accepts `iteratee` which is
  27044. * invoked for each element in `array` to generate the criterion by which
  27045. * uniqueness is computed. The order of result values is determined by the
  27046. * order they occur in the array. The iteratee is invoked with one argument:
  27047. * (value).
  27048. *
  27049. * @static
  27050. * @memberOf _
  27051. * @since 4.0.0
  27052. * @category Array
  27053. * @param {Array} array The array to inspect.
  27054. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27055. * @returns {Array} Returns the new duplicate free array.
  27056. * @example
  27057. *
  27058. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  27059. * // => [2.1, 1.2]
  27060. *
  27061. * // The `_.property` iteratee shorthand.
  27062. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  27063. * // => [{ 'x': 1 }, { 'x': 2 }]
  27064. */
  27065. function uniqBy(array, iteratee) {
  27066. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  27067. }
  27068. /**
  27069. * This method is like `_.uniq` except that it accepts `comparator` which
  27070. * is invoked to compare elements of `array`. The order of result values is
  27071. * determined by the order they occur in the array.The comparator is invoked
  27072. * with two arguments: (arrVal, othVal).
  27073. *
  27074. * @static
  27075. * @memberOf _
  27076. * @since 4.0.0
  27077. * @category Array
  27078. * @param {Array} array The array to inspect.
  27079. * @param {Function} [comparator] The comparator invoked per element.
  27080. * @returns {Array} Returns the new duplicate free array.
  27081. * @example
  27082. *
  27083. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  27084. *
  27085. * _.uniqWith(objects, _.isEqual);
  27086. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  27087. */
  27088. function uniqWith(array, comparator) {
  27089. comparator = typeof comparator == 'function' ? comparator : undefined;
  27090. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  27091. }
  27092. /**
  27093. * This method is like `_.zip` except that it accepts an array of grouped
  27094. * elements and creates an array regrouping the elements to their pre-zip
  27095. * configuration.
  27096. *
  27097. * @static
  27098. * @memberOf _
  27099. * @since 1.2.0
  27100. * @category Array
  27101. * @param {Array} array The array of grouped elements to process.
  27102. * @returns {Array} Returns the new array of regrouped elements.
  27103. * @example
  27104. *
  27105. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  27106. * // => [['a', 1, true], ['b', 2, false]]
  27107. *
  27108. * _.unzip(zipped);
  27109. * // => [['a', 'b'], [1, 2], [true, false]]
  27110. */
  27111. function unzip(array) {
  27112. if (!(array && array.length)) {
  27113. return [];
  27114. }
  27115. var length = 0;
  27116. array = arrayFilter(array, function(group) {
  27117. if (isArrayLikeObject(group)) {
  27118. length = nativeMax(group.length, length);
  27119. return true;
  27120. }
  27121. });
  27122. return baseTimes(length, function(index) {
  27123. return arrayMap(array, baseProperty(index));
  27124. });
  27125. }
  27126. /**
  27127. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  27128. * how regrouped values should be combined. The iteratee is invoked with the
  27129. * elements of each group: (...group).
  27130. *
  27131. * @static
  27132. * @memberOf _
  27133. * @since 3.8.0
  27134. * @category Array
  27135. * @param {Array} array The array of grouped elements to process.
  27136. * @param {Function} [iteratee=_.identity] The function to combine
  27137. * regrouped values.
  27138. * @returns {Array} Returns the new array of regrouped elements.
  27139. * @example
  27140. *
  27141. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  27142. * // => [[1, 10, 100], [2, 20, 200]]
  27143. *
  27144. * _.unzipWith(zipped, _.add);
  27145. * // => [3, 30, 300]
  27146. */
  27147. function unzipWith(array, iteratee) {
  27148. if (!(array && array.length)) {
  27149. return [];
  27150. }
  27151. var result = unzip(array);
  27152. if (iteratee == null) {
  27153. return result;
  27154. }
  27155. return arrayMap(result, function(group) {
  27156. return apply(iteratee, undefined, group);
  27157. });
  27158. }
  27159. /**
  27160. * Creates an array excluding all given values using
  27161. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27162. * for equality comparisons.
  27163. *
  27164. * **Note:** Unlike `_.pull`, this method returns a new array.
  27165. *
  27166. * @static
  27167. * @memberOf _
  27168. * @since 0.1.0
  27169. * @category Array
  27170. * @param {Array} array The array to inspect.
  27171. * @param {...*} [values] The values to exclude.
  27172. * @returns {Array} Returns the new array of filtered values.
  27173. * @see _.difference, _.xor
  27174. * @example
  27175. *
  27176. * _.without([2, 1, 2, 3], 1, 2);
  27177. * // => [3]
  27178. */
  27179. var without = baseRest(function(array, values) {
  27180. return isArrayLikeObject(array)
  27181. ? baseDifference(array, values)
  27182. : [];
  27183. });
  27184. /**
  27185. * Creates an array of unique values that is the
  27186. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  27187. * of the given arrays. The order of result values is determined by the order
  27188. * they occur in the arrays.
  27189. *
  27190. * @static
  27191. * @memberOf _
  27192. * @since 2.4.0
  27193. * @category Array
  27194. * @param {...Array} [arrays] The arrays to inspect.
  27195. * @returns {Array} Returns the new array of filtered values.
  27196. * @see _.difference, _.without
  27197. * @example
  27198. *
  27199. * _.xor([2, 1], [2, 3]);
  27200. * // => [1, 3]
  27201. */
  27202. var xor = baseRest(function(arrays) {
  27203. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  27204. });
  27205. /**
  27206. * This method is like `_.xor` except that it accepts `iteratee` which is
  27207. * invoked for each element of each `arrays` to generate the criterion by
  27208. * which by which they're compared. The order of result values is determined
  27209. * by the order they occur in the arrays. The iteratee is invoked with one
  27210. * argument: (value).
  27211. *
  27212. * @static
  27213. * @memberOf _
  27214. * @since 4.0.0
  27215. * @category Array
  27216. * @param {...Array} [arrays] The arrays to inspect.
  27217. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27218. * @returns {Array} Returns the new array of filtered values.
  27219. * @example
  27220. *
  27221. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  27222. * // => [1.2, 3.4]
  27223. *
  27224. * // The `_.property` iteratee shorthand.
  27225. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  27226. * // => [{ 'x': 2 }]
  27227. */
  27228. var xorBy = baseRest(function(arrays) {
  27229. var iteratee = last(arrays);
  27230. if (isArrayLikeObject(iteratee)) {
  27231. iteratee = undefined;
  27232. }
  27233. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  27234. });
  27235. /**
  27236. * This method is like `_.xor` except that it accepts `comparator` which is
  27237. * invoked to compare elements of `arrays`. The order of result values is
  27238. * determined by the order they occur in the arrays. The comparator is invoked
  27239. * with two arguments: (arrVal, othVal).
  27240. *
  27241. * @static
  27242. * @memberOf _
  27243. * @since 4.0.0
  27244. * @category Array
  27245. * @param {...Array} [arrays] The arrays to inspect.
  27246. * @param {Function} [comparator] The comparator invoked per element.
  27247. * @returns {Array} Returns the new array of filtered values.
  27248. * @example
  27249. *
  27250. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  27251. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  27252. *
  27253. * _.xorWith(objects, others, _.isEqual);
  27254. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  27255. */
  27256. var xorWith = baseRest(function(arrays) {
  27257. var comparator = last(arrays);
  27258. comparator = typeof comparator == 'function' ? comparator : undefined;
  27259. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  27260. });
  27261. /**
  27262. * Creates an array of grouped elements, the first of which contains the
  27263. * first elements of the given arrays, the second of which contains the
  27264. * second elements of the given arrays, and so on.
  27265. *
  27266. * @static
  27267. * @memberOf _
  27268. * @since 0.1.0
  27269. * @category Array
  27270. * @param {...Array} [arrays] The arrays to process.
  27271. * @returns {Array} Returns the new array of grouped elements.
  27272. * @example
  27273. *
  27274. * _.zip(['a', 'b'], [1, 2], [true, false]);
  27275. * // => [['a', 1, true], ['b', 2, false]]
  27276. */
  27277. var zip = baseRest(unzip);
  27278. /**
  27279. * This method is like `_.fromPairs` except that it accepts two arrays,
  27280. * one of property identifiers and one of corresponding values.
  27281. *
  27282. * @static
  27283. * @memberOf _
  27284. * @since 0.4.0
  27285. * @category Array
  27286. * @param {Array} [props=[]] The property identifiers.
  27287. * @param {Array} [values=[]] The property values.
  27288. * @returns {Object} Returns the new object.
  27289. * @example
  27290. *
  27291. * _.zipObject(['a', 'b'], [1, 2]);
  27292. * // => { 'a': 1, 'b': 2 }
  27293. */
  27294. function zipObject(props, values) {
  27295. return baseZipObject(props || [], values || [], assignValue);
  27296. }
  27297. /**
  27298. * This method is like `_.zipObject` except that it supports property paths.
  27299. *
  27300. * @static
  27301. * @memberOf _
  27302. * @since 4.1.0
  27303. * @category Array
  27304. * @param {Array} [props=[]] The property identifiers.
  27305. * @param {Array} [values=[]] The property values.
  27306. * @returns {Object} Returns the new object.
  27307. * @example
  27308. *
  27309. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  27310. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  27311. */
  27312. function zipObjectDeep(props, values) {
  27313. return baseZipObject(props || [], values || [], baseSet);
  27314. }
  27315. /**
  27316. * This method is like `_.zip` except that it accepts `iteratee` to specify
  27317. * how grouped values should be combined. The iteratee is invoked with the
  27318. * elements of each group: (...group).
  27319. *
  27320. * @static
  27321. * @memberOf _
  27322. * @since 3.8.0
  27323. * @category Array
  27324. * @param {...Array} [arrays] The arrays to process.
  27325. * @param {Function} [iteratee=_.identity] The function to combine
  27326. * grouped values.
  27327. * @returns {Array} Returns the new array of grouped elements.
  27328. * @example
  27329. *
  27330. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  27331. * return a + b + c;
  27332. * });
  27333. * // => [111, 222]
  27334. */
  27335. var zipWith = baseRest(function(arrays) {
  27336. var length = arrays.length,
  27337. iteratee = length > 1 ? arrays[length - 1] : undefined;
  27338. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  27339. return unzipWith(arrays, iteratee);
  27340. });
  27341. /*------------------------------------------------------------------------*/
  27342. /**
  27343. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  27344. * chain sequences enabled. The result of such sequences must be unwrapped
  27345. * with `_#value`.
  27346. *
  27347. * @static
  27348. * @memberOf _
  27349. * @since 1.3.0
  27350. * @category Seq
  27351. * @param {*} value The value to wrap.
  27352. * @returns {Object} Returns the new `lodash` wrapper instance.
  27353. * @example
  27354. *
  27355. * var users = [
  27356. * { 'user': 'barney', 'age': 36 },
  27357. * { 'user': 'fred', 'age': 40 },
  27358. * { 'user': 'pebbles', 'age': 1 }
  27359. * ];
  27360. *
  27361. * var youngest = _
  27362. * .chain(users)
  27363. * .sortBy('age')
  27364. * .map(function(o) {
  27365. * return o.user + ' is ' + o.age;
  27366. * })
  27367. * .head()
  27368. * .value();
  27369. * // => 'pebbles is 1'
  27370. */
  27371. function chain(value) {
  27372. var result = lodash(value);
  27373. result.__chain__ = true;
  27374. return result;
  27375. }
  27376. /**
  27377. * This method invokes `interceptor` and returns `value`. The interceptor
  27378. * is invoked with one argument; (value). The purpose of this method is to
  27379. * "tap into" a method chain sequence in order to modify intermediate results.
  27380. *
  27381. * @static
  27382. * @memberOf _
  27383. * @since 0.1.0
  27384. * @category Seq
  27385. * @param {*} value The value to provide to `interceptor`.
  27386. * @param {Function} interceptor The function to invoke.
  27387. * @returns {*} Returns `value`.
  27388. * @example
  27389. *
  27390. * _([1, 2, 3])
  27391. * .tap(function(array) {
  27392. * // Mutate input array.
  27393. * array.pop();
  27394. * })
  27395. * .reverse()
  27396. * .value();
  27397. * // => [2, 1]
  27398. */
  27399. function tap(value, interceptor) {
  27400. interceptor(value);
  27401. return value;
  27402. }
  27403. /**
  27404. * This method is like `_.tap` except that it returns the result of `interceptor`.
  27405. * The purpose of this method is to "pass thru" values replacing intermediate
  27406. * results in a method chain sequence.
  27407. *
  27408. * @static
  27409. * @memberOf _
  27410. * @since 3.0.0
  27411. * @category Seq
  27412. * @param {*} value The value to provide to `interceptor`.
  27413. * @param {Function} interceptor The function to invoke.
  27414. * @returns {*} Returns the result of `interceptor`.
  27415. * @example
  27416. *
  27417. * _(' abc ')
  27418. * .chain()
  27419. * .trim()
  27420. * .thru(function(value) {
  27421. * return [value];
  27422. * })
  27423. * .value();
  27424. * // => ['abc']
  27425. */
  27426. function thru(value, interceptor) {
  27427. return interceptor(value);
  27428. }
  27429. /**
  27430. * This method is the wrapper version of `_.at`.
  27431. *
  27432. * @name at
  27433. * @memberOf _
  27434. * @since 1.0.0
  27435. * @category Seq
  27436. * @param {...(string|string[])} [paths] The property paths to pick.
  27437. * @returns {Object} Returns the new `lodash` wrapper instance.
  27438. * @example
  27439. *
  27440. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  27441. *
  27442. * _(object).at(['a[0].b.c', 'a[1]']).value();
  27443. * // => [3, 4]
  27444. */
  27445. var wrapperAt = flatRest(function(paths) {
  27446. var length = paths.length,
  27447. start = length ? paths[0] : 0,
  27448. value = this.__wrapped__,
  27449. interceptor = function(object) { return baseAt(object, paths); };
  27450. if (length > 1 || this.__actions__.length ||
  27451. !(value instanceof LazyWrapper) || !isIndex(start)) {
  27452. return this.thru(interceptor);
  27453. }
  27454. value = value.slice(start, +start + (length ? 1 : 0));
  27455. value.__actions__.push({
  27456. 'func': thru,
  27457. 'args': [interceptor],
  27458. 'thisArg': undefined
  27459. });
  27460. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  27461. if (length && !array.length) {
  27462. array.push(undefined);
  27463. }
  27464. return array;
  27465. });
  27466. });
  27467. /**
  27468. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  27469. *
  27470. * @name chain
  27471. * @memberOf _
  27472. * @since 0.1.0
  27473. * @category Seq
  27474. * @returns {Object} Returns the new `lodash` wrapper instance.
  27475. * @example
  27476. *
  27477. * var users = [
  27478. * { 'user': 'barney', 'age': 36 },
  27479. * { 'user': 'fred', 'age': 40 }
  27480. * ];
  27481. *
  27482. * // A sequence without explicit chaining.
  27483. * _(users).head();
  27484. * // => { 'user': 'barney', 'age': 36 }
  27485. *
  27486. * // A sequence with explicit chaining.
  27487. * _(users)
  27488. * .chain()
  27489. * .head()
  27490. * .pick('user')
  27491. * .value();
  27492. * // => { 'user': 'barney' }
  27493. */
  27494. function wrapperChain() {
  27495. return chain(this);
  27496. }
  27497. /**
  27498. * Executes the chain sequence and returns the wrapped result.
  27499. *
  27500. * @name commit
  27501. * @memberOf _
  27502. * @since 3.2.0
  27503. * @category Seq
  27504. * @returns {Object} Returns the new `lodash` wrapper instance.
  27505. * @example
  27506. *
  27507. * var array = [1, 2];
  27508. * var wrapped = _(array).push(3);
  27509. *
  27510. * console.log(array);
  27511. * // => [1, 2]
  27512. *
  27513. * wrapped = wrapped.commit();
  27514. * console.log(array);
  27515. * // => [1, 2, 3]
  27516. *
  27517. * wrapped.last();
  27518. * // => 3
  27519. *
  27520. * console.log(array);
  27521. * // => [1, 2, 3]
  27522. */
  27523. function wrapperCommit() {
  27524. return new LodashWrapper(this.value(), this.__chain__);
  27525. }
  27526. /**
  27527. * Gets the next value on a wrapped object following the
  27528. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  27529. *
  27530. * @name next
  27531. * @memberOf _
  27532. * @since 4.0.0
  27533. * @category Seq
  27534. * @returns {Object} Returns the next iterator value.
  27535. * @example
  27536. *
  27537. * var wrapped = _([1, 2]);
  27538. *
  27539. * wrapped.next();
  27540. * // => { 'done': false, 'value': 1 }
  27541. *
  27542. * wrapped.next();
  27543. * // => { 'done': false, 'value': 2 }
  27544. *
  27545. * wrapped.next();
  27546. * // => { 'done': true, 'value': undefined }
  27547. */
  27548. function wrapperNext() {
  27549. if (this.__values__ === undefined) {
  27550. this.__values__ = toArray(this.value());
  27551. }
  27552. var done = this.__index__ >= this.__values__.length,
  27553. value = done ? undefined : this.__values__[this.__index__++];
  27554. return { 'done': done, 'value': value };
  27555. }
  27556. /**
  27557. * Enables the wrapper to be iterable.
  27558. *
  27559. * @name Symbol.iterator
  27560. * @memberOf _
  27561. * @since 4.0.0
  27562. * @category Seq
  27563. * @returns {Object} Returns the wrapper object.
  27564. * @example
  27565. *
  27566. * var wrapped = _([1, 2]);
  27567. *
  27568. * wrapped[Symbol.iterator]() === wrapped;
  27569. * // => true
  27570. *
  27571. * Array.from(wrapped);
  27572. * // => [1, 2]
  27573. */
  27574. function wrapperToIterator() {
  27575. return this;
  27576. }
  27577. /**
  27578. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  27579. *
  27580. * @name plant
  27581. * @memberOf _
  27582. * @since 3.2.0
  27583. * @category Seq
  27584. * @param {*} value The value to plant.
  27585. * @returns {Object} Returns the new `lodash` wrapper instance.
  27586. * @example
  27587. *
  27588. * function square(n) {
  27589. * return n * n;
  27590. * }
  27591. *
  27592. * var wrapped = _([1, 2]).map(square);
  27593. * var other = wrapped.plant([3, 4]);
  27594. *
  27595. * other.value();
  27596. * // => [9, 16]
  27597. *
  27598. * wrapped.value();
  27599. * // => [1, 4]
  27600. */
  27601. function wrapperPlant(value) {
  27602. var result,
  27603. parent = this;
  27604. while (parent instanceof baseLodash) {
  27605. var clone = wrapperClone(parent);
  27606. clone.__index__ = 0;
  27607. clone.__values__ = undefined;
  27608. if (result) {
  27609. previous.__wrapped__ = clone;
  27610. } else {
  27611. result = clone;
  27612. }
  27613. var previous = clone;
  27614. parent = parent.__wrapped__;
  27615. }
  27616. previous.__wrapped__ = value;
  27617. return result;
  27618. }
  27619. /**
  27620. * This method is the wrapper version of `_.reverse`.
  27621. *
  27622. * **Note:** This method mutates the wrapped array.
  27623. *
  27624. * @name reverse
  27625. * @memberOf _
  27626. * @since 0.1.0
  27627. * @category Seq
  27628. * @returns {Object} Returns the new `lodash` wrapper instance.
  27629. * @example
  27630. *
  27631. * var array = [1, 2, 3];
  27632. *
  27633. * _(array).reverse().value()
  27634. * // => [3, 2, 1]
  27635. *
  27636. * console.log(array);
  27637. * // => [3, 2, 1]
  27638. */
  27639. function wrapperReverse() {
  27640. var value = this.__wrapped__;
  27641. if (value instanceof LazyWrapper) {
  27642. var wrapped = value;
  27643. if (this.__actions__.length) {
  27644. wrapped = new LazyWrapper(this);
  27645. }
  27646. wrapped = wrapped.reverse();
  27647. wrapped.__actions__.push({
  27648. 'func': thru,
  27649. 'args': [reverse],
  27650. 'thisArg': undefined
  27651. });
  27652. return new LodashWrapper(wrapped, this.__chain__);
  27653. }
  27654. return this.thru(reverse);
  27655. }
  27656. /**
  27657. * Executes the chain sequence to resolve the unwrapped value.
  27658. *
  27659. * @name value
  27660. * @memberOf _
  27661. * @since 0.1.0
  27662. * @alias toJSON, valueOf
  27663. * @category Seq
  27664. * @returns {*} Returns the resolved unwrapped value.
  27665. * @example
  27666. *
  27667. * _([1, 2, 3]).value();
  27668. * // => [1, 2, 3]
  27669. */
  27670. function wrapperValue() {
  27671. return baseWrapperValue(this.__wrapped__, this.__actions__);
  27672. }
  27673. /*------------------------------------------------------------------------*/
  27674. /**
  27675. * Creates an object composed of keys generated from the results of running
  27676. * each element of `collection` thru `iteratee`. The corresponding value of
  27677. * each key is the number of times the key was returned by `iteratee`. The
  27678. * iteratee is invoked with one argument: (value).
  27679. *
  27680. * @static
  27681. * @memberOf _
  27682. * @since 0.5.0
  27683. * @category Collection
  27684. * @param {Array|Object} collection The collection to iterate over.
  27685. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27686. * @returns {Object} Returns the composed aggregate object.
  27687. * @example
  27688. *
  27689. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  27690. * // => { '4': 1, '6': 2 }
  27691. *
  27692. * // The `_.property` iteratee shorthand.
  27693. * _.countBy(['one', 'two', 'three'], 'length');
  27694. * // => { '3': 2, '5': 1 }
  27695. */
  27696. var countBy = createAggregator(function(result, value, key) {
  27697. if (hasOwnProperty.call(result, key)) {
  27698. ++result[key];
  27699. } else {
  27700. baseAssignValue(result, key, 1);
  27701. }
  27702. });
  27703. /**
  27704. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  27705. * Iteration is stopped once `predicate` returns falsey. The predicate is
  27706. * invoked with three arguments: (value, index|key, collection).
  27707. *
  27708. * **Note:** This method returns `true` for
  27709. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  27710. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  27711. * elements of empty collections.
  27712. *
  27713. * @static
  27714. * @memberOf _
  27715. * @since 0.1.0
  27716. * @category Collection
  27717. * @param {Array|Object} collection The collection to iterate over.
  27718. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27719. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27720. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  27721. * else `false`.
  27722. * @example
  27723. *
  27724. * _.every([true, 1, null, 'yes'], Boolean);
  27725. * // => false
  27726. *
  27727. * var users = [
  27728. * { 'user': 'barney', 'age': 36, 'active': false },
  27729. * { 'user': 'fred', 'age': 40, 'active': false }
  27730. * ];
  27731. *
  27732. * // The `_.matches` iteratee shorthand.
  27733. * _.every(users, { 'user': 'barney', 'active': false });
  27734. * // => false
  27735. *
  27736. * // The `_.matchesProperty` iteratee shorthand.
  27737. * _.every(users, ['active', false]);
  27738. * // => true
  27739. *
  27740. * // The `_.property` iteratee shorthand.
  27741. * _.every(users, 'active');
  27742. * // => false
  27743. */
  27744. function every(collection, predicate, guard) {
  27745. var func = isArray(collection) ? arrayEvery : baseEvery;
  27746. if (guard && isIterateeCall(collection, predicate, guard)) {
  27747. predicate = undefined;
  27748. }
  27749. return func(collection, getIteratee(predicate, 3));
  27750. }
  27751. /**
  27752. * Iterates over elements of `collection`, returning an array of all elements
  27753. * `predicate` returns truthy for. The predicate is invoked with three
  27754. * arguments: (value, index|key, collection).
  27755. *
  27756. * **Note:** Unlike `_.remove`, this method returns a new array.
  27757. *
  27758. * @static
  27759. * @memberOf _
  27760. * @since 0.1.0
  27761. * @category Collection
  27762. * @param {Array|Object} collection The collection to iterate over.
  27763. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27764. * @returns {Array} Returns the new filtered array.
  27765. * @see _.reject
  27766. * @example
  27767. *
  27768. * var users = [
  27769. * { 'user': 'barney', 'age': 36, 'active': true },
  27770. * { 'user': 'fred', 'age': 40, 'active': false }
  27771. * ];
  27772. *
  27773. * _.filter(users, function(o) { return !o.active; });
  27774. * // => objects for ['fred']
  27775. *
  27776. * // The `_.matches` iteratee shorthand.
  27777. * _.filter(users, { 'age': 36, 'active': true });
  27778. * // => objects for ['barney']
  27779. *
  27780. * // The `_.matchesProperty` iteratee shorthand.
  27781. * _.filter(users, ['active', false]);
  27782. * // => objects for ['fred']
  27783. *
  27784. * // The `_.property` iteratee shorthand.
  27785. * _.filter(users, 'active');
  27786. * // => objects for ['barney']
  27787. */
  27788. function filter(collection, predicate) {
  27789. var func = isArray(collection) ? arrayFilter : baseFilter;
  27790. return func(collection, getIteratee(predicate, 3));
  27791. }
  27792. /**
  27793. * Iterates over elements of `collection`, returning the first element
  27794. * `predicate` returns truthy for. The predicate is invoked with three
  27795. * arguments: (value, index|key, collection).
  27796. *
  27797. * @static
  27798. * @memberOf _
  27799. * @since 0.1.0
  27800. * @category Collection
  27801. * @param {Array|Object} collection The collection to inspect.
  27802. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27803. * @param {number} [fromIndex=0] The index to search from.
  27804. * @returns {*} Returns the matched element, else `undefined`.
  27805. * @example
  27806. *
  27807. * var users = [
  27808. * { 'user': 'barney', 'age': 36, 'active': true },
  27809. * { 'user': 'fred', 'age': 40, 'active': false },
  27810. * { 'user': 'pebbles', 'age': 1, 'active': true }
  27811. * ];
  27812. *
  27813. * _.find(users, function(o) { return o.age < 40; });
  27814. * // => object for 'barney'
  27815. *
  27816. * // The `_.matches` iteratee shorthand.
  27817. * _.find(users, { 'age': 1, 'active': true });
  27818. * // => object for 'pebbles'
  27819. *
  27820. * // The `_.matchesProperty` iteratee shorthand.
  27821. * _.find(users, ['active', false]);
  27822. * // => object for 'fred'
  27823. *
  27824. * // The `_.property` iteratee shorthand.
  27825. * _.find(users, 'active');
  27826. * // => object for 'barney'
  27827. */
  27828. var find = createFind(findIndex);
  27829. /**
  27830. * This method is like `_.find` except that it iterates over elements of
  27831. * `collection` from right to left.
  27832. *
  27833. * @static
  27834. * @memberOf _
  27835. * @since 2.0.0
  27836. * @category Collection
  27837. * @param {Array|Object} collection The collection to inspect.
  27838. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27839. * @param {number} [fromIndex=collection.length-1] The index to search from.
  27840. * @returns {*} Returns the matched element, else `undefined`.
  27841. * @example
  27842. *
  27843. * _.findLast([1, 2, 3, 4], function(n) {
  27844. * return n % 2 == 1;
  27845. * });
  27846. * // => 3
  27847. */
  27848. var findLast = createFind(findLastIndex);
  27849. /**
  27850. * Creates a flattened array of values by running each element in `collection`
  27851. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  27852. * with three arguments: (value, index|key, collection).
  27853. *
  27854. * @static
  27855. * @memberOf _
  27856. * @since 4.0.0
  27857. * @category Collection
  27858. * @param {Array|Object} collection The collection to iterate over.
  27859. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27860. * @returns {Array} Returns the new flattened array.
  27861. * @example
  27862. *
  27863. * function duplicate(n) {
  27864. * return [n, n];
  27865. * }
  27866. *
  27867. * _.flatMap([1, 2], duplicate);
  27868. * // => [1, 1, 2, 2]
  27869. */
  27870. function flatMap(collection, iteratee) {
  27871. return baseFlatten(map(collection, iteratee), 1);
  27872. }
  27873. /**
  27874. * This method is like `_.flatMap` except that it recursively flattens the
  27875. * mapped results.
  27876. *
  27877. * @static
  27878. * @memberOf _
  27879. * @since 4.7.0
  27880. * @category Collection
  27881. * @param {Array|Object} collection The collection to iterate over.
  27882. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27883. * @returns {Array} Returns the new flattened array.
  27884. * @example
  27885. *
  27886. * function duplicate(n) {
  27887. * return [[[n, n]]];
  27888. * }
  27889. *
  27890. * _.flatMapDeep([1, 2], duplicate);
  27891. * // => [1, 1, 2, 2]
  27892. */
  27893. function flatMapDeep(collection, iteratee) {
  27894. return baseFlatten(map(collection, iteratee), INFINITY);
  27895. }
  27896. /**
  27897. * This method is like `_.flatMap` except that it recursively flattens the
  27898. * mapped results up to `depth` times.
  27899. *
  27900. * @static
  27901. * @memberOf _
  27902. * @since 4.7.0
  27903. * @category Collection
  27904. * @param {Array|Object} collection The collection to iterate over.
  27905. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27906. * @param {number} [depth=1] The maximum recursion depth.
  27907. * @returns {Array} Returns the new flattened array.
  27908. * @example
  27909. *
  27910. * function duplicate(n) {
  27911. * return [[[n, n]]];
  27912. * }
  27913. *
  27914. * _.flatMapDepth([1, 2], duplicate, 2);
  27915. * // => [[1, 1], [2, 2]]
  27916. */
  27917. function flatMapDepth(collection, iteratee, depth) {
  27918. depth = depth === undefined ? 1 : toInteger(depth);
  27919. return baseFlatten(map(collection, iteratee), depth);
  27920. }
  27921. /**
  27922. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  27923. * The iteratee is invoked with three arguments: (value, index|key, collection).
  27924. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27925. *
  27926. * **Note:** As with other "Collections" methods, objects with a "length"
  27927. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  27928. * or `_.forOwn` for object iteration.
  27929. *
  27930. * @static
  27931. * @memberOf _
  27932. * @since 0.1.0
  27933. * @alias each
  27934. * @category Collection
  27935. * @param {Array|Object} collection The collection to iterate over.
  27936. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27937. * @returns {Array|Object} Returns `collection`.
  27938. * @see _.forEachRight
  27939. * @example
  27940. *
  27941. * _.forEach([1, 2], function(value) {
  27942. * console.log(value);
  27943. * });
  27944. * // => Logs `1` then `2`.
  27945. *
  27946. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27947. * console.log(key);
  27948. * });
  27949. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27950. */
  27951. function forEach(collection, iteratee) {
  27952. var func = isArray(collection) ? arrayEach : baseEach;
  27953. return func(collection, getIteratee(iteratee, 3));
  27954. }
  27955. /**
  27956. * This method is like `_.forEach` except that it iterates over elements of
  27957. * `collection` from right to left.
  27958. *
  27959. * @static
  27960. * @memberOf _
  27961. * @since 2.0.0
  27962. * @alias eachRight
  27963. * @category Collection
  27964. * @param {Array|Object} collection The collection to iterate over.
  27965. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27966. * @returns {Array|Object} Returns `collection`.
  27967. * @see _.forEach
  27968. * @example
  27969. *
  27970. * _.forEachRight([1, 2], function(value) {
  27971. * console.log(value);
  27972. * });
  27973. * // => Logs `2` then `1`.
  27974. */
  27975. function forEachRight(collection, iteratee) {
  27976. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27977. return func(collection, getIteratee(iteratee, 3));
  27978. }
  27979. /**
  27980. * Creates an object composed of keys generated from the results of running
  27981. * each element of `collection` thru `iteratee`. The order of grouped values
  27982. * is determined by the order they occur in `collection`. The corresponding
  27983. * value of each key is an array of elements responsible for generating the
  27984. * key. The iteratee is invoked with one argument: (value).
  27985. *
  27986. * @static
  27987. * @memberOf _
  27988. * @since 0.1.0
  27989. * @category Collection
  27990. * @param {Array|Object} collection The collection to iterate over.
  27991. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27992. * @returns {Object} Returns the composed aggregate object.
  27993. * @example
  27994. *
  27995. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27996. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27997. *
  27998. * // The `_.property` iteratee shorthand.
  27999. * _.groupBy(['one', 'two', 'three'], 'length');
  28000. * // => { '3': ['one', 'two'], '5': ['three'] }
  28001. */
  28002. var groupBy = createAggregator(function(result, value, key) {
  28003. if (hasOwnProperty.call(result, key)) {
  28004. result[key].push(value);
  28005. } else {
  28006. baseAssignValue(result, key, [value]);
  28007. }
  28008. });
  28009. /**
  28010. * Checks if `value` is in `collection`. If `collection` is a string, it's
  28011. * checked for a substring of `value`, otherwise
  28012. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28013. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  28014. * the offset from the end of `collection`.
  28015. *
  28016. * @static
  28017. * @memberOf _
  28018. * @since 0.1.0
  28019. * @category Collection
  28020. * @param {Array|Object|string} collection The collection to inspect.
  28021. * @param {*} value The value to search for.
  28022. * @param {number} [fromIndex=0] The index to search from.
  28023. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  28024. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  28025. * @example
  28026. *
  28027. * _.includes([1, 2, 3], 1);
  28028. * // => true
  28029. *
  28030. * _.includes([1, 2, 3], 1, 2);
  28031. * // => false
  28032. *
  28033. * _.includes({ 'a': 1, 'b': 2 }, 1);
  28034. * // => true
  28035. *
  28036. * _.includes('abcd', 'bc');
  28037. * // => true
  28038. */
  28039. function includes(collection, value, fromIndex, guard) {
  28040. collection = isArrayLike(collection) ? collection : values(collection);
  28041. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  28042. var length = collection.length;
  28043. if (fromIndex < 0) {
  28044. fromIndex = nativeMax(length + fromIndex, 0);
  28045. }
  28046. return isString(collection)
  28047. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  28048. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  28049. }
  28050. /**
  28051. * Invokes the method at `path` of each element in `collection`, returning
  28052. * an array of the results of each invoked method. Any additional arguments
  28053. * are provided to each invoked method. If `path` is a function, it's invoked
  28054. * for, and `this` bound to, each element in `collection`.
  28055. *
  28056. * @static
  28057. * @memberOf _
  28058. * @since 4.0.0
  28059. * @category Collection
  28060. * @param {Array|Object} collection The collection to iterate over.
  28061. * @param {Array|Function|string} path The path of the method to invoke or
  28062. * the function invoked per iteration.
  28063. * @param {...*} [args] The arguments to invoke each method with.
  28064. * @returns {Array} Returns the array of results.
  28065. * @example
  28066. *
  28067. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  28068. * // => [[1, 5, 7], [1, 2, 3]]
  28069. *
  28070. * _.invokeMap([123, 456], String.prototype.split, '');
  28071. * // => [['1', '2', '3'], ['4', '5', '6']]
  28072. */
  28073. var invokeMap = baseRest(function(collection, path, args) {
  28074. var index = -1,
  28075. isFunc = typeof path == 'function',
  28076. result = isArrayLike(collection) ? Array(collection.length) : [];
  28077. baseEach(collection, function(value) {
  28078. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  28079. });
  28080. return result;
  28081. });
  28082. /**
  28083. * Creates an object composed of keys generated from the results of running
  28084. * each element of `collection` thru `iteratee`. The corresponding value of
  28085. * each key is the last element responsible for generating the key. The
  28086. * iteratee is invoked with one argument: (value).
  28087. *
  28088. * @static
  28089. * @memberOf _
  28090. * @since 4.0.0
  28091. * @category Collection
  28092. * @param {Array|Object} collection The collection to iterate over.
  28093. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  28094. * @returns {Object} Returns the composed aggregate object.
  28095. * @example
  28096. *
  28097. * var array = [
  28098. * { 'dir': 'left', 'code': 97 },
  28099. * { 'dir': 'right', 'code': 100 }
  28100. * ];
  28101. *
  28102. * _.keyBy(array, function(o) {
  28103. * return String.fromCharCode(o.code);
  28104. * });
  28105. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  28106. *
  28107. * _.keyBy(array, 'dir');
  28108. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  28109. */
  28110. var keyBy = createAggregator(function(result, value, key) {
  28111. baseAssignValue(result, key, value);
  28112. });
  28113. /**
  28114. * Creates an array of values by running each element in `collection` thru
  28115. * `iteratee`. The iteratee is invoked with three arguments:
  28116. * (value, index|key, collection).
  28117. *
  28118. * Many lodash methods are guarded to work as iteratees for methods like
  28119. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  28120. *
  28121. * The guarded methods are:
  28122. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  28123. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  28124. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  28125. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  28126. *
  28127. * @static
  28128. * @memberOf _
  28129. * @since 0.1.0
  28130. * @category Collection
  28131. * @param {Array|Object} collection The collection to iterate over.
  28132. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28133. * @returns {Array} Returns the new mapped array.
  28134. * @example
  28135. *
  28136. * function square(n) {
  28137. * return n * n;
  28138. * }
  28139. *
  28140. * _.map([4, 8], square);
  28141. * // => [16, 64]
  28142. *
  28143. * _.map({ 'a': 4, 'b': 8 }, square);
  28144. * // => [16, 64] (iteration order is not guaranteed)
  28145. *
  28146. * var users = [
  28147. * { 'user': 'barney' },
  28148. * { 'user': 'fred' }
  28149. * ];
  28150. *
  28151. * // The `_.property` iteratee shorthand.
  28152. * _.map(users, 'user');
  28153. * // => ['barney', 'fred']
  28154. */
  28155. function map(collection, iteratee) {
  28156. var func = isArray(collection) ? arrayMap : baseMap;
  28157. return func(collection, getIteratee(iteratee, 3));
  28158. }
  28159. /**
  28160. * This method is like `_.sortBy` except that it allows specifying the sort
  28161. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  28162. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  28163. * descending or "asc" for ascending sort order of corresponding values.
  28164. *
  28165. * @static
  28166. * @memberOf _
  28167. * @since 4.0.0
  28168. * @category Collection
  28169. * @param {Array|Object} collection The collection to iterate over.
  28170. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  28171. * The iteratees to sort by.
  28172. * @param {string[]} [orders] The sort orders of `iteratees`.
  28173. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  28174. * @returns {Array} Returns the new sorted array.
  28175. * @example
  28176. *
  28177. * var users = [
  28178. * { 'user': 'fred', 'age': 48 },
  28179. * { 'user': 'barney', 'age': 34 },
  28180. * { 'user': 'fred', 'age': 40 },
  28181. * { 'user': 'barney', 'age': 36 }
  28182. * ];
  28183. *
  28184. * // Sort by `user` in ascending order and by `age` in descending order.
  28185. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  28186. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  28187. */
  28188. function orderBy(collection, iteratees, orders, guard) {
  28189. if (collection == null) {
  28190. return [];
  28191. }
  28192. if (!isArray(iteratees)) {
  28193. iteratees = iteratees == null ? [] : [iteratees];
  28194. }
  28195. orders = guard ? undefined : orders;
  28196. if (!isArray(orders)) {
  28197. orders = orders == null ? [] : [orders];
  28198. }
  28199. return baseOrderBy(collection, iteratees, orders);
  28200. }
  28201. /**
  28202. * Creates an array of elements split into two groups, the first of which
  28203. * contains elements `predicate` returns truthy for, the second of which
  28204. * contains elements `predicate` returns falsey for. The predicate is
  28205. * invoked with one argument: (value).
  28206. *
  28207. * @static
  28208. * @memberOf _
  28209. * @since 3.0.0
  28210. * @category Collection
  28211. * @param {Array|Object} collection The collection to iterate over.
  28212. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28213. * @returns {Array} Returns the array of grouped elements.
  28214. * @example
  28215. *
  28216. * var users = [
  28217. * { 'user': 'barney', 'age': 36, 'active': false },
  28218. * { 'user': 'fred', 'age': 40, 'active': true },
  28219. * { 'user': 'pebbles', 'age': 1, 'active': false }
  28220. * ];
  28221. *
  28222. * _.partition(users, function(o) { return o.active; });
  28223. * // => objects for [['fred'], ['barney', 'pebbles']]
  28224. *
  28225. * // The `_.matches` iteratee shorthand.
  28226. * _.partition(users, { 'age': 1, 'active': false });
  28227. * // => objects for [['pebbles'], ['barney', 'fred']]
  28228. *
  28229. * // The `_.matchesProperty` iteratee shorthand.
  28230. * _.partition(users, ['active', false]);
  28231. * // => objects for [['barney', 'pebbles'], ['fred']]
  28232. *
  28233. * // The `_.property` iteratee shorthand.
  28234. * _.partition(users, 'active');
  28235. * // => objects for [['fred'], ['barney', 'pebbles']]
  28236. */
  28237. var partition = createAggregator(function(result, value, key) {
  28238. result[key ? 0 : 1].push(value);
  28239. }, function() { return [[], []]; });
  28240. /**
  28241. * Reduces `collection` to a value which is the accumulated result of running
  28242. * each element in `collection` thru `iteratee`, where each successive
  28243. * invocation is supplied the return value of the previous. If `accumulator`
  28244. * is not given, the first element of `collection` is used as the initial
  28245. * value. The iteratee is invoked with four arguments:
  28246. * (accumulator, value, index|key, collection).
  28247. *
  28248. * Many lodash methods are guarded to work as iteratees for methods like
  28249. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  28250. *
  28251. * The guarded methods are:
  28252. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  28253. * and `sortBy`
  28254. *
  28255. * @static
  28256. * @memberOf _
  28257. * @since 0.1.0
  28258. * @category Collection
  28259. * @param {Array|Object} collection The collection to iterate over.
  28260. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28261. * @param {*} [accumulator] The initial value.
  28262. * @returns {*} Returns the accumulated value.
  28263. * @see _.reduceRight
  28264. * @example
  28265. *
  28266. * _.reduce([1, 2], function(sum, n) {
  28267. * return sum + n;
  28268. * }, 0);
  28269. * // => 3
  28270. *
  28271. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  28272. * (result[value] || (result[value] = [])).push(key);
  28273. * return result;
  28274. * }, {});
  28275. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  28276. */
  28277. function reduce(collection, iteratee, accumulator) {
  28278. var func = isArray(collection) ? arrayReduce : baseReduce,
  28279. initAccum = arguments.length < 3;
  28280. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  28281. }
  28282. /**
  28283. * This method is like `_.reduce` except that it iterates over elements of
  28284. * `collection` from right to left.
  28285. *
  28286. * @static
  28287. * @memberOf _
  28288. * @since 0.1.0
  28289. * @category Collection
  28290. * @param {Array|Object} collection The collection to iterate over.
  28291. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28292. * @param {*} [accumulator] The initial value.
  28293. * @returns {*} Returns the accumulated value.
  28294. * @see _.reduce
  28295. * @example
  28296. *
  28297. * var array = [[0, 1], [2, 3], [4, 5]];
  28298. *
  28299. * _.reduceRight(array, function(flattened, other) {
  28300. * return flattened.concat(other);
  28301. * }, []);
  28302. * // => [4, 5, 2, 3, 0, 1]
  28303. */
  28304. function reduceRight(collection, iteratee, accumulator) {
  28305. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  28306. initAccum = arguments.length < 3;
  28307. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  28308. }
  28309. /**
  28310. * The opposite of `_.filter`; this method returns the elements of `collection`
  28311. * that `predicate` does **not** return truthy for.
  28312. *
  28313. * @static
  28314. * @memberOf _
  28315. * @since 0.1.0
  28316. * @category Collection
  28317. * @param {Array|Object} collection The collection to iterate over.
  28318. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28319. * @returns {Array} Returns the new filtered array.
  28320. * @see _.filter
  28321. * @example
  28322. *
  28323. * var users = [
  28324. * { 'user': 'barney', 'age': 36, 'active': false },
  28325. * { 'user': 'fred', 'age': 40, 'active': true }
  28326. * ];
  28327. *
  28328. * _.reject(users, function(o) { return !o.active; });
  28329. * // => objects for ['fred']
  28330. *
  28331. * // The `_.matches` iteratee shorthand.
  28332. * _.reject(users, { 'age': 40, 'active': true });
  28333. * // => objects for ['barney']
  28334. *
  28335. * // The `_.matchesProperty` iteratee shorthand.
  28336. * _.reject(users, ['active', false]);
  28337. * // => objects for ['fred']
  28338. *
  28339. * // The `_.property` iteratee shorthand.
  28340. * _.reject(users, 'active');
  28341. * // => objects for ['barney']
  28342. */
  28343. function reject(collection, predicate) {
  28344. var func = isArray(collection) ? arrayFilter : baseFilter;
  28345. return func(collection, negate(getIteratee(predicate, 3)));
  28346. }
  28347. /**
  28348. * Gets a random element from `collection`.
  28349. *
  28350. * @static
  28351. * @memberOf _
  28352. * @since 2.0.0
  28353. * @category Collection
  28354. * @param {Array|Object} collection The collection to sample.
  28355. * @returns {*} Returns the random element.
  28356. * @example
  28357. *
  28358. * _.sample([1, 2, 3, 4]);
  28359. * // => 2
  28360. */
  28361. function sample(collection) {
  28362. var func = isArray(collection) ? arraySample : baseSample;
  28363. return func(collection);
  28364. }
  28365. /**
  28366. * Gets `n` random elements at unique keys from `collection` up to the
  28367. * size of `collection`.
  28368. *
  28369. * @static
  28370. * @memberOf _
  28371. * @since 4.0.0
  28372. * @category Collection
  28373. * @param {Array|Object} collection The collection to sample.
  28374. * @param {number} [n=1] The number of elements to sample.
  28375. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28376. * @returns {Array} Returns the random elements.
  28377. * @example
  28378. *
  28379. * _.sampleSize([1, 2, 3], 2);
  28380. * // => [3, 1]
  28381. *
  28382. * _.sampleSize([1, 2, 3], 4);
  28383. * // => [2, 3, 1]
  28384. */
  28385. function sampleSize(collection, n, guard) {
  28386. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  28387. n = 1;
  28388. } else {
  28389. n = toInteger(n);
  28390. }
  28391. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  28392. return func(collection, n);
  28393. }
  28394. /**
  28395. * Creates an array of shuffled values, using a version of the
  28396. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  28397. *
  28398. * @static
  28399. * @memberOf _
  28400. * @since 0.1.0
  28401. * @category Collection
  28402. * @param {Array|Object} collection The collection to shuffle.
  28403. * @returns {Array} Returns the new shuffled array.
  28404. * @example
  28405. *
  28406. * _.shuffle([1, 2, 3, 4]);
  28407. * // => [4, 1, 3, 2]
  28408. */
  28409. function shuffle(collection) {
  28410. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  28411. return func(collection);
  28412. }
  28413. /**
  28414. * Gets the size of `collection` by returning its length for array-like
  28415. * values or the number of own enumerable string keyed properties for objects.
  28416. *
  28417. * @static
  28418. * @memberOf _
  28419. * @since 0.1.0
  28420. * @category Collection
  28421. * @param {Array|Object|string} collection The collection to inspect.
  28422. * @returns {number} Returns the collection size.
  28423. * @example
  28424. *
  28425. * _.size([1, 2, 3]);
  28426. * // => 3
  28427. *
  28428. * _.size({ 'a': 1, 'b': 2 });
  28429. * // => 2
  28430. *
  28431. * _.size('pebbles');
  28432. * // => 7
  28433. */
  28434. function size(collection) {
  28435. if (collection == null) {
  28436. return 0;
  28437. }
  28438. if (isArrayLike(collection)) {
  28439. return isString(collection) ? stringSize(collection) : collection.length;
  28440. }
  28441. var tag = getTag(collection);
  28442. if (tag == mapTag || tag == setTag) {
  28443. return collection.size;
  28444. }
  28445. return baseKeys(collection).length;
  28446. }
  28447. /**
  28448. * Checks if `predicate` returns truthy for **any** element of `collection`.
  28449. * Iteration is stopped once `predicate` returns truthy. The predicate is
  28450. * invoked with three arguments: (value, index|key, collection).
  28451. *
  28452. * @static
  28453. * @memberOf _
  28454. * @since 0.1.0
  28455. * @category Collection
  28456. * @param {Array|Object} collection The collection to iterate over.
  28457. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28458. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28459. * @returns {boolean} Returns `true` if any element passes the predicate check,
  28460. * else `false`.
  28461. * @example
  28462. *
  28463. * _.some([null, 0, 'yes', false], Boolean);
  28464. * // => true
  28465. *
  28466. * var users = [
  28467. * { 'user': 'barney', 'active': true },
  28468. * { 'user': 'fred', 'active': false }
  28469. * ];
  28470. *
  28471. * // The `_.matches` iteratee shorthand.
  28472. * _.some(users, { 'user': 'barney', 'active': false });
  28473. * // => false
  28474. *
  28475. * // The `_.matchesProperty` iteratee shorthand.
  28476. * _.some(users, ['active', false]);
  28477. * // => true
  28478. *
  28479. * // The `_.property` iteratee shorthand.
  28480. * _.some(users, 'active');
  28481. * // => true
  28482. */
  28483. function some(collection, predicate, guard) {
  28484. var func = isArray(collection) ? arraySome : baseSome;
  28485. if (guard && isIterateeCall(collection, predicate, guard)) {
  28486. predicate = undefined;
  28487. }
  28488. return func(collection, getIteratee(predicate, 3));
  28489. }
  28490. /**
  28491. * Creates an array of elements, sorted in ascending order by the results of
  28492. * running each element in a collection thru each iteratee. This method
  28493. * performs a stable sort, that is, it preserves the original sort order of
  28494. * equal elements. The iteratees are invoked with one argument: (value).
  28495. *
  28496. * @static
  28497. * @memberOf _
  28498. * @since 0.1.0
  28499. * @category Collection
  28500. * @param {Array|Object} collection The collection to iterate over.
  28501. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  28502. * The iteratees to sort by.
  28503. * @returns {Array} Returns the new sorted array.
  28504. * @example
  28505. *
  28506. * var users = [
  28507. * { 'user': 'fred', 'age': 48 },
  28508. * { 'user': 'barney', 'age': 36 },
  28509. * { 'user': 'fred', 'age': 40 },
  28510. * { 'user': 'barney', 'age': 34 }
  28511. * ];
  28512. *
  28513. * _.sortBy(users, [function(o) { return o.user; }]);
  28514. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  28515. *
  28516. * _.sortBy(users, ['user', 'age']);
  28517. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  28518. */
  28519. var sortBy = baseRest(function(collection, iteratees) {
  28520. if (collection == null) {
  28521. return [];
  28522. }
  28523. var length = iteratees.length;
  28524. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  28525. iteratees = [];
  28526. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  28527. iteratees = [iteratees[0]];
  28528. }
  28529. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  28530. });
  28531. /*------------------------------------------------------------------------*/
  28532. /**
  28533. * Gets the timestamp of the number of milliseconds that have elapsed since
  28534. * the Unix epoch (1 January 1970 00:00:00 UTC).
  28535. *
  28536. * @static
  28537. * @memberOf _
  28538. * @since 2.4.0
  28539. * @category Date
  28540. * @returns {number} Returns the timestamp.
  28541. * @example
  28542. *
  28543. * _.defer(function(stamp) {
  28544. * console.log(_.now() - stamp);
  28545. * }, _.now());
  28546. * // => Logs the number of milliseconds it took for the deferred invocation.
  28547. */
  28548. var now = ctxNow || function() {
  28549. return root.Date.now();
  28550. };
  28551. /*------------------------------------------------------------------------*/
  28552. /**
  28553. * The opposite of `_.before`; this method creates a function that invokes
  28554. * `func` once it's called `n` or more times.
  28555. *
  28556. * @static
  28557. * @memberOf _
  28558. * @since 0.1.0
  28559. * @category Function
  28560. * @param {number} n The number of calls before `func` is invoked.
  28561. * @param {Function} func The function to restrict.
  28562. * @returns {Function} Returns the new restricted function.
  28563. * @example
  28564. *
  28565. * var saves = ['profile', 'settings'];
  28566. *
  28567. * var done = _.after(saves.length, function() {
  28568. * console.log('done saving!');
  28569. * });
  28570. *
  28571. * _.forEach(saves, function(type) {
  28572. * asyncSave({ 'type': type, 'complete': done });
  28573. * });
  28574. * // => Logs 'done saving!' after the two async saves have completed.
  28575. */
  28576. function after(n, func) {
  28577. if (typeof func != 'function') {
  28578. throw new TypeError(FUNC_ERROR_TEXT);
  28579. }
  28580. n = toInteger(n);
  28581. return function() {
  28582. if (--n < 1) {
  28583. return func.apply(this, arguments);
  28584. }
  28585. };
  28586. }
  28587. /**
  28588. * Creates a function that invokes `func`, with up to `n` arguments,
  28589. * ignoring any additional arguments.
  28590. *
  28591. * @static
  28592. * @memberOf _
  28593. * @since 3.0.0
  28594. * @category Function
  28595. * @param {Function} func The function to cap arguments for.
  28596. * @param {number} [n=func.length] The arity cap.
  28597. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28598. * @returns {Function} Returns the new capped function.
  28599. * @example
  28600. *
  28601. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  28602. * // => [6, 8, 10]
  28603. */
  28604. function ary(func, n, guard) {
  28605. n = guard ? undefined : n;
  28606. n = (func && n == null) ? func.length : n;
  28607. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  28608. }
  28609. /**
  28610. * Creates a function that invokes `func`, with the `this` binding and arguments
  28611. * of the created function, while it's called less than `n` times. Subsequent
  28612. * calls to the created function return the result of the last `func` invocation.
  28613. *
  28614. * @static
  28615. * @memberOf _
  28616. * @since 3.0.0
  28617. * @category Function
  28618. * @param {number} n The number of calls at which `func` is no longer invoked.
  28619. * @param {Function} func The function to restrict.
  28620. * @returns {Function} Returns the new restricted function.
  28621. * @example
  28622. *
  28623. * jQuery(element).on('click', _.before(5, addContactToList));
  28624. * // => Allows adding up to 4 contacts to the list.
  28625. */
  28626. function before(n, func) {
  28627. var result;
  28628. if (typeof func != 'function') {
  28629. throw new TypeError(FUNC_ERROR_TEXT);
  28630. }
  28631. n = toInteger(n);
  28632. return function() {
  28633. if (--n > 0) {
  28634. result = func.apply(this, arguments);
  28635. }
  28636. if (n <= 1) {
  28637. func = undefined;
  28638. }
  28639. return result;
  28640. };
  28641. }
  28642. /**
  28643. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  28644. * and `partials` prepended to the arguments it receives.
  28645. *
  28646. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  28647. * may be used as a placeholder for partially applied arguments.
  28648. *
  28649. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  28650. * property of bound functions.
  28651. *
  28652. * @static
  28653. * @memberOf _
  28654. * @since 0.1.0
  28655. * @category Function
  28656. * @param {Function} func The function to bind.
  28657. * @param {*} thisArg The `this` binding of `func`.
  28658. * @param {...*} [partials] The arguments to be partially applied.
  28659. * @returns {Function} Returns the new bound function.
  28660. * @example
  28661. *
  28662. * function greet(greeting, punctuation) {
  28663. * return greeting + ' ' + this.user + punctuation;
  28664. * }
  28665. *
  28666. * var object = { 'user': 'fred' };
  28667. *
  28668. * var bound = _.bind(greet, object, 'hi');
  28669. * bound('!');
  28670. * // => 'hi fred!'
  28671. *
  28672. * // Bound with placeholders.
  28673. * var bound = _.bind(greet, object, _, '!');
  28674. * bound('hi');
  28675. * // => 'hi fred!'
  28676. */
  28677. var bind = baseRest(function(func, thisArg, partials) {
  28678. var bitmask = WRAP_BIND_FLAG;
  28679. if (partials.length) {
  28680. var holders = replaceHolders(partials, getHolder(bind));
  28681. bitmask |= WRAP_PARTIAL_FLAG;
  28682. }
  28683. return createWrap(func, bitmask, thisArg, partials, holders);
  28684. });
  28685. /**
  28686. * Creates a function that invokes the method at `object[key]` with `partials`
  28687. * prepended to the arguments it receives.
  28688. *
  28689. * This method differs from `_.bind` by allowing bound functions to reference
  28690. * methods that may be redefined or don't yet exist. See
  28691. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  28692. * for more details.
  28693. *
  28694. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  28695. * builds, may be used as a placeholder for partially applied arguments.
  28696. *
  28697. * @static
  28698. * @memberOf _
  28699. * @since 0.10.0
  28700. * @category Function
  28701. * @param {Object} object The object to invoke the method on.
  28702. * @param {string} key The key of the method.
  28703. * @param {...*} [partials] The arguments to be partially applied.
  28704. * @returns {Function} Returns the new bound function.
  28705. * @example
  28706. *
  28707. * var object = {
  28708. * 'user': 'fred',
  28709. * 'greet': function(greeting, punctuation) {
  28710. * return greeting + ' ' + this.user + punctuation;
  28711. * }
  28712. * };
  28713. *
  28714. * var bound = _.bindKey(object, 'greet', 'hi');
  28715. * bound('!');
  28716. * // => 'hi fred!'
  28717. *
  28718. * object.greet = function(greeting, punctuation) {
  28719. * return greeting + 'ya ' + this.user + punctuation;
  28720. * };
  28721. *
  28722. * bound('!');
  28723. * // => 'hiya fred!'
  28724. *
  28725. * // Bound with placeholders.
  28726. * var bound = _.bindKey(object, 'greet', _, '!');
  28727. * bound('hi');
  28728. * // => 'hiya fred!'
  28729. */
  28730. var bindKey = baseRest(function(object, key, partials) {
  28731. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  28732. if (partials.length) {
  28733. var holders = replaceHolders(partials, getHolder(bindKey));
  28734. bitmask |= WRAP_PARTIAL_FLAG;
  28735. }
  28736. return createWrap(key, bitmask, object, partials, holders);
  28737. });
  28738. /**
  28739. * Creates a function that accepts arguments of `func` and either invokes
  28740. * `func` returning its result, if at least `arity` number of arguments have
  28741. * been provided, or returns a function that accepts the remaining `func`
  28742. * arguments, and so on. The arity of `func` may be specified if `func.length`
  28743. * is not sufficient.
  28744. *
  28745. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  28746. * may be used as a placeholder for provided arguments.
  28747. *
  28748. * **Note:** This method doesn't set the "length" property of curried functions.
  28749. *
  28750. * @static
  28751. * @memberOf _
  28752. * @since 2.0.0
  28753. * @category Function
  28754. * @param {Function} func The function to curry.
  28755. * @param {number} [arity=func.length] The arity of `func`.
  28756. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28757. * @returns {Function} Returns the new curried function.
  28758. * @example
  28759. *
  28760. * var abc = function(a, b, c) {
  28761. * return [a, b, c];
  28762. * };
  28763. *
  28764. * var curried = _.curry(abc);
  28765. *
  28766. * curried(1)(2)(3);
  28767. * // => [1, 2, 3]
  28768. *
  28769. * curried(1, 2)(3);
  28770. * // => [1, 2, 3]
  28771. *
  28772. * curried(1, 2, 3);
  28773. * // => [1, 2, 3]
  28774. *
  28775. * // Curried with placeholders.
  28776. * curried(1)(_, 3)(2);
  28777. * // => [1, 2, 3]
  28778. */
  28779. function curry(func, arity, guard) {
  28780. arity = guard ? undefined : arity;
  28781. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28782. result.placeholder = curry.placeholder;
  28783. return result;
  28784. }
  28785. /**
  28786. * This method is like `_.curry` except that arguments are applied to `func`
  28787. * in the manner of `_.partialRight` instead of `_.partial`.
  28788. *
  28789. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  28790. * builds, may be used as a placeholder for provided arguments.
  28791. *
  28792. * **Note:** This method doesn't set the "length" property of curried functions.
  28793. *
  28794. * @static
  28795. * @memberOf _
  28796. * @since 3.0.0
  28797. * @category Function
  28798. * @param {Function} func The function to curry.
  28799. * @param {number} [arity=func.length] The arity of `func`.
  28800. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28801. * @returns {Function} Returns the new curried function.
  28802. * @example
  28803. *
  28804. * var abc = function(a, b, c) {
  28805. * return [a, b, c];
  28806. * };
  28807. *
  28808. * var curried = _.curryRight(abc);
  28809. *
  28810. * curried(3)(2)(1);
  28811. * // => [1, 2, 3]
  28812. *
  28813. * curried(2, 3)(1);
  28814. * // => [1, 2, 3]
  28815. *
  28816. * curried(1, 2, 3);
  28817. * // => [1, 2, 3]
  28818. *
  28819. * // Curried with placeholders.
  28820. * curried(3)(1, _)(2);
  28821. * // => [1, 2, 3]
  28822. */
  28823. function curryRight(func, arity, guard) {
  28824. arity = guard ? undefined : arity;
  28825. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28826. result.placeholder = curryRight.placeholder;
  28827. return result;
  28828. }
  28829. /**
  28830. * Creates a debounced function that delays invoking `func` until after `wait`
  28831. * milliseconds have elapsed since the last time the debounced function was
  28832. * invoked. The debounced function comes with a `cancel` method to cancel
  28833. * delayed `func` invocations and a `flush` method to immediately invoke them.
  28834. * Provide `options` to indicate whether `func` should be invoked on the
  28835. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  28836. * with the last arguments provided to the debounced function. Subsequent
  28837. * calls to the debounced function return the result of the last `func`
  28838. * invocation.
  28839. *
  28840. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28841. * invoked on the trailing edge of the timeout only if the debounced function
  28842. * is invoked more than once during the `wait` timeout.
  28843. *
  28844. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28845. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28846. *
  28847. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28848. * for details over the differences between `_.debounce` and `_.throttle`.
  28849. *
  28850. * @static
  28851. * @memberOf _
  28852. * @since 0.1.0
  28853. * @category Function
  28854. * @param {Function} func The function to debounce.
  28855. * @param {number} [wait=0] The number of milliseconds to delay.
  28856. * @param {Object} [options={}] The options object.
  28857. * @param {boolean} [options.leading=false]
  28858. * Specify invoking on the leading edge of the timeout.
  28859. * @param {number} [options.maxWait]
  28860. * The maximum time `func` is allowed to be delayed before it's invoked.
  28861. * @param {boolean} [options.trailing=true]
  28862. * Specify invoking on the trailing edge of the timeout.
  28863. * @returns {Function} Returns the new debounced function.
  28864. * @example
  28865. *
  28866. * // Avoid costly calculations while the window size is in flux.
  28867. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  28868. *
  28869. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  28870. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  28871. * 'leading': true,
  28872. * 'trailing': false
  28873. * }));
  28874. *
  28875. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  28876. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  28877. * var source = new EventSource('/stream');
  28878. * jQuery(source).on('message', debounced);
  28879. *
  28880. * // Cancel the trailing debounced invocation.
  28881. * jQuery(window).on('popstate', debounced.cancel);
  28882. */
  28883. function debounce(func, wait, options) {
  28884. var lastArgs,
  28885. lastThis,
  28886. maxWait,
  28887. result,
  28888. timerId,
  28889. lastCallTime,
  28890. lastInvokeTime = 0,
  28891. leading = false,
  28892. maxing = false,
  28893. trailing = true;
  28894. if (typeof func != 'function') {
  28895. throw new TypeError(FUNC_ERROR_TEXT);
  28896. }
  28897. wait = toNumber(wait) || 0;
  28898. if (isObject(options)) {
  28899. leading = !!options.leading;
  28900. maxing = 'maxWait' in options;
  28901. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  28902. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28903. }
  28904. function invokeFunc(time) {
  28905. var args = lastArgs,
  28906. thisArg = lastThis;
  28907. lastArgs = lastThis = undefined;
  28908. lastInvokeTime = time;
  28909. result = func.apply(thisArg, args);
  28910. return result;
  28911. }
  28912. function leadingEdge(time) {
  28913. // Reset any `maxWait` timer.
  28914. lastInvokeTime = time;
  28915. // Start the timer for the trailing edge.
  28916. timerId = setTimeout(timerExpired, wait);
  28917. // Invoke the leading edge.
  28918. return leading ? invokeFunc(time) : result;
  28919. }
  28920. function remainingWait(time) {
  28921. var timeSinceLastCall = time - lastCallTime,
  28922. timeSinceLastInvoke = time - lastInvokeTime,
  28923. timeWaiting = wait - timeSinceLastCall;
  28924. return maxing
  28925. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  28926. : timeWaiting;
  28927. }
  28928. function shouldInvoke(time) {
  28929. var timeSinceLastCall = time - lastCallTime,
  28930. timeSinceLastInvoke = time - lastInvokeTime;
  28931. // Either this is the first call, activity has stopped and we're at the
  28932. // trailing edge, the system time has gone backwards and we're treating
  28933. // it as the trailing edge, or we've hit the `maxWait` limit.
  28934. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28935. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28936. }
  28937. function timerExpired() {
  28938. var time = now();
  28939. if (shouldInvoke(time)) {
  28940. return trailingEdge(time);
  28941. }
  28942. // Restart the timer.
  28943. timerId = setTimeout(timerExpired, remainingWait(time));
  28944. }
  28945. function trailingEdge(time) {
  28946. timerId = undefined;
  28947. // Only invoke if we have `lastArgs` which means `func` has been
  28948. // debounced at least once.
  28949. if (trailing && lastArgs) {
  28950. return invokeFunc(time);
  28951. }
  28952. lastArgs = lastThis = undefined;
  28953. return result;
  28954. }
  28955. function cancel() {
  28956. if (timerId !== undefined) {
  28957. clearTimeout(timerId);
  28958. }
  28959. lastInvokeTime = 0;
  28960. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28961. }
  28962. function flush() {
  28963. return timerId === undefined ? result : trailingEdge(now());
  28964. }
  28965. function debounced() {
  28966. var time = now(),
  28967. isInvoking = shouldInvoke(time);
  28968. lastArgs = arguments;
  28969. lastThis = this;
  28970. lastCallTime = time;
  28971. if (isInvoking) {
  28972. if (timerId === undefined) {
  28973. return leadingEdge(lastCallTime);
  28974. }
  28975. if (maxing) {
  28976. // Handle invocations in a tight loop.
  28977. clearTimeout(timerId);
  28978. timerId = setTimeout(timerExpired, wait);
  28979. return invokeFunc(lastCallTime);
  28980. }
  28981. }
  28982. if (timerId === undefined) {
  28983. timerId = setTimeout(timerExpired, wait);
  28984. }
  28985. return result;
  28986. }
  28987. debounced.cancel = cancel;
  28988. debounced.flush = flush;
  28989. return debounced;
  28990. }
  28991. /**
  28992. * Defers invoking the `func` until the current call stack has cleared. Any
  28993. * additional arguments are provided to `func` when it's invoked.
  28994. *
  28995. * @static
  28996. * @memberOf _
  28997. * @since 0.1.0
  28998. * @category Function
  28999. * @param {Function} func The function to defer.
  29000. * @param {...*} [args] The arguments to invoke `func` with.
  29001. * @returns {number} Returns the timer id.
  29002. * @example
  29003. *
  29004. * _.defer(function(text) {
  29005. * console.log(text);
  29006. * }, 'deferred');
  29007. * // => Logs 'deferred' after one millisecond.
  29008. */
  29009. var defer = baseRest(function(func, args) {
  29010. return baseDelay(func, 1, args);
  29011. });
  29012. /**
  29013. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  29014. * provided to `func` when it's invoked.
  29015. *
  29016. * @static
  29017. * @memberOf _
  29018. * @since 0.1.0
  29019. * @category Function
  29020. * @param {Function} func The function to delay.
  29021. * @param {number} wait The number of milliseconds to delay invocation.
  29022. * @param {...*} [args] The arguments to invoke `func` with.
  29023. * @returns {number} Returns the timer id.
  29024. * @example
  29025. *
  29026. * _.delay(function(text) {
  29027. * console.log(text);
  29028. * }, 1000, 'later');
  29029. * // => Logs 'later' after one second.
  29030. */
  29031. var delay = baseRest(function(func, wait, args) {
  29032. return baseDelay(func, toNumber(wait) || 0, args);
  29033. });
  29034. /**
  29035. * Creates a function that invokes `func` with arguments reversed.
  29036. *
  29037. * @static
  29038. * @memberOf _
  29039. * @since 4.0.0
  29040. * @category Function
  29041. * @param {Function} func The function to flip arguments for.
  29042. * @returns {Function} Returns the new flipped function.
  29043. * @example
  29044. *
  29045. * var flipped = _.flip(function() {
  29046. * return _.toArray(arguments);
  29047. * });
  29048. *
  29049. * flipped('a', 'b', 'c', 'd');
  29050. * // => ['d', 'c', 'b', 'a']
  29051. */
  29052. function flip(func) {
  29053. return createWrap(func, WRAP_FLIP_FLAG);
  29054. }
  29055. /**
  29056. * Creates a function that memoizes the result of `func`. If `resolver` is
  29057. * provided, it determines the cache key for storing the result based on the
  29058. * arguments provided to the memoized function. By default, the first argument
  29059. * provided to the memoized function is used as the map cache key. The `func`
  29060. * is invoked with the `this` binding of the memoized function.
  29061. *
  29062. * **Note:** The cache is exposed as the `cache` property on the memoized
  29063. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  29064. * constructor with one whose instances implement the
  29065. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  29066. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  29067. *
  29068. * @static
  29069. * @memberOf _
  29070. * @since 0.1.0
  29071. * @category Function
  29072. * @param {Function} func The function to have its output memoized.
  29073. * @param {Function} [resolver] The function to resolve the cache key.
  29074. * @returns {Function} Returns the new memoized function.
  29075. * @example
  29076. *
  29077. * var object = { 'a': 1, 'b': 2 };
  29078. * var other = { 'c': 3, 'd': 4 };
  29079. *
  29080. * var values = _.memoize(_.values);
  29081. * values(object);
  29082. * // => [1, 2]
  29083. *
  29084. * values(other);
  29085. * // => [3, 4]
  29086. *
  29087. * object.a = 2;
  29088. * values(object);
  29089. * // => [1, 2]
  29090. *
  29091. * // Modify the result cache.
  29092. * values.cache.set(object, ['a', 'b']);
  29093. * values(object);
  29094. * // => ['a', 'b']
  29095. *
  29096. * // Replace `_.memoize.Cache`.
  29097. * _.memoize.Cache = WeakMap;
  29098. */
  29099. function memoize(func, resolver) {
  29100. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  29101. throw new TypeError(FUNC_ERROR_TEXT);
  29102. }
  29103. var memoized = function() {
  29104. var args = arguments,
  29105. key = resolver ? resolver.apply(this, args) : args[0],
  29106. cache = memoized.cache;
  29107. if (cache.has(key)) {
  29108. return cache.get(key);
  29109. }
  29110. var result = func.apply(this, args);
  29111. memoized.cache = cache.set(key, result) || cache;
  29112. return result;
  29113. };
  29114. memoized.cache = new (memoize.Cache || MapCache);
  29115. return memoized;
  29116. }
  29117. // Expose `MapCache`.
  29118. memoize.Cache = MapCache;
  29119. /**
  29120. * Creates a function that negates the result of the predicate `func`. The
  29121. * `func` predicate is invoked with the `this` binding and arguments of the
  29122. * created function.
  29123. *
  29124. * @static
  29125. * @memberOf _
  29126. * @since 3.0.0
  29127. * @category Function
  29128. * @param {Function} predicate The predicate to negate.
  29129. * @returns {Function} Returns the new negated function.
  29130. * @example
  29131. *
  29132. * function isEven(n) {
  29133. * return n % 2 == 0;
  29134. * }
  29135. *
  29136. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  29137. * // => [1, 3, 5]
  29138. */
  29139. function negate(predicate) {
  29140. if (typeof predicate != 'function') {
  29141. throw new TypeError(FUNC_ERROR_TEXT);
  29142. }
  29143. return function() {
  29144. var args = arguments;
  29145. switch (args.length) {
  29146. case 0: return !predicate.call(this);
  29147. case 1: return !predicate.call(this, args[0]);
  29148. case 2: return !predicate.call(this, args[0], args[1]);
  29149. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  29150. }
  29151. return !predicate.apply(this, args);
  29152. };
  29153. }
  29154. /**
  29155. * Creates a function that is restricted to invoking `func` once. Repeat calls
  29156. * to the function return the value of the first invocation. The `func` is
  29157. * invoked with the `this` binding and arguments of the created function.
  29158. *
  29159. * @static
  29160. * @memberOf _
  29161. * @since 0.1.0
  29162. * @category Function
  29163. * @param {Function} func The function to restrict.
  29164. * @returns {Function} Returns the new restricted function.
  29165. * @example
  29166. *
  29167. * var initialize = _.once(createApplication);
  29168. * initialize();
  29169. * initialize();
  29170. * // => `createApplication` is invoked once
  29171. */
  29172. function once(func) {
  29173. return before(2, func);
  29174. }
  29175. /**
  29176. * Creates a function that invokes `func` with its arguments transformed.
  29177. *
  29178. * @static
  29179. * @since 4.0.0
  29180. * @memberOf _
  29181. * @category Function
  29182. * @param {Function} func The function to wrap.
  29183. * @param {...(Function|Function[])} [transforms=[_.identity]]
  29184. * The argument transforms.
  29185. * @returns {Function} Returns the new function.
  29186. * @example
  29187. *
  29188. * function doubled(n) {
  29189. * return n * 2;
  29190. * }
  29191. *
  29192. * function square(n) {
  29193. * return n * n;
  29194. * }
  29195. *
  29196. * var func = _.overArgs(function(x, y) {
  29197. * return [x, y];
  29198. * }, [square, doubled]);
  29199. *
  29200. * func(9, 3);
  29201. * // => [81, 6]
  29202. *
  29203. * func(10, 5);
  29204. * // => [100, 10]
  29205. */
  29206. var overArgs = castRest(function(func, transforms) {
  29207. transforms = (transforms.length == 1 && isArray(transforms[0]))
  29208. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  29209. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  29210. var funcsLength = transforms.length;
  29211. return baseRest(function(args) {
  29212. var index = -1,
  29213. length = nativeMin(args.length, funcsLength);
  29214. while (++index < length) {
  29215. args[index] = transforms[index].call(this, args[index]);
  29216. }
  29217. return apply(func, this, args);
  29218. });
  29219. });
  29220. /**
  29221. * Creates a function that invokes `func` with `partials` prepended to the
  29222. * arguments it receives. This method is like `_.bind` except it does **not**
  29223. * alter the `this` binding.
  29224. *
  29225. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  29226. * builds, may be used as a placeholder for partially applied arguments.
  29227. *
  29228. * **Note:** This method doesn't set the "length" property of partially
  29229. * applied functions.
  29230. *
  29231. * @static
  29232. * @memberOf _
  29233. * @since 0.2.0
  29234. * @category Function
  29235. * @param {Function} func The function to partially apply arguments to.
  29236. * @param {...*} [partials] The arguments to be partially applied.
  29237. * @returns {Function} Returns the new partially applied function.
  29238. * @example
  29239. *
  29240. * function greet(greeting, name) {
  29241. * return greeting + ' ' + name;
  29242. * }
  29243. *
  29244. * var sayHelloTo = _.partial(greet, 'hello');
  29245. * sayHelloTo('fred');
  29246. * // => 'hello fred'
  29247. *
  29248. * // Partially applied with placeholders.
  29249. * var greetFred = _.partial(greet, _, 'fred');
  29250. * greetFred('hi');
  29251. * // => 'hi fred'
  29252. */
  29253. var partial = baseRest(function(func, partials) {
  29254. var holders = replaceHolders(partials, getHolder(partial));
  29255. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  29256. });
  29257. /**
  29258. * This method is like `_.partial` except that partially applied arguments
  29259. * are appended to the arguments it receives.
  29260. *
  29261. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  29262. * builds, may be used as a placeholder for partially applied arguments.
  29263. *
  29264. * **Note:** This method doesn't set the "length" property of partially
  29265. * applied functions.
  29266. *
  29267. * @static
  29268. * @memberOf _
  29269. * @since 1.0.0
  29270. * @category Function
  29271. * @param {Function} func The function to partially apply arguments to.
  29272. * @param {...*} [partials] The arguments to be partially applied.
  29273. * @returns {Function} Returns the new partially applied function.
  29274. * @example
  29275. *
  29276. * function greet(greeting, name) {
  29277. * return greeting + ' ' + name;
  29278. * }
  29279. *
  29280. * var greetFred = _.partialRight(greet, 'fred');
  29281. * greetFred('hi');
  29282. * // => 'hi fred'
  29283. *
  29284. * // Partially applied with placeholders.
  29285. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  29286. * sayHelloTo('fred');
  29287. * // => 'hello fred'
  29288. */
  29289. var partialRight = baseRest(function(func, partials) {
  29290. var holders = replaceHolders(partials, getHolder(partialRight));
  29291. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  29292. });
  29293. /**
  29294. * Creates a function that invokes `func` with arguments arranged according
  29295. * to the specified `indexes` where the argument value at the first index is
  29296. * provided as the first argument, the argument value at the second index is
  29297. * provided as the second argument, and so on.
  29298. *
  29299. * @static
  29300. * @memberOf _
  29301. * @since 3.0.0
  29302. * @category Function
  29303. * @param {Function} func The function to rearrange arguments for.
  29304. * @param {...(number|number[])} indexes The arranged argument indexes.
  29305. * @returns {Function} Returns the new function.
  29306. * @example
  29307. *
  29308. * var rearged = _.rearg(function(a, b, c) {
  29309. * return [a, b, c];
  29310. * }, [2, 0, 1]);
  29311. *
  29312. * rearged('b', 'c', 'a')
  29313. * // => ['a', 'b', 'c']
  29314. */
  29315. var rearg = flatRest(function(func, indexes) {
  29316. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  29317. });
  29318. /**
  29319. * Creates a function that invokes `func` with the `this` binding of the
  29320. * created function and arguments from `start` and beyond provided as
  29321. * an array.
  29322. *
  29323. * **Note:** This method is based on the
  29324. * [rest parameter](https://mdn.io/rest_parameters).
  29325. *
  29326. * @static
  29327. * @memberOf _
  29328. * @since 4.0.0
  29329. * @category Function
  29330. * @param {Function} func The function to apply a rest parameter to.
  29331. * @param {number} [start=func.length-1] The start position of the rest parameter.
  29332. * @returns {Function} Returns the new function.
  29333. * @example
  29334. *
  29335. * var say = _.rest(function(what, names) {
  29336. * return what + ' ' + _.initial(names).join(', ') +
  29337. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  29338. * });
  29339. *
  29340. * say('hello', 'fred', 'barney', 'pebbles');
  29341. * // => 'hello fred, barney, & pebbles'
  29342. */
  29343. function rest(func, start) {
  29344. if (typeof func != 'function') {
  29345. throw new TypeError(FUNC_ERROR_TEXT);
  29346. }
  29347. start = start === undefined ? start : toInteger(start);
  29348. return baseRest(func, start);
  29349. }
  29350. /**
  29351. * Creates a function that invokes `func` with the `this` binding of the
  29352. * create function and an array of arguments much like
  29353. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  29354. *
  29355. * **Note:** This method is based on the
  29356. * [spread operator](https://mdn.io/spread_operator).
  29357. *
  29358. * @static
  29359. * @memberOf _
  29360. * @since 3.2.0
  29361. * @category Function
  29362. * @param {Function} func The function to spread arguments over.
  29363. * @param {number} [start=0] The start position of the spread.
  29364. * @returns {Function} Returns the new function.
  29365. * @example
  29366. *
  29367. * var say = _.spread(function(who, what) {
  29368. * return who + ' says ' + what;
  29369. * });
  29370. *
  29371. * say(['fred', 'hello']);
  29372. * // => 'fred says hello'
  29373. *
  29374. * var numbers = Promise.all([
  29375. * Promise.resolve(40),
  29376. * Promise.resolve(36)
  29377. * ]);
  29378. *
  29379. * numbers.then(_.spread(function(x, y) {
  29380. * return x + y;
  29381. * }));
  29382. * // => a Promise of 76
  29383. */
  29384. function spread(func, start) {
  29385. if (typeof func != 'function') {
  29386. throw new TypeError(FUNC_ERROR_TEXT);
  29387. }
  29388. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  29389. return baseRest(function(args) {
  29390. var array = args[start],
  29391. otherArgs = castSlice(args, 0, start);
  29392. if (array) {
  29393. arrayPush(otherArgs, array);
  29394. }
  29395. return apply(func, this, otherArgs);
  29396. });
  29397. }
  29398. /**
  29399. * Creates a throttled function that only invokes `func` at most once per
  29400. * every `wait` milliseconds. The throttled function comes with a `cancel`
  29401. * method to cancel delayed `func` invocations and a `flush` method to
  29402. * immediately invoke them. Provide `options` to indicate whether `func`
  29403. * should be invoked on the leading and/or trailing edge of the `wait`
  29404. * timeout. The `func` is invoked with the last arguments provided to the
  29405. * throttled function. Subsequent calls to the throttled function return the
  29406. * result of the last `func` invocation.
  29407. *
  29408. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  29409. * invoked on the trailing edge of the timeout only if the throttled function
  29410. * is invoked more than once during the `wait` timeout.
  29411. *
  29412. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  29413. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  29414. *
  29415. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  29416. * for details over the differences between `_.throttle` and `_.debounce`.
  29417. *
  29418. * @static
  29419. * @memberOf _
  29420. * @since 0.1.0
  29421. * @category Function
  29422. * @param {Function} func The function to throttle.
  29423. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  29424. * @param {Object} [options={}] The options object.
  29425. * @param {boolean} [options.leading=true]
  29426. * Specify invoking on the leading edge of the timeout.
  29427. * @param {boolean} [options.trailing=true]
  29428. * Specify invoking on the trailing edge of the timeout.
  29429. * @returns {Function} Returns the new throttled function.
  29430. * @example
  29431. *
  29432. * // Avoid excessively updating the position while scrolling.
  29433. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  29434. *
  29435. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  29436. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  29437. * jQuery(element).on('click', throttled);
  29438. *
  29439. * // Cancel the trailing throttled invocation.
  29440. * jQuery(window).on('popstate', throttled.cancel);
  29441. */
  29442. function throttle(func, wait, options) {
  29443. var leading = true,
  29444. trailing = true;
  29445. if (typeof func != 'function') {
  29446. throw new TypeError(FUNC_ERROR_TEXT);
  29447. }
  29448. if (isObject(options)) {
  29449. leading = 'leading' in options ? !!options.leading : leading;
  29450. trailing = 'trailing' in options ? !!options.trailing : trailing;
  29451. }
  29452. return debounce(func, wait, {
  29453. 'leading': leading,
  29454. 'maxWait': wait,
  29455. 'trailing': trailing
  29456. });
  29457. }
  29458. /**
  29459. * Creates a function that accepts up to one argument, ignoring any
  29460. * additional arguments.
  29461. *
  29462. * @static
  29463. * @memberOf _
  29464. * @since 4.0.0
  29465. * @category Function
  29466. * @param {Function} func The function to cap arguments for.
  29467. * @returns {Function} Returns the new capped function.
  29468. * @example
  29469. *
  29470. * _.map(['6', '8', '10'], _.unary(parseInt));
  29471. * // => [6, 8, 10]
  29472. */
  29473. function unary(func) {
  29474. return ary(func, 1);
  29475. }
  29476. /**
  29477. * Creates a function that provides `value` to `wrapper` as its first
  29478. * argument. Any additional arguments provided to the function are appended
  29479. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  29480. * binding of the created function.
  29481. *
  29482. * @static
  29483. * @memberOf _
  29484. * @since 0.1.0
  29485. * @category Function
  29486. * @param {*} value The value to wrap.
  29487. * @param {Function} [wrapper=identity] The wrapper function.
  29488. * @returns {Function} Returns the new function.
  29489. * @example
  29490. *
  29491. * var p = _.wrap(_.escape, function(func, text) {
  29492. * return '<p>' + func(text) + '</p>';
  29493. * });
  29494. *
  29495. * p('fred, barney, & pebbles');
  29496. * // => '<p>fred, barney, &amp; pebbles</p>'
  29497. */
  29498. function wrap(value, wrapper) {
  29499. return partial(castFunction(wrapper), value);
  29500. }
  29501. /*------------------------------------------------------------------------*/
  29502. /**
  29503. * Casts `value` as an array if it's not one.
  29504. *
  29505. * @static
  29506. * @memberOf _
  29507. * @since 4.4.0
  29508. * @category Lang
  29509. * @param {*} value The value to inspect.
  29510. * @returns {Array} Returns the cast array.
  29511. * @example
  29512. *
  29513. * _.castArray(1);
  29514. * // => [1]
  29515. *
  29516. * _.castArray({ 'a': 1 });
  29517. * // => [{ 'a': 1 }]
  29518. *
  29519. * _.castArray('abc');
  29520. * // => ['abc']
  29521. *
  29522. * _.castArray(null);
  29523. * // => [null]
  29524. *
  29525. * _.castArray(undefined);
  29526. * // => [undefined]
  29527. *
  29528. * _.castArray();
  29529. * // => []
  29530. *
  29531. * var array = [1, 2, 3];
  29532. * console.log(_.castArray(array) === array);
  29533. * // => true
  29534. */
  29535. function castArray() {
  29536. if (!arguments.length) {
  29537. return [];
  29538. }
  29539. var value = arguments[0];
  29540. return isArray(value) ? value : [value];
  29541. }
  29542. /**
  29543. * Creates a shallow clone of `value`.
  29544. *
  29545. * **Note:** This method is loosely based on the
  29546. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  29547. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  29548. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  29549. * arrays. The own enumerable properties of `arguments` objects are cloned
  29550. * as plain objects. An empty object is returned for uncloneable values such
  29551. * as error objects, functions, DOM nodes, and WeakMaps.
  29552. *
  29553. * @static
  29554. * @memberOf _
  29555. * @since 0.1.0
  29556. * @category Lang
  29557. * @param {*} value The value to clone.
  29558. * @returns {*} Returns the cloned value.
  29559. * @see _.cloneDeep
  29560. * @example
  29561. *
  29562. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29563. *
  29564. * var shallow = _.clone(objects);
  29565. * console.log(shallow[0] === objects[0]);
  29566. * // => true
  29567. */
  29568. function clone(value) {
  29569. return baseClone(value, CLONE_SYMBOLS_FLAG);
  29570. }
  29571. /**
  29572. * This method is like `_.clone` except that it accepts `customizer` which
  29573. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  29574. * cloning is handled by the method instead. The `customizer` is invoked with
  29575. * up to four arguments; (value [, index|key, object, stack]).
  29576. *
  29577. * @static
  29578. * @memberOf _
  29579. * @since 4.0.0
  29580. * @category Lang
  29581. * @param {*} value The value to clone.
  29582. * @param {Function} [customizer] The function to customize cloning.
  29583. * @returns {*} Returns the cloned value.
  29584. * @see _.cloneDeepWith
  29585. * @example
  29586. *
  29587. * function customizer(value) {
  29588. * if (_.isElement(value)) {
  29589. * return value.cloneNode(false);
  29590. * }
  29591. * }
  29592. *
  29593. * var el = _.cloneWith(document.body, customizer);
  29594. *
  29595. * console.log(el === document.body);
  29596. * // => false
  29597. * console.log(el.nodeName);
  29598. * // => 'BODY'
  29599. * console.log(el.childNodes.length);
  29600. * // => 0
  29601. */
  29602. function cloneWith(value, customizer) {
  29603. customizer = typeof customizer == 'function' ? customizer : undefined;
  29604. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  29605. }
  29606. /**
  29607. * This method is like `_.clone` except that it recursively clones `value`.
  29608. *
  29609. * @static
  29610. * @memberOf _
  29611. * @since 1.0.0
  29612. * @category Lang
  29613. * @param {*} value The value to recursively clone.
  29614. * @returns {*} Returns the deep cloned value.
  29615. * @see _.clone
  29616. * @example
  29617. *
  29618. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29619. *
  29620. * var deep = _.cloneDeep(objects);
  29621. * console.log(deep[0] === objects[0]);
  29622. * // => false
  29623. */
  29624. function cloneDeep(value) {
  29625. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  29626. }
  29627. /**
  29628. * This method is like `_.cloneWith` except that it recursively clones `value`.
  29629. *
  29630. * @static
  29631. * @memberOf _
  29632. * @since 4.0.0
  29633. * @category Lang
  29634. * @param {*} value The value to recursively clone.
  29635. * @param {Function} [customizer] The function to customize cloning.
  29636. * @returns {*} Returns the deep cloned value.
  29637. * @see _.cloneWith
  29638. * @example
  29639. *
  29640. * function customizer(value) {
  29641. * if (_.isElement(value)) {
  29642. * return value.cloneNode(true);
  29643. * }
  29644. * }
  29645. *
  29646. * var el = _.cloneDeepWith(document.body, customizer);
  29647. *
  29648. * console.log(el === document.body);
  29649. * // => false
  29650. * console.log(el.nodeName);
  29651. * // => 'BODY'
  29652. * console.log(el.childNodes.length);
  29653. * // => 20
  29654. */
  29655. function cloneDeepWith(value, customizer) {
  29656. customizer = typeof customizer == 'function' ? customizer : undefined;
  29657. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  29658. }
  29659. /**
  29660. * Checks if `object` conforms to `source` by invoking the predicate
  29661. * properties of `source` with the corresponding property values of `object`.
  29662. *
  29663. * **Note:** This method is equivalent to `_.conforms` when `source` is
  29664. * partially applied.
  29665. *
  29666. * @static
  29667. * @memberOf _
  29668. * @since 4.14.0
  29669. * @category Lang
  29670. * @param {Object} object The object to inspect.
  29671. * @param {Object} source The object of property predicates to conform to.
  29672. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  29673. * @example
  29674. *
  29675. * var object = { 'a': 1, 'b': 2 };
  29676. *
  29677. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  29678. * // => true
  29679. *
  29680. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  29681. * // => false
  29682. */
  29683. function conformsTo(object, source) {
  29684. return source == null || baseConformsTo(object, source, keys(source));
  29685. }
  29686. /**
  29687. * Performs a
  29688. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  29689. * comparison between two values to determine if they are equivalent.
  29690. *
  29691. * @static
  29692. * @memberOf _
  29693. * @since 4.0.0
  29694. * @category Lang
  29695. * @param {*} value The value to compare.
  29696. * @param {*} other The other value to compare.
  29697. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29698. * @example
  29699. *
  29700. * var object = { 'a': 1 };
  29701. * var other = { 'a': 1 };
  29702. *
  29703. * _.eq(object, object);
  29704. * // => true
  29705. *
  29706. * _.eq(object, other);
  29707. * // => false
  29708. *
  29709. * _.eq('a', 'a');
  29710. * // => true
  29711. *
  29712. * _.eq('a', Object('a'));
  29713. * // => false
  29714. *
  29715. * _.eq(NaN, NaN);
  29716. * // => true
  29717. */
  29718. function eq(value, other) {
  29719. return value === other || (value !== value && other !== other);
  29720. }
  29721. /**
  29722. * Checks if `value` is greater than `other`.
  29723. *
  29724. * @static
  29725. * @memberOf _
  29726. * @since 3.9.0
  29727. * @category Lang
  29728. * @param {*} value The value to compare.
  29729. * @param {*} other The other value to compare.
  29730. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  29731. * else `false`.
  29732. * @see _.lt
  29733. * @example
  29734. *
  29735. * _.gt(3, 1);
  29736. * // => true
  29737. *
  29738. * _.gt(3, 3);
  29739. * // => false
  29740. *
  29741. * _.gt(1, 3);
  29742. * // => false
  29743. */
  29744. var gt = createRelationalOperation(baseGt);
  29745. /**
  29746. * Checks if `value` is greater than or equal to `other`.
  29747. *
  29748. * @static
  29749. * @memberOf _
  29750. * @since 3.9.0
  29751. * @category Lang
  29752. * @param {*} value The value to compare.
  29753. * @param {*} other The other value to compare.
  29754. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  29755. * `other`, else `false`.
  29756. * @see _.lte
  29757. * @example
  29758. *
  29759. * _.gte(3, 1);
  29760. * // => true
  29761. *
  29762. * _.gte(3, 3);
  29763. * // => true
  29764. *
  29765. * _.gte(1, 3);
  29766. * // => false
  29767. */
  29768. var gte = createRelationalOperation(function(value, other) {
  29769. return value >= other;
  29770. });
  29771. /**
  29772. * Checks if `value` is likely an `arguments` object.
  29773. *
  29774. * @static
  29775. * @memberOf _
  29776. * @since 0.1.0
  29777. * @category Lang
  29778. * @param {*} value The value to check.
  29779. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  29780. * else `false`.
  29781. * @example
  29782. *
  29783. * _.isArguments(function() { return arguments; }());
  29784. * // => true
  29785. *
  29786. * _.isArguments([1, 2, 3]);
  29787. * // => false
  29788. */
  29789. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  29790. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  29791. !propertyIsEnumerable.call(value, 'callee');
  29792. };
  29793. /**
  29794. * Checks if `value` is classified as an `Array` object.
  29795. *
  29796. * @static
  29797. * @memberOf _
  29798. * @since 0.1.0
  29799. * @category Lang
  29800. * @param {*} value The value to check.
  29801. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  29802. * @example
  29803. *
  29804. * _.isArray([1, 2, 3]);
  29805. * // => true
  29806. *
  29807. * _.isArray(document.body.children);
  29808. * // => false
  29809. *
  29810. * _.isArray('abc');
  29811. * // => false
  29812. *
  29813. * _.isArray(_.noop);
  29814. * // => false
  29815. */
  29816. var isArray = Array.isArray;
  29817. /**
  29818. * Checks if `value` is classified as an `ArrayBuffer` object.
  29819. *
  29820. * @static
  29821. * @memberOf _
  29822. * @since 4.3.0
  29823. * @category Lang
  29824. * @param {*} value The value to check.
  29825. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  29826. * @example
  29827. *
  29828. * _.isArrayBuffer(new ArrayBuffer(2));
  29829. * // => true
  29830. *
  29831. * _.isArrayBuffer(new Array(2));
  29832. * // => false
  29833. */
  29834. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  29835. /**
  29836. * Checks if `value` is array-like. A value is considered array-like if it's
  29837. * not a function and has a `value.length` that's an integer greater than or
  29838. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  29839. *
  29840. * @static
  29841. * @memberOf _
  29842. * @since 4.0.0
  29843. * @category Lang
  29844. * @param {*} value The value to check.
  29845. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  29846. * @example
  29847. *
  29848. * _.isArrayLike([1, 2, 3]);
  29849. * // => true
  29850. *
  29851. * _.isArrayLike(document.body.children);
  29852. * // => true
  29853. *
  29854. * _.isArrayLike('abc');
  29855. * // => true
  29856. *
  29857. * _.isArrayLike(_.noop);
  29858. * // => false
  29859. */
  29860. function isArrayLike(value) {
  29861. return value != null && isLength(value.length) && !isFunction(value);
  29862. }
  29863. /**
  29864. * This method is like `_.isArrayLike` except that it also checks if `value`
  29865. * is an object.
  29866. *
  29867. * @static
  29868. * @memberOf _
  29869. * @since 4.0.0
  29870. * @category Lang
  29871. * @param {*} value The value to check.
  29872. * @returns {boolean} Returns `true` if `value` is an array-like object,
  29873. * else `false`.
  29874. * @example
  29875. *
  29876. * _.isArrayLikeObject([1, 2, 3]);
  29877. * // => true
  29878. *
  29879. * _.isArrayLikeObject(document.body.children);
  29880. * // => true
  29881. *
  29882. * _.isArrayLikeObject('abc');
  29883. * // => false
  29884. *
  29885. * _.isArrayLikeObject(_.noop);
  29886. * // => false
  29887. */
  29888. function isArrayLikeObject(value) {
  29889. return isObjectLike(value) && isArrayLike(value);
  29890. }
  29891. /**
  29892. * Checks if `value` is classified as a boolean primitive or object.
  29893. *
  29894. * @static
  29895. * @memberOf _
  29896. * @since 0.1.0
  29897. * @category Lang
  29898. * @param {*} value The value to check.
  29899. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  29900. * @example
  29901. *
  29902. * _.isBoolean(false);
  29903. * // => true
  29904. *
  29905. * _.isBoolean(null);
  29906. * // => false
  29907. */
  29908. function isBoolean(value) {
  29909. return value === true || value === false ||
  29910. (isObjectLike(value) && baseGetTag(value) == boolTag);
  29911. }
  29912. /**
  29913. * Checks if `value` is a buffer.
  29914. *
  29915. * @static
  29916. * @memberOf _
  29917. * @since 4.3.0
  29918. * @category Lang
  29919. * @param {*} value The value to check.
  29920. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  29921. * @example
  29922. *
  29923. * _.isBuffer(new Buffer(2));
  29924. * // => true
  29925. *
  29926. * _.isBuffer(new Uint8Array(2));
  29927. * // => false
  29928. */
  29929. var isBuffer = nativeIsBuffer || stubFalse;
  29930. /**
  29931. * Checks if `value` is classified as a `Date` object.
  29932. *
  29933. * @static
  29934. * @memberOf _
  29935. * @since 0.1.0
  29936. * @category Lang
  29937. * @param {*} value The value to check.
  29938. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29939. * @example
  29940. *
  29941. * _.isDate(new Date);
  29942. * // => true
  29943. *
  29944. * _.isDate('Mon April 23 2012');
  29945. * // => false
  29946. */
  29947. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29948. /**
  29949. * Checks if `value` is likely a DOM element.
  29950. *
  29951. * @static
  29952. * @memberOf _
  29953. * @since 0.1.0
  29954. * @category Lang
  29955. * @param {*} value The value to check.
  29956. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29957. * @example
  29958. *
  29959. * _.isElement(document.body);
  29960. * // => true
  29961. *
  29962. * _.isElement('<body>');
  29963. * // => false
  29964. */
  29965. function isElement(value) {
  29966. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29967. }
  29968. /**
  29969. * Checks if `value` is an empty object, collection, map, or set.
  29970. *
  29971. * Objects are considered empty if they have no own enumerable string keyed
  29972. * properties.
  29973. *
  29974. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29975. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29976. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29977. *
  29978. * @static
  29979. * @memberOf _
  29980. * @since 0.1.0
  29981. * @category Lang
  29982. * @param {*} value The value to check.
  29983. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29984. * @example
  29985. *
  29986. * _.isEmpty(null);
  29987. * // => true
  29988. *
  29989. * _.isEmpty(true);
  29990. * // => true
  29991. *
  29992. * _.isEmpty(1);
  29993. * // => true
  29994. *
  29995. * _.isEmpty([1, 2, 3]);
  29996. * // => false
  29997. *
  29998. * _.isEmpty({ 'a': 1 });
  29999. * // => false
  30000. */
  30001. function isEmpty(value) {
  30002. if (value == null) {
  30003. return true;
  30004. }
  30005. if (isArrayLike(value) &&
  30006. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  30007. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  30008. return !value.length;
  30009. }
  30010. var tag = getTag(value);
  30011. if (tag == mapTag || tag == setTag) {
  30012. return !value.size;
  30013. }
  30014. if (isPrototype(value)) {
  30015. return !baseKeys(value).length;
  30016. }
  30017. for (var key in value) {
  30018. if (hasOwnProperty.call(value, key)) {
  30019. return false;
  30020. }
  30021. }
  30022. return true;
  30023. }
  30024. /**
  30025. * Performs a deep comparison between two values to determine if they are
  30026. * equivalent.
  30027. *
  30028. * **Note:** This method supports comparing arrays, array buffers, booleans,
  30029. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  30030. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  30031. * by their own, not inherited, enumerable properties. Functions and DOM
  30032. * nodes are compared by strict equality, i.e. `===`.
  30033. *
  30034. * @static
  30035. * @memberOf _
  30036. * @since 0.1.0
  30037. * @category Lang
  30038. * @param {*} value The value to compare.
  30039. * @param {*} other The other value to compare.
  30040. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  30041. * @example
  30042. *
  30043. * var object = { 'a': 1 };
  30044. * var other = { 'a': 1 };
  30045. *
  30046. * _.isEqual(object, other);
  30047. * // => true
  30048. *
  30049. * object === other;
  30050. * // => false
  30051. */
  30052. function isEqual(value, other) {
  30053. return baseIsEqual(value, other);
  30054. }
  30055. /**
  30056. * This method is like `_.isEqual` except that it accepts `customizer` which
  30057. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  30058. * are handled by the method instead. The `customizer` is invoked with up to
  30059. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  30060. *
  30061. * @static
  30062. * @memberOf _
  30063. * @since 4.0.0
  30064. * @category Lang
  30065. * @param {*} value The value to compare.
  30066. * @param {*} other The other value to compare.
  30067. * @param {Function} [customizer] The function to customize comparisons.
  30068. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  30069. * @example
  30070. *
  30071. * function isGreeting(value) {
  30072. * return /^h(?:i|ello)$/.test(value);
  30073. * }
  30074. *
  30075. * function customizer(objValue, othValue) {
  30076. * if (isGreeting(objValue) && isGreeting(othValue)) {
  30077. * return true;
  30078. * }
  30079. * }
  30080. *
  30081. * var array = ['hello', 'goodbye'];
  30082. * var other = ['hi', 'goodbye'];
  30083. *
  30084. * _.isEqualWith(array, other, customizer);
  30085. * // => true
  30086. */
  30087. function isEqualWith(value, other, customizer) {
  30088. customizer = typeof customizer == 'function' ? customizer : undefined;
  30089. var result = customizer ? customizer(value, other) : undefined;
  30090. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  30091. }
  30092. /**
  30093. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  30094. * `SyntaxError`, `TypeError`, or `URIError` object.
  30095. *
  30096. * @static
  30097. * @memberOf _
  30098. * @since 3.0.0
  30099. * @category Lang
  30100. * @param {*} value The value to check.
  30101. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  30102. * @example
  30103. *
  30104. * _.isError(new Error);
  30105. * // => true
  30106. *
  30107. * _.isError(Error);
  30108. * // => false
  30109. */
  30110. function isError(value) {
  30111. if (!isObjectLike(value)) {
  30112. return false;
  30113. }
  30114. var tag = baseGetTag(value);
  30115. return tag == errorTag || tag == domExcTag ||
  30116. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  30117. }
  30118. /**
  30119. * Checks if `value` is a finite primitive number.
  30120. *
  30121. * **Note:** This method is based on
  30122. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  30123. *
  30124. * @static
  30125. * @memberOf _
  30126. * @since 0.1.0
  30127. * @category Lang
  30128. * @param {*} value The value to check.
  30129. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  30130. * @example
  30131. *
  30132. * _.isFinite(3);
  30133. * // => true
  30134. *
  30135. * _.isFinite(Number.MIN_VALUE);
  30136. * // => true
  30137. *
  30138. * _.isFinite(Infinity);
  30139. * // => false
  30140. *
  30141. * _.isFinite('3');
  30142. * // => false
  30143. */
  30144. function isFinite(value) {
  30145. return typeof value == 'number' && nativeIsFinite(value);
  30146. }
  30147. /**
  30148. * Checks if `value` is classified as a `Function` object.
  30149. *
  30150. * @static
  30151. * @memberOf _
  30152. * @since 0.1.0
  30153. * @category Lang
  30154. * @param {*} value The value to check.
  30155. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  30156. * @example
  30157. *
  30158. * _.isFunction(_);
  30159. * // => true
  30160. *
  30161. * _.isFunction(/abc/);
  30162. * // => false
  30163. */
  30164. function isFunction(value) {
  30165. if (!isObject(value)) {
  30166. return false;
  30167. }
  30168. // The use of `Object#toString` avoids issues with the `typeof` operator
  30169. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  30170. var tag = baseGetTag(value);
  30171. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  30172. }
  30173. /**
  30174. * Checks if `value` is an integer.
  30175. *
  30176. * **Note:** This method is based on
  30177. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  30178. *
  30179. * @static
  30180. * @memberOf _
  30181. * @since 4.0.0
  30182. * @category Lang
  30183. * @param {*} value The value to check.
  30184. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  30185. * @example
  30186. *
  30187. * _.isInteger(3);
  30188. * // => true
  30189. *
  30190. * _.isInteger(Number.MIN_VALUE);
  30191. * // => false
  30192. *
  30193. * _.isInteger(Infinity);
  30194. * // => false
  30195. *
  30196. * _.isInteger('3');
  30197. * // => false
  30198. */
  30199. function isInteger(value) {
  30200. return typeof value == 'number' && value == toInteger(value);
  30201. }
  30202. /**
  30203. * Checks if `value` is a valid array-like length.
  30204. *
  30205. * **Note:** This method is loosely based on
  30206. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30207. *
  30208. * @static
  30209. * @memberOf _
  30210. * @since 4.0.0
  30211. * @category Lang
  30212. * @param {*} value The value to check.
  30213. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  30214. * @example
  30215. *
  30216. * _.isLength(3);
  30217. * // => true
  30218. *
  30219. * _.isLength(Number.MIN_VALUE);
  30220. * // => false
  30221. *
  30222. * _.isLength(Infinity);
  30223. * // => false
  30224. *
  30225. * _.isLength('3');
  30226. * // => false
  30227. */
  30228. function isLength(value) {
  30229. return typeof value == 'number' &&
  30230. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  30231. }
  30232. /**
  30233. * Checks if `value` is the
  30234. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  30235. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  30236. *
  30237. * @static
  30238. * @memberOf _
  30239. * @since 0.1.0
  30240. * @category Lang
  30241. * @param {*} value The value to check.
  30242. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  30243. * @example
  30244. *
  30245. * _.isObject({});
  30246. * // => true
  30247. *
  30248. * _.isObject([1, 2, 3]);
  30249. * // => true
  30250. *
  30251. * _.isObject(_.noop);
  30252. * // => true
  30253. *
  30254. * _.isObject(null);
  30255. * // => false
  30256. */
  30257. function isObject(value) {
  30258. var type = typeof value;
  30259. return value != null && (type == 'object' || type == 'function');
  30260. }
  30261. /**
  30262. * Checks if `value` is object-like. A value is object-like if it's not `null`
  30263. * and has a `typeof` result of "object".
  30264. *
  30265. * @static
  30266. * @memberOf _
  30267. * @since 4.0.0
  30268. * @category Lang
  30269. * @param {*} value The value to check.
  30270. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  30271. * @example
  30272. *
  30273. * _.isObjectLike({});
  30274. * // => true
  30275. *
  30276. * _.isObjectLike([1, 2, 3]);
  30277. * // => true
  30278. *
  30279. * _.isObjectLike(_.noop);
  30280. * // => false
  30281. *
  30282. * _.isObjectLike(null);
  30283. * // => false
  30284. */
  30285. function isObjectLike(value) {
  30286. return value != null && typeof value == 'object';
  30287. }
  30288. /**
  30289. * Checks if `value` is classified as a `Map` object.
  30290. *
  30291. * @static
  30292. * @memberOf _
  30293. * @since 4.3.0
  30294. * @category Lang
  30295. * @param {*} value The value to check.
  30296. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  30297. * @example
  30298. *
  30299. * _.isMap(new Map);
  30300. * // => true
  30301. *
  30302. * _.isMap(new WeakMap);
  30303. * // => false
  30304. */
  30305. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  30306. /**
  30307. * Performs a partial deep comparison between `object` and `source` to
  30308. * determine if `object` contains equivalent property values.
  30309. *
  30310. * **Note:** This method is equivalent to `_.matches` when `source` is
  30311. * partially applied.
  30312. *
  30313. * Partial comparisons will match empty array and empty object `source`
  30314. * values against any array or object value, respectively. See `_.isEqual`
  30315. * for a list of supported value comparisons.
  30316. *
  30317. * @static
  30318. * @memberOf _
  30319. * @since 3.0.0
  30320. * @category Lang
  30321. * @param {Object} object The object to inspect.
  30322. * @param {Object} source The object of property values to match.
  30323. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  30324. * @example
  30325. *
  30326. * var object = { 'a': 1, 'b': 2 };
  30327. *
  30328. * _.isMatch(object, { 'b': 2 });
  30329. * // => true
  30330. *
  30331. * _.isMatch(object, { 'b': 1 });
  30332. * // => false
  30333. */
  30334. function isMatch(object, source) {
  30335. return object === source || baseIsMatch(object, source, getMatchData(source));
  30336. }
  30337. /**
  30338. * This method is like `_.isMatch` except that it accepts `customizer` which
  30339. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  30340. * are handled by the method instead. The `customizer` is invoked with five
  30341. * arguments: (objValue, srcValue, index|key, object, source).
  30342. *
  30343. * @static
  30344. * @memberOf _
  30345. * @since 4.0.0
  30346. * @category Lang
  30347. * @param {Object} object The object to inspect.
  30348. * @param {Object} source The object of property values to match.
  30349. * @param {Function} [customizer] The function to customize comparisons.
  30350. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  30351. * @example
  30352. *
  30353. * function isGreeting(value) {
  30354. * return /^h(?:i|ello)$/.test(value);
  30355. * }
  30356. *
  30357. * function customizer(objValue, srcValue) {
  30358. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  30359. * return true;
  30360. * }
  30361. * }
  30362. *
  30363. * var object = { 'greeting': 'hello' };
  30364. * var source = { 'greeting': 'hi' };
  30365. *
  30366. * _.isMatchWith(object, source, customizer);
  30367. * // => true
  30368. */
  30369. function isMatchWith(object, source, customizer) {
  30370. customizer = typeof customizer == 'function' ? customizer : undefined;
  30371. return baseIsMatch(object, source, getMatchData(source), customizer);
  30372. }
  30373. /**
  30374. * Checks if `value` is `NaN`.
  30375. *
  30376. * **Note:** This method is based on
  30377. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  30378. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  30379. * `undefined` and other non-number values.
  30380. *
  30381. * @static
  30382. * @memberOf _
  30383. * @since 0.1.0
  30384. * @category Lang
  30385. * @param {*} value The value to check.
  30386. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  30387. * @example
  30388. *
  30389. * _.isNaN(NaN);
  30390. * // => true
  30391. *
  30392. * _.isNaN(new Number(NaN));
  30393. * // => true
  30394. *
  30395. * isNaN(undefined);
  30396. * // => true
  30397. *
  30398. * _.isNaN(undefined);
  30399. * // => false
  30400. */
  30401. function isNaN(value) {
  30402. // An `NaN` primitive is the only value that is not equal to itself.
  30403. // Perform the `toStringTag` check first to avoid errors with some
  30404. // ActiveX objects in IE.
  30405. return isNumber(value) && value != +value;
  30406. }
  30407. /**
  30408. * Checks if `value` is a pristine native function.
  30409. *
  30410. * **Note:** This method can't reliably detect native functions in the presence
  30411. * of the core-js package because core-js circumvents this kind of detection.
  30412. * Despite multiple requests, the core-js maintainer has made it clear: any
  30413. * attempt to fix the detection will be obstructed. As a result, we're left
  30414. * with little choice but to throw an error. Unfortunately, this also affects
  30415. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  30416. * which rely on core-js.
  30417. *
  30418. * @static
  30419. * @memberOf _
  30420. * @since 3.0.0
  30421. * @category Lang
  30422. * @param {*} value The value to check.
  30423. * @returns {boolean} Returns `true` if `value` is a native function,
  30424. * else `false`.
  30425. * @example
  30426. *
  30427. * _.isNative(Array.prototype.push);
  30428. * // => true
  30429. *
  30430. * _.isNative(_);
  30431. * // => false
  30432. */
  30433. function isNative(value) {
  30434. if (isMaskable(value)) {
  30435. throw new Error(CORE_ERROR_TEXT);
  30436. }
  30437. return baseIsNative(value);
  30438. }
  30439. /**
  30440. * Checks if `value` is `null`.
  30441. *
  30442. * @static
  30443. * @memberOf _
  30444. * @since 0.1.0
  30445. * @category Lang
  30446. * @param {*} value The value to check.
  30447. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  30448. * @example
  30449. *
  30450. * _.isNull(null);
  30451. * // => true
  30452. *
  30453. * _.isNull(void 0);
  30454. * // => false
  30455. */
  30456. function isNull(value) {
  30457. return value === null;
  30458. }
  30459. /**
  30460. * Checks if `value` is `null` or `undefined`.
  30461. *
  30462. * @static
  30463. * @memberOf _
  30464. * @since 4.0.0
  30465. * @category Lang
  30466. * @param {*} value The value to check.
  30467. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  30468. * @example
  30469. *
  30470. * _.isNil(null);
  30471. * // => true
  30472. *
  30473. * _.isNil(void 0);
  30474. * // => true
  30475. *
  30476. * _.isNil(NaN);
  30477. * // => false
  30478. */
  30479. function isNil(value) {
  30480. return value == null;
  30481. }
  30482. /**
  30483. * Checks if `value` is classified as a `Number` primitive or object.
  30484. *
  30485. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  30486. * classified as numbers, use the `_.isFinite` method.
  30487. *
  30488. * @static
  30489. * @memberOf _
  30490. * @since 0.1.0
  30491. * @category Lang
  30492. * @param {*} value The value to check.
  30493. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  30494. * @example
  30495. *
  30496. * _.isNumber(3);
  30497. * // => true
  30498. *
  30499. * _.isNumber(Number.MIN_VALUE);
  30500. * // => true
  30501. *
  30502. * _.isNumber(Infinity);
  30503. * // => true
  30504. *
  30505. * _.isNumber('3');
  30506. * // => false
  30507. */
  30508. function isNumber(value) {
  30509. return typeof value == 'number' ||
  30510. (isObjectLike(value) && baseGetTag(value) == numberTag);
  30511. }
  30512. /**
  30513. * Checks if `value` is a plain object, that is, an object created by the
  30514. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  30515. *
  30516. * @static
  30517. * @memberOf _
  30518. * @since 0.8.0
  30519. * @category Lang
  30520. * @param {*} value The value to check.
  30521. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  30522. * @example
  30523. *
  30524. * function Foo() {
  30525. * this.a = 1;
  30526. * }
  30527. *
  30528. * _.isPlainObject(new Foo);
  30529. * // => false
  30530. *
  30531. * _.isPlainObject([1, 2, 3]);
  30532. * // => false
  30533. *
  30534. * _.isPlainObject({ 'x': 0, 'y': 0 });
  30535. * // => true
  30536. *
  30537. * _.isPlainObject(Object.create(null));
  30538. * // => true
  30539. */
  30540. function isPlainObject(value) {
  30541. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  30542. return false;
  30543. }
  30544. var proto = getPrototype(value);
  30545. if (proto === null) {
  30546. return true;
  30547. }
  30548. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  30549. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  30550. funcToString.call(Ctor) == objectCtorString;
  30551. }
  30552. /**
  30553. * Checks if `value` is classified as a `RegExp` object.
  30554. *
  30555. * @static
  30556. * @memberOf _
  30557. * @since 0.1.0
  30558. * @category Lang
  30559. * @param {*} value The value to check.
  30560. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  30561. * @example
  30562. *
  30563. * _.isRegExp(/abc/);
  30564. * // => true
  30565. *
  30566. * _.isRegExp('/abc/');
  30567. * // => false
  30568. */
  30569. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  30570. /**
  30571. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  30572. * double precision number which isn't the result of a rounded unsafe integer.
  30573. *
  30574. * **Note:** This method is based on
  30575. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  30576. *
  30577. * @static
  30578. * @memberOf _
  30579. * @since 4.0.0
  30580. * @category Lang
  30581. * @param {*} value The value to check.
  30582. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  30583. * @example
  30584. *
  30585. * _.isSafeInteger(3);
  30586. * // => true
  30587. *
  30588. * _.isSafeInteger(Number.MIN_VALUE);
  30589. * // => false
  30590. *
  30591. * _.isSafeInteger(Infinity);
  30592. * // => false
  30593. *
  30594. * _.isSafeInteger('3');
  30595. * // => false
  30596. */
  30597. function isSafeInteger(value) {
  30598. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  30599. }
  30600. /**
  30601. * Checks if `value` is classified as a `Set` object.
  30602. *
  30603. * @static
  30604. * @memberOf _
  30605. * @since 4.3.0
  30606. * @category Lang
  30607. * @param {*} value The value to check.
  30608. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  30609. * @example
  30610. *
  30611. * _.isSet(new Set);
  30612. * // => true
  30613. *
  30614. * _.isSet(new WeakSet);
  30615. * // => false
  30616. */
  30617. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  30618. /**
  30619. * Checks if `value` is classified as a `String` primitive or object.
  30620. *
  30621. * @static
  30622. * @since 0.1.0
  30623. * @memberOf _
  30624. * @category Lang
  30625. * @param {*} value The value to check.
  30626. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  30627. * @example
  30628. *
  30629. * _.isString('abc');
  30630. * // => true
  30631. *
  30632. * _.isString(1);
  30633. * // => false
  30634. */
  30635. function isString(value) {
  30636. return typeof value == 'string' ||
  30637. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  30638. }
  30639. /**
  30640. * Checks if `value` is classified as a `Symbol` primitive or object.
  30641. *
  30642. * @static
  30643. * @memberOf _
  30644. * @since 4.0.0
  30645. * @category Lang
  30646. * @param {*} value The value to check.
  30647. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  30648. * @example
  30649. *
  30650. * _.isSymbol(Symbol.iterator);
  30651. * // => true
  30652. *
  30653. * _.isSymbol('abc');
  30654. * // => false
  30655. */
  30656. function isSymbol(value) {
  30657. return typeof value == 'symbol' ||
  30658. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  30659. }
  30660. /**
  30661. * Checks if `value` is classified as a typed array.
  30662. *
  30663. * @static
  30664. * @memberOf _
  30665. * @since 3.0.0
  30666. * @category Lang
  30667. * @param {*} value The value to check.
  30668. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  30669. * @example
  30670. *
  30671. * _.isTypedArray(new Uint8Array);
  30672. * // => true
  30673. *
  30674. * _.isTypedArray([]);
  30675. * // => false
  30676. */
  30677. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  30678. /**
  30679. * Checks if `value` is `undefined`.
  30680. *
  30681. * @static
  30682. * @since 0.1.0
  30683. * @memberOf _
  30684. * @category Lang
  30685. * @param {*} value The value to check.
  30686. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  30687. * @example
  30688. *
  30689. * _.isUndefined(void 0);
  30690. * // => true
  30691. *
  30692. * _.isUndefined(null);
  30693. * // => false
  30694. */
  30695. function isUndefined(value) {
  30696. return value === undefined;
  30697. }
  30698. /**
  30699. * Checks if `value` is classified as a `WeakMap` object.
  30700. *
  30701. * @static
  30702. * @memberOf _
  30703. * @since 4.3.0
  30704. * @category Lang
  30705. * @param {*} value The value to check.
  30706. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  30707. * @example
  30708. *
  30709. * _.isWeakMap(new WeakMap);
  30710. * // => true
  30711. *
  30712. * _.isWeakMap(new Map);
  30713. * // => false
  30714. */
  30715. function isWeakMap(value) {
  30716. return isObjectLike(value) && getTag(value) == weakMapTag;
  30717. }
  30718. /**
  30719. * Checks if `value` is classified as a `WeakSet` object.
  30720. *
  30721. * @static
  30722. * @memberOf _
  30723. * @since 4.3.0
  30724. * @category Lang
  30725. * @param {*} value The value to check.
  30726. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  30727. * @example
  30728. *
  30729. * _.isWeakSet(new WeakSet);
  30730. * // => true
  30731. *
  30732. * _.isWeakSet(new Set);
  30733. * // => false
  30734. */
  30735. function isWeakSet(value) {
  30736. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  30737. }
  30738. /**
  30739. * Checks if `value` is less than `other`.
  30740. *
  30741. * @static
  30742. * @memberOf _
  30743. * @since 3.9.0
  30744. * @category Lang
  30745. * @param {*} value The value to compare.
  30746. * @param {*} other The other value to compare.
  30747. * @returns {boolean} Returns `true` if `value` is less than `other`,
  30748. * else `false`.
  30749. * @see _.gt
  30750. * @example
  30751. *
  30752. * _.lt(1, 3);
  30753. * // => true
  30754. *
  30755. * _.lt(3, 3);
  30756. * // => false
  30757. *
  30758. * _.lt(3, 1);
  30759. * // => false
  30760. */
  30761. var lt = createRelationalOperation(baseLt);
  30762. /**
  30763. * Checks if `value` is less than or equal to `other`.
  30764. *
  30765. * @static
  30766. * @memberOf _
  30767. * @since 3.9.0
  30768. * @category Lang
  30769. * @param {*} value The value to compare.
  30770. * @param {*} other The other value to compare.
  30771. * @returns {boolean} Returns `true` if `value` is less than or equal to
  30772. * `other`, else `false`.
  30773. * @see _.gte
  30774. * @example
  30775. *
  30776. * _.lte(1, 3);
  30777. * // => true
  30778. *
  30779. * _.lte(3, 3);
  30780. * // => true
  30781. *
  30782. * _.lte(3, 1);
  30783. * // => false
  30784. */
  30785. var lte = createRelationalOperation(function(value, other) {
  30786. return value <= other;
  30787. });
  30788. /**
  30789. * Converts `value` to an array.
  30790. *
  30791. * @static
  30792. * @since 0.1.0
  30793. * @memberOf _
  30794. * @category Lang
  30795. * @param {*} value The value to convert.
  30796. * @returns {Array} Returns the converted array.
  30797. * @example
  30798. *
  30799. * _.toArray({ 'a': 1, 'b': 2 });
  30800. * // => [1, 2]
  30801. *
  30802. * _.toArray('abc');
  30803. * // => ['a', 'b', 'c']
  30804. *
  30805. * _.toArray(1);
  30806. * // => []
  30807. *
  30808. * _.toArray(null);
  30809. * // => []
  30810. */
  30811. function toArray(value) {
  30812. if (!value) {
  30813. return [];
  30814. }
  30815. if (isArrayLike(value)) {
  30816. return isString(value) ? stringToArray(value) : copyArray(value);
  30817. }
  30818. if (symIterator && value[symIterator]) {
  30819. return iteratorToArray(value[symIterator]());
  30820. }
  30821. var tag = getTag(value),
  30822. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  30823. return func(value);
  30824. }
  30825. /**
  30826. * Converts `value` to a finite number.
  30827. *
  30828. * @static
  30829. * @memberOf _
  30830. * @since 4.12.0
  30831. * @category Lang
  30832. * @param {*} value The value to convert.
  30833. * @returns {number} Returns the converted number.
  30834. * @example
  30835. *
  30836. * _.toFinite(3.2);
  30837. * // => 3.2
  30838. *
  30839. * _.toFinite(Number.MIN_VALUE);
  30840. * // => 5e-324
  30841. *
  30842. * _.toFinite(Infinity);
  30843. * // => 1.7976931348623157e+308
  30844. *
  30845. * _.toFinite('3.2');
  30846. * // => 3.2
  30847. */
  30848. function toFinite(value) {
  30849. if (!value) {
  30850. return value === 0 ? value : 0;
  30851. }
  30852. value = toNumber(value);
  30853. if (value === INFINITY || value === -INFINITY) {
  30854. var sign = (value < 0 ? -1 : 1);
  30855. return sign * MAX_INTEGER;
  30856. }
  30857. return value === value ? value : 0;
  30858. }
  30859. /**
  30860. * Converts `value` to an integer.
  30861. *
  30862. * **Note:** This method is loosely based on
  30863. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  30864. *
  30865. * @static
  30866. * @memberOf _
  30867. * @since 4.0.0
  30868. * @category Lang
  30869. * @param {*} value The value to convert.
  30870. * @returns {number} Returns the converted integer.
  30871. * @example
  30872. *
  30873. * _.toInteger(3.2);
  30874. * // => 3
  30875. *
  30876. * _.toInteger(Number.MIN_VALUE);
  30877. * // => 0
  30878. *
  30879. * _.toInteger(Infinity);
  30880. * // => 1.7976931348623157e+308
  30881. *
  30882. * _.toInteger('3.2');
  30883. * // => 3
  30884. */
  30885. function toInteger(value) {
  30886. var result = toFinite(value),
  30887. remainder = result % 1;
  30888. return result === result ? (remainder ? result - remainder : result) : 0;
  30889. }
  30890. /**
  30891. * Converts `value` to an integer suitable for use as the length of an
  30892. * array-like object.
  30893. *
  30894. * **Note:** This method is based on
  30895. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30896. *
  30897. * @static
  30898. * @memberOf _
  30899. * @since 4.0.0
  30900. * @category Lang
  30901. * @param {*} value The value to convert.
  30902. * @returns {number} Returns the converted integer.
  30903. * @example
  30904. *
  30905. * _.toLength(3.2);
  30906. * // => 3
  30907. *
  30908. * _.toLength(Number.MIN_VALUE);
  30909. * // => 0
  30910. *
  30911. * _.toLength(Infinity);
  30912. * // => 4294967295
  30913. *
  30914. * _.toLength('3.2');
  30915. * // => 3
  30916. */
  30917. function toLength(value) {
  30918. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  30919. }
  30920. /**
  30921. * Converts `value` to a number.
  30922. *
  30923. * @static
  30924. * @memberOf _
  30925. * @since 4.0.0
  30926. * @category Lang
  30927. * @param {*} value The value to process.
  30928. * @returns {number} Returns the number.
  30929. * @example
  30930. *
  30931. * _.toNumber(3.2);
  30932. * // => 3.2
  30933. *
  30934. * _.toNumber(Number.MIN_VALUE);
  30935. * // => 5e-324
  30936. *
  30937. * _.toNumber(Infinity);
  30938. * // => Infinity
  30939. *
  30940. * _.toNumber('3.2');
  30941. * // => 3.2
  30942. */
  30943. function toNumber(value) {
  30944. if (typeof value == 'number') {
  30945. return value;
  30946. }
  30947. if (isSymbol(value)) {
  30948. return NAN;
  30949. }
  30950. if (isObject(value)) {
  30951. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30952. value = isObject(other) ? (other + '') : other;
  30953. }
  30954. if (typeof value != 'string') {
  30955. return value === 0 ? value : +value;
  30956. }
  30957. value = value.replace(reTrim, '');
  30958. var isBinary = reIsBinary.test(value);
  30959. return (isBinary || reIsOctal.test(value))
  30960. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30961. : (reIsBadHex.test(value) ? NAN : +value);
  30962. }
  30963. /**
  30964. * Converts `value` to a plain object flattening inherited enumerable string
  30965. * keyed properties of `value` to own properties of the plain object.
  30966. *
  30967. * @static
  30968. * @memberOf _
  30969. * @since 3.0.0
  30970. * @category Lang
  30971. * @param {*} value The value to convert.
  30972. * @returns {Object} Returns the converted plain object.
  30973. * @example
  30974. *
  30975. * function Foo() {
  30976. * this.b = 2;
  30977. * }
  30978. *
  30979. * Foo.prototype.c = 3;
  30980. *
  30981. * _.assign({ 'a': 1 }, new Foo);
  30982. * // => { 'a': 1, 'b': 2 }
  30983. *
  30984. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30985. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30986. */
  30987. function toPlainObject(value) {
  30988. return copyObject(value, keysIn(value));
  30989. }
  30990. /**
  30991. * Converts `value` to a safe integer. A safe integer can be compared and
  30992. * represented correctly.
  30993. *
  30994. * @static
  30995. * @memberOf _
  30996. * @since 4.0.0
  30997. * @category Lang
  30998. * @param {*} value The value to convert.
  30999. * @returns {number} Returns the converted integer.
  31000. * @example
  31001. *
  31002. * _.toSafeInteger(3.2);
  31003. * // => 3
  31004. *
  31005. * _.toSafeInteger(Number.MIN_VALUE);
  31006. * // => 0
  31007. *
  31008. * _.toSafeInteger(Infinity);
  31009. * // => 9007199254740991
  31010. *
  31011. * _.toSafeInteger('3.2');
  31012. * // => 3
  31013. */
  31014. function toSafeInteger(value) {
  31015. return value
  31016. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  31017. : (value === 0 ? value : 0);
  31018. }
  31019. /**
  31020. * Converts `value` to a string. An empty string is returned for `null`
  31021. * and `undefined` values. The sign of `-0` is preserved.
  31022. *
  31023. * @static
  31024. * @memberOf _
  31025. * @since 4.0.0
  31026. * @category Lang
  31027. * @param {*} value The value to convert.
  31028. * @returns {string} Returns the converted string.
  31029. * @example
  31030. *
  31031. * _.toString(null);
  31032. * // => ''
  31033. *
  31034. * _.toString(-0);
  31035. * // => '-0'
  31036. *
  31037. * _.toString([1, 2, 3]);
  31038. * // => '1,2,3'
  31039. */
  31040. function toString(value) {
  31041. return value == null ? '' : baseToString(value);
  31042. }
  31043. /*------------------------------------------------------------------------*/
  31044. /**
  31045. * Assigns own enumerable string keyed properties of source objects to the
  31046. * destination object. Source objects are applied from left to right.
  31047. * Subsequent sources overwrite property assignments of previous sources.
  31048. *
  31049. * **Note:** This method mutates `object` and is loosely based on
  31050. * [`Object.assign`](https://mdn.io/Object/assign).
  31051. *
  31052. * @static
  31053. * @memberOf _
  31054. * @since 0.10.0
  31055. * @category Object
  31056. * @param {Object} object The destination object.
  31057. * @param {...Object} [sources] The source objects.
  31058. * @returns {Object} Returns `object`.
  31059. * @see _.assignIn
  31060. * @example
  31061. *
  31062. * function Foo() {
  31063. * this.a = 1;
  31064. * }
  31065. *
  31066. * function Bar() {
  31067. * this.c = 3;
  31068. * }
  31069. *
  31070. * Foo.prototype.b = 2;
  31071. * Bar.prototype.d = 4;
  31072. *
  31073. * _.assign({ 'a': 0 }, new Foo, new Bar);
  31074. * // => { 'a': 1, 'c': 3 }
  31075. */
  31076. var assign = createAssigner(function(object, source) {
  31077. if (isPrototype(source) || isArrayLike(source)) {
  31078. copyObject(source, keys(source), object);
  31079. return;
  31080. }
  31081. for (var key in source) {
  31082. if (hasOwnProperty.call(source, key)) {
  31083. assignValue(object, key, source[key]);
  31084. }
  31085. }
  31086. });
  31087. /**
  31088. * This method is like `_.assign` except that it iterates over own and
  31089. * inherited source properties.
  31090. *
  31091. * **Note:** This method mutates `object`.
  31092. *
  31093. * @static
  31094. * @memberOf _
  31095. * @since 4.0.0
  31096. * @alias extend
  31097. * @category Object
  31098. * @param {Object} object The destination object.
  31099. * @param {...Object} [sources] The source objects.
  31100. * @returns {Object} Returns `object`.
  31101. * @see _.assign
  31102. * @example
  31103. *
  31104. * function Foo() {
  31105. * this.a = 1;
  31106. * }
  31107. *
  31108. * function Bar() {
  31109. * this.c = 3;
  31110. * }
  31111. *
  31112. * Foo.prototype.b = 2;
  31113. * Bar.prototype.d = 4;
  31114. *
  31115. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  31116. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  31117. */
  31118. var assignIn = createAssigner(function(object, source) {
  31119. copyObject(source, keysIn(source), object);
  31120. });
  31121. /**
  31122. * This method is like `_.assignIn` except that it accepts `customizer`
  31123. * which is invoked to produce the assigned values. If `customizer` returns
  31124. * `undefined`, assignment is handled by the method instead. The `customizer`
  31125. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  31126. *
  31127. * **Note:** This method mutates `object`.
  31128. *
  31129. * @static
  31130. * @memberOf _
  31131. * @since 4.0.0
  31132. * @alias extendWith
  31133. * @category Object
  31134. * @param {Object} object The destination object.
  31135. * @param {...Object} sources The source objects.
  31136. * @param {Function} [customizer] The function to customize assigned values.
  31137. * @returns {Object} Returns `object`.
  31138. * @see _.assignWith
  31139. * @example
  31140. *
  31141. * function customizer(objValue, srcValue) {
  31142. * return _.isUndefined(objValue) ? srcValue : objValue;
  31143. * }
  31144. *
  31145. * var defaults = _.partialRight(_.assignInWith, customizer);
  31146. *
  31147. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31148. * // => { 'a': 1, 'b': 2 }
  31149. */
  31150. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  31151. copyObject(source, keysIn(source), object, customizer);
  31152. });
  31153. /**
  31154. * This method is like `_.assign` except that it accepts `customizer`
  31155. * which is invoked to produce the assigned values. If `customizer` returns
  31156. * `undefined`, assignment is handled by the method instead. The `customizer`
  31157. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  31158. *
  31159. * **Note:** This method mutates `object`.
  31160. *
  31161. * @static
  31162. * @memberOf _
  31163. * @since 4.0.0
  31164. * @category Object
  31165. * @param {Object} object The destination object.
  31166. * @param {...Object} sources The source objects.
  31167. * @param {Function} [customizer] The function to customize assigned values.
  31168. * @returns {Object} Returns `object`.
  31169. * @see _.assignInWith
  31170. * @example
  31171. *
  31172. * function customizer(objValue, srcValue) {
  31173. * return _.isUndefined(objValue) ? srcValue : objValue;
  31174. * }
  31175. *
  31176. * var defaults = _.partialRight(_.assignWith, customizer);
  31177. *
  31178. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31179. * // => { 'a': 1, 'b': 2 }
  31180. */
  31181. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  31182. copyObject(source, keys(source), object, customizer);
  31183. });
  31184. /**
  31185. * Creates an array of values corresponding to `paths` of `object`.
  31186. *
  31187. * @static
  31188. * @memberOf _
  31189. * @since 1.0.0
  31190. * @category Object
  31191. * @param {Object} object The object to iterate over.
  31192. * @param {...(string|string[])} [paths] The property paths to pick.
  31193. * @returns {Array} Returns the picked values.
  31194. * @example
  31195. *
  31196. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  31197. *
  31198. * _.at(object, ['a[0].b.c', 'a[1]']);
  31199. * // => [3, 4]
  31200. */
  31201. var at = flatRest(baseAt);
  31202. /**
  31203. * Creates an object that inherits from the `prototype` object. If a
  31204. * `properties` object is given, its own enumerable string keyed properties
  31205. * are assigned to the created object.
  31206. *
  31207. * @static
  31208. * @memberOf _
  31209. * @since 2.3.0
  31210. * @category Object
  31211. * @param {Object} prototype The object to inherit from.
  31212. * @param {Object} [properties] The properties to assign to the object.
  31213. * @returns {Object} Returns the new object.
  31214. * @example
  31215. *
  31216. * function Shape() {
  31217. * this.x = 0;
  31218. * this.y = 0;
  31219. * }
  31220. *
  31221. * function Circle() {
  31222. * Shape.call(this);
  31223. * }
  31224. *
  31225. * Circle.prototype = _.create(Shape.prototype, {
  31226. * 'constructor': Circle
  31227. * });
  31228. *
  31229. * var circle = new Circle;
  31230. * circle instanceof Circle;
  31231. * // => true
  31232. *
  31233. * circle instanceof Shape;
  31234. * // => true
  31235. */
  31236. function create(prototype, properties) {
  31237. var result = baseCreate(prototype);
  31238. return properties == null ? result : baseAssign(result, properties);
  31239. }
  31240. /**
  31241. * Assigns own and inherited enumerable string keyed properties of source
  31242. * objects to the destination object for all destination properties that
  31243. * resolve to `undefined`. Source objects are applied from left to right.
  31244. * Once a property is set, additional values of the same property are ignored.
  31245. *
  31246. * **Note:** This method mutates `object`.
  31247. *
  31248. * @static
  31249. * @since 0.1.0
  31250. * @memberOf _
  31251. * @category Object
  31252. * @param {Object} object The destination object.
  31253. * @param {...Object} [sources] The source objects.
  31254. * @returns {Object} Returns `object`.
  31255. * @see _.defaultsDeep
  31256. * @example
  31257. *
  31258. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31259. * // => { 'a': 1, 'b': 2 }
  31260. */
  31261. var defaults = baseRest(function(object, sources) {
  31262. object = Object(object);
  31263. var index = -1;
  31264. var length = sources.length;
  31265. var guard = length > 2 ? sources[2] : undefined;
  31266. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  31267. length = 1;
  31268. }
  31269. while (++index < length) {
  31270. var source = sources[index];
  31271. var props = keysIn(source);
  31272. var propsIndex = -1;
  31273. var propsLength = props.length;
  31274. while (++propsIndex < propsLength) {
  31275. var key = props[propsIndex];
  31276. var value = object[key];
  31277. if (value === undefined ||
  31278. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  31279. object[key] = source[key];
  31280. }
  31281. }
  31282. }
  31283. return object;
  31284. });
  31285. /**
  31286. * This method is like `_.defaults` except that it recursively assigns
  31287. * default properties.
  31288. *
  31289. * **Note:** This method mutates `object`.
  31290. *
  31291. * @static
  31292. * @memberOf _
  31293. * @since 3.10.0
  31294. * @category Object
  31295. * @param {Object} object The destination object.
  31296. * @param {...Object} [sources] The source objects.
  31297. * @returns {Object} Returns `object`.
  31298. * @see _.defaults
  31299. * @example
  31300. *
  31301. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  31302. * // => { 'a': { 'b': 2, 'c': 3 } }
  31303. */
  31304. var defaultsDeep = baseRest(function(args) {
  31305. args.push(undefined, customDefaultsMerge);
  31306. return apply(mergeWith, undefined, args);
  31307. });
  31308. /**
  31309. * This method is like `_.find` except that it returns the key of the first
  31310. * element `predicate` returns truthy for instead of the element itself.
  31311. *
  31312. * @static
  31313. * @memberOf _
  31314. * @since 1.1.0
  31315. * @category Object
  31316. * @param {Object} object The object to inspect.
  31317. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  31318. * @returns {string|undefined} Returns the key of the matched element,
  31319. * else `undefined`.
  31320. * @example
  31321. *
  31322. * var users = {
  31323. * 'barney': { 'age': 36, 'active': true },
  31324. * 'fred': { 'age': 40, 'active': false },
  31325. * 'pebbles': { 'age': 1, 'active': true }
  31326. * };
  31327. *
  31328. * _.findKey(users, function(o) { return o.age < 40; });
  31329. * // => 'barney' (iteration order is not guaranteed)
  31330. *
  31331. * // The `_.matches` iteratee shorthand.
  31332. * _.findKey(users, { 'age': 1, 'active': true });
  31333. * // => 'pebbles'
  31334. *
  31335. * // The `_.matchesProperty` iteratee shorthand.
  31336. * _.findKey(users, ['active', false]);
  31337. * // => 'fred'
  31338. *
  31339. * // The `_.property` iteratee shorthand.
  31340. * _.findKey(users, 'active');
  31341. * // => 'barney'
  31342. */
  31343. function findKey(object, predicate) {
  31344. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  31345. }
  31346. /**
  31347. * This method is like `_.findKey` except that it iterates over elements of
  31348. * a collection in the opposite order.
  31349. *
  31350. * @static
  31351. * @memberOf _
  31352. * @since 2.0.0
  31353. * @category Object
  31354. * @param {Object} object The object to inspect.
  31355. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  31356. * @returns {string|undefined} Returns the key of the matched element,
  31357. * else `undefined`.
  31358. * @example
  31359. *
  31360. * var users = {
  31361. * 'barney': { 'age': 36, 'active': true },
  31362. * 'fred': { 'age': 40, 'active': false },
  31363. * 'pebbles': { 'age': 1, 'active': true }
  31364. * };
  31365. *
  31366. * _.findLastKey(users, function(o) { return o.age < 40; });
  31367. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  31368. *
  31369. * // The `_.matches` iteratee shorthand.
  31370. * _.findLastKey(users, { 'age': 36, 'active': true });
  31371. * // => 'barney'
  31372. *
  31373. * // The `_.matchesProperty` iteratee shorthand.
  31374. * _.findLastKey(users, ['active', false]);
  31375. * // => 'fred'
  31376. *
  31377. * // The `_.property` iteratee shorthand.
  31378. * _.findLastKey(users, 'active');
  31379. * // => 'pebbles'
  31380. */
  31381. function findLastKey(object, predicate) {
  31382. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  31383. }
  31384. /**
  31385. * Iterates over own and inherited enumerable string keyed properties of an
  31386. * object and invokes `iteratee` for each property. The iteratee is invoked
  31387. * with three arguments: (value, key, object). Iteratee functions may exit
  31388. * iteration early by explicitly returning `false`.
  31389. *
  31390. * @static
  31391. * @memberOf _
  31392. * @since 0.3.0
  31393. * @category Object
  31394. * @param {Object} object The object to iterate over.
  31395. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31396. * @returns {Object} Returns `object`.
  31397. * @see _.forInRight
  31398. * @example
  31399. *
  31400. * function Foo() {
  31401. * this.a = 1;
  31402. * this.b = 2;
  31403. * }
  31404. *
  31405. * Foo.prototype.c = 3;
  31406. *
  31407. * _.forIn(new Foo, function(value, key) {
  31408. * console.log(key);
  31409. * });
  31410. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  31411. */
  31412. function forIn(object, iteratee) {
  31413. return object == null
  31414. ? object
  31415. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  31416. }
  31417. /**
  31418. * This method is like `_.forIn` except that it iterates over properties of
  31419. * `object` in the opposite order.
  31420. *
  31421. * @static
  31422. * @memberOf _
  31423. * @since 2.0.0
  31424. * @category Object
  31425. * @param {Object} object The object to iterate over.
  31426. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31427. * @returns {Object} Returns `object`.
  31428. * @see _.forIn
  31429. * @example
  31430. *
  31431. * function Foo() {
  31432. * this.a = 1;
  31433. * this.b = 2;
  31434. * }
  31435. *
  31436. * Foo.prototype.c = 3;
  31437. *
  31438. * _.forInRight(new Foo, function(value, key) {
  31439. * console.log(key);
  31440. * });
  31441. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  31442. */
  31443. function forInRight(object, iteratee) {
  31444. return object == null
  31445. ? object
  31446. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  31447. }
  31448. /**
  31449. * Iterates over own enumerable string keyed properties of an object and
  31450. * invokes `iteratee` for each property. The iteratee is invoked with three
  31451. * arguments: (value, key, object). Iteratee functions may exit iteration
  31452. * early by explicitly returning `false`.
  31453. *
  31454. * @static
  31455. * @memberOf _
  31456. * @since 0.3.0
  31457. * @category Object
  31458. * @param {Object} object The object to iterate over.
  31459. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31460. * @returns {Object} Returns `object`.
  31461. * @see _.forOwnRight
  31462. * @example
  31463. *
  31464. * function Foo() {
  31465. * this.a = 1;
  31466. * this.b = 2;
  31467. * }
  31468. *
  31469. * Foo.prototype.c = 3;
  31470. *
  31471. * _.forOwn(new Foo, function(value, key) {
  31472. * console.log(key);
  31473. * });
  31474. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  31475. */
  31476. function forOwn(object, iteratee) {
  31477. return object && baseForOwn(object, getIteratee(iteratee, 3));
  31478. }
  31479. /**
  31480. * This method is like `_.forOwn` except that it iterates over properties of
  31481. * `object` in the opposite order.
  31482. *
  31483. * @static
  31484. * @memberOf _
  31485. * @since 2.0.0
  31486. * @category Object
  31487. * @param {Object} object The object to iterate over.
  31488. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31489. * @returns {Object} Returns `object`.
  31490. * @see _.forOwn
  31491. * @example
  31492. *
  31493. * function Foo() {
  31494. * this.a = 1;
  31495. * this.b = 2;
  31496. * }
  31497. *
  31498. * Foo.prototype.c = 3;
  31499. *
  31500. * _.forOwnRight(new Foo, function(value, key) {
  31501. * console.log(key);
  31502. * });
  31503. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  31504. */
  31505. function forOwnRight(object, iteratee) {
  31506. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  31507. }
  31508. /**
  31509. * Creates an array of function property names from own enumerable properties
  31510. * of `object`.
  31511. *
  31512. * @static
  31513. * @since 0.1.0
  31514. * @memberOf _
  31515. * @category Object
  31516. * @param {Object} object The object to inspect.
  31517. * @returns {Array} Returns the function names.
  31518. * @see _.functionsIn
  31519. * @example
  31520. *
  31521. * function Foo() {
  31522. * this.a = _.constant('a');
  31523. * this.b = _.constant('b');
  31524. * }
  31525. *
  31526. * Foo.prototype.c = _.constant('c');
  31527. *
  31528. * _.functions(new Foo);
  31529. * // => ['a', 'b']
  31530. */
  31531. function functions(object) {
  31532. return object == null ? [] : baseFunctions(object, keys(object));
  31533. }
  31534. /**
  31535. * Creates an array of function property names from own and inherited
  31536. * enumerable properties of `object`.
  31537. *
  31538. * @static
  31539. * @memberOf _
  31540. * @since 4.0.0
  31541. * @category Object
  31542. * @param {Object} object The object to inspect.
  31543. * @returns {Array} Returns the function names.
  31544. * @see _.functions
  31545. * @example
  31546. *
  31547. * function Foo() {
  31548. * this.a = _.constant('a');
  31549. * this.b = _.constant('b');
  31550. * }
  31551. *
  31552. * Foo.prototype.c = _.constant('c');
  31553. *
  31554. * _.functionsIn(new Foo);
  31555. * // => ['a', 'b', 'c']
  31556. */
  31557. function functionsIn(object) {
  31558. return object == null ? [] : baseFunctions(object, keysIn(object));
  31559. }
  31560. /**
  31561. * Gets the value at `path` of `object`. If the resolved value is
  31562. * `undefined`, the `defaultValue` is returned in its place.
  31563. *
  31564. * @static
  31565. * @memberOf _
  31566. * @since 3.7.0
  31567. * @category Object
  31568. * @param {Object} object The object to query.
  31569. * @param {Array|string} path The path of the property to get.
  31570. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31571. * @returns {*} Returns the resolved value.
  31572. * @example
  31573. *
  31574. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31575. *
  31576. * _.get(object, 'a[0].b.c');
  31577. * // => 3
  31578. *
  31579. * _.get(object, ['a', '0', 'b', 'c']);
  31580. * // => 3
  31581. *
  31582. * _.get(object, 'a.b.c', 'default');
  31583. * // => 'default'
  31584. */
  31585. function get(object, path, defaultValue) {
  31586. var result = object == null ? undefined : baseGet(object, path);
  31587. return result === undefined ? defaultValue : result;
  31588. }
  31589. /**
  31590. * Checks if `path` is a direct property of `object`.
  31591. *
  31592. * @static
  31593. * @since 0.1.0
  31594. * @memberOf _
  31595. * @category Object
  31596. * @param {Object} object The object to query.
  31597. * @param {Array|string} path The path to check.
  31598. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31599. * @example
  31600. *
  31601. * var object = { 'a': { 'b': 2 } };
  31602. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  31603. *
  31604. * _.has(object, 'a');
  31605. * // => true
  31606. *
  31607. * _.has(object, 'a.b');
  31608. * // => true
  31609. *
  31610. * _.has(object, ['a', 'b']);
  31611. * // => true
  31612. *
  31613. * _.has(other, 'a');
  31614. * // => false
  31615. */
  31616. function has(object, path) {
  31617. return object != null && hasPath(object, path, baseHas);
  31618. }
  31619. /**
  31620. * Checks if `path` is a direct or inherited property of `object`.
  31621. *
  31622. * @static
  31623. * @memberOf _
  31624. * @since 4.0.0
  31625. * @category Object
  31626. * @param {Object} object The object to query.
  31627. * @param {Array|string} path The path to check.
  31628. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31629. * @example
  31630. *
  31631. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  31632. *
  31633. * _.hasIn(object, 'a');
  31634. * // => true
  31635. *
  31636. * _.hasIn(object, 'a.b');
  31637. * // => true
  31638. *
  31639. * _.hasIn(object, ['a', 'b']);
  31640. * // => true
  31641. *
  31642. * _.hasIn(object, 'b');
  31643. * // => false
  31644. */
  31645. function hasIn(object, path) {
  31646. return object != null && hasPath(object, path, baseHasIn);
  31647. }
  31648. /**
  31649. * Creates an object composed of the inverted keys and values of `object`.
  31650. * If `object` contains duplicate values, subsequent values overwrite
  31651. * property assignments of previous values.
  31652. *
  31653. * @static
  31654. * @memberOf _
  31655. * @since 0.7.0
  31656. * @category Object
  31657. * @param {Object} object The object to invert.
  31658. * @returns {Object} Returns the new inverted object.
  31659. * @example
  31660. *
  31661. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31662. *
  31663. * _.invert(object);
  31664. * // => { '1': 'c', '2': 'b' }
  31665. */
  31666. var invert = createInverter(function(result, value, key) {
  31667. if (value != null &&
  31668. typeof value.toString != 'function') {
  31669. value = nativeObjectToString.call(value);
  31670. }
  31671. result[value] = key;
  31672. }, constant(identity));
  31673. /**
  31674. * This method is like `_.invert` except that the inverted object is generated
  31675. * from the results of running each element of `object` thru `iteratee`. The
  31676. * corresponding inverted value of each inverted key is an array of keys
  31677. * responsible for generating the inverted value. The iteratee is invoked
  31678. * with one argument: (value).
  31679. *
  31680. * @static
  31681. * @memberOf _
  31682. * @since 4.1.0
  31683. * @category Object
  31684. * @param {Object} object The object to invert.
  31685. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  31686. * @returns {Object} Returns the new inverted object.
  31687. * @example
  31688. *
  31689. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31690. *
  31691. * _.invertBy(object);
  31692. * // => { '1': ['a', 'c'], '2': ['b'] }
  31693. *
  31694. * _.invertBy(object, function(value) {
  31695. * return 'group' + value;
  31696. * });
  31697. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  31698. */
  31699. var invertBy = createInverter(function(result, value, key) {
  31700. if (value != null &&
  31701. typeof value.toString != 'function') {
  31702. value = nativeObjectToString.call(value);
  31703. }
  31704. if (hasOwnProperty.call(result, value)) {
  31705. result[value].push(key);
  31706. } else {
  31707. result[value] = [key];
  31708. }
  31709. }, getIteratee);
  31710. /**
  31711. * Invokes the method at `path` of `object`.
  31712. *
  31713. * @static
  31714. * @memberOf _
  31715. * @since 4.0.0
  31716. * @category Object
  31717. * @param {Object} object The object to query.
  31718. * @param {Array|string} path The path of the method to invoke.
  31719. * @param {...*} [args] The arguments to invoke the method with.
  31720. * @returns {*} Returns the result of the invoked method.
  31721. * @example
  31722. *
  31723. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  31724. *
  31725. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  31726. * // => [2, 3]
  31727. */
  31728. var invoke = baseRest(baseInvoke);
  31729. /**
  31730. * Creates an array of the own enumerable property names of `object`.
  31731. *
  31732. * **Note:** Non-object values are coerced to objects. See the
  31733. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  31734. * for more details.
  31735. *
  31736. * @static
  31737. * @since 0.1.0
  31738. * @memberOf _
  31739. * @category Object
  31740. * @param {Object} object The object to query.
  31741. * @returns {Array} Returns the array of property names.
  31742. * @example
  31743. *
  31744. * function Foo() {
  31745. * this.a = 1;
  31746. * this.b = 2;
  31747. * }
  31748. *
  31749. * Foo.prototype.c = 3;
  31750. *
  31751. * _.keys(new Foo);
  31752. * // => ['a', 'b'] (iteration order is not guaranteed)
  31753. *
  31754. * _.keys('hi');
  31755. * // => ['0', '1']
  31756. */
  31757. function keys(object) {
  31758. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  31759. }
  31760. /**
  31761. * Creates an array of the own and inherited enumerable property names of `object`.
  31762. *
  31763. * **Note:** Non-object values are coerced to objects.
  31764. *
  31765. * @static
  31766. * @memberOf _
  31767. * @since 3.0.0
  31768. * @category Object
  31769. * @param {Object} object The object to query.
  31770. * @returns {Array} Returns the array of property names.
  31771. * @example
  31772. *
  31773. * function Foo() {
  31774. * this.a = 1;
  31775. * this.b = 2;
  31776. * }
  31777. *
  31778. * Foo.prototype.c = 3;
  31779. *
  31780. * _.keysIn(new Foo);
  31781. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  31782. */
  31783. function keysIn(object) {
  31784. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  31785. }
  31786. /**
  31787. * The opposite of `_.mapValues`; this method creates an object with the
  31788. * same values as `object` and keys generated by running each own enumerable
  31789. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  31790. * with three arguments: (value, key, object).
  31791. *
  31792. * @static
  31793. * @memberOf _
  31794. * @since 3.8.0
  31795. * @category Object
  31796. * @param {Object} object The object to iterate over.
  31797. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31798. * @returns {Object} Returns the new mapped object.
  31799. * @see _.mapValues
  31800. * @example
  31801. *
  31802. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  31803. * return key + value;
  31804. * });
  31805. * // => { 'a1': 1, 'b2': 2 }
  31806. */
  31807. function mapKeys(object, iteratee) {
  31808. var result = {};
  31809. iteratee = getIteratee(iteratee, 3);
  31810. baseForOwn(object, function(value, key, object) {
  31811. baseAssignValue(result, iteratee(value, key, object), value);
  31812. });
  31813. return result;
  31814. }
  31815. /**
  31816. * Creates an object with the same keys as `object` and values generated
  31817. * by running each own enumerable string keyed property of `object` thru
  31818. * `iteratee`. The iteratee is invoked with three arguments:
  31819. * (value, key, object).
  31820. *
  31821. * @static
  31822. * @memberOf _
  31823. * @since 2.4.0
  31824. * @category Object
  31825. * @param {Object} object The object to iterate over.
  31826. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31827. * @returns {Object} Returns the new mapped object.
  31828. * @see _.mapKeys
  31829. * @example
  31830. *
  31831. * var users = {
  31832. * 'fred': { 'user': 'fred', 'age': 40 },
  31833. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  31834. * };
  31835. *
  31836. * _.mapValues(users, function(o) { return o.age; });
  31837. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31838. *
  31839. * // The `_.property` iteratee shorthand.
  31840. * _.mapValues(users, 'age');
  31841. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31842. */
  31843. function mapValues(object, iteratee) {
  31844. var result = {};
  31845. iteratee = getIteratee(iteratee, 3);
  31846. baseForOwn(object, function(value, key, object) {
  31847. baseAssignValue(result, key, iteratee(value, key, object));
  31848. });
  31849. return result;
  31850. }
  31851. /**
  31852. * This method is like `_.assign` except that it recursively merges own and
  31853. * inherited enumerable string keyed properties of source objects into the
  31854. * destination object. Source properties that resolve to `undefined` are
  31855. * skipped if a destination value exists. Array and plain object properties
  31856. * are merged recursively. Other objects and value types are overridden by
  31857. * assignment. Source objects are applied from left to right. Subsequent
  31858. * sources overwrite property assignments of previous sources.
  31859. *
  31860. * **Note:** This method mutates `object`.
  31861. *
  31862. * @static
  31863. * @memberOf _
  31864. * @since 0.5.0
  31865. * @category Object
  31866. * @param {Object} object The destination object.
  31867. * @param {...Object} [sources] The source objects.
  31868. * @returns {Object} Returns `object`.
  31869. * @example
  31870. *
  31871. * var object = {
  31872. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  31873. * };
  31874. *
  31875. * var other = {
  31876. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  31877. * };
  31878. *
  31879. * _.merge(object, other);
  31880. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  31881. */
  31882. var merge = createAssigner(function(object, source, srcIndex) {
  31883. baseMerge(object, source, srcIndex);
  31884. });
  31885. /**
  31886. * This method is like `_.merge` except that it accepts `customizer` which
  31887. * is invoked to produce the merged values of the destination and source
  31888. * properties. If `customizer` returns `undefined`, merging is handled by the
  31889. * method instead. The `customizer` is invoked with six arguments:
  31890. * (objValue, srcValue, key, object, source, stack).
  31891. *
  31892. * **Note:** This method mutates `object`.
  31893. *
  31894. * @static
  31895. * @memberOf _
  31896. * @since 4.0.0
  31897. * @category Object
  31898. * @param {Object} object The destination object.
  31899. * @param {...Object} sources The source objects.
  31900. * @param {Function} customizer The function to customize assigned values.
  31901. * @returns {Object} Returns `object`.
  31902. * @example
  31903. *
  31904. * function customizer(objValue, srcValue) {
  31905. * if (_.isArray(objValue)) {
  31906. * return objValue.concat(srcValue);
  31907. * }
  31908. * }
  31909. *
  31910. * var object = { 'a': [1], 'b': [2] };
  31911. * var other = { 'a': [3], 'b': [4] };
  31912. *
  31913. * _.mergeWith(object, other, customizer);
  31914. * // => { 'a': [1, 3], 'b': [2, 4] }
  31915. */
  31916. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  31917. baseMerge(object, source, srcIndex, customizer);
  31918. });
  31919. /**
  31920. * The opposite of `_.pick`; this method creates an object composed of the
  31921. * own and inherited enumerable property paths of `object` that are not omitted.
  31922. *
  31923. * **Note:** This method is considerably slower than `_.pick`.
  31924. *
  31925. * @static
  31926. * @since 0.1.0
  31927. * @memberOf _
  31928. * @category Object
  31929. * @param {Object} object The source object.
  31930. * @param {...(string|string[])} [paths] The property paths to omit.
  31931. * @returns {Object} Returns the new object.
  31932. * @example
  31933. *
  31934. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31935. *
  31936. * _.omit(object, ['a', 'c']);
  31937. * // => { 'b': '2' }
  31938. */
  31939. var omit = flatRest(function(object, paths) {
  31940. var result = {};
  31941. if (object == null) {
  31942. return result;
  31943. }
  31944. var isDeep = false;
  31945. paths = arrayMap(paths, function(path) {
  31946. path = castPath(path, object);
  31947. isDeep || (isDeep = path.length > 1);
  31948. return path;
  31949. });
  31950. copyObject(object, getAllKeysIn(object), result);
  31951. if (isDeep) {
  31952. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31953. }
  31954. var length = paths.length;
  31955. while (length--) {
  31956. baseUnset(result, paths[length]);
  31957. }
  31958. return result;
  31959. });
  31960. /**
  31961. * The opposite of `_.pickBy`; this method creates an object composed of
  31962. * the own and inherited enumerable string keyed properties of `object` that
  31963. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31964. * arguments: (value, key).
  31965. *
  31966. * @static
  31967. * @memberOf _
  31968. * @since 4.0.0
  31969. * @category Object
  31970. * @param {Object} object The source object.
  31971. * @param {Function} [predicate=_.identity] The function invoked per property.
  31972. * @returns {Object} Returns the new object.
  31973. * @example
  31974. *
  31975. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31976. *
  31977. * _.omitBy(object, _.isNumber);
  31978. * // => { 'b': '2' }
  31979. */
  31980. function omitBy(object, predicate) {
  31981. return pickBy(object, negate(getIteratee(predicate)));
  31982. }
  31983. /**
  31984. * Creates an object composed of the picked `object` properties.
  31985. *
  31986. * @static
  31987. * @since 0.1.0
  31988. * @memberOf _
  31989. * @category Object
  31990. * @param {Object} object The source object.
  31991. * @param {...(string|string[])} [paths] The property paths to pick.
  31992. * @returns {Object} Returns the new object.
  31993. * @example
  31994. *
  31995. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31996. *
  31997. * _.pick(object, ['a', 'c']);
  31998. * // => { 'a': 1, 'c': 3 }
  31999. */
  32000. var pick = flatRest(function(object, paths) {
  32001. return object == null ? {} : basePick(object, paths);
  32002. });
  32003. /**
  32004. * Creates an object composed of the `object` properties `predicate` returns
  32005. * truthy for. The predicate is invoked with two arguments: (value, key).
  32006. *
  32007. * @static
  32008. * @memberOf _
  32009. * @since 4.0.0
  32010. * @category Object
  32011. * @param {Object} object The source object.
  32012. * @param {Function} [predicate=_.identity] The function invoked per property.
  32013. * @returns {Object} Returns the new object.
  32014. * @example
  32015. *
  32016. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  32017. *
  32018. * _.pickBy(object, _.isNumber);
  32019. * // => { 'a': 1, 'c': 3 }
  32020. */
  32021. function pickBy(object, predicate) {
  32022. if (object == null) {
  32023. return {};
  32024. }
  32025. var props = arrayMap(getAllKeysIn(object), function(prop) {
  32026. return [prop];
  32027. });
  32028. predicate = getIteratee(predicate);
  32029. return basePickBy(object, props, function(value, path) {
  32030. return predicate(value, path[0]);
  32031. });
  32032. }
  32033. /**
  32034. * This method is like `_.get` except that if the resolved value is a
  32035. * function it's invoked with the `this` binding of its parent object and
  32036. * its result is returned.
  32037. *
  32038. * @static
  32039. * @since 0.1.0
  32040. * @memberOf _
  32041. * @category Object
  32042. * @param {Object} object The object to query.
  32043. * @param {Array|string} path The path of the property to resolve.
  32044. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  32045. * @returns {*} Returns the resolved value.
  32046. * @example
  32047. *
  32048. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  32049. *
  32050. * _.result(object, 'a[0].b.c1');
  32051. * // => 3
  32052. *
  32053. * _.result(object, 'a[0].b.c2');
  32054. * // => 4
  32055. *
  32056. * _.result(object, 'a[0].b.c3', 'default');
  32057. * // => 'default'
  32058. *
  32059. * _.result(object, 'a[0].b.c3', _.constant('default'));
  32060. * // => 'default'
  32061. */
  32062. function result(object, path, defaultValue) {
  32063. path = castPath(path, object);
  32064. var index = -1,
  32065. length = path.length;
  32066. // Ensure the loop is entered when path is empty.
  32067. if (!length) {
  32068. length = 1;
  32069. object = undefined;
  32070. }
  32071. while (++index < length) {
  32072. var value = object == null ? undefined : object[toKey(path[index])];
  32073. if (value === undefined) {
  32074. index = length;
  32075. value = defaultValue;
  32076. }
  32077. object = isFunction(value) ? value.call(object) : value;
  32078. }
  32079. return object;
  32080. }
  32081. /**
  32082. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  32083. * it's created. Arrays are created for missing index properties while objects
  32084. * are created for all other missing properties. Use `_.setWith` to customize
  32085. * `path` creation.
  32086. *
  32087. * **Note:** This method mutates `object`.
  32088. *
  32089. * @static
  32090. * @memberOf _
  32091. * @since 3.7.0
  32092. * @category Object
  32093. * @param {Object} object The object to modify.
  32094. * @param {Array|string} path The path of the property to set.
  32095. * @param {*} value The value to set.
  32096. * @returns {Object} Returns `object`.
  32097. * @example
  32098. *
  32099. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  32100. *
  32101. * _.set(object, 'a[0].b.c', 4);
  32102. * console.log(object.a[0].b.c);
  32103. * // => 4
  32104. *
  32105. * _.set(object, ['x', '0', 'y', 'z'], 5);
  32106. * console.log(object.x[0].y.z);
  32107. * // => 5
  32108. */
  32109. function set(object, path, value) {
  32110. return object == null ? object : baseSet(object, path, value);
  32111. }
  32112. /**
  32113. * This method is like `_.set` except that it accepts `customizer` which is
  32114. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  32115. * path creation is handled by the method instead. The `customizer` is invoked
  32116. * with three arguments: (nsValue, key, nsObject).
  32117. *
  32118. * **Note:** This method mutates `object`.
  32119. *
  32120. * @static
  32121. * @memberOf _
  32122. * @since 4.0.0
  32123. * @category Object
  32124. * @param {Object} object The object to modify.
  32125. * @param {Array|string} path The path of the property to set.
  32126. * @param {*} value The value to set.
  32127. * @param {Function} [customizer] The function to customize assigned values.
  32128. * @returns {Object} Returns `object`.
  32129. * @example
  32130. *
  32131. * var object = {};
  32132. *
  32133. * _.setWith(object, '[0][1]', 'a', Object);
  32134. * // => { '0': { '1': 'a' } }
  32135. */
  32136. function setWith(object, path, value, customizer) {
  32137. customizer = typeof customizer == 'function' ? customizer : undefined;
  32138. return object == null ? object : baseSet(object, path, value, customizer);
  32139. }
  32140. /**
  32141. * Creates an array of own enumerable string keyed-value pairs for `object`
  32142. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  32143. * entries are returned.
  32144. *
  32145. * @static
  32146. * @memberOf _
  32147. * @since 4.0.0
  32148. * @alias entries
  32149. * @category Object
  32150. * @param {Object} object The object to query.
  32151. * @returns {Array} Returns the key-value pairs.
  32152. * @example
  32153. *
  32154. * function Foo() {
  32155. * this.a = 1;
  32156. * this.b = 2;
  32157. * }
  32158. *
  32159. * Foo.prototype.c = 3;
  32160. *
  32161. * _.toPairs(new Foo);
  32162. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  32163. */
  32164. var toPairs = createToPairs(keys);
  32165. /**
  32166. * Creates an array of own and inherited enumerable string keyed-value pairs
  32167. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  32168. * or set, its entries are returned.
  32169. *
  32170. * @static
  32171. * @memberOf _
  32172. * @since 4.0.0
  32173. * @alias entriesIn
  32174. * @category Object
  32175. * @param {Object} object The object to query.
  32176. * @returns {Array} Returns the key-value pairs.
  32177. * @example
  32178. *
  32179. * function Foo() {
  32180. * this.a = 1;
  32181. * this.b = 2;
  32182. * }
  32183. *
  32184. * Foo.prototype.c = 3;
  32185. *
  32186. * _.toPairsIn(new Foo);
  32187. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  32188. */
  32189. var toPairsIn = createToPairs(keysIn);
  32190. /**
  32191. * An alternative to `_.reduce`; this method transforms `object` to a new
  32192. * `accumulator` object which is the result of running each of its own
  32193. * enumerable string keyed properties thru `iteratee`, with each invocation
  32194. * potentially mutating the `accumulator` object. If `accumulator` is not
  32195. * provided, a new object with the same `[[Prototype]]` will be used. The
  32196. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  32197. * Iteratee functions may exit iteration early by explicitly returning `false`.
  32198. *
  32199. * @static
  32200. * @memberOf _
  32201. * @since 1.3.0
  32202. * @category Object
  32203. * @param {Object} object The object to iterate over.
  32204. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  32205. * @param {*} [accumulator] The custom accumulator value.
  32206. * @returns {*} Returns the accumulated value.
  32207. * @example
  32208. *
  32209. * _.transform([2, 3, 4], function(result, n) {
  32210. * result.push(n *= n);
  32211. * return n % 2 == 0;
  32212. * }, []);
  32213. * // => [4, 9]
  32214. *
  32215. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  32216. * (result[value] || (result[value] = [])).push(key);
  32217. * }, {});
  32218. * // => { '1': ['a', 'c'], '2': ['b'] }
  32219. */
  32220. function transform(object, iteratee, accumulator) {
  32221. var isArr = isArray(object),
  32222. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  32223. iteratee = getIteratee(iteratee, 4);
  32224. if (accumulator == null) {
  32225. var Ctor = object && object.constructor;
  32226. if (isArrLike) {
  32227. accumulator = isArr ? new Ctor : [];
  32228. }
  32229. else if (isObject(object)) {
  32230. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  32231. }
  32232. else {
  32233. accumulator = {};
  32234. }
  32235. }
  32236. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  32237. return iteratee(accumulator, value, index, object);
  32238. });
  32239. return accumulator;
  32240. }
  32241. /**
  32242. * Removes the property at `path` of `object`.
  32243. *
  32244. * **Note:** This method mutates `object`.
  32245. *
  32246. * @static
  32247. * @memberOf _
  32248. * @since 4.0.0
  32249. * @category Object
  32250. * @param {Object} object The object to modify.
  32251. * @param {Array|string} path The path of the property to unset.
  32252. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  32253. * @example
  32254. *
  32255. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  32256. * _.unset(object, 'a[0].b.c');
  32257. * // => true
  32258. *
  32259. * console.log(object);
  32260. * // => { 'a': [{ 'b': {} }] };
  32261. *
  32262. * _.unset(object, ['a', '0', 'b', 'c']);
  32263. * // => true
  32264. *
  32265. * console.log(object);
  32266. * // => { 'a': [{ 'b': {} }] };
  32267. */
  32268. function unset(object, path) {
  32269. return object == null ? true : baseUnset(object, path);
  32270. }
  32271. /**
  32272. * This method is like `_.set` except that accepts `updater` to produce the
  32273. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  32274. * is invoked with one argument: (value).
  32275. *
  32276. * **Note:** This method mutates `object`.
  32277. *
  32278. * @static
  32279. * @memberOf _
  32280. * @since 4.6.0
  32281. * @category Object
  32282. * @param {Object} object The object to modify.
  32283. * @param {Array|string} path The path of the property to set.
  32284. * @param {Function} updater The function to produce the updated value.
  32285. * @returns {Object} Returns `object`.
  32286. * @example
  32287. *
  32288. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  32289. *
  32290. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  32291. * console.log(object.a[0].b.c);
  32292. * // => 9
  32293. *
  32294. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  32295. * console.log(object.x[0].y.z);
  32296. * // => 0
  32297. */
  32298. function update(object, path, updater) {
  32299. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  32300. }
  32301. /**
  32302. * This method is like `_.update` except that it accepts `customizer` which is
  32303. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  32304. * path creation is handled by the method instead. The `customizer` is invoked
  32305. * with three arguments: (nsValue, key, nsObject).
  32306. *
  32307. * **Note:** This method mutates `object`.
  32308. *
  32309. * @static
  32310. * @memberOf _
  32311. * @since 4.6.0
  32312. * @category Object
  32313. * @param {Object} object The object to modify.
  32314. * @param {Array|string} path The path of the property to set.
  32315. * @param {Function} updater The function to produce the updated value.
  32316. * @param {Function} [customizer] The function to customize assigned values.
  32317. * @returns {Object} Returns `object`.
  32318. * @example
  32319. *
  32320. * var object = {};
  32321. *
  32322. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  32323. * // => { '0': { '1': 'a' } }
  32324. */
  32325. function updateWith(object, path, updater, customizer) {
  32326. customizer = typeof customizer == 'function' ? customizer : undefined;
  32327. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  32328. }
  32329. /**
  32330. * Creates an array of the own enumerable string keyed property values of `object`.
  32331. *
  32332. * **Note:** Non-object values are coerced to objects.
  32333. *
  32334. * @static
  32335. * @since 0.1.0
  32336. * @memberOf _
  32337. * @category Object
  32338. * @param {Object} object The object to query.
  32339. * @returns {Array} Returns the array of property values.
  32340. * @example
  32341. *
  32342. * function Foo() {
  32343. * this.a = 1;
  32344. * this.b = 2;
  32345. * }
  32346. *
  32347. * Foo.prototype.c = 3;
  32348. *
  32349. * _.values(new Foo);
  32350. * // => [1, 2] (iteration order is not guaranteed)
  32351. *
  32352. * _.values('hi');
  32353. * // => ['h', 'i']
  32354. */
  32355. function values(object) {
  32356. return object == null ? [] : baseValues(object, keys(object));
  32357. }
  32358. /**
  32359. * Creates an array of the own and inherited enumerable string keyed property
  32360. * values of `object`.
  32361. *
  32362. * **Note:** Non-object values are coerced to objects.
  32363. *
  32364. * @static
  32365. * @memberOf _
  32366. * @since 3.0.0
  32367. * @category Object
  32368. * @param {Object} object The object to query.
  32369. * @returns {Array} Returns the array of property values.
  32370. * @example
  32371. *
  32372. * function Foo() {
  32373. * this.a = 1;
  32374. * this.b = 2;
  32375. * }
  32376. *
  32377. * Foo.prototype.c = 3;
  32378. *
  32379. * _.valuesIn(new Foo);
  32380. * // => [1, 2, 3] (iteration order is not guaranteed)
  32381. */
  32382. function valuesIn(object) {
  32383. return object == null ? [] : baseValues(object, keysIn(object));
  32384. }
  32385. /*------------------------------------------------------------------------*/
  32386. /**
  32387. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  32388. *
  32389. * @static
  32390. * @memberOf _
  32391. * @since 4.0.0
  32392. * @category Number
  32393. * @param {number} number The number to clamp.
  32394. * @param {number} [lower] The lower bound.
  32395. * @param {number} upper The upper bound.
  32396. * @returns {number} Returns the clamped number.
  32397. * @example
  32398. *
  32399. * _.clamp(-10, -5, 5);
  32400. * // => -5
  32401. *
  32402. * _.clamp(10, -5, 5);
  32403. * // => 5
  32404. */
  32405. function clamp(number, lower, upper) {
  32406. if (upper === undefined) {
  32407. upper = lower;
  32408. lower = undefined;
  32409. }
  32410. if (upper !== undefined) {
  32411. upper = toNumber(upper);
  32412. upper = upper === upper ? upper : 0;
  32413. }
  32414. if (lower !== undefined) {
  32415. lower = toNumber(lower);
  32416. lower = lower === lower ? lower : 0;
  32417. }
  32418. return baseClamp(toNumber(number), lower, upper);
  32419. }
  32420. /**
  32421. * Checks if `n` is between `start` and up to, but not including, `end`. If
  32422. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  32423. * If `start` is greater than `end` the params are swapped to support
  32424. * negative ranges.
  32425. *
  32426. * @static
  32427. * @memberOf _
  32428. * @since 3.3.0
  32429. * @category Number
  32430. * @param {number} number The number to check.
  32431. * @param {number} [start=0] The start of the range.
  32432. * @param {number} end The end of the range.
  32433. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  32434. * @see _.range, _.rangeRight
  32435. * @example
  32436. *
  32437. * _.inRange(3, 2, 4);
  32438. * // => true
  32439. *
  32440. * _.inRange(4, 8);
  32441. * // => true
  32442. *
  32443. * _.inRange(4, 2);
  32444. * // => false
  32445. *
  32446. * _.inRange(2, 2);
  32447. * // => false
  32448. *
  32449. * _.inRange(1.2, 2);
  32450. * // => true
  32451. *
  32452. * _.inRange(5.2, 4);
  32453. * // => false
  32454. *
  32455. * _.inRange(-3, -2, -6);
  32456. * // => true
  32457. */
  32458. function inRange(number, start, end) {
  32459. start = toFinite(start);
  32460. if (end === undefined) {
  32461. end = start;
  32462. start = 0;
  32463. } else {
  32464. end = toFinite(end);
  32465. }
  32466. number = toNumber(number);
  32467. return baseInRange(number, start, end);
  32468. }
  32469. /**
  32470. * Produces a random number between the inclusive `lower` and `upper` bounds.
  32471. * If only one argument is provided a number between `0` and the given number
  32472. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  32473. * floats, a floating-point number is returned instead of an integer.
  32474. *
  32475. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32476. * floating-point values which can produce unexpected results.
  32477. *
  32478. * @static
  32479. * @memberOf _
  32480. * @since 0.7.0
  32481. * @category Number
  32482. * @param {number} [lower=0] The lower bound.
  32483. * @param {number} [upper=1] The upper bound.
  32484. * @param {boolean} [floating] Specify returning a floating-point number.
  32485. * @returns {number} Returns the random number.
  32486. * @example
  32487. *
  32488. * _.random(0, 5);
  32489. * // => an integer between 0 and 5
  32490. *
  32491. * _.random(5);
  32492. * // => also an integer between 0 and 5
  32493. *
  32494. * _.random(5, true);
  32495. * // => a floating-point number between 0 and 5
  32496. *
  32497. * _.random(1.2, 5.2);
  32498. * // => a floating-point number between 1.2 and 5.2
  32499. */
  32500. function random(lower, upper, floating) {
  32501. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  32502. upper = floating = undefined;
  32503. }
  32504. if (floating === undefined) {
  32505. if (typeof upper == 'boolean') {
  32506. floating = upper;
  32507. upper = undefined;
  32508. }
  32509. else if (typeof lower == 'boolean') {
  32510. floating = lower;
  32511. lower = undefined;
  32512. }
  32513. }
  32514. if (lower === undefined && upper === undefined) {
  32515. lower = 0;
  32516. upper = 1;
  32517. }
  32518. else {
  32519. lower = toFinite(lower);
  32520. if (upper === undefined) {
  32521. upper = lower;
  32522. lower = 0;
  32523. } else {
  32524. upper = toFinite(upper);
  32525. }
  32526. }
  32527. if (lower > upper) {
  32528. var temp = lower;
  32529. lower = upper;
  32530. upper = temp;
  32531. }
  32532. if (floating || lower % 1 || upper % 1) {
  32533. var rand = nativeRandom();
  32534. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  32535. }
  32536. return baseRandom(lower, upper);
  32537. }
  32538. /*------------------------------------------------------------------------*/
  32539. /**
  32540. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  32541. *
  32542. * @static
  32543. * @memberOf _
  32544. * @since 3.0.0
  32545. * @category String
  32546. * @param {string} [string=''] The string to convert.
  32547. * @returns {string} Returns the camel cased string.
  32548. * @example
  32549. *
  32550. * _.camelCase('Foo Bar');
  32551. * // => 'fooBar'
  32552. *
  32553. * _.camelCase('--foo-bar--');
  32554. * // => 'fooBar'
  32555. *
  32556. * _.camelCase('__FOO_BAR__');
  32557. * // => 'fooBar'
  32558. */
  32559. var camelCase = createCompounder(function(result, word, index) {
  32560. word = word.toLowerCase();
  32561. return result + (index ? capitalize(word) : word);
  32562. });
  32563. /**
  32564. * Converts the first character of `string` to upper case and the remaining
  32565. * to lower case.
  32566. *
  32567. * @static
  32568. * @memberOf _
  32569. * @since 3.0.0
  32570. * @category String
  32571. * @param {string} [string=''] The string to capitalize.
  32572. * @returns {string} Returns the capitalized string.
  32573. * @example
  32574. *
  32575. * _.capitalize('FRED');
  32576. * // => 'Fred'
  32577. */
  32578. function capitalize(string) {
  32579. return upperFirst(toString(string).toLowerCase());
  32580. }
  32581. /**
  32582. * Deburrs `string` by converting
  32583. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  32584. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  32585. * letters to basic Latin letters and removing
  32586. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  32587. *
  32588. * @static
  32589. * @memberOf _
  32590. * @since 3.0.0
  32591. * @category String
  32592. * @param {string} [string=''] The string to deburr.
  32593. * @returns {string} Returns the deburred string.
  32594. * @example
  32595. *
  32596. * _.deburr('déjà vu');
  32597. * // => 'deja vu'
  32598. */
  32599. function deburr(string) {
  32600. string = toString(string);
  32601. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  32602. }
  32603. /**
  32604. * Checks if `string` ends with the given target string.
  32605. *
  32606. * @static
  32607. * @memberOf _
  32608. * @since 3.0.0
  32609. * @category String
  32610. * @param {string} [string=''] The string to inspect.
  32611. * @param {string} [target] The string to search for.
  32612. * @param {number} [position=string.length] The position to search up to.
  32613. * @returns {boolean} Returns `true` if `string` ends with `target`,
  32614. * else `false`.
  32615. * @example
  32616. *
  32617. * _.endsWith('abc', 'c');
  32618. * // => true
  32619. *
  32620. * _.endsWith('abc', 'b');
  32621. * // => false
  32622. *
  32623. * _.endsWith('abc', 'b', 2);
  32624. * // => true
  32625. */
  32626. function endsWith(string, target, position) {
  32627. string = toString(string);
  32628. target = baseToString(target);
  32629. var length = string.length;
  32630. position = position === undefined
  32631. ? length
  32632. : baseClamp(toInteger(position), 0, length);
  32633. var end = position;
  32634. position -= target.length;
  32635. return position >= 0 && string.slice(position, end) == target;
  32636. }
  32637. /**
  32638. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  32639. * corresponding HTML entities.
  32640. *
  32641. * **Note:** No other characters are escaped. To escape additional
  32642. * characters use a third-party library like [_he_](https://mths.be/he).
  32643. *
  32644. * Though the ">" character is escaped for symmetry, characters like
  32645. * ">" and "/" don't need escaping in HTML and have no special meaning
  32646. * unless they're part of a tag or unquoted attribute value. See
  32647. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  32648. * (under "semi-related fun fact") for more details.
  32649. *
  32650. * When working with HTML you should always
  32651. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  32652. * XSS vectors.
  32653. *
  32654. * @static
  32655. * @since 0.1.0
  32656. * @memberOf _
  32657. * @category String
  32658. * @param {string} [string=''] The string to escape.
  32659. * @returns {string} Returns the escaped string.
  32660. * @example
  32661. *
  32662. * _.escape('fred, barney, & pebbles');
  32663. * // => 'fred, barney, &amp; pebbles'
  32664. */
  32665. function escape(string) {
  32666. string = toString(string);
  32667. return (string && reHasUnescapedHtml.test(string))
  32668. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  32669. : string;
  32670. }
  32671. /**
  32672. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  32673. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  32674. *
  32675. * @static
  32676. * @memberOf _
  32677. * @since 3.0.0
  32678. * @category String
  32679. * @param {string} [string=''] The string to escape.
  32680. * @returns {string} Returns the escaped string.
  32681. * @example
  32682. *
  32683. * _.escapeRegExp('[lodash](https://lodash.com/)');
  32684. * // => '\[lodash\]\(https://lodash\.com/\)'
  32685. */
  32686. function escapeRegExp(string) {
  32687. string = toString(string);
  32688. return (string && reHasRegExpChar.test(string))
  32689. ? string.replace(reRegExpChar, '\\$&')
  32690. : string;
  32691. }
  32692. /**
  32693. * Converts `string` to
  32694. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  32695. *
  32696. * @static
  32697. * @memberOf _
  32698. * @since 3.0.0
  32699. * @category String
  32700. * @param {string} [string=''] The string to convert.
  32701. * @returns {string} Returns the kebab cased string.
  32702. * @example
  32703. *
  32704. * _.kebabCase('Foo Bar');
  32705. * // => 'foo-bar'
  32706. *
  32707. * _.kebabCase('fooBar');
  32708. * // => 'foo-bar'
  32709. *
  32710. * _.kebabCase('__FOO_BAR__');
  32711. * // => 'foo-bar'
  32712. */
  32713. var kebabCase = createCompounder(function(result, word, index) {
  32714. return result + (index ? '-' : '') + word.toLowerCase();
  32715. });
  32716. /**
  32717. * Converts `string`, as space separated words, to lower case.
  32718. *
  32719. * @static
  32720. * @memberOf _
  32721. * @since 4.0.0
  32722. * @category String
  32723. * @param {string} [string=''] The string to convert.
  32724. * @returns {string} Returns the lower cased string.
  32725. * @example
  32726. *
  32727. * _.lowerCase('--Foo-Bar--');
  32728. * // => 'foo bar'
  32729. *
  32730. * _.lowerCase('fooBar');
  32731. * // => 'foo bar'
  32732. *
  32733. * _.lowerCase('__FOO_BAR__');
  32734. * // => 'foo bar'
  32735. */
  32736. var lowerCase = createCompounder(function(result, word, index) {
  32737. return result + (index ? ' ' : '') + word.toLowerCase();
  32738. });
  32739. /**
  32740. * Converts the first character of `string` to lower case.
  32741. *
  32742. * @static
  32743. * @memberOf _
  32744. * @since 4.0.0
  32745. * @category String
  32746. * @param {string} [string=''] The string to convert.
  32747. * @returns {string} Returns the converted string.
  32748. * @example
  32749. *
  32750. * _.lowerFirst('Fred');
  32751. * // => 'fred'
  32752. *
  32753. * _.lowerFirst('FRED');
  32754. * // => 'fRED'
  32755. */
  32756. var lowerFirst = createCaseFirst('toLowerCase');
  32757. /**
  32758. * Pads `string` on the left and right sides if it's shorter than `length`.
  32759. * Padding characters are truncated if they can't be evenly divided by `length`.
  32760. *
  32761. * @static
  32762. * @memberOf _
  32763. * @since 3.0.0
  32764. * @category String
  32765. * @param {string} [string=''] The string to pad.
  32766. * @param {number} [length=0] The padding length.
  32767. * @param {string} [chars=' '] The string used as padding.
  32768. * @returns {string} Returns the padded string.
  32769. * @example
  32770. *
  32771. * _.pad('abc', 8);
  32772. * // => ' abc '
  32773. *
  32774. * _.pad('abc', 8, '_-');
  32775. * // => '_-abc_-_'
  32776. *
  32777. * _.pad('abc', 3);
  32778. * // => 'abc'
  32779. */
  32780. function pad(string, length, chars) {
  32781. string = toString(string);
  32782. length = toInteger(length);
  32783. var strLength = length ? stringSize(string) : 0;
  32784. if (!length || strLength >= length) {
  32785. return string;
  32786. }
  32787. var mid = (length - strLength) / 2;
  32788. return (
  32789. createPadding(nativeFloor(mid), chars) +
  32790. string +
  32791. createPadding(nativeCeil(mid), chars)
  32792. );
  32793. }
  32794. /**
  32795. * Pads `string` on the right side if it's shorter than `length`. Padding
  32796. * characters are truncated if they exceed `length`.
  32797. *
  32798. * @static
  32799. * @memberOf _
  32800. * @since 4.0.0
  32801. * @category String
  32802. * @param {string} [string=''] The string to pad.
  32803. * @param {number} [length=0] The padding length.
  32804. * @param {string} [chars=' '] The string used as padding.
  32805. * @returns {string} Returns the padded string.
  32806. * @example
  32807. *
  32808. * _.padEnd('abc', 6);
  32809. * // => 'abc '
  32810. *
  32811. * _.padEnd('abc', 6, '_-');
  32812. * // => 'abc_-_'
  32813. *
  32814. * _.padEnd('abc', 3);
  32815. * // => 'abc'
  32816. */
  32817. function padEnd(string, length, chars) {
  32818. string = toString(string);
  32819. length = toInteger(length);
  32820. var strLength = length ? stringSize(string) : 0;
  32821. return (length && strLength < length)
  32822. ? (string + createPadding(length - strLength, chars))
  32823. : string;
  32824. }
  32825. /**
  32826. * Pads `string` on the left side if it's shorter than `length`. Padding
  32827. * characters are truncated if they exceed `length`.
  32828. *
  32829. * @static
  32830. * @memberOf _
  32831. * @since 4.0.0
  32832. * @category String
  32833. * @param {string} [string=''] The string to pad.
  32834. * @param {number} [length=0] The padding length.
  32835. * @param {string} [chars=' '] The string used as padding.
  32836. * @returns {string} Returns the padded string.
  32837. * @example
  32838. *
  32839. * _.padStart('abc', 6);
  32840. * // => ' abc'
  32841. *
  32842. * _.padStart('abc', 6, '_-');
  32843. * // => '_-_abc'
  32844. *
  32845. * _.padStart('abc', 3);
  32846. * // => 'abc'
  32847. */
  32848. function padStart(string, length, chars) {
  32849. string = toString(string);
  32850. length = toInteger(length);
  32851. var strLength = length ? stringSize(string) : 0;
  32852. return (length && strLength < length)
  32853. ? (createPadding(length - strLength, chars) + string)
  32854. : string;
  32855. }
  32856. /**
  32857. * Converts `string` to an integer of the specified radix. If `radix` is
  32858. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  32859. * hexadecimal, in which case a `radix` of `16` is used.
  32860. *
  32861. * **Note:** This method aligns with the
  32862. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  32863. *
  32864. * @static
  32865. * @memberOf _
  32866. * @since 1.1.0
  32867. * @category String
  32868. * @param {string} string The string to convert.
  32869. * @param {number} [radix=10] The radix to interpret `value` by.
  32870. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32871. * @returns {number} Returns the converted integer.
  32872. * @example
  32873. *
  32874. * _.parseInt('08');
  32875. * // => 8
  32876. *
  32877. * _.map(['6', '08', '10'], _.parseInt);
  32878. * // => [6, 8, 10]
  32879. */
  32880. function parseInt(string, radix, guard) {
  32881. if (guard || radix == null) {
  32882. radix = 0;
  32883. } else if (radix) {
  32884. radix = +radix;
  32885. }
  32886. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  32887. }
  32888. /**
  32889. * Repeats the given string `n` times.
  32890. *
  32891. * @static
  32892. * @memberOf _
  32893. * @since 3.0.0
  32894. * @category String
  32895. * @param {string} [string=''] The string to repeat.
  32896. * @param {number} [n=1] The number of times to repeat the string.
  32897. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32898. * @returns {string} Returns the repeated string.
  32899. * @example
  32900. *
  32901. * _.repeat('*', 3);
  32902. * // => '***'
  32903. *
  32904. * _.repeat('abc', 2);
  32905. * // => 'abcabc'
  32906. *
  32907. * _.repeat('abc', 0);
  32908. * // => ''
  32909. */
  32910. function repeat(string, n, guard) {
  32911. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  32912. n = 1;
  32913. } else {
  32914. n = toInteger(n);
  32915. }
  32916. return baseRepeat(toString(string), n);
  32917. }
  32918. /**
  32919. * Replaces matches for `pattern` in `string` with `replacement`.
  32920. *
  32921. * **Note:** This method is based on
  32922. * [`String#replace`](https://mdn.io/String/replace).
  32923. *
  32924. * @static
  32925. * @memberOf _
  32926. * @since 4.0.0
  32927. * @category String
  32928. * @param {string} [string=''] The string to modify.
  32929. * @param {RegExp|string} pattern The pattern to replace.
  32930. * @param {Function|string} replacement The match replacement.
  32931. * @returns {string} Returns the modified string.
  32932. * @example
  32933. *
  32934. * _.replace('Hi Fred', 'Fred', 'Barney');
  32935. * // => 'Hi Barney'
  32936. */
  32937. function replace() {
  32938. var args = arguments,
  32939. string = toString(args[0]);
  32940. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32941. }
  32942. /**
  32943. * Converts `string` to
  32944. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32945. *
  32946. * @static
  32947. * @memberOf _
  32948. * @since 3.0.0
  32949. * @category String
  32950. * @param {string} [string=''] The string to convert.
  32951. * @returns {string} Returns the snake cased string.
  32952. * @example
  32953. *
  32954. * _.snakeCase('Foo Bar');
  32955. * // => 'foo_bar'
  32956. *
  32957. * _.snakeCase('fooBar');
  32958. * // => 'foo_bar'
  32959. *
  32960. * _.snakeCase('--FOO-BAR--');
  32961. * // => 'foo_bar'
  32962. */
  32963. var snakeCase = createCompounder(function(result, word, index) {
  32964. return result + (index ? '_' : '') + word.toLowerCase();
  32965. });
  32966. /**
  32967. * Splits `string` by `separator`.
  32968. *
  32969. * **Note:** This method is based on
  32970. * [`String#split`](https://mdn.io/String/split).
  32971. *
  32972. * @static
  32973. * @memberOf _
  32974. * @since 4.0.0
  32975. * @category String
  32976. * @param {string} [string=''] The string to split.
  32977. * @param {RegExp|string} separator The separator pattern to split by.
  32978. * @param {number} [limit] The length to truncate results to.
  32979. * @returns {Array} Returns the string segments.
  32980. * @example
  32981. *
  32982. * _.split('a-b-c', '-', 2);
  32983. * // => ['a', 'b']
  32984. */
  32985. function split(string, separator, limit) {
  32986. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32987. separator = limit = undefined;
  32988. }
  32989. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32990. if (!limit) {
  32991. return [];
  32992. }
  32993. string = toString(string);
  32994. if (string && (
  32995. typeof separator == 'string' ||
  32996. (separator != null && !isRegExp(separator))
  32997. )) {
  32998. separator = baseToString(separator);
  32999. if (!separator && hasUnicode(string)) {
  33000. return castSlice(stringToArray(string), 0, limit);
  33001. }
  33002. }
  33003. return string.split(separator, limit);
  33004. }
  33005. /**
  33006. * Converts `string` to
  33007. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  33008. *
  33009. * @static
  33010. * @memberOf _
  33011. * @since 3.1.0
  33012. * @category String
  33013. * @param {string} [string=''] The string to convert.
  33014. * @returns {string} Returns the start cased string.
  33015. * @example
  33016. *
  33017. * _.startCase('--foo-bar--');
  33018. * // => 'Foo Bar'
  33019. *
  33020. * _.startCase('fooBar');
  33021. * // => 'Foo Bar'
  33022. *
  33023. * _.startCase('__FOO_BAR__');
  33024. * // => 'FOO BAR'
  33025. */
  33026. var startCase = createCompounder(function(result, word, index) {
  33027. return result + (index ? ' ' : '') + upperFirst(word);
  33028. });
  33029. /**
  33030. * Checks if `string` starts with the given target string.
  33031. *
  33032. * @static
  33033. * @memberOf _
  33034. * @since 3.0.0
  33035. * @category String
  33036. * @param {string} [string=''] The string to inspect.
  33037. * @param {string} [target] The string to search for.
  33038. * @param {number} [position=0] The position to search from.
  33039. * @returns {boolean} Returns `true` if `string` starts with `target`,
  33040. * else `false`.
  33041. * @example
  33042. *
  33043. * _.startsWith('abc', 'a');
  33044. * // => true
  33045. *
  33046. * _.startsWith('abc', 'b');
  33047. * // => false
  33048. *
  33049. * _.startsWith('abc', 'b', 1);
  33050. * // => true
  33051. */
  33052. function startsWith(string, target, position) {
  33053. string = toString(string);
  33054. position = position == null
  33055. ? 0
  33056. : baseClamp(toInteger(position), 0, string.length);
  33057. target = baseToString(target);
  33058. return string.slice(position, position + target.length) == target;
  33059. }
  33060. /**
  33061. * Creates a compiled template function that can interpolate data properties
  33062. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  33063. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  33064. * properties may be accessed as free variables in the template. If a setting
  33065. * object is given, it takes precedence over `_.templateSettings` values.
  33066. *
  33067. * **Note:** In the development build `_.template` utilizes
  33068. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  33069. * for easier debugging.
  33070. *
  33071. * For more information on precompiling templates see
  33072. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  33073. *
  33074. * For more information on Chrome extension sandboxes see
  33075. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  33076. *
  33077. * @static
  33078. * @since 0.1.0
  33079. * @memberOf _
  33080. * @category String
  33081. * @param {string} [string=''] The template string.
  33082. * @param {Object} [options={}] The options object.
  33083. * @param {RegExp} [options.escape=_.templateSettings.escape]
  33084. * The HTML "escape" delimiter.
  33085. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  33086. * The "evaluate" delimiter.
  33087. * @param {Object} [options.imports=_.templateSettings.imports]
  33088. * An object to import into the template as free variables.
  33089. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  33090. * The "interpolate" delimiter.
  33091. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  33092. * The sourceURL of the compiled template.
  33093. * @param {string} [options.variable='obj']
  33094. * The data object variable name.
  33095. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33096. * @returns {Function} Returns the compiled template function.
  33097. * @example
  33098. *
  33099. * // Use the "interpolate" delimiter to create a compiled template.
  33100. * var compiled = _.template('hello <%= user %>!');
  33101. * compiled({ 'user': 'fred' });
  33102. * // => 'hello fred!'
  33103. *
  33104. * // Use the HTML "escape" delimiter to escape data property values.
  33105. * var compiled = _.template('<b><%- value %></b>');
  33106. * compiled({ 'value': '<script>' });
  33107. * // => '<b>&lt;script&gt;</b>'
  33108. *
  33109. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  33110. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  33111. * compiled({ 'users': ['fred', 'barney'] });
  33112. * // => '<li>fred</li><li>barney</li>'
  33113. *
  33114. * // Use the internal `print` function in "evaluate" delimiters.
  33115. * var compiled = _.template('<% print("hello " + user); %>!');
  33116. * compiled({ 'user': 'barney' });
  33117. * // => 'hello barney!'
  33118. *
  33119. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  33120. * // Disable support by replacing the "interpolate" delimiter.
  33121. * var compiled = _.template('hello ${ user }!');
  33122. * compiled({ 'user': 'pebbles' });
  33123. * // => 'hello pebbles!'
  33124. *
  33125. * // Use backslashes to treat delimiters as plain text.
  33126. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  33127. * compiled({ 'value': 'ignored' });
  33128. * // => '<%- value %>'
  33129. *
  33130. * // Use the `imports` option to import `jQuery` as `jq`.
  33131. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  33132. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  33133. * compiled({ 'users': ['fred', 'barney'] });
  33134. * // => '<li>fred</li><li>barney</li>'
  33135. *
  33136. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  33137. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  33138. * compiled(data);
  33139. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  33140. *
  33141. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  33142. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  33143. * compiled.source;
  33144. * // => function(data) {
  33145. * // var __t, __p = '';
  33146. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  33147. * // return __p;
  33148. * // }
  33149. *
  33150. * // Use custom template delimiters.
  33151. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  33152. * var compiled = _.template('hello {{ user }}!');
  33153. * compiled({ 'user': 'mustache' });
  33154. * // => 'hello mustache!'
  33155. *
  33156. * // Use the `source` property to inline compiled templates for meaningful
  33157. * // line numbers in error messages and stack traces.
  33158. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  33159. * var JST = {\
  33160. * "main": ' + _.template(mainText).source + '\
  33161. * };\
  33162. * ');
  33163. */
  33164. function template(string, options, guard) {
  33165. // Based on John Resig's `tmpl` implementation
  33166. // (http://ejohn.org/blog/javascript-micro-templating/)
  33167. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  33168. var settings = lodash.templateSettings;
  33169. if (guard && isIterateeCall(string, options, guard)) {
  33170. options = undefined;
  33171. }
  33172. string = toString(string);
  33173. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  33174. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  33175. importsKeys = keys(imports),
  33176. importsValues = baseValues(imports, importsKeys);
  33177. var isEscaping,
  33178. isEvaluating,
  33179. index = 0,
  33180. interpolate = options.interpolate || reNoMatch,
  33181. source = "__p += '";
  33182. // Compile the regexp to match each delimiter.
  33183. var reDelimiters = RegExp(
  33184. (options.escape || reNoMatch).source + '|' +
  33185. interpolate.source + '|' +
  33186. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  33187. (options.evaluate || reNoMatch).source + '|$'
  33188. , 'g');
  33189. // Use a sourceURL for easier debugging.
  33190. // The sourceURL gets injected into the source that's eval-ed, so be careful
  33191. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  33192. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  33193. var sourceURL = '//# sourceURL=' +
  33194. (hasOwnProperty.call(options, 'sourceURL')
  33195. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  33196. : ('lodash.templateSources[' + (++templateCounter) + ']')
  33197. ) + '\n';
  33198. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  33199. interpolateValue || (interpolateValue = esTemplateValue);
  33200. // Escape characters that can't be included in string literals.
  33201. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  33202. // Replace delimiters with snippets.
  33203. if (escapeValue) {
  33204. isEscaping = true;
  33205. source += "' +\n__e(" + escapeValue + ") +\n'";
  33206. }
  33207. if (evaluateValue) {
  33208. isEvaluating = true;
  33209. source += "';\n" + evaluateValue + ";\n__p += '";
  33210. }
  33211. if (interpolateValue) {
  33212. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  33213. }
  33214. index = offset + match.length;
  33215. // The JS engine embedded in Adobe products needs `match` returned in
  33216. // order to produce the correct `offset` value.
  33217. return match;
  33218. });
  33219. source += "';\n";
  33220. // If `variable` is not specified wrap a with-statement around the generated
  33221. // code to add the data object to the top of the scope chain.
  33222. // Like with sourceURL, we take care to not check the option's prototype,
  33223. // as this configuration is a code injection vector.
  33224. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  33225. if (!variable) {
  33226. source = 'with (obj) {\n' + source + '\n}\n';
  33227. }
  33228. // Cleanup code by stripping empty strings.
  33229. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  33230. .replace(reEmptyStringMiddle, '$1')
  33231. .replace(reEmptyStringTrailing, '$1;');
  33232. // Frame code as the function body.
  33233. source = 'function(' + (variable || 'obj') + ') {\n' +
  33234. (variable
  33235. ? ''
  33236. : 'obj || (obj = {});\n'
  33237. ) +
  33238. "var __t, __p = ''" +
  33239. (isEscaping
  33240. ? ', __e = _.escape'
  33241. : ''
  33242. ) +
  33243. (isEvaluating
  33244. ? ', __j = Array.prototype.join;\n' +
  33245. "function print() { __p += __j.call(arguments, '') }\n"
  33246. : ';\n'
  33247. ) +
  33248. source +
  33249. 'return __p\n}';
  33250. var result = attempt(function() {
  33251. return Function(importsKeys, sourceURL + 'return ' + source)
  33252. .apply(undefined, importsValues);
  33253. });
  33254. // Provide the compiled function's source by its `toString` method or
  33255. // the `source` property as a convenience for inlining compiled templates.
  33256. result.source = source;
  33257. if (isError(result)) {
  33258. throw result;
  33259. }
  33260. return result;
  33261. }
  33262. /**
  33263. * Converts `string`, as a whole, to lower case just like
  33264. * [String#toLowerCase](https://mdn.io/toLowerCase).
  33265. *
  33266. * @static
  33267. * @memberOf _
  33268. * @since 4.0.0
  33269. * @category String
  33270. * @param {string} [string=''] The string to convert.
  33271. * @returns {string} Returns the lower cased string.
  33272. * @example
  33273. *
  33274. * _.toLower('--Foo-Bar--');
  33275. * // => '--foo-bar--'
  33276. *
  33277. * _.toLower('fooBar');
  33278. * // => 'foobar'
  33279. *
  33280. * _.toLower('__FOO_BAR__');
  33281. * // => '__foo_bar__'
  33282. */
  33283. function toLower(value) {
  33284. return toString(value).toLowerCase();
  33285. }
  33286. /**
  33287. * Converts `string`, as a whole, to upper case just like
  33288. * [String#toUpperCase](https://mdn.io/toUpperCase).
  33289. *
  33290. * @static
  33291. * @memberOf _
  33292. * @since 4.0.0
  33293. * @category String
  33294. * @param {string} [string=''] The string to convert.
  33295. * @returns {string} Returns the upper cased string.
  33296. * @example
  33297. *
  33298. * _.toUpper('--foo-bar--');
  33299. * // => '--FOO-BAR--'
  33300. *
  33301. * _.toUpper('fooBar');
  33302. * // => 'FOOBAR'
  33303. *
  33304. * _.toUpper('__foo_bar__');
  33305. * // => '__FOO_BAR__'
  33306. */
  33307. function toUpper(value) {
  33308. return toString(value).toUpperCase();
  33309. }
  33310. /**
  33311. * Removes leading and trailing whitespace or specified characters from `string`.
  33312. *
  33313. * @static
  33314. * @memberOf _
  33315. * @since 3.0.0
  33316. * @category String
  33317. * @param {string} [string=''] The string to trim.
  33318. * @param {string} [chars=whitespace] The characters to trim.
  33319. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33320. * @returns {string} Returns the trimmed string.
  33321. * @example
  33322. *
  33323. * _.trim(' abc ');
  33324. * // => 'abc'
  33325. *
  33326. * _.trim('-_-abc-_-', '_-');
  33327. * // => 'abc'
  33328. *
  33329. * _.map([' foo ', ' bar '], _.trim);
  33330. * // => ['foo', 'bar']
  33331. */
  33332. function trim(string, chars, guard) {
  33333. string = toString(string);
  33334. if (string && (guard || chars === undefined)) {
  33335. return string.replace(reTrim, '');
  33336. }
  33337. if (!string || !(chars = baseToString(chars))) {
  33338. return string;
  33339. }
  33340. var strSymbols = stringToArray(string),
  33341. chrSymbols = stringToArray(chars),
  33342. start = charsStartIndex(strSymbols, chrSymbols),
  33343. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  33344. return castSlice(strSymbols, start, end).join('');
  33345. }
  33346. /**
  33347. * Removes trailing whitespace or specified characters from `string`.
  33348. *
  33349. * @static
  33350. * @memberOf _
  33351. * @since 4.0.0
  33352. * @category String
  33353. * @param {string} [string=''] The string to trim.
  33354. * @param {string} [chars=whitespace] The characters to trim.
  33355. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33356. * @returns {string} Returns the trimmed string.
  33357. * @example
  33358. *
  33359. * _.trimEnd(' abc ');
  33360. * // => ' abc'
  33361. *
  33362. * _.trimEnd('-_-abc-_-', '_-');
  33363. * // => '-_-abc'
  33364. */
  33365. function trimEnd(string, chars, guard) {
  33366. string = toString(string);
  33367. if (string && (guard || chars === undefined)) {
  33368. return string.replace(reTrimEnd, '');
  33369. }
  33370. if (!string || !(chars = baseToString(chars))) {
  33371. return string;
  33372. }
  33373. var strSymbols = stringToArray(string),
  33374. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  33375. return castSlice(strSymbols, 0, end).join('');
  33376. }
  33377. /**
  33378. * Removes leading whitespace or specified characters from `string`.
  33379. *
  33380. * @static
  33381. * @memberOf _
  33382. * @since 4.0.0
  33383. * @category String
  33384. * @param {string} [string=''] The string to trim.
  33385. * @param {string} [chars=whitespace] The characters to trim.
  33386. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33387. * @returns {string} Returns the trimmed string.
  33388. * @example
  33389. *
  33390. * _.trimStart(' abc ');
  33391. * // => 'abc '
  33392. *
  33393. * _.trimStart('-_-abc-_-', '_-');
  33394. * // => 'abc-_-'
  33395. */
  33396. function trimStart(string, chars, guard) {
  33397. string = toString(string);
  33398. if (string && (guard || chars === undefined)) {
  33399. return string.replace(reTrimStart, '');
  33400. }
  33401. if (!string || !(chars = baseToString(chars))) {
  33402. return string;
  33403. }
  33404. var strSymbols = stringToArray(string),
  33405. start = charsStartIndex(strSymbols, stringToArray(chars));
  33406. return castSlice(strSymbols, start).join('');
  33407. }
  33408. /**
  33409. * Truncates `string` if it's longer than the given maximum string length.
  33410. * The last characters of the truncated string are replaced with the omission
  33411. * string which defaults to "...".
  33412. *
  33413. * @static
  33414. * @memberOf _
  33415. * @since 4.0.0
  33416. * @category String
  33417. * @param {string} [string=''] The string to truncate.
  33418. * @param {Object} [options={}] The options object.
  33419. * @param {number} [options.length=30] The maximum string length.
  33420. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  33421. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  33422. * @returns {string} Returns the truncated string.
  33423. * @example
  33424. *
  33425. * _.truncate('hi-diddly-ho there, neighborino');
  33426. * // => 'hi-diddly-ho there, neighbo...'
  33427. *
  33428. * _.truncate('hi-diddly-ho there, neighborino', {
  33429. * 'length': 24,
  33430. * 'separator': ' '
  33431. * });
  33432. * // => 'hi-diddly-ho there,...'
  33433. *
  33434. * _.truncate('hi-diddly-ho there, neighborino', {
  33435. * 'length': 24,
  33436. * 'separator': /,? +/
  33437. * });
  33438. * // => 'hi-diddly-ho there...'
  33439. *
  33440. * _.truncate('hi-diddly-ho there, neighborino', {
  33441. * 'omission': ' [...]'
  33442. * });
  33443. * // => 'hi-diddly-ho there, neig [...]'
  33444. */
  33445. function truncate(string, options) {
  33446. var length = DEFAULT_TRUNC_LENGTH,
  33447. omission = DEFAULT_TRUNC_OMISSION;
  33448. if (isObject(options)) {
  33449. var separator = 'separator' in options ? options.separator : separator;
  33450. length = 'length' in options ? toInteger(options.length) : length;
  33451. omission = 'omission' in options ? baseToString(options.omission) : omission;
  33452. }
  33453. string = toString(string);
  33454. var strLength = string.length;
  33455. if (hasUnicode(string)) {
  33456. var strSymbols = stringToArray(string);
  33457. strLength = strSymbols.length;
  33458. }
  33459. if (length >= strLength) {
  33460. return string;
  33461. }
  33462. var end = length - stringSize(omission);
  33463. if (end < 1) {
  33464. return omission;
  33465. }
  33466. var result = strSymbols
  33467. ? castSlice(strSymbols, 0, end).join('')
  33468. : string.slice(0, end);
  33469. if (separator === undefined) {
  33470. return result + omission;
  33471. }
  33472. if (strSymbols) {
  33473. end += (result.length - end);
  33474. }
  33475. if (isRegExp(separator)) {
  33476. if (string.slice(end).search(separator)) {
  33477. var match,
  33478. substring = result;
  33479. if (!separator.global) {
  33480. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  33481. }
  33482. separator.lastIndex = 0;
  33483. while ((match = separator.exec(substring))) {
  33484. var newEnd = match.index;
  33485. }
  33486. result = result.slice(0, newEnd === undefined ? end : newEnd);
  33487. }
  33488. } else if (string.indexOf(baseToString(separator), end) != end) {
  33489. var index = result.lastIndexOf(separator);
  33490. if (index > -1) {
  33491. result = result.slice(0, index);
  33492. }
  33493. }
  33494. return result + omission;
  33495. }
  33496. /**
  33497. * The inverse of `_.escape`; this method converts the HTML entities
  33498. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  33499. * their corresponding characters.
  33500. *
  33501. * **Note:** No other HTML entities are unescaped. To unescape additional
  33502. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  33503. *
  33504. * @static
  33505. * @memberOf _
  33506. * @since 0.6.0
  33507. * @category String
  33508. * @param {string} [string=''] The string to unescape.
  33509. * @returns {string} Returns the unescaped string.
  33510. * @example
  33511. *
  33512. * _.unescape('fred, barney, &amp; pebbles');
  33513. * // => 'fred, barney, & pebbles'
  33514. */
  33515. function unescape(string) {
  33516. string = toString(string);
  33517. return (string && reHasEscapedHtml.test(string))
  33518. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  33519. : string;
  33520. }
  33521. /**
  33522. * Converts `string`, as space separated words, to upper case.
  33523. *
  33524. * @static
  33525. * @memberOf _
  33526. * @since 4.0.0
  33527. * @category String
  33528. * @param {string} [string=''] The string to convert.
  33529. * @returns {string} Returns the upper cased string.
  33530. * @example
  33531. *
  33532. * _.upperCase('--foo-bar');
  33533. * // => 'FOO BAR'
  33534. *
  33535. * _.upperCase('fooBar');
  33536. * // => 'FOO BAR'
  33537. *
  33538. * _.upperCase('__foo_bar__');
  33539. * // => 'FOO BAR'
  33540. */
  33541. var upperCase = createCompounder(function(result, word, index) {
  33542. return result + (index ? ' ' : '') + word.toUpperCase();
  33543. });
  33544. /**
  33545. * Converts the first character of `string` to upper case.
  33546. *
  33547. * @static
  33548. * @memberOf _
  33549. * @since 4.0.0
  33550. * @category String
  33551. * @param {string} [string=''] The string to convert.
  33552. * @returns {string} Returns the converted string.
  33553. * @example
  33554. *
  33555. * _.upperFirst('fred');
  33556. * // => 'Fred'
  33557. *
  33558. * _.upperFirst('FRED');
  33559. * // => 'FRED'
  33560. */
  33561. var upperFirst = createCaseFirst('toUpperCase');
  33562. /**
  33563. * Splits `string` into an array of its words.
  33564. *
  33565. * @static
  33566. * @memberOf _
  33567. * @since 3.0.0
  33568. * @category String
  33569. * @param {string} [string=''] The string to inspect.
  33570. * @param {RegExp|string} [pattern] The pattern to match words.
  33571. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33572. * @returns {Array} Returns the words of `string`.
  33573. * @example
  33574. *
  33575. * _.words('fred, barney, & pebbles');
  33576. * // => ['fred', 'barney', 'pebbles']
  33577. *
  33578. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  33579. * // => ['fred', 'barney', '&', 'pebbles']
  33580. */
  33581. function words(string, pattern, guard) {
  33582. string = toString(string);
  33583. pattern = guard ? undefined : pattern;
  33584. if (pattern === undefined) {
  33585. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  33586. }
  33587. return string.match(pattern) || [];
  33588. }
  33589. /*------------------------------------------------------------------------*/
  33590. /**
  33591. * Attempts to invoke `func`, returning either the result or the caught error
  33592. * object. Any additional arguments are provided to `func` when it's invoked.
  33593. *
  33594. * @static
  33595. * @memberOf _
  33596. * @since 3.0.0
  33597. * @category Util
  33598. * @param {Function} func The function to attempt.
  33599. * @param {...*} [args] The arguments to invoke `func` with.
  33600. * @returns {*} Returns the `func` result or error object.
  33601. * @example
  33602. *
  33603. * // Avoid throwing errors for invalid selectors.
  33604. * var elements = _.attempt(function(selector) {
  33605. * return document.querySelectorAll(selector);
  33606. * }, '>_>');
  33607. *
  33608. * if (_.isError(elements)) {
  33609. * elements = [];
  33610. * }
  33611. */
  33612. var attempt = baseRest(function(func, args) {
  33613. try {
  33614. return apply(func, undefined, args);
  33615. } catch (e) {
  33616. return isError(e) ? e : new Error(e);
  33617. }
  33618. });
  33619. /**
  33620. * Binds methods of an object to the object itself, overwriting the existing
  33621. * method.
  33622. *
  33623. * **Note:** This method doesn't set the "length" property of bound functions.
  33624. *
  33625. * @static
  33626. * @since 0.1.0
  33627. * @memberOf _
  33628. * @category Util
  33629. * @param {Object} object The object to bind and assign the bound methods to.
  33630. * @param {...(string|string[])} methodNames The object method names to bind.
  33631. * @returns {Object} Returns `object`.
  33632. * @example
  33633. *
  33634. * var view = {
  33635. * 'label': 'docs',
  33636. * 'click': function() {
  33637. * console.log('clicked ' + this.label);
  33638. * }
  33639. * };
  33640. *
  33641. * _.bindAll(view, ['click']);
  33642. * jQuery(element).on('click', view.click);
  33643. * // => Logs 'clicked docs' when clicked.
  33644. */
  33645. var bindAll = flatRest(function(object, methodNames) {
  33646. arrayEach(methodNames, function(key) {
  33647. key = toKey(key);
  33648. baseAssignValue(object, key, bind(object[key], object));
  33649. });
  33650. return object;
  33651. });
  33652. /**
  33653. * Creates a function that iterates over `pairs` and invokes the corresponding
  33654. * function of the first predicate to return truthy. The predicate-function
  33655. * pairs are invoked with the `this` binding and arguments of the created
  33656. * function.
  33657. *
  33658. * @static
  33659. * @memberOf _
  33660. * @since 4.0.0
  33661. * @category Util
  33662. * @param {Array} pairs The predicate-function pairs.
  33663. * @returns {Function} Returns the new composite function.
  33664. * @example
  33665. *
  33666. * var func = _.cond([
  33667. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  33668. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  33669. * [_.stubTrue, _.constant('no match')]
  33670. * ]);
  33671. *
  33672. * func({ 'a': 1, 'b': 2 });
  33673. * // => 'matches A'
  33674. *
  33675. * func({ 'a': 0, 'b': 1 });
  33676. * // => 'matches B'
  33677. *
  33678. * func({ 'a': '1', 'b': '2' });
  33679. * // => 'no match'
  33680. */
  33681. function cond(pairs) {
  33682. var length = pairs == null ? 0 : pairs.length,
  33683. toIteratee = getIteratee();
  33684. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  33685. if (typeof pair[1] != 'function') {
  33686. throw new TypeError(FUNC_ERROR_TEXT);
  33687. }
  33688. return [toIteratee(pair[0]), pair[1]];
  33689. });
  33690. return baseRest(function(args) {
  33691. var index = -1;
  33692. while (++index < length) {
  33693. var pair = pairs[index];
  33694. if (apply(pair[0], this, args)) {
  33695. return apply(pair[1], this, args);
  33696. }
  33697. }
  33698. });
  33699. }
  33700. /**
  33701. * Creates a function that invokes the predicate properties of `source` with
  33702. * the corresponding property values of a given object, returning `true` if
  33703. * all predicates return truthy, else `false`.
  33704. *
  33705. * **Note:** The created function is equivalent to `_.conformsTo` with
  33706. * `source` partially applied.
  33707. *
  33708. * @static
  33709. * @memberOf _
  33710. * @since 4.0.0
  33711. * @category Util
  33712. * @param {Object} source The object of property predicates to conform to.
  33713. * @returns {Function} Returns the new spec function.
  33714. * @example
  33715. *
  33716. * var objects = [
  33717. * { 'a': 2, 'b': 1 },
  33718. * { 'a': 1, 'b': 2 }
  33719. * ];
  33720. *
  33721. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  33722. * // => [{ 'a': 1, 'b': 2 }]
  33723. */
  33724. function conforms(source) {
  33725. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  33726. }
  33727. /**
  33728. * Creates a function that returns `value`.
  33729. *
  33730. * @static
  33731. * @memberOf _
  33732. * @since 2.4.0
  33733. * @category Util
  33734. * @param {*} value The value to return from the new function.
  33735. * @returns {Function} Returns the new constant function.
  33736. * @example
  33737. *
  33738. * var objects = _.times(2, _.constant({ 'a': 1 }));
  33739. *
  33740. * console.log(objects);
  33741. * // => [{ 'a': 1 }, { 'a': 1 }]
  33742. *
  33743. * console.log(objects[0] === objects[1]);
  33744. * // => true
  33745. */
  33746. function constant(value) {
  33747. return function() {
  33748. return value;
  33749. };
  33750. }
  33751. /**
  33752. * Checks `value` to determine whether a default value should be returned in
  33753. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  33754. * or `undefined`.
  33755. *
  33756. * @static
  33757. * @memberOf _
  33758. * @since 4.14.0
  33759. * @category Util
  33760. * @param {*} value The value to check.
  33761. * @param {*} defaultValue The default value.
  33762. * @returns {*} Returns the resolved value.
  33763. * @example
  33764. *
  33765. * _.defaultTo(1, 10);
  33766. * // => 1
  33767. *
  33768. * _.defaultTo(undefined, 10);
  33769. * // => 10
  33770. */
  33771. function defaultTo(value, defaultValue) {
  33772. return (value == null || value !== value) ? defaultValue : value;
  33773. }
  33774. /**
  33775. * Creates a function that returns the result of invoking the given functions
  33776. * with the `this` binding of the created function, where each successive
  33777. * invocation is supplied the return value of the previous.
  33778. *
  33779. * @static
  33780. * @memberOf _
  33781. * @since 3.0.0
  33782. * @category Util
  33783. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33784. * @returns {Function} Returns the new composite function.
  33785. * @see _.flowRight
  33786. * @example
  33787. *
  33788. * function square(n) {
  33789. * return n * n;
  33790. * }
  33791. *
  33792. * var addSquare = _.flow([_.add, square]);
  33793. * addSquare(1, 2);
  33794. * // => 9
  33795. */
  33796. var flow = createFlow();
  33797. /**
  33798. * This method is like `_.flow` except that it creates a function that
  33799. * invokes the given functions from right to left.
  33800. *
  33801. * @static
  33802. * @since 3.0.0
  33803. * @memberOf _
  33804. * @category Util
  33805. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33806. * @returns {Function} Returns the new composite function.
  33807. * @see _.flow
  33808. * @example
  33809. *
  33810. * function square(n) {
  33811. * return n * n;
  33812. * }
  33813. *
  33814. * var addSquare = _.flowRight([square, _.add]);
  33815. * addSquare(1, 2);
  33816. * // => 9
  33817. */
  33818. var flowRight = createFlow(true);
  33819. /**
  33820. * This method returns the first argument it receives.
  33821. *
  33822. * @static
  33823. * @since 0.1.0
  33824. * @memberOf _
  33825. * @category Util
  33826. * @param {*} value Any value.
  33827. * @returns {*} Returns `value`.
  33828. * @example
  33829. *
  33830. * var object = { 'a': 1 };
  33831. *
  33832. * console.log(_.identity(object) === object);
  33833. * // => true
  33834. */
  33835. function identity(value) {
  33836. return value;
  33837. }
  33838. /**
  33839. * Creates a function that invokes `func` with the arguments of the created
  33840. * function. If `func` is a property name, the created function returns the
  33841. * property value for a given element. If `func` is an array or object, the
  33842. * created function returns `true` for elements that contain the equivalent
  33843. * source properties, otherwise it returns `false`.
  33844. *
  33845. * @static
  33846. * @since 4.0.0
  33847. * @memberOf _
  33848. * @category Util
  33849. * @param {*} [func=_.identity] The value to convert to a callback.
  33850. * @returns {Function} Returns the callback.
  33851. * @example
  33852. *
  33853. * var users = [
  33854. * { 'user': 'barney', 'age': 36, 'active': true },
  33855. * { 'user': 'fred', 'age': 40, 'active': false }
  33856. * ];
  33857. *
  33858. * // The `_.matches` iteratee shorthand.
  33859. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  33860. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  33861. *
  33862. * // The `_.matchesProperty` iteratee shorthand.
  33863. * _.filter(users, _.iteratee(['user', 'fred']));
  33864. * // => [{ 'user': 'fred', 'age': 40 }]
  33865. *
  33866. * // The `_.property` iteratee shorthand.
  33867. * _.map(users, _.iteratee('user'));
  33868. * // => ['barney', 'fred']
  33869. *
  33870. * // Create custom iteratee shorthands.
  33871. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  33872. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  33873. * return func.test(string);
  33874. * };
  33875. * });
  33876. *
  33877. * _.filter(['abc', 'def'], /ef/);
  33878. * // => ['def']
  33879. */
  33880. function iteratee(func) {
  33881. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  33882. }
  33883. /**
  33884. * Creates a function that performs a partial deep comparison between a given
  33885. * object and `source`, returning `true` if the given object has equivalent
  33886. * property values, else `false`.
  33887. *
  33888. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  33889. * partially applied.
  33890. *
  33891. * Partial comparisons will match empty array and empty object `source`
  33892. * values against any array or object value, respectively. See `_.isEqual`
  33893. * for a list of supported value comparisons.
  33894. *
  33895. * @static
  33896. * @memberOf _
  33897. * @since 3.0.0
  33898. * @category Util
  33899. * @param {Object} source The object of property values to match.
  33900. * @returns {Function} Returns the new spec function.
  33901. * @example
  33902. *
  33903. * var objects = [
  33904. * { 'a': 1, 'b': 2, 'c': 3 },
  33905. * { 'a': 4, 'b': 5, 'c': 6 }
  33906. * ];
  33907. *
  33908. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  33909. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  33910. */
  33911. function matches(source) {
  33912. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  33913. }
  33914. /**
  33915. * Creates a function that performs a partial deep comparison between the
  33916. * value at `path` of a given object to `srcValue`, returning `true` if the
  33917. * object value is equivalent, else `false`.
  33918. *
  33919. * **Note:** Partial comparisons will match empty array and empty object
  33920. * `srcValue` values against any array or object value, respectively. See
  33921. * `_.isEqual` for a list of supported value comparisons.
  33922. *
  33923. * @static
  33924. * @memberOf _
  33925. * @since 3.2.0
  33926. * @category Util
  33927. * @param {Array|string} path The path of the property to get.
  33928. * @param {*} srcValue The value to match.
  33929. * @returns {Function} Returns the new spec function.
  33930. * @example
  33931. *
  33932. * var objects = [
  33933. * { 'a': 1, 'b': 2, 'c': 3 },
  33934. * { 'a': 4, 'b': 5, 'c': 6 }
  33935. * ];
  33936. *
  33937. * _.find(objects, _.matchesProperty('a', 4));
  33938. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33939. */
  33940. function matchesProperty(path, srcValue) {
  33941. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33942. }
  33943. /**
  33944. * Creates a function that invokes the method at `path` of a given object.
  33945. * Any additional arguments are provided to the invoked method.
  33946. *
  33947. * @static
  33948. * @memberOf _
  33949. * @since 3.7.0
  33950. * @category Util
  33951. * @param {Array|string} path The path of the method to invoke.
  33952. * @param {...*} [args] The arguments to invoke the method with.
  33953. * @returns {Function} Returns the new invoker function.
  33954. * @example
  33955. *
  33956. * var objects = [
  33957. * { 'a': { 'b': _.constant(2) } },
  33958. * { 'a': { 'b': _.constant(1) } }
  33959. * ];
  33960. *
  33961. * _.map(objects, _.method('a.b'));
  33962. * // => [2, 1]
  33963. *
  33964. * _.map(objects, _.method(['a', 'b']));
  33965. * // => [2, 1]
  33966. */
  33967. var method = baseRest(function(path, args) {
  33968. return function(object) {
  33969. return baseInvoke(object, path, args);
  33970. };
  33971. });
  33972. /**
  33973. * The opposite of `_.method`; this method creates a function that invokes
  33974. * the method at a given path of `object`. Any additional arguments are
  33975. * provided to the invoked method.
  33976. *
  33977. * @static
  33978. * @memberOf _
  33979. * @since 3.7.0
  33980. * @category Util
  33981. * @param {Object} object The object to query.
  33982. * @param {...*} [args] The arguments to invoke the method with.
  33983. * @returns {Function} Returns the new invoker function.
  33984. * @example
  33985. *
  33986. * var array = _.times(3, _.constant),
  33987. * object = { 'a': array, 'b': array, 'c': array };
  33988. *
  33989. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33990. * // => [2, 0]
  33991. *
  33992. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33993. * // => [2, 0]
  33994. */
  33995. var methodOf = baseRest(function(object, args) {
  33996. return function(path) {
  33997. return baseInvoke(object, path, args);
  33998. };
  33999. });
  34000. /**
  34001. * Adds all own enumerable string keyed function properties of a source
  34002. * object to the destination object. If `object` is a function, then methods
  34003. * are added to its prototype as well.
  34004. *
  34005. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  34006. * avoid conflicts caused by modifying the original.
  34007. *
  34008. * @static
  34009. * @since 0.1.0
  34010. * @memberOf _
  34011. * @category Util
  34012. * @param {Function|Object} [object=lodash] The destination object.
  34013. * @param {Object} source The object of functions to add.
  34014. * @param {Object} [options={}] The options object.
  34015. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  34016. * @returns {Function|Object} Returns `object`.
  34017. * @example
  34018. *
  34019. * function vowels(string) {
  34020. * return _.filter(string, function(v) {
  34021. * return /[aeiou]/i.test(v);
  34022. * });
  34023. * }
  34024. *
  34025. * _.mixin({ 'vowels': vowels });
  34026. * _.vowels('fred');
  34027. * // => ['e']
  34028. *
  34029. * _('fred').vowels().value();
  34030. * // => ['e']
  34031. *
  34032. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  34033. * _('fred').vowels();
  34034. * // => ['e']
  34035. */
  34036. function mixin(object, source, options) {
  34037. var props = keys(source),
  34038. methodNames = baseFunctions(source, props);
  34039. if (options == null &&
  34040. !(isObject(source) && (methodNames.length || !props.length))) {
  34041. options = source;
  34042. source = object;
  34043. object = this;
  34044. methodNames = baseFunctions(source, keys(source));
  34045. }
  34046. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  34047. isFunc = isFunction(object);
  34048. arrayEach(methodNames, function(methodName) {
  34049. var func = source[methodName];
  34050. object[methodName] = func;
  34051. if (isFunc) {
  34052. object.prototype[methodName] = function() {
  34053. var chainAll = this.__chain__;
  34054. if (chain || chainAll) {
  34055. var result = object(this.__wrapped__),
  34056. actions = result.__actions__ = copyArray(this.__actions__);
  34057. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  34058. result.__chain__ = chainAll;
  34059. return result;
  34060. }
  34061. return func.apply(object, arrayPush([this.value()], arguments));
  34062. };
  34063. }
  34064. });
  34065. return object;
  34066. }
  34067. /**
  34068. * Reverts the `_` variable to its previous value and returns a reference to
  34069. * the `lodash` function.
  34070. *
  34071. * @static
  34072. * @since 0.1.0
  34073. * @memberOf _
  34074. * @category Util
  34075. * @returns {Function} Returns the `lodash` function.
  34076. * @example
  34077. *
  34078. * var lodash = _.noConflict();
  34079. */
  34080. function noConflict() {
  34081. if (root._ === this) {
  34082. root._ = oldDash;
  34083. }
  34084. return this;
  34085. }
  34086. /**
  34087. * This method returns `undefined`.
  34088. *
  34089. * @static
  34090. * @memberOf _
  34091. * @since 2.3.0
  34092. * @category Util
  34093. * @example
  34094. *
  34095. * _.times(2, _.noop);
  34096. * // => [undefined, undefined]
  34097. */
  34098. function noop() {
  34099. // No operation performed.
  34100. }
  34101. /**
  34102. * Creates a function that gets the argument at index `n`. If `n` is negative,
  34103. * the nth argument from the end is returned.
  34104. *
  34105. * @static
  34106. * @memberOf _
  34107. * @since 4.0.0
  34108. * @category Util
  34109. * @param {number} [n=0] The index of the argument to return.
  34110. * @returns {Function} Returns the new pass-thru function.
  34111. * @example
  34112. *
  34113. * var func = _.nthArg(1);
  34114. * func('a', 'b', 'c', 'd');
  34115. * // => 'b'
  34116. *
  34117. * var func = _.nthArg(-2);
  34118. * func('a', 'b', 'c', 'd');
  34119. * // => 'c'
  34120. */
  34121. function nthArg(n) {
  34122. n = toInteger(n);
  34123. return baseRest(function(args) {
  34124. return baseNth(args, n);
  34125. });
  34126. }
  34127. /**
  34128. * Creates a function that invokes `iteratees` with the arguments it receives
  34129. * and returns their results.
  34130. *
  34131. * @static
  34132. * @memberOf _
  34133. * @since 4.0.0
  34134. * @category Util
  34135. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  34136. * The iteratees to invoke.
  34137. * @returns {Function} Returns the new function.
  34138. * @example
  34139. *
  34140. * var func = _.over([Math.max, Math.min]);
  34141. *
  34142. * func(1, 2, 3, 4);
  34143. * // => [4, 1]
  34144. */
  34145. var over = createOver(arrayMap);
  34146. /**
  34147. * Creates a function that checks if **all** of the `predicates` return
  34148. * truthy when invoked with the arguments it receives.
  34149. *
  34150. * @static
  34151. * @memberOf _
  34152. * @since 4.0.0
  34153. * @category Util
  34154. * @param {...(Function|Function[])} [predicates=[_.identity]]
  34155. * The predicates to check.
  34156. * @returns {Function} Returns the new function.
  34157. * @example
  34158. *
  34159. * var func = _.overEvery([Boolean, isFinite]);
  34160. *
  34161. * func('1');
  34162. * // => true
  34163. *
  34164. * func(null);
  34165. * // => false
  34166. *
  34167. * func(NaN);
  34168. * // => false
  34169. */
  34170. var overEvery = createOver(arrayEvery);
  34171. /**
  34172. * Creates a function that checks if **any** of the `predicates` return
  34173. * truthy when invoked with the arguments it receives.
  34174. *
  34175. * @static
  34176. * @memberOf _
  34177. * @since 4.0.0
  34178. * @category Util
  34179. * @param {...(Function|Function[])} [predicates=[_.identity]]
  34180. * The predicates to check.
  34181. * @returns {Function} Returns the new function.
  34182. * @example
  34183. *
  34184. * var func = _.overSome([Boolean, isFinite]);
  34185. *
  34186. * func('1');
  34187. * // => true
  34188. *
  34189. * func(null);
  34190. * // => true
  34191. *
  34192. * func(NaN);
  34193. * // => false
  34194. */
  34195. var overSome = createOver(arraySome);
  34196. /**
  34197. * Creates a function that returns the value at `path` of a given object.
  34198. *
  34199. * @static
  34200. * @memberOf _
  34201. * @since 2.4.0
  34202. * @category Util
  34203. * @param {Array|string} path The path of the property to get.
  34204. * @returns {Function} Returns the new accessor function.
  34205. * @example
  34206. *
  34207. * var objects = [
  34208. * { 'a': { 'b': 2 } },
  34209. * { 'a': { 'b': 1 } }
  34210. * ];
  34211. *
  34212. * _.map(objects, _.property('a.b'));
  34213. * // => [2, 1]
  34214. *
  34215. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  34216. * // => [1, 2]
  34217. */
  34218. function property(path) {
  34219. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  34220. }
  34221. /**
  34222. * The opposite of `_.property`; this method creates a function that returns
  34223. * the value at a given path of `object`.
  34224. *
  34225. * @static
  34226. * @memberOf _
  34227. * @since 3.0.0
  34228. * @category Util
  34229. * @param {Object} object The object to query.
  34230. * @returns {Function} Returns the new accessor function.
  34231. * @example
  34232. *
  34233. * var array = [0, 1, 2],
  34234. * object = { 'a': array, 'b': array, 'c': array };
  34235. *
  34236. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  34237. * // => [2, 0]
  34238. *
  34239. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  34240. * // => [2, 0]
  34241. */
  34242. function propertyOf(object) {
  34243. return function(path) {
  34244. return object == null ? undefined : baseGet(object, path);
  34245. };
  34246. }
  34247. /**
  34248. * Creates an array of numbers (positive and/or negative) progressing from
  34249. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  34250. * `start` is specified without an `end` or `step`. If `end` is not specified,
  34251. * it's set to `start` with `start` then set to `0`.
  34252. *
  34253. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  34254. * floating-point values which can produce unexpected results.
  34255. *
  34256. * @static
  34257. * @since 0.1.0
  34258. * @memberOf _
  34259. * @category Util
  34260. * @param {number} [start=0] The start of the range.
  34261. * @param {number} end The end of the range.
  34262. * @param {number} [step=1] The value to increment or decrement by.
  34263. * @returns {Array} Returns the range of numbers.
  34264. * @see _.inRange, _.rangeRight
  34265. * @example
  34266. *
  34267. * _.range(4);
  34268. * // => [0, 1, 2, 3]
  34269. *
  34270. * _.range(-4);
  34271. * // => [0, -1, -2, -3]
  34272. *
  34273. * _.range(1, 5);
  34274. * // => [1, 2, 3, 4]
  34275. *
  34276. * _.range(0, 20, 5);
  34277. * // => [0, 5, 10, 15]
  34278. *
  34279. * _.range(0, -4, -1);
  34280. * // => [0, -1, -2, -3]
  34281. *
  34282. * _.range(1, 4, 0);
  34283. * // => [1, 1, 1]
  34284. *
  34285. * _.range(0);
  34286. * // => []
  34287. */
  34288. var range = createRange();
  34289. /**
  34290. * This method is like `_.range` except that it populates values in
  34291. * descending order.
  34292. *
  34293. * @static
  34294. * @memberOf _
  34295. * @since 4.0.0
  34296. * @category Util
  34297. * @param {number} [start=0] The start of the range.
  34298. * @param {number} end The end of the range.
  34299. * @param {number} [step=1] The value to increment or decrement by.
  34300. * @returns {Array} Returns the range of numbers.
  34301. * @see _.inRange, _.range
  34302. * @example
  34303. *
  34304. * _.rangeRight(4);
  34305. * // => [3, 2, 1, 0]
  34306. *
  34307. * _.rangeRight(-4);
  34308. * // => [-3, -2, -1, 0]
  34309. *
  34310. * _.rangeRight(1, 5);
  34311. * // => [4, 3, 2, 1]
  34312. *
  34313. * _.rangeRight(0, 20, 5);
  34314. * // => [15, 10, 5, 0]
  34315. *
  34316. * _.rangeRight(0, -4, -1);
  34317. * // => [-3, -2, -1, 0]
  34318. *
  34319. * _.rangeRight(1, 4, 0);
  34320. * // => [1, 1, 1]
  34321. *
  34322. * _.rangeRight(0);
  34323. * // => []
  34324. */
  34325. var rangeRight = createRange(true);
  34326. /**
  34327. * This method returns a new empty array.
  34328. *
  34329. * @static
  34330. * @memberOf _
  34331. * @since 4.13.0
  34332. * @category Util
  34333. * @returns {Array} Returns the new empty array.
  34334. * @example
  34335. *
  34336. * var arrays = _.times(2, _.stubArray);
  34337. *
  34338. * console.log(arrays);
  34339. * // => [[], []]
  34340. *
  34341. * console.log(arrays[0] === arrays[1]);
  34342. * // => false
  34343. */
  34344. function stubArray() {
  34345. return [];
  34346. }
  34347. /**
  34348. * This method returns `false`.
  34349. *
  34350. * @static
  34351. * @memberOf _
  34352. * @since 4.13.0
  34353. * @category Util
  34354. * @returns {boolean} Returns `false`.
  34355. * @example
  34356. *
  34357. * _.times(2, _.stubFalse);
  34358. * // => [false, false]
  34359. */
  34360. function stubFalse() {
  34361. return false;
  34362. }
  34363. /**
  34364. * This method returns a new empty object.
  34365. *
  34366. * @static
  34367. * @memberOf _
  34368. * @since 4.13.0
  34369. * @category Util
  34370. * @returns {Object} Returns the new empty object.
  34371. * @example
  34372. *
  34373. * var objects = _.times(2, _.stubObject);
  34374. *
  34375. * console.log(objects);
  34376. * // => [{}, {}]
  34377. *
  34378. * console.log(objects[0] === objects[1]);
  34379. * // => false
  34380. */
  34381. function stubObject() {
  34382. return {};
  34383. }
  34384. /**
  34385. * This method returns an empty string.
  34386. *
  34387. * @static
  34388. * @memberOf _
  34389. * @since 4.13.0
  34390. * @category Util
  34391. * @returns {string} Returns the empty string.
  34392. * @example
  34393. *
  34394. * _.times(2, _.stubString);
  34395. * // => ['', '']
  34396. */
  34397. function stubString() {
  34398. return '';
  34399. }
  34400. /**
  34401. * This method returns `true`.
  34402. *
  34403. * @static
  34404. * @memberOf _
  34405. * @since 4.13.0
  34406. * @category Util
  34407. * @returns {boolean} Returns `true`.
  34408. * @example
  34409. *
  34410. * _.times(2, _.stubTrue);
  34411. * // => [true, true]
  34412. */
  34413. function stubTrue() {
  34414. return true;
  34415. }
  34416. /**
  34417. * Invokes the iteratee `n` times, returning an array of the results of
  34418. * each invocation. The iteratee is invoked with one argument; (index).
  34419. *
  34420. * @static
  34421. * @since 0.1.0
  34422. * @memberOf _
  34423. * @category Util
  34424. * @param {number} n The number of times to invoke `iteratee`.
  34425. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  34426. * @returns {Array} Returns the array of results.
  34427. * @example
  34428. *
  34429. * _.times(3, String);
  34430. * // => ['0', '1', '2']
  34431. *
  34432. * _.times(4, _.constant(0));
  34433. * // => [0, 0, 0, 0]
  34434. */
  34435. function times(n, iteratee) {
  34436. n = toInteger(n);
  34437. if (n < 1 || n > MAX_SAFE_INTEGER) {
  34438. return [];
  34439. }
  34440. var index = MAX_ARRAY_LENGTH,
  34441. length = nativeMin(n, MAX_ARRAY_LENGTH);
  34442. iteratee = getIteratee(iteratee);
  34443. n -= MAX_ARRAY_LENGTH;
  34444. var result = baseTimes(length, iteratee);
  34445. while (++index < n) {
  34446. iteratee(index);
  34447. }
  34448. return result;
  34449. }
  34450. /**
  34451. * Converts `value` to a property path array.
  34452. *
  34453. * @static
  34454. * @memberOf _
  34455. * @since 4.0.0
  34456. * @category Util
  34457. * @param {*} value The value to convert.
  34458. * @returns {Array} Returns the new property path array.
  34459. * @example
  34460. *
  34461. * _.toPath('a.b.c');
  34462. * // => ['a', 'b', 'c']
  34463. *
  34464. * _.toPath('a[0].b.c');
  34465. * // => ['a', '0', 'b', 'c']
  34466. */
  34467. function toPath(value) {
  34468. if (isArray(value)) {
  34469. return arrayMap(value, toKey);
  34470. }
  34471. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  34472. }
  34473. /**
  34474. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  34475. *
  34476. * @static
  34477. * @since 0.1.0
  34478. * @memberOf _
  34479. * @category Util
  34480. * @param {string} [prefix=''] The value to prefix the ID with.
  34481. * @returns {string} Returns the unique ID.
  34482. * @example
  34483. *
  34484. * _.uniqueId('contact_');
  34485. * // => 'contact_104'
  34486. *
  34487. * _.uniqueId();
  34488. * // => '105'
  34489. */
  34490. function uniqueId(prefix) {
  34491. var id = ++idCounter;
  34492. return toString(prefix) + id;
  34493. }
  34494. /*------------------------------------------------------------------------*/
  34495. /**
  34496. * Adds two numbers.
  34497. *
  34498. * @static
  34499. * @memberOf _
  34500. * @since 3.4.0
  34501. * @category Math
  34502. * @param {number} augend The first number in an addition.
  34503. * @param {number} addend The second number in an addition.
  34504. * @returns {number} Returns the total.
  34505. * @example
  34506. *
  34507. * _.add(6, 4);
  34508. * // => 10
  34509. */
  34510. var add = createMathOperation(function(augend, addend) {
  34511. return augend + addend;
  34512. }, 0);
  34513. /**
  34514. * Computes `number` rounded up to `precision`.
  34515. *
  34516. * @static
  34517. * @memberOf _
  34518. * @since 3.10.0
  34519. * @category Math
  34520. * @param {number} number The number to round up.
  34521. * @param {number} [precision=0] The precision to round up to.
  34522. * @returns {number} Returns the rounded up number.
  34523. * @example
  34524. *
  34525. * _.ceil(4.006);
  34526. * // => 5
  34527. *
  34528. * _.ceil(6.004, 2);
  34529. * // => 6.01
  34530. *
  34531. * _.ceil(6040, -2);
  34532. * // => 6100
  34533. */
  34534. var ceil = createRound('ceil');
  34535. /**
  34536. * Divide two numbers.
  34537. *
  34538. * @static
  34539. * @memberOf _
  34540. * @since 4.7.0
  34541. * @category Math
  34542. * @param {number} dividend The first number in a division.
  34543. * @param {number} divisor The second number in a division.
  34544. * @returns {number} Returns the quotient.
  34545. * @example
  34546. *
  34547. * _.divide(6, 4);
  34548. * // => 1.5
  34549. */
  34550. var divide = createMathOperation(function(dividend, divisor) {
  34551. return dividend / divisor;
  34552. }, 1);
  34553. /**
  34554. * Computes `number` rounded down to `precision`.
  34555. *
  34556. * @static
  34557. * @memberOf _
  34558. * @since 3.10.0
  34559. * @category Math
  34560. * @param {number} number The number to round down.
  34561. * @param {number} [precision=0] The precision to round down to.
  34562. * @returns {number} Returns the rounded down number.
  34563. * @example
  34564. *
  34565. * _.floor(4.006);
  34566. * // => 4
  34567. *
  34568. * _.floor(0.046, 2);
  34569. * // => 0.04
  34570. *
  34571. * _.floor(4060, -2);
  34572. * // => 4000
  34573. */
  34574. var floor = createRound('floor');
  34575. /**
  34576. * Computes the maximum value of `array`. If `array` is empty or falsey,
  34577. * `undefined` is returned.
  34578. *
  34579. * @static
  34580. * @since 0.1.0
  34581. * @memberOf _
  34582. * @category Math
  34583. * @param {Array} array The array to iterate over.
  34584. * @returns {*} Returns the maximum value.
  34585. * @example
  34586. *
  34587. * _.max([4, 2, 8, 6]);
  34588. * // => 8
  34589. *
  34590. * _.max([]);
  34591. * // => undefined
  34592. */
  34593. function max(array) {
  34594. return (array && array.length)
  34595. ? baseExtremum(array, identity, baseGt)
  34596. : undefined;
  34597. }
  34598. /**
  34599. * This method is like `_.max` except that it accepts `iteratee` which is
  34600. * invoked for each element in `array` to generate the criterion by which
  34601. * the value is ranked. The iteratee is invoked with one argument: (value).
  34602. *
  34603. * @static
  34604. * @memberOf _
  34605. * @since 4.0.0
  34606. * @category Math
  34607. * @param {Array} array The array to iterate over.
  34608. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34609. * @returns {*} Returns the maximum value.
  34610. * @example
  34611. *
  34612. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34613. *
  34614. * _.maxBy(objects, function(o) { return o.n; });
  34615. * // => { 'n': 2 }
  34616. *
  34617. * // The `_.property` iteratee shorthand.
  34618. * _.maxBy(objects, 'n');
  34619. * // => { 'n': 2 }
  34620. */
  34621. function maxBy(array, iteratee) {
  34622. return (array && array.length)
  34623. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  34624. : undefined;
  34625. }
  34626. /**
  34627. * Computes the mean of the values in `array`.
  34628. *
  34629. * @static
  34630. * @memberOf _
  34631. * @since 4.0.0
  34632. * @category Math
  34633. * @param {Array} array The array to iterate over.
  34634. * @returns {number} Returns the mean.
  34635. * @example
  34636. *
  34637. * _.mean([4, 2, 8, 6]);
  34638. * // => 5
  34639. */
  34640. function mean(array) {
  34641. return baseMean(array, identity);
  34642. }
  34643. /**
  34644. * This method is like `_.mean` except that it accepts `iteratee` which is
  34645. * invoked for each element in `array` to generate the value to be averaged.
  34646. * The iteratee is invoked with one argument: (value).
  34647. *
  34648. * @static
  34649. * @memberOf _
  34650. * @since 4.7.0
  34651. * @category Math
  34652. * @param {Array} array The array to iterate over.
  34653. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34654. * @returns {number} Returns the mean.
  34655. * @example
  34656. *
  34657. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34658. *
  34659. * _.meanBy(objects, function(o) { return o.n; });
  34660. * // => 5
  34661. *
  34662. * // The `_.property` iteratee shorthand.
  34663. * _.meanBy(objects, 'n');
  34664. * // => 5
  34665. */
  34666. function meanBy(array, iteratee) {
  34667. return baseMean(array, getIteratee(iteratee, 2));
  34668. }
  34669. /**
  34670. * Computes the minimum value of `array`. If `array` is empty or falsey,
  34671. * `undefined` is returned.
  34672. *
  34673. * @static
  34674. * @since 0.1.0
  34675. * @memberOf _
  34676. * @category Math
  34677. * @param {Array} array The array to iterate over.
  34678. * @returns {*} Returns the minimum value.
  34679. * @example
  34680. *
  34681. * _.min([4, 2, 8, 6]);
  34682. * // => 2
  34683. *
  34684. * _.min([]);
  34685. * // => undefined
  34686. */
  34687. function min(array) {
  34688. return (array && array.length)
  34689. ? baseExtremum(array, identity, baseLt)
  34690. : undefined;
  34691. }
  34692. /**
  34693. * This method is like `_.min` except that it accepts `iteratee` which is
  34694. * invoked for each element in `array` to generate the criterion by which
  34695. * the value is ranked. The iteratee is invoked with one argument: (value).
  34696. *
  34697. * @static
  34698. * @memberOf _
  34699. * @since 4.0.0
  34700. * @category Math
  34701. * @param {Array} array The array to iterate over.
  34702. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34703. * @returns {*} Returns the minimum value.
  34704. * @example
  34705. *
  34706. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34707. *
  34708. * _.minBy(objects, function(o) { return o.n; });
  34709. * // => { 'n': 1 }
  34710. *
  34711. * // The `_.property` iteratee shorthand.
  34712. * _.minBy(objects, 'n');
  34713. * // => { 'n': 1 }
  34714. */
  34715. function minBy(array, iteratee) {
  34716. return (array && array.length)
  34717. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  34718. : undefined;
  34719. }
  34720. /**
  34721. * Multiply two numbers.
  34722. *
  34723. * @static
  34724. * @memberOf _
  34725. * @since 4.7.0
  34726. * @category Math
  34727. * @param {number} multiplier The first number in a multiplication.
  34728. * @param {number} multiplicand The second number in a multiplication.
  34729. * @returns {number} Returns the product.
  34730. * @example
  34731. *
  34732. * _.multiply(6, 4);
  34733. * // => 24
  34734. */
  34735. var multiply = createMathOperation(function(multiplier, multiplicand) {
  34736. return multiplier * multiplicand;
  34737. }, 1);
  34738. /**
  34739. * Computes `number` rounded to `precision`.
  34740. *
  34741. * @static
  34742. * @memberOf _
  34743. * @since 3.10.0
  34744. * @category Math
  34745. * @param {number} number The number to round.
  34746. * @param {number} [precision=0] The precision to round to.
  34747. * @returns {number} Returns the rounded number.
  34748. * @example
  34749. *
  34750. * _.round(4.006);
  34751. * // => 4
  34752. *
  34753. * _.round(4.006, 2);
  34754. * // => 4.01
  34755. *
  34756. * _.round(4060, -2);
  34757. * // => 4100
  34758. */
  34759. var round = createRound('round');
  34760. /**
  34761. * Subtract two numbers.
  34762. *
  34763. * @static
  34764. * @memberOf _
  34765. * @since 4.0.0
  34766. * @category Math
  34767. * @param {number} minuend The first number in a subtraction.
  34768. * @param {number} subtrahend The second number in a subtraction.
  34769. * @returns {number} Returns the difference.
  34770. * @example
  34771. *
  34772. * _.subtract(6, 4);
  34773. * // => 2
  34774. */
  34775. var subtract = createMathOperation(function(minuend, subtrahend) {
  34776. return minuend - subtrahend;
  34777. }, 0);
  34778. /**
  34779. * Computes the sum of the values in `array`.
  34780. *
  34781. * @static
  34782. * @memberOf _
  34783. * @since 3.4.0
  34784. * @category Math
  34785. * @param {Array} array The array to iterate over.
  34786. * @returns {number} Returns the sum.
  34787. * @example
  34788. *
  34789. * _.sum([4, 2, 8, 6]);
  34790. * // => 20
  34791. */
  34792. function sum(array) {
  34793. return (array && array.length)
  34794. ? baseSum(array, identity)
  34795. : 0;
  34796. }
  34797. /**
  34798. * This method is like `_.sum` except that it accepts `iteratee` which is
  34799. * invoked for each element in `array` to generate the value to be summed.
  34800. * The iteratee is invoked with one argument: (value).
  34801. *
  34802. * @static
  34803. * @memberOf _
  34804. * @since 4.0.0
  34805. * @category Math
  34806. * @param {Array} array The array to iterate over.
  34807. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34808. * @returns {number} Returns the sum.
  34809. * @example
  34810. *
  34811. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34812. *
  34813. * _.sumBy(objects, function(o) { return o.n; });
  34814. * // => 20
  34815. *
  34816. * // The `_.property` iteratee shorthand.
  34817. * _.sumBy(objects, 'n');
  34818. * // => 20
  34819. */
  34820. function sumBy(array, iteratee) {
  34821. return (array && array.length)
  34822. ? baseSum(array, getIteratee(iteratee, 2))
  34823. : 0;
  34824. }
  34825. /*------------------------------------------------------------------------*/
  34826. // Add methods that return wrapped values in chain sequences.
  34827. lodash.after = after;
  34828. lodash.ary = ary;
  34829. lodash.assign = assign;
  34830. lodash.assignIn = assignIn;
  34831. lodash.assignInWith = assignInWith;
  34832. lodash.assignWith = assignWith;
  34833. lodash.at = at;
  34834. lodash.before = before;
  34835. lodash.bind = bind;
  34836. lodash.bindAll = bindAll;
  34837. lodash.bindKey = bindKey;
  34838. lodash.castArray = castArray;
  34839. lodash.chain = chain;
  34840. lodash.chunk = chunk;
  34841. lodash.compact = compact;
  34842. lodash.concat = concat;
  34843. lodash.cond = cond;
  34844. lodash.conforms = conforms;
  34845. lodash.constant = constant;
  34846. lodash.countBy = countBy;
  34847. lodash.create = create;
  34848. lodash.curry = curry;
  34849. lodash.curryRight = curryRight;
  34850. lodash.debounce = debounce;
  34851. lodash.defaults = defaults;
  34852. lodash.defaultsDeep = defaultsDeep;
  34853. lodash.defer = defer;
  34854. lodash.delay = delay;
  34855. lodash.difference = difference;
  34856. lodash.differenceBy = differenceBy;
  34857. lodash.differenceWith = differenceWith;
  34858. lodash.drop = drop;
  34859. lodash.dropRight = dropRight;
  34860. lodash.dropRightWhile = dropRightWhile;
  34861. lodash.dropWhile = dropWhile;
  34862. lodash.fill = fill;
  34863. lodash.filter = filter;
  34864. lodash.flatMap = flatMap;
  34865. lodash.flatMapDeep = flatMapDeep;
  34866. lodash.flatMapDepth = flatMapDepth;
  34867. lodash.flatten = flatten;
  34868. lodash.flattenDeep = flattenDeep;
  34869. lodash.flattenDepth = flattenDepth;
  34870. lodash.flip = flip;
  34871. lodash.flow = flow;
  34872. lodash.flowRight = flowRight;
  34873. lodash.fromPairs = fromPairs;
  34874. lodash.functions = functions;
  34875. lodash.functionsIn = functionsIn;
  34876. lodash.groupBy = groupBy;
  34877. lodash.initial = initial;
  34878. lodash.intersection = intersection;
  34879. lodash.intersectionBy = intersectionBy;
  34880. lodash.intersectionWith = intersectionWith;
  34881. lodash.invert = invert;
  34882. lodash.invertBy = invertBy;
  34883. lodash.invokeMap = invokeMap;
  34884. lodash.iteratee = iteratee;
  34885. lodash.keyBy = keyBy;
  34886. lodash.keys = keys;
  34887. lodash.keysIn = keysIn;
  34888. lodash.map = map;
  34889. lodash.mapKeys = mapKeys;
  34890. lodash.mapValues = mapValues;
  34891. lodash.matches = matches;
  34892. lodash.matchesProperty = matchesProperty;
  34893. lodash.memoize = memoize;
  34894. lodash.merge = merge;
  34895. lodash.mergeWith = mergeWith;
  34896. lodash.method = method;
  34897. lodash.methodOf = methodOf;
  34898. lodash.mixin = mixin;
  34899. lodash.negate = negate;
  34900. lodash.nthArg = nthArg;
  34901. lodash.omit = omit;
  34902. lodash.omitBy = omitBy;
  34903. lodash.once = once;
  34904. lodash.orderBy = orderBy;
  34905. lodash.over = over;
  34906. lodash.overArgs = overArgs;
  34907. lodash.overEvery = overEvery;
  34908. lodash.overSome = overSome;
  34909. lodash.partial = partial;
  34910. lodash.partialRight = partialRight;
  34911. lodash.partition = partition;
  34912. lodash.pick = pick;
  34913. lodash.pickBy = pickBy;
  34914. lodash.property = property;
  34915. lodash.propertyOf = propertyOf;
  34916. lodash.pull = pull;
  34917. lodash.pullAll = pullAll;
  34918. lodash.pullAllBy = pullAllBy;
  34919. lodash.pullAllWith = pullAllWith;
  34920. lodash.pullAt = pullAt;
  34921. lodash.range = range;
  34922. lodash.rangeRight = rangeRight;
  34923. lodash.rearg = rearg;
  34924. lodash.reject = reject;
  34925. lodash.remove = remove;
  34926. lodash.rest = rest;
  34927. lodash.reverse = reverse;
  34928. lodash.sampleSize = sampleSize;
  34929. lodash.set = set;
  34930. lodash.setWith = setWith;
  34931. lodash.shuffle = shuffle;
  34932. lodash.slice = slice;
  34933. lodash.sortBy = sortBy;
  34934. lodash.sortedUniq = sortedUniq;
  34935. lodash.sortedUniqBy = sortedUniqBy;
  34936. lodash.split = split;
  34937. lodash.spread = spread;
  34938. lodash.tail = tail;
  34939. lodash.take = take;
  34940. lodash.takeRight = takeRight;
  34941. lodash.takeRightWhile = takeRightWhile;
  34942. lodash.takeWhile = takeWhile;
  34943. lodash.tap = tap;
  34944. lodash.throttle = throttle;
  34945. lodash.thru = thru;
  34946. lodash.toArray = toArray;
  34947. lodash.toPairs = toPairs;
  34948. lodash.toPairsIn = toPairsIn;
  34949. lodash.toPath = toPath;
  34950. lodash.toPlainObject = toPlainObject;
  34951. lodash.transform = transform;
  34952. lodash.unary = unary;
  34953. lodash.union = union;
  34954. lodash.unionBy = unionBy;
  34955. lodash.unionWith = unionWith;
  34956. lodash.uniq = uniq;
  34957. lodash.uniqBy = uniqBy;
  34958. lodash.uniqWith = uniqWith;
  34959. lodash.unset = unset;
  34960. lodash.unzip = unzip;
  34961. lodash.unzipWith = unzipWith;
  34962. lodash.update = update;
  34963. lodash.updateWith = updateWith;
  34964. lodash.values = values;
  34965. lodash.valuesIn = valuesIn;
  34966. lodash.without = without;
  34967. lodash.words = words;
  34968. lodash.wrap = wrap;
  34969. lodash.xor = xor;
  34970. lodash.xorBy = xorBy;
  34971. lodash.xorWith = xorWith;
  34972. lodash.zip = zip;
  34973. lodash.zipObject = zipObject;
  34974. lodash.zipObjectDeep = zipObjectDeep;
  34975. lodash.zipWith = zipWith;
  34976. // Add aliases.
  34977. lodash.entries = toPairs;
  34978. lodash.entriesIn = toPairsIn;
  34979. lodash.extend = assignIn;
  34980. lodash.extendWith = assignInWith;
  34981. // Add methods to `lodash.prototype`.
  34982. mixin(lodash, lodash);
  34983. /*------------------------------------------------------------------------*/
  34984. // Add methods that return unwrapped values in chain sequences.
  34985. lodash.add = add;
  34986. lodash.attempt = attempt;
  34987. lodash.camelCase = camelCase;
  34988. lodash.capitalize = capitalize;
  34989. lodash.ceil = ceil;
  34990. lodash.clamp = clamp;
  34991. lodash.clone = clone;
  34992. lodash.cloneDeep = cloneDeep;
  34993. lodash.cloneDeepWith = cloneDeepWith;
  34994. lodash.cloneWith = cloneWith;
  34995. lodash.conformsTo = conformsTo;
  34996. lodash.deburr = deburr;
  34997. lodash.defaultTo = defaultTo;
  34998. lodash.divide = divide;
  34999. lodash.endsWith = endsWith;
  35000. lodash.eq = eq;
  35001. lodash.escape = escape;
  35002. lodash.escapeRegExp = escapeRegExp;
  35003. lodash.every = every;
  35004. lodash.find = find;
  35005. lodash.findIndex = findIndex;
  35006. lodash.findKey = findKey;
  35007. lodash.findLast = findLast;
  35008. lodash.findLastIndex = findLastIndex;
  35009. lodash.findLastKey = findLastKey;
  35010. lodash.floor = floor;
  35011. lodash.forEach = forEach;
  35012. lodash.forEachRight = forEachRight;
  35013. lodash.forIn = forIn;
  35014. lodash.forInRight = forInRight;
  35015. lodash.forOwn = forOwn;
  35016. lodash.forOwnRight = forOwnRight;
  35017. lodash.get = get;
  35018. lodash.gt = gt;
  35019. lodash.gte = gte;
  35020. lodash.has = has;
  35021. lodash.hasIn = hasIn;
  35022. lodash.head = head;
  35023. lodash.identity = identity;
  35024. lodash.includes = includes;
  35025. lodash.indexOf = indexOf;
  35026. lodash.inRange = inRange;
  35027. lodash.invoke = invoke;
  35028. lodash.isArguments = isArguments;
  35029. lodash.isArray = isArray;
  35030. lodash.isArrayBuffer = isArrayBuffer;
  35031. lodash.isArrayLike = isArrayLike;
  35032. lodash.isArrayLikeObject = isArrayLikeObject;
  35033. lodash.isBoolean = isBoolean;
  35034. lodash.isBuffer = isBuffer;
  35035. lodash.isDate = isDate;
  35036. lodash.isElement = isElement;
  35037. lodash.isEmpty = isEmpty;
  35038. lodash.isEqual = isEqual;
  35039. lodash.isEqualWith = isEqualWith;
  35040. lodash.isError = isError;
  35041. lodash.isFinite = isFinite;
  35042. lodash.isFunction = isFunction;
  35043. lodash.isInteger = isInteger;
  35044. lodash.isLength = isLength;
  35045. lodash.isMap = isMap;
  35046. lodash.isMatch = isMatch;
  35047. lodash.isMatchWith = isMatchWith;
  35048. lodash.isNaN = isNaN;
  35049. lodash.isNative = isNative;
  35050. lodash.isNil = isNil;
  35051. lodash.isNull = isNull;
  35052. lodash.isNumber = isNumber;
  35053. lodash.isObject = isObject;
  35054. lodash.isObjectLike = isObjectLike;
  35055. lodash.isPlainObject = isPlainObject;
  35056. lodash.isRegExp = isRegExp;
  35057. lodash.isSafeInteger = isSafeInteger;
  35058. lodash.isSet = isSet;
  35059. lodash.isString = isString;
  35060. lodash.isSymbol = isSymbol;
  35061. lodash.isTypedArray = isTypedArray;
  35062. lodash.isUndefined = isUndefined;
  35063. lodash.isWeakMap = isWeakMap;
  35064. lodash.isWeakSet = isWeakSet;
  35065. lodash.join = join;
  35066. lodash.kebabCase = kebabCase;
  35067. lodash.last = last;
  35068. lodash.lastIndexOf = lastIndexOf;
  35069. lodash.lowerCase = lowerCase;
  35070. lodash.lowerFirst = lowerFirst;
  35071. lodash.lt = lt;
  35072. lodash.lte = lte;
  35073. lodash.max = max;
  35074. lodash.maxBy = maxBy;
  35075. lodash.mean = mean;
  35076. lodash.meanBy = meanBy;
  35077. lodash.min = min;
  35078. lodash.minBy = minBy;
  35079. lodash.stubArray = stubArray;
  35080. lodash.stubFalse = stubFalse;
  35081. lodash.stubObject = stubObject;
  35082. lodash.stubString = stubString;
  35083. lodash.stubTrue = stubTrue;
  35084. lodash.multiply = multiply;
  35085. lodash.nth = nth;
  35086. lodash.noConflict = noConflict;
  35087. lodash.noop = noop;
  35088. lodash.now = now;
  35089. lodash.pad = pad;
  35090. lodash.padEnd = padEnd;
  35091. lodash.padStart = padStart;
  35092. lodash.parseInt = parseInt;
  35093. lodash.random = random;
  35094. lodash.reduce = reduce;
  35095. lodash.reduceRight = reduceRight;
  35096. lodash.repeat = repeat;
  35097. lodash.replace = replace;
  35098. lodash.result = result;
  35099. lodash.round = round;
  35100. lodash.runInContext = runInContext;
  35101. lodash.sample = sample;
  35102. lodash.size = size;
  35103. lodash.snakeCase = snakeCase;
  35104. lodash.some = some;
  35105. lodash.sortedIndex = sortedIndex;
  35106. lodash.sortedIndexBy = sortedIndexBy;
  35107. lodash.sortedIndexOf = sortedIndexOf;
  35108. lodash.sortedLastIndex = sortedLastIndex;
  35109. lodash.sortedLastIndexBy = sortedLastIndexBy;
  35110. lodash.sortedLastIndexOf = sortedLastIndexOf;
  35111. lodash.startCase = startCase;
  35112. lodash.startsWith = startsWith;
  35113. lodash.subtract = subtract;
  35114. lodash.sum = sum;
  35115. lodash.sumBy = sumBy;
  35116. lodash.template = template;
  35117. lodash.times = times;
  35118. lodash.toFinite = toFinite;
  35119. lodash.toInteger = toInteger;
  35120. lodash.toLength = toLength;
  35121. lodash.toLower = toLower;
  35122. lodash.toNumber = toNumber;
  35123. lodash.toSafeInteger = toSafeInteger;
  35124. lodash.toString = toString;
  35125. lodash.toUpper = toUpper;
  35126. lodash.trim = trim;
  35127. lodash.trimEnd = trimEnd;
  35128. lodash.trimStart = trimStart;
  35129. lodash.truncate = truncate;
  35130. lodash.unescape = unescape;
  35131. lodash.uniqueId = uniqueId;
  35132. lodash.upperCase = upperCase;
  35133. lodash.upperFirst = upperFirst;
  35134. // Add aliases.
  35135. lodash.each = forEach;
  35136. lodash.eachRight = forEachRight;
  35137. lodash.first = head;
  35138. mixin(lodash, (function() {
  35139. var source = {};
  35140. baseForOwn(lodash, function(func, methodName) {
  35141. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  35142. source[methodName] = func;
  35143. }
  35144. });
  35145. return source;
  35146. }()), { 'chain': false });
  35147. /*------------------------------------------------------------------------*/
  35148. /**
  35149. * The semantic version number.
  35150. *
  35151. * @static
  35152. * @memberOf _
  35153. * @type {string}
  35154. */
  35155. lodash.VERSION = VERSION;
  35156. // Assign default placeholders.
  35157. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  35158. lodash[methodName].placeholder = lodash;
  35159. });
  35160. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  35161. arrayEach(['drop', 'take'], function(methodName, index) {
  35162. LazyWrapper.prototype[methodName] = function(n) {
  35163. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  35164. var result = (this.__filtered__ && !index)
  35165. ? new LazyWrapper(this)
  35166. : this.clone();
  35167. if (result.__filtered__) {
  35168. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  35169. } else {
  35170. result.__views__.push({
  35171. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  35172. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  35173. });
  35174. }
  35175. return result;
  35176. };
  35177. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  35178. return this.reverse()[methodName](n).reverse();
  35179. };
  35180. });
  35181. // Add `LazyWrapper` methods that accept an `iteratee` value.
  35182. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  35183. var type = index + 1,
  35184. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  35185. LazyWrapper.prototype[methodName] = function(iteratee) {
  35186. var result = this.clone();
  35187. result.__iteratees__.push({
  35188. 'iteratee': getIteratee(iteratee, 3),
  35189. 'type': type
  35190. });
  35191. result.__filtered__ = result.__filtered__ || isFilter;
  35192. return result;
  35193. };
  35194. });
  35195. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  35196. arrayEach(['head', 'last'], function(methodName, index) {
  35197. var takeName = 'take' + (index ? 'Right' : '');
  35198. LazyWrapper.prototype[methodName] = function() {
  35199. return this[takeName](1).value()[0];
  35200. };
  35201. });
  35202. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  35203. arrayEach(['initial', 'tail'], function(methodName, index) {
  35204. var dropName = 'drop' + (index ? '' : 'Right');
  35205. LazyWrapper.prototype[methodName] = function() {
  35206. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  35207. };
  35208. });
  35209. LazyWrapper.prototype.compact = function() {
  35210. return this.filter(identity);
  35211. };
  35212. LazyWrapper.prototype.find = function(predicate) {
  35213. return this.filter(predicate).head();
  35214. };
  35215. LazyWrapper.prototype.findLast = function(predicate) {
  35216. return this.reverse().find(predicate);
  35217. };
  35218. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  35219. if (typeof path == 'function') {
  35220. return new LazyWrapper(this);
  35221. }
  35222. return this.map(function(value) {
  35223. return baseInvoke(value, path, args);
  35224. });
  35225. });
  35226. LazyWrapper.prototype.reject = function(predicate) {
  35227. return this.filter(negate(getIteratee(predicate)));
  35228. };
  35229. LazyWrapper.prototype.slice = function(start, end) {
  35230. start = toInteger(start);
  35231. var result = this;
  35232. if (result.__filtered__ && (start > 0 || end < 0)) {
  35233. return new LazyWrapper(result);
  35234. }
  35235. if (start < 0) {
  35236. result = result.takeRight(-start);
  35237. } else if (start) {
  35238. result = result.drop(start);
  35239. }
  35240. if (end !== undefined) {
  35241. end = toInteger(end);
  35242. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  35243. }
  35244. return result;
  35245. };
  35246. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  35247. return this.reverse().takeWhile(predicate).reverse();
  35248. };
  35249. LazyWrapper.prototype.toArray = function() {
  35250. return this.take(MAX_ARRAY_LENGTH);
  35251. };
  35252. // Add `LazyWrapper` methods to `lodash.prototype`.
  35253. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  35254. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  35255. isTaker = /^(?:head|last)$/.test(methodName),
  35256. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  35257. retUnwrapped = isTaker || /^find/.test(methodName);
  35258. if (!lodashFunc) {
  35259. return;
  35260. }
  35261. lodash.prototype[methodName] = function() {
  35262. var value = this.__wrapped__,
  35263. args = isTaker ? [1] : arguments,
  35264. isLazy = value instanceof LazyWrapper,
  35265. iteratee = args[0],
  35266. useLazy = isLazy || isArray(value);
  35267. var interceptor = function(value) {
  35268. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  35269. return (isTaker && chainAll) ? result[0] : result;
  35270. };
  35271. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  35272. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  35273. isLazy = useLazy = false;
  35274. }
  35275. var chainAll = this.__chain__,
  35276. isHybrid = !!this.__actions__.length,
  35277. isUnwrapped = retUnwrapped && !chainAll,
  35278. onlyLazy = isLazy && !isHybrid;
  35279. if (!retUnwrapped && useLazy) {
  35280. value = onlyLazy ? value : new LazyWrapper(this);
  35281. var result = func.apply(value, args);
  35282. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  35283. return new LodashWrapper(result, chainAll);
  35284. }
  35285. if (isUnwrapped && onlyLazy) {
  35286. return func.apply(this, args);
  35287. }
  35288. result = this.thru(interceptor);
  35289. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  35290. };
  35291. });
  35292. // Add `Array` methods to `lodash.prototype`.
  35293. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  35294. var func = arrayProto[methodName],
  35295. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  35296. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  35297. lodash.prototype[methodName] = function() {
  35298. var args = arguments;
  35299. if (retUnwrapped && !this.__chain__) {
  35300. var value = this.value();
  35301. return func.apply(isArray(value) ? value : [], args);
  35302. }
  35303. return this[chainName](function(value) {
  35304. return func.apply(isArray(value) ? value : [], args);
  35305. });
  35306. };
  35307. });
  35308. // Map minified method names to their real names.
  35309. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  35310. var lodashFunc = lodash[methodName];
  35311. if (lodashFunc) {
  35312. var key = lodashFunc.name + '';
  35313. if (!hasOwnProperty.call(realNames, key)) {
  35314. realNames[key] = [];
  35315. }
  35316. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  35317. }
  35318. });
  35319. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  35320. 'name': 'wrapper',
  35321. 'func': undefined
  35322. }];
  35323. // Add methods to `LazyWrapper`.
  35324. LazyWrapper.prototype.clone = lazyClone;
  35325. LazyWrapper.prototype.reverse = lazyReverse;
  35326. LazyWrapper.prototype.value = lazyValue;
  35327. // Add chain sequence methods to the `lodash` wrapper.
  35328. lodash.prototype.at = wrapperAt;
  35329. lodash.prototype.chain = wrapperChain;
  35330. lodash.prototype.commit = wrapperCommit;
  35331. lodash.prototype.next = wrapperNext;
  35332. lodash.prototype.plant = wrapperPlant;
  35333. lodash.prototype.reverse = wrapperReverse;
  35334. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  35335. // Add lazy aliases.
  35336. lodash.prototype.first = lodash.prototype.head;
  35337. if (symIterator) {
  35338. lodash.prototype[symIterator] = wrapperToIterator;
  35339. }
  35340. return lodash;
  35341. });
  35342. /*--------------------------------------------------------------------------*/
  35343. // Export lodash.
  35344. var _ = runInContext();
  35345. // Some AMD build optimizers, like r.js, check for condition patterns like:
  35346. if (true) {
  35347. // Expose Lodash on the global object to prevent errors when Lodash is
  35348. // loaded by a script tag in the presence of an AMD loader.
  35349. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  35350. // Use `_.noConflict` to remove Lodash from the global object.
  35351. root._ = _;
  35352. // Define as an anonymous module so, through path mapping, it can be
  35353. // referenced as the "underscore" module.
  35354. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  35355. return _;
  35356. }).call(exports, __webpack_require__, exports, module),
  35357. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  35358. }
  35359. // Check for `exports` after `define` in case a build optimizer adds it.
  35360. else {}
  35361. }.call(this));
  35362. /* 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)))
  35363. /***/ }),
  35364. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  35365. /*!***************************************************!*\
  35366. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  35367. \***************************************************/
  35368. /*! exports provided: default */
  35369. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  35370. "use strict";
  35371. __webpack_require__.r(__webpack_exports__);
  35372. /* WEBPACK VAR INJECTION */(function(global) {/**!
  35373. * @fileOverview Kickass library to create and place poppers near their reference elements.
  35374. * @version 1.16.1
  35375. * @license
  35376. * Copyright (c) 2016 Federico Zivolo and contributors
  35377. *
  35378. * Permission is hereby granted, free of charge, to any person obtaining a copy
  35379. * of this software and associated documentation files (the "Software"), to deal
  35380. * in the Software without restriction, including without limitation the rights
  35381. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  35382. * copies of the Software, and to permit persons to whom the Software is
  35383. * furnished to do so, subject to the following conditions:
  35384. *
  35385. * The above copyright notice and this permission notice shall be included in all
  35386. * copies or substantial portions of the Software.
  35387. *
  35388. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  35389. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  35390. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  35391. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  35392. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  35393. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  35394. * SOFTWARE.
  35395. */
  35396. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  35397. var timeoutDuration = function () {
  35398. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  35399. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  35400. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  35401. return 1;
  35402. }
  35403. }
  35404. return 0;
  35405. }();
  35406. function microtaskDebounce(fn) {
  35407. var called = false;
  35408. return function () {
  35409. if (called) {
  35410. return;
  35411. }
  35412. called = true;
  35413. window.Promise.resolve().then(function () {
  35414. called = false;
  35415. fn();
  35416. });
  35417. };
  35418. }
  35419. function taskDebounce(fn) {
  35420. var scheduled = false;
  35421. return function () {
  35422. if (!scheduled) {
  35423. scheduled = true;
  35424. setTimeout(function () {
  35425. scheduled = false;
  35426. fn();
  35427. }, timeoutDuration);
  35428. }
  35429. };
  35430. }
  35431. var supportsMicroTasks = isBrowser && window.Promise;
  35432. /**
  35433. * Create a debounced version of a method, that's asynchronously deferred
  35434. * but called in the minimum time possible.
  35435. *
  35436. * @method
  35437. * @memberof Popper.Utils
  35438. * @argument {Function} fn
  35439. * @returns {Function}
  35440. */
  35441. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  35442. /**
  35443. * Check if the given variable is a function
  35444. * @method
  35445. * @memberof Popper.Utils
  35446. * @argument {Any} functionToCheck - variable to check
  35447. * @returns {Boolean} answer to: is a function?
  35448. */
  35449. function isFunction(functionToCheck) {
  35450. var getType = {};
  35451. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  35452. }
  35453. /**
  35454. * Get CSS computed property of the given element
  35455. * @method
  35456. * @memberof Popper.Utils
  35457. * @argument {Eement} element
  35458. * @argument {String} property
  35459. */
  35460. function getStyleComputedProperty(element, property) {
  35461. if (element.nodeType !== 1) {
  35462. return [];
  35463. }
  35464. // NOTE: 1 DOM access here
  35465. var window = element.ownerDocument.defaultView;
  35466. var css = window.getComputedStyle(element, null);
  35467. return property ? css[property] : css;
  35468. }
  35469. /**
  35470. * Returns the parentNode or the host of the element
  35471. * @method
  35472. * @memberof Popper.Utils
  35473. * @argument {Element} element
  35474. * @returns {Element} parent
  35475. */
  35476. function getParentNode(element) {
  35477. if (element.nodeName === 'HTML') {
  35478. return element;
  35479. }
  35480. return element.parentNode || element.host;
  35481. }
  35482. /**
  35483. * Returns the scrolling parent of the given element
  35484. * @method
  35485. * @memberof Popper.Utils
  35486. * @argument {Element} element
  35487. * @returns {Element} scroll parent
  35488. */
  35489. function getScrollParent(element) {
  35490. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  35491. if (!element) {
  35492. return document.body;
  35493. }
  35494. switch (element.nodeName) {
  35495. case 'HTML':
  35496. case 'BODY':
  35497. return element.ownerDocument.body;
  35498. case '#document':
  35499. return element.body;
  35500. }
  35501. // Firefox want us to check `-x` and `-y` variations as well
  35502. var _getStyleComputedProp = getStyleComputedProperty(element),
  35503. overflow = _getStyleComputedProp.overflow,
  35504. overflowX = _getStyleComputedProp.overflowX,
  35505. overflowY = _getStyleComputedProp.overflowY;
  35506. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  35507. return element;
  35508. }
  35509. return getScrollParent(getParentNode(element));
  35510. }
  35511. /**
  35512. * Returns the reference node of the reference object, or the reference object itself.
  35513. * @method
  35514. * @memberof Popper.Utils
  35515. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  35516. * @returns {Element} parent
  35517. */
  35518. function getReferenceNode(reference) {
  35519. return reference && reference.referenceNode ? reference.referenceNode : reference;
  35520. }
  35521. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  35522. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  35523. /**
  35524. * Determines if the browser is Internet Explorer
  35525. * @method
  35526. * @memberof Popper.Utils
  35527. * @param {Number} version to check
  35528. * @returns {Boolean} isIE
  35529. */
  35530. function isIE(version) {
  35531. if (version === 11) {
  35532. return isIE11;
  35533. }
  35534. if (version === 10) {
  35535. return isIE10;
  35536. }
  35537. return isIE11 || isIE10;
  35538. }
  35539. /**
  35540. * Returns the offset parent of the given element
  35541. * @method
  35542. * @memberof Popper.Utils
  35543. * @argument {Element} element
  35544. * @returns {Element} offset parent
  35545. */
  35546. function getOffsetParent(element) {
  35547. if (!element) {
  35548. return document.documentElement;
  35549. }
  35550. var noOffsetParent = isIE(10) ? document.body : null;
  35551. // NOTE: 1 DOM access here
  35552. var offsetParent = element.offsetParent || null;
  35553. // Skip hidden elements which don't have an offsetParent
  35554. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  35555. offsetParent = (element = element.nextElementSibling).offsetParent;
  35556. }
  35557. var nodeName = offsetParent && offsetParent.nodeName;
  35558. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  35559. return element ? element.ownerDocument.documentElement : document.documentElement;
  35560. }
  35561. // .offsetParent will return the closest TH, TD or TABLE in case
  35562. // no offsetParent is present, I hate this job...
  35563. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  35564. return getOffsetParent(offsetParent);
  35565. }
  35566. return offsetParent;
  35567. }
  35568. function isOffsetContainer(element) {
  35569. var nodeName = element.nodeName;
  35570. if (nodeName === 'BODY') {
  35571. return false;
  35572. }
  35573. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  35574. }
  35575. /**
  35576. * Finds the root node (document, shadowDOM root) of the given element
  35577. * @method
  35578. * @memberof Popper.Utils
  35579. * @argument {Element} node
  35580. * @returns {Element} root node
  35581. */
  35582. function getRoot(node) {
  35583. if (node.parentNode !== null) {
  35584. return getRoot(node.parentNode);
  35585. }
  35586. return node;
  35587. }
  35588. /**
  35589. * Finds the offset parent common to the two provided nodes
  35590. * @method
  35591. * @memberof Popper.Utils
  35592. * @argument {Element} element1
  35593. * @argument {Element} element2
  35594. * @returns {Element} common offset parent
  35595. */
  35596. function findCommonOffsetParent(element1, element2) {
  35597. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35598. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  35599. return document.documentElement;
  35600. }
  35601. // Here we make sure to give as "start" the element that comes first in the DOM
  35602. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  35603. var start = order ? element1 : element2;
  35604. var end = order ? element2 : element1;
  35605. // Get common ancestor container
  35606. var range = document.createRange();
  35607. range.setStart(start, 0);
  35608. range.setEnd(end, 0);
  35609. var commonAncestorContainer = range.commonAncestorContainer;
  35610. // Both nodes are inside #document
  35611. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  35612. if (isOffsetContainer(commonAncestorContainer)) {
  35613. return commonAncestorContainer;
  35614. }
  35615. return getOffsetParent(commonAncestorContainer);
  35616. }
  35617. // one of the nodes is inside shadowDOM, find which one
  35618. var element1root = getRoot(element1);
  35619. if (element1root.host) {
  35620. return findCommonOffsetParent(element1root.host, element2);
  35621. } else {
  35622. return findCommonOffsetParent(element1, getRoot(element2).host);
  35623. }
  35624. }
  35625. /**
  35626. * Gets the scroll value of the given element in the given side (top and left)
  35627. * @method
  35628. * @memberof Popper.Utils
  35629. * @argument {Element} element
  35630. * @argument {String} side `top` or `left`
  35631. * @returns {number} amount of scrolled pixels
  35632. */
  35633. function getScroll(element) {
  35634. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  35635. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  35636. var nodeName = element.nodeName;
  35637. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35638. var html = element.ownerDocument.documentElement;
  35639. var scrollingElement = element.ownerDocument.scrollingElement || html;
  35640. return scrollingElement[upperSide];
  35641. }
  35642. return element[upperSide];
  35643. }
  35644. /*
  35645. * Sum or subtract the element scroll values (left and top) from a given rect object
  35646. * @method
  35647. * @memberof Popper.Utils
  35648. * @param {Object} rect - Rect object you want to change
  35649. * @param {HTMLElement} element - The element from the function reads the scroll values
  35650. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  35651. * @return {Object} rect - The modifier rect object
  35652. */
  35653. function includeScroll(rect, element) {
  35654. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35655. var scrollTop = getScroll(element, 'top');
  35656. var scrollLeft = getScroll(element, 'left');
  35657. var modifier = subtract ? -1 : 1;
  35658. rect.top += scrollTop * modifier;
  35659. rect.bottom += scrollTop * modifier;
  35660. rect.left += scrollLeft * modifier;
  35661. rect.right += scrollLeft * modifier;
  35662. return rect;
  35663. }
  35664. /*
  35665. * Helper to detect borders of a given element
  35666. * @method
  35667. * @memberof Popper.Utils
  35668. * @param {CSSStyleDeclaration} styles
  35669. * Result of `getStyleComputedProperty` on the given element
  35670. * @param {String} axis - `x` or `y`
  35671. * @return {number} borders - The borders size of the given axis
  35672. */
  35673. function getBordersSize(styles, axis) {
  35674. var sideA = axis === 'x' ? 'Left' : 'Top';
  35675. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  35676. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  35677. }
  35678. function getSize(axis, body, html, computedStyle) {
  35679. 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);
  35680. }
  35681. function getWindowSizes(document) {
  35682. var body = document.body;
  35683. var html = document.documentElement;
  35684. var computedStyle = isIE(10) && getComputedStyle(html);
  35685. return {
  35686. height: getSize('Height', body, html, computedStyle),
  35687. width: getSize('Width', body, html, computedStyle)
  35688. };
  35689. }
  35690. var classCallCheck = function (instance, Constructor) {
  35691. if (!(instance instanceof Constructor)) {
  35692. throw new TypeError("Cannot call a class as a function");
  35693. }
  35694. };
  35695. var createClass = function () {
  35696. function defineProperties(target, props) {
  35697. for (var i = 0; i < props.length; i++) {
  35698. var descriptor = props[i];
  35699. descriptor.enumerable = descriptor.enumerable || false;
  35700. descriptor.configurable = true;
  35701. if ("value" in descriptor) descriptor.writable = true;
  35702. Object.defineProperty(target, descriptor.key, descriptor);
  35703. }
  35704. }
  35705. return function (Constructor, protoProps, staticProps) {
  35706. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  35707. if (staticProps) defineProperties(Constructor, staticProps);
  35708. return Constructor;
  35709. };
  35710. }();
  35711. var defineProperty = function (obj, key, value) {
  35712. if (key in obj) {
  35713. Object.defineProperty(obj, key, {
  35714. value: value,
  35715. enumerable: true,
  35716. configurable: true,
  35717. writable: true
  35718. });
  35719. } else {
  35720. obj[key] = value;
  35721. }
  35722. return obj;
  35723. };
  35724. var _extends = Object.assign || function (target) {
  35725. for (var i = 1; i < arguments.length; i++) {
  35726. var source = arguments[i];
  35727. for (var key in source) {
  35728. if (Object.prototype.hasOwnProperty.call(source, key)) {
  35729. target[key] = source[key];
  35730. }
  35731. }
  35732. }
  35733. return target;
  35734. };
  35735. /**
  35736. * Given element offsets, generate an output similar to getBoundingClientRect
  35737. * @method
  35738. * @memberof Popper.Utils
  35739. * @argument {Object} offsets
  35740. * @returns {Object} ClientRect like output
  35741. */
  35742. function getClientRect(offsets) {
  35743. return _extends({}, offsets, {
  35744. right: offsets.left + offsets.width,
  35745. bottom: offsets.top + offsets.height
  35746. });
  35747. }
  35748. /**
  35749. * Get bounding client rect of given element
  35750. * @method
  35751. * @memberof Popper.Utils
  35752. * @param {HTMLElement} element
  35753. * @return {Object} client rect
  35754. */
  35755. function getBoundingClientRect(element) {
  35756. var rect = {};
  35757. // IE10 10 FIX: Please, don't ask, the element isn't
  35758. // considered in DOM in some circumstances...
  35759. // This isn't reproducible in IE10 compatibility mode of IE11
  35760. try {
  35761. if (isIE(10)) {
  35762. rect = element.getBoundingClientRect();
  35763. var scrollTop = getScroll(element, 'top');
  35764. var scrollLeft = getScroll(element, 'left');
  35765. rect.top += scrollTop;
  35766. rect.left += scrollLeft;
  35767. rect.bottom += scrollTop;
  35768. rect.right += scrollLeft;
  35769. } else {
  35770. rect = element.getBoundingClientRect();
  35771. }
  35772. } catch (e) {}
  35773. var result = {
  35774. left: rect.left,
  35775. top: rect.top,
  35776. width: rect.right - rect.left,
  35777. height: rect.bottom - rect.top
  35778. };
  35779. // subtract scrollbar size from sizes
  35780. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  35781. var width = sizes.width || element.clientWidth || result.width;
  35782. var height = sizes.height || element.clientHeight || result.height;
  35783. var horizScrollbar = element.offsetWidth - width;
  35784. var vertScrollbar = element.offsetHeight - height;
  35785. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  35786. // we make this check conditional for performance reasons
  35787. if (horizScrollbar || vertScrollbar) {
  35788. var styles = getStyleComputedProperty(element);
  35789. horizScrollbar -= getBordersSize(styles, 'x');
  35790. vertScrollbar -= getBordersSize(styles, 'y');
  35791. result.width -= horizScrollbar;
  35792. result.height -= vertScrollbar;
  35793. }
  35794. return getClientRect(result);
  35795. }
  35796. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  35797. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35798. var isIE10 = isIE(10);
  35799. var isHTML = parent.nodeName === 'HTML';
  35800. var childrenRect = getBoundingClientRect(children);
  35801. var parentRect = getBoundingClientRect(parent);
  35802. var scrollParent = getScrollParent(children);
  35803. var styles = getStyleComputedProperty(parent);
  35804. var borderTopWidth = parseFloat(styles.borderTopWidth);
  35805. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  35806. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  35807. if (fixedPosition && isHTML) {
  35808. parentRect.top = Math.max(parentRect.top, 0);
  35809. parentRect.left = Math.max(parentRect.left, 0);
  35810. }
  35811. var offsets = getClientRect({
  35812. top: childrenRect.top - parentRect.top - borderTopWidth,
  35813. left: childrenRect.left - parentRect.left - borderLeftWidth,
  35814. width: childrenRect.width,
  35815. height: childrenRect.height
  35816. });
  35817. offsets.marginTop = 0;
  35818. offsets.marginLeft = 0;
  35819. // Subtract margins of documentElement in case it's being used as parent
  35820. // we do this only on HTML because it's the only element that behaves
  35821. // differently when margins are applied to it. The margins are included in
  35822. // the box of the documentElement, in the other cases not.
  35823. if (!isIE10 && isHTML) {
  35824. var marginTop = parseFloat(styles.marginTop);
  35825. var marginLeft = parseFloat(styles.marginLeft);
  35826. offsets.top -= borderTopWidth - marginTop;
  35827. offsets.bottom -= borderTopWidth - marginTop;
  35828. offsets.left -= borderLeftWidth - marginLeft;
  35829. offsets.right -= borderLeftWidth - marginLeft;
  35830. // Attach marginTop and marginLeft because in some circumstances we may need them
  35831. offsets.marginTop = marginTop;
  35832. offsets.marginLeft = marginLeft;
  35833. }
  35834. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  35835. offsets = includeScroll(offsets, parent);
  35836. }
  35837. return offsets;
  35838. }
  35839. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  35840. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35841. var html = element.ownerDocument.documentElement;
  35842. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  35843. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  35844. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  35845. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  35846. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  35847. var offset = {
  35848. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  35849. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  35850. width: width,
  35851. height: height
  35852. };
  35853. return getClientRect(offset);
  35854. }
  35855. /**
  35856. * Check if the given element is fixed or is inside a fixed parent
  35857. * @method
  35858. * @memberof Popper.Utils
  35859. * @argument {Element} element
  35860. * @argument {Element} customContainer
  35861. * @returns {Boolean} answer to "isFixed?"
  35862. */
  35863. function isFixed(element) {
  35864. var nodeName = element.nodeName;
  35865. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35866. return false;
  35867. }
  35868. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  35869. return true;
  35870. }
  35871. var parentNode = getParentNode(element);
  35872. if (!parentNode) {
  35873. return false;
  35874. }
  35875. return isFixed(parentNode);
  35876. }
  35877. /**
  35878. * Finds the first parent of an element that has a transformed property defined
  35879. * @method
  35880. * @memberof Popper.Utils
  35881. * @argument {Element} element
  35882. * @returns {Element} first transformed parent or documentElement
  35883. */
  35884. function getFixedPositionOffsetParent(element) {
  35885. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35886. if (!element || !element.parentElement || isIE()) {
  35887. return document.documentElement;
  35888. }
  35889. var el = element.parentElement;
  35890. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  35891. el = el.parentElement;
  35892. }
  35893. return el || document.documentElement;
  35894. }
  35895. /**
  35896. * Computed the boundaries limits and return them
  35897. * @method
  35898. * @memberof Popper.Utils
  35899. * @param {HTMLElement} popper
  35900. * @param {HTMLElement} reference
  35901. * @param {number} padding
  35902. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  35903. * @param {Boolean} fixedPosition - Is in fixed position mode
  35904. * @returns {Object} Coordinates of the boundaries
  35905. */
  35906. function getBoundaries(popper, reference, padding, boundariesElement) {
  35907. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  35908. // NOTE: 1 DOM access here
  35909. var boundaries = { top: 0, left: 0 };
  35910. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35911. // Handle viewport case
  35912. if (boundariesElement === 'viewport') {
  35913. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  35914. } else {
  35915. // Handle other cases based on DOM element used as boundaries
  35916. var boundariesNode = void 0;
  35917. if (boundariesElement === 'scrollParent') {
  35918. boundariesNode = getScrollParent(getParentNode(reference));
  35919. if (boundariesNode.nodeName === 'BODY') {
  35920. boundariesNode = popper.ownerDocument.documentElement;
  35921. }
  35922. } else if (boundariesElement === 'window') {
  35923. boundariesNode = popper.ownerDocument.documentElement;
  35924. } else {
  35925. boundariesNode = boundariesElement;
  35926. }
  35927. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  35928. // In case of HTML, we need a different computation
  35929. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  35930. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35931. height = _getWindowSizes.height,
  35932. width = _getWindowSizes.width;
  35933. boundaries.top += offsets.top - offsets.marginTop;
  35934. boundaries.bottom = height + offsets.top;
  35935. boundaries.left += offsets.left - offsets.marginLeft;
  35936. boundaries.right = width + offsets.left;
  35937. } else {
  35938. // for all the other DOM elements, this one is good
  35939. boundaries = offsets;
  35940. }
  35941. }
  35942. // Add paddings
  35943. padding = padding || 0;
  35944. var isPaddingNumber = typeof padding === 'number';
  35945. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35946. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35947. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35948. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35949. return boundaries;
  35950. }
  35951. function getArea(_ref) {
  35952. var width = _ref.width,
  35953. height = _ref.height;
  35954. return width * height;
  35955. }
  35956. /**
  35957. * Utility used to transform the `auto` placement to the placement with more
  35958. * available space.
  35959. * @method
  35960. * @memberof Popper.Utils
  35961. * @argument {Object} data - The data object generated by update method
  35962. * @argument {Object} options - Modifiers configuration and options
  35963. * @returns {Object} The data object, properly modified
  35964. */
  35965. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35966. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35967. if (placement.indexOf('auto') === -1) {
  35968. return placement;
  35969. }
  35970. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35971. var rects = {
  35972. top: {
  35973. width: boundaries.width,
  35974. height: refRect.top - boundaries.top
  35975. },
  35976. right: {
  35977. width: boundaries.right - refRect.right,
  35978. height: boundaries.height
  35979. },
  35980. bottom: {
  35981. width: boundaries.width,
  35982. height: boundaries.bottom - refRect.bottom
  35983. },
  35984. left: {
  35985. width: refRect.left - boundaries.left,
  35986. height: boundaries.height
  35987. }
  35988. };
  35989. var sortedAreas = Object.keys(rects).map(function (key) {
  35990. return _extends({
  35991. key: key
  35992. }, rects[key], {
  35993. area: getArea(rects[key])
  35994. });
  35995. }).sort(function (a, b) {
  35996. return b.area - a.area;
  35997. });
  35998. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35999. var width = _ref2.width,
  36000. height = _ref2.height;
  36001. return width >= popper.clientWidth && height >= popper.clientHeight;
  36002. });
  36003. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  36004. var variation = placement.split('-')[1];
  36005. return computedPlacement + (variation ? '-' + variation : '');
  36006. }
  36007. /**
  36008. * Get offsets to the reference element
  36009. * @method
  36010. * @memberof Popper.Utils
  36011. * @param {Object} state
  36012. * @param {Element} popper - the popper element
  36013. * @param {Element} reference - the reference element (the popper will be relative to this)
  36014. * @param {Element} fixedPosition - is in fixed position mode
  36015. * @returns {Object} An object containing the offsets which will be applied to the popper
  36016. */
  36017. function getReferenceOffsets(state, popper, reference) {
  36018. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  36019. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  36020. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  36021. }
  36022. /**
  36023. * Get the outer sizes of the given element (offset size + margins)
  36024. * @method
  36025. * @memberof Popper.Utils
  36026. * @argument {Element} element
  36027. * @returns {Object} object containing width and height properties
  36028. */
  36029. function getOuterSizes(element) {
  36030. var window = element.ownerDocument.defaultView;
  36031. var styles = window.getComputedStyle(element);
  36032. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  36033. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  36034. var result = {
  36035. width: element.offsetWidth + y,
  36036. height: element.offsetHeight + x
  36037. };
  36038. return result;
  36039. }
  36040. /**
  36041. * Get the opposite placement of the given one
  36042. * @method
  36043. * @memberof Popper.Utils
  36044. * @argument {String} placement
  36045. * @returns {String} flipped placement
  36046. */
  36047. function getOppositePlacement(placement) {
  36048. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  36049. return placement.replace(/left|right|bottom|top/g, function (matched) {
  36050. return hash[matched];
  36051. });
  36052. }
  36053. /**
  36054. * Get offsets to the popper
  36055. * @method
  36056. * @memberof Popper.Utils
  36057. * @param {Object} position - CSS position the Popper will get applied
  36058. * @param {HTMLElement} popper - the popper element
  36059. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  36060. * @param {String} placement - one of the valid placement options
  36061. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  36062. */
  36063. function getPopperOffsets(popper, referenceOffsets, placement) {
  36064. placement = placement.split('-')[0];
  36065. // Get popper node sizes
  36066. var popperRect = getOuterSizes(popper);
  36067. // Add position, width and height to our offsets object
  36068. var popperOffsets = {
  36069. width: popperRect.width,
  36070. height: popperRect.height
  36071. };
  36072. // depending by the popper placement we have to compute its offsets slightly differently
  36073. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  36074. var mainSide = isHoriz ? 'top' : 'left';
  36075. var secondarySide = isHoriz ? 'left' : 'top';
  36076. var measurement = isHoriz ? 'height' : 'width';
  36077. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  36078. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  36079. if (placement === secondarySide) {
  36080. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  36081. } else {
  36082. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  36083. }
  36084. return popperOffsets;
  36085. }
  36086. /**
  36087. * Mimics the `find` method of Array
  36088. * @method
  36089. * @memberof Popper.Utils
  36090. * @argument {Array} arr
  36091. * @argument prop
  36092. * @argument value
  36093. * @returns index or -1
  36094. */
  36095. function find(arr, check) {
  36096. // use native find if supported
  36097. if (Array.prototype.find) {
  36098. return arr.find(check);
  36099. }
  36100. // use `filter` to obtain the same behavior of `find`
  36101. return arr.filter(check)[0];
  36102. }
  36103. /**
  36104. * Return the index of the matching object
  36105. * @method
  36106. * @memberof Popper.Utils
  36107. * @argument {Array} arr
  36108. * @argument prop
  36109. * @argument value
  36110. * @returns index or -1
  36111. */
  36112. function findIndex(arr, prop, value) {
  36113. // use native findIndex if supported
  36114. if (Array.prototype.findIndex) {
  36115. return arr.findIndex(function (cur) {
  36116. return cur[prop] === value;
  36117. });
  36118. }
  36119. // use `find` + `indexOf` if `findIndex` isn't supported
  36120. var match = find(arr, function (obj) {
  36121. return obj[prop] === value;
  36122. });
  36123. return arr.indexOf(match);
  36124. }
  36125. /**
  36126. * Loop trough the list of modifiers and run them in order,
  36127. * each of them will then edit the data object.
  36128. * @method
  36129. * @memberof Popper.Utils
  36130. * @param {dataObject} data
  36131. * @param {Array} modifiers
  36132. * @param {String} ends - Optional modifier name used as stopper
  36133. * @returns {dataObject}
  36134. */
  36135. function runModifiers(modifiers, data, ends) {
  36136. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  36137. modifiersToRun.forEach(function (modifier) {
  36138. if (modifier['function']) {
  36139. // eslint-disable-line dot-notation
  36140. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  36141. }
  36142. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  36143. if (modifier.enabled && isFunction(fn)) {
  36144. // Add properties to offsets to make them a complete clientRect object
  36145. // we do this before each modifier to make sure the previous one doesn't
  36146. // mess with these values
  36147. data.offsets.popper = getClientRect(data.offsets.popper);
  36148. data.offsets.reference = getClientRect(data.offsets.reference);
  36149. data = fn(data, modifier);
  36150. }
  36151. });
  36152. return data;
  36153. }
  36154. /**
  36155. * Updates the position of the popper, computing the new offsets and applying
  36156. * the new style.<br />
  36157. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  36158. * @method
  36159. * @memberof Popper
  36160. */
  36161. function update() {
  36162. // if popper is destroyed, don't perform any further update
  36163. if (this.state.isDestroyed) {
  36164. return;
  36165. }
  36166. var data = {
  36167. instance: this,
  36168. styles: {},
  36169. arrowStyles: {},
  36170. attributes: {},
  36171. flipped: false,
  36172. offsets: {}
  36173. };
  36174. // compute reference element offsets
  36175. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  36176. // compute auto placement, store placement inside the data object,
  36177. // modifiers will be able to edit `placement` if needed
  36178. // and refer to originalPlacement to know the original value
  36179. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  36180. // store the computed placement inside `originalPlacement`
  36181. data.originalPlacement = data.placement;
  36182. data.positionFixed = this.options.positionFixed;
  36183. // compute the popper offsets
  36184. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  36185. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  36186. // run the modifiers
  36187. data = runModifiers(this.modifiers, data);
  36188. // the first `update` will call `onCreate` callback
  36189. // the other ones will call `onUpdate` callback
  36190. if (!this.state.isCreated) {
  36191. this.state.isCreated = true;
  36192. this.options.onCreate(data);
  36193. } else {
  36194. this.options.onUpdate(data);
  36195. }
  36196. }
  36197. /**
  36198. * Helper used to know if the given modifier is enabled.
  36199. * @method
  36200. * @memberof Popper.Utils
  36201. * @returns {Boolean}
  36202. */
  36203. function isModifierEnabled(modifiers, modifierName) {
  36204. return modifiers.some(function (_ref) {
  36205. var name = _ref.name,
  36206. enabled = _ref.enabled;
  36207. return enabled && name === modifierName;
  36208. });
  36209. }
  36210. /**
  36211. * Get the prefixed supported property name
  36212. * @method
  36213. * @memberof Popper.Utils
  36214. * @argument {String} property (camelCase)
  36215. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  36216. */
  36217. function getSupportedPropertyName(property) {
  36218. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  36219. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  36220. for (var i = 0; i < prefixes.length; i++) {
  36221. var prefix = prefixes[i];
  36222. var toCheck = prefix ? '' + prefix + upperProp : property;
  36223. if (typeof document.body.style[toCheck] !== 'undefined') {
  36224. return toCheck;
  36225. }
  36226. }
  36227. return null;
  36228. }
  36229. /**
  36230. * Destroys the popper.
  36231. * @method
  36232. * @memberof Popper
  36233. */
  36234. function destroy() {
  36235. this.state.isDestroyed = true;
  36236. // touch DOM only if `applyStyle` modifier is enabled
  36237. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  36238. this.popper.removeAttribute('x-placement');
  36239. this.popper.style.position = '';
  36240. this.popper.style.top = '';
  36241. this.popper.style.left = '';
  36242. this.popper.style.right = '';
  36243. this.popper.style.bottom = '';
  36244. this.popper.style.willChange = '';
  36245. this.popper.style[getSupportedPropertyName('transform')] = '';
  36246. }
  36247. this.disableEventListeners();
  36248. // remove the popper if user explicitly asked for the deletion on destroy
  36249. // do not use `remove` because IE11 doesn't support it
  36250. if (this.options.removeOnDestroy) {
  36251. this.popper.parentNode.removeChild(this.popper);
  36252. }
  36253. return this;
  36254. }
  36255. /**
  36256. * Get the window associated with the element
  36257. * @argument {Element} element
  36258. * @returns {Window}
  36259. */
  36260. function getWindow(element) {
  36261. var ownerDocument = element.ownerDocument;
  36262. return ownerDocument ? ownerDocument.defaultView : window;
  36263. }
  36264. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  36265. var isBody = scrollParent.nodeName === 'BODY';
  36266. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  36267. target.addEventListener(event, callback, { passive: true });
  36268. if (!isBody) {
  36269. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  36270. }
  36271. scrollParents.push(target);
  36272. }
  36273. /**
  36274. * Setup needed event listeners used to update the popper position
  36275. * @method
  36276. * @memberof Popper.Utils
  36277. * @private
  36278. */
  36279. function setupEventListeners(reference, options, state, updateBound) {
  36280. // Resize event listener on window
  36281. state.updateBound = updateBound;
  36282. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  36283. // Scroll event listener on scroll parents
  36284. var scrollElement = getScrollParent(reference);
  36285. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  36286. state.scrollElement = scrollElement;
  36287. state.eventsEnabled = true;
  36288. return state;
  36289. }
  36290. /**
  36291. * It will add resize/scroll events and start recalculating
  36292. * position of the popper element when they are triggered.
  36293. * @method
  36294. * @memberof Popper
  36295. */
  36296. function enableEventListeners() {
  36297. if (!this.state.eventsEnabled) {
  36298. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  36299. }
  36300. }
  36301. /**
  36302. * Remove event listeners used to update the popper position
  36303. * @method
  36304. * @memberof Popper.Utils
  36305. * @private
  36306. */
  36307. function removeEventListeners(reference, state) {
  36308. // Remove resize event listener on window
  36309. getWindow(reference).removeEventListener('resize', state.updateBound);
  36310. // Remove scroll event listener on scroll parents
  36311. state.scrollParents.forEach(function (target) {
  36312. target.removeEventListener('scroll', state.updateBound);
  36313. });
  36314. // Reset state
  36315. state.updateBound = null;
  36316. state.scrollParents = [];
  36317. state.scrollElement = null;
  36318. state.eventsEnabled = false;
  36319. return state;
  36320. }
  36321. /**
  36322. * It will remove resize/scroll events and won't recalculate popper position
  36323. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  36324. * unless you call `update` method manually.
  36325. * @method
  36326. * @memberof Popper
  36327. */
  36328. function disableEventListeners() {
  36329. if (this.state.eventsEnabled) {
  36330. cancelAnimationFrame(this.scheduleUpdate);
  36331. this.state = removeEventListeners(this.reference, this.state);
  36332. }
  36333. }
  36334. /**
  36335. * Tells if a given input is a number
  36336. * @method
  36337. * @memberof Popper.Utils
  36338. * @param {*} input to check
  36339. * @return {Boolean}
  36340. */
  36341. function isNumeric(n) {
  36342. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  36343. }
  36344. /**
  36345. * Set the style to the given popper
  36346. * @method
  36347. * @memberof Popper.Utils
  36348. * @argument {Element} element - Element to apply the style to
  36349. * @argument {Object} styles
  36350. * Object with a list of properties and values which will be applied to the element
  36351. */
  36352. function setStyles(element, styles) {
  36353. Object.keys(styles).forEach(function (prop) {
  36354. var unit = '';
  36355. // add unit if the value is numeric and is one of the following
  36356. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  36357. unit = 'px';
  36358. }
  36359. element.style[prop] = styles[prop] + unit;
  36360. });
  36361. }
  36362. /**
  36363. * Set the attributes to the given popper
  36364. * @method
  36365. * @memberof Popper.Utils
  36366. * @argument {Element} element - Element to apply the attributes to
  36367. * @argument {Object} styles
  36368. * Object with a list of properties and values which will be applied to the element
  36369. */
  36370. function setAttributes(element, attributes) {
  36371. Object.keys(attributes).forEach(function (prop) {
  36372. var value = attributes[prop];
  36373. if (value !== false) {
  36374. element.setAttribute(prop, attributes[prop]);
  36375. } else {
  36376. element.removeAttribute(prop);
  36377. }
  36378. });
  36379. }
  36380. /**
  36381. * @function
  36382. * @memberof Modifiers
  36383. * @argument {Object} data - The data object generated by `update` method
  36384. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  36385. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  36386. * @argument {Object} options - Modifiers configuration and options
  36387. * @returns {Object} The same data object
  36388. */
  36389. function applyStyle(data) {
  36390. // any property present in `data.styles` will be applied to the popper,
  36391. // in this way we can make the 3rd party modifiers add custom styles to it
  36392. // Be aware, modifiers could override the properties defined in the previous
  36393. // lines of this modifier!
  36394. setStyles(data.instance.popper, data.styles);
  36395. // any property present in `data.attributes` will be applied to the popper,
  36396. // they will be set as HTML attributes of the element
  36397. setAttributes(data.instance.popper, data.attributes);
  36398. // if arrowElement is defined and arrowStyles has some properties
  36399. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  36400. setStyles(data.arrowElement, data.arrowStyles);
  36401. }
  36402. return data;
  36403. }
  36404. /**
  36405. * Set the x-placement attribute before everything else because it could be used
  36406. * to add margins to the popper margins needs to be calculated to get the
  36407. * correct popper offsets.
  36408. * @method
  36409. * @memberof Popper.modifiers
  36410. * @param {HTMLElement} reference - The reference element used to position the popper
  36411. * @param {HTMLElement} popper - The HTML element used as popper
  36412. * @param {Object} options - Popper.js options
  36413. */
  36414. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  36415. // compute reference element offsets
  36416. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  36417. // compute auto placement, store placement inside the data object,
  36418. // modifiers will be able to edit `placement` if needed
  36419. // and refer to originalPlacement to know the original value
  36420. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  36421. popper.setAttribute('x-placement', placement);
  36422. // Apply `position` to popper before anything else because
  36423. // without the position applied we can't guarantee correct computations
  36424. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  36425. return options;
  36426. }
  36427. /**
  36428. * @function
  36429. * @memberof Popper.Utils
  36430. * @argument {Object} data - The data object generated by `update` method
  36431. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  36432. * @returns {Object} The popper's position offsets rounded
  36433. *
  36434. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  36435. * good as it can be within reason.
  36436. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  36437. *
  36438. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  36439. * as well on High DPI screens).
  36440. *
  36441. * Firefox prefers no rounding for positioning and does not have blurriness on
  36442. * high DPI screens.
  36443. *
  36444. * Only horizontal placement and left/right values need to be considered.
  36445. */
  36446. function getRoundedOffsets(data, shouldRound) {
  36447. var _data$offsets = data.offsets,
  36448. popper = _data$offsets.popper,
  36449. reference = _data$offsets.reference;
  36450. var round = Math.round,
  36451. floor = Math.floor;
  36452. var noRound = function noRound(v) {
  36453. return v;
  36454. };
  36455. var referenceWidth = round(reference.width);
  36456. var popperWidth = round(popper.width);
  36457. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  36458. var isVariation = data.placement.indexOf('-') !== -1;
  36459. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  36460. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  36461. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  36462. var verticalToInteger = !shouldRound ? noRound : round;
  36463. return {
  36464. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  36465. top: verticalToInteger(popper.top),
  36466. bottom: verticalToInteger(popper.bottom),
  36467. right: horizontalToInteger(popper.right)
  36468. };
  36469. }
  36470. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  36471. /**
  36472. * @function
  36473. * @memberof Modifiers
  36474. * @argument {Object} data - The data object generated by `update` method
  36475. * @argument {Object} options - Modifiers configuration and options
  36476. * @returns {Object} The data object, properly modified
  36477. */
  36478. function computeStyle(data, options) {
  36479. var x = options.x,
  36480. y = options.y;
  36481. var popper = data.offsets.popper;
  36482. // Remove this legacy support in Popper.js v2
  36483. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  36484. return modifier.name === 'applyStyle';
  36485. }).gpuAcceleration;
  36486. if (legacyGpuAccelerationOption !== undefined) {
  36487. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  36488. }
  36489. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  36490. var offsetParent = getOffsetParent(data.instance.popper);
  36491. var offsetParentRect = getBoundingClientRect(offsetParent);
  36492. // Styles
  36493. var styles = {
  36494. position: popper.position
  36495. };
  36496. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  36497. var sideA = x === 'bottom' ? 'top' : 'bottom';
  36498. var sideB = y === 'right' ? 'left' : 'right';
  36499. // if gpuAcceleration is set to `true` and transform is supported,
  36500. // we use `translate3d` to apply the position to the popper we
  36501. // automatically use the supported prefixed version if needed
  36502. var prefixedProperty = getSupportedPropertyName('transform');
  36503. // now, let's make a step back and look at this code closely (wtf?)
  36504. // If the content of the popper grows once it's been positioned, it
  36505. // may happen that the popper gets misplaced because of the new content
  36506. // overflowing its reference element
  36507. // To avoid this problem, we provide two options (x and y), which allow
  36508. // the consumer to define the offset origin.
  36509. // If we position a popper on top of a reference element, we can set
  36510. // `x` to `top` to make the popper grow towards its top instead of
  36511. // its bottom.
  36512. var left = void 0,
  36513. top = void 0;
  36514. if (sideA === 'bottom') {
  36515. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  36516. // and not the bottom of the html element
  36517. if (offsetParent.nodeName === 'HTML') {
  36518. top = -offsetParent.clientHeight + offsets.bottom;
  36519. } else {
  36520. top = -offsetParentRect.height + offsets.bottom;
  36521. }
  36522. } else {
  36523. top = offsets.top;
  36524. }
  36525. if (sideB === 'right') {
  36526. if (offsetParent.nodeName === 'HTML') {
  36527. left = -offsetParent.clientWidth + offsets.right;
  36528. } else {
  36529. left = -offsetParentRect.width + offsets.right;
  36530. }
  36531. } else {
  36532. left = offsets.left;
  36533. }
  36534. if (gpuAcceleration && prefixedProperty) {
  36535. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  36536. styles[sideA] = 0;
  36537. styles[sideB] = 0;
  36538. styles.willChange = 'transform';
  36539. } else {
  36540. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  36541. var invertTop = sideA === 'bottom' ? -1 : 1;
  36542. var invertLeft = sideB === 'right' ? -1 : 1;
  36543. styles[sideA] = top * invertTop;
  36544. styles[sideB] = left * invertLeft;
  36545. styles.willChange = sideA + ', ' + sideB;
  36546. }
  36547. // Attributes
  36548. var attributes = {
  36549. 'x-placement': data.placement
  36550. };
  36551. // Update `data` attributes, styles and arrowStyles
  36552. data.attributes = _extends({}, attributes, data.attributes);
  36553. data.styles = _extends({}, styles, data.styles);
  36554. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  36555. return data;
  36556. }
  36557. /**
  36558. * Helper used to know if the given modifier depends from another one.<br />
  36559. * It checks if the needed modifier is listed and enabled.
  36560. * @method
  36561. * @memberof Popper.Utils
  36562. * @param {Array} modifiers - list of modifiers
  36563. * @param {String} requestingName - name of requesting modifier
  36564. * @param {String} requestedName - name of requested modifier
  36565. * @returns {Boolean}
  36566. */
  36567. function isModifierRequired(modifiers, requestingName, requestedName) {
  36568. var requesting = find(modifiers, function (_ref) {
  36569. var name = _ref.name;
  36570. return name === requestingName;
  36571. });
  36572. var isRequired = !!requesting && modifiers.some(function (modifier) {
  36573. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  36574. });
  36575. if (!isRequired) {
  36576. var _requesting = '`' + requestingName + '`';
  36577. var requested = '`' + requestedName + '`';
  36578. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  36579. }
  36580. return isRequired;
  36581. }
  36582. /**
  36583. * @function
  36584. * @memberof Modifiers
  36585. * @argument {Object} data - The data object generated by update method
  36586. * @argument {Object} options - Modifiers configuration and options
  36587. * @returns {Object} The data object, properly modified
  36588. */
  36589. function arrow(data, options) {
  36590. var _data$offsets$arrow;
  36591. // arrow depends on keepTogether in order to work
  36592. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  36593. return data;
  36594. }
  36595. var arrowElement = options.element;
  36596. // if arrowElement is a string, suppose it's a CSS selector
  36597. if (typeof arrowElement === 'string') {
  36598. arrowElement = data.instance.popper.querySelector(arrowElement);
  36599. // if arrowElement is not found, don't run the modifier
  36600. if (!arrowElement) {
  36601. return data;
  36602. }
  36603. } else {
  36604. // if the arrowElement isn't a query selector we must check that the
  36605. // provided DOM node is child of its popper node
  36606. if (!data.instance.popper.contains(arrowElement)) {
  36607. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  36608. return data;
  36609. }
  36610. }
  36611. var placement = data.placement.split('-')[0];
  36612. var _data$offsets = data.offsets,
  36613. popper = _data$offsets.popper,
  36614. reference = _data$offsets.reference;
  36615. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  36616. var len = isVertical ? 'height' : 'width';
  36617. var sideCapitalized = isVertical ? 'Top' : 'Left';
  36618. var side = sideCapitalized.toLowerCase();
  36619. var altSide = isVertical ? 'left' : 'top';
  36620. var opSide = isVertical ? 'bottom' : 'right';
  36621. var arrowElementSize = getOuterSizes(arrowElement)[len];
  36622. //
  36623. // extends keepTogether behavior making sure the popper and its
  36624. // reference have enough pixels in conjunction
  36625. //
  36626. // top/left side
  36627. if (reference[opSide] - arrowElementSize < popper[side]) {
  36628. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  36629. }
  36630. // bottom/right side
  36631. if (reference[side] + arrowElementSize > popper[opSide]) {
  36632. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  36633. }
  36634. data.offsets.popper = getClientRect(data.offsets.popper);
  36635. // compute center of the popper
  36636. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  36637. // Compute the sideValue using the updated popper offsets
  36638. // take popper margin in account because we don't have this info available
  36639. var css = getStyleComputedProperty(data.instance.popper);
  36640. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  36641. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  36642. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  36643. // prevent arrowElement from being placed not contiguously to its popper
  36644. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  36645. data.arrowElement = arrowElement;
  36646. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  36647. return data;
  36648. }
  36649. /**
  36650. * Get the opposite placement variation of the given one
  36651. * @method
  36652. * @memberof Popper.Utils
  36653. * @argument {String} placement variation
  36654. * @returns {String} flipped placement variation
  36655. */
  36656. function getOppositeVariation(variation) {
  36657. if (variation === 'end') {
  36658. return 'start';
  36659. } else if (variation === 'start') {
  36660. return 'end';
  36661. }
  36662. return variation;
  36663. }
  36664. /**
  36665. * List of accepted placements to use as values of the `placement` option.<br />
  36666. * Valid placements are:
  36667. * - `auto`
  36668. * - `top`
  36669. * - `right`
  36670. * - `bottom`
  36671. * - `left`
  36672. *
  36673. * Each placement can have a variation from this list:
  36674. * - `-start`
  36675. * - `-end`
  36676. *
  36677. * Variations are interpreted easily if you think of them as the left to right
  36678. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  36679. * is right.<br />
  36680. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  36681. *
  36682. * Some valid examples are:
  36683. * - `top-end` (on top of reference, right aligned)
  36684. * - `right-start` (on right of reference, top aligned)
  36685. * - `bottom` (on bottom, centered)
  36686. * - `auto-end` (on the side with more space available, alignment depends by placement)
  36687. *
  36688. * @static
  36689. * @type {Array}
  36690. * @enum {String}
  36691. * @readonly
  36692. * @method placements
  36693. * @memberof Popper
  36694. */
  36695. 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'];
  36696. // Get rid of `auto` `auto-start` and `auto-end`
  36697. var validPlacements = placements.slice(3);
  36698. /**
  36699. * Given an initial placement, returns all the subsequent placements
  36700. * clockwise (or counter-clockwise).
  36701. *
  36702. * @method
  36703. * @memberof Popper.Utils
  36704. * @argument {String} placement - A valid placement (it accepts variations)
  36705. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  36706. * @returns {Array} placements including their variations
  36707. */
  36708. function clockwise(placement) {
  36709. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  36710. var index = validPlacements.indexOf(placement);
  36711. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  36712. return counter ? arr.reverse() : arr;
  36713. }
  36714. var BEHAVIORS = {
  36715. FLIP: 'flip',
  36716. CLOCKWISE: 'clockwise',
  36717. COUNTERCLOCKWISE: 'counterclockwise'
  36718. };
  36719. /**
  36720. * @function
  36721. * @memberof Modifiers
  36722. * @argument {Object} data - The data object generated by update method
  36723. * @argument {Object} options - Modifiers configuration and options
  36724. * @returns {Object} The data object, properly modified
  36725. */
  36726. function flip(data, options) {
  36727. // if `inner` modifier is enabled, we can't use the `flip` modifier
  36728. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  36729. return data;
  36730. }
  36731. if (data.flipped && data.placement === data.originalPlacement) {
  36732. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  36733. return data;
  36734. }
  36735. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  36736. var placement = data.placement.split('-')[0];
  36737. var placementOpposite = getOppositePlacement(placement);
  36738. var variation = data.placement.split('-')[1] || '';
  36739. var flipOrder = [];
  36740. switch (options.behavior) {
  36741. case BEHAVIORS.FLIP:
  36742. flipOrder = [placement, placementOpposite];
  36743. break;
  36744. case BEHAVIORS.CLOCKWISE:
  36745. flipOrder = clockwise(placement);
  36746. break;
  36747. case BEHAVIORS.COUNTERCLOCKWISE:
  36748. flipOrder = clockwise(placement, true);
  36749. break;
  36750. default:
  36751. flipOrder = options.behavior;
  36752. }
  36753. flipOrder.forEach(function (step, index) {
  36754. if (placement !== step || flipOrder.length === index + 1) {
  36755. return data;
  36756. }
  36757. placement = data.placement.split('-')[0];
  36758. placementOpposite = getOppositePlacement(placement);
  36759. var popperOffsets = data.offsets.popper;
  36760. var refOffsets = data.offsets.reference;
  36761. // using floor because the reference offsets may contain decimals we are not going to consider here
  36762. var floor = Math.floor;
  36763. 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);
  36764. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  36765. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  36766. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  36767. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  36768. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  36769. // flip the variation if required
  36770. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36771. // flips variation if reference element overflows boundaries
  36772. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  36773. // flips variation if popper content overflows boundaries
  36774. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  36775. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  36776. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  36777. // this boolean to detect any flip loop
  36778. data.flipped = true;
  36779. if (overlapsRef || overflowsBoundaries) {
  36780. placement = flipOrder[index + 1];
  36781. }
  36782. if (flippedVariation) {
  36783. variation = getOppositeVariation(variation);
  36784. }
  36785. data.placement = placement + (variation ? '-' + variation : '');
  36786. // this object contains `position`, we want to preserve it along with
  36787. // any additional property we may add in the future
  36788. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  36789. data = runModifiers(data.instance.modifiers, data, 'flip');
  36790. }
  36791. });
  36792. return data;
  36793. }
  36794. /**
  36795. * @function
  36796. * @memberof Modifiers
  36797. * @argument {Object} data - The data object generated by update method
  36798. * @argument {Object} options - Modifiers configuration and options
  36799. * @returns {Object} The data object, properly modified
  36800. */
  36801. function keepTogether(data) {
  36802. var _data$offsets = data.offsets,
  36803. popper = _data$offsets.popper,
  36804. reference = _data$offsets.reference;
  36805. var placement = data.placement.split('-')[0];
  36806. var floor = Math.floor;
  36807. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36808. var side = isVertical ? 'right' : 'bottom';
  36809. var opSide = isVertical ? 'left' : 'top';
  36810. var measurement = isVertical ? 'width' : 'height';
  36811. if (popper[side] < floor(reference[opSide])) {
  36812. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  36813. }
  36814. if (popper[opSide] > floor(reference[side])) {
  36815. data.offsets.popper[opSide] = floor(reference[side]);
  36816. }
  36817. return data;
  36818. }
  36819. /**
  36820. * Converts a string containing value + unit into a px value number
  36821. * @function
  36822. * @memberof {modifiers~offset}
  36823. * @private
  36824. * @argument {String} str - Value + unit string
  36825. * @argument {String} measurement - `height` or `width`
  36826. * @argument {Object} popperOffsets
  36827. * @argument {Object} referenceOffsets
  36828. * @returns {Number|String}
  36829. * Value in pixels, or original string if no values were extracted
  36830. */
  36831. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  36832. // separate value from unit
  36833. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  36834. var value = +split[1];
  36835. var unit = split[2];
  36836. // If it's not a number it's an operator, I guess
  36837. if (!value) {
  36838. return str;
  36839. }
  36840. if (unit.indexOf('%') === 0) {
  36841. var element = void 0;
  36842. switch (unit) {
  36843. case '%p':
  36844. element = popperOffsets;
  36845. break;
  36846. case '%':
  36847. case '%r':
  36848. default:
  36849. element = referenceOffsets;
  36850. }
  36851. var rect = getClientRect(element);
  36852. return rect[measurement] / 100 * value;
  36853. } else if (unit === 'vh' || unit === 'vw') {
  36854. // if is a vh or vw, we calculate the size based on the viewport
  36855. var size = void 0;
  36856. if (unit === 'vh') {
  36857. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  36858. } else {
  36859. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  36860. }
  36861. return size / 100 * value;
  36862. } else {
  36863. // if is an explicit pixel unit, we get rid of the unit and keep the value
  36864. // if is an implicit unit, it's px, and we return just the value
  36865. return value;
  36866. }
  36867. }
  36868. /**
  36869. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  36870. * @function
  36871. * @memberof {modifiers~offset}
  36872. * @private
  36873. * @argument {String} offset
  36874. * @argument {Object} popperOffsets
  36875. * @argument {Object} referenceOffsets
  36876. * @argument {String} basePlacement
  36877. * @returns {Array} a two cells array with x and y offsets in numbers
  36878. */
  36879. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  36880. var offsets = [0, 0];
  36881. // Use height if placement is left or right and index is 0 otherwise use width
  36882. // in this way the first offset will use an axis and the second one
  36883. // will use the other one
  36884. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  36885. // Split the offset string to obtain a list of values and operands
  36886. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  36887. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  36888. return frag.trim();
  36889. });
  36890. // Detect if the offset string contains a pair of values or a single one
  36891. // they could be separated by comma or space
  36892. var divider = fragments.indexOf(find(fragments, function (frag) {
  36893. return frag.search(/,|\s/) !== -1;
  36894. }));
  36895. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  36896. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  36897. }
  36898. // If divider is found, we divide the list of values and operands to divide
  36899. // them by ofset X and Y.
  36900. var splitRegex = /\s*,\s*|\s+/;
  36901. 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];
  36902. // Convert the values with units to absolute pixels to allow our computations
  36903. ops = ops.map(function (op, index) {
  36904. // Most of the units rely on the orientation of the popper
  36905. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  36906. var mergeWithPrevious = false;
  36907. return op
  36908. // This aggregates any `+` or `-` sign that aren't considered operators
  36909. // e.g.: 10 + +5 => [10, +, +5]
  36910. .reduce(function (a, b) {
  36911. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  36912. a[a.length - 1] = b;
  36913. mergeWithPrevious = true;
  36914. return a;
  36915. } else if (mergeWithPrevious) {
  36916. a[a.length - 1] += b;
  36917. mergeWithPrevious = false;
  36918. return a;
  36919. } else {
  36920. return a.concat(b);
  36921. }
  36922. }, [])
  36923. // Here we convert the string values into number values (in px)
  36924. .map(function (str) {
  36925. return toValue(str, measurement, popperOffsets, referenceOffsets);
  36926. });
  36927. });
  36928. // Loop trough the offsets arrays and execute the operations
  36929. ops.forEach(function (op, index) {
  36930. op.forEach(function (frag, index2) {
  36931. if (isNumeric(frag)) {
  36932. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36933. }
  36934. });
  36935. });
  36936. return offsets;
  36937. }
  36938. /**
  36939. * @function
  36940. * @memberof Modifiers
  36941. * @argument {Object} data - The data object generated by update method
  36942. * @argument {Object} options - Modifiers configuration and options
  36943. * @argument {Number|String} options.offset=0
  36944. * The offset value as described in the modifier description
  36945. * @returns {Object} The data object, properly modified
  36946. */
  36947. function offset(data, _ref) {
  36948. var offset = _ref.offset;
  36949. var placement = data.placement,
  36950. _data$offsets = data.offsets,
  36951. popper = _data$offsets.popper,
  36952. reference = _data$offsets.reference;
  36953. var basePlacement = placement.split('-')[0];
  36954. var offsets = void 0;
  36955. if (isNumeric(+offset)) {
  36956. offsets = [+offset, 0];
  36957. } else {
  36958. offsets = parseOffset(offset, popper, reference, basePlacement);
  36959. }
  36960. if (basePlacement === 'left') {
  36961. popper.top += offsets[0];
  36962. popper.left -= offsets[1];
  36963. } else if (basePlacement === 'right') {
  36964. popper.top += offsets[0];
  36965. popper.left += offsets[1];
  36966. } else if (basePlacement === 'top') {
  36967. popper.left += offsets[0];
  36968. popper.top -= offsets[1];
  36969. } else if (basePlacement === 'bottom') {
  36970. popper.left += offsets[0];
  36971. popper.top += offsets[1];
  36972. }
  36973. data.popper = popper;
  36974. return data;
  36975. }
  36976. /**
  36977. * @function
  36978. * @memberof Modifiers
  36979. * @argument {Object} data - The data object generated by `update` method
  36980. * @argument {Object} options - Modifiers configuration and options
  36981. * @returns {Object} The data object, properly modified
  36982. */
  36983. function preventOverflow(data, options) {
  36984. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36985. // If offsetParent is the reference element, we really want to
  36986. // go one step up and use the next offsetParent as reference to
  36987. // avoid to make this modifier completely useless and look like broken
  36988. if (data.instance.reference === boundariesElement) {
  36989. boundariesElement = getOffsetParent(boundariesElement);
  36990. }
  36991. // NOTE: DOM access here
  36992. // resets the popper's position so that the document size can be calculated excluding
  36993. // the size of the popper element itself
  36994. var transformProp = getSupportedPropertyName('transform');
  36995. var popperStyles = data.instance.popper.style; // assignment to help minification
  36996. var top = popperStyles.top,
  36997. left = popperStyles.left,
  36998. transform = popperStyles[transformProp];
  36999. popperStyles.top = '';
  37000. popperStyles.left = '';
  37001. popperStyles[transformProp] = '';
  37002. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  37003. // NOTE: DOM access here
  37004. // restores the original style properties after the offsets have been computed
  37005. popperStyles.top = top;
  37006. popperStyles.left = left;
  37007. popperStyles[transformProp] = transform;
  37008. options.boundaries = boundaries;
  37009. var order = options.priority;
  37010. var popper = data.offsets.popper;
  37011. var check = {
  37012. primary: function primary(placement) {
  37013. var value = popper[placement];
  37014. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  37015. value = Math.max(popper[placement], boundaries[placement]);
  37016. }
  37017. return defineProperty({}, placement, value);
  37018. },
  37019. secondary: function secondary(placement) {
  37020. var mainSide = placement === 'right' ? 'left' : 'top';
  37021. var value = popper[mainSide];
  37022. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  37023. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  37024. }
  37025. return defineProperty({}, mainSide, value);
  37026. }
  37027. };
  37028. order.forEach(function (placement) {
  37029. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  37030. popper = _extends({}, popper, check[side](placement));
  37031. });
  37032. data.offsets.popper = popper;
  37033. return data;
  37034. }
  37035. /**
  37036. * @function
  37037. * @memberof Modifiers
  37038. * @argument {Object} data - The data object generated by `update` method
  37039. * @argument {Object} options - Modifiers configuration and options
  37040. * @returns {Object} The data object, properly modified
  37041. */
  37042. function shift(data) {
  37043. var placement = data.placement;
  37044. var basePlacement = placement.split('-')[0];
  37045. var shiftvariation = placement.split('-')[1];
  37046. // if shift shiftvariation is specified, run the modifier
  37047. if (shiftvariation) {
  37048. var _data$offsets = data.offsets,
  37049. reference = _data$offsets.reference,
  37050. popper = _data$offsets.popper;
  37051. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  37052. var side = isVertical ? 'left' : 'top';
  37053. var measurement = isVertical ? 'width' : 'height';
  37054. var shiftOffsets = {
  37055. start: defineProperty({}, side, reference[side]),
  37056. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  37057. };
  37058. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  37059. }
  37060. return data;
  37061. }
  37062. /**
  37063. * @function
  37064. * @memberof Modifiers
  37065. * @argument {Object} data - The data object generated by update method
  37066. * @argument {Object} options - Modifiers configuration and options
  37067. * @returns {Object} The data object, properly modified
  37068. */
  37069. function hide(data) {
  37070. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  37071. return data;
  37072. }
  37073. var refRect = data.offsets.reference;
  37074. var bound = find(data.instance.modifiers, function (modifier) {
  37075. return modifier.name === 'preventOverflow';
  37076. }).boundaries;
  37077. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  37078. // Avoid unnecessary DOM access if visibility hasn't changed
  37079. if (data.hide === true) {
  37080. return data;
  37081. }
  37082. data.hide = true;
  37083. data.attributes['x-out-of-boundaries'] = '';
  37084. } else {
  37085. // Avoid unnecessary DOM access if visibility hasn't changed
  37086. if (data.hide === false) {
  37087. return data;
  37088. }
  37089. data.hide = false;
  37090. data.attributes['x-out-of-boundaries'] = false;
  37091. }
  37092. return data;
  37093. }
  37094. /**
  37095. * @function
  37096. * @memberof Modifiers
  37097. * @argument {Object} data - The data object generated by `update` method
  37098. * @argument {Object} options - Modifiers configuration and options
  37099. * @returns {Object} The data object, properly modified
  37100. */
  37101. function inner(data) {
  37102. var placement = data.placement;
  37103. var basePlacement = placement.split('-')[0];
  37104. var _data$offsets = data.offsets,
  37105. popper = _data$offsets.popper,
  37106. reference = _data$offsets.reference;
  37107. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  37108. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  37109. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  37110. data.placement = getOppositePlacement(placement);
  37111. data.offsets.popper = getClientRect(popper);
  37112. return data;
  37113. }
  37114. /**
  37115. * Modifier function, each modifier can have a function of this type assigned
  37116. * to its `fn` property.<br />
  37117. * These functions will be called on each update, this means that you must
  37118. * make sure they are performant enough to avoid performance bottlenecks.
  37119. *
  37120. * @function ModifierFn
  37121. * @argument {dataObject} data - The data object generated by `update` method
  37122. * @argument {Object} options - Modifiers configuration and options
  37123. * @returns {dataObject} The data object, properly modified
  37124. */
  37125. /**
  37126. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  37127. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  37128. * needed by the library.
  37129. *
  37130. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  37131. * All the other properties are configurations that could be tweaked.
  37132. * @namespace modifiers
  37133. */
  37134. var modifiers = {
  37135. /**
  37136. * Modifier used to shift the popper on the start or end of its reference
  37137. * element.<br />
  37138. * It will read the variation of the `placement` property.<br />
  37139. * It can be one either `-end` or `-start`.
  37140. * @memberof modifiers
  37141. * @inner
  37142. */
  37143. shift: {
  37144. /** @prop {number} order=100 - Index used to define the order of execution */
  37145. order: 100,
  37146. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37147. enabled: true,
  37148. /** @prop {ModifierFn} */
  37149. fn: shift
  37150. },
  37151. /**
  37152. * The `offset` modifier can shift your popper on both its axis.
  37153. *
  37154. * It accepts the following units:
  37155. * - `px` or unit-less, interpreted as pixels
  37156. * - `%` or `%r`, percentage relative to the length of the reference element
  37157. * - `%p`, percentage relative to the length of the popper element
  37158. * - `vw`, CSS viewport width unit
  37159. * - `vh`, CSS viewport height unit
  37160. *
  37161. * For length is intended the main axis relative to the placement of the popper.<br />
  37162. * This means that if the placement is `top` or `bottom`, the length will be the
  37163. * `width`. In case of `left` or `right`, it will be the `height`.
  37164. *
  37165. * You can provide a single value (as `Number` or `String`), or a pair of values
  37166. * as `String` divided by a comma or one (or more) white spaces.<br />
  37167. * The latter is a deprecated method because it leads to confusion and will be
  37168. * removed in v2.<br />
  37169. * Additionally, it accepts additions and subtractions between different units.
  37170. * Note that multiplications and divisions aren't supported.
  37171. *
  37172. * Valid examples are:
  37173. * ```
  37174. * 10
  37175. * '10%'
  37176. * '10, 10'
  37177. * '10%, 10'
  37178. * '10 + 10%'
  37179. * '10 - 5vh + 3%'
  37180. * '-10px + 5vh, 5px - 6%'
  37181. * ```
  37182. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  37183. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  37184. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  37185. *
  37186. * @memberof modifiers
  37187. * @inner
  37188. */
  37189. offset: {
  37190. /** @prop {number} order=200 - Index used to define the order of execution */
  37191. order: 200,
  37192. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37193. enabled: true,
  37194. /** @prop {ModifierFn} */
  37195. fn: offset,
  37196. /** @prop {Number|String} offset=0
  37197. * The offset value as described in the modifier description
  37198. */
  37199. offset: 0
  37200. },
  37201. /**
  37202. * Modifier used to prevent the popper from being positioned outside the boundary.
  37203. *
  37204. * A scenario exists where the reference itself is not within the boundaries.<br />
  37205. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  37206. * In this case we need to decide whether the popper should either:
  37207. *
  37208. * - detach from the reference and remain "trapped" in the boundaries, or
  37209. * - if it should ignore the boundary and "escape with its reference"
  37210. *
  37211. * When `escapeWithReference` is set to`true` and reference is completely
  37212. * outside its boundaries, the popper will overflow (or completely leave)
  37213. * the boundaries in order to remain attached to the edge of the reference.
  37214. *
  37215. * @memberof modifiers
  37216. * @inner
  37217. */
  37218. preventOverflow: {
  37219. /** @prop {number} order=300 - Index used to define the order of execution */
  37220. order: 300,
  37221. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37222. enabled: true,
  37223. /** @prop {ModifierFn} */
  37224. fn: preventOverflow,
  37225. /**
  37226. * @prop {Array} [priority=['left','right','top','bottom']]
  37227. * Popper will try to prevent overflow following these priorities by default,
  37228. * then, it could overflow on the left and on top of the `boundariesElement`
  37229. */
  37230. priority: ['left', 'right', 'top', 'bottom'],
  37231. /**
  37232. * @prop {number} padding=5
  37233. * Amount of pixel used to define a minimum distance between the boundaries
  37234. * and the popper. This makes sure the popper always has a little padding
  37235. * between the edges of its container
  37236. */
  37237. padding: 5,
  37238. /**
  37239. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  37240. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  37241. * `viewport` or any DOM element.
  37242. */
  37243. boundariesElement: 'scrollParent'
  37244. },
  37245. /**
  37246. * Modifier used to make sure the reference and its popper stay near each other
  37247. * without leaving any gap between the two. Especially useful when the arrow is
  37248. * enabled and you want to ensure that it points to its reference element.
  37249. * It cares only about the first axis. You can still have poppers with margin
  37250. * between the popper and its reference element.
  37251. * @memberof modifiers
  37252. * @inner
  37253. */
  37254. keepTogether: {
  37255. /** @prop {number} order=400 - Index used to define the order of execution */
  37256. order: 400,
  37257. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37258. enabled: true,
  37259. /** @prop {ModifierFn} */
  37260. fn: keepTogether
  37261. },
  37262. /**
  37263. * This modifier is used to move the `arrowElement` of the popper to make
  37264. * sure it is positioned between the reference element and its popper element.
  37265. * It will read the outer size of the `arrowElement` node to detect how many
  37266. * pixels of conjunction are needed.
  37267. *
  37268. * It has no effect if no `arrowElement` is provided.
  37269. * @memberof modifiers
  37270. * @inner
  37271. */
  37272. arrow: {
  37273. /** @prop {number} order=500 - Index used to define the order of execution */
  37274. order: 500,
  37275. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37276. enabled: true,
  37277. /** @prop {ModifierFn} */
  37278. fn: arrow,
  37279. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  37280. element: '[x-arrow]'
  37281. },
  37282. /**
  37283. * Modifier used to flip the popper's placement when it starts to overlap its
  37284. * reference element.
  37285. *
  37286. * Requires the `preventOverflow` modifier before it in order to work.
  37287. *
  37288. * **NOTE:** this modifier will interrupt the current update cycle and will
  37289. * restart it if it detects the need to flip the placement.
  37290. * @memberof modifiers
  37291. * @inner
  37292. */
  37293. flip: {
  37294. /** @prop {number} order=600 - Index used to define the order of execution */
  37295. order: 600,
  37296. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37297. enabled: true,
  37298. /** @prop {ModifierFn} */
  37299. fn: flip,
  37300. /**
  37301. * @prop {String|Array} behavior='flip'
  37302. * The behavior used to change the popper's placement. It can be one of
  37303. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  37304. * placements (with optional variations)
  37305. */
  37306. behavior: 'flip',
  37307. /**
  37308. * @prop {number} padding=5
  37309. * The popper will flip if it hits the edges of the `boundariesElement`
  37310. */
  37311. padding: 5,
  37312. /**
  37313. * @prop {String|HTMLElement} boundariesElement='viewport'
  37314. * The element which will define the boundaries of the popper position.
  37315. * The popper will never be placed outside of the defined boundaries
  37316. * (except if `keepTogether` is enabled)
  37317. */
  37318. boundariesElement: 'viewport',
  37319. /**
  37320. * @prop {Boolean} flipVariations=false
  37321. * The popper will switch placement variation between `-start` and `-end` when
  37322. * the reference element overlaps its boundaries.
  37323. *
  37324. * The original placement should have a set variation.
  37325. */
  37326. flipVariations: false,
  37327. /**
  37328. * @prop {Boolean} flipVariationsByContent=false
  37329. * The popper will switch placement variation between `-start` and `-end` when
  37330. * the popper element overlaps its reference boundaries.
  37331. *
  37332. * The original placement should have a set variation.
  37333. */
  37334. flipVariationsByContent: false
  37335. },
  37336. /**
  37337. * Modifier used to make the popper flow toward the inner of the reference element.
  37338. * By default, when this modifier is disabled, the popper will be placed outside
  37339. * the reference element.
  37340. * @memberof modifiers
  37341. * @inner
  37342. */
  37343. inner: {
  37344. /** @prop {number} order=700 - Index used to define the order of execution */
  37345. order: 700,
  37346. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  37347. enabled: false,
  37348. /** @prop {ModifierFn} */
  37349. fn: inner
  37350. },
  37351. /**
  37352. * Modifier used to hide the popper when its reference element is outside of the
  37353. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  37354. * be used to hide with a CSS selector the popper when its reference is
  37355. * out of boundaries.
  37356. *
  37357. * Requires the `preventOverflow` modifier before it in order to work.
  37358. * @memberof modifiers
  37359. * @inner
  37360. */
  37361. hide: {
  37362. /** @prop {number} order=800 - Index used to define the order of execution */
  37363. order: 800,
  37364. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37365. enabled: true,
  37366. /** @prop {ModifierFn} */
  37367. fn: hide
  37368. },
  37369. /**
  37370. * Computes the style that will be applied to the popper element to gets
  37371. * properly positioned.
  37372. *
  37373. * Note that this modifier will not touch the DOM, it just prepares the styles
  37374. * so that `applyStyle` modifier can apply it. This separation is useful
  37375. * in case you need to replace `applyStyle` with a custom implementation.
  37376. *
  37377. * This modifier has `850` as `order` value to maintain backward compatibility
  37378. * with previous versions of Popper.js. Expect the modifiers ordering method
  37379. * to change in future major versions of the library.
  37380. *
  37381. * @memberof modifiers
  37382. * @inner
  37383. */
  37384. computeStyle: {
  37385. /** @prop {number} order=850 - Index used to define the order of execution */
  37386. order: 850,
  37387. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37388. enabled: true,
  37389. /** @prop {ModifierFn} */
  37390. fn: computeStyle,
  37391. /**
  37392. * @prop {Boolean} gpuAcceleration=true
  37393. * If true, it uses the CSS 3D transformation to position the popper.
  37394. * Otherwise, it will use the `top` and `left` properties
  37395. */
  37396. gpuAcceleration: true,
  37397. /**
  37398. * @prop {string} [x='bottom']
  37399. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  37400. * Change this if your popper should grow in a direction different from `bottom`
  37401. */
  37402. x: 'bottom',
  37403. /**
  37404. * @prop {string} [x='left']
  37405. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  37406. * Change this if your popper should grow in a direction different from `right`
  37407. */
  37408. y: 'right'
  37409. },
  37410. /**
  37411. * Applies the computed styles to the popper element.
  37412. *
  37413. * All the DOM manipulations are limited to this modifier. This is useful in case
  37414. * you want to integrate Popper.js inside a framework or view library and you
  37415. * want to delegate all the DOM manipulations to it.
  37416. *
  37417. * Note that if you disable this modifier, you must make sure the popper element
  37418. * has its position set to `absolute` before Popper.js can do its work!
  37419. *
  37420. * Just disable this modifier and define your own to achieve the desired effect.
  37421. *
  37422. * @memberof modifiers
  37423. * @inner
  37424. */
  37425. applyStyle: {
  37426. /** @prop {number} order=900 - Index used to define the order of execution */
  37427. order: 900,
  37428. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37429. enabled: true,
  37430. /** @prop {ModifierFn} */
  37431. fn: applyStyle,
  37432. /** @prop {Function} */
  37433. onLoad: applyStyleOnLoad,
  37434. /**
  37435. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  37436. * @prop {Boolean} gpuAcceleration=true
  37437. * If true, it uses the CSS 3D transformation to position the popper.
  37438. * Otherwise, it will use the `top` and `left` properties
  37439. */
  37440. gpuAcceleration: undefined
  37441. }
  37442. };
  37443. /**
  37444. * The `dataObject` is an object containing all the information used by Popper.js.
  37445. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  37446. * @name dataObject
  37447. * @property {Object} data.instance The Popper.js instance
  37448. * @property {String} data.placement Placement applied to popper
  37449. * @property {String} data.originalPlacement Placement originally defined on init
  37450. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  37451. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  37452. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  37453. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37454. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37455. * @property {Object} data.boundaries Offsets of the popper boundaries
  37456. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  37457. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  37458. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  37459. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  37460. */
  37461. /**
  37462. * Default options provided to Popper.js constructor.<br />
  37463. * These can be overridden using the `options` argument of Popper.js.<br />
  37464. * To override an option, simply pass an object with the same
  37465. * structure of the `options` object, as the 3rd argument. For example:
  37466. * ```
  37467. * new Popper(ref, pop, {
  37468. * modifiers: {
  37469. * preventOverflow: { enabled: false }
  37470. * }
  37471. * })
  37472. * ```
  37473. * @type {Object}
  37474. * @static
  37475. * @memberof Popper
  37476. */
  37477. var Defaults = {
  37478. /**
  37479. * Popper's placement.
  37480. * @prop {Popper.placements} placement='bottom'
  37481. */
  37482. placement: 'bottom',
  37483. /**
  37484. * Set this to true if you want popper to position it self in 'fixed' mode
  37485. * @prop {Boolean} positionFixed=false
  37486. */
  37487. positionFixed: false,
  37488. /**
  37489. * Whether events (resize, scroll) are initially enabled.
  37490. * @prop {Boolean} eventsEnabled=true
  37491. */
  37492. eventsEnabled: true,
  37493. /**
  37494. * Set to true if you want to automatically remove the popper when
  37495. * you call the `destroy` method.
  37496. * @prop {Boolean} removeOnDestroy=false
  37497. */
  37498. removeOnDestroy: false,
  37499. /**
  37500. * Callback called when the popper is created.<br />
  37501. * By default, it is set to no-op.<br />
  37502. * Access Popper.js instance with `data.instance`.
  37503. * @prop {onCreate}
  37504. */
  37505. onCreate: function onCreate() {},
  37506. /**
  37507. * Callback called when the popper is updated. This callback is not called
  37508. * on the initialization/creation of the popper, but only on subsequent
  37509. * updates.<br />
  37510. * By default, it is set to no-op.<br />
  37511. * Access Popper.js instance with `data.instance`.
  37512. * @prop {onUpdate}
  37513. */
  37514. onUpdate: function onUpdate() {},
  37515. /**
  37516. * List of modifiers used to modify the offsets before they are applied to the popper.
  37517. * They provide most of the functionalities of Popper.js.
  37518. * @prop {modifiers}
  37519. */
  37520. modifiers: modifiers
  37521. };
  37522. /**
  37523. * @callback onCreate
  37524. * @param {dataObject} data
  37525. */
  37526. /**
  37527. * @callback onUpdate
  37528. * @param {dataObject} data
  37529. */
  37530. // Utils
  37531. // Methods
  37532. var Popper = function () {
  37533. /**
  37534. * Creates a new Popper.js instance.
  37535. * @class Popper
  37536. * @param {Element|referenceObject} reference - The reference element used to position the popper
  37537. * @param {Element} popper - The HTML / XML element used as the popper
  37538. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  37539. * @return {Object} instance - The generated Popper.js instance
  37540. */
  37541. function Popper(reference, popper) {
  37542. var _this = this;
  37543. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  37544. classCallCheck(this, Popper);
  37545. this.scheduleUpdate = function () {
  37546. return requestAnimationFrame(_this.update);
  37547. };
  37548. // make update() debounced, so that it only runs at most once-per-tick
  37549. this.update = debounce(this.update.bind(this));
  37550. // with {} we create a new object with the options inside it
  37551. this.options = _extends({}, Popper.Defaults, options);
  37552. // init state
  37553. this.state = {
  37554. isDestroyed: false,
  37555. isCreated: false,
  37556. scrollParents: []
  37557. };
  37558. // get reference and popper elements (allow jQuery wrappers)
  37559. this.reference = reference && reference.jquery ? reference[0] : reference;
  37560. this.popper = popper && popper.jquery ? popper[0] : popper;
  37561. // Deep merge modifiers options
  37562. this.options.modifiers = {};
  37563. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  37564. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  37565. });
  37566. // Refactoring modifiers' list (Object => Array)
  37567. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  37568. return _extends({
  37569. name: name
  37570. }, _this.options.modifiers[name]);
  37571. })
  37572. // sort the modifiers by order
  37573. .sort(function (a, b) {
  37574. return a.order - b.order;
  37575. });
  37576. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  37577. // such code is executed in the same order of its modifier
  37578. // they could add new properties to their options configuration
  37579. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  37580. this.modifiers.forEach(function (modifierOptions) {
  37581. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  37582. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  37583. }
  37584. });
  37585. // fire the first update to position the popper in the right place
  37586. this.update();
  37587. var eventsEnabled = this.options.eventsEnabled;
  37588. if (eventsEnabled) {
  37589. // setup event listeners, they will take care of update the position in specific situations
  37590. this.enableEventListeners();
  37591. }
  37592. this.state.eventsEnabled = eventsEnabled;
  37593. }
  37594. // We can't use class properties because they don't get listed in the
  37595. // class prototype and break stuff like Sinon stubs
  37596. createClass(Popper, [{
  37597. key: 'update',
  37598. value: function update$$1() {
  37599. return update.call(this);
  37600. }
  37601. }, {
  37602. key: 'destroy',
  37603. value: function destroy$$1() {
  37604. return destroy.call(this);
  37605. }
  37606. }, {
  37607. key: 'enableEventListeners',
  37608. value: function enableEventListeners$$1() {
  37609. return enableEventListeners.call(this);
  37610. }
  37611. }, {
  37612. key: 'disableEventListeners',
  37613. value: function disableEventListeners$$1() {
  37614. return disableEventListeners.call(this);
  37615. }
  37616. /**
  37617. * Schedules an update. It will run on the next UI update available.
  37618. * @method scheduleUpdate
  37619. * @memberof Popper
  37620. */
  37621. /**
  37622. * Collection of utilities useful when writing custom modifiers.
  37623. * Starting from version 1.7, this method is available only if you
  37624. * include `popper-utils.js` before `popper.js`.
  37625. *
  37626. * **DEPRECATION**: This way to access PopperUtils is deprecated
  37627. * and will be removed in v2! Use the PopperUtils module directly instead.
  37628. * Due to the high instability of the methods contained in Utils, we can't
  37629. * guarantee them to follow semver. Use them at your own risk!
  37630. * @static
  37631. * @private
  37632. * @type {Object}
  37633. * @deprecated since version 1.8
  37634. * @member Utils
  37635. * @memberof Popper
  37636. */
  37637. }]);
  37638. return Popper;
  37639. }();
  37640. /**
  37641. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  37642. * and lets you use it as replacement of a real DOM node.<br />
  37643. * You can use this method to position a popper relatively to a set of coordinates
  37644. * in case you don't have a DOM node to use as reference.
  37645. *
  37646. * ```
  37647. * new Popper(referenceObject, popperNode);
  37648. * ```
  37649. *
  37650. * NB: This feature isn't supported in Internet Explorer 10.
  37651. * @name referenceObject
  37652. * @property {Function} data.getBoundingClientRect
  37653. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  37654. * @property {number} data.clientWidth
  37655. * An ES6 getter that will return the width of the virtual reference element.
  37656. * @property {number} data.clientHeight
  37657. * An ES6 getter that will return the height of the virtual reference element.
  37658. */
  37659. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  37660. Popper.placements = placements;
  37661. Popper.Defaults = Defaults;
  37662. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  37663. //# sourceMappingURL=popper.js.map
  37664. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  37665. /***/ }),
  37666. /***/ "./node_modules/process/browser.js":
  37667. /*!*****************************************!*\
  37668. !*** ./node_modules/process/browser.js ***!
  37669. \*****************************************/
  37670. /*! no static exports found */
  37671. /***/ (function(module, exports) {
  37672. // shim for using process in browser
  37673. var process = module.exports = {};
  37674. // cached from whatever global is present so that test runners that stub it
  37675. // don't break things. But we need to wrap it in a try catch in case it is
  37676. // wrapped in strict mode code which doesn't define any globals. It's inside a
  37677. // function because try/catches deoptimize in certain engines.
  37678. var cachedSetTimeout;
  37679. var cachedClearTimeout;
  37680. function defaultSetTimout() {
  37681. throw new Error('setTimeout has not been defined');
  37682. }
  37683. function defaultClearTimeout () {
  37684. throw new Error('clearTimeout has not been defined');
  37685. }
  37686. (function () {
  37687. try {
  37688. if (typeof setTimeout === 'function') {
  37689. cachedSetTimeout = setTimeout;
  37690. } else {
  37691. cachedSetTimeout = defaultSetTimout;
  37692. }
  37693. } catch (e) {
  37694. cachedSetTimeout = defaultSetTimout;
  37695. }
  37696. try {
  37697. if (typeof clearTimeout === 'function') {
  37698. cachedClearTimeout = clearTimeout;
  37699. } else {
  37700. cachedClearTimeout = defaultClearTimeout;
  37701. }
  37702. } catch (e) {
  37703. cachedClearTimeout = defaultClearTimeout;
  37704. }
  37705. } ())
  37706. function runTimeout(fun) {
  37707. if (cachedSetTimeout === setTimeout) {
  37708. //normal enviroments in sane situations
  37709. return setTimeout(fun, 0);
  37710. }
  37711. // if setTimeout wasn't available but was latter defined
  37712. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  37713. cachedSetTimeout = setTimeout;
  37714. return setTimeout(fun, 0);
  37715. }
  37716. try {
  37717. // when when somebody has screwed with setTimeout but no I.E. maddness
  37718. return cachedSetTimeout(fun, 0);
  37719. } catch(e){
  37720. try {
  37721. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37722. return cachedSetTimeout.call(null, fun, 0);
  37723. } catch(e){
  37724. // 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
  37725. return cachedSetTimeout.call(this, fun, 0);
  37726. }
  37727. }
  37728. }
  37729. function runClearTimeout(marker) {
  37730. if (cachedClearTimeout === clearTimeout) {
  37731. //normal enviroments in sane situations
  37732. return clearTimeout(marker);
  37733. }
  37734. // if clearTimeout wasn't available but was latter defined
  37735. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  37736. cachedClearTimeout = clearTimeout;
  37737. return clearTimeout(marker);
  37738. }
  37739. try {
  37740. // when when somebody has screwed with setTimeout but no I.E. maddness
  37741. return cachedClearTimeout(marker);
  37742. } catch (e){
  37743. try {
  37744. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37745. return cachedClearTimeout.call(null, marker);
  37746. } catch (e){
  37747. // 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.
  37748. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  37749. return cachedClearTimeout.call(this, marker);
  37750. }
  37751. }
  37752. }
  37753. var queue = [];
  37754. var draining = false;
  37755. var currentQueue;
  37756. var queueIndex = -1;
  37757. function cleanUpNextTick() {
  37758. if (!draining || !currentQueue) {
  37759. return;
  37760. }
  37761. draining = false;
  37762. if (currentQueue.length) {
  37763. queue = currentQueue.concat(queue);
  37764. } else {
  37765. queueIndex = -1;
  37766. }
  37767. if (queue.length) {
  37768. drainQueue();
  37769. }
  37770. }
  37771. function drainQueue() {
  37772. if (draining) {
  37773. return;
  37774. }
  37775. var timeout = runTimeout(cleanUpNextTick);
  37776. draining = true;
  37777. var len = queue.length;
  37778. while(len) {
  37779. currentQueue = queue;
  37780. queue = [];
  37781. while (++queueIndex < len) {
  37782. if (currentQueue) {
  37783. currentQueue[queueIndex].run();
  37784. }
  37785. }
  37786. queueIndex = -1;
  37787. len = queue.length;
  37788. }
  37789. currentQueue = null;
  37790. draining = false;
  37791. runClearTimeout(timeout);
  37792. }
  37793. process.nextTick = function (fun) {
  37794. var args = new Array(arguments.length - 1);
  37795. if (arguments.length > 1) {
  37796. for (var i = 1; i < arguments.length; i++) {
  37797. args[i - 1] = arguments[i];
  37798. }
  37799. }
  37800. queue.push(new Item(fun, args));
  37801. if (queue.length === 1 && !draining) {
  37802. runTimeout(drainQueue);
  37803. }
  37804. };
  37805. // v8 likes predictible objects
  37806. function Item(fun, array) {
  37807. this.fun = fun;
  37808. this.array = array;
  37809. }
  37810. Item.prototype.run = function () {
  37811. this.fun.apply(null, this.array);
  37812. };
  37813. process.title = 'browser';
  37814. process.browser = true;
  37815. process.env = {};
  37816. process.argv = [];
  37817. process.version = ''; // empty string to avoid regexp issues
  37818. process.versions = {};
  37819. function noop() {}
  37820. process.on = noop;
  37821. process.addListener = noop;
  37822. process.once = noop;
  37823. process.off = noop;
  37824. process.removeListener = noop;
  37825. process.removeAllListeners = noop;
  37826. process.emit = noop;
  37827. process.prependListener = noop;
  37828. process.prependOnceListener = noop;
  37829. process.listeners = function (name) { return [] }
  37830. process.binding = function (name) {
  37831. throw new Error('process.binding is not supported');
  37832. };
  37833. process.cwd = function () { return '/' };
  37834. process.chdir = function (dir) {
  37835. throw new Error('process.chdir is not supported');
  37836. };
  37837. process.umask = function() { return 0; };
  37838. /***/ }),
  37839. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  37840. /*!***************************************************!*\
  37841. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  37842. \***************************************************/
  37843. /*! no static exports found */
  37844. /***/ (function(module, exports, __webpack_require__) {
  37845. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  37846. * Pusher JavaScript Library v5.0.3
  37847. * https://pusher.com/
  37848. *
  37849. * Copyright 2017, Pusher
  37850. * Released under the MIT licence.
  37851. */
  37852. (function webpackUniversalModuleDefinition(root, factory) {
  37853. if(true)
  37854. module.exports = factory();
  37855. else {}
  37856. })(window, function() {
  37857. return /******/ (function(modules) { // webpackBootstrap
  37858. /******/ // The module cache
  37859. /******/ var installedModules = {};
  37860. /******/
  37861. /******/ // The require function
  37862. /******/ function __webpack_require__(moduleId) {
  37863. /******/
  37864. /******/ // Check if module is in cache
  37865. /******/ if(installedModules[moduleId]) {
  37866. /******/ return installedModules[moduleId].exports;
  37867. /******/ }
  37868. /******/ // Create a new module (and put it into the cache)
  37869. /******/ var module = installedModules[moduleId] = {
  37870. /******/ i: moduleId,
  37871. /******/ l: false,
  37872. /******/ exports: {}
  37873. /******/ };
  37874. /******/
  37875. /******/ // Execute the module function
  37876. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  37877. /******/
  37878. /******/ // Flag the module as loaded
  37879. /******/ module.l = true;
  37880. /******/
  37881. /******/ // Return the exports of the module
  37882. /******/ return module.exports;
  37883. /******/ }
  37884. /******/
  37885. /******/
  37886. /******/ // expose the modules object (__webpack_modules__)
  37887. /******/ __webpack_require__.m = modules;
  37888. /******/
  37889. /******/ // expose the module cache
  37890. /******/ __webpack_require__.c = installedModules;
  37891. /******/
  37892. /******/ // define getter function for harmony exports
  37893. /******/ __webpack_require__.d = function(exports, name, getter) {
  37894. /******/ if(!__webpack_require__.o(exports, name)) {
  37895. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  37896. /******/ }
  37897. /******/ };
  37898. /******/
  37899. /******/ // define __esModule on exports
  37900. /******/ __webpack_require__.r = function(exports) {
  37901. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  37902. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  37903. /******/ }
  37904. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  37905. /******/ };
  37906. /******/
  37907. /******/ // create a fake namespace object
  37908. /******/ // mode & 1: value is a module id, require it
  37909. /******/ // mode & 2: merge all properties of value into the ns
  37910. /******/ // mode & 4: return value when already ns object
  37911. /******/ // mode & 8|1: behave like require
  37912. /******/ __webpack_require__.t = function(value, mode) {
  37913. /******/ if(mode & 1) value = __webpack_require__(value);
  37914. /******/ if(mode & 8) return value;
  37915. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  37916. /******/ var ns = Object.create(null);
  37917. /******/ __webpack_require__.r(ns);
  37918. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  37919. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  37920. /******/ return ns;
  37921. /******/ };
  37922. /******/
  37923. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37924. /******/ __webpack_require__.n = function(module) {
  37925. /******/ var getter = module && module.__esModule ?
  37926. /******/ function getDefault() { return module['default']; } :
  37927. /******/ function getModuleExports() { return module; };
  37928. /******/ __webpack_require__.d(getter, 'a', getter);
  37929. /******/ return getter;
  37930. /******/ };
  37931. /******/
  37932. /******/ // Object.prototype.hasOwnProperty.call
  37933. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37934. /******/
  37935. /******/ // __webpack_public_path__
  37936. /******/ __webpack_require__.p = "";
  37937. /******/
  37938. /******/
  37939. /******/ // Load entry module and return exports
  37940. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37941. /******/ })
  37942. /************************************************************************/
  37943. /******/ ([
  37944. /* 0 */
  37945. /***/ (function(module, exports, __webpack_require__) {
  37946. (function(nacl) {
  37947. 'use strict';
  37948. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37949. // Public domain.
  37950. //
  37951. // Implementation derived from TweetNaCl version 20140427.
  37952. // See for details: http://tweetnacl.cr.yp.to/
  37953. var gf = function(init) {
  37954. var i, r = new Float64Array(16);
  37955. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37956. return r;
  37957. };
  37958. // Pluggable, initialized in high-level API below.
  37959. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37960. var _0 = new Uint8Array(16);
  37961. var _9 = new Uint8Array(32); _9[0] = 9;
  37962. var gf0 = gf(),
  37963. gf1 = gf([1]),
  37964. _121665 = gf([0xdb41, 1]),
  37965. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37966. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37967. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37968. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37969. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37970. function ts64(x, i, h, l) {
  37971. x[i] = (h >> 24) & 0xff;
  37972. x[i+1] = (h >> 16) & 0xff;
  37973. x[i+2] = (h >> 8) & 0xff;
  37974. x[i+3] = h & 0xff;
  37975. x[i+4] = (l >> 24) & 0xff;
  37976. x[i+5] = (l >> 16) & 0xff;
  37977. x[i+6] = (l >> 8) & 0xff;
  37978. x[i+7] = l & 0xff;
  37979. }
  37980. function vn(x, xi, y, yi, n) {
  37981. var i,d = 0;
  37982. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37983. return (1 & ((d - 1) >>> 8)) - 1;
  37984. }
  37985. function crypto_verify_16(x, xi, y, yi) {
  37986. return vn(x,xi,y,yi,16);
  37987. }
  37988. function crypto_verify_32(x, xi, y, yi) {
  37989. return vn(x,xi,y,yi,32);
  37990. }
  37991. function core_salsa20(o, p, k, c) {
  37992. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37993. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37994. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37995. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37996. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37997. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37998. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37999. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  38000. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  38001. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  38002. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  38003. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  38004. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  38005. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  38006. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  38007. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  38008. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  38009. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  38010. x15 = j15, u;
  38011. for (var i = 0; i < 20; i += 2) {
  38012. u = x0 + x12 | 0;
  38013. x4 ^= u<<7 | u>>>(32-7);
  38014. u = x4 + x0 | 0;
  38015. x8 ^= u<<9 | u>>>(32-9);
  38016. u = x8 + x4 | 0;
  38017. x12 ^= u<<13 | u>>>(32-13);
  38018. u = x12 + x8 | 0;
  38019. x0 ^= u<<18 | u>>>(32-18);
  38020. u = x5 + x1 | 0;
  38021. x9 ^= u<<7 | u>>>(32-7);
  38022. u = x9 + x5 | 0;
  38023. x13 ^= u<<9 | u>>>(32-9);
  38024. u = x13 + x9 | 0;
  38025. x1 ^= u<<13 | u>>>(32-13);
  38026. u = x1 + x13 | 0;
  38027. x5 ^= u<<18 | u>>>(32-18);
  38028. u = x10 + x6 | 0;
  38029. x14 ^= u<<7 | u>>>(32-7);
  38030. u = x14 + x10 | 0;
  38031. x2 ^= u<<9 | u>>>(32-9);
  38032. u = x2 + x14 | 0;
  38033. x6 ^= u<<13 | u>>>(32-13);
  38034. u = x6 + x2 | 0;
  38035. x10 ^= u<<18 | u>>>(32-18);
  38036. u = x15 + x11 | 0;
  38037. x3 ^= u<<7 | u>>>(32-7);
  38038. u = x3 + x15 | 0;
  38039. x7 ^= u<<9 | u>>>(32-9);
  38040. u = x7 + x3 | 0;
  38041. x11 ^= u<<13 | u>>>(32-13);
  38042. u = x11 + x7 | 0;
  38043. x15 ^= u<<18 | u>>>(32-18);
  38044. u = x0 + x3 | 0;
  38045. x1 ^= u<<7 | u>>>(32-7);
  38046. u = x1 + x0 | 0;
  38047. x2 ^= u<<9 | u>>>(32-9);
  38048. u = x2 + x1 | 0;
  38049. x3 ^= u<<13 | u>>>(32-13);
  38050. u = x3 + x2 | 0;
  38051. x0 ^= u<<18 | u>>>(32-18);
  38052. u = x5 + x4 | 0;
  38053. x6 ^= u<<7 | u>>>(32-7);
  38054. u = x6 + x5 | 0;
  38055. x7 ^= u<<9 | u>>>(32-9);
  38056. u = x7 + x6 | 0;
  38057. x4 ^= u<<13 | u>>>(32-13);
  38058. u = x4 + x7 | 0;
  38059. x5 ^= u<<18 | u>>>(32-18);
  38060. u = x10 + x9 | 0;
  38061. x11 ^= u<<7 | u>>>(32-7);
  38062. u = x11 + x10 | 0;
  38063. x8 ^= u<<9 | u>>>(32-9);
  38064. u = x8 + x11 | 0;
  38065. x9 ^= u<<13 | u>>>(32-13);
  38066. u = x9 + x8 | 0;
  38067. x10 ^= u<<18 | u>>>(32-18);
  38068. u = x15 + x14 | 0;
  38069. x12 ^= u<<7 | u>>>(32-7);
  38070. u = x12 + x15 | 0;
  38071. x13 ^= u<<9 | u>>>(32-9);
  38072. u = x13 + x12 | 0;
  38073. x14 ^= u<<13 | u>>>(32-13);
  38074. u = x14 + x13 | 0;
  38075. x15 ^= u<<18 | u>>>(32-18);
  38076. }
  38077. x0 = x0 + j0 | 0;
  38078. x1 = x1 + j1 | 0;
  38079. x2 = x2 + j2 | 0;
  38080. x3 = x3 + j3 | 0;
  38081. x4 = x4 + j4 | 0;
  38082. x5 = x5 + j5 | 0;
  38083. x6 = x6 + j6 | 0;
  38084. x7 = x7 + j7 | 0;
  38085. x8 = x8 + j8 | 0;
  38086. x9 = x9 + j9 | 0;
  38087. x10 = x10 + j10 | 0;
  38088. x11 = x11 + j11 | 0;
  38089. x12 = x12 + j12 | 0;
  38090. x13 = x13 + j13 | 0;
  38091. x14 = x14 + j14 | 0;
  38092. x15 = x15 + j15 | 0;
  38093. o[ 0] = x0 >>> 0 & 0xff;
  38094. o[ 1] = x0 >>> 8 & 0xff;
  38095. o[ 2] = x0 >>> 16 & 0xff;
  38096. o[ 3] = x0 >>> 24 & 0xff;
  38097. o[ 4] = x1 >>> 0 & 0xff;
  38098. o[ 5] = x1 >>> 8 & 0xff;
  38099. o[ 6] = x1 >>> 16 & 0xff;
  38100. o[ 7] = x1 >>> 24 & 0xff;
  38101. o[ 8] = x2 >>> 0 & 0xff;
  38102. o[ 9] = x2 >>> 8 & 0xff;
  38103. o[10] = x2 >>> 16 & 0xff;
  38104. o[11] = x2 >>> 24 & 0xff;
  38105. o[12] = x3 >>> 0 & 0xff;
  38106. o[13] = x3 >>> 8 & 0xff;
  38107. o[14] = x3 >>> 16 & 0xff;
  38108. o[15] = x3 >>> 24 & 0xff;
  38109. o[16] = x4 >>> 0 & 0xff;
  38110. o[17] = x4 >>> 8 & 0xff;
  38111. o[18] = x4 >>> 16 & 0xff;
  38112. o[19] = x4 >>> 24 & 0xff;
  38113. o[20] = x5 >>> 0 & 0xff;
  38114. o[21] = x5 >>> 8 & 0xff;
  38115. o[22] = x5 >>> 16 & 0xff;
  38116. o[23] = x5 >>> 24 & 0xff;
  38117. o[24] = x6 >>> 0 & 0xff;
  38118. o[25] = x6 >>> 8 & 0xff;
  38119. o[26] = x6 >>> 16 & 0xff;
  38120. o[27] = x6 >>> 24 & 0xff;
  38121. o[28] = x7 >>> 0 & 0xff;
  38122. o[29] = x7 >>> 8 & 0xff;
  38123. o[30] = x7 >>> 16 & 0xff;
  38124. o[31] = x7 >>> 24 & 0xff;
  38125. o[32] = x8 >>> 0 & 0xff;
  38126. o[33] = x8 >>> 8 & 0xff;
  38127. o[34] = x8 >>> 16 & 0xff;
  38128. o[35] = x8 >>> 24 & 0xff;
  38129. o[36] = x9 >>> 0 & 0xff;
  38130. o[37] = x9 >>> 8 & 0xff;
  38131. o[38] = x9 >>> 16 & 0xff;
  38132. o[39] = x9 >>> 24 & 0xff;
  38133. o[40] = x10 >>> 0 & 0xff;
  38134. o[41] = x10 >>> 8 & 0xff;
  38135. o[42] = x10 >>> 16 & 0xff;
  38136. o[43] = x10 >>> 24 & 0xff;
  38137. o[44] = x11 >>> 0 & 0xff;
  38138. o[45] = x11 >>> 8 & 0xff;
  38139. o[46] = x11 >>> 16 & 0xff;
  38140. o[47] = x11 >>> 24 & 0xff;
  38141. o[48] = x12 >>> 0 & 0xff;
  38142. o[49] = x12 >>> 8 & 0xff;
  38143. o[50] = x12 >>> 16 & 0xff;
  38144. o[51] = x12 >>> 24 & 0xff;
  38145. o[52] = x13 >>> 0 & 0xff;
  38146. o[53] = x13 >>> 8 & 0xff;
  38147. o[54] = x13 >>> 16 & 0xff;
  38148. o[55] = x13 >>> 24 & 0xff;
  38149. o[56] = x14 >>> 0 & 0xff;
  38150. o[57] = x14 >>> 8 & 0xff;
  38151. o[58] = x14 >>> 16 & 0xff;
  38152. o[59] = x14 >>> 24 & 0xff;
  38153. o[60] = x15 >>> 0 & 0xff;
  38154. o[61] = x15 >>> 8 & 0xff;
  38155. o[62] = x15 >>> 16 & 0xff;
  38156. o[63] = x15 >>> 24 & 0xff;
  38157. }
  38158. function core_hsalsa20(o,p,k,c) {
  38159. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  38160. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  38161. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  38162. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  38163. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  38164. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  38165. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  38166. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  38167. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  38168. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  38169. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  38170. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  38171. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  38172. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  38173. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  38174. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  38175. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  38176. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  38177. x15 = j15, u;
  38178. for (var i = 0; i < 20; i += 2) {
  38179. u = x0 + x12 | 0;
  38180. x4 ^= u<<7 | u>>>(32-7);
  38181. u = x4 + x0 | 0;
  38182. x8 ^= u<<9 | u>>>(32-9);
  38183. u = x8 + x4 | 0;
  38184. x12 ^= u<<13 | u>>>(32-13);
  38185. u = x12 + x8 | 0;
  38186. x0 ^= u<<18 | u>>>(32-18);
  38187. u = x5 + x1 | 0;
  38188. x9 ^= u<<7 | u>>>(32-7);
  38189. u = x9 + x5 | 0;
  38190. x13 ^= u<<9 | u>>>(32-9);
  38191. u = x13 + x9 | 0;
  38192. x1 ^= u<<13 | u>>>(32-13);
  38193. u = x1 + x13 | 0;
  38194. x5 ^= u<<18 | u>>>(32-18);
  38195. u = x10 + x6 | 0;
  38196. x14 ^= u<<7 | u>>>(32-7);
  38197. u = x14 + x10 | 0;
  38198. x2 ^= u<<9 | u>>>(32-9);
  38199. u = x2 + x14 | 0;
  38200. x6 ^= u<<13 | u>>>(32-13);
  38201. u = x6 + x2 | 0;
  38202. x10 ^= u<<18 | u>>>(32-18);
  38203. u = x15 + x11 | 0;
  38204. x3 ^= u<<7 | u>>>(32-7);
  38205. u = x3 + x15 | 0;
  38206. x7 ^= u<<9 | u>>>(32-9);
  38207. u = x7 + x3 | 0;
  38208. x11 ^= u<<13 | u>>>(32-13);
  38209. u = x11 + x7 | 0;
  38210. x15 ^= u<<18 | u>>>(32-18);
  38211. u = x0 + x3 | 0;
  38212. x1 ^= u<<7 | u>>>(32-7);
  38213. u = x1 + x0 | 0;
  38214. x2 ^= u<<9 | u>>>(32-9);
  38215. u = x2 + x1 | 0;
  38216. x3 ^= u<<13 | u>>>(32-13);
  38217. u = x3 + x2 | 0;
  38218. x0 ^= u<<18 | u>>>(32-18);
  38219. u = x5 + x4 | 0;
  38220. x6 ^= u<<7 | u>>>(32-7);
  38221. u = x6 + x5 | 0;
  38222. x7 ^= u<<9 | u>>>(32-9);
  38223. u = x7 + x6 | 0;
  38224. x4 ^= u<<13 | u>>>(32-13);
  38225. u = x4 + x7 | 0;
  38226. x5 ^= u<<18 | u>>>(32-18);
  38227. u = x10 + x9 | 0;
  38228. x11 ^= u<<7 | u>>>(32-7);
  38229. u = x11 + x10 | 0;
  38230. x8 ^= u<<9 | u>>>(32-9);
  38231. u = x8 + x11 | 0;
  38232. x9 ^= u<<13 | u>>>(32-13);
  38233. u = x9 + x8 | 0;
  38234. x10 ^= u<<18 | u>>>(32-18);
  38235. u = x15 + x14 | 0;
  38236. x12 ^= u<<7 | u>>>(32-7);
  38237. u = x12 + x15 | 0;
  38238. x13 ^= u<<9 | u>>>(32-9);
  38239. u = x13 + x12 | 0;
  38240. x14 ^= u<<13 | u>>>(32-13);
  38241. u = x14 + x13 | 0;
  38242. x15 ^= u<<18 | u>>>(32-18);
  38243. }
  38244. o[ 0] = x0 >>> 0 & 0xff;
  38245. o[ 1] = x0 >>> 8 & 0xff;
  38246. o[ 2] = x0 >>> 16 & 0xff;
  38247. o[ 3] = x0 >>> 24 & 0xff;
  38248. o[ 4] = x5 >>> 0 & 0xff;
  38249. o[ 5] = x5 >>> 8 & 0xff;
  38250. o[ 6] = x5 >>> 16 & 0xff;
  38251. o[ 7] = x5 >>> 24 & 0xff;
  38252. o[ 8] = x10 >>> 0 & 0xff;
  38253. o[ 9] = x10 >>> 8 & 0xff;
  38254. o[10] = x10 >>> 16 & 0xff;
  38255. o[11] = x10 >>> 24 & 0xff;
  38256. o[12] = x15 >>> 0 & 0xff;
  38257. o[13] = x15 >>> 8 & 0xff;
  38258. o[14] = x15 >>> 16 & 0xff;
  38259. o[15] = x15 >>> 24 & 0xff;
  38260. o[16] = x6 >>> 0 & 0xff;
  38261. o[17] = x6 >>> 8 & 0xff;
  38262. o[18] = x6 >>> 16 & 0xff;
  38263. o[19] = x6 >>> 24 & 0xff;
  38264. o[20] = x7 >>> 0 & 0xff;
  38265. o[21] = x7 >>> 8 & 0xff;
  38266. o[22] = x7 >>> 16 & 0xff;
  38267. o[23] = x7 >>> 24 & 0xff;
  38268. o[24] = x8 >>> 0 & 0xff;
  38269. o[25] = x8 >>> 8 & 0xff;
  38270. o[26] = x8 >>> 16 & 0xff;
  38271. o[27] = x8 >>> 24 & 0xff;
  38272. o[28] = x9 >>> 0 & 0xff;
  38273. o[29] = x9 >>> 8 & 0xff;
  38274. o[30] = x9 >>> 16 & 0xff;
  38275. o[31] = x9 >>> 24 & 0xff;
  38276. }
  38277. function crypto_core_salsa20(out,inp,k,c) {
  38278. core_salsa20(out,inp,k,c);
  38279. }
  38280. function crypto_core_hsalsa20(out,inp,k,c) {
  38281. core_hsalsa20(out,inp,k,c);
  38282. }
  38283. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  38284. // "expand 32-byte k"
  38285. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  38286. var z = new Uint8Array(16), x = new Uint8Array(64);
  38287. var u, i;
  38288. for (i = 0; i < 16; i++) z[i] = 0;
  38289. for (i = 0; i < 8; i++) z[i] = n[i];
  38290. while (b >= 64) {
  38291. crypto_core_salsa20(x,z,k,sigma);
  38292. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  38293. u = 1;
  38294. for (i = 8; i < 16; i++) {
  38295. u = u + (z[i] & 0xff) | 0;
  38296. z[i] = u & 0xff;
  38297. u >>>= 8;
  38298. }
  38299. b -= 64;
  38300. cpos += 64;
  38301. mpos += 64;
  38302. }
  38303. if (b > 0) {
  38304. crypto_core_salsa20(x,z,k,sigma);
  38305. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  38306. }
  38307. return 0;
  38308. }
  38309. function crypto_stream_salsa20(c,cpos,b,n,k) {
  38310. var z = new Uint8Array(16), x = new Uint8Array(64);
  38311. var u, i;
  38312. for (i = 0; i < 16; i++) z[i] = 0;
  38313. for (i = 0; i < 8; i++) z[i] = n[i];
  38314. while (b >= 64) {
  38315. crypto_core_salsa20(x,z,k,sigma);
  38316. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  38317. u = 1;
  38318. for (i = 8; i < 16; i++) {
  38319. u = u + (z[i] & 0xff) | 0;
  38320. z[i] = u & 0xff;
  38321. u >>>= 8;
  38322. }
  38323. b -= 64;
  38324. cpos += 64;
  38325. }
  38326. if (b > 0) {
  38327. crypto_core_salsa20(x,z,k,sigma);
  38328. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  38329. }
  38330. return 0;
  38331. }
  38332. function crypto_stream(c,cpos,d,n,k) {
  38333. var s = new Uint8Array(32);
  38334. crypto_core_hsalsa20(s,n,k,sigma);
  38335. var sn = new Uint8Array(8);
  38336. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  38337. return crypto_stream_salsa20(c,cpos,d,sn,s);
  38338. }
  38339. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  38340. var s = new Uint8Array(32);
  38341. crypto_core_hsalsa20(s,n,k,sigma);
  38342. var sn = new Uint8Array(8);
  38343. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  38344. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  38345. }
  38346. /*
  38347. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  38348. * https://github.com/floodyberry/poly1305-donna
  38349. */
  38350. var poly1305 = function(key) {
  38351. this.buffer = new Uint8Array(16);
  38352. this.r = new Uint16Array(10);
  38353. this.h = new Uint16Array(10);
  38354. this.pad = new Uint16Array(8);
  38355. this.leftover = 0;
  38356. this.fin = 0;
  38357. var t0, t1, t2, t3, t4, t5, t6, t7;
  38358. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  38359. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  38360. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  38361. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  38362. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  38363. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  38364. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  38365. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  38366. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  38367. this.r[9] = ((t7 >>> 5)) & 0x007f;
  38368. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  38369. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  38370. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  38371. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  38372. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  38373. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  38374. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  38375. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  38376. };
  38377. poly1305.prototype.blocks = function(m, mpos, bytes) {
  38378. var hibit = this.fin ? 0 : (1 << 11);
  38379. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  38380. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  38381. var h0 = this.h[0],
  38382. h1 = this.h[1],
  38383. h2 = this.h[2],
  38384. h3 = this.h[3],
  38385. h4 = this.h[4],
  38386. h5 = this.h[5],
  38387. h6 = this.h[6],
  38388. h7 = this.h[7],
  38389. h8 = this.h[8],
  38390. h9 = this.h[9];
  38391. var r0 = this.r[0],
  38392. r1 = this.r[1],
  38393. r2 = this.r[2],
  38394. r3 = this.r[3],
  38395. r4 = this.r[4],
  38396. r5 = this.r[5],
  38397. r6 = this.r[6],
  38398. r7 = this.r[7],
  38399. r8 = this.r[8],
  38400. r9 = this.r[9];
  38401. while (bytes >= 16) {
  38402. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  38403. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  38404. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  38405. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  38406. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  38407. h5 += ((t4 >>> 1)) & 0x1fff;
  38408. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  38409. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  38410. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  38411. h9 += ((t7 >>> 5)) | hibit;
  38412. c = 0;
  38413. d0 = c;
  38414. d0 += h0 * r0;
  38415. d0 += h1 * (5 * r9);
  38416. d0 += h2 * (5 * r8);
  38417. d0 += h3 * (5 * r7);
  38418. d0 += h4 * (5 * r6);
  38419. c = (d0 >>> 13); d0 &= 0x1fff;
  38420. d0 += h5 * (5 * r5);
  38421. d0 += h6 * (5 * r4);
  38422. d0 += h7 * (5 * r3);
  38423. d0 += h8 * (5 * r2);
  38424. d0 += h9 * (5 * r1);
  38425. c += (d0 >>> 13); d0 &= 0x1fff;
  38426. d1 = c;
  38427. d1 += h0 * r1;
  38428. d1 += h1 * r0;
  38429. d1 += h2 * (5 * r9);
  38430. d1 += h3 * (5 * r8);
  38431. d1 += h4 * (5 * r7);
  38432. c = (d1 >>> 13); d1 &= 0x1fff;
  38433. d1 += h5 * (5 * r6);
  38434. d1 += h6 * (5 * r5);
  38435. d1 += h7 * (5 * r4);
  38436. d1 += h8 * (5 * r3);
  38437. d1 += h9 * (5 * r2);
  38438. c += (d1 >>> 13); d1 &= 0x1fff;
  38439. d2 = c;
  38440. d2 += h0 * r2;
  38441. d2 += h1 * r1;
  38442. d2 += h2 * r0;
  38443. d2 += h3 * (5 * r9);
  38444. d2 += h4 * (5 * r8);
  38445. c = (d2 >>> 13); d2 &= 0x1fff;
  38446. d2 += h5 * (5 * r7);
  38447. d2 += h6 * (5 * r6);
  38448. d2 += h7 * (5 * r5);
  38449. d2 += h8 * (5 * r4);
  38450. d2 += h9 * (5 * r3);
  38451. c += (d2 >>> 13); d2 &= 0x1fff;
  38452. d3 = c;
  38453. d3 += h0 * r3;
  38454. d3 += h1 * r2;
  38455. d3 += h2 * r1;
  38456. d3 += h3 * r0;
  38457. d3 += h4 * (5 * r9);
  38458. c = (d3 >>> 13); d3 &= 0x1fff;
  38459. d3 += h5 * (5 * r8);
  38460. d3 += h6 * (5 * r7);
  38461. d3 += h7 * (5 * r6);
  38462. d3 += h8 * (5 * r5);
  38463. d3 += h9 * (5 * r4);
  38464. c += (d3 >>> 13); d3 &= 0x1fff;
  38465. d4 = c;
  38466. d4 += h0 * r4;
  38467. d4 += h1 * r3;
  38468. d4 += h2 * r2;
  38469. d4 += h3 * r1;
  38470. d4 += h4 * r0;
  38471. c = (d4 >>> 13); d4 &= 0x1fff;
  38472. d4 += h5 * (5 * r9);
  38473. d4 += h6 * (5 * r8);
  38474. d4 += h7 * (5 * r7);
  38475. d4 += h8 * (5 * r6);
  38476. d4 += h9 * (5 * r5);
  38477. c += (d4 >>> 13); d4 &= 0x1fff;
  38478. d5 = c;
  38479. d5 += h0 * r5;
  38480. d5 += h1 * r4;
  38481. d5 += h2 * r3;
  38482. d5 += h3 * r2;
  38483. d5 += h4 * r1;
  38484. c = (d5 >>> 13); d5 &= 0x1fff;
  38485. d5 += h5 * r0;
  38486. d5 += h6 * (5 * r9);
  38487. d5 += h7 * (5 * r8);
  38488. d5 += h8 * (5 * r7);
  38489. d5 += h9 * (5 * r6);
  38490. c += (d5 >>> 13); d5 &= 0x1fff;
  38491. d6 = c;
  38492. d6 += h0 * r6;
  38493. d6 += h1 * r5;
  38494. d6 += h2 * r4;
  38495. d6 += h3 * r3;
  38496. d6 += h4 * r2;
  38497. c = (d6 >>> 13); d6 &= 0x1fff;
  38498. d6 += h5 * r1;
  38499. d6 += h6 * r0;
  38500. d6 += h7 * (5 * r9);
  38501. d6 += h8 * (5 * r8);
  38502. d6 += h9 * (5 * r7);
  38503. c += (d6 >>> 13); d6 &= 0x1fff;
  38504. d7 = c;
  38505. d7 += h0 * r7;
  38506. d7 += h1 * r6;
  38507. d7 += h2 * r5;
  38508. d7 += h3 * r4;
  38509. d7 += h4 * r3;
  38510. c = (d7 >>> 13); d7 &= 0x1fff;
  38511. d7 += h5 * r2;
  38512. d7 += h6 * r1;
  38513. d7 += h7 * r0;
  38514. d7 += h8 * (5 * r9);
  38515. d7 += h9 * (5 * r8);
  38516. c += (d7 >>> 13); d7 &= 0x1fff;
  38517. d8 = c;
  38518. d8 += h0 * r8;
  38519. d8 += h1 * r7;
  38520. d8 += h2 * r6;
  38521. d8 += h3 * r5;
  38522. d8 += h4 * r4;
  38523. c = (d8 >>> 13); d8 &= 0x1fff;
  38524. d8 += h5 * r3;
  38525. d8 += h6 * r2;
  38526. d8 += h7 * r1;
  38527. d8 += h8 * r0;
  38528. d8 += h9 * (5 * r9);
  38529. c += (d8 >>> 13); d8 &= 0x1fff;
  38530. d9 = c;
  38531. d9 += h0 * r9;
  38532. d9 += h1 * r8;
  38533. d9 += h2 * r7;
  38534. d9 += h3 * r6;
  38535. d9 += h4 * r5;
  38536. c = (d9 >>> 13); d9 &= 0x1fff;
  38537. d9 += h5 * r4;
  38538. d9 += h6 * r3;
  38539. d9 += h7 * r2;
  38540. d9 += h8 * r1;
  38541. d9 += h9 * r0;
  38542. c += (d9 >>> 13); d9 &= 0x1fff;
  38543. c = (((c << 2) + c)) | 0;
  38544. c = (c + d0) | 0;
  38545. d0 = c & 0x1fff;
  38546. c = (c >>> 13);
  38547. d1 += c;
  38548. h0 = d0;
  38549. h1 = d1;
  38550. h2 = d2;
  38551. h3 = d3;
  38552. h4 = d4;
  38553. h5 = d5;
  38554. h6 = d6;
  38555. h7 = d7;
  38556. h8 = d8;
  38557. h9 = d9;
  38558. mpos += 16;
  38559. bytes -= 16;
  38560. }
  38561. this.h[0] = h0;
  38562. this.h[1] = h1;
  38563. this.h[2] = h2;
  38564. this.h[3] = h3;
  38565. this.h[4] = h4;
  38566. this.h[5] = h5;
  38567. this.h[6] = h6;
  38568. this.h[7] = h7;
  38569. this.h[8] = h8;
  38570. this.h[9] = h9;
  38571. };
  38572. poly1305.prototype.finish = function(mac, macpos) {
  38573. var g = new Uint16Array(10);
  38574. var c, mask, f, i;
  38575. if (this.leftover) {
  38576. i = this.leftover;
  38577. this.buffer[i++] = 1;
  38578. for (; i < 16; i++) this.buffer[i] = 0;
  38579. this.fin = 1;
  38580. this.blocks(this.buffer, 0, 16);
  38581. }
  38582. c = this.h[1] >>> 13;
  38583. this.h[1] &= 0x1fff;
  38584. for (i = 2; i < 10; i++) {
  38585. this.h[i] += c;
  38586. c = this.h[i] >>> 13;
  38587. this.h[i] &= 0x1fff;
  38588. }
  38589. this.h[0] += (c * 5);
  38590. c = this.h[0] >>> 13;
  38591. this.h[0] &= 0x1fff;
  38592. this.h[1] += c;
  38593. c = this.h[1] >>> 13;
  38594. this.h[1] &= 0x1fff;
  38595. this.h[2] += c;
  38596. g[0] = this.h[0] + 5;
  38597. c = g[0] >>> 13;
  38598. g[0] &= 0x1fff;
  38599. for (i = 1; i < 10; i++) {
  38600. g[i] = this.h[i] + c;
  38601. c = g[i] >>> 13;
  38602. g[i] &= 0x1fff;
  38603. }
  38604. g[9] -= (1 << 13);
  38605. mask = (c ^ 1) - 1;
  38606. for (i = 0; i < 10; i++) g[i] &= mask;
  38607. mask = ~mask;
  38608. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  38609. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  38610. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  38611. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  38612. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  38613. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  38614. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  38615. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  38616. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  38617. f = this.h[0] + this.pad[0];
  38618. this.h[0] = f & 0xffff;
  38619. for (i = 1; i < 8; i++) {
  38620. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  38621. this.h[i] = f & 0xffff;
  38622. }
  38623. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  38624. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  38625. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  38626. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  38627. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  38628. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  38629. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  38630. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  38631. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  38632. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  38633. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  38634. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  38635. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  38636. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  38637. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  38638. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  38639. };
  38640. poly1305.prototype.update = function(m, mpos, bytes) {
  38641. var i, want;
  38642. if (this.leftover) {
  38643. want = (16 - this.leftover);
  38644. if (want > bytes)
  38645. want = bytes;
  38646. for (i = 0; i < want; i++)
  38647. this.buffer[this.leftover + i] = m[mpos+i];
  38648. bytes -= want;
  38649. mpos += want;
  38650. this.leftover += want;
  38651. if (this.leftover < 16)
  38652. return;
  38653. this.blocks(this.buffer, 0, 16);
  38654. this.leftover = 0;
  38655. }
  38656. if (bytes >= 16) {
  38657. want = bytes - (bytes % 16);
  38658. this.blocks(m, mpos, want);
  38659. mpos += want;
  38660. bytes -= want;
  38661. }
  38662. if (bytes) {
  38663. for (i = 0; i < bytes; i++)
  38664. this.buffer[this.leftover + i] = m[mpos+i];
  38665. this.leftover += bytes;
  38666. }
  38667. };
  38668. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  38669. var s = new poly1305(k);
  38670. s.update(m, mpos, n);
  38671. s.finish(out, outpos);
  38672. return 0;
  38673. }
  38674. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  38675. var x = new Uint8Array(16);
  38676. crypto_onetimeauth(x,0,m,mpos,n,k);
  38677. return crypto_verify_16(h,hpos,x,0);
  38678. }
  38679. function crypto_secretbox(c,m,d,n,k) {
  38680. var i;
  38681. if (d < 32) return -1;
  38682. crypto_stream_xor(c,0,m,0,d,n,k);
  38683. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  38684. for (i = 0; i < 16; i++) c[i] = 0;
  38685. return 0;
  38686. }
  38687. function crypto_secretbox_open(m,c,d,n,k) {
  38688. var i;
  38689. var x = new Uint8Array(32);
  38690. if (d < 32) return -1;
  38691. crypto_stream(x,0,32,n,k);
  38692. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  38693. crypto_stream_xor(m,0,c,0,d,n,k);
  38694. for (i = 0; i < 32; i++) m[i] = 0;
  38695. return 0;
  38696. }
  38697. function set25519(r, a) {
  38698. var i;
  38699. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  38700. }
  38701. function car25519(o) {
  38702. var i, v, c = 1;
  38703. for (i = 0; i < 16; i++) {
  38704. v = o[i] + c + 65535;
  38705. c = Math.floor(v / 65536);
  38706. o[i] = v - c * 65536;
  38707. }
  38708. o[0] += c-1 + 37 * (c-1);
  38709. }
  38710. function sel25519(p, q, b) {
  38711. var t, c = ~(b-1);
  38712. for (var i = 0; i < 16; i++) {
  38713. t = c & (p[i] ^ q[i]);
  38714. p[i] ^= t;
  38715. q[i] ^= t;
  38716. }
  38717. }
  38718. function pack25519(o, n) {
  38719. var i, j, b;
  38720. var m = gf(), t = gf();
  38721. for (i = 0; i < 16; i++) t[i] = n[i];
  38722. car25519(t);
  38723. car25519(t);
  38724. car25519(t);
  38725. for (j = 0; j < 2; j++) {
  38726. m[0] = t[0] - 0xffed;
  38727. for (i = 1; i < 15; i++) {
  38728. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  38729. m[i-1] &= 0xffff;
  38730. }
  38731. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  38732. b = (m[15]>>16) & 1;
  38733. m[14] &= 0xffff;
  38734. sel25519(t, m, 1-b);
  38735. }
  38736. for (i = 0; i < 16; i++) {
  38737. o[2*i] = t[i] & 0xff;
  38738. o[2*i+1] = t[i]>>8;
  38739. }
  38740. }
  38741. function neq25519(a, b) {
  38742. var c = new Uint8Array(32), d = new Uint8Array(32);
  38743. pack25519(c, a);
  38744. pack25519(d, b);
  38745. return crypto_verify_32(c, 0, d, 0);
  38746. }
  38747. function par25519(a) {
  38748. var d = new Uint8Array(32);
  38749. pack25519(d, a);
  38750. return d[0] & 1;
  38751. }
  38752. function unpack25519(o, n) {
  38753. var i;
  38754. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  38755. o[15] &= 0x7fff;
  38756. }
  38757. function A(o, a, b) {
  38758. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  38759. }
  38760. function Z(o, a, b) {
  38761. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  38762. }
  38763. function M(o, a, b) {
  38764. var v, c,
  38765. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  38766. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  38767. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  38768. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  38769. b0 = b[0],
  38770. b1 = b[1],
  38771. b2 = b[2],
  38772. b3 = b[3],
  38773. b4 = b[4],
  38774. b5 = b[5],
  38775. b6 = b[6],
  38776. b7 = b[7],
  38777. b8 = b[8],
  38778. b9 = b[9],
  38779. b10 = b[10],
  38780. b11 = b[11],
  38781. b12 = b[12],
  38782. b13 = b[13],
  38783. b14 = b[14],
  38784. b15 = b[15];
  38785. v = a[0];
  38786. t0 += v * b0;
  38787. t1 += v * b1;
  38788. t2 += v * b2;
  38789. t3 += v * b3;
  38790. t4 += v * b4;
  38791. t5 += v * b5;
  38792. t6 += v * b6;
  38793. t7 += v * b7;
  38794. t8 += v * b8;
  38795. t9 += v * b9;
  38796. t10 += v * b10;
  38797. t11 += v * b11;
  38798. t12 += v * b12;
  38799. t13 += v * b13;
  38800. t14 += v * b14;
  38801. t15 += v * b15;
  38802. v = a[1];
  38803. t1 += v * b0;
  38804. t2 += v * b1;
  38805. t3 += v * b2;
  38806. t4 += v * b3;
  38807. t5 += v * b4;
  38808. t6 += v * b5;
  38809. t7 += v * b6;
  38810. t8 += v * b7;
  38811. t9 += v * b8;
  38812. t10 += v * b9;
  38813. t11 += v * b10;
  38814. t12 += v * b11;
  38815. t13 += v * b12;
  38816. t14 += v * b13;
  38817. t15 += v * b14;
  38818. t16 += v * b15;
  38819. v = a[2];
  38820. t2 += v * b0;
  38821. t3 += v * b1;
  38822. t4 += v * b2;
  38823. t5 += v * b3;
  38824. t6 += v * b4;
  38825. t7 += v * b5;
  38826. t8 += v * b6;
  38827. t9 += v * b7;
  38828. t10 += v * b8;
  38829. t11 += v * b9;
  38830. t12 += v * b10;
  38831. t13 += v * b11;
  38832. t14 += v * b12;
  38833. t15 += v * b13;
  38834. t16 += v * b14;
  38835. t17 += v * b15;
  38836. v = a[3];
  38837. t3 += v * b0;
  38838. t4 += v * b1;
  38839. t5 += v * b2;
  38840. t6 += v * b3;
  38841. t7 += v * b4;
  38842. t8 += v * b5;
  38843. t9 += v * b6;
  38844. t10 += v * b7;
  38845. t11 += v * b8;
  38846. t12 += v * b9;
  38847. t13 += v * b10;
  38848. t14 += v * b11;
  38849. t15 += v * b12;
  38850. t16 += v * b13;
  38851. t17 += v * b14;
  38852. t18 += v * b15;
  38853. v = a[4];
  38854. t4 += v * b0;
  38855. t5 += v * b1;
  38856. t6 += v * b2;
  38857. t7 += v * b3;
  38858. t8 += v * b4;
  38859. t9 += v * b5;
  38860. t10 += v * b6;
  38861. t11 += v * b7;
  38862. t12 += v * b8;
  38863. t13 += v * b9;
  38864. t14 += v * b10;
  38865. t15 += v * b11;
  38866. t16 += v * b12;
  38867. t17 += v * b13;
  38868. t18 += v * b14;
  38869. t19 += v * b15;
  38870. v = a[5];
  38871. t5 += v * b0;
  38872. t6 += v * b1;
  38873. t7 += v * b2;
  38874. t8 += v * b3;
  38875. t9 += v * b4;
  38876. t10 += v * b5;
  38877. t11 += v * b6;
  38878. t12 += v * b7;
  38879. t13 += v * b8;
  38880. t14 += v * b9;
  38881. t15 += v * b10;
  38882. t16 += v * b11;
  38883. t17 += v * b12;
  38884. t18 += v * b13;
  38885. t19 += v * b14;
  38886. t20 += v * b15;
  38887. v = a[6];
  38888. t6 += v * b0;
  38889. t7 += v * b1;
  38890. t8 += v * b2;
  38891. t9 += v * b3;
  38892. t10 += v * b4;
  38893. t11 += v * b5;
  38894. t12 += v * b6;
  38895. t13 += v * b7;
  38896. t14 += v * b8;
  38897. t15 += v * b9;
  38898. t16 += v * b10;
  38899. t17 += v * b11;
  38900. t18 += v * b12;
  38901. t19 += v * b13;
  38902. t20 += v * b14;
  38903. t21 += v * b15;
  38904. v = a[7];
  38905. t7 += v * b0;
  38906. t8 += v * b1;
  38907. t9 += v * b2;
  38908. t10 += v * b3;
  38909. t11 += v * b4;
  38910. t12 += v * b5;
  38911. t13 += v * b6;
  38912. t14 += v * b7;
  38913. t15 += v * b8;
  38914. t16 += v * b9;
  38915. t17 += v * b10;
  38916. t18 += v * b11;
  38917. t19 += v * b12;
  38918. t20 += v * b13;
  38919. t21 += v * b14;
  38920. t22 += v * b15;
  38921. v = a[8];
  38922. t8 += v * b0;
  38923. t9 += v * b1;
  38924. t10 += v * b2;
  38925. t11 += v * b3;
  38926. t12 += v * b4;
  38927. t13 += v * b5;
  38928. t14 += v * b6;
  38929. t15 += v * b7;
  38930. t16 += v * b8;
  38931. t17 += v * b9;
  38932. t18 += v * b10;
  38933. t19 += v * b11;
  38934. t20 += v * b12;
  38935. t21 += v * b13;
  38936. t22 += v * b14;
  38937. t23 += v * b15;
  38938. v = a[9];
  38939. t9 += v * b0;
  38940. t10 += v * b1;
  38941. t11 += v * b2;
  38942. t12 += v * b3;
  38943. t13 += v * b4;
  38944. t14 += v * b5;
  38945. t15 += v * b6;
  38946. t16 += v * b7;
  38947. t17 += v * b8;
  38948. t18 += v * b9;
  38949. t19 += v * b10;
  38950. t20 += v * b11;
  38951. t21 += v * b12;
  38952. t22 += v * b13;
  38953. t23 += v * b14;
  38954. t24 += v * b15;
  38955. v = a[10];
  38956. t10 += v * b0;
  38957. t11 += v * b1;
  38958. t12 += v * b2;
  38959. t13 += v * b3;
  38960. t14 += v * b4;
  38961. t15 += v * b5;
  38962. t16 += v * b6;
  38963. t17 += v * b7;
  38964. t18 += v * b8;
  38965. t19 += v * b9;
  38966. t20 += v * b10;
  38967. t21 += v * b11;
  38968. t22 += v * b12;
  38969. t23 += v * b13;
  38970. t24 += v * b14;
  38971. t25 += v * b15;
  38972. v = a[11];
  38973. t11 += v * b0;
  38974. t12 += v * b1;
  38975. t13 += v * b2;
  38976. t14 += v * b3;
  38977. t15 += v * b4;
  38978. t16 += v * b5;
  38979. t17 += v * b6;
  38980. t18 += v * b7;
  38981. t19 += v * b8;
  38982. t20 += v * b9;
  38983. t21 += v * b10;
  38984. t22 += v * b11;
  38985. t23 += v * b12;
  38986. t24 += v * b13;
  38987. t25 += v * b14;
  38988. t26 += v * b15;
  38989. v = a[12];
  38990. t12 += v * b0;
  38991. t13 += v * b1;
  38992. t14 += v * b2;
  38993. t15 += v * b3;
  38994. t16 += v * b4;
  38995. t17 += v * b5;
  38996. t18 += v * b6;
  38997. t19 += v * b7;
  38998. t20 += v * b8;
  38999. t21 += v * b9;
  39000. t22 += v * b10;
  39001. t23 += v * b11;
  39002. t24 += v * b12;
  39003. t25 += v * b13;
  39004. t26 += v * b14;
  39005. t27 += v * b15;
  39006. v = a[13];
  39007. t13 += v * b0;
  39008. t14 += v * b1;
  39009. t15 += v * b2;
  39010. t16 += v * b3;
  39011. t17 += v * b4;
  39012. t18 += v * b5;
  39013. t19 += v * b6;
  39014. t20 += v * b7;
  39015. t21 += v * b8;
  39016. t22 += v * b9;
  39017. t23 += v * b10;
  39018. t24 += v * b11;
  39019. t25 += v * b12;
  39020. t26 += v * b13;
  39021. t27 += v * b14;
  39022. t28 += v * b15;
  39023. v = a[14];
  39024. t14 += v * b0;
  39025. t15 += v * b1;
  39026. t16 += v * b2;
  39027. t17 += v * b3;
  39028. t18 += v * b4;
  39029. t19 += v * b5;
  39030. t20 += v * b6;
  39031. t21 += v * b7;
  39032. t22 += v * b8;
  39033. t23 += v * b9;
  39034. t24 += v * b10;
  39035. t25 += v * b11;
  39036. t26 += v * b12;
  39037. t27 += v * b13;
  39038. t28 += v * b14;
  39039. t29 += v * b15;
  39040. v = a[15];
  39041. t15 += v * b0;
  39042. t16 += v * b1;
  39043. t17 += v * b2;
  39044. t18 += v * b3;
  39045. t19 += v * b4;
  39046. t20 += v * b5;
  39047. t21 += v * b6;
  39048. t22 += v * b7;
  39049. t23 += v * b8;
  39050. t24 += v * b9;
  39051. t25 += v * b10;
  39052. t26 += v * b11;
  39053. t27 += v * b12;
  39054. t28 += v * b13;
  39055. t29 += v * b14;
  39056. t30 += v * b15;
  39057. t0 += 38 * t16;
  39058. t1 += 38 * t17;
  39059. t2 += 38 * t18;
  39060. t3 += 38 * t19;
  39061. t4 += 38 * t20;
  39062. t5 += 38 * t21;
  39063. t6 += 38 * t22;
  39064. t7 += 38 * t23;
  39065. t8 += 38 * t24;
  39066. t9 += 38 * t25;
  39067. t10 += 38 * t26;
  39068. t11 += 38 * t27;
  39069. t12 += 38 * t28;
  39070. t13 += 38 * t29;
  39071. t14 += 38 * t30;
  39072. // t15 left as is
  39073. // first car
  39074. c = 1;
  39075. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  39076. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  39077. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  39078. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  39079. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  39080. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  39081. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  39082. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  39083. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  39084. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  39085. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  39086. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  39087. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  39088. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  39089. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  39090. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  39091. t0 += c-1 + 37 * (c-1);
  39092. // second car
  39093. c = 1;
  39094. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  39095. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  39096. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  39097. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  39098. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  39099. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  39100. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  39101. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  39102. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  39103. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  39104. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  39105. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  39106. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  39107. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  39108. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  39109. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  39110. t0 += c-1 + 37 * (c-1);
  39111. o[ 0] = t0;
  39112. o[ 1] = t1;
  39113. o[ 2] = t2;
  39114. o[ 3] = t3;
  39115. o[ 4] = t4;
  39116. o[ 5] = t5;
  39117. o[ 6] = t6;
  39118. o[ 7] = t7;
  39119. o[ 8] = t8;
  39120. o[ 9] = t9;
  39121. o[10] = t10;
  39122. o[11] = t11;
  39123. o[12] = t12;
  39124. o[13] = t13;
  39125. o[14] = t14;
  39126. o[15] = t15;
  39127. }
  39128. function S(o, a) {
  39129. M(o, a, a);
  39130. }
  39131. function inv25519(o, i) {
  39132. var c = gf();
  39133. var a;
  39134. for (a = 0; a < 16; a++) c[a] = i[a];
  39135. for (a = 253; a >= 0; a--) {
  39136. S(c, c);
  39137. if(a !== 2 && a !== 4) M(c, c, i);
  39138. }
  39139. for (a = 0; a < 16; a++) o[a] = c[a];
  39140. }
  39141. function pow2523(o, i) {
  39142. var c = gf();
  39143. var a;
  39144. for (a = 0; a < 16; a++) c[a] = i[a];
  39145. for (a = 250; a >= 0; a--) {
  39146. S(c, c);
  39147. if(a !== 1) M(c, c, i);
  39148. }
  39149. for (a = 0; a < 16; a++) o[a] = c[a];
  39150. }
  39151. function crypto_scalarmult(q, n, p) {
  39152. var z = new Uint8Array(32);
  39153. var x = new Float64Array(80), r, i;
  39154. var a = gf(), b = gf(), c = gf(),
  39155. d = gf(), e = gf(), f = gf();
  39156. for (i = 0; i < 31; i++) z[i] = n[i];
  39157. z[31]=(n[31]&127)|64;
  39158. z[0]&=248;
  39159. unpack25519(x,p);
  39160. for (i = 0; i < 16; i++) {
  39161. b[i]=x[i];
  39162. d[i]=a[i]=c[i]=0;
  39163. }
  39164. a[0]=d[0]=1;
  39165. for (i=254; i>=0; --i) {
  39166. r=(z[i>>>3]>>>(i&7))&1;
  39167. sel25519(a,b,r);
  39168. sel25519(c,d,r);
  39169. A(e,a,c);
  39170. Z(a,a,c);
  39171. A(c,b,d);
  39172. Z(b,b,d);
  39173. S(d,e);
  39174. S(f,a);
  39175. M(a,c,a);
  39176. M(c,b,e);
  39177. A(e,a,c);
  39178. Z(a,a,c);
  39179. S(b,a);
  39180. Z(c,d,f);
  39181. M(a,c,_121665);
  39182. A(a,a,d);
  39183. M(c,c,a);
  39184. M(a,d,f);
  39185. M(d,b,x);
  39186. S(b,e);
  39187. sel25519(a,b,r);
  39188. sel25519(c,d,r);
  39189. }
  39190. for (i = 0; i < 16; i++) {
  39191. x[i+16]=a[i];
  39192. x[i+32]=c[i];
  39193. x[i+48]=b[i];
  39194. x[i+64]=d[i];
  39195. }
  39196. var x32 = x.subarray(32);
  39197. var x16 = x.subarray(16);
  39198. inv25519(x32,x32);
  39199. M(x16,x16,x32);
  39200. pack25519(q,x16);
  39201. return 0;
  39202. }
  39203. function crypto_scalarmult_base(q, n) {
  39204. return crypto_scalarmult(q, n, _9);
  39205. }
  39206. function crypto_box_keypair(y, x) {
  39207. randombytes(x, 32);
  39208. return crypto_scalarmult_base(y, x);
  39209. }
  39210. function crypto_box_beforenm(k, y, x) {
  39211. var s = new Uint8Array(32);
  39212. crypto_scalarmult(s, x, y);
  39213. return crypto_core_hsalsa20(k, _0, s, sigma);
  39214. }
  39215. var crypto_box_afternm = crypto_secretbox;
  39216. var crypto_box_open_afternm = crypto_secretbox_open;
  39217. function crypto_box(c, m, d, n, y, x) {
  39218. var k = new Uint8Array(32);
  39219. crypto_box_beforenm(k, y, x);
  39220. return crypto_box_afternm(c, m, d, n, k);
  39221. }
  39222. function crypto_box_open(m, c, d, n, y, x) {
  39223. var k = new Uint8Array(32);
  39224. crypto_box_beforenm(k, y, x);
  39225. return crypto_box_open_afternm(m, c, d, n, k);
  39226. }
  39227. var K = [
  39228. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  39229. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  39230. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  39231. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  39232. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  39233. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  39234. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  39235. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  39236. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  39237. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  39238. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  39239. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  39240. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  39241. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  39242. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  39243. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  39244. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  39245. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  39246. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  39247. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  39248. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  39249. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  39250. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  39251. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  39252. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  39253. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  39254. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  39255. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  39256. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  39257. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  39258. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  39259. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  39260. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  39261. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  39262. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  39263. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  39264. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  39265. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  39266. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  39267. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  39268. ];
  39269. function crypto_hashblocks_hl(hh, hl, m, n) {
  39270. var wh = new Int32Array(16), wl = new Int32Array(16),
  39271. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  39272. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  39273. th, tl, i, j, h, l, a, b, c, d;
  39274. var ah0 = hh[0],
  39275. ah1 = hh[1],
  39276. ah2 = hh[2],
  39277. ah3 = hh[3],
  39278. ah4 = hh[4],
  39279. ah5 = hh[5],
  39280. ah6 = hh[6],
  39281. ah7 = hh[7],
  39282. al0 = hl[0],
  39283. al1 = hl[1],
  39284. al2 = hl[2],
  39285. al3 = hl[3],
  39286. al4 = hl[4],
  39287. al5 = hl[5],
  39288. al6 = hl[6],
  39289. al7 = hl[7];
  39290. var pos = 0;
  39291. while (n >= 128) {
  39292. for (i = 0; i < 16; i++) {
  39293. j = 8 * i + pos;
  39294. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  39295. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  39296. }
  39297. for (i = 0; i < 80; i++) {
  39298. bh0 = ah0;
  39299. bh1 = ah1;
  39300. bh2 = ah2;
  39301. bh3 = ah3;
  39302. bh4 = ah4;
  39303. bh5 = ah5;
  39304. bh6 = ah6;
  39305. bh7 = ah7;
  39306. bl0 = al0;
  39307. bl1 = al1;
  39308. bl2 = al2;
  39309. bl3 = al3;
  39310. bl4 = al4;
  39311. bl5 = al5;
  39312. bl6 = al6;
  39313. bl7 = al7;
  39314. // add
  39315. h = ah7;
  39316. l = al7;
  39317. a = l & 0xffff; b = l >>> 16;
  39318. c = h & 0xffff; d = h >>> 16;
  39319. // Sigma1
  39320. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  39321. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  39322. a += l & 0xffff; b += l >>> 16;
  39323. c += h & 0xffff; d += h >>> 16;
  39324. // Ch
  39325. h = (ah4 & ah5) ^ (~ah4 & ah6);
  39326. l = (al4 & al5) ^ (~al4 & al6);
  39327. a += l & 0xffff; b += l >>> 16;
  39328. c += h & 0xffff; d += h >>> 16;
  39329. // K
  39330. h = K[i*2];
  39331. l = K[i*2+1];
  39332. a += l & 0xffff; b += l >>> 16;
  39333. c += h & 0xffff; d += h >>> 16;
  39334. // w
  39335. h = wh[i%16];
  39336. l = wl[i%16];
  39337. a += l & 0xffff; b += l >>> 16;
  39338. c += h & 0xffff; d += h >>> 16;
  39339. b += a >>> 16;
  39340. c += b >>> 16;
  39341. d += c >>> 16;
  39342. th = c & 0xffff | d << 16;
  39343. tl = a & 0xffff | b << 16;
  39344. // add
  39345. h = th;
  39346. l = tl;
  39347. a = l & 0xffff; b = l >>> 16;
  39348. c = h & 0xffff; d = h >>> 16;
  39349. // Sigma0
  39350. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  39351. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  39352. a += l & 0xffff; b += l >>> 16;
  39353. c += h & 0xffff; d += h >>> 16;
  39354. // Maj
  39355. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  39356. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  39357. a += l & 0xffff; b += l >>> 16;
  39358. c += h & 0xffff; d += h >>> 16;
  39359. b += a >>> 16;
  39360. c += b >>> 16;
  39361. d += c >>> 16;
  39362. bh7 = (c & 0xffff) | (d << 16);
  39363. bl7 = (a & 0xffff) | (b << 16);
  39364. // add
  39365. h = bh3;
  39366. l = bl3;
  39367. a = l & 0xffff; b = l >>> 16;
  39368. c = h & 0xffff; d = h >>> 16;
  39369. h = th;
  39370. l = tl;
  39371. a += l & 0xffff; b += l >>> 16;
  39372. c += h & 0xffff; d += h >>> 16;
  39373. b += a >>> 16;
  39374. c += b >>> 16;
  39375. d += c >>> 16;
  39376. bh3 = (c & 0xffff) | (d << 16);
  39377. bl3 = (a & 0xffff) | (b << 16);
  39378. ah1 = bh0;
  39379. ah2 = bh1;
  39380. ah3 = bh2;
  39381. ah4 = bh3;
  39382. ah5 = bh4;
  39383. ah6 = bh5;
  39384. ah7 = bh6;
  39385. ah0 = bh7;
  39386. al1 = bl0;
  39387. al2 = bl1;
  39388. al3 = bl2;
  39389. al4 = bl3;
  39390. al5 = bl4;
  39391. al6 = bl5;
  39392. al7 = bl6;
  39393. al0 = bl7;
  39394. if (i%16 === 15) {
  39395. for (j = 0; j < 16; j++) {
  39396. // add
  39397. h = wh[j];
  39398. l = wl[j];
  39399. a = l & 0xffff; b = l >>> 16;
  39400. c = h & 0xffff; d = h >>> 16;
  39401. h = wh[(j+9)%16];
  39402. l = wl[(j+9)%16];
  39403. a += l & 0xffff; b += l >>> 16;
  39404. c += h & 0xffff; d += h >>> 16;
  39405. // sigma0
  39406. th = wh[(j+1)%16];
  39407. tl = wl[(j+1)%16];
  39408. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  39409. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  39410. a += l & 0xffff; b += l >>> 16;
  39411. c += h & 0xffff; d += h >>> 16;
  39412. // sigma1
  39413. th = wh[(j+14)%16];
  39414. tl = wl[(j+14)%16];
  39415. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  39416. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  39417. a += l & 0xffff; b += l >>> 16;
  39418. c += h & 0xffff; d += h >>> 16;
  39419. b += a >>> 16;
  39420. c += b >>> 16;
  39421. d += c >>> 16;
  39422. wh[j] = (c & 0xffff) | (d << 16);
  39423. wl[j] = (a & 0xffff) | (b << 16);
  39424. }
  39425. }
  39426. }
  39427. // add
  39428. h = ah0;
  39429. l = al0;
  39430. a = l & 0xffff; b = l >>> 16;
  39431. c = h & 0xffff; d = h >>> 16;
  39432. h = hh[0];
  39433. l = hl[0];
  39434. a += l & 0xffff; b += l >>> 16;
  39435. c += h & 0xffff; d += h >>> 16;
  39436. b += a >>> 16;
  39437. c += b >>> 16;
  39438. d += c >>> 16;
  39439. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  39440. hl[0] = al0 = (a & 0xffff) | (b << 16);
  39441. h = ah1;
  39442. l = al1;
  39443. a = l & 0xffff; b = l >>> 16;
  39444. c = h & 0xffff; d = h >>> 16;
  39445. h = hh[1];
  39446. l = hl[1];
  39447. a += l & 0xffff; b += l >>> 16;
  39448. c += h & 0xffff; d += h >>> 16;
  39449. b += a >>> 16;
  39450. c += b >>> 16;
  39451. d += c >>> 16;
  39452. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  39453. hl[1] = al1 = (a & 0xffff) | (b << 16);
  39454. h = ah2;
  39455. l = al2;
  39456. a = l & 0xffff; b = l >>> 16;
  39457. c = h & 0xffff; d = h >>> 16;
  39458. h = hh[2];
  39459. l = hl[2];
  39460. a += l & 0xffff; b += l >>> 16;
  39461. c += h & 0xffff; d += h >>> 16;
  39462. b += a >>> 16;
  39463. c += b >>> 16;
  39464. d += c >>> 16;
  39465. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  39466. hl[2] = al2 = (a & 0xffff) | (b << 16);
  39467. h = ah3;
  39468. l = al3;
  39469. a = l & 0xffff; b = l >>> 16;
  39470. c = h & 0xffff; d = h >>> 16;
  39471. h = hh[3];
  39472. l = hl[3];
  39473. a += l & 0xffff; b += l >>> 16;
  39474. c += h & 0xffff; d += h >>> 16;
  39475. b += a >>> 16;
  39476. c += b >>> 16;
  39477. d += c >>> 16;
  39478. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  39479. hl[3] = al3 = (a & 0xffff) | (b << 16);
  39480. h = ah4;
  39481. l = al4;
  39482. a = l & 0xffff; b = l >>> 16;
  39483. c = h & 0xffff; d = h >>> 16;
  39484. h = hh[4];
  39485. l = hl[4];
  39486. a += l & 0xffff; b += l >>> 16;
  39487. c += h & 0xffff; d += h >>> 16;
  39488. b += a >>> 16;
  39489. c += b >>> 16;
  39490. d += c >>> 16;
  39491. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  39492. hl[4] = al4 = (a & 0xffff) | (b << 16);
  39493. h = ah5;
  39494. l = al5;
  39495. a = l & 0xffff; b = l >>> 16;
  39496. c = h & 0xffff; d = h >>> 16;
  39497. h = hh[5];
  39498. l = hl[5];
  39499. a += l & 0xffff; b += l >>> 16;
  39500. c += h & 0xffff; d += h >>> 16;
  39501. b += a >>> 16;
  39502. c += b >>> 16;
  39503. d += c >>> 16;
  39504. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  39505. hl[5] = al5 = (a & 0xffff) | (b << 16);
  39506. h = ah6;
  39507. l = al6;
  39508. a = l & 0xffff; b = l >>> 16;
  39509. c = h & 0xffff; d = h >>> 16;
  39510. h = hh[6];
  39511. l = hl[6];
  39512. a += l & 0xffff; b += l >>> 16;
  39513. c += h & 0xffff; d += h >>> 16;
  39514. b += a >>> 16;
  39515. c += b >>> 16;
  39516. d += c >>> 16;
  39517. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  39518. hl[6] = al6 = (a & 0xffff) | (b << 16);
  39519. h = ah7;
  39520. l = al7;
  39521. a = l & 0xffff; b = l >>> 16;
  39522. c = h & 0xffff; d = h >>> 16;
  39523. h = hh[7];
  39524. l = hl[7];
  39525. a += l & 0xffff; b += l >>> 16;
  39526. c += h & 0xffff; d += h >>> 16;
  39527. b += a >>> 16;
  39528. c += b >>> 16;
  39529. d += c >>> 16;
  39530. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  39531. hl[7] = al7 = (a & 0xffff) | (b << 16);
  39532. pos += 128;
  39533. n -= 128;
  39534. }
  39535. return n;
  39536. }
  39537. function crypto_hash(out, m, n) {
  39538. var hh = new Int32Array(8),
  39539. hl = new Int32Array(8),
  39540. x = new Uint8Array(256),
  39541. i, b = n;
  39542. hh[0] = 0x6a09e667;
  39543. hh[1] = 0xbb67ae85;
  39544. hh[2] = 0x3c6ef372;
  39545. hh[3] = 0xa54ff53a;
  39546. hh[4] = 0x510e527f;
  39547. hh[5] = 0x9b05688c;
  39548. hh[6] = 0x1f83d9ab;
  39549. hh[7] = 0x5be0cd19;
  39550. hl[0] = 0xf3bcc908;
  39551. hl[1] = 0x84caa73b;
  39552. hl[2] = 0xfe94f82b;
  39553. hl[3] = 0x5f1d36f1;
  39554. hl[4] = 0xade682d1;
  39555. hl[5] = 0x2b3e6c1f;
  39556. hl[6] = 0xfb41bd6b;
  39557. hl[7] = 0x137e2179;
  39558. crypto_hashblocks_hl(hh, hl, m, n);
  39559. n %= 128;
  39560. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  39561. x[n] = 128;
  39562. n = 256-128*(n<112?1:0);
  39563. x[n-9] = 0;
  39564. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  39565. crypto_hashblocks_hl(hh, hl, x, n);
  39566. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  39567. return 0;
  39568. }
  39569. function add(p, q) {
  39570. var a = gf(), b = gf(), c = gf(),
  39571. d = gf(), e = gf(), f = gf(),
  39572. g = gf(), h = gf(), t = gf();
  39573. Z(a, p[1], p[0]);
  39574. Z(t, q[1], q[0]);
  39575. M(a, a, t);
  39576. A(b, p[0], p[1]);
  39577. A(t, q[0], q[1]);
  39578. M(b, b, t);
  39579. M(c, p[3], q[3]);
  39580. M(c, c, D2);
  39581. M(d, p[2], q[2]);
  39582. A(d, d, d);
  39583. Z(e, b, a);
  39584. Z(f, d, c);
  39585. A(g, d, c);
  39586. A(h, b, a);
  39587. M(p[0], e, f);
  39588. M(p[1], h, g);
  39589. M(p[2], g, f);
  39590. M(p[3], e, h);
  39591. }
  39592. function cswap(p, q, b) {
  39593. var i;
  39594. for (i = 0; i < 4; i++) {
  39595. sel25519(p[i], q[i], b);
  39596. }
  39597. }
  39598. function pack(r, p) {
  39599. var tx = gf(), ty = gf(), zi = gf();
  39600. inv25519(zi, p[2]);
  39601. M(tx, p[0], zi);
  39602. M(ty, p[1], zi);
  39603. pack25519(r, ty);
  39604. r[31] ^= par25519(tx) << 7;
  39605. }
  39606. function scalarmult(p, q, s) {
  39607. var b, i;
  39608. set25519(p[0], gf0);
  39609. set25519(p[1], gf1);
  39610. set25519(p[2], gf1);
  39611. set25519(p[3], gf0);
  39612. for (i = 255; i >= 0; --i) {
  39613. b = (s[(i/8)|0] >> (i&7)) & 1;
  39614. cswap(p, q, b);
  39615. add(q, p);
  39616. add(p, p);
  39617. cswap(p, q, b);
  39618. }
  39619. }
  39620. function scalarbase(p, s) {
  39621. var q = [gf(), gf(), gf(), gf()];
  39622. set25519(q[0], X);
  39623. set25519(q[1], Y);
  39624. set25519(q[2], gf1);
  39625. M(q[3], X, Y);
  39626. scalarmult(p, q, s);
  39627. }
  39628. function crypto_sign_keypair(pk, sk, seeded) {
  39629. var d = new Uint8Array(64);
  39630. var p = [gf(), gf(), gf(), gf()];
  39631. var i;
  39632. if (!seeded) randombytes(sk, 32);
  39633. crypto_hash(d, sk, 32);
  39634. d[0] &= 248;
  39635. d[31] &= 127;
  39636. d[31] |= 64;
  39637. scalarbase(p, d);
  39638. pack(pk, p);
  39639. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  39640. return 0;
  39641. }
  39642. 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]);
  39643. function modL(r, x) {
  39644. var carry, i, j, k;
  39645. for (i = 63; i >= 32; --i) {
  39646. carry = 0;
  39647. for (j = i - 32, k = i - 12; j < k; ++j) {
  39648. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  39649. carry = (x[j] + 128) >> 8;
  39650. x[j] -= carry * 256;
  39651. }
  39652. x[j] += carry;
  39653. x[i] = 0;
  39654. }
  39655. carry = 0;
  39656. for (j = 0; j < 32; j++) {
  39657. x[j] += carry - (x[31] >> 4) * L[j];
  39658. carry = x[j] >> 8;
  39659. x[j] &= 255;
  39660. }
  39661. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  39662. for (i = 0; i < 32; i++) {
  39663. x[i+1] += x[i] >> 8;
  39664. r[i] = x[i] & 255;
  39665. }
  39666. }
  39667. function reduce(r) {
  39668. var x = new Float64Array(64), i;
  39669. for (i = 0; i < 64; i++) x[i] = r[i];
  39670. for (i = 0; i < 64; i++) r[i] = 0;
  39671. modL(r, x);
  39672. }
  39673. // Note: difference from C - smlen returned, not passed as argument.
  39674. function crypto_sign(sm, m, n, sk) {
  39675. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  39676. var i, j, x = new Float64Array(64);
  39677. var p = [gf(), gf(), gf(), gf()];
  39678. crypto_hash(d, sk, 32);
  39679. d[0] &= 248;
  39680. d[31] &= 127;
  39681. d[31] |= 64;
  39682. var smlen = n + 64;
  39683. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  39684. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  39685. crypto_hash(r, sm.subarray(32), n+32);
  39686. reduce(r);
  39687. scalarbase(p, r);
  39688. pack(sm, p);
  39689. for (i = 32; i < 64; i++) sm[i] = sk[i];
  39690. crypto_hash(h, sm, n + 64);
  39691. reduce(h);
  39692. for (i = 0; i < 64; i++) x[i] = 0;
  39693. for (i = 0; i < 32; i++) x[i] = r[i];
  39694. for (i = 0; i < 32; i++) {
  39695. for (j = 0; j < 32; j++) {
  39696. x[i+j] += h[i] * d[j];
  39697. }
  39698. }
  39699. modL(sm.subarray(32), x);
  39700. return smlen;
  39701. }
  39702. function unpackneg(r, p) {
  39703. var t = gf(), chk = gf(), num = gf(),
  39704. den = gf(), den2 = gf(), den4 = gf(),
  39705. den6 = gf();
  39706. set25519(r[2], gf1);
  39707. unpack25519(r[1], p);
  39708. S(num, r[1]);
  39709. M(den, num, D);
  39710. Z(num, num, r[2]);
  39711. A(den, r[2], den);
  39712. S(den2, den);
  39713. S(den4, den2);
  39714. M(den6, den4, den2);
  39715. M(t, den6, num);
  39716. M(t, t, den);
  39717. pow2523(t, t);
  39718. M(t, t, num);
  39719. M(t, t, den);
  39720. M(t, t, den);
  39721. M(r[0], t, den);
  39722. S(chk, r[0]);
  39723. M(chk, chk, den);
  39724. if (neq25519(chk, num)) M(r[0], r[0], I);
  39725. S(chk, r[0]);
  39726. M(chk, chk, den);
  39727. if (neq25519(chk, num)) return -1;
  39728. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  39729. M(r[3], r[0], r[1]);
  39730. return 0;
  39731. }
  39732. function crypto_sign_open(m, sm, n, pk) {
  39733. var i, mlen;
  39734. var t = new Uint8Array(32), h = new Uint8Array(64);
  39735. var p = [gf(), gf(), gf(), gf()],
  39736. q = [gf(), gf(), gf(), gf()];
  39737. mlen = -1;
  39738. if (n < 64) return -1;
  39739. if (unpackneg(q, pk)) return -1;
  39740. for (i = 0; i < n; i++) m[i] = sm[i];
  39741. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  39742. crypto_hash(h, m, n);
  39743. reduce(h);
  39744. scalarmult(p, q, h);
  39745. scalarbase(q, sm.subarray(32));
  39746. add(p, q);
  39747. pack(t, p);
  39748. n -= 64;
  39749. if (crypto_verify_32(sm, 0, t, 0)) {
  39750. for (i = 0; i < n; i++) m[i] = 0;
  39751. return -1;
  39752. }
  39753. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  39754. mlen = n;
  39755. return mlen;
  39756. }
  39757. var crypto_secretbox_KEYBYTES = 32,
  39758. crypto_secretbox_NONCEBYTES = 24,
  39759. crypto_secretbox_ZEROBYTES = 32,
  39760. crypto_secretbox_BOXZEROBYTES = 16,
  39761. crypto_scalarmult_BYTES = 32,
  39762. crypto_scalarmult_SCALARBYTES = 32,
  39763. crypto_box_PUBLICKEYBYTES = 32,
  39764. crypto_box_SECRETKEYBYTES = 32,
  39765. crypto_box_BEFORENMBYTES = 32,
  39766. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  39767. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  39768. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  39769. crypto_sign_BYTES = 64,
  39770. crypto_sign_PUBLICKEYBYTES = 32,
  39771. crypto_sign_SECRETKEYBYTES = 64,
  39772. crypto_sign_SEEDBYTES = 32,
  39773. crypto_hash_BYTES = 64;
  39774. nacl.lowlevel = {
  39775. crypto_core_hsalsa20: crypto_core_hsalsa20,
  39776. crypto_stream_xor: crypto_stream_xor,
  39777. crypto_stream: crypto_stream,
  39778. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  39779. crypto_stream_salsa20: crypto_stream_salsa20,
  39780. crypto_onetimeauth: crypto_onetimeauth,
  39781. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  39782. crypto_verify_16: crypto_verify_16,
  39783. crypto_verify_32: crypto_verify_32,
  39784. crypto_secretbox: crypto_secretbox,
  39785. crypto_secretbox_open: crypto_secretbox_open,
  39786. crypto_scalarmult: crypto_scalarmult,
  39787. crypto_scalarmult_base: crypto_scalarmult_base,
  39788. crypto_box_beforenm: crypto_box_beforenm,
  39789. crypto_box_afternm: crypto_box_afternm,
  39790. crypto_box: crypto_box,
  39791. crypto_box_open: crypto_box_open,
  39792. crypto_box_keypair: crypto_box_keypair,
  39793. crypto_hash: crypto_hash,
  39794. crypto_sign: crypto_sign,
  39795. crypto_sign_keypair: crypto_sign_keypair,
  39796. crypto_sign_open: crypto_sign_open,
  39797. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  39798. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  39799. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  39800. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  39801. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  39802. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  39803. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  39804. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  39805. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  39806. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  39807. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  39808. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  39809. crypto_sign_BYTES: crypto_sign_BYTES,
  39810. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  39811. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  39812. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  39813. crypto_hash_BYTES: crypto_hash_BYTES
  39814. };
  39815. /* High-level API */
  39816. function checkLengths(k, n) {
  39817. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  39818. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  39819. }
  39820. function checkBoxLengths(pk, sk) {
  39821. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  39822. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  39823. }
  39824. function checkArrayTypes() {
  39825. for (var i = 0; i < arguments.length; i++) {
  39826. if (!(arguments[i] instanceof Uint8Array))
  39827. throw new TypeError('unexpected type, use Uint8Array');
  39828. }
  39829. }
  39830. function cleanup(arr) {
  39831. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  39832. }
  39833. nacl.randomBytes = function(n) {
  39834. var b = new Uint8Array(n);
  39835. randombytes(b, n);
  39836. return b;
  39837. };
  39838. nacl.secretbox = function(msg, nonce, key) {
  39839. checkArrayTypes(msg, nonce, key);
  39840. checkLengths(key, nonce);
  39841. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  39842. var c = new Uint8Array(m.length);
  39843. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  39844. crypto_secretbox(c, m, m.length, nonce, key);
  39845. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  39846. };
  39847. nacl.secretbox.open = function(box, nonce, key) {
  39848. checkArrayTypes(box, nonce, key);
  39849. checkLengths(key, nonce);
  39850. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  39851. var m = new Uint8Array(c.length);
  39852. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  39853. if (c.length < 32) return null;
  39854. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  39855. return m.subarray(crypto_secretbox_ZEROBYTES);
  39856. };
  39857. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  39858. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  39859. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  39860. nacl.scalarMult = function(n, p) {
  39861. checkArrayTypes(n, p);
  39862. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39863. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  39864. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39865. crypto_scalarmult(q, n, p);
  39866. return q;
  39867. };
  39868. nacl.scalarMult.base = function(n) {
  39869. checkArrayTypes(n);
  39870. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39871. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39872. crypto_scalarmult_base(q, n);
  39873. return q;
  39874. };
  39875. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  39876. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  39877. nacl.box = function(msg, nonce, publicKey, secretKey) {
  39878. var k = nacl.box.before(publicKey, secretKey);
  39879. return nacl.secretbox(msg, nonce, k);
  39880. };
  39881. nacl.box.before = function(publicKey, secretKey) {
  39882. checkArrayTypes(publicKey, secretKey);
  39883. checkBoxLengths(publicKey, secretKey);
  39884. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  39885. crypto_box_beforenm(k, publicKey, secretKey);
  39886. return k;
  39887. };
  39888. nacl.box.after = nacl.secretbox;
  39889. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  39890. var k = nacl.box.before(publicKey, secretKey);
  39891. return nacl.secretbox.open(msg, nonce, k);
  39892. };
  39893. nacl.box.open.after = nacl.secretbox.open;
  39894. nacl.box.keyPair = function() {
  39895. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39896. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  39897. crypto_box_keypair(pk, sk);
  39898. return {publicKey: pk, secretKey: sk};
  39899. };
  39900. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  39901. checkArrayTypes(secretKey);
  39902. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  39903. throw new Error('bad secret key size');
  39904. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39905. crypto_scalarmult_base(pk, secretKey);
  39906. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39907. };
  39908. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  39909. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  39910. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  39911. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  39912. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  39913. nacl.sign = function(msg, secretKey) {
  39914. checkArrayTypes(msg, secretKey);
  39915. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39916. throw new Error('bad secret key size');
  39917. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  39918. crypto_sign(signedMsg, msg, msg.length, secretKey);
  39919. return signedMsg;
  39920. };
  39921. nacl.sign.open = function(signedMsg, publicKey) {
  39922. checkArrayTypes(signedMsg, publicKey);
  39923. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39924. throw new Error('bad public key size');
  39925. var tmp = new Uint8Array(signedMsg.length);
  39926. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  39927. if (mlen < 0) return null;
  39928. var m = new Uint8Array(mlen);
  39929. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  39930. return m;
  39931. };
  39932. nacl.sign.detached = function(msg, secretKey) {
  39933. var signedMsg = nacl.sign(msg, secretKey);
  39934. var sig = new Uint8Array(crypto_sign_BYTES);
  39935. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39936. return sig;
  39937. };
  39938. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39939. checkArrayTypes(msg, sig, publicKey);
  39940. if (sig.length !== crypto_sign_BYTES)
  39941. throw new Error('bad signature size');
  39942. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39943. throw new Error('bad public key size');
  39944. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39945. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39946. var i;
  39947. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39948. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39949. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39950. };
  39951. nacl.sign.keyPair = function() {
  39952. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39953. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39954. crypto_sign_keypair(pk, sk);
  39955. return {publicKey: pk, secretKey: sk};
  39956. };
  39957. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39958. checkArrayTypes(secretKey);
  39959. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39960. throw new Error('bad secret key size');
  39961. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39962. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39963. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39964. };
  39965. nacl.sign.keyPair.fromSeed = function(seed) {
  39966. checkArrayTypes(seed);
  39967. if (seed.length !== crypto_sign_SEEDBYTES)
  39968. throw new Error('bad seed size');
  39969. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39970. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39971. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39972. crypto_sign_keypair(pk, sk, true);
  39973. return {publicKey: pk, secretKey: sk};
  39974. };
  39975. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39976. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39977. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39978. nacl.sign.signatureLength = crypto_sign_BYTES;
  39979. nacl.hash = function(msg) {
  39980. checkArrayTypes(msg);
  39981. var h = new Uint8Array(crypto_hash_BYTES);
  39982. crypto_hash(h, msg, msg.length);
  39983. return h;
  39984. };
  39985. nacl.hash.hashLength = crypto_hash_BYTES;
  39986. nacl.verify = function(x, y) {
  39987. checkArrayTypes(x, y);
  39988. // Zero length arguments are considered not equal.
  39989. if (x.length === 0 || y.length === 0) return false;
  39990. if (x.length !== y.length) return false;
  39991. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39992. };
  39993. nacl.setPRNG = function(fn) {
  39994. randombytes = fn;
  39995. };
  39996. (function() {
  39997. // Initialize PRNG if environment provides CSPRNG.
  39998. // If not, methods calling randombytes will throw.
  39999. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  40000. if (crypto && crypto.getRandomValues) {
  40001. // Browsers.
  40002. var QUOTA = 65536;
  40003. nacl.setPRNG(function(x, n) {
  40004. var i, v = new Uint8Array(n);
  40005. for (i = 0; i < n; i += QUOTA) {
  40006. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  40007. }
  40008. for (i = 0; i < n; i++) x[i] = v[i];
  40009. cleanup(v);
  40010. });
  40011. } else if (true) {
  40012. // Node.js.
  40013. crypto = __webpack_require__(3);
  40014. if (crypto && crypto.randomBytes) {
  40015. nacl.setPRNG(function(x, n) {
  40016. var i, v = crypto.randomBytes(n);
  40017. for (i = 0; i < n; i++) x[i] = v[i];
  40018. cleanup(v);
  40019. });
  40020. }
  40021. }
  40022. })();
  40023. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  40024. /***/ }),
  40025. /* 1 */
  40026. /***/ (function(module, exports, __webpack_require__) {
  40027. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  40028. // Public domain.
  40029. (function(root, f) {
  40030. 'use strict';
  40031. if ( true && module.exports) module.exports = f();
  40032. else if (root.nacl) root.nacl.util = f();
  40033. else {
  40034. root.nacl = {};
  40035. root.nacl.util = f();
  40036. }
  40037. }(this, function() {
  40038. 'use strict';
  40039. var util = {};
  40040. function validateBase64(s) {
  40041. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  40042. throw new TypeError('invalid encoding');
  40043. }
  40044. }
  40045. util.decodeUTF8 = function(s) {
  40046. if (typeof s !== 'string') throw new TypeError('expected string');
  40047. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  40048. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  40049. return b;
  40050. };
  40051. util.encodeUTF8 = function(arr) {
  40052. var i, s = [];
  40053. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  40054. return decodeURIComponent(escape(s.join('')));
  40055. };
  40056. if (typeof atob === 'undefined') {
  40057. // Node.js
  40058. if (typeof Buffer.from !== 'undefined') {
  40059. // Node v6 and later
  40060. util.encodeBase64 = function (arr) { // v6 and later
  40061. return Buffer.from(arr).toString('base64');
  40062. };
  40063. util.decodeBase64 = function (s) {
  40064. validateBase64(s);
  40065. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  40066. };
  40067. } else {
  40068. // Node earlier than v6
  40069. util.encodeBase64 = function (arr) { // v6 and later
  40070. return (new Buffer(arr)).toString('base64');
  40071. };
  40072. util.decodeBase64 = function(s) {
  40073. validateBase64(s);
  40074. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  40075. };
  40076. }
  40077. } else {
  40078. // Browsers
  40079. util.encodeBase64 = function(arr) {
  40080. var i, s = [], len = arr.length;
  40081. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  40082. return btoa(s.join(''));
  40083. };
  40084. util.decodeBase64 = function(s) {
  40085. validateBase64(s);
  40086. var i, d = atob(s), b = new Uint8Array(d.length);
  40087. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  40088. return b;
  40089. };
  40090. }
  40091. return util;
  40092. }));
  40093. /***/ }),
  40094. /* 2 */
  40095. /***/ (function(module, exports, __webpack_require__) {
  40096. // required so we don't have to do require('pusher').default etc.
  40097. module.exports = __webpack_require__(4).default;
  40098. /***/ }),
  40099. /* 3 */
  40100. /***/ (function(module, exports) {
  40101. /* (ignored) */
  40102. /***/ }),
  40103. /* 4 */
  40104. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  40105. "use strict";
  40106. __webpack_require__.r(__webpack_exports__);
  40107. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  40108. var ScriptReceiverFactory = (function () {
  40109. function ScriptReceiverFactory(prefix, name) {
  40110. this.lastId = 0;
  40111. this.prefix = prefix;
  40112. this.name = name;
  40113. }
  40114. ScriptReceiverFactory.prototype.create = function (callback) {
  40115. this.lastId++;
  40116. var number = this.lastId;
  40117. var id = this.prefix + number;
  40118. var name = this.name + "[" + number + "]";
  40119. var called = false;
  40120. var callbackWrapper = function () {
  40121. if (!called) {
  40122. callback.apply(null, arguments);
  40123. called = true;
  40124. }
  40125. };
  40126. this[number] = callbackWrapper;
  40127. return { number: number, id: id, name: name, callback: callbackWrapper };
  40128. };
  40129. ScriptReceiverFactory.prototype.remove = function (receiver) {
  40130. delete this[receiver.number];
  40131. };
  40132. return ScriptReceiverFactory;
  40133. }());
  40134. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  40135. // CONCATENATED MODULE: ./src/core/defaults.ts
  40136. var Defaults = {
  40137. VERSION: "5.0.3",
  40138. PROTOCOL: 7,
  40139. host: 'ws.pusherapp.com',
  40140. ws_port: 80,
  40141. wss_port: 443,
  40142. ws_path: '',
  40143. sockjs_host: 'sockjs.pusher.com',
  40144. sockjs_http_port: 80,
  40145. sockjs_https_port: 443,
  40146. sockjs_path: '/pusher',
  40147. stats_host: 'stats.pusher.com',
  40148. channel_auth_endpoint: '/pusher/auth',
  40149. channel_auth_transport: 'ajax',
  40150. activity_timeout: 120000,
  40151. pong_timeout: 30000,
  40152. unavailable_timeout: 10000,
  40153. cdn_http: "http://js.pusher.com",
  40154. cdn_https: "https://js.pusher.com",
  40155. dependency_suffix: ""
  40156. };
  40157. /* harmony default export */ var defaults = (Defaults);
  40158. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  40159. var dependency_loader_DependencyLoader = (function () {
  40160. function DependencyLoader(options) {
  40161. this.options = options;
  40162. this.receivers = options.receivers || ScriptReceivers;
  40163. this.loading = {};
  40164. }
  40165. DependencyLoader.prototype.load = function (name, options, callback) {
  40166. var self = this;
  40167. if (self.loading[name] && self.loading[name].length > 0) {
  40168. self.loading[name].push(callback);
  40169. }
  40170. else {
  40171. self.loading[name] = [callback];
  40172. var request = runtime.createScriptRequest(self.getPath(name, options));
  40173. var receiver = self.receivers.create(function (error) {
  40174. self.receivers.remove(receiver);
  40175. if (self.loading[name]) {
  40176. var callbacks = self.loading[name];
  40177. delete self.loading[name];
  40178. var successCallback = function (wasSuccessful) {
  40179. if (!wasSuccessful) {
  40180. request.cleanup();
  40181. }
  40182. };
  40183. for (var i = 0; i < callbacks.length; i++) {
  40184. callbacks[i](error, successCallback);
  40185. }
  40186. }
  40187. });
  40188. request.send(receiver);
  40189. }
  40190. };
  40191. DependencyLoader.prototype.getRoot = function (options) {
  40192. var cdn;
  40193. var protocol = runtime.getDocument().location.protocol;
  40194. if ((options && options.useTLS) || protocol === "https:") {
  40195. cdn = this.options.cdn_https;
  40196. }
  40197. else {
  40198. cdn = this.options.cdn_http;
  40199. }
  40200. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  40201. };
  40202. DependencyLoader.prototype.getPath = function (name, options) {
  40203. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  40204. };
  40205. ;
  40206. return DependencyLoader;
  40207. }());
  40208. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  40209. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  40210. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  40211. var Dependencies = new dependency_loader({
  40212. cdn_http: defaults.cdn_http,
  40213. cdn_https: defaults.cdn_https,
  40214. version: defaults.VERSION,
  40215. suffix: defaults.dependency_suffix,
  40216. receivers: DependenciesReceivers
  40217. });
  40218. // CONCATENATED MODULE: ./src/core/base64.ts
  40219. function encode(s) {
  40220. return btoa(utob(s));
  40221. }
  40222. var fromCharCode = String.fromCharCode;
  40223. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  40224. var b64tab = {};
  40225. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  40226. b64tab[b64chars.charAt(base64_i)] = base64_i;
  40227. }
  40228. var cb_utob = function (c) {
  40229. var cc = c.charCodeAt(0);
  40230. return cc < 0x80
  40231. ? c
  40232. : cc < 0x800
  40233. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  40234. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  40235. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  40236. fromCharCode(0x80 | (cc & 0x3f));
  40237. };
  40238. var utob = function (u) {
  40239. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  40240. };
  40241. var cb_encode = function (ccc) {
  40242. var padlen = [0, 2, 1][ccc.length % 3];
  40243. var ord = (ccc.charCodeAt(0) << 16) |
  40244. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  40245. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  40246. var chars = [
  40247. b64chars.charAt(ord >>> 18),
  40248. b64chars.charAt((ord >>> 12) & 63),
  40249. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  40250. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  40251. ];
  40252. return chars.join('');
  40253. };
  40254. var btoa = window.btoa ||
  40255. function (b) {
  40256. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  40257. };
  40258. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  40259. var Timer = (function () {
  40260. function Timer(set, clear, delay, callback) {
  40261. var _this = this;
  40262. this.clear = clear;
  40263. this.timer = set(function () {
  40264. if (_this.timer) {
  40265. _this.timer = callback(_this.timer);
  40266. }
  40267. }, delay);
  40268. }
  40269. Timer.prototype.isRunning = function () {
  40270. return this.timer !== null;
  40271. };
  40272. Timer.prototype.ensureAborted = function () {
  40273. if (this.timer) {
  40274. this.clear(this.timer);
  40275. this.timer = null;
  40276. }
  40277. };
  40278. return Timer;
  40279. }());
  40280. /* harmony default export */ var abstract_timer = (Timer);
  40281. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  40282. var __extends = (undefined && undefined.__extends) || (function () {
  40283. var extendStatics = function (d, b) {
  40284. extendStatics = Object.setPrototypeOf ||
  40285. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40286. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40287. return extendStatics(d, b);
  40288. };
  40289. return function (d, b) {
  40290. extendStatics(d, b);
  40291. function __() { this.constructor = d; }
  40292. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40293. };
  40294. })();
  40295. function timers_clearTimeout(timer) {
  40296. window.clearTimeout(timer);
  40297. }
  40298. function timers_clearInterval(timer) {
  40299. window.clearInterval(timer);
  40300. }
  40301. var OneOffTimer = (function (_super) {
  40302. __extends(OneOffTimer, _super);
  40303. function OneOffTimer(delay, callback) {
  40304. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  40305. callback();
  40306. return null;
  40307. }) || this;
  40308. }
  40309. return OneOffTimer;
  40310. }(abstract_timer));
  40311. var PeriodicTimer = (function (_super) {
  40312. __extends(PeriodicTimer, _super);
  40313. function PeriodicTimer(delay, callback) {
  40314. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  40315. callback();
  40316. return timer;
  40317. }) || this;
  40318. }
  40319. return PeriodicTimer;
  40320. }(abstract_timer));
  40321. // CONCATENATED MODULE: ./src/core/util.ts
  40322. var Util = {
  40323. now: function () {
  40324. if (Date.now) {
  40325. return Date.now();
  40326. }
  40327. else {
  40328. return new Date().valueOf();
  40329. }
  40330. },
  40331. defer: function (callback) {
  40332. return new OneOffTimer(0, callback);
  40333. },
  40334. method: function (name) {
  40335. var args = [];
  40336. for (var _i = 1; _i < arguments.length; _i++) {
  40337. args[_i - 1] = arguments[_i];
  40338. }
  40339. var boundArguments = Array.prototype.slice.call(arguments, 1);
  40340. return function (object) {
  40341. return object[name].apply(object, boundArguments.concat(arguments));
  40342. };
  40343. }
  40344. };
  40345. /* harmony default export */ var util = (Util);
  40346. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  40347. function extend(target) {
  40348. var sources = [];
  40349. for (var _i = 1; _i < arguments.length; _i++) {
  40350. sources[_i - 1] = arguments[_i];
  40351. }
  40352. for (var i = 0; i < sources.length; i++) {
  40353. var extensions = sources[i];
  40354. for (var property in extensions) {
  40355. if (extensions[property] && extensions[property].constructor &&
  40356. extensions[property].constructor === Object) {
  40357. target[property] = extend(target[property] || {}, extensions[property]);
  40358. }
  40359. else {
  40360. target[property] = extensions[property];
  40361. }
  40362. }
  40363. }
  40364. return target;
  40365. }
  40366. function stringify() {
  40367. var m = ["Pusher"];
  40368. for (var i = 0; i < arguments.length; i++) {
  40369. if (typeof arguments[i] === "string") {
  40370. m.push(arguments[i]);
  40371. }
  40372. else {
  40373. m.push(safeJSONStringify(arguments[i]));
  40374. }
  40375. }
  40376. return m.join(" : ");
  40377. }
  40378. function arrayIndexOf(array, item) {
  40379. var nativeIndexOf = Array.prototype.indexOf;
  40380. if (array === null) {
  40381. return -1;
  40382. }
  40383. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  40384. return array.indexOf(item);
  40385. }
  40386. for (var i = 0, l = array.length; i < l; i++) {
  40387. if (array[i] === item) {
  40388. return i;
  40389. }
  40390. }
  40391. return -1;
  40392. }
  40393. function objectApply(object, f) {
  40394. for (var key in object) {
  40395. if (Object.prototype.hasOwnProperty.call(object, key)) {
  40396. f(object[key], key, object);
  40397. }
  40398. }
  40399. }
  40400. function keys(object) {
  40401. var keys = [];
  40402. objectApply(object, function (_, key) {
  40403. keys.push(key);
  40404. });
  40405. return keys;
  40406. }
  40407. function values(object) {
  40408. var values = [];
  40409. objectApply(object, function (value) {
  40410. values.push(value);
  40411. });
  40412. return values;
  40413. }
  40414. function apply(array, f, context) {
  40415. for (var i = 0; i < array.length; i++) {
  40416. f.call(context || window, array[i], i, array);
  40417. }
  40418. }
  40419. function map(array, f) {
  40420. var result = [];
  40421. for (var i = 0; i < array.length; i++) {
  40422. result.push(f(array[i], i, array, result));
  40423. }
  40424. return result;
  40425. }
  40426. function mapObject(object, f) {
  40427. var result = {};
  40428. objectApply(object, function (value, key) {
  40429. result[key] = f(value);
  40430. });
  40431. return result;
  40432. }
  40433. function filter(array, test) {
  40434. test = test || function (value) { return !!value; };
  40435. var result = [];
  40436. for (var i = 0; i < array.length; i++) {
  40437. if (test(array[i], i, array, result)) {
  40438. result.push(array[i]);
  40439. }
  40440. }
  40441. return result;
  40442. }
  40443. function filterObject(object, test) {
  40444. var result = {};
  40445. objectApply(object, function (value, key) {
  40446. if ((test && test(value, key, object, result)) || Boolean(value)) {
  40447. result[key] = value;
  40448. }
  40449. });
  40450. return result;
  40451. }
  40452. function flatten(object) {
  40453. var result = [];
  40454. objectApply(object, function (value, key) {
  40455. result.push([key, value]);
  40456. });
  40457. return result;
  40458. }
  40459. function any(array, test) {
  40460. for (var i = 0; i < array.length; i++) {
  40461. if (test(array[i], i, array)) {
  40462. return true;
  40463. }
  40464. }
  40465. return false;
  40466. }
  40467. function collections_all(array, test) {
  40468. for (var i = 0; i < array.length; i++) {
  40469. if (!test(array[i], i, array)) {
  40470. return false;
  40471. }
  40472. }
  40473. return true;
  40474. }
  40475. function encodeParamsObject(data) {
  40476. return mapObject(data, function (value) {
  40477. if (typeof value === "object") {
  40478. value = safeJSONStringify(value);
  40479. }
  40480. return encodeURIComponent(encode(value.toString()));
  40481. });
  40482. }
  40483. function buildQueryString(data) {
  40484. var params = filterObject(data, function (value) {
  40485. return value !== undefined;
  40486. });
  40487. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  40488. return query;
  40489. }
  40490. function decycleObject(object) {
  40491. var objects = [], paths = [];
  40492. return (function derez(value, path) {
  40493. var i, name, nu;
  40494. switch (typeof value) {
  40495. case 'object':
  40496. if (!value) {
  40497. return null;
  40498. }
  40499. for (i = 0; i < objects.length; i += 1) {
  40500. if (objects[i] === value) {
  40501. return { $ref: paths[i] };
  40502. }
  40503. }
  40504. objects.push(value);
  40505. paths.push(path);
  40506. if (Object.prototype.toString.apply(value) === '[object Array]') {
  40507. nu = [];
  40508. for (i = 0; i < value.length; i += 1) {
  40509. nu[i] = derez(value[i], path + '[' + i + ']');
  40510. }
  40511. }
  40512. else {
  40513. nu = {};
  40514. for (name in value) {
  40515. if (Object.prototype.hasOwnProperty.call(value, name)) {
  40516. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  40517. }
  40518. }
  40519. }
  40520. return nu;
  40521. case 'number':
  40522. case 'string':
  40523. case 'boolean':
  40524. return value;
  40525. }
  40526. }(object, '$'));
  40527. }
  40528. function safeJSONStringify(source) {
  40529. try {
  40530. return JSON.stringify(source);
  40531. }
  40532. catch (e) {
  40533. return JSON.stringify(decycleObject(source));
  40534. }
  40535. }
  40536. // CONCATENATED MODULE: ./src/core/logger.ts
  40537. var logger_Logger = (function () {
  40538. function Logger() {
  40539. this.globalLog = function (message) {
  40540. if (window.console && window.console.log) {
  40541. window.console.log(message);
  40542. }
  40543. };
  40544. }
  40545. Logger.prototype.debug = function () {
  40546. var args = [];
  40547. for (var _i = 0; _i < arguments.length; _i++) {
  40548. args[_i] = arguments[_i];
  40549. }
  40550. this.log(this.globalLog, args);
  40551. };
  40552. Logger.prototype.warn = function () {
  40553. var args = [];
  40554. for (var _i = 0; _i < arguments.length; _i++) {
  40555. args[_i] = arguments[_i];
  40556. }
  40557. this.log(this.globalLogWarn, args);
  40558. };
  40559. Logger.prototype.error = function () {
  40560. var args = [];
  40561. for (var _i = 0; _i < arguments.length; _i++) {
  40562. args[_i] = arguments[_i];
  40563. }
  40564. this.log(this.globalLogError, args);
  40565. };
  40566. Logger.prototype.globalLogWarn = function (message) {
  40567. if (window.console && window.console.warn) {
  40568. window.console.warn(message);
  40569. }
  40570. else {
  40571. this.globalLog(message);
  40572. }
  40573. };
  40574. Logger.prototype.globalLogError = function (message) {
  40575. if (window.console && window.console.error) {
  40576. window.console.error(message);
  40577. }
  40578. else {
  40579. this.globalLogWarn(message);
  40580. }
  40581. };
  40582. Logger.prototype.log = function (defaultLoggingFunction) {
  40583. var args = [];
  40584. for (var _i = 1; _i < arguments.length; _i++) {
  40585. args[_i - 1] = arguments[_i];
  40586. }
  40587. var message = stringify.apply(this, arguments);
  40588. if (core_pusher.log) {
  40589. core_pusher.log(message);
  40590. }
  40591. else if (core_pusher.logToConsole) {
  40592. var log = defaultLoggingFunction.bind(this);
  40593. log(message);
  40594. }
  40595. };
  40596. return Logger;
  40597. }());
  40598. /* harmony default export */ var logger = (new logger_Logger());
  40599. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  40600. var urlStore = {
  40601. baseUrl: "https://pusher.com",
  40602. urls: {
  40603. authenticationEndpoint: {
  40604. path: "/docs/authenticating_users",
  40605. },
  40606. javascriptQuickStart: {
  40607. path: "/docs/javascript_quick_start"
  40608. },
  40609. triggeringClientEvents: {
  40610. path: "/docs/client_api_guide/client_events#trigger-events"
  40611. }
  40612. }
  40613. };
  40614. var buildLogSuffix = function (key) {
  40615. var urlPrefix = "See:";
  40616. var urlObj = urlStore.urls[key];
  40617. if (!urlObj)
  40618. return "";
  40619. var url;
  40620. if (urlObj.fullUrl) {
  40621. url = urlObj.fullUrl;
  40622. }
  40623. else if (urlObj.path) {
  40624. url = urlStore.baseUrl + urlObj.path;
  40625. }
  40626. if (!url)
  40627. return "";
  40628. return urlPrefix + " " + url;
  40629. };
  40630. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  40631. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  40632. var ajax = function (context, socketId, callback) {
  40633. var self = this, xhr;
  40634. xhr = runtime.createXHR();
  40635. xhr.open("POST", self.options.authEndpoint, true);
  40636. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  40637. for (var headerName in this.authOptions.headers) {
  40638. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  40639. }
  40640. xhr.onreadystatechange = function () {
  40641. if (xhr.readyState === 4) {
  40642. if (xhr.status === 200) {
  40643. var data, parsed = false;
  40644. try {
  40645. data = JSON.parse(xhr.responseText);
  40646. parsed = true;
  40647. }
  40648. catch (e) {
  40649. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  40650. }
  40651. if (parsed) {
  40652. callback(false, data);
  40653. }
  40654. }
  40655. else {
  40656. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40657. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  40658. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  40659. ("Clients must be authenticated to join private or presence channels. " + suffix));
  40660. callback(true, xhr.status);
  40661. }
  40662. }
  40663. };
  40664. xhr.send(this.composeQuery(socketId));
  40665. return xhr;
  40666. };
  40667. /* harmony default export */ var xhr_auth = (ajax);
  40668. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  40669. var jsonp = function (context, socketId, callback) {
  40670. if (this.authOptions.headers !== undefined) {
  40671. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  40672. }
  40673. var callbackName = context.nextAuthCallbackID.toString();
  40674. context.nextAuthCallbackID++;
  40675. var document = context.getDocument();
  40676. var script = document.createElement("script");
  40677. context.auth_callbacks[callbackName] = function (data) {
  40678. callback(false, data);
  40679. };
  40680. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  40681. script.src = this.options.authEndpoint +
  40682. '?callback=' +
  40683. encodeURIComponent(callback_name) +
  40684. '&' +
  40685. this.composeQuery(socketId);
  40686. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  40687. head.insertBefore(script, head.firstChild);
  40688. };
  40689. /* harmony default export */ var jsonp_auth = (jsonp);
  40690. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  40691. var ScriptRequest = (function () {
  40692. function ScriptRequest(src) {
  40693. this.src = src;
  40694. }
  40695. ScriptRequest.prototype.send = function (receiver) {
  40696. var self = this;
  40697. var errorString = "Error loading " + self.src;
  40698. self.script = document.createElement("script");
  40699. self.script.id = receiver.id;
  40700. self.script.src = self.src;
  40701. self.script.type = "text/javascript";
  40702. self.script.charset = "UTF-8";
  40703. if (self.script.addEventListener) {
  40704. self.script.onerror = function () {
  40705. receiver.callback(errorString);
  40706. };
  40707. self.script.onload = function () {
  40708. receiver.callback(null);
  40709. };
  40710. }
  40711. else {
  40712. self.script.onreadystatechange = function () {
  40713. if (self.script.readyState === 'loaded' ||
  40714. self.script.readyState === 'complete') {
  40715. receiver.callback(null);
  40716. }
  40717. };
  40718. }
  40719. if (self.script.async === undefined && document.attachEvent &&
  40720. /opera/i.test(navigator.userAgent)) {
  40721. self.errorScript = document.createElement("script");
  40722. self.errorScript.id = receiver.id + "_error";
  40723. self.errorScript.text = receiver.name + "('" + errorString + "');";
  40724. self.script.async = self.errorScript.async = false;
  40725. }
  40726. else {
  40727. self.script.async = true;
  40728. }
  40729. var head = document.getElementsByTagName('head')[0];
  40730. head.insertBefore(self.script, head.firstChild);
  40731. if (self.errorScript) {
  40732. head.insertBefore(self.errorScript, self.script.nextSibling);
  40733. }
  40734. };
  40735. ScriptRequest.prototype.cleanup = function () {
  40736. if (this.script) {
  40737. this.script.onload = this.script.onerror = null;
  40738. this.script.onreadystatechange = null;
  40739. }
  40740. if (this.script && this.script.parentNode) {
  40741. this.script.parentNode.removeChild(this.script);
  40742. }
  40743. if (this.errorScript && this.errorScript.parentNode) {
  40744. this.errorScript.parentNode.removeChild(this.errorScript);
  40745. }
  40746. this.script = null;
  40747. this.errorScript = null;
  40748. };
  40749. return ScriptRequest;
  40750. }());
  40751. /* harmony default export */ var script_request = (ScriptRequest);
  40752. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  40753. var jsonp_request_JSONPRequest = (function () {
  40754. function JSONPRequest(url, data) {
  40755. this.url = url;
  40756. this.data = data;
  40757. }
  40758. JSONPRequest.prototype.send = function (receiver) {
  40759. if (this.request) {
  40760. return;
  40761. }
  40762. var query = buildQueryString(this.data);
  40763. var url = this.url + "/" + receiver.number + "?" + query;
  40764. this.request = runtime.createScriptRequest(url);
  40765. this.request.send(receiver);
  40766. };
  40767. JSONPRequest.prototype.cleanup = function () {
  40768. if (this.request) {
  40769. this.request.cleanup();
  40770. }
  40771. };
  40772. return JSONPRequest;
  40773. }());
  40774. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  40775. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  40776. var getAgent = function (sender, useTLS) {
  40777. return function (data, callback) {
  40778. var scheme = "http" + (useTLS ? "s" : "") + "://";
  40779. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  40780. var request = runtime.createJSONPRequest(url, data);
  40781. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  40782. ScriptReceivers.remove(receiver);
  40783. request.cleanup();
  40784. if (result && result.host) {
  40785. sender.host = result.host;
  40786. }
  40787. if (callback) {
  40788. callback(error, result);
  40789. }
  40790. });
  40791. request.send(receiver);
  40792. };
  40793. };
  40794. var jsonp_timeline_jsonp = {
  40795. name: 'jsonp',
  40796. getAgent: getAgent
  40797. };
  40798. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  40799. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  40800. function getGenericURL(baseScheme, params, path) {
  40801. var scheme = baseScheme + (params.useTLS ? "s" : "");
  40802. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  40803. return scheme + "://" + host + path;
  40804. }
  40805. function getGenericPath(key, queryString) {
  40806. var path = "/app/" + key;
  40807. var query = "?protocol=" + defaults.PROTOCOL +
  40808. "&client=js" +
  40809. "&version=" + defaults.VERSION +
  40810. (queryString ? ("&" + queryString) : "");
  40811. return path + query;
  40812. }
  40813. var ws = {
  40814. getInitial: function (key, params) {
  40815. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  40816. return getGenericURL("ws", params, path);
  40817. }
  40818. };
  40819. var http = {
  40820. getInitial: function (key, params) {
  40821. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  40822. return getGenericURL("http", params, path);
  40823. }
  40824. };
  40825. var sockjs = {
  40826. getInitial: function (key, params) {
  40827. return getGenericURL("http", params, params.httpPath || "/pusher");
  40828. },
  40829. getPath: function (key, params) {
  40830. return getGenericPath(key);
  40831. }
  40832. };
  40833. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  40834. var callback_registry_CallbackRegistry = (function () {
  40835. function CallbackRegistry() {
  40836. this._callbacks = {};
  40837. }
  40838. CallbackRegistry.prototype.get = function (name) {
  40839. return this._callbacks[prefix(name)];
  40840. };
  40841. CallbackRegistry.prototype.add = function (name, callback, context) {
  40842. var prefixedEventName = prefix(name);
  40843. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  40844. this._callbacks[prefixedEventName].push({
  40845. fn: callback,
  40846. context: context
  40847. });
  40848. };
  40849. CallbackRegistry.prototype.remove = function (name, callback, context) {
  40850. if (!name && !callback && !context) {
  40851. this._callbacks = {};
  40852. return;
  40853. }
  40854. var names = name ? [prefix(name)] : keys(this._callbacks);
  40855. if (callback || context) {
  40856. this.removeCallback(names, callback, context);
  40857. }
  40858. else {
  40859. this.removeAllCallbacks(names);
  40860. }
  40861. };
  40862. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  40863. apply(names, function (name) {
  40864. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  40865. return (callback && callback !== binding.fn) ||
  40866. (context && context !== binding.context);
  40867. });
  40868. if (this._callbacks[name].length === 0) {
  40869. delete this._callbacks[name];
  40870. }
  40871. }, this);
  40872. };
  40873. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  40874. apply(names, function (name) {
  40875. delete this._callbacks[name];
  40876. }, this);
  40877. };
  40878. return CallbackRegistry;
  40879. }());
  40880. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  40881. function prefix(name) {
  40882. return "_" + name;
  40883. }
  40884. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  40885. var dispatcher_Dispatcher = (function () {
  40886. function Dispatcher(failThrough) {
  40887. this.callbacks = new callback_registry();
  40888. this.global_callbacks = [];
  40889. this.failThrough = failThrough;
  40890. }
  40891. Dispatcher.prototype.bind = function (eventName, callback, context) {
  40892. this.callbacks.add(eventName, callback, context);
  40893. return this;
  40894. };
  40895. Dispatcher.prototype.bind_global = function (callback) {
  40896. this.global_callbacks.push(callback);
  40897. return this;
  40898. };
  40899. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  40900. this.callbacks.remove(eventName, callback, context);
  40901. return this;
  40902. };
  40903. Dispatcher.prototype.unbind_global = function (callback) {
  40904. if (!callback) {
  40905. this.global_callbacks = [];
  40906. return this;
  40907. }
  40908. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  40909. return this;
  40910. };
  40911. Dispatcher.prototype.unbind_all = function () {
  40912. this.unbind();
  40913. this.unbind_global();
  40914. return this;
  40915. };
  40916. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  40917. for (var i = 0; i < this.global_callbacks.length; i++) {
  40918. this.global_callbacks[i](eventName, data);
  40919. }
  40920. var callbacks = this.callbacks.get(eventName);
  40921. var args = [];
  40922. if (metadata) {
  40923. args.push(data, metadata);
  40924. }
  40925. else if (data) {
  40926. args.push(data);
  40927. }
  40928. if (callbacks && callbacks.length > 0) {
  40929. for (var i = 0; i < callbacks.length; i++) {
  40930. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40931. }
  40932. }
  40933. else if (this.failThrough) {
  40934. this.failThrough(eventName, data);
  40935. }
  40936. return this;
  40937. };
  40938. return Dispatcher;
  40939. }());
  40940. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40941. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40942. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40943. var extendStatics = function (d, b) {
  40944. extendStatics = Object.setPrototypeOf ||
  40945. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40946. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40947. return extendStatics(d, b);
  40948. };
  40949. return function (d, b) {
  40950. extendStatics(d, b);
  40951. function __() { this.constructor = d; }
  40952. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40953. };
  40954. })();
  40955. var transport_connection_TransportConnection = (function (_super) {
  40956. transport_connection_extends(TransportConnection, _super);
  40957. function TransportConnection(hooks, name, priority, key, options) {
  40958. var _this = _super.call(this) || this;
  40959. _this.initialize = runtime.transportConnectionInitializer;
  40960. _this.hooks = hooks;
  40961. _this.name = name;
  40962. _this.priority = priority;
  40963. _this.key = key;
  40964. _this.options = options;
  40965. _this.state = "new";
  40966. _this.timeline = options.timeline;
  40967. _this.activityTimeout = options.activityTimeout;
  40968. _this.id = _this.timeline.generateUniqueID();
  40969. return _this;
  40970. }
  40971. TransportConnection.prototype.handlesActivityChecks = function () {
  40972. return Boolean(this.hooks.handlesActivityChecks);
  40973. };
  40974. TransportConnection.prototype.supportsPing = function () {
  40975. return Boolean(this.hooks.supportsPing);
  40976. };
  40977. TransportConnection.prototype.connect = function () {
  40978. var _this = this;
  40979. if (this.socket || this.state !== "initialized") {
  40980. return false;
  40981. }
  40982. var url = this.hooks.urls.getInitial(this.key, this.options);
  40983. try {
  40984. this.socket = this.hooks.getSocket(url, this.options);
  40985. }
  40986. catch (e) {
  40987. util.defer(function () {
  40988. _this.onError(e);
  40989. _this.changeState("closed");
  40990. });
  40991. return false;
  40992. }
  40993. this.bindListeners();
  40994. logger.debug("Connecting", { transport: this.name, url: url });
  40995. this.changeState("connecting");
  40996. return true;
  40997. };
  40998. TransportConnection.prototype.close = function () {
  40999. if (this.socket) {
  41000. this.socket.close();
  41001. return true;
  41002. }
  41003. else {
  41004. return false;
  41005. }
  41006. };
  41007. TransportConnection.prototype.send = function (data) {
  41008. var _this = this;
  41009. if (this.state === "open") {
  41010. util.defer(function () {
  41011. if (_this.socket) {
  41012. _this.socket.send(data);
  41013. }
  41014. });
  41015. return true;
  41016. }
  41017. else {
  41018. return false;
  41019. }
  41020. };
  41021. TransportConnection.prototype.ping = function () {
  41022. if (this.state === "open" && this.supportsPing()) {
  41023. this.socket.ping();
  41024. }
  41025. };
  41026. TransportConnection.prototype.onOpen = function () {
  41027. if (this.hooks.beforeOpen) {
  41028. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  41029. }
  41030. this.changeState("open");
  41031. this.socket.onopen = undefined;
  41032. };
  41033. TransportConnection.prototype.onError = function (error) {
  41034. this.emit("error", { type: 'WebSocketError', error: error });
  41035. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  41036. };
  41037. TransportConnection.prototype.onClose = function (closeEvent) {
  41038. if (closeEvent) {
  41039. this.changeState("closed", {
  41040. code: closeEvent.code,
  41041. reason: closeEvent.reason,
  41042. wasClean: closeEvent.wasClean
  41043. });
  41044. }
  41045. else {
  41046. this.changeState("closed");
  41047. }
  41048. this.unbindListeners();
  41049. this.socket = undefined;
  41050. };
  41051. TransportConnection.prototype.onMessage = function (message) {
  41052. this.emit("message", message);
  41053. };
  41054. TransportConnection.prototype.onActivity = function () {
  41055. this.emit("activity");
  41056. };
  41057. TransportConnection.prototype.bindListeners = function () {
  41058. var _this = this;
  41059. this.socket.onopen = function () {
  41060. _this.onOpen();
  41061. };
  41062. this.socket.onerror = function (error) {
  41063. _this.onError(error);
  41064. };
  41065. this.socket.onclose = function (closeEvent) {
  41066. _this.onClose(closeEvent);
  41067. };
  41068. this.socket.onmessage = function (message) {
  41069. _this.onMessage(message);
  41070. };
  41071. if (this.supportsPing()) {
  41072. this.socket.onactivity = function () { _this.onActivity(); };
  41073. }
  41074. };
  41075. TransportConnection.prototype.unbindListeners = function () {
  41076. if (this.socket) {
  41077. this.socket.onopen = undefined;
  41078. this.socket.onerror = undefined;
  41079. this.socket.onclose = undefined;
  41080. this.socket.onmessage = undefined;
  41081. if (this.supportsPing()) {
  41082. this.socket.onactivity = undefined;
  41083. }
  41084. }
  41085. };
  41086. TransportConnection.prototype.changeState = function (state, params) {
  41087. this.state = state;
  41088. this.timeline.info(this.buildTimelineMessage({
  41089. state: state,
  41090. params: params
  41091. }));
  41092. this.emit(state, params);
  41093. };
  41094. TransportConnection.prototype.buildTimelineMessage = function (message) {
  41095. return extend({ cid: this.id }, message);
  41096. };
  41097. return TransportConnection;
  41098. }(dispatcher));
  41099. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  41100. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  41101. var transport_Transport = (function () {
  41102. function Transport(hooks) {
  41103. this.hooks = hooks;
  41104. }
  41105. Transport.prototype.isSupported = function (environment) {
  41106. return this.hooks.isSupported(environment);
  41107. };
  41108. Transport.prototype.createConnection = function (name, priority, key, options) {
  41109. return new transport_connection(this.hooks, name, priority, key, options);
  41110. };
  41111. return Transport;
  41112. }());
  41113. /* harmony default export */ var transports_transport = (transport_Transport);
  41114. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  41115. var WSTransport = new transports_transport({
  41116. urls: ws,
  41117. handlesActivityChecks: false,
  41118. supportsPing: false,
  41119. isInitialized: function () {
  41120. return Boolean(runtime.getWebSocketAPI());
  41121. },
  41122. isSupported: function () {
  41123. return Boolean(runtime.getWebSocketAPI());
  41124. },
  41125. getSocket: function (url) {
  41126. return runtime.createWebSocket(url);
  41127. }
  41128. });
  41129. var httpConfiguration = {
  41130. urls: http,
  41131. handlesActivityChecks: false,
  41132. supportsPing: true,
  41133. isInitialized: function () {
  41134. return true;
  41135. }
  41136. };
  41137. var streamingConfiguration = extend({ getSocket: function (url) {
  41138. return runtime.HTTPFactory.createStreamingSocket(url);
  41139. }
  41140. }, httpConfiguration);
  41141. var pollingConfiguration = extend({ getSocket: function (url) {
  41142. return runtime.HTTPFactory.createPollingSocket(url);
  41143. }
  41144. }, httpConfiguration);
  41145. var xhrConfiguration = {
  41146. isSupported: function () {
  41147. return runtime.isXHRSupported();
  41148. }
  41149. };
  41150. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  41151. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  41152. var Transports = {
  41153. ws: WSTransport,
  41154. xhr_streaming: XHRStreamingTransport,
  41155. xhr_polling: XHRPollingTransport
  41156. };
  41157. /* harmony default export */ var transports = (Transports);
  41158. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  41159. var SockJSTransport = new transports_transport({
  41160. file: "sockjs",
  41161. urls: sockjs,
  41162. handlesActivityChecks: true,
  41163. supportsPing: false,
  41164. isSupported: function () {
  41165. return true;
  41166. },
  41167. isInitialized: function () {
  41168. return window.SockJS !== undefined;
  41169. },
  41170. getSocket: function (url, options) {
  41171. return new window.SockJS(url, null, {
  41172. js_path: Dependencies.getPath("sockjs", {
  41173. useTLS: options.useTLS
  41174. }),
  41175. ignore_null_origin: options.ignoreNullOrigin
  41176. });
  41177. },
  41178. beforeOpen: function (socket, path) {
  41179. socket.send(JSON.stringify({
  41180. path: path
  41181. }));
  41182. }
  41183. });
  41184. var xdrConfiguration = {
  41185. isSupported: function (environment) {
  41186. var yes = runtime.isXDRSupported(environment.useTLS);
  41187. return yes;
  41188. }
  41189. };
  41190. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  41191. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  41192. transports.xdr_streaming = XDRStreamingTransport;
  41193. transports.xdr_polling = XDRPollingTransport;
  41194. transports.sockjs = SockJSTransport;
  41195. /* harmony default export */ var transports_transports = (transports);
  41196. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  41197. var net_info_extends = (undefined && undefined.__extends) || (function () {
  41198. var extendStatics = function (d, b) {
  41199. extendStatics = Object.setPrototypeOf ||
  41200. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41201. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41202. return extendStatics(d, b);
  41203. };
  41204. return function (d, b) {
  41205. extendStatics(d, b);
  41206. function __() { this.constructor = d; }
  41207. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41208. };
  41209. })();
  41210. var NetInfo = (function (_super) {
  41211. net_info_extends(NetInfo, _super);
  41212. function NetInfo() {
  41213. var _this = _super.call(this) || this;
  41214. var self = _this;
  41215. if (window.addEventListener !== undefined) {
  41216. window.addEventListener("online", function () {
  41217. self.emit('online');
  41218. }, false);
  41219. window.addEventListener("offline", function () {
  41220. self.emit('offline');
  41221. }, false);
  41222. }
  41223. return _this;
  41224. }
  41225. NetInfo.prototype.isOnline = function () {
  41226. if (window.navigator.onLine === undefined) {
  41227. return true;
  41228. }
  41229. else {
  41230. return window.navigator.onLine;
  41231. }
  41232. };
  41233. return NetInfo;
  41234. }(dispatcher));
  41235. var net_info_Network = new NetInfo();
  41236. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  41237. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  41238. function AssistantToTheTransportManager(manager, transport, options) {
  41239. this.manager = manager;
  41240. this.transport = transport;
  41241. this.minPingDelay = options.minPingDelay;
  41242. this.maxPingDelay = options.maxPingDelay;
  41243. this.pingDelay = undefined;
  41244. }
  41245. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  41246. var _this = this;
  41247. options = extend({}, options, {
  41248. activityTimeout: this.pingDelay
  41249. });
  41250. var connection = this.transport.createConnection(name, priority, key, options);
  41251. var openTimestamp = null;
  41252. var onOpen = function () {
  41253. connection.unbind("open", onOpen);
  41254. connection.bind("closed", onClosed);
  41255. openTimestamp = util.now();
  41256. };
  41257. var onClosed = function (closeEvent) {
  41258. connection.unbind("closed", onClosed);
  41259. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  41260. _this.manager.reportDeath();
  41261. }
  41262. else if (!closeEvent.wasClean && openTimestamp) {
  41263. var lifespan = util.now() - openTimestamp;
  41264. if (lifespan < 2 * _this.maxPingDelay) {
  41265. _this.manager.reportDeath();
  41266. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  41267. }
  41268. }
  41269. };
  41270. connection.bind("open", onOpen);
  41271. return connection;
  41272. };
  41273. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  41274. return this.manager.isAlive() && this.transport.isSupported(environment);
  41275. };
  41276. return AssistantToTheTransportManager;
  41277. }());
  41278. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  41279. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  41280. var Protocol = {
  41281. decodeMessage: function (messageEvent) {
  41282. try {
  41283. var messageData = JSON.parse(messageEvent.data);
  41284. var pusherEventData = messageData.data;
  41285. if (typeof pusherEventData === 'string') {
  41286. try {
  41287. pusherEventData = JSON.parse(messageData.data);
  41288. }
  41289. catch (e) { }
  41290. }
  41291. var pusherEvent = {
  41292. event: messageData.event,
  41293. channel: messageData.channel,
  41294. data: pusherEventData,
  41295. };
  41296. if (messageData.user_id) {
  41297. pusherEvent.user_id = messageData.user_id;
  41298. }
  41299. return pusherEvent;
  41300. }
  41301. catch (e) {
  41302. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  41303. }
  41304. },
  41305. encodeMessage: function (event) {
  41306. return JSON.stringify(event);
  41307. },
  41308. processHandshake: function (messageEvent) {
  41309. var message = Protocol.decodeMessage(messageEvent);
  41310. if (message.event === "pusher:connection_established") {
  41311. if (!message.data.activity_timeout) {
  41312. throw "No activity timeout specified in handshake";
  41313. }
  41314. return {
  41315. action: "connected",
  41316. id: message.data.socket_id,
  41317. activityTimeout: message.data.activity_timeout * 1000
  41318. };
  41319. }
  41320. else if (message.event === "pusher:error") {
  41321. return {
  41322. action: this.getCloseAction(message.data),
  41323. error: this.getCloseError(message.data)
  41324. };
  41325. }
  41326. else {
  41327. throw "Invalid handshake";
  41328. }
  41329. },
  41330. getCloseAction: function (closeEvent) {
  41331. if (closeEvent.code < 4000) {
  41332. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  41333. return "backoff";
  41334. }
  41335. else {
  41336. return null;
  41337. }
  41338. }
  41339. else if (closeEvent.code === 4000) {
  41340. return "tls_only";
  41341. }
  41342. else if (closeEvent.code < 4100) {
  41343. return "refused";
  41344. }
  41345. else if (closeEvent.code < 4200) {
  41346. return "backoff";
  41347. }
  41348. else if (closeEvent.code < 4300) {
  41349. return "retry";
  41350. }
  41351. else {
  41352. return "refused";
  41353. }
  41354. },
  41355. getCloseError: function (closeEvent) {
  41356. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  41357. return {
  41358. type: 'PusherError',
  41359. data: {
  41360. code: closeEvent.code,
  41361. message: closeEvent.reason || closeEvent.message
  41362. }
  41363. };
  41364. }
  41365. else {
  41366. return null;
  41367. }
  41368. }
  41369. };
  41370. /* harmony default export */ var protocol_protocol = (Protocol);
  41371. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  41372. var connection_extends = (undefined && undefined.__extends) || (function () {
  41373. var extendStatics = function (d, b) {
  41374. extendStatics = Object.setPrototypeOf ||
  41375. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41376. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41377. return extendStatics(d, b);
  41378. };
  41379. return function (d, b) {
  41380. extendStatics(d, b);
  41381. function __() { this.constructor = d; }
  41382. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41383. };
  41384. })();
  41385. var connection_Connection = (function (_super) {
  41386. connection_extends(Connection, _super);
  41387. function Connection(id, transport) {
  41388. var _this = _super.call(this) || this;
  41389. _this.id = id;
  41390. _this.transport = transport;
  41391. _this.activityTimeout = transport.activityTimeout;
  41392. _this.bindListeners();
  41393. return _this;
  41394. }
  41395. Connection.prototype.handlesActivityChecks = function () {
  41396. return this.transport.handlesActivityChecks();
  41397. };
  41398. Connection.prototype.send = function (data) {
  41399. return this.transport.send(data);
  41400. };
  41401. Connection.prototype.send_event = function (name, data, channel) {
  41402. var event = { event: name, data: data };
  41403. if (channel) {
  41404. event.channel = channel;
  41405. }
  41406. logger.debug('Event sent', event);
  41407. return this.send(protocol_protocol.encodeMessage(event));
  41408. };
  41409. Connection.prototype.ping = function () {
  41410. if (this.transport.supportsPing()) {
  41411. this.transport.ping();
  41412. }
  41413. else {
  41414. this.send_event('pusher:ping', {});
  41415. }
  41416. };
  41417. Connection.prototype.close = function () {
  41418. this.transport.close();
  41419. };
  41420. Connection.prototype.bindListeners = function () {
  41421. var _this = this;
  41422. var listeners = {
  41423. message: function (messageEvent) {
  41424. var pusherEvent;
  41425. try {
  41426. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  41427. }
  41428. catch (e) {
  41429. _this.emit('error', {
  41430. type: 'MessageParseError',
  41431. error: e,
  41432. data: messageEvent.data
  41433. });
  41434. }
  41435. if (pusherEvent !== undefined) {
  41436. logger.debug('Event recd', pusherEvent);
  41437. switch (pusherEvent.event) {
  41438. case 'pusher:error':
  41439. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  41440. break;
  41441. case 'pusher:ping':
  41442. _this.emit("ping");
  41443. break;
  41444. case 'pusher:pong':
  41445. _this.emit("pong");
  41446. break;
  41447. }
  41448. _this.emit('message', pusherEvent);
  41449. }
  41450. },
  41451. activity: function () {
  41452. _this.emit("activity");
  41453. },
  41454. error: function (error) {
  41455. _this.emit("error", { type: "WebSocketError", error: error });
  41456. },
  41457. closed: function (closeEvent) {
  41458. unbindListeners();
  41459. if (closeEvent && closeEvent.code) {
  41460. _this.handleCloseEvent(closeEvent);
  41461. }
  41462. _this.transport = null;
  41463. _this.emit("closed");
  41464. }
  41465. };
  41466. var unbindListeners = function () {
  41467. objectApply(listeners, function (listener, event) {
  41468. _this.transport.unbind(event, listener);
  41469. });
  41470. };
  41471. objectApply(listeners, function (listener, event) {
  41472. _this.transport.bind(event, listener);
  41473. });
  41474. };
  41475. Connection.prototype.handleCloseEvent = function (closeEvent) {
  41476. var action = protocol_protocol.getCloseAction(closeEvent);
  41477. var error = protocol_protocol.getCloseError(closeEvent);
  41478. if (error) {
  41479. this.emit('error', error);
  41480. }
  41481. if (action) {
  41482. this.emit(action, { action: action, error: error });
  41483. }
  41484. };
  41485. return Connection;
  41486. }(dispatcher));
  41487. /* harmony default export */ var connection_connection = (connection_Connection);
  41488. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  41489. var handshake_Handshake = (function () {
  41490. function Handshake(transport, callback) {
  41491. this.transport = transport;
  41492. this.callback = callback;
  41493. this.bindListeners();
  41494. }
  41495. Handshake.prototype.close = function () {
  41496. this.unbindListeners();
  41497. this.transport.close();
  41498. };
  41499. Handshake.prototype.bindListeners = function () {
  41500. var _this = this;
  41501. this.onMessage = function (m) {
  41502. _this.unbindListeners();
  41503. var result;
  41504. try {
  41505. result = protocol_protocol.processHandshake(m);
  41506. }
  41507. catch (e) {
  41508. _this.finish("error", { error: e });
  41509. _this.transport.close();
  41510. return;
  41511. }
  41512. if (result.action === "connected") {
  41513. _this.finish("connected", {
  41514. connection: new connection_connection(result.id, _this.transport),
  41515. activityTimeout: result.activityTimeout
  41516. });
  41517. }
  41518. else {
  41519. _this.finish(result.action, { error: result.error });
  41520. _this.transport.close();
  41521. }
  41522. };
  41523. this.onClosed = function (closeEvent) {
  41524. _this.unbindListeners();
  41525. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  41526. var error = protocol_protocol.getCloseError(closeEvent);
  41527. _this.finish(action, { error: error });
  41528. };
  41529. this.transport.bind("message", this.onMessage);
  41530. this.transport.bind("closed", this.onClosed);
  41531. };
  41532. Handshake.prototype.unbindListeners = function () {
  41533. this.transport.unbind("message", this.onMessage);
  41534. this.transport.unbind("closed", this.onClosed);
  41535. };
  41536. Handshake.prototype.finish = function (action, params) {
  41537. this.callback(extend({ transport: this.transport, action: action }, params));
  41538. };
  41539. return Handshake;
  41540. }());
  41541. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  41542. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  41543. var pusher_authorizer_PusherAuthorizer = (function () {
  41544. function PusherAuthorizer(channel, options) {
  41545. this.channel = channel;
  41546. var authTransport = options.authTransport;
  41547. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  41548. throw "'" + authTransport + "' is not a recognized auth transport";
  41549. }
  41550. this.type = authTransport;
  41551. this.options = options;
  41552. this.authOptions = (options || {}).auth || {};
  41553. }
  41554. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  41555. var query = 'socket_id=' + encodeURIComponent(socketId) +
  41556. '&channel_name=' + encodeURIComponent(this.channel.name);
  41557. for (var i in this.authOptions.params) {
  41558. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  41559. }
  41560. return query;
  41561. };
  41562. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  41563. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  41564. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  41565. };
  41566. return PusherAuthorizer;
  41567. }());
  41568. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  41569. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  41570. var timeline_sender_TimelineSender = (function () {
  41571. function TimelineSender(timeline, options) {
  41572. this.timeline = timeline;
  41573. this.options = options || {};
  41574. }
  41575. TimelineSender.prototype.send = function (useTLS, callback) {
  41576. if (this.timeline.isEmpty()) {
  41577. return;
  41578. }
  41579. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  41580. };
  41581. return TimelineSender;
  41582. }());
  41583. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  41584. // CONCATENATED MODULE: ./src/core/errors.ts
  41585. var errors_extends = (undefined && undefined.__extends) || (function () {
  41586. var extendStatics = function (d, b) {
  41587. extendStatics = Object.setPrototypeOf ||
  41588. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41589. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41590. return extendStatics(d, b);
  41591. };
  41592. return function (d, b) {
  41593. extendStatics(d, b);
  41594. function __() { this.constructor = d; }
  41595. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41596. };
  41597. })();
  41598. var BadEventName = (function (_super) {
  41599. errors_extends(BadEventName, _super);
  41600. function BadEventName(msg) {
  41601. var _newTarget = this.constructor;
  41602. var _this = _super.call(this, msg) || this;
  41603. Object.setPrototypeOf(_this, _newTarget.prototype);
  41604. return _this;
  41605. }
  41606. return BadEventName;
  41607. }(Error));
  41608. var RequestTimedOut = (function (_super) {
  41609. errors_extends(RequestTimedOut, _super);
  41610. function RequestTimedOut(msg) {
  41611. var _newTarget = this.constructor;
  41612. var _this = _super.call(this, msg) || this;
  41613. Object.setPrototypeOf(_this, _newTarget.prototype);
  41614. return _this;
  41615. }
  41616. return RequestTimedOut;
  41617. }(Error));
  41618. var TransportPriorityTooLow = (function (_super) {
  41619. errors_extends(TransportPriorityTooLow, _super);
  41620. function TransportPriorityTooLow(msg) {
  41621. var _newTarget = this.constructor;
  41622. var _this = _super.call(this, msg) || this;
  41623. Object.setPrototypeOf(_this, _newTarget.prototype);
  41624. return _this;
  41625. }
  41626. return TransportPriorityTooLow;
  41627. }(Error));
  41628. var TransportClosed = (function (_super) {
  41629. errors_extends(TransportClosed, _super);
  41630. function TransportClosed(msg) {
  41631. var _newTarget = this.constructor;
  41632. var _this = _super.call(this, msg) || this;
  41633. Object.setPrototypeOf(_this, _newTarget.prototype);
  41634. return _this;
  41635. }
  41636. return TransportClosed;
  41637. }(Error));
  41638. var UnsupportedFeature = (function (_super) {
  41639. errors_extends(UnsupportedFeature, _super);
  41640. function UnsupportedFeature(msg) {
  41641. var _newTarget = this.constructor;
  41642. var _this = _super.call(this, msg) || this;
  41643. Object.setPrototypeOf(_this, _newTarget.prototype);
  41644. return _this;
  41645. }
  41646. return UnsupportedFeature;
  41647. }(Error));
  41648. var UnsupportedTransport = (function (_super) {
  41649. errors_extends(UnsupportedTransport, _super);
  41650. function UnsupportedTransport(msg) {
  41651. var _newTarget = this.constructor;
  41652. var _this = _super.call(this, msg) || this;
  41653. Object.setPrototypeOf(_this, _newTarget.prototype);
  41654. return _this;
  41655. }
  41656. return UnsupportedTransport;
  41657. }(Error));
  41658. var UnsupportedStrategy = (function (_super) {
  41659. errors_extends(UnsupportedStrategy, _super);
  41660. function UnsupportedStrategy(msg) {
  41661. var _newTarget = this.constructor;
  41662. var _this = _super.call(this, msg) || this;
  41663. Object.setPrototypeOf(_this, _newTarget.prototype);
  41664. return _this;
  41665. }
  41666. return UnsupportedStrategy;
  41667. }(Error));
  41668. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  41669. var channel_extends = (undefined && undefined.__extends) || (function () {
  41670. var extendStatics = function (d, b) {
  41671. extendStatics = Object.setPrototypeOf ||
  41672. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41673. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41674. return extendStatics(d, b);
  41675. };
  41676. return function (d, b) {
  41677. extendStatics(d, b);
  41678. function __() { this.constructor = d; }
  41679. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41680. };
  41681. })();
  41682. var channel_Channel = (function (_super) {
  41683. channel_extends(Channel, _super);
  41684. function Channel(name, pusher) {
  41685. var _this = _super.call(this, function (event, data) {
  41686. logger.debug('No callbacks on ' + name + ' for ' + event);
  41687. }) || this;
  41688. _this.name = name;
  41689. _this.pusher = pusher;
  41690. _this.subscribed = false;
  41691. _this.subscriptionPending = false;
  41692. _this.subscriptionCancelled = false;
  41693. return _this;
  41694. }
  41695. Channel.prototype.authorize = function (socketId, callback) {
  41696. return callback(false, {});
  41697. };
  41698. Channel.prototype.trigger = function (event, data) {
  41699. if (event.indexOf("client-") !== 0) {
  41700. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  41701. }
  41702. if (!this.subscribed) {
  41703. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  41704. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  41705. }
  41706. return this.pusher.send_event(event, data, this.name);
  41707. };
  41708. Channel.prototype.disconnect = function () {
  41709. this.subscribed = false;
  41710. this.subscriptionPending = false;
  41711. };
  41712. Channel.prototype.handleEvent = function (event) {
  41713. var eventName = event.event;
  41714. var data = event.data;
  41715. if (eventName === "pusher_internal:subscription_succeeded") {
  41716. this.handleSubscriptionSucceededEvent(event);
  41717. }
  41718. else if (eventName.indexOf("pusher_internal:") !== 0) {
  41719. var metadata = {};
  41720. this.emit(eventName, data, metadata);
  41721. }
  41722. };
  41723. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41724. this.subscriptionPending = false;
  41725. this.subscribed = true;
  41726. if (this.subscriptionCancelled) {
  41727. this.pusher.unsubscribe(this.name);
  41728. }
  41729. else {
  41730. this.emit("pusher:subscription_succeeded", event.data);
  41731. }
  41732. };
  41733. Channel.prototype.subscribe = function () {
  41734. var _this = this;
  41735. if (this.subscribed) {
  41736. return;
  41737. }
  41738. this.subscriptionPending = true;
  41739. this.subscriptionCancelled = false;
  41740. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  41741. if (error) {
  41742. logger.error(data);
  41743. _this.emit('pusher:subscription_error', data);
  41744. }
  41745. else {
  41746. _this.pusher.send_event('pusher:subscribe', {
  41747. auth: data.auth,
  41748. channel_data: data.channel_data,
  41749. channel: _this.name
  41750. });
  41751. }
  41752. });
  41753. };
  41754. Channel.prototype.unsubscribe = function () {
  41755. this.subscribed = false;
  41756. this.pusher.send_event('pusher:unsubscribe', {
  41757. channel: this.name
  41758. });
  41759. };
  41760. Channel.prototype.cancelSubscription = function () {
  41761. this.subscriptionCancelled = true;
  41762. };
  41763. Channel.prototype.reinstateSubscription = function () {
  41764. this.subscriptionCancelled = false;
  41765. };
  41766. return Channel;
  41767. }(dispatcher));
  41768. /* harmony default export */ var channels_channel = (channel_Channel);
  41769. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  41770. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  41771. var extendStatics = function (d, b) {
  41772. extendStatics = Object.setPrototypeOf ||
  41773. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41774. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41775. return extendStatics(d, b);
  41776. };
  41777. return function (d, b) {
  41778. extendStatics(d, b);
  41779. function __() { this.constructor = d; }
  41780. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41781. };
  41782. })();
  41783. var private_channel_PrivateChannel = (function (_super) {
  41784. private_channel_extends(PrivateChannel, _super);
  41785. function PrivateChannel() {
  41786. return _super !== null && _super.apply(this, arguments) || this;
  41787. }
  41788. PrivateChannel.prototype.authorize = function (socketId, callback) {
  41789. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  41790. return authorizer.authorize(socketId, callback);
  41791. };
  41792. return PrivateChannel;
  41793. }(channels_channel));
  41794. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  41795. // CONCATENATED MODULE: ./src/core/channels/members.ts
  41796. var members_Members = (function () {
  41797. function Members() {
  41798. this.reset();
  41799. }
  41800. Members.prototype.get = function (id) {
  41801. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  41802. return {
  41803. id: id,
  41804. info: this.members[id]
  41805. };
  41806. }
  41807. else {
  41808. return null;
  41809. }
  41810. };
  41811. Members.prototype.each = function (callback) {
  41812. var _this = this;
  41813. objectApply(this.members, function (member, id) {
  41814. callback(_this.get(id));
  41815. });
  41816. };
  41817. Members.prototype.setMyID = function (id) {
  41818. this.myID = id;
  41819. };
  41820. Members.prototype.onSubscription = function (subscriptionData) {
  41821. this.members = subscriptionData.presence.hash;
  41822. this.count = subscriptionData.presence.count;
  41823. this.me = this.get(this.myID);
  41824. };
  41825. Members.prototype.addMember = function (memberData) {
  41826. if (this.get(memberData.user_id) === null) {
  41827. this.count++;
  41828. }
  41829. this.members[memberData.user_id] = memberData.user_info;
  41830. return this.get(memberData.user_id);
  41831. };
  41832. Members.prototype.removeMember = function (memberData) {
  41833. var member = this.get(memberData.user_id);
  41834. if (member) {
  41835. delete this.members[memberData.user_id];
  41836. this.count--;
  41837. }
  41838. return member;
  41839. };
  41840. Members.prototype.reset = function () {
  41841. this.members = {};
  41842. this.count = 0;
  41843. this.myID = null;
  41844. this.me = null;
  41845. };
  41846. return Members;
  41847. }());
  41848. /* harmony default export */ var members = (members_Members);
  41849. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  41850. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  41851. var extendStatics = function (d, b) {
  41852. extendStatics = Object.setPrototypeOf ||
  41853. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41854. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41855. return extendStatics(d, b);
  41856. };
  41857. return function (d, b) {
  41858. extendStatics(d, b);
  41859. function __() { this.constructor = d; }
  41860. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41861. };
  41862. })();
  41863. var presence_channel_PresenceChannel = (function (_super) {
  41864. presence_channel_extends(PresenceChannel, _super);
  41865. function PresenceChannel(name, pusher) {
  41866. var _this = _super.call(this, name, pusher) || this;
  41867. _this.members = new members();
  41868. return _this;
  41869. }
  41870. PresenceChannel.prototype.authorize = function (socketId, callback) {
  41871. var _this = this;
  41872. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41873. if (!error) {
  41874. if (authData.channel_data === undefined) {
  41875. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  41876. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  41877. ("expected 'channel_data' field. " + suffix));
  41878. callback("Invalid auth response");
  41879. return;
  41880. }
  41881. var channelData = JSON.parse(authData.channel_data);
  41882. _this.members.setMyID(channelData.user_id);
  41883. }
  41884. callback(error, authData);
  41885. });
  41886. };
  41887. PresenceChannel.prototype.handleEvent = function (event) {
  41888. var eventName = event.event;
  41889. if (eventName.indexOf("pusher_internal:") === 0) {
  41890. this.handleInternalEvent(event);
  41891. }
  41892. else {
  41893. var data = event.data;
  41894. var metadata = {};
  41895. if (event.user_id) {
  41896. metadata.user_id = event.user_id;
  41897. }
  41898. this.emit(eventName, data, metadata);
  41899. }
  41900. };
  41901. PresenceChannel.prototype.handleInternalEvent = function (event) {
  41902. var eventName = event.event;
  41903. var data = event.data;
  41904. switch (eventName) {
  41905. case "pusher_internal:subscription_succeeded":
  41906. this.handleSubscriptionSucceededEvent(event);
  41907. break;
  41908. case "pusher_internal:member_added":
  41909. var addedMember = this.members.addMember(data);
  41910. this.emit('pusher:member_added', addedMember);
  41911. break;
  41912. case "pusher_internal:member_removed":
  41913. var removedMember = this.members.removeMember(data);
  41914. if (removedMember) {
  41915. this.emit('pusher:member_removed', removedMember);
  41916. }
  41917. break;
  41918. }
  41919. };
  41920. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41921. this.subscriptionPending = false;
  41922. this.subscribed = true;
  41923. if (this.subscriptionCancelled) {
  41924. this.pusher.unsubscribe(this.name);
  41925. }
  41926. else {
  41927. this.members.onSubscription(event.data);
  41928. this.emit("pusher:subscription_succeeded", this.members);
  41929. }
  41930. };
  41931. PresenceChannel.prototype.disconnect = function () {
  41932. this.members.reset();
  41933. _super.prototype.disconnect.call(this);
  41934. };
  41935. return PresenceChannel;
  41936. }(private_channel));
  41937. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41938. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41939. var nacl_fast = __webpack_require__(0);
  41940. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41941. var nacl_util = __webpack_require__(1);
  41942. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41943. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41944. var extendStatics = function (d, b) {
  41945. extendStatics = Object.setPrototypeOf ||
  41946. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41947. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41948. return extendStatics(d, b);
  41949. };
  41950. return function (d, b) {
  41951. extendStatics(d, b);
  41952. function __() { this.constructor = d; }
  41953. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41954. };
  41955. })();
  41956. var encrypted_channel_EncryptedChannel = (function (_super) {
  41957. encrypted_channel_extends(EncryptedChannel, _super);
  41958. function EncryptedChannel() {
  41959. var _this = _super !== null && _super.apply(this, arguments) || this;
  41960. _this.key = null;
  41961. return _this;
  41962. }
  41963. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41964. var _this = this;
  41965. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41966. if (error) {
  41967. callback(true, authData);
  41968. return;
  41969. }
  41970. var sharedSecret = authData["shared_secret"];
  41971. if (!sharedSecret) {
  41972. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41973. callback(true, errorMsg);
  41974. return;
  41975. }
  41976. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41977. delete authData["shared_secret"];
  41978. callback(false, authData);
  41979. });
  41980. };
  41981. EncryptedChannel.prototype.trigger = function (event, data) {
  41982. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41983. };
  41984. EncryptedChannel.prototype.handleEvent = function (event) {
  41985. var eventName = event.event;
  41986. var data = event.data;
  41987. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41988. _super.prototype.handleEvent.call(this, event);
  41989. return;
  41990. }
  41991. this.handleEncryptedEvent(eventName, data);
  41992. };
  41993. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41994. var _this = this;
  41995. if (!this.key) {
  41996. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41997. return;
  41998. }
  41999. if (!data.ciphertext || !data.nonce) {
  42000. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  42001. return;
  42002. }
  42003. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  42004. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  42005. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  42006. return;
  42007. }
  42008. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  42009. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  42010. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  42011. return;
  42012. }
  42013. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  42014. if (bytes === null) {
  42015. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  42016. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  42017. if (error) {
  42018. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  42019. return;
  42020. }
  42021. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  42022. if (bytes === null) {
  42023. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  42024. return;
  42025. }
  42026. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  42027. return;
  42028. });
  42029. return;
  42030. }
  42031. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  42032. };
  42033. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  42034. try {
  42035. this.emit(eventName, JSON.parse(data));
  42036. }
  42037. catch (e) {
  42038. this.emit(eventName, data);
  42039. }
  42040. return this;
  42041. };
  42042. return EncryptedChannel;
  42043. }(private_channel));
  42044. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  42045. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  42046. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  42047. var extendStatics = function (d, b) {
  42048. extendStatics = Object.setPrototypeOf ||
  42049. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  42050. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  42051. return extendStatics(d, b);
  42052. };
  42053. return function (d, b) {
  42054. extendStatics(d, b);
  42055. function __() { this.constructor = d; }
  42056. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  42057. };
  42058. })();
  42059. var connection_manager_ConnectionManager = (function (_super) {
  42060. connection_manager_extends(ConnectionManager, _super);
  42061. function ConnectionManager(key, options) {
  42062. var _this = _super.call(this) || this;
  42063. _this.key = key;
  42064. _this.options = options || {};
  42065. _this.state = "initialized";
  42066. _this.connection = null;
  42067. _this.usingTLS = !!options.useTLS;
  42068. _this.timeline = _this.options.timeline;
  42069. _this.errorCallbacks = _this.buildErrorCallbacks();
  42070. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  42071. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  42072. var Network = runtime.getNetwork();
  42073. Network.bind("online", function () {
  42074. _this.timeline.info({ netinfo: "online" });
  42075. if (_this.state === "connecting" || _this.state === "unavailable") {
  42076. _this.retryIn(0);
  42077. }
  42078. });
  42079. Network.bind("offline", function () {
  42080. _this.timeline.info({ netinfo: "offline" });
  42081. if (_this.connection) {
  42082. _this.sendActivityCheck();
  42083. }
  42084. });
  42085. _this.updateStrategy();
  42086. return _this;
  42087. }
  42088. ConnectionManager.prototype.connect = function () {
  42089. if (this.connection || this.runner) {
  42090. return;
  42091. }
  42092. if (!this.strategy.isSupported()) {
  42093. this.updateState("failed");
  42094. return;
  42095. }
  42096. this.updateState("connecting");
  42097. this.startConnecting();
  42098. this.setUnavailableTimer();
  42099. };
  42100. ;
  42101. ConnectionManager.prototype.send = function (data) {
  42102. if (this.connection) {
  42103. return this.connection.send(data);
  42104. }
  42105. else {
  42106. return false;
  42107. }
  42108. };
  42109. ;
  42110. ConnectionManager.prototype.send_event = function (name, data, channel) {
  42111. if (this.connection) {
  42112. return this.connection.send_event(name, data, channel);
  42113. }
  42114. else {
  42115. return false;
  42116. }
  42117. };
  42118. ;
  42119. ConnectionManager.prototype.disconnect = function () {
  42120. this.disconnectInternally();
  42121. this.updateState("disconnected");
  42122. };
  42123. ;
  42124. ConnectionManager.prototype.isUsingTLS = function () {
  42125. return this.usingTLS;
  42126. };
  42127. ;
  42128. ConnectionManager.prototype.startConnecting = function () {
  42129. var _this = this;
  42130. var callback = function (error, handshake) {
  42131. if (error) {
  42132. _this.runner = _this.strategy.connect(0, callback);
  42133. }
  42134. else {
  42135. if (handshake.action === "error") {
  42136. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  42137. _this.timeline.error({ handshakeError: handshake.error });
  42138. }
  42139. else {
  42140. _this.abortConnecting();
  42141. _this.handshakeCallbacks[handshake.action](handshake);
  42142. }
  42143. }
  42144. };
  42145. this.runner = this.strategy.connect(0, callback);
  42146. };
  42147. ;
  42148. ConnectionManager.prototype.abortConnecting = function () {
  42149. if (this.runner) {
  42150. this.runner.abort();
  42151. this.runner = null;
  42152. }
  42153. };
  42154. ;
  42155. ConnectionManager.prototype.disconnectInternally = function () {
  42156. this.abortConnecting();
  42157. this.clearRetryTimer();
  42158. this.clearUnavailableTimer();
  42159. if (this.connection) {
  42160. var connection = this.abandonConnection();
  42161. connection.close();
  42162. }
  42163. };
  42164. ;
  42165. ConnectionManager.prototype.updateStrategy = function () {
  42166. this.strategy = this.options.getStrategy({
  42167. key: this.key,
  42168. timeline: this.timeline,
  42169. useTLS: this.usingTLS
  42170. });
  42171. };
  42172. ;
  42173. ConnectionManager.prototype.retryIn = function (delay) {
  42174. var _this = this;
  42175. this.timeline.info({ action: "retry", delay: delay });
  42176. if (delay > 0) {
  42177. this.emit("connecting_in", Math.round(delay / 1000));
  42178. }
  42179. this.retryTimer = new OneOffTimer(delay || 0, function () {
  42180. _this.disconnectInternally();
  42181. _this.connect();
  42182. });
  42183. };
  42184. ;
  42185. ConnectionManager.prototype.clearRetryTimer = function () {
  42186. if (this.retryTimer) {
  42187. this.retryTimer.ensureAborted();
  42188. this.retryTimer = null;
  42189. }
  42190. };
  42191. ;
  42192. ConnectionManager.prototype.setUnavailableTimer = function () {
  42193. var _this = this;
  42194. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  42195. _this.updateState("unavailable");
  42196. });
  42197. };
  42198. ;
  42199. ConnectionManager.prototype.clearUnavailableTimer = function () {
  42200. if (this.unavailableTimer) {
  42201. this.unavailableTimer.ensureAborted();
  42202. }
  42203. };
  42204. ;
  42205. ConnectionManager.prototype.sendActivityCheck = function () {
  42206. var _this = this;
  42207. this.stopActivityCheck();
  42208. this.connection.ping();
  42209. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  42210. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  42211. _this.retryIn(0);
  42212. });
  42213. };
  42214. ;
  42215. ConnectionManager.prototype.resetActivityCheck = function () {
  42216. var _this = this;
  42217. this.stopActivityCheck();
  42218. if (this.connection && !this.connection.handlesActivityChecks()) {
  42219. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  42220. _this.sendActivityCheck();
  42221. });
  42222. }
  42223. };
  42224. ;
  42225. ConnectionManager.prototype.stopActivityCheck = function () {
  42226. if (this.activityTimer) {
  42227. this.activityTimer.ensureAborted();
  42228. }
  42229. };
  42230. ;
  42231. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  42232. var _this = this;
  42233. return extend({}, errorCallbacks, {
  42234. message: function (message) {
  42235. _this.resetActivityCheck();
  42236. _this.emit('message', message);
  42237. },
  42238. ping: function () {
  42239. _this.send_event('pusher:pong', {});
  42240. },
  42241. activity: function () {
  42242. _this.resetActivityCheck();
  42243. },
  42244. error: function (error) {
  42245. _this.emit("error", { type: "WebSocketError", error: error });
  42246. },
  42247. closed: function () {
  42248. _this.abandonConnection();
  42249. if (_this.shouldRetry()) {
  42250. _this.retryIn(1000);
  42251. }
  42252. }
  42253. });
  42254. };
  42255. ;
  42256. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  42257. var _this = this;
  42258. return extend({}, errorCallbacks, {
  42259. connected: function (handshake) {
  42260. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  42261. _this.clearUnavailableTimer();
  42262. _this.setConnection(handshake.connection);
  42263. _this.socket_id = _this.connection.id;
  42264. _this.updateState("connected", { socket_id: _this.socket_id });
  42265. }
  42266. });
  42267. };
  42268. ;
  42269. ConnectionManager.prototype.buildErrorCallbacks = function () {
  42270. var _this = this;
  42271. var withErrorEmitted = function (callback) {
  42272. return function (result) {
  42273. if (result.error) {
  42274. _this.emit("error", { type: "WebSocketError", error: result.error });
  42275. }
  42276. callback(result);
  42277. };
  42278. };
  42279. return {
  42280. tls_only: withErrorEmitted(function () {
  42281. _this.usingTLS = true;
  42282. _this.updateStrategy();
  42283. _this.retryIn(0);
  42284. }),
  42285. refused: withErrorEmitted(function () {
  42286. _this.disconnect();
  42287. }),
  42288. backoff: withErrorEmitted(function () {
  42289. _this.retryIn(1000);
  42290. }),
  42291. retry: withErrorEmitted(function () {
  42292. _this.retryIn(0);
  42293. })
  42294. };
  42295. };
  42296. ;
  42297. ConnectionManager.prototype.setConnection = function (connection) {
  42298. this.connection = connection;
  42299. for (var event in this.connectionCallbacks) {
  42300. this.connection.bind(event, this.connectionCallbacks[event]);
  42301. }
  42302. this.resetActivityCheck();
  42303. };
  42304. ;
  42305. ConnectionManager.prototype.abandonConnection = function () {
  42306. if (!this.connection) {
  42307. return;
  42308. }
  42309. this.stopActivityCheck();
  42310. for (var event in this.connectionCallbacks) {
  42311. this.connection.unbind(event, this.connectionCallbacks[event]);
  42312. }
  42313. var connection = this.connection;
  42314. this.connection = null;
  42315. return connection;
  42316. };
  42317. ConnectionManager.prototype.updateState = function (newState, data) {
  42318. var previousState = this.state;
  42319. this.state = newState;
  42320. if (previousState !== newState) {
  42321. var newStateDescription = newState;
  42322. if (newStateDescription === "connected") {
  42323. newStateDescription += " with new socket ID " + data.socket_id;
  42324. }
  42325. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  42326. this.timeline.info({ state: newState, params: data });
  42327. this.emit('state_change', { previous: previousState, current: newState });
  42328. this.emit(newState, data);
  42329. }
  42330. };
  42331. ConnectionManager.prototype.shouldRetry = function () {
  42332. return this.state === "connecting" || this.state === "connected";
  42333. };
  42334. return ConnectionManager;
  42335. }(dispatcher));
  42336. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  42337. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  42338. var channels_Channels = (function () {
  42339. function Channels() {
  42340. this.channels = {};
  42341. }
  42342. Channels.prototype.add = function (name, pusher) {
  42343. if (!this.channels[name]) {
  42344. this.channels[name] = createChannel(name, pusher);
  42345. }
  42346. return this.channels[name];
  42347. };
  42348. Channels.prototype.all = function () {
  42349. return values(this.channels);
  42350. };
  42351. Channels.prototype.find = function (name) {
  42352. return this.channels[name];
  42353. };
  42354. Channels.prototype.remove = function (name) {
  42355. var channel = this.channels[name];
  42356. delete this.channels[name];
  42357. return channel;
  42358. };
  42359. Channels.prototype.disconnect = function () {
  42360. objectApply(this.channels, function (channel) {
  42361. channel.disconnect();
  42362. });
  42363. };
  42364. return Channels;
  42365. }());
  42366. /* harmony default export */ var channels = (channels_Channels);
  42367. function createChannel(name, pusher) {
  42368. if (name.indexOf('private-encrypted-') === 0) {
  42369. if (false) { var errorMsg; }
  42370. return factory.createEncryptedChannel(name, pusher);
  42371. }
  42372. else if (name.indexOf('private-') === 0) {
  42373. return factory.createPrivateChannel(name, pusher);
  42374. }
  42375. else if (name.indexOf('presence-') === 0) {
  42376. return factory.createPresenceChannel(name, pusher);
  42377. }
  42378. else {
  42379. return factory.createChannel(name, pusher);
  42380. }
  42381. }
  42382. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  42383. var Factory = {
  42384. createChannels: function () {
  42385. return new channels();
  42386. },
  42387. createConnectionManager: function (key, options) {
  42388. return new connection_manager(key, options);
  42389. },
  42390. createChannel: function (name, pusher) {
  42391. return new channels_channel(name, pusher);
  42392. },
  42393. createPrivateChannel: function (name, pusher) {
  42394. return new private_channel(name, pusher);
  42395. },
  42396. createPresenceChannel: function (name, pusher) {
  42397. return new presence_channel(name, pusher);
  42398. },
  42399. createEncryptedChannel: function (name, pusher) {
  42400. return new encrypted_channel(name, pusher);
  42401. },
  42402. createTimelineSender: function (timeline, options) {
  42403. return new timeline_sender(timeline, options);
  42404. },
  42405. createAuthorizer: function (channel, options) {
  42406. if (options.authorizer) {
  42407. return options.authorizer(channel, options);
  42408. }
  42409. return new pusher_authorizer(channel, options);
  42410. },
  42411. createHandshake: function (transport, callback) {
  42412. return new connection_handshake(transport, callback);
  42413. },
  42414. createAssistantToTheTransportManager: function (manager, transport, options) {
  42415. return new assistant_to_the_transport_manager(manager, transport, options);
  42416. }
  42417. };
  42418. /* harmony default export */ var factory = (Factory);
  42419. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  42420. var transport_manager_TransportManager = (function () {
  42421. function TransportManager(options) {
  42422. this.options = options || {};
  42423. this.livesLeft = this.options.lives || Infinity;
  42424. }
  42425. TransportManager.prototype.getAssistant = function (transport) {
  42426. return factory.createAssistantToTheTransportManager(this, transport, {
  42427. minPingDelay: this.options.minPingDelay,
  42428. maxPingDelay: this.options.maxPingDelay
  42429. });
  42430. };
  42431. TransportManager.prototype.isAlive = function () {
  42432. return this.livesLeft > 0;
  42433. };
  42434. TransportManager.prototype.reportDeath = function () {
  42435. this.livesLeft -= 1;
  42436. };
  42437. return TransportManager;
  42438. }());
  42439. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  42440. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  42441. var sequential_strategy_SequentialStrategy = (function () {
  42442. function SequentialStrategy(strategies, options) {
  42443. this.strategies = strategies;
  42444. this.loop = Boolean(options.loop);
  42445. this.failFast = Boolean(options.failFast);
  42446. this.timeout = options.timeout;
  42447. this.timeoutLimit = options.timeoutLimit;
  42448. }
  42449. SequentialStrategy.prototype.isSupported = function () {
  42450. return any(this.strategies, util.method("isSupported"));
  42451. };
  42452. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  42453. var _this = this;
  42454. var strategies = this.strategies;
  42455. var current = 0;
  42456. var timeout = this.timeout;
  42457. var runner = null;
  42458. var tryNextStrategy = function (error, handshake) {
  42459. if (handshake) {
  42460. callback(null, handshake);
  42461. }
  42462. else {
  42463. current = current + 1;
  42464. if (_this.loop) {
  42465. current = current % strategies.length;
  42466. }
  42467. if (current < strategies.length) {
  42468. if (timeout) {
  42469. timeout = timeout * 2;
  42470. if (_this.timeoutLimit) {
  42471. timeout = Math.min(timeout, _this.timeoutLimit);
  42472. }
  42473. }
  42474. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  42475. }
  42476. else {
  42477. callback(true);
  42478. }
  42479. }
  42480. };
  42481. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  42482. return {
  42483. abort: function () {
  42484. runner.abort();
  42485. },
  42486. forceMinPriority: function (p) {
  42487. minPriority = p;
  42488. if (runner) {
  42489. runner.forceMinPriority(p);
  42490. }
  42491. }
  42492. };
  42493. };
  42494. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  42495. var timer = null;
  42496. var runner = null;
  42497. if (options.timeout > 0) {
  42498. timer = new OneOffTimer(options.timeout, function () {
  42499. runner.abort();
  42500. callback(true);
  42501. });
  42502. }
  42503. runner = strategy.connect(minPriority, function (error, handshake) {
  42504. if (error && timer && timer.isRunning() && !options.failFast) {
  42505. return;
  42506. }
  42507. if (timer) {
  42508. timer.ensureAborted();
  42509. }
  42510. callback(error, handshake);
  42511. });
  42512. return {
  42513. abort: function () {
  42514. if (timer) {
  42515. timer.ensureAborted();
  42516. }
  42517. runner.abort();
  42518. },
  42519. forceMinPriority: function (p) {
  42520. runner.forceMinPriority(p);
  42521. }
  42522. };
  42523. };
  42524. return SequentialStrategy;
  42525. }());
  42526. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  42527. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  42528. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  42529. function BestConnectedEverStrategy(strategies) {
  42530. this.strategies = strategies;
  42531. }
  42532. BestConnectedEverStrategy.prototype.isSupported = function () {
  42533. return any(this.strategies, util.method("isSupported"));
  42534. };
  42535. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  42536. return connect(this.strategies, minPriority, function (i, runners) {
  42537. return function (error, handshake) {
  42538. runners[i].error = error;
  42539. if (error) {
  42540. if (allRunnersFailed(runners)) {
  42541. callback(true);
  42542. }
  42543. return;
  42544. }
  42545. apply(runners, function (runner) {
  42546. runner.forceMinPriority(handshake.transport.priority);
  42547. });
  42548. callback(null, handshake);
  42549. };
  42550. });
  42551. };
  42552. return BestConnectedEverStrategy;
  42553. }());
  42554. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  42555. function connect(strategies, minPriority, callbackBuilder) {
  42556. var runners = map(strategies, function (strategy, i, _, rs) {
  42557. return strategy.connect(minPriority, callbackBuilder(i, rs));
  42558. });
  42559. return {
  42560. abort: function () {
  42561. apply(runners, abortRunner);
  42562. },
  42563. forceMinPriority: function (p) {
  42564. apply(runners, function (runner) {
  42565. runner.forceMinPriority(p);
  42566. });
  42567. }
  42568. };
  42569. }
  42570. function allRunnersFailed(runners) {
  42571. return collections_all(runners, function (runner) {
  42572. return Boolean(runner.error);
  42573. });
  42574. }
  42575. function abortRunner(runner) {
  42576. if (!runner.error && !runner.aborted) {
  42577. runner.abort();
  42578. runner.aborted = true;
  42579. }
  42580. }
  42581. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  42582. var cached_strategy_CachedStrategy = (function () {
  42583. function CachedStrategy(strategy, transports, options) {
  42584. this.strategy = strategy;
  42585. this.transports = transports;
  42586. this.ttl = options.ttl || 1800 * 1000;
  42587. this.usingTLS = options.useTLS;
  42588. this.timeline = options.timeline;
  42589. }
  42590. CachedStrategy.prototype.isSupported = function () {
  42591. return this.strategy.isSupported();
  42592. };
  42593. CachedStrategy.prototype.connect = function (minPriority, callback) {
  42594. var usingTLS = this.usingTLS;
  42595. var info = fetchTransportCache(usingTLS);
  42596. var strategies = [this.strategy];
  42597. if (info && info.timestamp + this.ttl >= util.now()) {
  42598. var transport = this.transports[info.transport];
  42599. if (transport) {
  42600. this.timeline.info({
  42601. cached: true,
  42602. transport: info.transport,
  42603. latency: info.latency
  42604. });
  42605. strategies.push(new sequential_strategy([transport], {
  42606. timeout: info.latency * 2 + 1000,
  42607. failFast: true
  42608. }));
  42609. }
  42610. }
  42611. var startTimestamp = util.now();
  42612. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  42613. if (error) {
  42614. flushTransportCache(usingTLS);
  42615. if (strategies.length > 0) {
  42616. startTimestamp = util.now();
  42617. runner = strategies.pop().connect(minPriority, cb);
  42618. }
  42619. else {
  42620. callback(error);
  42621. }
  42622. }
  42623. else {
  42624. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  42625. callback(null, handshake);
  42626. }
  42627. });
  42628. return {
  42629. abort: function () {
  42630. runner.abort();
  42631. },
  42632. forceMinPriority: function (p) {
  42633. minPriority = p;
  42634. if (runner) {
  42635. runner.forceMinPriority(p);
  42636. }
  42637. }
  42638. };
  42639. };
  42640. return CachedStrategy;
  42641. }());
  42642. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  42643. function getTransportCacheKey(usingTLS) {
  42644. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  42645. }
  42646. function fetchTransportCache(usingTLS) {
  42647. var storage = runtime.getLocalStorage();
  42648. if (storage) {
  42649. try {
  42650. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  42651. if (serializedCache) {
  42652. return JSON.parse(serializedCache);
  42653. }
  42654. }
  42655. catch (e) {
  42656. flushTransportCache(usingTLS);
  42657. }
  42658. }
  42659. return null;
  42660. }
  42661. function storeTransportCache(usingTLS, transport, latency) {
  42662. var storage = runtime.getLocalStorage();
  42663. if (storage) {
  42664. try {
  42665. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  42666. timestamp: util.now(),
  42667. transport: transport,
  42668. latency: latency
  42669. });
  42670. }
  42671. catch (e) {
  42672. }
  42673. }
  42674. }
  42675. function flushTransportCache(usingTLS) {
  42676. var storage = runtime.getLocalStorage();
  42677. if (storage) {
  42678. try {
  42679. delete storage[getTransportCacheKey(usingTLS)];
  42680. }
  42681. catch (e) {
  42682. }
  42683. }
  42684. }
  42685. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  42686. var delayed_strategy_DelayedStrategy = (function () {
  42687. function DelayedStrategy(strategy, _a) {
  42688. var number = _a.delay;
  42689. this.strategy = strategy;
  42690. this.options = { delay: number };
  42691. }
  42692. DelayedStrategy.prototype.isSupported = function () {
  42693. return this.strategy.isSupported();
  42694. };
  42695. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  42696. var strategy = this.strategy;
  42697. var runner;
  42698. var timer = new OneOffTimer(this.options.delay, function () {
  42699. runner = strategy.connect(minPriority, callback);
  42700. });
  42701. return {
  42702. abort: function () {
  42703. timer.ensureAborted();
  42704. if (runner) {
  42705. runner.abort();
  42706. }
  42707. },
  42708. forceMinPriority: function (p) {
  42709. minPriority = p;
  42710. if (runner) {
  42711. runner.forceMinPriority(p);
  42712. }
  42713. }
  42714. };
  42715. };
  42716. return DelayedStrategy;
  42717. }());
  42718. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  42719. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  42720. var IfStrategy = (function () {
  42721. function IfStrategy(test, trueBranch, falseBranch) {
  42722. this.test = test;
  42723. this.trueBranch = trueBranch;
  42724. this.falseBranch = falseBranch;
  42725. }
  42726. IfStrategy.prototype.isSupported = function () {
  42727. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42728. return branch.isSupported();
  42729. };
  42730. IfStrategy.prototype.connect = function (minPriority, callback) {
  42731. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42732. return branch.connect(minPriority, callback);
  42733. };
  42734. return IfStrategy;
  42735. }());
  42736. /* harmony default export */ var if_strategy = (IfStrategy);
  42737. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  42738. var FirstConnectedStrategy = (function () {
  42739. function FirstConnectedStrategy(strategy) {
  42740. this.strategy = strategy;
  42741. }
  42742. FirstConnectedStrategy.prototype.isSupported = function () {
  42743. return this.strategy.isSupported();
  42744. };
  42745. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  42746. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  42747. if (handshake) {
  42748. runner.abort();
  42749. }
  42750. callback(error, handshake);
  42751. });
  42752. return runner;
  42753. };
  42754. return FirstConnectedStrategy;
  42755. }());
  42756. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  42757. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  42758. function testSupportsStrategy(strategy) {
  42759. return function () {
  42760. return strategy.isSupported();
  42761. };
  42762. }
  42763. var getDefaultStrategy = function (config, defineTransport) {
  42764. var definedTransports = {};
  42765. function defineTransportStrategy(name, type, priority, options, manager) {
  42766. var transport = defineTransport(config, name, type, priority, options, manager);
  42767. definedTransports[name] = transport;
  42768. return transport;
  42769. }
  42770. var ws_options = {
  42771. hostNonTLS: config.wsHost + ":" + config.wsPort,
  42772. hostTLS: config.wsHost + ":" + config.wssPort,
  42773. httpPath: config.wsPath
  42774. };
  42775. var wss_options = extend({}, ws_options, {
  42776. useTLS: true
  42777. });
  42778. var sockjs_options = {
  42779. hostNonTLS: config.httpHost + ":" + config.httpPort,
  42780. hostTLS: config.httpHost + ":" + config.httpsPort,
  42781. httpPath: config.httpPath
  42782. };
  42783. var timeouts = {
  42784. loop: true,
  42785. timeout: 15000,
  42786. timeoutLimit: 60000
  42787. };
  42788. var ws_manager = new transport_manager({
  42789. lives: 2,
  42790. minPingDelay: 10000,
  42791. maxPingDelay: config.activity_timeout
  42792. });
  42793. var streaming_manager = new transport_manager({
  42794. lives: 2,
  42795. minPingDelay: 10000,
  42796. maxPingDelay: config.activity_timeout
  42797. });
  42798. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  42799. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  42800. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  42801. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  42802. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  42803. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  42804. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  42805. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  42806. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  42807. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  42808. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  42809. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  42810. 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);
  42811. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  42812. var wsStrategy;
  42813. if (config.useTLS) {
  42814. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  42815. }
  42816. else {
  42817. wsStrategy = new best_connected_ever_strategy([
  42818. ws_loop,
  42819. new delayed_strategy(wss_loop, { delay: 2000 }),
  42820. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  42821. ]);
  42822. }
  42823. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  42824. ttl: 1800000,
  42825. timeline: config.timeline,
  42826. useTLS: config.useTLS
  42827. });
  42828. };
  42829. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  42830. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  42831. /* harmony default export */ var transport_connection_initializer = (function () {
  42832. var self = this;
  42833. self.timeline.info(self.buildTimelineMessage({
  42834. transport: self.name + (self.options.useTLS ? "s" : "")
  42835. }));
  42836. if (self.hooks.isInitialized()) {
  42837. self.changeState("initialized");
  42838. }
  42839. else if (self.hooks.file) {
  42840. self.changeState("initializing");
  42841. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  42842. if (self.hooks.isInitialized()) {
  42843. self.changeState("initialized");
  42844. callback(true);
  42845. }
  42846. else {
  42847. if (error) {
  42848. self.onError(error);
  42849. }
  42850. self.onClose();
  42851. callback(false);
  42852. }
  42853. });
  42854. }
  42855. else {
  42856. self.onClose();
  42857. }
  42858. });
  42859. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  42860. var http_xdomain_request_hooks = {
  42861. getRequest: function (socket) {
  42862. var xdr = new window.XDomainRequest();
  42863. xdr.ontimeout = function () {
  42864. socket.emit("error", new RequestTimedOut());
  42865. socket.close();
  42866. };
  42867. xdr.onerror = function (e) {
  42868. socket.emit("error", e);
  42869. socket.close();
  42870. };
  42871. xdr.onprogress = function () {
  42872. if (xdr.responseText && xdr.responseText.length > 0) {
  42873. socket.onChunk(200, xdr.responseText);
  42874. }
  42875. };
  42876. xdr.onload = function () {
  42877. if (xdr.responseText && xdr.responseText.length > 0) {
  42878. socket.onChunk(200, xdr.responseText);
  42879. }
  42880. socket.emit("finished", 200);
  42881. socket.close();
  42882. };
  42883. return xdr;
  42884. },
  42885. abortRequest: function (xdr) {
  42886. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  42887. xdr.abort();
  42888. }
  42889. };
  42890. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  42891. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  42892. var http_request_extends = (undefined && undefined.__extends) || (function () {
  42893. var extendStatics = function (d, b) {
  42894. extendStatics = Object.setPrototypeOf ||
  42895. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  42896. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  42897. return extendStatics(d, b);
  42898. };
  42899. return function (d, b) {
  42900. extendStatics(d, b);
  42901. function __() { this.constructor = d; }
  42902. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  42903. };
  42904. })();
  42905. var MAX_BUFFER_LENGTH = 256 * 1024;
  42906. var http_request_HTTPRequest = (function (_super) {
  42907. http_request_extends(HTTPRequest, _super);
  42908. function HTTPRequest(hooks, method, url) {
  42909. var _this = _super.call(this) || this;
  42910. _this.hooks = hooks;
  42911. _this.method = method;
  42912. _this.url = url;
  42913. return _this;
  42914. }
  42915. HTTPRequest.prototype.start = function (payload) {
  42916. var _this = this;
  42917. this.position = 0;
  42918. this.xhr = this.hooks.getRequest(this);
  42919. this.unloader = function () {
  42920. _this.close();
  42921. };
  42922. runtime.addUnloadListener(this.unloader);
  42923. this.xhr.open(this.method, this.url, true);
  42924. if (this.xhr.setRequestHeader) {
  42925. this.xhr.setRequestHeader("Content-Type", "application/json");
  42926. }
  42927. this.xhr.send(payload);
  42928. };
  42929. HTTPRequest.prototype.close = function () {
  42930. if (this.unloader) {
  42931. runtime.removeUnloadListener(this.unloader);
  42932. this.unloader = null;
  42933. }
  42934. if (this.xhr) {
  42935. this.hooks.abortRequest(this.xhr);
  42936. this.xhr = null;
  42937. }
  42938. };
  42939. HTTPRequest.prototype.onChunk = function (status, data) {
  42940. while (true) {
  42941. var chunk = this.advanceBuffer(data);
  42942. if (chunk) {
  42943. this.emit("chunk", { status: status, data: chunk });
  42944. }
  42945. else {
  42946. break;
  42947. }
  42948. }
  42949. if (this.isBufferTooLong(data)) {
  42950. this.emit("buffer_too_long");
  42951. }
  42952. };
  42953. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42954. var unreadData = buffer.slice(this.position);
  42955. var endOfLinePosition = unreadData.indexOf("\n");
  42956. if (endOfLinePosition !== -1) {
  42957. this.position += endOfLinePosition + 1;
  42958. return unreadData.slice(0, endOfLinePosition);
  42959. }
  42960. else {
  42961. return null;
  42962. }
  42963. };
  42964. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42965. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42966. };
  42967. return HTTPRequest;
  42968. }(dispatcher));
  42969. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42970. // CONCATENATED MODULE: ./src/core/http/state.ts
  42971. var State;
  42972. (function (State) {
  42973. State[State["CONNECTING"] = 0] = "CONNECTING";
  42974. State[State["OPEN"] = 1] = "OPEN";
  42975. State[State["CLOSED"] = 3] = "CLOSED";
  42976. })(State || (State = {}));
  42977. /* harmony default export */ var state = (State);
  42978. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42979. var autoIncrement = 1;
  42980. var http_socket_HTTPSocket = (function () {
  42981. function HTTPSocket(hooks, url) {
  42982. this.hooks = hooks;
  42983. this.session = randomNumber(1000) + "/" + randomString(8);
  42984. this.location = getLocation(url);
  42985. this.readyState = state.CONNECTING;
  42986. this.openStream();
  42987. }
  42988. HTTPSocket.prototype.send = function (payload) {
  42989. return this.sendRaw(JSON.stringify([payload]));
  42990. };
  42991. HTTPSocket.prototype.ping = function () {
  42992. this.hooks.sendHeartbeat(this);
  42993. };
  42994. HTTPSocket.prototype.close = function (code, reason) {
  42995. this.onClose(code, reason, true);
  42996. };
  42997. HTTPSocket.prototype.sendRaw = function (payload) {
  42998. if (this.readyState === state.OPEN) {
  42999. try {
  43000. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  43001. return true;
  43002. }
  43003. catch (e) {
  43004. return false;
  43005. }
  43006. }
  43007. else {
  43008. return false;
  43009. }
  43010. };
  43011. HTTPSocket.prototype.reconnect = function () {
  43012. this.closeStream();
  43013. this.openStream();
  43014. };
  43015. ;
  43016. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  43017. this.closeStream();
  43018. this.readyState = state.CLOSED;
  43019. if (this.onclose) {
  43020. this.onclose({
  43021. code: code,
  43022. reason: reason,
  43023. wasClean: wasClean
  43024. });
  43025. }
  43026. };
  43027. HTTPSocket.prototype.onChunk = function (chunk) {
  43028. if (chunk.status !== 200) {
  43029. return;
  43030. }
  43031. if (this.readyState === state.OPEN) {
  43032. this.onActivity();
  43033. }
  43034. var payload;
  43035. var type = chunk.data.slice(0, 1);
  43036. switch (type) {
  43037. case 'o':
  43038. payload = JSON.parse(chunk.data.slice(1) || '{}');
  43039. this.onOpen(payload);
  43040. break;
  43041. case 'a':
  43042. payload = JSON.parse(chunk.data.slice(1) || '[]');
  43043. for (var i = 0; i < payload.length; i++) {
  43044. this.onEvent(payload[i]);
  43045. }
  43046. break;
  43047. case 'm':
  43048. payload = JSON.parse(chunk.data.slice(1) || 'null');
  43049. this.onEvent(payload);
  43050. break;
  43051. case 'h':
  43052. this.hooks.onHeartbeat(this);
  43053. break;
  43054. case 'c':
  43055. payload = JSON.parse(chunk.data.slice(1) || '[]');
  43056. this.onClose(payload[0], payload[1], true);
  43057. break;
  43058. }
  43059. };
  43060. HTTPSocket.prototype.onOpen = function (options) {
  43061. if (this.readyState === state.CONNECTING) {
  43062. if (options && options.hostname) {
  43063. this.location.base = replaceHost(this.location.base, options.hostname);
  43064. }
  43065. this.readyState = state.OPEN;
  43066. if (this.onopen) {
  43067. this.onopen();
  43068. }
  43069. }
  43070. else {
  43071. this.onClose(1006, "Server lost session", true);
  43072. }
  43073. };
  43074. HTTPSocket.prototype.onEvent = function (event) {
  43075. if (this.readyState === state.OPEN && this.onmessage) {
  43076. this.onmessage({ data: event });
  43077. }
  43078. };
  43079. HTTPSocket.prototype.onActivity = function () {
  43080. if (this.onactivity) {
  43081. this.onactivity();
  43082. }
  43083. };
  43084. HTTPSocket.prototype.onError = function (error) {
  43085. if (this.onerror) {
  43086. this.onerror(error);
  43087. }
  43088. };
  43089. HTTPSocket.prototype.openStream = function () {
  43090. var _this = this;
  43091. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  43092. this.stream.bind("chunk", function (chunk) {
  43093. _this.onChunk(chunk);
  43094. });
  43095. this.stream.bind("finished", function (status) {
  43096. _this.hooks.onFinished(_this, status);
  43097. });
  43098. this.stream.bind("buffer_too_long", function () {
  43099. _this.reconnect();
  43100. });
  43101. try {
  43102. this.stream.start();
  43103. }
  43104. catch (error) {
  43105. util.defer(function () {
  43106. _this.onError(error);
  43107. _this.onClose(1006, "Could not start streaming", false);
  43108. });
  43109. }
  43110. };
  43111. HTTPSocket.prototype.closeStream = function () {
  43112. if (this.stream) {
  43113. this.stream.unbind_all();
  43114. this.stream.close();
  43115. this.stream = null;
  43116. }
  43117. };
  43118. return HTTPSocket;
  43119. }());
  43120. function getLocation(url) {
  43121. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  43122. return {
  43123. base: parts[1],
  43124. queryString: parts[2]
  43125. };
  43126. }
  43127. function getSendURL(url, session) {
  43128. return url.base + "/" + session + "/xhr_send";
  43129. }
  43130. function getUniqueURL(url) {
  43131. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  43132. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  43133. }
  43134. function replaceHost(url, hostname) {
  43135. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  43136. return urlParts[1] + hostname + urlParts[3];
  43137. }
  43138. function randomNumber(max) {
  43139. return Math.floor(Math.random() * max);
  43140. }
  43141. function randomString(length) {
  43142. var result = [];
  43143. for (var i = 0; i < length; i++) {
  43144. result.push(randomNumber(32).toString(32));
  43145. }
  43146. return result.join('');
  43147. }
  43148. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  43149. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  43150. var http_streaming_socket_hooks = {
  43151. getReceiveURL: function (url, session) {
  43152. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  43153. },
  43154. onHeartbeat: function (socket) {
  43155. socket.sendRaw("[]");
  43156. },
  43157. sendHeartbeat: function (socket) {
  43158. socket.sendRaw("[]");
  43159. },
  43160. onFinished: function (socket, status) {
  43161. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  43162. }
  43163. };
  43164. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  43165. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  43166. var http_polling_socket_hooks = {
  43167. getReceiveURL: function (url, session) {
  43168. return url.base + "/" + session + "/xhr" + url.queryString;
  43169. },
  43170. onHeartbeat: function () {
  43171. },
  43172. sendHeartbeat: function (socket) {
  43173. socket.sendRaw("[]");
  43174. },
  43175. onFinished: function (socket, status) {
  43176. if (status === 200) {
  43177. socket.reconnect();
  43178. }
  43179. else {
  43180. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  43181. }
  43182. }
  43183. };
  43184. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  43185. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  43186. var http_xhr_request_hooks = {
  43187. getRequest: function (socket) {
  43188. var Constructor = runtime.getXHRAPI();
  43189. var xhr = new Constructor();
  43190. xhr.onreadystatechange = xhr.onprogress = function () {
  43191. switch (xhr.readyState) {
  43192. case 3:
  43193. if (xhr.responseText && xhr.responseText.length > 0) {
  43194. socket.onChunk(xhr.status, xhr.responseText);
  43195. }
  43196. break;
  43197. case 4:
  43198. if (xhr.responseText && xhr.responseText.length > 0) {
  43199. socket.onChunk(xhr.status, xhr.responseText);
  43200. }
  43201. socket.emit("finished", xhr.status);
  43202. socket.close();
  43203. break;
  43204. }
  43205. };
  43206. return xhr;
  43207. },
  43208. abortRequest: function (xhr) {
  43209. xhr.onreadystatechange = null;
  43210. xhr.abort();
  43211. }
  43212. };
  43213. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  43214. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  43215. var HTTP = {
  43216. createStreamingSocket: function (url) {
  43217. return this.createSocket(http_streaming_socket, url);
  43218. },
  43219. createPollingSocket: function (url) {
  43220. return this.createSocket(http_polling_socket, url);
  43221. },
  43222. createSocket: function (hooks, url) {
  43223. return new http_socket(hooks, url);
  43224. },
  43225. createXHR: function (method, url) {
  43226. return this.createRequest(http_xhr_request, method, url);
  43227. },
  43228. createRequest: function (hooks, method, url) {
  43229. return new http_request(hooks, method, url);
  43230. }
  43231. };
  43232. /* harmony default export */ var http_http = (HTTP);
  43233. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  43234. http_http.createXDR = function (method, url) {
  43235. return this.createRequest(http_xdomain_request, method, url);
  43236. };
  43237. /* harmony default export */ var web_http_http = (http_http);
  43238. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  43239. var Runtime = {
  43240. nextAuthCallbackID: 1,
  43241. auth_callbacks: {},
  43242. ScriptReceivers: ScriptReceivers,
  43243. DependenciesReceivers: DependenciesReceivers,
  43244. getDefaultStrategy: default_strategy,
  43245. Transports: transports_transports,
  43246. transportConnectionInitializer: transport_connection_initializer,
  43247. HTTPFactory: web_http_http,
  43248. TimelineTransport: jsonp_timeline,
  43249. getXHRAPI: function () {
  43250. return window.XMLHttpRequest;
  43251. },
  43252. getWebSocketAPI: function () {
  43253. return window.WebSocket || window.MozWebSocket;
  43254. },
  43255. setup: function (PusherClass) {
  43256. var _this = this;
  43257. window.Pusher = PusherClass;
  43258. var initializeOnDocumentBody = function () {
  43259. _this.onDocumentBody(PusherClass.ready);
  43260. };
  43261. if (!window.JSON) {
  43262. Dependencies.load("json2", {}, initializeOnDocumentBody);
  43263. }
  43264. else {
  43265. initializeOnDocumentBody();
  43266. }
  43267. },
  43268. getDocument: function () {
  43269. return document;
  43270. },
  43271. getProtocol: function () {
  43272. return this.getDocument().location.protocol;
  43273. },
  43274. getAuthorizers: function () {
  43275. return { ajax: xhr_auth, jsonp: jsonp_auth };
  43276. },
  43277. onDocumentBody: function (callback) {
  43278. var _this = this;
  43279. if (document.body) {
  43280. callback();
  43281. }
  43282. else {
  43283. setTimeout(function () {
  43284. _this.onDocumentBody(callback);
  43285. }, 0);
  43286. }
  43287. },
  43288. createJSONPRequest: function (url, data) {
  43289. return new jsonp_request(url, data);
  43290. },
  43291. createScriptRequest: function (src) {
  43292. return new script_request(src);
  43293. },
  43294. getLocalStorage: function () {
  43295. try {
  43296. return window.localStorage;
  43297. }
  43298. catch (e) {
  43299. return undefined;
  43300. }
  43301. },
  43302. createXHR: function () {
  43303. if (this.getXHRAPI()) {
  43304. return this.createXMLHttpRequest();
  43305. }
  43306. else {
  43307. return this.createMicrosoftXHR();
  43308. }
  43309. },
  43310. createXMLHttpRequest: function () {
  43311. var Constructor = this.getXHRAPI();
  43312. return new Constructor();
  43313. },
  43314. createMicrosoftXHR: function () {
  43315. return new ActiveXObject("Microsoft.XMLHTTP");
  43316. },
  43317. getNetwork: function () {
  43318. return net_info_Network;
  43319. },
  43320. createWebSocket: function (url) {
  43321. var Constructor = this.getWebSocketAPI();
  43322. return new Constructor(url);
  43323. },
  43324. createSocketRequest: function (method, url) {
  43325. if (this.isXHRSupported()) {
  43326. return this.HTTPFactory.createXHR(method, url);
  43327. }
  43328. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  43329. return this.HTTPFactory.createXDR(method, url);
  43330. }
  43331. else {
  43332. throw "Cross-origin HTTP requests are not supported";
  43333. }
  43334. },
  43335. isXHRSupported: function () {
  43336. var Constructor = this.getXHRAPI();
  43337. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  43338. },
  43339. isXDRSupported: function (useTLS) {
  43340. var protocol = useTLS ? "https:" : "http:";
  43341. var documentProtocol = this.getProtocol();
  43342. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  43343. },
  43344. addUnloadListener: function (listener) {
  43345. if (window.addEventListener !== undefined) {
  43346. window.addEventListener("unload", listener, false);
  43347. }
  43348. else if (window.attachEvent !== undefined) {
  43349. window.attachEvent("onunload", listener);
  43350. }
  43351. },
  43352. removeUnloadListener: function (listener) {
  43353. if (window.addEventListener !== undefined) {
  43354. window.removeEventListener("unload", listener, false);
  43355. }
  43356. else if (window.detachEvent !== undefined) {
  43357. window.detachEvent("onunload", listener);
  43358. }
  43359. }
  43360. };
  43361. /* harmony default export */ var runtime = (Runtime);
  43362. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  43363. var TimelineLevel;
  43364. (function (TimelineLevel) {
  43365. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  43366. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  43367. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  43368. })(TimelineLevel || (TimelineLevel = {}));
  43369. /* harmony default export */ var timeline_level = (TimelineLevel);
  43370. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  43371. var timeline_Timeline = (function () {
  43372. function Timeline(key, session, options) {
  43373. this.key = key;
  43374. this.session = session;
  43375. this.events = [];
  43376. this.options = options || {};
  43377. this.sent = 0;
  43378. this.uniqueID = 0;
  43379. }
  43380. Timeline.prototype.log = function (level, event) {
  43381. if (level <= this.options.level) {
  43382. this.events.push(extend({}, event, { timestamp: util.now() }));
  43383. if (this.options.limit && this.events.length > this.options.limit) {
  43384. this.events.shift();
  43385. }
  43386. }
  43387. };
  43388. Timeline.prototype.error = function (event) {
  43389. this.log(timeline_level.ERROR, event);
  43390. };
  43391. Timeline.prototype.info = function (event) {
  43392. this.log(timeline_level.INFO, event);
  43393. };
  43394. Timeline.prototype.debug = function (event) {
  43395. this.log(timeline_level.DEBUG, event);
  43396. };
  43397. Timeline.prototype.isEmpty = function () {
  43398. return this.events.length === 0;
  43399. };
  43400. Timeline.prototype.send = function (sendfn, callback) {
  43401. var _this = this;
  43402. var data = extend({
  43403. session: this.session,
  43404. bundle: this.sent + 1,
  43405. key: this.key,
  43406. lib: "js",
  43407. version: this.options.version,
  43408. cluster: this.options.cluster,
  43409. features: this.options.features,
  43410. timeline: this.events
  43411. }, this.options.params);
  43412. this.events = [];
  43413. sendfn(data, function (error, result) {
  43414. if (!error) {
  43415. _this.sent++;
  43416. }
  43417. if (callback) {
  43418. callback(error, result);
  43419. }
  43420. });
  43421. return true;
  43422. };
  43423. Timeline.prototype.generateUniqueID = function () {
  43424. this.uniqueID++;
  43425. return this.uniqueID;
  43426. };
  43427. return Timeline;
  43428. }());
  43429. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  43430. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  43431. var transport_strategy_TransportStrategy = (function () {
  43432. function TransportStrategy(name, priority, transport, options) {
  43433. this.name = name;
  43434. this.priority = priority;
  43435. this.transport = transport;
  43436. this.options = options || {};
  43437. }
  43438. TransportStrategy.prototype.isSupported = function () {
  43439. return this.transport.isSupported({
  43440. useTLS: this.options.useTLS
  43441. });
  43442. };
  43443. TransportStrategy.prototype.connect = function (minPriority, callback) {
  43444. var _this = this;
  43445. if (!this.isSupported()) {
  43446. return failAttempt(new UnsupportedStrategy(), callback);
  43447. }
  43448. else if (this.priority < minPriority) {
  43449. return failAttempt(new TransportPriorityTooLow(), callback);
  43450. }
  43451. var connected = false;
  43452. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  43453. var handshake = null;
  43454. var onInitialized = function () {
  43455. transport.unbind("initialized", onInitialized);
  43456. transport.connect();
  43457. };
  43458. var onOpen = function () {
  43459. handshake = factory.createHandshake(transport, function (result) {
  43460. connected = true;
  43461. unbindListeners();
  43462. callback(null, result);
  43463. });
  43464. };
  43465. var onError = function (error) {
  43466. unbindListeners();
  43467. callback(error);
  43468. };
  43469. var onClosed = function () {
  43470. unbindListeners();
  43471. var serializedTransport;
  43472. serializedTransport = safeJSONStringify(transport);
  43473. callback(new TransportClosed(serializedTransport));
  43474. };
  43475. var unbindListeners = function () {
  43476. transport.unbind("initialized", onInitialized);
  43477. transport.unbind("open", onOpen);
  43478. transport.unbind("error", onError);
  43479. transport.unbind("closed", onClosed);
  43480. };
  43481. transport.bind("initialized", onInitialized);
  43482. transport.bind("open", onOpen);
  43483. transport.bind("error", onError);
  43484. transport.bind("closed", onClosed);
  43485. transport.initialize();
  43486. return {
  43487. abort: function () {
  43488. if (connected) {
  43489. return;
  43490. }
  43491. unbindListeners();
  43492. if (handshake) {
  43493. handshake.close();
  43494. }
  43495. else {
  43496. transport.close();
  43497. }
  43498. },
  43499. forceMinPriority: function (p) {
  43500. if (connected) {
  43501. return;
  43502. }
  43503. if (_this.priority < p) {
  43504. if (handshake) {
  43505. handshake.close();
  43506. }
  43507. else {
  43508. transport.close();
  43509. }
  43510. }
  43511. }
  43512. };
  43513. };
  43514. return TransportStrategy;
  43515. }());
  43516. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  43517. function failAttempt(error, callback) {
  43518. util.defer(function () {
  43519. callback(error);
  43520. });
  43521. return {
  43522. abort: function () { },
  43523. forceMinPriority: function () { }
  43524. };
  43525. }
  43526. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  43527. var strategy_builder_Transports = runtime.Transports;
  43528. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  43529. var transportClass = strategy_builder_Transports[type];
  43530. if (!transportClass) {
  43531. throw new UnsupportedTransport(type);
  43532. }
  43533. var enabled = (!config.enabledTransports ||
  43534. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  43535. (!config.disabledTransports ||
  43536. arrayIndexOf(config.disabledTransports, name) === -1);
  43537. var transport;
  43538. if (enabled) {
  43539. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  43540. key: config.key,
  43541. useTLS: config.useTLS,
  43542. timeline: config.timeline,
  43543. ignoreNullOrigin: config.ignoreNullOrigin
  43544. }, options));
  43545. }
  43546. else {
  43547. transport = strategy_builder_UnsupportedStrategy;
  43548. }
  43549. return transport;
  43550. };
  43551. var strategy_builder_UnsupportedStrategy = {
  43552. isSupported: function () {
  43553. return false;
  43554. },
  43555. connect: function (_, callback) {
  43556. var deferred = util.defer(function () {
  43557. callback(new UnsupportedStrategy());
  43558. });
  43559. return {
  43560. abort: function () {
  43561. deferred.ensureAborted();
  43562. },
  43563. forceMinPriority: function () { }
  43564. };
  43565. }
  43566. };
  43567. // CONCATENATED MODULE: ./src/core/config.ts
  43568. var getGlobalConfig = function () {
  43569. return {
  43570. wsHost: defaults.host,
  43571. wsPort: defaults.ws_port,
  43572. wssPort: defaults.wss_port,
  43573. wsPath: defaults.ws_path,
  43574. httpHost: defaults.sockjs_host,
  43575. httpPort: defaults.sockjs_http_port,
  43576. httpsPort: defaults.sockjs_https_port,
  43577. httpPath: defaults.sockjs_path,
  43578. statsHost: defaults.stats_host,
  43579. authEndpoint: defaults.channel_auth_endpoint,
  43580. authTransport: defaults.channel_auth_transport,
  43581. activity_timeout: defaults.activity_timeout,
  43582. pong_timeout: defaults.pong_timeout,
  43583. unavailable_timeout: defaults.unavailable_timeout
  43584. };
  43585. };
  43586. var getClusterConfig = function (clusterName) {
  43587. return {
  43588. wsHost: 'ws-' + clusterName + '.pusher.com',
  43589. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  43590. };
  43591. };
  43592. // CONCATENATED MODULE: ./src/core/pusher.ts
  43593. var pusher_Pusher = (function () {
  43594. function Pusher(app_key, options) {
  43595. var _this = this;
  43596. checkAppKey(app_key);
  43597. options = options || {};
  43598. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  43599. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  43600. logger.warn("You should always specify a cluster when connecting. " + suffix);
  43601. }
  43602. this.key = app_key;
  43603. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  43604. this.channels = factory.createChannels();
  43605. this.global_emitter = new dispatcher();
  43606. this.sessionID = Math.floor(Math.random() * 1000000000);
  43607. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  43608. cluster: this.config.cluster,
  43609. features: Pusher.getClientFeatures(),
  43610. params: this.config.timelineParams || {},
  43611. limit: 50,
  43612. level: timeline_level.INFO,
  43613. version: defaults.VERSION
  43614. });
  43615. if (!this.config.disableStats) {
  43616. this.timelineSender = factory.createTimelineSender(this.timeline, {
  43617. host: this.config.statsHost,
  43618. path: '/timeline/v2/' + runtime.TimelineTransport.name
  43619. });
  43620. }
  43621. var getStrategy = function (options) {
  43622. var config = extend({}, _this.config, options);
  43623. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  43624. };
  43625. this.connection = factory.createConnectionManager(this.key, extend({
  43626. getStrategy: getStrategy,
  43627. timeline: this.timeline,
  43628. activityTimeout: this.config.activity_timeout,
  43629. pongTimeout: this.config.pong_timeout,
  43630. unavailableTimeout: this.config.unavailable_timeout
  43631. }, this.config, { useTLS: this.shouldUseTLS() }));
  43632. this.connection.bind('connected', function () {
  43633. _this.subscribeAll();
  43634. if (_this.timelineSender) {
  43635. _this.timelineSender.send(_this.connection.isUsingTLS());
  43636. }
  43637. });
  43638. this.connection.bind('message', function (event) {
  43639. var eventName = event.event;
  43640. var internal = eventName.indexOf('pusher_internal:') === 0;
  43641. if (event.channel) {
  43642. var channel = _this.channel(event.channel);
  43643. if (channel) {
  43644. channel.handleEvent(event);
  43645. }
  43646. }
  43647. if (!internal) {
  43648. _this.global_emitter.emit(event.event, event.data);
  43649. }
  43650. });
  43651. this.connection.bind('connecting', function () {
  43652. _this.channels.disconnect();
  43653. });
  43654. this.connection.bind('disconnected', function () {
  43655. _this.channels.disconnect();
  43656. });
  43657. this.connection.bind('error', function (err) {
  43658. logger.warn(err);
  43659. });
  43660. Pusher.instances.push(this);
  43661. this.timeline.info({ instances: Pusher.instances.length });
  43662. if (Pusher.isReady) {
  43663. this.connect();
  43664. }
  43665. }
  43666. Pusher.ready = function () {
  43667. Pusher.isReady = true;
  43668. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  43669. Pusher.instances[i].connect();
  43670. }
  43671. };
  43672. Pusher.getClientFeatures = function () {
  43673. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  43674. return t.isSupported({});
  43675. }));
  43676. };
  43677. Pusher.prototype.channel = function (name) {
  43678. return this.channels.find(name);
  43679. };
  43680. Pusher.prototype.allChannels = function () {
  43681. return this.channels.all();
  43682. };
  43683. Pusher.prototype.connect = function () {
  43684. this.connection.connect();
  43685. if (this.timelineSender) {
  43686. if (!this.timelineSenderTimer) {
  43687. var usingTLS = this.connection.isUsingTLS();
  43688. var timelineSender = this.timelineSender;
  43689. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  43690. timelineSender.send(usingTLS);
  43691. });
  43692. }
  43693. }
  43694. };
  43695. Pusher.prototype.disconnect = function () {
  43696. this.connection.disconnect();
  43697. if (this.timelineSenderTimer) {
  43698. this.timelineSenderTimer.ensureAborted();
  43699. this.timelineSenderTimer = null;
  43700. }
  43701. };
  43702. Pusher.prototype.bind = function (event_name, callback, context) {
  43703. this.global_emitter.bind(event_name, callback, context);
  43704. return this;
  43705. };
  43706. Pusher.prototype.unbind = function (event_name, callback, context) {
  43707. this.global_emitter.unbind(event_name, callback, context);
  43708. return this;
  43709. };
  43710. Pusher.prototype.bind_global = function (callback) {
  43711. this.global_emitter.bind_global(callback);
  43712. return this;
  43713. };
  43714. Pusher.prototype.unbind_global = function (callback) {
  43715. this.global_emitter.unbind_global(callback);
  43716. return this;
  43717. };
  43718. Pusher.prototype.unbind_all = function (callback) {
  43719. this.global_emitter.unbind_all();
  43720. return this;
  43721. };
  43722. Pusher.prototype.subscribeAll = function () {
  43723. var channelName;
  43724. for (channelName in this.channels.channels) {
  43725. if (this.channels.channels.hasOwnProperty(channelName)) {
  43726. this.subscribe(channelName);
  43727. }
  43728. }
  43729. };
  43730. Pusher.prototype.subscribe = function (channel_name) {
  43731. var channel = this.channels.add(channel_name, this);
  43732. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  43733. channel.reinstateSubscription();
  43734. }
  43735. else if (!channel.subscriptionPending &&
  43736. this.connection.state === 'connected') {
  43737. channel.subscribe();
  43738. }
  43739. return channel;
  43740. };
  43741. Pusher.prototype.unsubscribe = function (channel_name) {
  43742. var channel = this.channels.find(channel_name);
  43743. if (channel && channel.subscriptionPending) {
  43744. channel.cancelSubscription();
  43745. }
  43746. else {
  43747. channel = this.channels.remove(channel_name);
  43748. if (channel && this.connection.state === 'connected') {
  43749. channel.unsubscribe();
  43750. }
  43751. }
  43752. };
  43753. Pusher.prototype.send_event = function (event_name, data, channel) {
  43754. return this.connection.send_event(event_name, data, channel);
  43755. };
  43756. Pusher.prototype.shouldUseTLS = function () {
  43757. if (runtime.getProtocol() === 'https:') {
  43758. return true;
  43759. }
  43760. else if (this.config.forceTLS === true) {
  43761. return true;
  43762. }
  43763. else {
  43764. return Boolean(this.config.encrypted);
  43765. }
  43766. };
  43767. Pusher.instances = [];
  43768. Pusher.isReady = false;
  43769. Pusher.logToConsole = false;
  43770. Pusher.Runtime = runtime;
  43771. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  43772. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  43773. Pusher.auth_callbacks = runtime.auth_callbacks;
  43774. return Pusher;
  43775. }());
  43776. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  43777. function checkAppKey(key) {
  43778. if (key === null || key === undefined) {
  43779. throw 'You must pass your app key when you instantiate Pusher.';
  43780. }
  43781. }
  43782. runtime.setup(pusher_Pusher);
  43783. /***/ })
  43784. /******/ ]);
  43785. });
  43786. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  43787. /***/ }),
  43788. /***/ "./node_modules/setimmediate/setImmediate.js":
  43789. /*!***************************************************!*\
  43790. !*** ./node_modules/setimmediate/setImmediate.js ***!
  43791. \***************************************************/
  43792. /*! no static exports found */
  43793. /***/ (function(module, exports, __webpack_require__) {
  43794. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  43795. "use strict";
  43796. if (global.setImmediate) {
  43797. return;
  43798. }
  43799. var nextHandle = 1; // Spec says greater than zero
  43800. var tasksByHandle = {};
  43801. var currentlyRunningATask = false;
  43802. var doc = global.document;
  43803. var registerImmediate;
  43804. function setImmediate(callback) {
  43805. // Callback can either be a function or a string
  43806. if (typeof callback !== "function") {
  43807. callback = new Function("" + callback);
  43808. }
  43809. // Copy function arguments
  43810. var args = new Array(arguments.length - 1);
  43811. for (var i = 0; i < args.length; i++) {
  43812. args[i] = arguments[i + 1];
  43813. }
  43814. // Store and register the task
  43815. var task = { callback: callback, args: args };
  43816. tasksByHandle[nextHandle] = task;
  43817. registerImmediate(nextHandle);
  43818. return nextHandle++;
  43819. }
  43820. function clearImmediate(handle) {
  43821. delete tasksByHandle[handle];
  43822. }
  43823. function run(task) {
  43824. var callback = task.callback;
  43825. var args = task.args;
  43826. switch (args.length) {
  43827. case 0:
  43828. callback();
  43829. break;
  43830. case 1:
  43831. callback(args[0]);
  43832. break;
  43833. case 2:
  43834. callback(args[0], args[1]);
  43835. break;
  43836. case 3:
  43837. callback(args[0], args[1], args[2]);
  43838. break;
  43839. default:
  43840. callback.apply(undefined, args);
  43841. break;
  43842. }
  43843. }
  43844. function runIfPresent(handle) {
  43845. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  43846. // So if we're currently running a task, we'll need to delay this invocation.
  43847. if (currentlyRunningATask) {
  43848. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  43849. // "too much recursion" error.
  43850. setTimeout(runIfPresent, 0, handle);
  43851. } else {
  43852. var task = tasksByHandle[handle];
  43853. if (task) {
  43854. currentlyRunningATask = true;
  43855. try {
  43856. run(task);
  43857. } finally {
  43858. clearImmediate(handle);
  43859. currentlyRunningATask = false;
  43860. }
  43861. }
  43862. }
  43863. }
  43864. function installNextTickImplementation() {
  43865. registerImmediate = function(handle) {
  43866. process.nextTick(function () { runIfPresent(handle); });
  43867. };
  43868. }
  43869. function canUsePostMessage() {
  43870. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  43871. // where `global.postMessage` means something completely different and can't be used for this purpose.
  43872. if (global.postMessage && !global.importScripts) {
  43873. var postMessageIsAsynchronous = true;
  43874. var oldOnMessage = global.onmessage;
  43875. global.onmessage = function() {
  43876. postMessageIsAsynchronous = false;
  43877. };
  43878. global.postMessage("", "*");
  43879. global.onmessage = oldOnMessage;
  43880. return postMessageIsAsynchronous;
  43881. }
  43882. }
  43883. function installPostMessageImplementation() {
  43884. // Installs an event handler on `global` for the `message` event: see
  43885. // * https://developer.mozilla.org/en/DOM/window.postMessage
  43886. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  43887. var messagePrefix = "setImmediate$" + Math.random() + "$";
  43888. var onGlobalMessage = function(event) {
  43889. if (event.source === global &&
  43890. typeof event.data === "string" &&
  43891. event.data.indexOf(messagePrefix) === 0) {
  43892. runIfPresent(+event.data.slice(messagePrefix.length));
  43893. }
  43894. };
  43895. if (global.addEventListener) {
  43896. global.addEventListener("message", onGlobalMessage, false);
  43897. } else {
  43898. global.attachEvent("onmessage", onGlobalMessage);
  43899. }
  43900. registerImmediate = function(handle) {
  43901. global.postMessage(messagePrefix + handle, "*");
  43902. };
  43903. }
  43904. function installMessageChannelImplementation() {
  43905. var channel = new MessageChannel();
  43906. channel.port1.onmessage = function(event) {
  43907. var handle = event.data;
  43908. runIfPresent(handle);
  43909. };
  43910. registerImmediate = function(handle) {
  43911. channel.port2.postMessage(handle);
  43912. };
  43913. }
  43914. function installReadyStateChangeImplementation() {
  43915. var html = doc.documentElement;
  43916. registerImmediate = function(handle) {
  43917. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  43918. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  43919. var script = doc.createElement("script");
  43920. script.onreadystatechange = function () {
  43921. runIfPresent(handle);
  43922. script.onreadystatechange = null;
  43923. html.removeChild(script);
  43924. script = null;
  43925. };
  43926. html.appendChild(script);
  43927. };
  43928. }
  43929. function installSetTimeoutImplementation() {
  43930. registerImmediate = function(handle) {
  43931. setTimeout(runIfPresent, 0, handle);
  43932. };
  43933. }
  43934. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43935. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43936. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43937. // Don't get fooled by e.g. browserify environments.
  43938. if ({}.toString.call(global.process) === "[object process]") {
  43939. // For Node.js before 0.9
  43940. installNextTickImplementation();
  43941. } else if (canUsePostMessage()) {
  43942. // For non-IE10 modern browsers
  43943. installPostMessageImplementation();
  43944. } else if (global.MessageChannel) {
  43945. // For web workers, where supported
  43946. installMessageChannelImplementation();
  43947. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43948. // For IE 6–8
  43949. installReadyStateChangeImplementation();
  43950. } else {
  43951. // For older browsers
  43952. installSetTimeoutImplementation();
  43953. }
  43954. attachTo.setImmediate = setImmediate;
  43955. attachTo.clearImmediate = clearImmediate;
  43956. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43957. /* 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")))
  43958. /***/ }),
  43959. /***/ "./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&":
  43960. /*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43961. !*** ./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& ***!
  43962. \***********************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43963. /*! no static exports found */
  43964. /***/ (function(module, exports, __webpack_require__) {
  43965. 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&");
  43966. if(typeof content === 'string') content = [[module.i, content, '']];
  43967. var transform;
  43968. var insertInto;
  43969. var options = {"hmr":true}
  43970. options.transform = transform
  43971. options.insertInto = undefined;
  43972. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43973. if(content.locals) module.exports = content.locals;
  43974. if(false) {}
  43975. /***/ }),
  43976. /***/ "./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&":
  43977. /*!************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43978. !*** ./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& ***!
  43979. \************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43980. /*! no static exports found */
  43981. /***/ (function(module, exports, __webpack_require__) {
  43982. 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&");
  43983. if(typeof content === 'string') content = [[module.i, content, '']];
  43984. var transform;
  43985. var insertInto;
  43986. var options = {"hmr":true}
  43987. options.transform = transform
  43988. options.insertInto = undefined;
  43989. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43990. if(content.locals) module.exports = content.locals;
  43991. if(false) {}
  43992. /***/ }),
  43993. /***/ "./node_modules/style-loader/lib/addStyles.js":
  43994. /*!****************************************************!*\
  43995. !*** ./node_modules/style-loader/lib/addStyles.js ***!
  43996. \****************************************************/
  43997. /*! no static exports found */
  43998. /***/ (function(module, exports, __webpack_require__) {
  43999. /*
  44000. MIT License http://www.opensource.org/licenses/mit-license.php
  44001. Author Tobias Koppers @sokra
  44002. */
  44003. var stylesInDom = {};
  44004. var memoize = function (fn) {
  44005. var memo;
  44006. return function () {
  44007. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  44008. return memo;
  44009. };
  44010. };
  44011. var isOldIE = memoize(function () {
  44012. // Test for IE <= 9 as proposed by Browserhacks
  44013. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  44014. // Tests for existence of standard globals is to allow style-loader
  44015. // to operate correctly into non-standard environments
  44016. // @see https://github.com/webpack-contrib/style-loader/issues/177
  44017. return window && document && document.all && !window.atob;
  44018. });
  44019. var getTarget = function (target, parent) {
  44020. if (parent){
  44021. return parent.querySelector(target);
  44022. }
  44023. return document.querySelector(target);
  44024. };
  44025. var getElement = (function (fn) {
  44026. var memo = {};
  44027. return function(target, parent) {
  44028. // If passing function in options, then use it for resolve "head" element.
  44029. // Useful for Shadow Root style i.e
  44030. // {
  44031. // insertInto: function () { return document.querySelector("#foo").shadowRoot }
  44032. // }
  44033. if (typeof target === 'function') {
  44034. return target();
  44035. }
  44036. if (typeof memo[target] === "undefined") {
  44037. var styleTarget = getTarget.call(this, target, parent);
  44038. // Special case to return head of iframe instead of iframe itself
  44039. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  44040. try {
  44041. // This will throw an exception if access to iframe is blocked
  44042. // due to cross-origin restrictions
  44043. styleTarget = styleTarget.contentDocument.head;
  44044. } catch(e) {
  44045. styleTarget = null;
  44046. }
  44047. }
  44048. memo[target] = styleTarget;
  44049. }
  44050. return memo[target]
  44051. };
  44052. })();
  44053. var singleton = null;
  44054. var singletonCounter = 0;
  44055. var stylesInsertedAtTop = [];
  44056. var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js");
  44057. module.exports = function(list, options) {
  44058. if (typeof DEBUG !== "undefined" && DEBUG) {
  44059. if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  44060. }
  44061. options = options || {};
  44062. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  44063. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  44064. // tags it will allow on a page
  44065. if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
  44066. // By default, add <style> tags to the <head> element
  44067. if (!options.insertInto) options.insertInto = "head";
  44068. // By default, add <style> tags to the bottom of the target
  44069. if (!options.insertAt) options.insertAt = "bottom";
  44070. var styles = listToStyles(list, options);
  44071. addStylesToDom(styles, options);
  44072. return function update (newList) {
  44073. var mayRemove = [];
  44074. for (var i = 0; i < styles.length; i++) {
  44075. var item = styles[i];
  44076. var domStyle = stylesInDom[item.id];
  44077. domStyle.refs--;
  44078. mayRemove.push(domStyle);
  44079. }
  44080. if(newList) {
  44081. var newStyles = listToStyles(newList, options);
  44082. addStylesToDom(newStyles, options);
  44083. }
  44084. for (var i = 0; i < mayRemove.length; i++) {
  44085. var domStyle = mayRemove[i];
  44086. if(domStyle.refs === 0) {
  44087. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
  44088. delete stylesInDom[domStyle.id];
  44089. }
  44090. }
  44091. };
  44092. };
  44093. function addStylesToDom (styles, options) {
  44094. for (var i = 0; i < styles.length; i++) {
  44095. var item = styles[i];
  44096. var domStyle = stylesInDom[item.id];
  44097. if(domStyle) {
  44098. domStyle.refs++;
  44099. for(var j = 0; j < domStyle.parts.length; j++) {
  44100. domStyle.parts[j](item.parts[j]);
  44101. }
  44102. for(; j < item.parts.length; j++) {
  44103. domStyle.parts.push(addStyle(item.parts[j], options));
  44104. }
  44105. } else {
  44106. var parts = [];
  44107. for(var j = 0; j < item.parts.length; j++) {
  44108. parts.push(addStyle(item.parts[j], options));
  44109. }
  44110. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  44111. }
  44112. }
  44113. }
  44114. function listToStyles (list, options) {
  44115. var styles = [];
  44116. var newStyles = {};
  44117. for (var i = 0; i < list.length; i++) {
  44118. var item = list[i];
  44119. var id = options.base ? item[0] + options.base : item[0];
  44120. var css = item[1];
  44121. var media = item[2];
  44122. var sourceMap = item[3];
  44123. var part = {css: css, media: media, sourceMap: sourceMap};
  44124. if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
  44125. else newStyles[id].parts.push(part);
  44126. }
  44127. return styles;
  44128. }
  44129. function insertStyleElement (options, style) {
  44130. var target = getElement(options.insertInto)
  44131. if (!target) {
  44132. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  44133. }
  44134. var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
  44135. if (options.insertAt === "top") {
  44136. if (!lastStyleElementInsertedAtTop) {
  44137. target.insertBefore(style, target.firstChild);
  44138. } else if (lastStyleElementInsertedAtTop.nextSibling) {
  44139. target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
  44140. } else {
  44141. target.appendChild(style);
  44142. }
  44143. stylesInsertedAtTop.push(style);
  44144. } else if (options.insertAt === "bottom") {
  44145. target.appendChild(style);
  44146. } else if (typeof options.insertAt === "object" && options.insertAt.before) {
  44147. var nextSibling = getElement(options.insertAt.before, target);
  44148. target.insertBefore(style, nextSibling);
  44149. } else {
  44150. 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");
  44151. }
  44152. }
  44153. function removeStyleElement (style) {
  44154. if (style.parentNode === null) return false;
  44155. style.parentNode.removeChild(style);
  44156. var idx = stylesInsertedAtTop.indexOf(style);
  44157. if(idx >= 0) {
  44158. stylesInsertedAtTop.splice(idx, 1);
  44159. }
  44160. }
  44161. function createStyleElement (options) {
  44162. var style = document.createElement("style");
  44163. if(options.attrs.type === undefined) {
  44164. options.attrs.type = "text/css";
  44165. }
  44166. if(options.attrs.nonce === undefined) {
  44167. var nonce = getNonce();
  44168. if (nonce) {
  44169. options.attrs.nonce = nonce;
  44170. }
  44171. }
  44172. addAttrs(style, options.attrs);
  44173. insertStyleElement(options, style);
  44174. return style;
  44175. }
  44176. function createLinkElement (options) {
  44177. var link = document.createElement("link");
  44178. if(options.attrs.type === undefined) {
  44179. options.attrs.type = "text/css";
  44180. }
  44181. options.attrs.rel = "stylesheet";
  44182. addAttrs(link, options.attrs);
  44183. insertStyleElement(options, link);
  44184. return link;
  44185. }
  44186. function addAttrs (el, attrs) {
  44187. Object.keys(attrs).forEach(function (key) {
  44188. el.setAttribute(key, attrs[key]);
  44189. });
  44190. }
  44191. function getNonce() {
  44192. if (false) {}
  44193. return __webpack_require__.nc;
  44194. }
  44195. function addStyle (obj, options) {
  44196. var style, update, remove, result;
  44197. // If a transform function was defined, run it on the css
  44198. if (options.transform && obj.css) {
  44199. result = typeof options.transform === 'function'
  44200. ? options.transform(obj.css)
  44201. : options.transform.default(obj.css);
  44202. if (result) {
  44203. // If transform returns a value, use that instead of the original css.
  44204. // This allows running runtime transformations on the css.
  44205. obj.css = result;
  44206. } else {
  44207. // If the transform function returns a falsy value, don't add this css.
  44208. // This allows conditional loading of css
  44209. return function() {
  44210. // noop
  44211. };
  44212. }
  44213. }
  44214. if (options.singleton) {
  44215. var styleIndex = singletonCounter++;
  44216. style = singleton || (singleton = createStyleElement(options));
  44217. update = applyToSingletonTag.bind(null, style, styleIndex, false);
  44218. remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  44219. } else if (
  44220. obj.sourceMap &&
  44221. typeof URL === "function" &&
  44222. typeof URL.createObjectURL === "function" &&
  44223. typeof URL.revokeObjectURL === "function" &&
  44224. typeof Blob === "function" &&
  44225. typeof btoa === "function"
  44226. ) {
  44227. style = createLinkElement(options);
  44228. update = updateLink.bind(null, style, options);
  44229. remove = function () {
  44230. removeStyleElement(style);
  44231. if(style.href) URL.revokeObjectURL(style.href);
  44232. };
  44233. } else {
  44234. style = createStyleElement(options);
  44235. update = applyToTag.bind(null, style);
  44236. remove = function () {
  44237. removeStyleElement(style);
  44238. };
  44239. }
  44240. update(obj);
  44241. return function updateStyle (newObj) {
  44242. if (newObj) {
  44243. if (
  44244. newObj.css === obj.css &&
  44245. newObj.media === obj.media &&
  44246. newObj.sourceMap === obj.sourceMap
  44247. ) {
  44248. return;
  44249. }
  44250. update(obj = newObj);
  44251. } else {
  44252. remove();
  44253. }
  44254. };
  44255. }
  44256. var replaceText = (function () {
  44257. var textStore = [];
  44258. return function (index, replacement) {
  44259. textStore[index] = replacement;
  44260. return textStore.filter(Boolean).join('\n');
  44261. };
  44262. })();
  44263. function applyToSingletonTag (style, index, remove, obj) {
  44264. var css = remove ? "" : obj.css;
  44265. if (style.styleSheet) {
  44266. style.styleSheet.cssText = replaceText(index, css);
  44267. } else {
  44268. var cssNode = document.createTextNode(css);
  44269. var childNodes = style.childNodes;
  44270. if (childNodes[index]) style.removeChild(childNodes[index]);
  44271. if (childNodes.length) {
  44272. style.insertBefore(cssNode, childNodes[index]);
  44273. } else {
  44274. style.appendChild(cssNode);
  44275. }
  44276. }
  44277. }
  44278. function applyToTag (style, obj) {
  44279. var css = obj.css;
  44280. var media = obj.media;
  44281. if(media) {
  44282. style.setAttribute("media", media)
  44283. }
  44284. if(style.styleSheet) {
  44285. style.styleSheet.cssText = css;
  44286. } else {
  44287. while(style.firstChild) {
  44288. style.removeChild(style.firstChild);
  44289. }
  44290. style.appendChild(document.createTextNode(css));
  44291. }
  44292. }
  44293. function updateLink (link, options, obj) {
  44294. var css = obj.css;
  44295. var sourceMap = obj.sourceMap;
  44296. /*
  44297. If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  44298. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  44299. on by default. Otherwise default to the convertToAbsoluteUrls option
  44300. directly
  44301. */
  44302. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  44303. if (options.convertToAbsoluteUrls || autoFixUrls) {
  44304. css = fixUrls(css);
  44305. }
  44306. if (sourceMap) {
  44307. // http://stackoverflow.com/a/26603875
  44308. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  44309. }
  44310. var blob = new Blob([css], { type: "text/css" });
  44311. var oldSrc = link.href;
  44312. link.href = URL.createObjectURL(blob);
  44313. if(oldSrc) URL.revokeObjectURL(oldSrc);
  44314. }
  44315. /***/ }),
  44316. /***/ "./node_modules/style-loader/lib/urls.js":
  44317. /*!***********************************************!*\
  44318. !*** ./node_modules/style-loader/lib/urls.js ***!
  44319. \***********************************************/
  44320. /*! no static exports found */
  44321. /***/ (function(module, exports) {
  44322. /**
  44323. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  44324. * embed the css on the page. This breaks all relative urls because now they are relative to a
  44325. * bundle instead of the current page.
  44326. *
  44327. * One solution is to only use full urls, but that may be impossible.
  44328. *
  44329. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  44330. *
  44331. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  44332. *
  44333. */
  44334. module.exports = function (css) {
  44335. // get current location
  44336. var location = typeof window !== "undefined" && window.location;
  44337. if (!location) {
  44338. throw new Error("fixUrls requires window.location");
  44339. }
  44340. // blank or null?
  44341. if (!css || typeof css !== "string") {
  44342. return css;
  44343. }
  44344. var baseUrl = location.protocol + "//" + location.host;
  44345. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  44346. // convert each url(...)
  44347. /*
  44348. This regular expression is just a way to recursively match brackets within
  44349. a string.
  44350. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  44351. ( = Start a capturing group
  44352. (?: = Start a non-capturing group
  44353. [^)(] = Match anything that isn't a parentheses
  44354. | = OR
  44355. \( = Match a start parentheses
  44356. (?: = Start another non-capturing groups
  44357. [^)(]+ = Match anything that isn't a parentheses
  44358. | = OR
  44359. \( = Match a start parentheses
  44360. [^)(]* = Match anything that isn't a parentheses
  44361. \) = Match a end parentheses
  44362. ) = End Group
  44363. *\) = Match anything and then a close parens
  44364. ) = Close non-capturing group
  44365. * = Match anything
  44366. ) = Close capturing group
  44367. \) = Match a close parens
  44368. /gi = Get all matches, not the first. Be case insensitive.
  44369. */
  44370. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  44371. // strip quotes (if they exist)
  44372. var unquotedOrigUrl = origUrl
  44373. .trim()
  44374. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  44375. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  44376. // already a full url? no change
  44377. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
  44378. return fullMatch;
  44379. }
  44380. // convert the url to a full url
  44381. var newUrl;
  44382. if (unquotedOrigUrl.indexOf("//") === 0) {
  44383. //TODO: should we add protocol?
  44384. newUrl = unquotedOrigUrl;
  44385. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  44386. // path should be relative to the base url
  44387. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  44388. } else {
  44389. // path should be relative to current directory
  44390. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  44391. }
  44392. // send back the fixed url(...)
  44393. return "url(" + JSON.stringify(newUrl) + ")";
  44394. });
  44395. // send back the fixed css
  44396. return fixedCss;
  44397. };
  44398. /***/ }),
  44399. /***/ "./node_modules/timers-browserify/main.js":
  44400. /*!************************************************!*\
  44401. !*** ./node_modules/timers-browserify/main.js ***!
  44402. \************************************************/
  44403. /*! no static exports found */
  44404. /***/ (function(module, exports, __webpack_require__) {
  44405. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  44406. (typeof self !== "undefined" && self) ||
  44407. window;
  44408. var apply = Function.prototype.apply;
  44409. // DOM APIs, for completeness
  44410. exports.setTimeout = function() {
  44411. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  44412. };
  44413. exports.setInterval = function() {
  44414. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  44415. };
  44416. exports.clearTimeout =
  44417. exports.clearInterval = function(timeout) {
  44418. if (timeout) {
  44419. timeout.close();
  44420. }
  44421. };
  44422. function Timeout(id, clearFn) {
  44423. this._id = id;
  44424. this._clearFn = clearFn;
  44425. }
  44426. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  44427. Timeout.prototype.close = function() {
  44428. this._clearFn.call(scope, this._id);
  44429. };
  44430. // Does not start the time, just sets up the members needed.
  44431. exports.enroll = function(item, msecs) {
  44432. clearTimeout(item._idleTimeoutId);
  44433. item._idleTimeout = msecs;
  44434. };
  44435. exports.unenroll = function(item) {
  44436. clearTimeout(item._idleTimeoutId);
  44437. item._idleTimeout = -1;
  44438. };
  44439. exports._unrefActive = exports.active = function(item) {
  44440. clearTimeout(item._idleTimeoutId);
  44441. var msecs = item._idleTimeout;
  44442. if (msecs >= 0) {
  44443. item._idleTimeoutId = setTimeout(function onTimeout() {
  44444. if (item._onTimeout)
  44445. item._onTimeout();
  44446. }, msecs);
  44447. }
  44448. };
  44449. // setimmediate attaches itself to the global object
  44450. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  44451. // On some exotic environments, it's not clear which object `setimmediate` was
  44452. // able to install onto. Search each possibility in the same order as the
  44453. // `setimmediate` library.
  44454. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  44455. (typeof global !== "undefined" && global.setImmediate) ||
  44456. (this && this.setImmediate);
  44457. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  44458. (typeof global !== "undefined" && global.clearImmediate) ||
  44459. (this && this.clearImmediate);
  44460. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  44461. /***/ }),
  44462. /***/ "./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&":
  44463. /*!************************************************************************************************************************************************************************************************************!*\
  44464. !*** ./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& ***!
  44465. \************************************************************************************************************************************************************************************************************/
  44466. /*! exports provided: render, staticRenderFns */
  44467. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44468. "use strict";
  44469. __webpack_require__.r(__webpack_exports__);
  44470. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44471. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44472. var render = function() {
  44473. var _vm = this
  44474. var _h = _vm.$createElement
  44475. var _c = _vm._self._c || _h
  44476. return _c(
  44477. "div",
  44478. [
  44479. _c("asset-info-edit-modal", {
  44480. attrs: {
  44481. "modal-id": "asset" + _vm.asset.pcid + "editModal",
  44482. "populate-with": _vm.asset
  44483. }
  44484. }),
  44485. _vm._v(" "),
  44486. _c("h4", { staticClass: "text-center" }, [
  44487. _vm._v(
  44488. _vm._s(this.asset.pcmanu) + " " + _vm._s(this.asset.pcmake) + " - "
  44489. ),
  44490. _c("small", { staticClass: "text-muted" }, [
  44491. _vm._v(_vm._s(this.asset.pcnickname))
  44492. ])
  44493. ]),
  44494. _vm._v(" "),
  44495. _c("p", [_vm._v("OS: " + _vm._s(this.asset.pcextra[2]))]),
  44496. _vm._v(" "),
  44497. _c("p", [_vm._v("S/N: " + _vm._s(this.asset.pcextra[104]))]),
  44498. _vm._v(" "),
  44499. _c("p", [_vm._v("CPU: " + _vm._s(this.asset.pcextra[101]))]),
  44500. _vm._v(" "),
  44501. _c("p", [_vm._v("RAM: " + _vm._s(this.asset.pcextra[100]))]),
  44502. _vm._v(" "),
  44503. _c("p", [_vm._v("Graphics: " + _vm._s(this.asset.pcextra[4]))]),
  44504. _vm._v(" "),
  44505. _c(
  44506. "button",
  44507. {
  44508. staticClass: "btn btn-primary",
  44509. attrs: {
  44510. type: "button",
  44511. "data-toggle": "modal",
  44512. "data-target": "#asset" + _vm.asset.pcid + "editModal"
  44513. }
  44514. },
  44515. [_vm._v("Edit")]
  44516. )
  44517. ],
  44518. 1
  44519. )
  44520. }
  44521. var staticRenderFns = []
  44522. render._withStripped = true
  44523. /***/ }),
  44524. /***/ "./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&":
  44525. /*!*********************************************************************************************************************************************************************************************************************!*\
  44526. !*** ./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& ***!
  44527. \*********************************************************************************************************************************************************************************************************************/
  44528. /*! exports provided: render, staticRenderFns */
  44529. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44530. "use strict";
  44531. __webpack_require__.r(__webpack_exports__);
  44532. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44533. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44534. var render = function() {
  44535. var _vm = this
  44536. var _h = _vm.$createElement
  44537. var _c = _vm._self._c || _h
  44538. return _c(
  44539. "modal",
  44540. {
  44541. attrs: {
  44542. id: _vm.modalId,
  44543. tabindex: "-1",
  44544. role: "dialog",
  44545. "aria-labelledby": _vm.modalId + "Label"
  44546. }
  44547. },
  44548. [
  44549. _c(
  44550. "h5",
  44551. {
  44552. staticClass: "modal-title",
  44553. attrs: { slot: "header", id: _vm.modalId + "Label" },
  44554. slot: "header"
  44555. },
  44556. [_vm._v("\n Edit Work Order Information\n ")]
  44557. ),
  44558. _vm._v(" "),
  44559. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44560. _c("div", { staticClass: "form-group" }, [
  44561. _c("label", { attrs: { for: "manufacturer" } }, [
  44562. _vm._v("Manufacturer")
  44563. ]),
  44564. _vm._v(" "),
  44565. _c("input", {
  44566. directives: [
  44567. {
  44568. name: "model",
  44569. rawName: "v-model",
  44570. value: _vm.asset.pcmanu,
  44571. expression: "asset.pcmanu"
  44572. }
  44573. ],
  44574. staticClass: "form-control",
  44575. attrs: { type: "text", name: "manufacturer", id: "manufacturer" },
  44576. domProps: { value: _vm.asset.pcmanu },
  44577. on: {
  44578. input: function($event) {
  44579. if ($event.target.composing) {
  44580. return
  44581. }
  44582. _vm.$set(_vm.asset, "pcmanu", $event.target.value)
  44583. }
  44584. }
  44585. })
  44586. ]),
  44587. _vm._v(" "),
  44588. _c("div", { staticClass: "form-group" }, [
  44589. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  44590. _vm._v(" "),
  44591. _c("input", {
  44592. directives: [
  44593. {
  44594. name: "model",
  44595. rawName: "v-model",
  44596. value: _vm.asset.pcmake,
  44597. expression: "asset.pcmake"
  44598. }
  44599. ],
  44600. staticClass: "form-control",
  44601. attrs: { type: "text", name: "make", id: "make" },
  44602. domProps: { value: _vm.asset.pcmake },
  44603. on: {
  44604. input: function($event) {
  44605. if ($event.target.composing) {
  44606. return
  44607. }
  44608. _vm.$set(_vm.asset, "pcmake", $event.target.value)
  44609. }
  44610. }
  44611. })
  44612. ]),
  44613. _vm._v(" "),
  44614. _c("div", { staticClass: "form-group" }, [
  44615. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  44616. _vm._v(" "),
  44617. _c("input", {
  44618. directives: [
  44619. {
  44620. name: "model",
  44621. rawName: "v-model",
  44622. value: _vm.asset.pcnickname,
  44623. expression: "asset.pcnickname"
  44624. }
  44625. ],
  44626. staticClass: "form-control",
  44627. attrs: { type: "text", name: "nickname", id: "nickname" },
  44628. domProps: { value: _vm.asset.pcnickname },
  44629. on: {
  44630. input: function($event) {
  44631. if ($event.target.composing) {
  44632. return
  44633. }
  44634. _vm.$set(_vm.asset, "pcnickname", $event.target.value)
  44635. }
  44636. }
  44637. })
  44638. ]),
  44639. _vm._v(" "),
  44640. _c("div", { staticClass: "form-group" }, [
  44641. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  44642. _vm._v(" "),
  44643. _c("input", {
  44644. directives: [
  44645. {
  44646. name: "model",
  44647. rawName: "v-model",
  44648. value: _vm.asset.pcextra[2],
  44649. expression: "asset.pcextra[2]"
  44650. }
  44651. ],
  44652. staticClass: "form-control",
  44653. attrs: { type: "text", name: "os", id: "os" },
  44654. domProps: { value: _vm.asset.pcextra[2] },
  44655. on: {
  44656. input: function($event) {
  44657. if ($event.target.composing) {
  44658. return
  44659. }
  44660. _vm.$set(_vm.asset.pcextra, 2, $event.target.value)
  44661. }
  44662. }
  44663. })
  44664. ]),
  44665. _vm._v(" "),
  44666. _c("div", { staticClass: "form-group" }, [
  44667. _c("label", { attrs: { for: "serial" } }, [_vm._v("Serial Number")]),
  44668. _vm._v(" "),
  44669. _c("input", {
  44670. directives: [
  44671. {
  44672. name: "model",
  44673. rawName: "v-model",
  44674. value: _vm.asset.pcextra[104],
  44675. expression: "asset.pcextra[104]"
  44676. }
  44677. ],
  44678. staticClass: "form-control",
  44679. attrs: { type: "text", id: "serial", name: "serial" },
  44680. domProps: { value: _vm.asset.pcextra[104] },
  44681. on: {
  44682. input: function($event) {
  44683. if ($event.target.composing) {
  44684. return
  44685. }
  44686. _vm.$set(_vm.asset.pcextra, 104, $event.target.value)
  44687. }
  44688. }
  44689. })
  44690. ]),
  44691. _vm._v(" "),
  44692. _c("div", { staticClass: "form-group" }, [
  44693. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  44694. _vm._v(" "),
  44695. _c("input", {
  44696. directives: [
  44697. {
  44698. name: "model",
  44699. rawName: "v-model",
  44700. value: _vm.asset.pcextra[101],
  44701. expression: "asset.pcextra[101]"
  44702. }
  44703. ],
  44704. staticClass: "form-control",
  44705. attrs: { type: "text", id: "cpu", name: "cpu" },
  44706. domProps: { value: _vm.asset.pcextra[101] },
  44707. on: {
  44708. input: function($event) {
  44709. if ($event.target.composing) {
  44710. return
  44711. }
  44712. _vm.$set(_vm.asset.pcextra, 101, $event.target.value)
  44713. }
  44714. }
  44715. })
  44716. ]),
  44717. _vm._v(" "),
  44718. _c("div", { staticClass: "form-group" }, [
  44719. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  44720. _vm._v(" "),
  44721. _c("input", {
  44722. directives: [
  44723. {
  44724. name: "model",
  44725. rawName: "v-model",
  44726. value: _vm.asset.pcextra[100],
  44727. expression: "asset.pcextra[100]"
  44728. }
  44729. ],
  44730. staticClass: "form-control",
  44731. attrs: { type: "text", name: "ram", id: "ram" },
  44732. domProps: { value: _vm.asset.pcextra[100] },
  44733. on: {
  44734. input: function($event) {
  44735. if ($event.target.composing) {
  44736. return
  44737. }
  44738. _vm.$set(_vm.asset.pcextra, 100, $event.target.value)
  44739. }
  44740. }
  44741. })
  44742. ]),
  44743. _vm._v(" "),
  44744. _c("div", { staticClass: "form-group" }, [
  44745. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  44746. _vm._v(" "),
  44747. _c("input", {
  44748. directives: [
  44749. {
  44750. name: "model",
  44751. rawName: "v-model",
  44752. value: _vm.asset.pcextra[4],
  44753. expression: "asset.pcextra[4]"
  44754. }
  44755. ],
  44756. staticClass: "form-control",
  44757. attrs: { type: "text", name: "graphics", id: "grapics" },
  44758. domProps: { value: _vm.asset.pcextra[4] },
  44759. on: {
  44760. input: function($event) {
  44761. if ($event.target.composing) {
  44762. return
  44763. }
  44764. _vm.$set(_vm.asset.pcextra, 4, $event.target.value)
  44765. }
  44766. }
  44767. })
  44768. ])
  44769. ]),
  44770. _vm._v(" "),
  44771. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44772. _c(
  44773. "button",
  44774. {
  44775. staticClass: "btn btn-secondary",
  44776. attrs: { type: "button", "data-dismiss": "modal" }
  44777. },
  44778. [_vm._v("Close")]
  44779. ),
  44780. _vm._v(" "),
  44781. _c(
  44782. "button",
  44783. {
  44784. staticClass: "btn btn-primary",
  44785. attrs: { type: "button" },
  44786. on: {
  44787. click: function($event) {
  44788. return _vm.updateAsset()
  44789. }
  44790. }
  44791. },
  44792. [
  44793. !_vm.assetSaving
  44794. ? _c("div", [_vm._v("Save")])
  44795. : _c("circle-spinner", { attrs: { size: 2 } })
  44796. ],
  44797. 1
  44798. )
  44799. ])
  44800. ]
  44801. )
  44802. }
  44803. var staticRenderFns = []
  44804. render._withStripped = true
  44805. /***/ }),
  44806. /***/ "./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&":
  44807. /*!*****************************************************************************************************************************************************************************************************************************!*\
  44808. !*** ./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& ***!
  44809. \*****************************************************************************************************************************************************************************************************************************/
  44810. /*! exports provided: render, staticRenderFns */
  44811. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44812. "use strict";
  44813. __webpack_require__.r(__webpack_exports__);
  44814. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44815. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44816. var render = function() {
  44817. var _vm = this
  44818. var _h = _vm.$createElement
  44819. var _c = _vm._self._c || _h
  44820. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  44821. _c("div", { staticClass: "input-group" }, [
  44822. _c("input", {
  44823. directives: [
  44824. {
  44825. name: "model",
  44826. rawName: "v-model",
  44827. value: _vm.searchText,
  44828. expression: "searchText"
  44829. }
  44830. ],
  44831. staticClass: "form-control",
  44832. attrs: { type: "text" },
  44833. domProps: { value: _vm.searchText },
  44834. on: {
  44835. input: [
  44836. function($event) {
  44837. if ($event.target.composing) {
  44838. return
  44839. }
  44840. _vm.searchText = $event.target.value
  44841. },
  44842. _vm.searchChanged
  44843. ]
  44844. }
  44845. }),
  44846. _vm._v(" "),
  44847. _c("div", { staticClass: "form-group-append" }, [
  44848. _c(
  44849. "a",
  44850. {
  44851. staticClass: "toggle input-group-text bg-primary text-light",
  44852. on: {
  44853. mousedown: function($event) {
  44854. $event.preventDefault()
  44855. },
  44856. click: function($event) {
  44857. return _vm.setOpen(!_vm.open)
  44858. }
  44859. }
  44860. },
  44861. [
  44862. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  44863. _vm._v(" "),
  44864. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  44865. ]
  44866. )
  44867. ])
  44868. ]),
  44869. _vm._v(" "),
  44870. _c(
  44871. "ul",
  44872. { staticClass: "suggestion-list list-unstyled" },
  44873. _vm._l(_vm.matches, function(suggestion, index) {
  44874. return _c(
  44875. "li",
  44876. {
  44877. key: index,
  44878. on: {
  44879. mousedown: function($event) {
  44880. $event.preventDefault()
  44881. },
  44882. click: function($event) {
  44883. return _vm.suggestionSelected(suggestion)
  44884. }
  44885. }
  44886. },
  44887. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  44888. )
  44889. }),
  44890. 0
  44891. )
  44892. ])
  44893. }
  44894. var staticRenderFns = []
  44895. render._withStripped = true
  44896. /***/ }),
  44897. /***/ "./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&":
  44898. /*!****************************************************************************************************************************************************************************************************************************!*\
  44899. !*** ./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& ***!
  44900. \****************************************************************************************************************************************************************************************************************************/
  44901. /*! exports provided: render, staticRenderFns */
  44902. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44903. "use strict";
  44904. __webpack_require__.r(__webpack_exports__);
  44905. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44906. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44907. var render = function() {
  44908. var _vm = this
  44909. var _h = _vm.$createElement
  44910. var _c = _vm._self._c || _h
  44911. return _c(
  44912. "div",
  44913. {
  44914. staticClass: "loader",
  44915. style: {
  44916. fontSize: _vm.size + "px",
  44917. borderLeft: "1.1em solid " + _vm.color
  44918. }
  44919. },
  44920. [_vm._v("Loading...")]
  44921. )
  44922. }
  44923. var staticRenderFns = []
  44924. render._withStripped = true
  44925. /***/ }),
  44926. /***/ "./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&":
  44927. /*!*************************************************************************************************************************************************************************************************************!*\
  44928. !*** ./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& ***!
  44929. \*************************************************************************************************************************************************************************************************************/
  44930. /*! exports provided: render, staticRenderFns */
  44931. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44932. "use strict";
  44933. __webpack_require__.r(__webpack_exports__);
  44934. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44935. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44936. var render = function() {
  44937. var _vm = this
  44938. var _h = _vm.$createElement
  44939. var _c = _vm._self._c || _h
  44940. return _c(
  44941. "div",
  44942. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  44943. [
  44944. _c("credential-form-modal", {
  44945. attrs: {
  44946. descriptions: _vm.creddescList,
  44947. "modal-id": "credential" + this.data.credid + "editModal",
  44948. populateWith: this.data
  44949. }
  44950. }),
  44951. _vm._v(" "),
  44952. _c(
  44953. "modal",
  44954. {
  44955. attrs: {
  44956. id: "credential" + this.data.credid + "deleteModal",
  44957. tabindex: "-1"
  44958. }
  44959. },
  44960. [
  44961. _c(
  44962. "h5",
  44963. {
  44964. staticClass: "modal-title",
  44965. attrs: {
  44966. slot: "header",
  44967. id: "credential" + this.data.credid + "deleteModalLabel"
  44968. },
  44969. slot: "header"
  44970. },
  44971. [_vm._v("\r\n Delete Credential\r\n ")]
  44972. ),
  44973. _vm._v(" "),
  44974. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44975. _vm._v("\r\n Are you sure?\r\n ")
  44976. ]),
  44977. _vm._v(" "),
  44978. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44979. _c(
  44980. "button",
  44981. {
  44982. staticClass: "btn btn-secondary",
  44983. attrs: { type: "button", "data-dismiss": "modal" }
  44984. },
  44985. [_vm._v("Cancel")]
  44986. ),
  44987. _vm._v(" "),
  44988. _c(
  44989. "button",
  44990. {
  44991. staticClass: "btn btn-danger",
  44992. attrs: { type: "button" },
  44993. on: {
  44994. click: function($event) {
  44995. return _vm.deleteCredential()
  44996. }
  44997. }
  44998. },
  44999. [
  45000. !_vm.credentialDeleting
  45001. ? _c("div", [_vm._v("Confirm")])
  45002. : _c("circle-spinner", { attrs: { size: 2 } })
  45003. ],
  45004. 1
  45005. )
  45006. ])
  45007. ]
  45008. ),
  45009. _vm._v(" "),
  45010. _c("div", { staticClass: "row no-gutters" }, [
  45011. _c("div", { staticClass: "h5 col-3 text-left" }, [
  45012. _vm._v(_vm._s(this.data.creddesc))
  45013. ]),
  45014. _vm._v(" "),
  45015. _c("div", { staticClass: "col-9 text-right" }, [
  45016. _vm._v(_vm._s(this.data.creddate))
  45017. ])
  45018. ]),
  45019. _vm._v(" "),
  45020. _c("div", { staticClass: "row" }, [
  45021. _c("div", { staticClass: "col-lg-9" }, [
  45022. _c("div", [
  45023. _vm._m(0),
  45024. _vm._v(" "),
  45025. _c("input", {
  45026. staticClass: "border-0 credential",
  45027. attrs: {
  45028. type: "text",
  45029. id: "username" + this.data.credid,
  45030. readonly: ""
  45031. },
  45032. domProps: { value: this.data.creduser }
  45033. }),
  45034. _vm._v(" "),
  45035. _c(
  45036. "button",
  45037. {
  45038. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  45039. attrs: {
  45040. id: "btn-username" + this.data.credid,
  45041. "data-clipboard-target": "#username" + this.data.credid
  45042. }
  45043. },
  45044. [_c("i", { staticClass: "far fa-clone" })]
  45045. )
  45046. ]),
  45047. _vm._v(" "),
  45048. _c("div", [
  45049. _vm._m(1),
  45050. _vm._v(" "),
  45051. _c("input", {
  45052. staticClass: "border-0 credential",
  45053. attrs: {
  45054. type: "text",
  45055. id: "password" + this.data.credid,
  45056. readonly: ""
  45057. },
  45058. domProps: { value: this.data.credpass }
  45059. }),
  45060. _vm._v(" "),
  45061. _c(
  45062. "button",
  45063. {
  45064. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  45065. attrs: {
  45066. id: "btn-password" + this.data.credid,
  45067. "data-clipboard-target": "#password" + this.data.credid
  45068. }
  45069. },
  45070. [_c("i", { staticClass: "far fa-clone" })]
  45071. )
  45072. ])
  45073. ]),
  45074. _vm._v(" "),
  45075. _c(
  45076. "div",
  45077. {
  45078. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  45079. attrs: { role: "group", "aria-label": "Edit and Delete" }
  45080. },
  45081. [
  45082. _c(
  45083. "button",
  45084. {
  45085. staticClass: "btn btn-sm btn-secondary p-lg-1",
  45086. attrs: {
  45087. type: "button",
  45088. "data-toggle": "modal",
  45089. "data-target": "#credential" + this.data.credid + "editModal"
  45090. }
  45091. },
  45092. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  45093. ),
  45094. _vm._v(" "),
  45095. _c(
  45096. "button",
  45097. {
  45098. staticClass: "btn btn-sm btn-danger p-lg-1",
  45099. attrs: {
  45100. type: "button",
  45101. "data-toggle": "modal",
  45102. "data-target":
  45103. "#credential" + this.data.credid + "deleteModal"
  45104. }
  45105. },
  45106. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  45107. )
  45108. ]
  45109. )
  45110. ])
  45111. ],
  45112. 1
  45113. )
  45114. }
  45115. var staticRenderFns = [
  45116. function() {
  45117. var _vm = this
  45118. var _h = _vm.$createElement
  45119. var _c = _vm._self._c || _h
  45120. return _c("label", { attrs: { for: "username" } }, [
  45121. _c("i", { staticClass: "fas fa-fw fa-user" })
  45122. ])
  45123. },
  45124. function() {
  45125. var _vm = this
  45126. var _h = _vm.$createElement
  45127. var _c = _vm._self._c || _h
  45128. return _c("label", { attrs: { for: "password" } }, [
  45129. _c("i", { staticClass: "fas fa-fw fa-key" })
  45130. ])
  45131. }
  45132. ]
  45133. render._withStripped = true
  45134. /***/ }),
  45135. /***/ "./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&":
  45136. /*!**********************************************************************************************************************************************************************************************************************!*\
  45137. !*** ./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& ***!
  45138. \**********************************************************************************************************************************************************************************************************************/
  45139. /*! exports provided: render, staticRenderFns */
  45140. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45141. "use strict";
  45142. __webpack_require__.r(__webpack_exports__);
  45143. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45144. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45145. var render = function() {
  45146. var _vm = this
  45147. var _h = _vm.$createElement
  45148. var _c = _vm._self._c || _h
  45149. return _c(
  45150. "modal",
  45151. {
  45152. attrs: {
  45153. id: _vm.id,
  45154. tabindex: "-1",
  45155. role: "dialog",
  45156. "aria-labelledby": _vm.id + "Label"
  45157. }
  45158. },
  45159. [
  45160. _c(
  45161. "h5",
  45162. {
  45163. staticClass: "modal-title",
  45164. attrs: { slot: "header", id: _vm.id + "Label" },
  45165. slot: "header"
  45166. },
  45167. [_vm._v("\n Edit Credential\n ")]
  45168. ),
  45169. _vm._v(" "),
  45170. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45171. _c(
  45172. "div",
  45173. { staticClass: "form" },
  45174. [
  45175. _c("autocomplete-custom-dropdown", {
  45176. attrs: {
  45177. options: _vm.descriptions,
  45178. value: _vm.creddesc,
  45179. "allow-custom": true
  45180. },
  45181. model: {
  45182. value: _vm.creddesc,
  45183. callback: function($$v) {
  45184. _vm.creddesc = $$v
  45185. },
  45186. expression: "creddesc"
  45187. }
  45188. })
  45189. ],
  45190. 1
  45191. ),
  45192. _vm._v(" "),
  45193. _c("div", { staticClass: "form-group" }, [
  45194. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  45195. _vm._v(" "),
  45196. _c("input", {
  45197. directives: [
  45198. {
  45199. name: "model",
  45200. rawName: "v-model",
  45201. value: _vm.data.creduser,
  45202. expression: "data.creduser"
  45203. }
  45204. ],
  45205. staticClass: "form-control credential",
  45206. attrs: {
  45207. type: "text",
  45208. name: "newusername" + _vm.data.credid,
  45209. id: "newusername" + _vm.data.credid
  45210. },
  45211. domProps: { value: _vm.data.creduser },
  45212. on: {
  45213. input: function($event) {
  45214. if ($event.target.composing) {
  45215. return
  45216. }
  45217. _vm.$set(_vm.data, "creduser", $event.target.value)
  45218. }
  45219. }
  45220. })
  45221. ]),
  45222. _vm._v(" "),
  45223. _c("div", { staticClass: "form-group" }, [
  45224. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  45225. _vm._v(" "),
  45226. _c("input", {
  45227. directives: [
  45228. {
  45229. name: "model",
  45230. rawName: "v-model",
  45231. value: _vm.data.credpass,
  45232. expression: "data.credpass"
  45233. }
  45234. ],
  45235. staticClass: "form-control credential",
  45236. attrs: {
  45237. type: "text",
  45238. name: "newpassword" + _vm.data.credid,
  45239. id: "newpassword" + _vm.data.credid
  45240. },
  45241. domProps: { value: _vm.data.credpass },
  45242. on: {
  45243. input: function($event) {
  45244. if ($event.target.composing) {
  45245. return
  45246. }
  45247. _vm.$set(_vm.data, "credpass", $event.target.value)
  45248. }
  45249. }
  45250. }),
  45251. _vm._v(" "),
  45252. _c(
  45253. "button",
  45254. {
  45255. staticClass: "btn btn-secondary",
  45256. attrs: { type: "button" },
  45257. on: {
  45258. click: function($event) {
  45259. return _vm.getRandomPassword(_vm.data.credid)
  45260. }
  45261. }
  45262. },
  45263. [_vm._v("Generate Random")]
  45264. )
  45265. ]),
  45266. _vm._v(" "),
  45267. _c("div", { staticClass: "form-group" })
  45268. ]),
  45269. _vm._v(" "),
  45270. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45271. _c(
  45272. "button",
  45273. {
  45274. staticClass: "btn btn-secondary",
  45275. attrs: { type: "button", "data-dismiss": "modal" }
  45276. },
  45277. [_vm._v("Close")]
  45278. ),
  45279. _vm._v(" "),
  45280. _c(
  45281. "button",
  45282. {
  45283. staticClass: "btn btn-primary",
  45284. attrs: { type: "button" },
  45285. on: {
  45286. click: function($event) {
  45287. return _vm.updateCredential()
  45288. }
  45289. }
  45290. },
  45291. [
  45292. !_vm.credentialSaving
  45293. ? _c("div", [_vm._v("Save")])
  45294. : _c("circle-spinner", { attrs: { size: 2 } })
  45295. ],
  45296. 1
  45297. )
  45298. ])
  45299. ]
  45300. )
  45301. }
  45302. var staticRenderFns = []
  45303. render._withStripped = true
  45304. /***/ }),
  45305. /***/ "./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&":
  45306. /*!*****************************************************************************************************************************************************************************************************************!*\
  45307. !*** ./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& ***!
  45308. \*****************************************************************************************************************************************************************************************************************/
  45309. /*! exports provided: render, staticRenderFns */
  45310. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45311. "use strict";
  45312. __webpack_require__.r(__webpack_exports__);
  45313. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45314. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45315. var render = function() {
  45316. var _vm = this
  45317. var _h = _vm.$createElement
  45318. var _c = _vm._self._c || _h
  45319. return _c(
  45320. "div",
  45321. [
  45322. _c("credential-form-modal", {
  45323. attrs: {
  45324. "modal-id": "newCredentialModal",
  45325. descriptions: _vm.creddescList,
  45326. create: true,
  45327. pcid: _vm.pcid
  45328. }
  45329. }),
  45330. _vm._v(" "),
  45331. _c(
  45332. "button",
  45333. {
  45334. staticClass: "btn btn-primary",
  45335. attrs: {
  45336. type: "button",
  45337. "data-toggle": "modal",
  45338. "data-target": "#newCredentialModal"
  45339. }
  45340. },
  45341. [_vm._v("New Credential")]
  45342. ),
  45343. _vm._v(" "),
  45344. _vm._l(_vm.credentials, function(credential) {
  45345. return _c(
  45346. "div",
  45347. { key: credential.credid },
  45348. [
  45349. _c("credential", {
  45350. attrs: { credential: credential, descriptions: _vm.creddescList }
  45351. })
  45352. ],
  45353. 1
  45354. )
  45355. })
  45356. ],
  45357. 2
  45358. )
  45359. }
  45360. var staticRenderFns = []
  45361. render._withStripped = true
  45362. /***/ }),
  45363. /***/ "./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&":
  45364. /*!************************************************************************************************************************************************************************************************************!*\
  45365. !*** ./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& ***!
  45366. \************************************************************************************************************************************************************************************************************/
  45367. /*! exports provided: render, staticRenderFns */
  45368. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45369. "use strict";
  45370. __webpack_require__.r(__webpack_exports__);
  45371. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45372. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45373. var render = function() {
  45374. var _vm = this
  45375. var _h = _vm.$createElement
  45376. var _c = _vm._self._c || _h
  45377. return _c(
  45378. "ul",
  45379. { staticClass: "list-unstyled" },
  45380. _vm._l(_vm.errorList, function(error) {
  45381. return _c("li", { key: error, staticClass: "text-danger" }, [
  45382. _vm._v(" " + _vm._s(error) + " ")
  45383. ])
  45384. }),
  45385. 0
  45386. )
  45387. }
  45388. var staticRenderFns = []
  45389. render._withStripped = true
  45390. /***/ }),
  45391. /***/ "./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&":
  45392. /*!********************************************************************************************************************************************************************************************************!*\
  45393. !*** ./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& ***!
  45394. \********************************************************************************************************************************************************************************************************/
  45395. /*! exports provided: render, staticRenderFns */
  45396. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45397. "use strict";
  45398. __webpack_require__.r(__webpack_exports__);
  45399. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45400. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45401. var render = function() {
  45402. var _vm = this
  45403. var _h = _vm.$createElement
  45404. var _c = _vm._self._c || _h
  45405. return _c("div", { staticClass: "modal fade" }, [
  45406. _c(
  45407. "div",
  45408. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  45409. [
  45410. _c("div", { staticClass: "modal-content" }, [
  45411. _c(
  45412. "div",
  45413. { staticClass: "modal-header" },
  45414. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  45415. 2
  45416. ),
  45417. _vm._v(" "),
  45418. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  45419. _vm._v(" "),
  45420. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  45421. ])
  45422. ]
  45423. )
  45424. ])
  45425. }
  45426. var staticRenderFns = [
  45427. function() {
  45428. var _vm = this
  45429. var _h = _vm.$createElement
  45430. var _c = _vm._self._c || _h
  45431. return _c(
  45432. "button",
  45433. {
  45434. staticClass: "close",
  45435. attrs: {
  45436. type: "button",
  45437. "data-dismiss": "modal",
  45438. "aria-label": "Close"
  45439. }
  45440. },
  45441. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  45442. )
  45443. }
  45444. ]
  45445. render._withStripped = true
  45446. /***/ }),
  45447. /***/ "./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&":
  45448. /*!******************************************************************************************************************************************************************************************************************!*\
  45449. !*** ./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& ***!
  45450. \******************************************************************************************************************************************************************************************************************/
  45451. /*! exports provided: render, staticRenderFns */
  45452. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45453. "use strict";
  45454. __webpack_require__.r(__webpack_exports__);
  45455. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45456. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45457. var render = function() {
  45458. var _vm = this
  45459. var _h = _vm.$createElement
  45460. var _c = _vm._self._c || _h
  45461. return _c(
  45462. "modal",
  45463. {
  45464. attrs: {
  45465. id: _vm.modalId,
  45466. tabindex: "-1",
  45467. role: "dialog",
  45468. "aria-labelledby": _vm.modalId + "Label"
  45469. }
  45470. },
  45471. [
  45472. _c(
  45473. "h5",
  45474. {
  45475. staticClass: "modal-title",
  45476. attrs: { slot: "header", id: _vm.modalId + "Label" },
  45477. slot: "header"
  45478. },
  45479. [_vm._v("\n Delete Note\n ")]
  45480. ),
  45481. _vm._v(" "),
  45482. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45483. _vm._v("\n Are you sure?\n ")
  45484. ]),
  45485. _vm._v(" "),
  45486. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45487. _c(
  45488. "button",
  45489. {
  45490. staticClass: "btn btn-secondary",
  45491. attrs: { type: "button", "data-dismiss": "modal" }
  45492. },
  45493. [_vm._v("Close")]
  45494. ),
  45495. _vm._v(" "),
  45496. _c(
  45497. "button",
  45498. {
  45499. staticClass: "btn btn-danger",
  45500. attrs: { type: "button" },
  45501. on: {
  45502. click: function($event) {
  45503. return _vm.deleteNote(_vm.note)
  45504. }
  45505. }
  45506. },
  45507. [
  45508. !_vm.noteDeleting
  45509. ? _c("div", [_vm._v("Confirm")])
  45510. : _c("circle-spinner", { attrs: { size: 2 } })
  45511. ],
  45512. 1
  45513. )
  45514. ])
  45515. ]
  45516. )
  45517. }
  45518. var staticRenderFns = []
  45519. render._withStripped = true
  45520. /***/ }),
  45521. /***/ "./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&":
  45522. /*!****************************************************************************************************************************************************************************************************************!*\
  45523. !*** ./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& ***!
  45524. \****************************************************************************************************************************************************************************************************************/
  45525. /*! exports provided: render, staticRenderFns */
  45526. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45527. "use strict";
  45528. __webpack_require__.r(__webpack_exports__);
  45529. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45530. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45531. var render = function() {
  45532. var _vm = this
  45533. var _h = _vm.$createElement
  45534. var _c = _vm._self._c || _h
  45535. return _c(
  45536. "div",
  45537. [
  45538. _vm.changeType
  45539. ? _c(
  45540. "modal",
  45541. {
  45542. attrs: {
  45543. id: _vm.modalId,
  45544. tabindex: "-1",
  45545. role: "dialog",
  45546. "aria-labelledby": _vm.modalId + "Label"
  45547. }
  45548. },
  45549. [
  45550. _vm.populateWith.notetype === 0
  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 Private Note\n ")]
  45559. )
  45560. : _c(
  45561. "h5",
  45562. {
  45563. staticClass: "modal-title",
  45564. attrs: { slot: "header", id: _vm.modalId + "Label" },
  45565. slot: "header"
  45566. },
  45567. [_vm._v("\n Change to Public Note\n ")]
  45568. ),
  45569. _vm._v(" "),
  45570. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45571. _vm._v("\n Are you sure?\n ")
  45572. ]),
  45573. _vm._v(" "),
  45574. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45575. _c(
  45576. "button",
  45577. {
  45578. staticClass: "btn btn-secondary",
  45579. attrs: { type: "button", "data-dismiss": "modal" }
  45580. },
  45581. [_vm._v("Close")]
  45582. ),
  45583. _vm._v(" "),
  45584. _c(
  45585. "button",
  45586. {
  45587. staticClass: "btn btn-primary",
  45588. attrs: { type: "button" },
  45589. on: {
  45590. click: function($event) {
  45591. return _vm.updateNote()
  45592. }
  45593. }
  45594. },
  45595. [
  45596. !_vm.noteSaving
  45597. ? _c("div", [_vm._v("Confirm")])
  45598. : _c("circle-spinner", { attrs: { size: 2 } })
  45599. ],
  45600. 1
  45601. )
  45602. ])
  45603. ]
  45604. )
  45605. : _c(
  45606. "modal",
  45607. {
  45608. attrs: {
  45609. id: _vm.modalId,
  45610. tabindex: "-1",
  45611. role: "dialog",
  45612. "aria-labelledby": _vm.modalId + "Label"
  45613. }
  45614. },
  45615. [
  45616. _c(
  45617. "h5",
  45618. {
  45619. staticClass: "modal-title",
  45620. attrs: { slot: "header", id: _vm.modalId + "Label" },
  45621. slot: "header"
  45622. },
  45623. [_vm._v("\n Edit Note\n ")]
  45624. ),
  45625. _vm._v(" "),
  45626. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45627. _c("div", { staticClass: "form-group" }, [
  45628. _c("label", { attrs: { for: "content" } }, [
  45629. _vm._v("Content")
  45630. ]),
  45631. _vm._v(" "),
  45632. _c("textarea", {
  45633. directives: [
  45634. {
  45635. name: "model",
  45636. rawName: "v-model",
  45637. value: _vm.note.thenote,
  45638. expression: "note.thenote"
  45639. }
  45640. ],
  45641. staticClass: "form-control",
  45642. attrs: {
  45643. name: "content" + _vm.note.noteid,
  45644. id: "content" + _vm.note.noteid
  45645. },
  45646. domProps: { value: _vm.note.thenote },
  45647. on: {
  45648. input: function($event) {
  45649. if ($event.target.composing) {
  45650. return
  45651. }
  45652. _vm.$set(_vm.note, "thenote", $event.target.value)
  45653. }
  45654. }
  45655. })
  45656. ])
  45657. ]),
  45658. _vm._v(" "),
  45659. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45660. _c(
  45661. "button",
  45662. {
  45663. staticClass: "btn btn-secondary",
  45664. attrs: { type: "button", "data-dismiss": "modal" }
  45665. },
  45666. [_vm._v("Close")]
  45667. ),
  45668. _vm._v(" "),
  45669. _c(
  45670. "button",
  45671. {
  45672. staticClass: "btn btn-primary",
  45673. attrs: { type: "button" },
  45674. on: {
  45675. click: function($event) {
  45676. return _vm.updateNote()
  45677. }
  45678. }
  45679. },
  45680. [
  45681. !_vm.noteSaving
  45682. ? _c("div", [_vm._v("Save")])
  45683. : _c("circle-spinner", { attrs: { size: 2 } })
  45684. ],
  45685. 1
  45686. )
  45687. ])
  45688. ]
  45689. )
  45690. ],
  45691. 1
  45692. )
  45693. }
  45694. var staticRenderFns = []
  45695. render._withStripped = true
  45696. /***/ }),
  45697. /***/ "./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&":
  45698. /*!********************************************************************************************************************************************************************************************************!*\
  45699. !*** ./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& ***!
  45700. \********************************************************************************************************************************************************************************************************/
  45701. /*! exports provided: render, staticRenderFns */
  45702. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45703. "use strict";
  45704. __webpack_require__.r(__webpack_exports__);
  45705. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45706. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45707. var render = function() {
  45708. var _vm = this
  45709. var _h = _vm.$createElement
  45710. var _c = _vm._self._c || _h
  45711. return _c(
  45712. "ul",
  45713. { staticClass: "list-unstyled" },
  45714. [
  45715. _c("div", { staticClass: "row" }, [
  45716. _c(
  45717. "div",
  45718. {
  45719. staticClass:
  45720. "col-md-2 d-flex justify-content-center justify-content-md-start"
  45721. },
  45722. [
  45723. _c(
  45724. "button",
  45725. {
  45726. staticClass: "btn btn-primary m-2",
  45727. attrs: {
  45728. type: "button",
  45729. "data-toggle": "collapse",
  45730. "data-target": "#note" + _vm.noteType + "add"
  45731. }
  45732. },
  45733. [
  45734. _c("i", { staticClass: "fas fa-fw fa-plus" }),
  45735. _vm._v(" Add New Note")
  45736. ]
  45737. )
  45738. ]
  45739. ),
  45740. _vm._v(" "),
  45741. _c("div", { staticClass: "col-md-10" }, [
  45742. _c(
  45743. "div",
  45744. {
  45745. staticClass: "collapse",
  45746. attrs: { id: "note" + _vm.noteType + "add" }
  45747. },
  45748. [
  45749. _c(
  45750. "div",
  45751. {
  45752. staticClass:
  45753. "d-flex flex-wrap flex-md-nowrap justify-content-center"
  45754. },
  45755. [
  45756. _c("textarea", {
  45757. directives: [
  45758. {
  45759. name: "model",
  45760. rawName: "v-model",
  45761. value: _vm.newNote.thenote,
  45762. expression: "newNote.thenote"
  45763. }
  45764. ],
  45765. staticClass: "form-control",
  45766. attrs: {
  45767. name: "newnote" + _vm.noteType,
  45768. id: "newnote" + _vm.noteType
  45769. },
  45770. domProps: { value: _vm.newNote.thenote },
  45771. on: {
  45772. input: function($event) {
  45773. if ($event.target.composing) {
  45774. return
  45775. }
  45776. _vm.$set(_vm.newNote, "thenote", $event.target.value)
  45777. }
  45778. }
  45779. }),
  45780. _vm._v(" "),
  45781. _c(
  45782. "button",
  45783. {
  45784. staticClass: "btn btn-secondary m-2",
  45785. attrs: { type: "button" },
  45786. on: {
  45787. click: function($event) {
  45788. return _vm.createNote()
  45789. }
  45790. }
  45791. },
  45792. [
  45793. !_vm.noteSaving
  45794. ? _c("div", [_vm._v("Save")])
  45795. : _c("circle-spinner", { attrs: { size: 2 } })
  45796. ],
  45797. 1
  45798. )
  45799. ]
  45800. )
  45801. ]
  45802. )
  45803. ])
  45804. ]),
  45805. _vm._v(" "),
  45806. _vm._l(this.notes, function(note, index) {
  45807. return _c(
  45808. "li",
  45809. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  45810. [
  45811. _c("note-form-modal", {
  45812. attrs: {
  45813. "modal-id": "note" + note.noteid + "editModal",
  45814. "populate-with": note
  45815. }
  45816. }),
  45817. _vm._v(" "),
  45818. _c("note-delete-modal", {
  45819. attrs: {
  45820. "modal-id": "note" + note.noteid + "deleteModal",
  45821. note: note
  45822. }
  45823. }),
  45824. _vm._v(" "),
  45825. _c("note-form-modal", {
  45826. attrs: {
  45827. "modal-id": "note" + note.noteid + "switchModal",
  45828. "populate-with": note,
  45829. "change-type": ""
  45830. }
  45831. }),
  45832. _vm._v(" "),
  45833. _c(
  45834. "div",
  45835. {
  45836. staticClass: "col-md-1 d-flex flex-column mx-md-3",
  45837. class: _vm.noteOrders[index]
  45838. },
  45839. [
  45840. _c("div", { staticClass: "text-center p-0 m-0" }, [
  45841. _vm._v(_vm._s(note.noteuser))
  45842. ]),
  45843. _vm._v(" "),
  45844. _c(
  45845. "div",
  45846. { staticClass: "text-muted text-small text-center p-0 m-0" },
  45847. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  45848. ),
  45849. _vm._v(" "),
  45850. _c(
  45851. "div",
  45852. { staticClass: "btn-group justify-content-center p-0 m-0" },
  45853. [
  45854. _vm.authusername === note.noteuser ||
  45855. _vm.authusername === "admin"
  45856. ? [
  45857. _c(
  45858. "button",
  45859. {
  45860. staticClass: "btn btn-sm btn-primary m-1",
  45861. attrs: {
  45862. "data-toggle": "modal",
  45863. "data-target":
  45864. "#note" + note.noteid + "editModal"
  45865. }
  45866. },
  45867. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  45868. ),
  45869. _vm._v(" "),
  45870. _c(
  45871. "button",
  45872. {
  45873. staticClass: "btn btn-sm btn-danger m-1",
  45874. attrs: {
  45875. "data-toggle": "modal",
  45876. "data-target":
  45877. "#note" + note.noteid + "deleteModal"
  45878. }
  45879. },
  45880. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  45881. ),
  45882. _vm._v(" "),
  45883. _c(
  45884. "button",
  45885. {
  45886. staticClass: "btn btn-sm btn-primary m-1",
  45887. attrs: {
  45888. "data-toggle": "modal",
  45889. "data-target":
  45890. "#note" + note.noteid + "switchModal"
  45891. }
  45892. },
  45893. [_c("i", { staticClass: "fa fa-fw fa-random" })]
  45894. )
  45895. ]
  45896. : _vm._e()
  45897. ],
  45898. 2
  45899. )
  45900. ]
  45901. ),
  45902. _vm._v(" "),
  45903. _c("div", { staticClass: "col-md-10" }, [
  45904. _c("div", { staticClass: "card m-2" }, [
  45905. _c("div", { staticClass: "card-body p-2" }, [
  45906. _vm._v(
  45907. "\n " +
  45908. _vm._s(note.thenote) +
  45909. "\n "
  45910. )
  45911. ])
  45912. ])
  45913. ])
  45914. ],
  45915. 1
  45916. )
  45917. })
  45918. ],
  45919. 2
  45920. )
  45921. }
  45922. var staticRenderFns = []
  45923. render._withStripped = true
  45924. /***/ }),
  45925. /***/ "./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&":
  45926. /*!******************************************************************************************************************************************************************************************************************!*\
  45927. !*** ./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& ***!
  45928. \******************************************************************************************************************************************************************************************************************/
  45929. /*! exports provided: render, staticRenderFns */
  45930. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45931. "use strict";
  45932. __webpack_require__.r(__webpack_exports__);
  45933. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45934. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45935. var render = function() {
  45936. var _vm = this
  45937. var _h = _vm.$createElement
  45938. var _c = _vm._self._c || _h
  45939. return _c(
  45940. "modal",
  45941. {
  45942. attrs: {
  45943. id: _vm.id,
  45944. tabindex: "-1",
  45945. role: "dialog",
  45946. "aria-labelledby": _vm.id + "Label"
  45947. }
  45948. },
  45949. [
  45950. _c(
  45951. "h5",
  45952. {
  45953. staticClass: "modal-title",
  45954. attrs: { slot: "header", id: _vm.id + "Label" },
  45955. slot: "header"
  45956. },
  45957. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  45958. ),
  45959. _vm._v(" "),
  45960. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45961. _c(
  45962. "div",
  45963. { staticClass: "form-group" },
  45964. [
  45965. _c("label", { attrs: { for: "probdesc" } }, [
  45966. _vm._v("Problem Description")
  45967. ]),
  45968. _vm._v(" "),
  45969. _c("textarea", {
  45970. directives: [
  45971. {
  45972. name: "model",
  45973. rawName: "v-model",
  45974. value: _vm.data.probdesc,
  45975. expression: "data.probdesc"
  45976. }
  45977. ],
  45978. class: {
  45979. "form-control": true,
  45980. "is-invalid": _vm.errors.probdesc
  45981. },
  45982. attrs: { id: "probdesc", name: "probdesc" },
  45983. domProps: { value: _vm.data.probdesc },
  45984. on: {
  45985. input: function($event) {
  45986. if ($event.target.composing) {
  45987. return
  45988. }
  45989. _vm.$set(_vm.data, "probdesc", $event.target.value)
  45990. }
  45991. }
  45992. }),
  45993. _vm._v(" "),
  45994. _c("error-list", { attrs: { errors: _vm.errors.probdesc } })
  45995. ],
  45996. 1
  45997. ),
  45998. _vm._v(" "),
  45999. _c(
  46000. "div",
  46001. { staticClass: "form-group" },
  46002. [
  46003. _c("label", { attrs: { for: "suggested" } }, [
  46004. _vm._v("Suggested Solution")
  46005. ]),
  46006. _vm._v(" "),
  46007. _c("textarea", {
  46008. directives: [
  46009. {
  46010. name: "model",
  46011. rawName: "v-model",
  46012. value: _vm.data.suggested,
  46013. expression: "data.suggested"
  46014. }
  46015. ],
  46016. class: {
  46017. "form-control": true,
  46018. "is-invalid": _vm.errors.suggested
  46019. },
  46020. attrs: { id: "suggested", name: "suggested" },
  46021. domProps: { value: _vm.data.suggested },
  46022. on: {
  46023. input: function($event) {
  46024. if ($event.target.composing) {
  46025. return
  46026. }
  46027. _vm.$set(_vm.data, "suggested", $event.target.value)
  46028. }
  46029. }
  46030. }),
  46031. _vm._v(" "),
  46032. _c("error-list", { attrs: { errors: _vm.errors.suggested } })
  46033. ],
  46034. 1
  46035. ),
  46036. _vm._v(" "),
  46037. _c(
  46038. "div",
  46039. { staticClass: "form-group" },
  46040. [
  46041. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  46042. _vm._v(" "),
  46043. _c("autocomplete-custom-dropdown", {
  46044. attrs: { options: _vm.storeList, value: this.store },
  46045. model: {
  46046. value: _vm.store,
  46047. callback: function($$v) {
  46048. _vm.store = $$v
  46049. },
  46050. expression: "store"
  46051. }
  46052. })
  46053. ],
  46054. 1
  46055. )
  46056. ]),
  46057. _vm._v(" "),
  46058. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  46059. _c(
  46060. "button",
  46061. {
  46062. staticClass: "btn btn-secondary",
  46063. attrs: { type: "button", "data-dismiss": "modal" }
  46064. },
  46065. [_vm._v("Close")]
  46066. ),
  46067. _vm._v(" "),
  46068. _c(
  46069. "button",
  46070. {
  46071. staticClass: "btn btn-primary",
  46072. attrs: { type: "button" },
  46073. on: {
  46074. click: function($event) {
  46075. return _vm.updateWorkOrder()
  46076. }
  46077. }
  46078. },
  46079. [
  46080. !_vm.woInfoSaving
  46081. ? _c("div", [_vm._v("Save")])
  46082. : _c("circle-spinner", { attrs: { size: 2 } })
  46083. ],
  46084. 1
  46085. )
  46086. ])
  46087. ]
  46088. )
  46089. }
  46090. var staticRenderFns = []
  46091. render._withStripped = true
  46092. /***/ }),
  46093. /***/ "./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&":
  46094. /*!****************************************************************************************************************************************************************************************************************!*\
  46095. !*** ./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& ***!
  46096. \****************************************************************************************************************************************************************************************************************/
  46097. /*! exports provided: render, staticRenderFns */
  46098. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46099. "use strict";
  46100. __webpack_require__.r(__webpack_exports__);
  46101. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46102. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46103. var render = function() {
  46104. var _vm = this
  46105. var _h = _vm.$createElement
  46106. var _c = _vm._self._c || _h
  46107. return _c(
  46108. "div",
  46109. [
  46110. _c("wo-info-edit-modal", {
  46111. attrs: {
  46112. "modal-id": "workordereditModal",
  46113. "populate-with": _vm.workOrder,
  46114. "store-list": this.storeList
  46115. }
  46116. }),
  46117. _vm._v(" "),
  46118. _c("p", [
  46119. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  46120. _vm._v(" "),
  46121. _c("span", {
  46122. domProps: { textContent: _vm._s(_vm.workOrder.probdesc) }
  46123. })
  46124. ]),
  46125. _vm._v(" "),
  46126. _c("p", [
  46127. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  46128. _vm._v(" "),
  46129. _c("span", {
  46130. domProps: { textContent: _vm._s(_vm.workOrder.suggested) }
  46131. })
  46132. ]),
  46133. _vm._v(" "),
  46134. _c("p", [
  46135. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  46136. _vm._v(" "),
  46137. _c("span", { domProps: { textContent: _vm._s(_vm.workOrder.woid) } })
  46138. ]),
  46139. _vm._v(" "),
  46140. _c("p", [
  46141. _c("i", { staticClass: "fas fa-fw fa-building" }),
  46142. _vm._v(" "),
  46143. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.workOrder.storeid]))])
  46144. ]),
  46145. _vm._v(" "),
  46146. _c("p", [
  46147. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  46148. _vm._v(" "),
  46149. _c(
  46150. "span",
  46151. {
  46152. staticClass: "dashed-underline",
  46153. attrs: {
  46154. "data-toggle": "tooltip",
  46155. "data-placement": "bottom",
  46156. title: this.getHRDate(_vm.workOrder.dropdate)
  46157. }
  46158. },
  46159. [
  46160. _vm._v(
  46161. "\n " +
  46162. _vm._s(_vm.daysOrDate(_vm.workOrder.dropdate)) +
  46163. "\n "
  46164. )
  46165. ]
  46166. )
  46167. ]),
  46168. _vm._v(" "),
  46169. _c("p", [
  46170. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  46171. _vm._v(" "),
  46172. !this.isZero(_vm.workOrder.pickupdate)
  46173. ? _c(
  46174. "span",
  46175. {
  46176. staticClass: "dashed-underline",
  46177. attrs: {
  46178. "data-toggle": "tooltip",
  46179. "data-placement": "bottom",
  46180. title: this.getHRDate(_vm.workOrder.pickupdate)
  46181. }
  46182. },
  46183. [
  46184. _vm._v(
  46185. "\n " +
  46186. _vm._s(_vm.daysOrDate(_vm.workOrder.pickupdate)) +
  46187. "\n "
  46188. )
  46189. ]
  46190. )
  46191. : _vm._e()
  46192. ]),
  46193. _vm._v(" "),
  46194. _c(
  46195. "button",
  46196. {
  46197. staticClass: "btn btn-primary",
  46198. attrs: {
  46199. type: "button",
  46200. "data-toggle": "modal",
  46201. "data-target": "#workordereditModal"
  46202. }
  46203. },
  46204. [_vm._v("Edit")]
  46205. )
  46206. ],
  46207. 1
  46208. )
  46209. }
  46210. var staticRenderFns = []
  46211. render._withStripped = true
  46212. /***/ }),
  46213. /***/ "./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&":
  46214. /*!*************************************************************************************************************************************************************************************************!*\
  46215. !*** ./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& ***!
  46216. \*************************************************************************************************************************************************************************************************/
  46217. /*! exports provided: render, staticRenderFns */
  46218. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46219. "use strict";
  46220. __webpack_require__.r(__webpack_exports__);
  46221. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46222. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46223. var render = function() {
  46224. var _vm = this
  46225. var _h = _vm.$createElement
  46226. var _c = _vm._self._c || _h
  46227. return _c("div", [
  46228. _c(
  46229. "nav",
  46230. {
  46231. staticClass:
  46232. "navbar navbar-expand navbar-dark bg-primary text-light shadow-sm"
  46233. },
  46234. [
  46235. _c(
  46236. "div",
  46237. { staticClass: "container-fluid" },
  46238. [
  46239. _c(
  46240. "router-link",
  46241. { staticClass: "navbar-brand", attrs: { to: { name: "home" } } },
  46242. [_vm._v("\n UPCCRT\n ")]
  46243. ),
  46244. _vm._v(" "),
  46245. _vm._m(0),
  46246. _vm._v(" "),
  46247. _c(
  46248. "div",
  46249. {
  46250. staticClass: "collapse navbar-collapse",
  46251. attrs: { id: "navbarSupportedContent" }
  46252. },
  46253. [
  46254. _c("ul", { staticClass: "navbar-nav mr-auto text-center" }, [
  46255. _vm._m(1),
  46256. _vm._v(" "),
  46257. _vm._m(2),
  46258. _vm._v(" "),
  46259. _c(
  46260. "li",
  46261. { staticClass: "nav-item" },
  46262. [
  46263. _c(
  46264. "router-link",
  46265. {
  46266. staticClass: "nav-link",
  46267. attrs: { to: { name: "dashboard" } }
  46268. },
  46269. [
  46270. _c("i", { staticClass: "fas fa-tachometer-alt" }),
  46271. _vm._v(" "),
  46272. _c(
  46273. "span",
  46274. { staticClass: "d-none d-sm-block d-md-inline" },
  46275. [_vm._v("Dashboard")]
  46276. )
  46277. ]
  46278. )
  46279. ],
  46280. 1
  46281. ),
  46282. _vm._v(" "),
  46283. _vm._m(3)
  46284. ]),
  46285. _vm._v(" "),
  46286. _c(
  46287. "ul",
  46288. { staticClass: "navbar-nav ml-auto" },
  46289. [
  46290. !_vm.isLoggedIn
  46291. ? _c(
  46292. "router-link",
  46293. {
  46294. staticClass: "nav-link",
  46295. attrs: { to: { name: "login" } }
  46296. },
  46297. [_vm._v("Login")]
  46298. )
  46299. : _vm._e(),
  46300. _vm._v(" "),
  46301. _vm.isLoggedIn
  46302. ? _c("li", { staticClass: "nav-link" }, [
  46303. _vm._v(_vm._s(_vm.username))
  46304. ])
  46305. : _vm._e(),
  46306. _vm._v(" "),
  46307. _vm.isLoggedIn
  46308. ? _c(
  46309. "router-link",
  46310. {
  46311. staticClass: "nav-link",
  46312. attrs: { to: { name: "home" } }
  46313. },
  46314. [_vm._v("Home")]
  46315. )
  46316. : _vm._e()
  46317. ],
  46318. 1
  46319. )
  46320. ]
  46321. )
  46322. ],
  46323. 1
  46324. )
  46325. ]
  46326. ),
  46327. _vm._v(" "),
  46328. _c("main", { staticClass: "py-4" }, [_c("router-view")], 1)
  46329. ])
  46330. }
  46331. var staticRenderFns = [
  46332. function() {
  46333. var _vm = this
  46334. var _h = _vm.$createElement
  46335. var _c = _vm._self._c || _h
  46336. return _c(
  46337. "button",
  46338. {
  46339. staticClass: "navbar-toggler",
  46340. attrs: {
  46341. type: "button",
  46342. "data-toggle": "collapse",
  46343. "data-target": "#navbarSupportedContent",
  46344. "aria-controls": "navbarSupportedContent",
  46345. "aria-expanded": "false"
  46346. }
  46347. },
  46348. [_c("span", { staticClass: "navbar-toggler-icon" })]
  46349. )
  46350. },
  46351. function() {
  46352. var _vm = this
  46353. var _h = _vm.$createElement
  46354. var _c = _vm._self._c || _h
  46355. return _c("li", { staticClass: "nav-item" }, [
  46356. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46357. _c("i", { staticClass: "fas fa-sign-in-alt" }),
  46358. _vm._v(" "),
  46359. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46360. _vm._v("Check-In")
  46361. ])
  46362. ])
  46363. ])
  46364. },
  46365. function() {
  46366. var _vm = this
  46367. var _h = _vm.$createElement
  46368. var _c = _vm._self._c || _h
  46369. return _c("li", { staticClass: "nav-item" }, [
  46370. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46371. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  46372. _vm._v(" "),
  46373. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46374. _vm._v("Check-Out")
  46375. ])
  46376. ])
  46377. ])
  46378. },
  46379. function() {
  46380. var _vm = this
  46381. var _h = _vm.$createElement
  46382. var _c = _vm._self._c || _h
  46383. return _c("li", { staticClass: "nav-item" }, [
  46384. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46385. _c("i", { staticClass: "fas fa-chart-bar" }),
  46386. _vm._v(" "),
  46387. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46388. _vm._v("Reports")
  46389. ])
  46390. ])
  46391. ])
  46392. }
  46393. ]
  46394. render._withStripped = true
  46395. /***/ }),
  46396. /***/ "./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&":
  46397. /*!*******************************************************************************************************************************************************************************************************!*\
  46398. !*** ./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& ***!
  46399. \*******************************************************************************************************************************************************************************************************/
  46400. /*! exports provided: render, staticRenderFns */
  46401. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46402. "use strict";
  46403. __webpack_require__.r(__webpack_exports__);
  46404. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46405. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46406. var render = function() {
  46407. var _vm = this
  46408. var _h = _vm.$createElement
  46409. var _c = _vm._self._c || _h
  46410. return _c("div", { staticClass: "container" }, [
  46411. _c("div", { staticClass: "row justify-content-center" }, [
  46412. !_vm.isLoading
  46413. ? _c(
  46414. "div",
  46415. { staticClass: "col-md-12" },
  46416. _vm._l(_vm.workOrders, function(workOrder, index) {
  46417. return _c(
  46418. "div",
  46419. { key: workOrder.woid, staticClass: "col-md-4" },
  46420. [
  46421. _c("div", { staticClass: "card" }, [
  46422. _c(
  46423. "div",
  46424. { staticClass: "card-header" },
  46425. [
  46426. _c(
  46427. "router-link",
  46428. {
  46429. staticClass: "h4 card-title",
  46430. attrs: {
  46431. to: {
  46432. name: "workorders",
  46433. params: { id: workOrder.woid }
  46434. }
  46435. }
  46436. },
  46437. [_vm._v(_vm._s(workOrder.woid))]
  46438. )
  46439. ],
  46440. 1
  46441. ),
  46442. _vm._v(" "),
  46443. _c("div", { staticClass: "card-body card-body-dark" }, [
  46444. _c("div", [
  46445. _vm._v(
  46446. "\n " +
  46447. _vm._s(workOrder.probdesc) +
  46448. "\n "
  46449. )
  46450. ]),
  46451. _vm._v(" "),
  46452. _c("div", [
  46453. _vm._v(
  46454. "\n " +
  46455. _vm._s(workOrder.suggested) +
  46456. "\n "
  46457. )
  46458. ])
  46459. ])
  46460. ])
  46461. ]
  46462. )
  46463. }),
  46464. 0
  46465. )
  46466. : _c(
  46467. "div",
  46468. { staticClass: "col-md-12" },
  46469. [_c("circle-spinner", { attrs: { color: "#663399" } })],
  46470. 1
  46471. )
  46472. ])
  46473. ])
  46474. }
  46475. var staticRenderFns = []
  46476. render._withStripped = true
  46477. /***/ }),
  46478. /***/ "./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&":
  46479. /*!***************************************************************************************************************************************************************************************************!*\
  46480. !*** ./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& ***!
  46481. \***************************************************************************************************************************************************************************************************/
  46482. /*! exports provided: render, staticRenderFns */
  46483. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46484. "use strict";
  46485. __webpack_require__.r(__webpack_exports__);
  46486. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46487. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46488. var render = function() {
  46489. var _vm = this
  46490. var _h = _vm.$createElement
  46491. var _c = _vm._self._c || _h
  46492. return _c("div", { staticClass: "container" }, [
  46493. _c("div", { staticClass: "row justify-content-center" }, [
  46494. _c("div", { staticClass: "col-md-8" }, [
  46495. _c("div", { staticClass: "card card-default" }, [
  46496. _c("div", { staticClass: "card-header" }, [_vm._v("Login")]),
  46497. _vm._v(" "),
  46498. _c("div", { staticClass: "card-body" }, [
  46499. _c("form", { attrs: { method: "POST", action: "/login" } }, [
  46500. _c("div", { staticClass: "form-group row" }, [
  46501. _c(
  46502. "label",
  46503. {
  46504. staticClass: "col-sm-4 col-form-label text-md-right",
  46505. attrs: { for: "username" }
  46506. },
  46507. [_vm._v("Username")]
  46508. ),
  46509. _vm._v(" "),
  46510. _c("div", { staticClass: "col-md-6" }, [
  46511. _c("input", {
  46512. directives: [
  46513. {
  46514. name: "model",
  46515. rawName: "v-model",
  46516. value: _vm.username,
  46517. expression: "username"
  46518. }
  46519. ],
  46520. staticClass: "form-control",
  46521. attrs: {
  46522. id: "username",
  46523. type: "username",
  46524. required: "",
  46525. autofocus: ""
  46526. },
  46527. domProps: { value: _vm.username },
  46528. on: {
  46529. input: function($event) {
  46530. if ($event.target.composing) {
  46531. return
  46532. }
  46533. _vm.username = $event.target.value
  46534. }
  46535. }
  46536. })
  46537. ])
  46538. ]),
  46539. _vm._v(" "),
  46540. _c("div", { staticClass: "form-group row" }, [
  46541. _c(
  46542. "label",
  46543. {
  46544. staticClass: "col-md-4 col-form-label text-md-right",
  46545. attrs: { for: "password" }
  46546. },
  46547. [_vm._v("Password")]
  46548. ),
  46549. _vm._v(" "),
  46550. _c("div", { staticClass: "col-md-6" }, [
  46551. _c("input", {
  46552. directives: [
  46553. {
  46554. name: "model",
  46555. rawName: "v-model",
  46556. value: _vm.password,
  46557. expression: "password"
  46558. }
  46559. ],
  46560. staticClass: "form-control",
  46561. attrs: { id: "password", type: "password", required: "" },
  46562. domProps: { value: _vm.password },
  46563. on: {
  46564. input: function($event) {
  46565. if ($event.target.composing) {
  46566. return
  46567. }
  46568. _vm.password = $event.target.value
  46569. }
  46570. }
  46571. })
  46572. ])
  46573. ]),
  46574. _vm._v(" "),
  46575. _c("div", { staticClass: "form-group row mb-0" }, [
  46576. _c("div", { staticClass: "col-md-8 offset-md-4" }, [
  46577. _c(
  46578. "button",
  46579. {
  46580. staticClass: "btn btn-primary",
  46581. attrs: { type: "submit" },
  46582. on: { click: _vm.handleSubmit }
  46583. },
  46584. [
  46585. _vm._v(
  46586. "\n Login\n "
  46587. )
  46588. ]
  46589. )
  46590. ])
  46591. ])
  46592. ])
  46593. ])
  46594. ])
  46595. ])
  46596. ])
  46597. ])
  46598. }
  46599. var staticRenderFns = []
  46600. render._withStripped = true
  46601. /***/ }),
  46602. /***/ "./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&":
  46603. /*!*****************************************************************************************************************************************************************************************************************!*\
  46604. !*** ./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& ***!
  46605. \*****************************************************************************************************************************************************************************************************************/
  46606. /*! exports provided: render, staticRenderFns */
  46607. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46608. "use strict";
  46609. __webpack_require__.r(__webpack_exports__);
  46610. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46611. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46612. var render = function() {
  46613. var _vm = this
  46614. var _h = _vm.$createElement
  46615. var _c = _vm._self._c || _h
  46616. return _vm._m(0)
  46617. }
  46618. var staticRenderFns = [
  46619. function() {
  46620. var _vm = this
  46621. var _h = _vm.$createElement
  46622. var _c = _vm._self._c || _h
  46623. return _c("div", { staticClass: "flex-center position-ref full-height" }, [
  46624. _c("div", { staticClass: "content" }, [
  46625. _c("div", { staticClass: "m-b-md" }, [
  46626. _c("h2", { staticClass: "title m-b-md" }, [
  46627. _vm._v("\n UPCCRT\n ")
  46628. ]),
  46629. _vm._v(" "),
  46630. _c("h3", [
  46631. _vm._v(
  46632. "\n University PC Care Repair Tracker\n "
  46633. )
  46634. ])
  46635. ])
  46636. ])
  46637. ])
  46638. }
  46639. ]
  46640. render._withStripped = true
  46641. /***/ }),
  46642. /***/ "./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&":
  46643. /*!*******************************************************************************************************************************************************************************************************!*\
  46644. !*** ./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& ***!
  46645. \*******************************************************************************************************************************************************************************************************/
  46646. /*! exports provided: render, staticRenderFns */
  46647. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46648. "use strict";
  46649. __webpack_require__.r(__webpack_exports__);
  46650. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46651. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46652. var render = function() {
  46653. var _vm = this
  46654. var _h = _vm.$createElement
  46655. var _c = _vm._self._c || _h
  46656. return _c("div", { staticClass: "container-fluid" }, [
  46657. _c("div", { staticClass: "row my-3" }, [
  46658. _c("div", { staticClass: "col-lg-6" }, [
  46659. _c("div", { staticClass: "card h-100" }, [
  46660. _vm._m(0),
  46661. _vm._v(" "),
  46662. _c("div", { staticClass: "card-body" }, [
  46663. _c("div", { staticClass: "tab-content" }, [
  46664. _c(
  46665. "div",
  46666. {
  46667. staticClass: "tab-pane active",
  46668. attrs: {
  46669. id: "assetinfo",
  46670. role: "tabpanel",
  46671. "aria-labelledby": "assetinfo-tab"
  46672. }
  46673. },
  46674. [
  46675. !_vm.assetLoading
  46676. ? _c("asset-info", { attrs: { asset: _vm.asset } })
  46677. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46678. ],
  46679. 1
  46680. ),
  46681. _vm._v(" "),
  46682. _c(
  46683. "div",
  46684. {
  46685. staticClass: "tab-pane",
  46686. attrs: {
  46687. id: "credentials",
  46688. role: "tabpanel",
  46689. "aria-labelledby": "credentials-tab"
  46690. }
  46691. },
  46692. [
  46693. !_vm.credentialsLoading && !_vm.credentialDescriptionsLoading
  46694. ? _c("credential-list", {
  46695. attrs: {
  46696. credentials: _vm.credentials,
  46697. descriptions: _vm.credentialDescriptions,
  46698. pcid: _vm.asset.pcid
  46699. }
  46700. })
  46701. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46702. ],
  46703. 1
  46704. )
  46705. ])
  46706. ])
  46707. ])
  46708. ]),
  46709. _vm._v(" "),
  46710. _c("div", { staticClass: "col-lg-6" }, [
  46711. _c("div", { staticClass: "card h-100" }, [
  46712. _vm._m(1),
  46713. _vm._v(" "),
  46714. _c("div", { staticClass: "card-body" }, [
  46715. _c("div", { staticClass: "tab-content" }, [
  46716. _c(
  46717. "div",
  46718. {
  46719. staticClass: "tab-pane active",
  46720. attrs: {
  46721. id: "workordersumm",
  46722. role: "tabpanel",
  46723. "aria-labelledby": "workordersumm-tab"
  46724. }
  46725. },
  46726. [
  46727. !_vm.woLoading && !_vm.storesLoading
  46728. ? _c("work-order-info", {
  46729. attrs: {
  46730. "work-order": _vm.workOrder,
  46731. stores: _vm.stores
  46732. }
  46733. })
  46734. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46735. ],
  46736. 1
  46737. ),
  46738. _vm._v(" "),
  46739. _c(
  46740. "div",
  46741. {
  46742. staticClass: "tab-pane",
  46743. attrs: {
  46744. id: "attachments",
  46745. role: "tabpanel",
  46746. "aria-labelledby": "attachments-tab"
  46747. }
  46748. },
  46749. [
  46750. _vm._v(
  46751. "\n TODO 2\n "
  46752. )
  46753. ]
  46754. )
  46755. ])
  46756. ])
  46757. ])
  46758. ])
  46759. ]),
  46760. _vm._v(" "),
  46761. _c("div", { staticClass: "row my-3 no-gutters" }, [
  46762. _c("div", { staticClass: "col-12" }, [
  46763. _c("div", { staticClass: "card" }, [
  46764. _c(
  46765. "div",
  46766. { staticClass: "card-body" },
  46767. [
  46768. _c("h5", { staticClass: "card-title" }, [
  46769. _vm._v("Customer Notes")
  46770. ]),
  46771. _vm._v(" "),
  46772. !_vm.workOrderNotesLoading
  46773. ? _c("notes", {
  46774. attrs: {
  46775. notes: _vm.publicNotes,
  46776. authusername: _vm.authUser,
  46777. "note-type": 0,
  46778. woid: _vm.id
  46779. }
  46780. })
  46781. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46782. ],
  46783. 1
  46784. )
  46785. ])
  46786. ])
  46787. ]),
  46788. _vm._v(" "),
  46789. _c("div", { staticClass: "row my-3 no-gutters" }, [
  46790. _c("div", { staticClass: "col-12" }, [
  46791. _c("div", { staticClass: "card" }, [
  46792. _c(
  46793. "div",
  46794. { staticClass: "card-body" },
  46795. [
  46796. _c("h5", { staticClass: "card-title" }, [
  46797. _vm._v("Private/Billing Notes")
  46798. ]),
  46799. _vm._v(" "),
  46800. !_vm.workOrderNotesLoading
  46801. ? _c("notes", {
  46802. attrs: {
  46803. notes: _vm.privateNotes,
  46804. authusername: _vm.authUser,
  46805. "note-type": 1,
  46806. woid: _vm.id
  46807. }
  46808. })
  46809. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46810. ],
  46811. 1
  46812. )
  46813. ])
  46814. ])
  46815. ])
  46816. ])
  46817. }
  46818. var staticRenderFns = [
  46819. function() {
  46820. var _vm = this
  46821. var _h = _vm.$createElement
  46822. var _c = _vm._self._c || _h
  46823. return _c("div", { staticClass: "card-header text-right" }, [
  46824. _c(
  46825. "button",
  46826. {
  46827. staticClass: "btn btn-default xs-toggle",
  46828. attrs: {
  46829. type: "button",
  46830. "data-toggle": "collapse",
  46831. "data-target": "#assetTab"
  46832. }
  46833. },
  46834. [
  46835. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  46836. _vm._v(" "),
  46837. _c("span", { staticClass: "icon-bar" }),
  46838. _vm._v(" "),
  46839. _c("span", { staticClass: "icon-bar" }),
  46840. _vm._v(" "),
  46841. _c("span", { staticClass: "icon-bar" })
  46842. ]
  46843. ),
  46844. _vm._v(" "),
  46845. _c(
  46846. "ul",
  46847. {
  46848. staticClass:
  46849. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  46850. attrs: { id: "assetTab", role: "tablist" }
  46851. },
  46852. [
  46853. _c("li", { staticClass: "nav-item" }, [
  46854. _c(
  46855. "a",
  46856. {
  46857. staticClass: "nav-link active",
  46858. attrs: {
  46859. id: "assetinfo-tab",
  46860. "data-toggle": "pill",
  46861. href: "#assetinfo",
  46862. role: "tab",
  46863. "aria-controls": "assetinfo",
  46864. "aria-selected": "true"
  46865. }
  46866. },
  46867. [_vm._v("Hardware")]
  46868. )
  46869. ]),
  46870. _vm._v(" "),
  46871. _c("li", { staticClass: "nav-item" }, [
  46872. _c(
  46873. "a",
  46874. {
  46875. staticClass: "nav-link",
  46876. attrs: {
  46877. id: "credentials-tab",
  46878. "data-toggle": "pill",
  46879. href: "#credentials",
  46880. role: "tab",
  46881. "aria-controls": "credentials",
  46882. "aria-selected": "false"
  46883. }
  46884. },
  46885. [_vm._v("Credentials")]
  46886. )
  46887. ])
  46888. ]
  46889. )
  46890. ])
  46891. },
  46892. function() {
  46893. var _vm = this
  46894. var _h = _vm.$createElement
  46895. var _c = _vm._self._c || _h
  46896. return _c("div", { staticClass: "card-header text-right" }, [
  46897. _c(
  46898. "button",
  46899. {
  46900. staticClass: "btn btn-default xs-toggle",
  46901. attrs: {
  46902. type: "button",
  46903. "data-toggle": "collapse",
  46904. "data-target": "#workorderTab"
  46905. }
  46906. },
  46907. [
  46908. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  46909. _vm._v(" "),
  46910. _c("span", { staticClass: "icon-bar" }),
  46911. _vm._v(" "),
  46912. _c("span", { staticClass: "icon-bar" }),
  46913. _vm._v(" "),
  46914. _c("span", { staticClass: "icon-bar" })
  46915. ]
  46916. ),
  46917. _vm._v(" "),
  46918. _c(
  46919. "ul",
  46920. {
  46921. staticClass:
  46922. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  46923. attrs: { id: "workorderTab", role: "tablist" }
  46924. },
  46925. [
  46926. _c("li", { staticClass: "nav-item" }, [
  46927. _c(
  46928. "a",
  46929. {
  46930. staticClass: "nav-link active",
  46931. attrs: {
  46932. id: "workordersumm-tab",
  46933. "data-toggle": "pill",
  46934. href: "#workordersumm",
  46935. role: "tab",
  46936. "aria-controls": "workordersumm",
  46937. "aria-selected": "true"
  46938. }
  46939. },
  46940. [_vm._v("Summary")]
  46941. )
  46942. ]),
  46943. _vm._v(" "),
  46944. _c("li", { staticClass: "nav-item" }, [
  46945. _c(
  46946. "a",
  46947. {
  46948. staticClass: "nav-link",
  46949. attrs: {
  46950. id: "attachments-tab",
  46951. "data-toggle": "pill",
  46952. href: "#attachments",
  46953. role: "tab",
  46954. "aria-controls": "attachments",
  46955. "aria-selected": "false"
  46956. }
  46957. },
  46958. [_vm._v("Attachments")]
  46959. )
  46960. ])
  46961. ]
  46962. )
  46963. ])
  46964. }
  46965. ]
  46966. render._withStripped = true
  46967. /***/ }),
  46968. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  46969. /*!********************************************************************!*\
  46970. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  46971. \********************************************************************/
  46972. /*! exports provided: default */
  46973. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46974. "use strict";
  46975. __webpack_require__.r(__webpack_exports__);
  46976. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  46977. /* globals __VUE_SSR_CONTEXT__ */
  46978. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  46979. // This module is a runtime utility for cleaner component module output and will
  46980. // be included in the final webpack user bundle.
  46981. function normalizeComponent (
  46982. scriptExports,
  46983. render,
  46984. staticRenderFns,
  46985. functionalTemplate,
  46986. injectStyles,
  46987. scopeId,
  46988. moduleIdentifier, /* server only */
  46989. shadowMode /* vue-cli only */
  46990. ) {
  46991. // Vue.extend constructor export interop
  46992. var options = typeof scriptExports === 'function'
  46993. ? scriptExports.options
  46994. : scriptExports
  46995. // render functions
  46996. if (render) {
  46997. options.render = render
  46998. options.staticRenderFns = staticRenderFns
  46999. options._compiled = true
  47000. }
  47001. // functional template
  47002. if (functionalTemplate) {
  47003. options.functional = true
  47004. }
  47005. // scopedId
  47006. if (scopeId) {
  47007. options._scopeId = 'data-v-' + scopeId
  47008. }
  47009. var hook
  47010. if (moduleIdentifier) { // server build
  47011. hook = function (context) {
  47012. // 2.3 injection
  47013. context =
  47014. context || // cached call
  47015. (this.$vnode && this.$vnode.ssrContext) || // stateful
  47016. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  47017. // 2.2 with runInNewContext: true
  47018. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  47019. context = __VUE_SSR_CONTEXT__
  47020. }
  47021. // inject component styles
  47022. if (injectStyles) {
  47023. injectStyles.call(this, context)
  47024. }
  47025. // register component module identifier for async chunk inferrence
  47026. if (context && context._registeredComponents) {
  47027. context._registeredComponents.add(moduleIdentifier)
  47028. }
  47029. }
  47030. // used by ssr in case component is cached and beforeCreate
  47031. // never gets called
  47032. options._ssrRegister = hook
  47033. } else if (injectStyles) {
  47034. hook = shadowMode
  47035. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  47036. : injectStyles
  47037. }
  47038. if (hook) {
  47039. if (options.functional) {
  47040. // for template-only hot-reload because in that case the render fn doesn't
  47041. // go through the normalizer
  47042. options._injectStyles = hook
  47043. // register for functioal component in vue file
  47044. var originalRender = options.render
  47045. options.render = function renderWithStyleInjection (h, context) {
  47046. hook.call(context)
  47047. return originalRender(h, context)
  47048. }
  47049. } else {
  47050. // inject component registration as beforeCreate hook
  47051. var existing = options.beforeCreate
  47052. options.beforeCreate = existing
  47053. ? [].concat(existing, hook)
  47054. : [hook]
  47055. }
  47056. }
  47057. return {
  47058. exports: scriptExports,
  47059. options: options
  47060. }
  47061. }
  47062. /***/ }),
  47063. /***/ "./node_modules/vue-router/dist/vue-router.esm.js":
  47064. /*!********************************************************!*\
  47065. !*** ./node_modules/vue-router/dist/vue-router.esm.js ***!
  47066. \********************************************************/
  47067. /*! exports provided: default */
  47068. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  47069. "use strict";
  47070. __webpack_require__.r(__webpack_exports__);
  47071. /*!
  47072. * vue-router v3.1.6
  47073. * (c) 2020 Evan You
  47074. * @license MIT
  47075. */
  47076. /* */
  47077. function assert (condition, message) {
  47078. if (!condition) {
  47079. throw new Error(("[vue-router] " + message))
  47080. }
  47081. }
  47082. function warn (condition, message) {
  47083. if ( true && !condition) {
  47084. typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
  47085. }
  47086. }
  47087. function isError (err) {
  47088. return Object.prototype.toString.call(err).indexOf('Error') > -1
  47089. }
  47090. function isExtendedError (constructor, err) {
  47091. return (
  47092. err instanceof constructor ||
  47093. // _name is to support IE9 too
  47094. (err && (err.name === constructor.name || err._name === constructor._name))
  47095. )
  47096. }
  47097. function extend (a, b) {
  47098. for (var key in b) {
  47099. a[key] = b[key];
  47100. }
  47101. return a
  47102. }
  47103. var View = {
  47104. name: 'RouterView',
  47105. functional: true,
  47106. props: {
  47107. name: {
  47108. type: String,
  47109. default: 'default'
  47110. }
  47111. },
  47112. render: function render (_, ref) {
  47113. var props = ref.props;
  47114. var children = ref.children;
  47115. var parent = ref.parent;
  47116. var data = ref.data;
  47117. // used by devtools to display a router-view badge
  47118. data.routerView = true;
  47119. // directly use parent context's createElement() function
  47120. // so that components rendered by router-view can resolve named slots
  47121. var h = parent.$createElement;
  47122. var name = props.name;
  47123. var route = parent.$route;
  47124. var cache = parent._routerViewCache || (parent._routerViewCache = {});
  47125. // determine current view depth, also check to see if the tree
  47126. // has been toggled inactive but kept-alive.
  47127. var depth = 0;
  47128. var inactive = false;
  47129. while (parent && parent._routerRoot !== parent) {
  47130. var vnodeData = parent.$vnode ? parent.$vnode.data : {};
  47131. if (vnodeData.routerView) {
  47132. depth++;
  47133. }
  47134. if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
  47135. inactive = true;
  47136. }
  47137. parent = parent.$parent;
  47138. }
  47139. data.routerViewDepth = depth;
  47140. // render previous view if the tree is inactive and kept-alive
  47141. if (inactive) {
  47142. var cachedData = cache[name];
  47143. var cachedComponent = cachedData && cachedData.component;
  47144. if (cachedComponent) {
  47145. // #2301
  47146. // pass props
  47147. if (cachedData.configProps) {
  47148. fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
  47149. }
  47150. return h(cachedComponent, data, children)
  47151. } else {
  47152. // render previous empty view
  47153. return h()
  47154. }
  47155. }
  47156. var matched = route.matched[depth];
  47157. var component = matched && matched.components[name];
  47158. // render empty node if no matched route or no config component
  47159. if (!matched || !component) {
  47160. cache[name] = null;
  47161. return h()
  47162. }
  47163. // cache component
  47164. cache[name] = { component: component };
  47165. // attach instance registration hook
  47166. // this will be called in the instance's injected lifecycle hooks
  47167. data.registerRouteInstance = function (vm, val) {
  47168. // val could be undefined for unregistration
  47169. var current = matched.instances[name];
  47170. if (
  47171. (val && current !== vm) ||
  47172. (!val && current === vm)
  47173. ) {
  47174. matched.instances[name] = val;
  47175. }
  47176. }
  47177. // also register instance in prepatch hook
  47178. // in case the same component instance is reused across different routes
  47179. ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
  47180. matched.instances[name] = vnode.componentInstance;
  47181. };
  47182. // register instance in init hook
  47183. // in case kept-alive component be actived when routes changed
  47184. data.hook.init = function (vnode) {
  47185. if (vnode.data.keepAlive &&
  47186. vnode.componentInstance &&
  47187. vnode.componentInstance !== matched.instances[name]
  47188. ) {
  47189. matched.instances[name] = vnode.componentInstance;
  47190. }
  47191. };
  47192. var configProps = matched.props && matched.props[name];
  47193. // save route and configProps in cachce
  47194. if (configProps) {
  47195. extend(cache[name], {
  47196. route: route,
  47197. configProps: configProps
  47198. });
  47199. fillPropsinData(component, data, route, configProps);
  47200. }
  47201. return h(component, data, children)
  47202. }
  47203. };
  47204. function fillPropsinData (component, data, route, configProps) {
  47205. // resolve props
  47206. var propsToPass = data.props = resolveProps(route, configProps);
  47207. if (propsToPass) {
  47208. // clone to prevent mutation
  47209. propsToPass = data.props = extend({}, propsToPass);
  47210. // pass non-declared props as attrs
  47211. var attrs = data.attrs = data.attrs || {};
  47212. for (var key in propsToPass) {
  47213. if (!component.props || !(key in component.props)) {
  47214. attrs[key] = propsToPass[key];
  47215. delete propsToPass[key];
  47216. }
  47217. }
  47218. }
  47219. }
  47220. function resolveProps (route, config) {
  47221. switch (typeof config) {
  47222. case 'undefined':
  47223. return
  47224. case 'object':
  47225. return config
  47226. case 'function':
  47227. return config(route)
  47228. case 'boolean':
  47229. return config ? route.params : undefined
  47230. default:
  47231. if (true) {
  47232. warn(
  47233. false,
  47234. "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
  47235. "expecting an object, function or boolean."
  47236. );
  47237. }
  47238. }
  47239. }
  47240. /* */
  47241. var encodeReserveRE = /[!'()*]/g;
  47242. var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
  47243. var commaRE = /%2C/g;
  47244. // fixed encodeURIComponent which is more conformant to RFC3986:
  47245. // - escapes [!'()*]
  47246. // - preserve commas
  47247. var encode = function (str) { return encodeURIComponent(str)
  47248. .replace(encodeReserveRE, encodeReserveReplacer)
  47249. .replace(commaRE, ','); };
  47250. var decode = decodeURIComponent;
  47251. function resolveQuery (
  47252. query,
  47253. extraQuery,
  47254. _parseQuery
  47255. ) {
  47256. if ( extraQuery === void 0 ) extraQuery = {};
  47257. var parse = _parseQuery || parseQuery;
  47258. var parsedQuery;
  47259. try {
  47260. parsedQuery = parse(query || '');
  47261. } catch (e) {
  47262. true && warn(false, e.message);
  47263. parsedQuery = {};
  47264. }
  47265. for (var key in extraQuery) {
  47266. parsedQuery[key] = extraQuery[key];
  47267. }
  47268. return parsedQuery
  47269. }
  47270. function parseQuery (query) {
  47271. var res = {};
  47272. query = query.trim().replace(/^(\?|#|&)/, '');
  47273. if (!query) {
  47274. return res
  47275. }
  47276. query.split('&').forEach(function (param) {
  47277. var parts = param.replace(/\+/g, ' ').split('=');
  47278. var key = decode(parts.shift());
  47279. var val = parts.length > 0
  47280. ? decode(parts.join('='))
  47281. : null;
  47282. if (res[key] === undefined) {
  47283. res[key] = val;
  47284. } else if (Array.isArray(res[key])) {
  47285. res[key].push(val);
  47286. } else {
  47287. res[key] = [res[key], val];
  47288. }
  47289. });
  47290. return res
  47291. }
  47292. function stringifyQuery (obj) {
  47293. var res = obj ? Object.keys(obj).map(function (key) {
  47294. var val = obj[key];
  47295. if (val === undefined) {
  47296. return ''
  47297. }
  47298. if (val === null) {
  47299. return encode(key)
  47300. }
  47301. if (Array.isArray(val)) {
  47302. var result = [];
  47303. val.forEach(function (val2) {
  47304. if (val2 === undefined) {
  47305. return
  47306. }
  47307. if (val2 === null) {
  47308. result.push(encode(key));
  47309. } else {
  47310. result.push(encode(key) + '=' + encode(val2));
  47311. }
  47312. });
  47313. return result.join('&')
  47314. }
  47315. return encode(key) + '=' + encode(val)
  47316. }).filter(function (x) { return x.length > 0; }).join('&') : null;
  47317. return res ? ("?" + res) : ''
  47318. }
  47319. /* */
  47320. var trailingSlashRE = /\/?$/;
  47321. function createRoute (
  47322. record,
  47323. location,
  47324. redirectedFrom,
  47325. router
  47326. ) {
  47327. var stringifyQuery = router && router.options.stringifyQuery;
  47328. var query = location.query || {};
  47329. try {
  47330. query = clone(query);
  47331. } catch (e) {}
  47332. var route = {
  47333. name: location.name || (record && record.name),
  47334. meta: (record && record.meta) || {},
  47335. path: location.path || '/',
  47336. hash: location.hash || '',
  47337. query: query,
  47338. params: location.params || {},
  47339. fullPath: getFullPath(location, stringifyQuery),
  47340. matched: record ? formatMatch(record) : []
  47341. };
  47342. if (redirectedFrom) {
  47343. route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery);
  47344. }
  47345. return Object.freeze(route)
  47346. }
  47347. function clone (value) {
  47348. if (Array.isArray(value)) {
  47349. return value.map(clone)
  47350. } else if (value && typeof value === 'object') {
  47351. var res = {};
  47352. for (var key in value) {
  47353. res[key] = clone(value[key]);
  47354. }
  47355. return res
  47356. } else {
  47357. return value
  47358. }
  47359. }
  47360. // the starting route that represents the initial state
  47361. var START = createRoute(null, {
  47362. path: '/'
  47363. });
  47364. function formatMatch (record) {
  47365. var res = [];
  47366. while (record) {
  47367. res.unshift(record);
  47368. record = record.parent;
  47369. }
  47370. return res
  47371. }
  47372. function getFullPath (
  47373. ref,
  47374. _stringifyQuery
  47375. ) {
  47376. var path = ref.path;
  47377. var query = ref.query; if ( query === void 0 ) query = {};
  47378. var hash = ref.hash; if ( hash === void 0 ) hash = '';
  47379. var stringify = _stringifyQuery || stringifyQuery;
  47380. return (path || '/') + stringify(query) + hash
  47381. }
  47382. function isSameRoute (a, b) {
  47383. if (b === START) {
  47384. return a === b
  47385. } else if (!b) {
  47386. return false
  47387. } else if (a.path && b.path) {
  47388. return (
  47389. a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
  47390. a.hash === b.hash &&
  47391. isObjectEqual(a.query, b.query)
  47392. )
  47393. } else if (a.name && b.name) {
  47394. return (
  47395. a.name === b.name &&
  47396. a.hash === b.hash &&
  47397. isObjectEqual(a.query, b.query) &&
  47398. isObjectEqual(a.params, b.params)
  47399. )
  47400. } else {
  47401. return false
  47402. }
  47403. }
  47404. function isObjectEqual (a, b) {
  47405. if ( a === void 0 ) a = {};
  47406. if ( b === void 0 ) b = {};
  47407. // handle null value #1566
  47408. if (!a || !b) { return a === b }
  47409. var aKeys = Object.keys(a);
  47410. var bKeys = Object.keys(b);
  47411. if (aKeys.length !== bKeys.length) {
  47412. return false
  47413. }
  47414. return aKeys.every(function (key) {
  47415. var aVal = a[key];
  47416. var bVal = b[key];
  47417. // check nested equality
  47418. if (typeof aVal === 'object' && typeof bVal === 'object') {
  47419. return isObjectEqual(aVal, bVal)
  47420. }
  47421. return String(aVal) === String(bVal)
  47422. })
  47423. }
  47424. function isIncludedRoute (current, target) {
  47425. return (
  47426. current.path.replace(trailingSlashRE, '/').indexOf(
  47427. target.path.replace(trailingSlashRE, '/')
  47428. ) === 0 &&
  47429. (!target.hash || current.hash === target.hash) &&
  47430. queryIncludes(current.query, target.query)
  47431. )
  47432. }
  47433. function queryIncludes (current, target) {
  47434. for (var key in target) {
  47435. if (!(key in current)) {
  47436. return false
  47437. }
  47438. }
  47439. return true
  47440. }
  47441. /* */
  47442. function resolvePath (
  47443. relative,
  47444. base,
  47445. append
  47446. ) {
  47447. var firstChar = relative.charAt(0);
  47448. if (firstChar === '/') {
  47449. return relative
  47450. }
  47451. if (firstChar === '?' || firstChar === '#') {
  47452. return base + relative
  47453. }
  47454. var stack = base.split('/');
  47455. // remove trailing segment if:
  47456. // - not appending
  47457. // - appending to trailing slash (last segment is empty)
  47458. if (!append || !stack[stack.length - 1]) {
  47459. stack.pop();
  47460. }
  47461. // resolve relative path
  47462. var segments = relative.replace(/^\//, '').split('/');
  47463. for (var i = 0; i < segments.length; i++) {
  47464. var segment = segments[i];
  47465. if (segment === '..') {
  47466. stack.pop();
  47467. } else if (segment !== '.') {
  47468. stack.push(segment);
  47469. }
  47470. }
  47471. // ensure leading slash
  47472. if (stack[0] !== '') {
  47473. stack.unshift('');
  47474. }
  47475. return stack.join('/')
  47476. }
  47477. function parsePath (path) {
  47478. var hash = '';
  47479. var query = '';
  47480. var hashIndex = path.indexOf('#');
  47481. if (hashIndex >= 0) {
  47482. hash = path.slice(hashIndex);
  47483. path = path.slice(0, hashIndex);
  47484. }
  47485. var queryIndex = path.indexOf('?');
  47486. if (queryIndex >= 0) {
  47487. query = path.slice(queryIndex + 1);
  47488. path = path.slice(0, queryIndex);
  47489. }
  47490. return {
  47491. path: path,
  47492. query: query,
  47493. hash: hash
  47494. }
  47495. }
  47496. function cleanPath (path) {
  47497. return path.replace(/\/\//g, '/')
  47498. }
  47499. var isarray = Array.isArray || function (arr) {
  47500. return Object.prototype.toString.call(arr) == '[object Array]';
  47501. };
  47502. /**
  47503. * Expose `pathToRegexp`.
  47504. */
  47505. var pathToRegexp_1 = pathToRegexp;
  47506. var parse_1 = parse;
  47507. var compile_1 = compile;
  47508. var tokensToFunction_1 = tokensToFunction;
  47509. var tokensToRegExp_1 = tokensToRegExp;
  47510. /**
  47511. * The main path matching regexp utility.
  47512. *
  47513. * @type {RegExp}
  47514. */
  47515. var PATH_REGEXP = new RegExp([
  47516. // Match escaped characters that would otherwise appear in future matches.
  47517. // This allows the user to escape special characters that won't transform.
  47518. '(\\\\.)',
  47519. // Match Express-style parameters and un-named parameters with a prefix
  47520. // and optional suffixes. Matches appear as:
  47521. //
  47522. // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
  47523. // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
  47524. // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
  47525. '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
  47526. ].join('|'), 'g');
  47527. /**
  47528. * Parse a string for the raw tokens.
  47529. *
  47530. * @param {string} str
  47531. * @param {Object=} options
  47532. * @return {!Array}
  47533. */
  47534. function parse (str, options) {
  47535. var tokens = [];
  47536. var key = 0;
  47537. var index = 0;
  47538. var path = '';
  47539. var defaultDelimiter = options && options.delimiter || '/';
  47540. var res;
  47541. while ((res = PATH_REGEXP.exec(str)) != null) {
  47542. var m = res[0];
  47543. var escaped = res[1];
  47544. var offset = res.index;
  47545. path += str.slice(index, offset);
  47546. index = offset + m.length;
  47547. // Ignore already escaped sequences.
  47548. if (escaped) {
  47549. path += escaped[1];
  47550. continue
  47551. }
  47552. var next = str[index];
  47553. var prefix = res[2];
  47554. var name = res[3];
  47555. var capture = res[4];
  47556. var group = res[5];
  47557. var modifier = res[6];
  47558. var asterisk = res[7];
  47559. // Push the current path onto the tokens.
  47560. if (path) {
  47561. tokens.push(path);
  47562. path = '';
  47563. }
  47564. var partial = prefix != null && next != null && next !== prefix;
  47565. var repeat = modifier === '+' || modifier === '*';
  47566. var optional = modifier === '?' || modifier === '*';
  47567. var delimiter = res[2] || defaultDelimiter;
  47568. var pattern = capture || group;
  47569. tokens.push({
  47570. name: name || key++,
  47571. prefix: prefix || '',
  47572. delimiter: delimiter,
  47573. optional: optional,
  47574. repeat: repeat,
  47575. partial: partial,
  47576. asterisk: !!asterisk,
  47577. pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
  47578. });
  47579. }
  47580. // Match any characters still remaining.
  47581. if (index < str.length) {
  47582. path += str.substr(index);
  47583. }
  47584. // If the path exists, push it onto the end.
  47585. if (path) {
  47586. tokens.push(path);
  47587. }
  47588. return tokens
  47589. }
  47590. /**
  47591. * Compile a string to a template function for the path.
  47592. *
  47593. * @param {string} str
  47594. * @param {Object=} options
  47595. * @return {!function(Object=, Object=)}
  47596. */
  47597. function compile (str, options) {
  47598. return tokensToFunction(parse(str, options))
  47599. }
  47600. /**
  47601. * Prettier encoding of URI path segments.
  47602. *
  47603. * @param {string}
  47604. * @return {string}
  47605. */
  47606. function encodeURIComponentPretty (str) {
  47607. return encodeURI(str).replace(/[\/?#]/g, function (c) {
  47608. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  47609. })
  47610. }
  47611. /**
  47612. * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
  47613. *
  47614. * @param {string}
  47615. * @return {string}
  47616. */
  47617. function encodeAsterisk (str) {
  47618. return encodeURI(str).replace(/[?#]/g, function (c) {
  47619. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  47620. })
  47621. }
  47622. /**
  47623. * Expose a method for transforming tokens into the path function.
  47624. */
  47625. function tokensToFunction (tokens) {
  47626. // Compile all the tokens into regexps.
  47627. var matches = new Array(tokens.length);
  47628. // Compile all the patterns before compilation.
  47629. for (var i = 0; i < tokens.length; i++) {
  47630. if (typeof tokens[i] === 'object') {
  47631. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
  47632. }
  47633. }
  47634. return function (obj, opts) {
  47635. var path = '';
  47636. var data = obj || {};
  47637. var options = opts || {};
  47638. var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
  47639. for (var i = 0; i < tokens.length; i++) {
  47640. var token = tokens[i];
  47641. if (typeof token === 'string') {
  47642. path += token;
  47643. continue
  47644. }
  47645. var value = data[token.name];
  47646. var segment;
  47647. if (value == null) {
  47648. if (token.optional) {
  47649. // Prepend partial segment prefixes.
  47650. if (token.partial) {
  47651. path += token.prefix;
  47652. }
  47653. continue
  47654. } else {
  47655. throw new TypeError('Expected "' + token.name + '" to be defined')
  47656. }
  47657. }
  47658. if (isarray(value)) {
  47659. if (!token.repeat) {
  47660. throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
  47661. }
  47662. if (value.length === 0) {
  47663. if (token.optional) {
  47664. continue
  47665. } else {
  47666. throw new TypeError('Expected "' + token.name + '" to not be empty')
  47667. }
  47668. }
  47669. for (var j = 0; j < value.length; j++) {
  47670. segment = encode(value[j]);
  47671. if (!matches[i].test(segment)) {
  47672. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
  47673. }
  47674. path += (j === 0 ? token.prefix : token.delimiter) + segment;
  47675. }
  47676. continue
  47677. }
  47678. segment = token.asterisk ? encodeAsterisk(value) : encode(value);
  47679. if (!matches[i].test(segment)) {
  47680. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
  47681. }
  47682. path += token.prefix + segment;
  47683. }
  47684. return path
  47685. }
  47686. }
  47687. /**
  47688. * Escape a regular expression string.
  47689. *
  47690. * @param {string} str
  47691. * @return {string}
  47692. */
  47693. function escapeString (str) {
  47694. return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
  47695. }
  47696. /**
  47697. * Escape the capturing group by escaping special characters and meaning.
  47698. *
  47699. * @param {string} group
  47700. * @return {string}
  47701. */
  47702. function escapeGroup (group) {
  47703. return group.replace(/([=!:$\/()])/g, '\\$1')
  47704. }
  47705. /**
  47706. * Attach the keys as a property of the regexp.
  47707. *
  47708. * @param {!RegExp} re
  47709. * @param {Array} keys
  47710. * @return {!RegExp}
  47711. */
  47712. function attachKeys (re, keys) {
  47713. re.keys = keys;
  47714. return re
  47715. }
  47716. /**
  47717. * Get the flags for a regexp from the options.
  47718. *
  47719. * @param {Object} options
  47720. * @return {string}
  47721. */
  47722. function flags (options) {
  47723. return options.sensitive ? '' : 'i'
  47724. }
  47725. /**
  47726. * Pull out keys from a regexp.
  47727. *
  47728. * @param {!RegExp} path
  47729. * @param {!Array} keys
  47730. * @return {!RegExp}
  47731. */
  47732. function regexpToRegexp (path, keys) {
  47733. // Use a negative lookahead to match only capturing groups.
  47734. var groups = path.source.match(/\((?!\?)/g);
  47735. if (groups) {
  47736. for (var i = 0; i < groups.length; i++) {
  47737. keys.push({
  47738. name: i,
  47739. prefix: null,
  47740. delimiter: null,
  47741. optional: false,
  47742. repeat: false,
  47743. partial: false,
  47744. asterisk: false,
  47745. pattern: null
  47746. });
  47747. }
  47748. }
  47749. return attachKeys(path, keys)
  47750. }
  47751. /**
  47752. * Transform an array into a regexp.
  47753. *
  47754. * @param {!Array} path
  47755. * @param {Array} keys
  47756. * @param {!Object} options
  47757. * @return {!RegExp}
  47758. */
  47759. function arrayToRegexp (path, keys, options) {
  47760. var parts = [];
  47761. for (var i = 0; i < path.length; i++) {
  47762. parts.push(pathToRegexp(path[i], keys, options).source);
  47763. }
  47764. var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
  47765. return attachKeys(regexp, keys)
  47766. }
  47767. /**
  47768. * Create a path regexp from string input.
  47769. *
  47770. * @param {string} path
  47771. * @param {!Array} keys
  47772. * @param {!Object} options
  47773. * @return {!RegExp}
  47774. */
  47775. function stringToRegexp (path, keys, options) {
  47776. return tokensToRegExp(parse(path, options), keys, options)
  47777. }
  47778. /**
  47779. * Expose a function for taking tokens and returning a RegExp.
  47780. *
  47781. * @param {!Array} tokens
  47782. * @param {(Array|Object)=} keys
  47783. * @param {Object=} options
  47784. * @return {!RegExp}
  47785. */
  47786. function tokensToRegExp (tokens, keys, options) {
  47787. if (!isarray(keys)) {
  47788. options = /** @type {!Object} */ (keys || options);
  47789. keys = [];
  47790. }
  47791. options = options || {};
  47792. var strict = options.strict;
  47793. var end = options.end !== false;
  47794. var route = '';
  47795. // Iterate over the tokens and create our regexp string.
  47796. for (var i = 0; i < tokens.length; i++) {
  47797. var token = tokens[i];
  47798. if (typeof token === 'string') {
  47799. route += escapeString(token);
  47800. } else {
  47801. var prefix = escapeString(token.prefix);
  47802. var capture = '(?:' + token.pattern + ')';
  47803. keys.push(token);
  47804. if (token.repeat) {
  47805. capture += '(?:' + prefix + capture + ')*';
  47806. }
  47807. if (token.optional) {
  47808. if (!token.partial) {
  47809. capture = '(?:' + prefix + '(' + capture + '))?';
  47810. } else {
  47811. capture = prefix + '(' + capture + ')?';
  47812. }
  47813. } else {
  47814. capture = prefix + '(' + capture + ')';
  47815. }
  47816. route += capture;
  47817. }
  47818. }
  47819. var delimiter = escapeString(options.delimiter || '/');
  47820. var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
  47821. // In non-strict mode we allow a slash at the end of match. If the path to
  47822. // match already ends with a slash, we remove it for consistency. The slash
  47823. // is valid at the end of a path match, not in the middle. This is important
  47824. // in non-ending mode, where "/test/" shouldn't match "/test//route".
  47825. if (!strict) {
  47826. route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
  47827. }
  47828. if (end) {
  47829. route += '$';
  47830. } else {
  47831. // In non-ending mode, we need the capturing groups to match as much as
  47832. // possible by using a positive lookahead to the end or next path segment.
  47833. route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
  47834. }
  47835. return attachKeys(new RegExp('^' + route, flags(options)), keys)
  47836. }
  47837. /**
  47838. * Normalize the given path string, returning a regular expression.
  47839. *
  47840. * An empty array can be passed in for the keys, which will hold the
  47841. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  47842. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  47843. *
  47844. * @param {(string|RegExp|Array)} path
  47845. * @param {(Array|Object)=} keys
  47846. * @param {Object=} options
  47847. * @return {!RegExp}
  47848. */
  47849. function pathToRegexp (path, keys, options) {
  47850. if (!isarray(keys)) {
  47851. options = /** @type {!Object} */ (keys || options);
  47852. keys = [];
  47853. }
  47854. options = options || {};
  47855. if (path instanceof RegExp) {
  47856. return regexpToRegexp(path, /** @type {!Array} */ (keys))
  47857. }
  47858. if (isarray(path)) {
  47859. return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
  47860. }
  47861. return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
  47862. }
  47863. pathToRegexp_1.parse = parse_1;
  47864. pathToRegexp_1.compile = compile_1;
  47865. pathToRegexp_1.tokensToFunction = tokensToFunction_1;
  47866. pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
  47867. /* */
  47868. // $flow-disable-line
  47869. var regexpCompileCache = Object.create(null);
  47870. function fillParams (
  47871. path,
  47872. params,
  47873. routeMsg
  47874. ) {
  47875. params = params || {};
  47876. try {
  47877. var filler =
  47878. regexpCompileCache[path] ||
  47879. (regexpCompileCache[path] = pathToRegexp_1.compile(path));
  47880. // Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }}
  47881. // and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string
  47882. if (typeof params.pathMatch === 'string') { params[0] = params.pathMatch; }
  47883. return filler(params, { pretty: true })
  47884. } catch (e) {
  47885. if (true) {
  47886. // Fix #3072 no warn if `pathMatch` is string
  47887. warn(typeof params.pathMatch === 'string', ("missing param for " + routeMsg + ": " + (e.message)));
  47888. }
  47889. return ''
  47890. } finally {
  47891. // delete the 0 if it was added
  47892. delete params[0];
  47893. }
  47894. }
  47895. /* */
  47896. function normalizeLocation (
  47897. raw,
  47898. current,
  47899. append,
  47900. router
  47901. ) {
  47902. var next = typeof raw === 'string' ? { path: raw } : raw;
  47903. // named target
  47904. if (next._normalized) {
  47905. return next
  47906. } else if (next.name) {
  47907. next = extend({}, raw);
  47908. var params = next.params;
  47909. if (params && typeof params === 'object') {
  47910. next.params = extend({}, params);
  47911. }
  47912. return next
  47913. }
  47914. // relative params
  47915. if (!next.path && next.params && current) {
  47916. next = extend({}, next);
  47917. next._normalized = true;
  47918. var params$1 = extend(extend({}, current.params), next.params);
  47919. if (current.name) {
  47920. next.name = current.name;
  47921. next.params = params$1;
  47922. } else if (current.matched.length) {
  47923. var rawPath = current.matched[current.matched.length - 1].path;
  47924. next.path = fillParams(rawPath, params$1, ("path " + (current.path)));
  47925. } else if (true) {
  47926. warn(false, "relative params navigation requires a current route.");
  47927. }
  47928. return next
  47929. }
  47930. var parsedPath = parsePath(next.path || '');
  47931. var basePath = (current && current.path) || '/';
  47932. var path = parsedPath.path
  47933. ? resolvePath(parsedPath.path, basePath, append || next.append)
  47934. : basePath;
  47935. var query = resolveQuery(
  47936. parsedPath.query,
  47937. next.query,
  47938. router && router.options.parseQuery
  47939. );
  47940. var hash = next.hash || parsedPath.hash;
  47941. if (hash && hash.charAt(0) !== '#') {
  47942. hash = "#" + hash;
  47943. }
  47944. return {
  47945. _normalized: true,
  47946. path: path,
  47947. query: query,
  47948. hash: hash
  47949. }
  47950. }
  47951. /* */
  47952. // work around weird flow bug
  47953. var toTypes = [String, Object];
  47954. var eventTypes = [String, Array];
  47955. var noop = function () {};
  47956. var Link = {
  47957. name: 'RouterLink',
  47958. props: {
  47959. to: {
  47960. type: toTypes,
  47961. required: true
  47962. },
  47963. tag: {
  47964. type: String,
  47965. default: 'a'
  47966. },
  47967. exact: Boolean,
  47968. append: Boolean,
  47969. replace: Boolean,
  47970. activeClass: String,
  47971. exactActiveClass: String,
  47972. event: {
  47973. type: eventTypes,
  47974. default: 'click'
  47975. }
  47976. },
  47977. render: function render (h) {
  47978. var this$1 = this;
  47979. var router = this.$router;
  47980. var current = this.$route;
  47981. var ref = router.resolve(
  47982. this.to,
  47983. current,
  47984. this.append
  47985. );
  47986. var location = ref.location;
  47987. var route = ref.route;
  47988. var href = ref.href;
  47989. var classes = {};
  47990. var globalActiveClass = router.options.linkActiveClass;
  47991. var globalExactActiveClass = router.options.linkExactActiveClass;
  47992. // Support global empty active class
  47993. var activeClassFallback =
  47994. globalActiveClass == null ? 'router-link-active' : globalActiveClass;
  47995. var exactActiveClassFallback =
  47996. globalExactActiveClass == null
  47997. ? 'router-link-exact-active'
  47998. : globalExactActiveClass;
  47999. var activeClass =
  48000. this.activeClass == null ? activeClassFallback : this.activeClass;
  48001. var exactActiveClass =
  48002. this.exactActiveClass == null
  48003. ? exactActiveClassFallback
  48004. : this.exactActiveClass;
  48005. var compareTarget = route.redirectedFrom
  48006. ? createRoute(null, normalizeLocation(route.redirectedFrom), null, router)
  48007. : route;
  48008. classes[exactActiveClass] = isSameRoute(current, compareTarget);
  48009. classes[activeClass] = this.exact
  48010. ? classes[exactActiveClass]
  48011. : isIncludedRoute(current, compareTarget);
  48012. var handler = function (e) {
  48013. if (guardEvent(e)) {
  48014. if (this$1.replace) {
  48015. router.replace(location, noop);
  48016. } else {
  48017. router.push(location, noop);
  48018. }
  48019. }
  48020. };
  48021. var on = { click: guardEvent };
  48022. if (Array.isArray(this.event)) {
  48023. this.event.forEach(function (e) {
  48024. on[e] = handler;
  48025. });
  48026. } else {
  48027. on[this.event] = handler;
  48028. }
  48029. var data = { class: classes };
  48030. var scopedSlot =
  48031. !this.$scopedSlots.$hasNormal &&
  48032. this.$scopedSlots.default &&
  48033. this.$scopedSlots.default({
  48034. href: href,
  48035. route: route,
  48036. navigate: handler,
  48037. isActive: classes[activeClass],
  48038. isExactActive: classes[exactActiveClass]
  48039. });
  48040. if (scopedSlot) {
  48041. if (scopedSlot.length === 1) {
  48042. return scopedSlot[0]
  48043. } else if (scopedSlot.length > 1 || !scopedSlot.length) {
  48044. if (true) {
  48045. warn(
  48046. false,
  48047. ("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.")
  48048. );
  48049. }
  48050. return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot)
  48051. }
  48052. }
  48053. if (this.tag === 'a') {
  48054. data.on = on;
  48055. data.attrs = { href: href };
  48056. } else {
  48057. // find the first <a> child and apply listener and href
  48058. var a = findAnchor(this.$slots.default);
  48059. if (a) {
  48060. // in case the <a> is a static node
  48061. a.isStatic = false;
  48062. var aData = (a.data = extend({}, a.data));
  48063. aData.on = aData.on || {};
  48064. // transform existing events in both objects into arrays so we can push later
  48065. for (var event in aData.on) {
  48066. var handler$1 = aData.on[event];
  48067. if (event in on) {
  48068. aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1];
  48069. }
  48070. }
  48071. // append new listeners for router-link
  48072. for (var event$1 in on) {
  48073. if (event$1 in aData.on) {
  48074. // on[event] is always a function
  48075. aData.on[event$1].push(on[event$1]);
  48076. } else {
  48077. aData.on[event$1] = handler;
  48078. }
  48079. }
  48080. var aAttrs = (a.data.attrs = extend({}, a.data.attrs));
  48081. aAttrs.href = href;
  48082. } else {
  48083. // doesn't have <a> child, apply listener to self
  48084. data.on = on;
  48085. }
  48086. }
  48087. return h(this.tag, data, this.$slots.default)
  48088. }
  48089. };
  48090. function guardEvent (e) {
  48091. // don't redirect with control keys
  48092. if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
  48093. // don't redirect when preventDefault called
  48094. if (e.defaultPrevented) { return }
  48095. // don't redirect on right click
  48096. if (e.button !== undefined && e.button !== 0) { return }
  48097. // don't redirect if `target="_blank"`
  48098. if (e.currentTarget && e.currentTarget.getAttribute) {
  48099. var target = e.currentTarget.getAttribute('target');
  48100. if (/\b_blank\b/i.test(target)) { return }
  48101. }
  48102. // this may be a Weex event which doesn't have this method
  48103. if (e.preventDefault) {
  48104. e.preventDefault();
  48105. }
  48106. return true
  48107. }
  48108. function findAnchor (children) {
  48109. if (children) {
  48110. var child;
  48111. for (var i = 0; i < children.length; i++) {
  48112. child = children[i];
  48113. if (child.tag === 'a') {
  48114. return child
  48115. }
  48116. if (child.children && (child = findAnchor(child.children))) {
  48117. return child
  48118. }
  48119. }
  48120. }
  48121. }
  48122. var _Vue;
  48123. function install (Vue) {
  48124. if (install.installed && _Vue === Vue) { return }
  48125. install.installed = true;
  48126. _Vue = Vue;
  48127. var isDef = function (v) { return v !== undefined; };
  48128. var registerInstance = function (vm, callVal) {
  48129. var i = vm.$options._parentVnode;
  48130. if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
  48131. i(vm, callVal);
  48132. }
  48133. };
  48134. Vue.mixin({
  48135. beforeCreate: function beforeCreate () {
  48136. if (isDef(this.$options.router)) {
  48137. this._routerRoot = this;
  48138. this._router = this.$options.router;
  48139. this._router.init(this);
  48140. Vue.util.defineReactive(this, '_route', this._router.history.current);
  48141. } else {
  48142. this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
  48143. }
  48144. registerInstance(this, this);
  48145. },
  48146. destroyed: function destroyed () {
  48147. registerInstance(this);
  48148. }
  48149. });
  48150. Object.defineProperty(Vue.prototype, '$router', {
  48151. get: function get () { return this._routerRoot._router }
  48152. });
  48153. Object.defineProperty(Vue.prototype, '$route', {
  48154. get: function get () { return this._routerRoot._route }
  48155. });
  48156. Vue.component('RouterView', View);
  48157. Vue.component('RouterLink', Link);
  48158. var strats = Vue.config.optionMergeStrategies;
  48159. // use the same hook merging strategy for route hooks
  48160. strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
  48161. }
  48162. /* */
  48163. var inBrowser = typeof window !== 'undefined';
  48164. /* */
  48165. function createRouteMap (
  48166. routes,
  48167. oldPathList,
  48168. oldPathMap,
  48169. oldNameMap
  48170. ) {
  48171. // the path list is used to control path matching priority
  48172. var pathList = oldPathList || [];
  48173. // $flow-disable-line
  48174. var pathMap = oldPathMap || Object.create(null);
  48175. // $flow-disable-line
  48176. var nameMap = oldNameMap || Object.create(null);
  48177. routes.forEach(function (route) {
  48178. addRouteRecord(pathList, pathMap, nameMap, route);
  48179. });
  48180. // ensure wildcard routes are always at the end
  48181. for (var i = 0, l = pathList.length; i < l; i++) {
  48182. if (pathList[i] === '*') {
  48183. pathList.push(pathList.splice(i, 1)[0]);
  48184. l--;
  48185. i--;
  48186. }
  48187. }
  48188. if (true) {
  48189. // warn if routes do not include leading slashes
  48190. var found = pathList
  48191. // check for missing leading slash
  48192. .filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; });
  48193. if (found.length > 0) {
  48194. var pathNames = found.map(function (path) { return ("- " + path); }).join('\n');
  48195. warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames));
  48196. }
  48197. }
  48198. return {
  48199. pathList: pathList,
  48200. pathMap: pathMap,
  48201. nameMap: nameMap
  48202. }
  48203. }
  48204. function addRouteRecord (
  48205. pathList,
  48206. pathMap,
  48207. nameMap,
  48208. route,
  48209. parent,
  48210. matchAs
  48211. ) {
  48212. var path = route.path;
  48213. var name = route.name;
  48214. if (true) {
  48215. assert(path != null, "\"path\" is required in a route configuration.");
  48216. assert(
  48217. typeof route.component !== 'string',
  48218. "route config \"component\" for path: " + (String(
  48219. path || name
  48220. )) + " cannot be a " + "string id. Use an actual component instead."
  48221. );
  48222. }
  48223. var pathToRegexpOptions =
  48224. route.pathToRegexpOptions || {};
  48225. var normalizedPath = normalizePath(path, parent, pathToRegexpOptions.strict);
  48226. if (typeof route.caseSensitive === 'boolean') {
  48227. pathToRegexpOptions.sensitive = route.caseSensitive;
  48228. }
  48229. var record = {
  48230. path: normalizedPath,
  48231. regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
  48232. components: route.components || { default: route.component },
  48233. instances: {},
  48234. name: name,
  48235. parent: parent,
  48236. matchAs: matchAs,
  48237. redirect: route.redirect,
  48238. beforeEnter: route.beforeEnter,
  48239. meta: route.meta || {},
  48240. props:
  48241. route.props == null
  48242. ? {}
  48243. : route.components
  48244. ? route.props
  48245. : { default: route.props }
  48246. };
  48247. if (route.children) {
  48248. // Warn if route is named, does not redirect and has a default child route.
  48249. // If users navigate to this route by name, the default child will
  48250. // not be rendered (GH Issue #629)
  48251. if (true) {
  48252. if (
  48253. route.name &&
  48254. !route.redirect &&
  48255. route.children.some(function (child) { return /^\/?$/.test(child.path); })
  48256. ) {
  48257. warn(
  48258. false,
  48259. "Named Route '" + (route.name) + "' has a default child route. " +
  48260. "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
  48261. "the default child route will not be rendered. Remove the name from " +
  48262. "this route and use the name of the default child route for named " +
  48263. "links instead."
  48264. );
  48265. }
  48266. }
  48267. route.children.forEach(function (child) {
  48268. var childMatchAs = matchAs
  48269. ? cleanPath((matchAs + "/" + (child.path)))
  48270. : undefined;
  48271. addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
  48272. });
  48273. }
  48274. if (!pathMap[record.path]) {
  48275. pathList.push(record.path);
  48276. pathMap[record.path] = record;
  48277. }
  48278. if (route.alias !== undefined) {
  48279. var aliases = Array.isArray(route.alias) ? route.alias : [route.alias];
  48280. for (var i = 0; i < aliases.length; ++i) {
  48281. var alias = aliases[i];
  48282. if ( true && alias === path) {
  48283. warn(
  48284. false,
  48285. ("Found an alias with the same value as the path: \"" + path + "\". You have to remove that alias. It will be ignored in development.")
  48286. );
  48287. // skip in dev to make it work
  48288. continue
  48289. }
  48290. var aliasRoute = {
  48291. path: alias,
  48292. children: route.children
  48293. };
  48294. addRouteRecord(
  48295. pathList,
  48296. pathMap,
  48297. nameMap,
  48298. aliasRoute,
  48299. parent,
  48300. record.path || '/' // matchAs
  48301. );
  48302. }
  48303. }
  48304. if (name) {
  48305. if (!nameMap[name]) {
  48306. nameMap[name] = record;
  48307. } else if ( true && !matchAs) {
  48308. warn(
  48309. false,
  48310. "Duplicate named routes definition: " +
  48311. "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
  48312. );
  48313. }
  48314. }
  48315. }
  48316. function compileRouteRegex (
  48317. path,
  48318. pathToRegexpOptions
  48319. ) {
  48320. var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
  48321. if (true) {
  48322. var keys = Object.create(null);
  48323. regex.keys.forEach(function (key) {
  48324. warn(
  48325. !keys[key.name],
  48326. ("Duplicate param keys in route with path: \"" + path + "\"")
  48327. );
  48328. keys[key.name] = true;
  48329. });
  48330. }
  48331. return regex
  48332. }
  48333. function normalizePath (
  48334. path,
  48335. parent,
  48336. strict
  48337. ) {
  48338. if (!strict) { path = path.replace(/\/$/, ''); }
  48339. if (path[0] === '/') { return path }
  48340. if (parent == null) { return path }
  48341. return cleanPath(((parent.path) + "/" + path))
  48342. }
  48343. /* */
  48344. function createMatcher (
  48345. routes,
  48346. router
  48347. ) {
  48348. var ref = createRouteMap(routes);
  48349. var pathList = ref.pathList;
  48350. var pathMap = ref.pathMap;
  48351. var nameMap = ref.nameMap;
  48352. function addRoutes (routes) {
  48353. createRouteMap(routes, pathList, pathMap, nameMap);
  48354. }
  48355. function match (
  48356. raw,
  48357. currentRoute,
  48358. redirectedFrom
  48359. ) {
  48360. var location = normalizeLocation(raw, currentRoute, false, router);
  48361. var name = location.name;
  48362. if (name) {
  48363. var record = nameMap[name];
  48364. if (true) {
  48365. warn(record, ("Route with name '" + name + "' does not exist"));
  48366. }
  48367. if (!record) { return _createRoute(null, location) }
  48368. var paramNames = record.regex.keys
  48369. .filter(function (key) { return !key.optional; })
  48370. .map(function (key) { return key.name; });
  48371. if (typeof location.params !== 'object') {
  48372. location.params = {};
  48373. }
  48374. if (currentRoute && typeof currentRoute.params === 'object') {
  48375. for (var key in currentRoute.params) {
  48376. if (!(key in location.params) && paramNames.indexOf(key) > -1) {
  48377. location.params[key] = currentRoute.params[key];
  48378. }
  48379. }
  48380. }
  48381. location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
  48382. return _createRoute(record, location, redirectedFrom)
  48383. } else if (location.path) {
  48384. location.params = {};
  48385. for (var i = 0; i < pathList.length; i++) {
  48386. var path = pathList[i];
  48387. var record$1 = pathMap[path];
  48388. if (matchRoute(record$1.regex, location.path, location.params)) {
  48389. return _createRoute(record$1, location, redirectedFrom)
  48390. }
  48391. }
  48392. }
  48393. // no match
  48394. return _createRoute(null, location)
  48395. }
  48396. function redirect (
  48397. record,
  48398. location
  48399. ) {
  48400. var originalRedirect = record.redirect;
  48401. var redirect = typeof originalRedirect === 'function'
  48402. ? originalRedirect(createRoute(record, location, null, router))
  48403. : originalRedirect;
  48404. if (typeof redirect === 'string') {
  48405. redirect = { path: redirect };
  48406. }
  48407. if (!redirect || typeof redirect !== 'object') {
  48408. if (true) {
  48409. warn(
  48410. false, ("invalid redirect option: " + (JSON.stringify(redirect)))
  48411. );
  48412. }
  48413. return _createRoute(null, location)
  48414. }
  48415. var re = redirect;
  48416. var name = re.name;
  48417. var path = re.path;
  48418. var query = location.query;
  48419. var hash = location.hash;
  48420. var params = location.params;
  48421. query = re.hasOwnProperty('query') ? re.query : query;
  48422. hash = re.hasOwnProperty('hash') ? re.hash : hash;
  48423. params = re.hasOwnProperty('params') ? re.params : params;
  48424. if (name) {
  48425. // resolved named direct
  48426. var targetRecord = nameMap[name];
  48427. if (true) {
  48428. assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
  48429. }
  48430. return match({
  48431. _normalized: true,
  48432. name: name,
  48433. query: query,
  48434. hash: hash,
  48435. params: params
  48436. }, undefined, location)
  48437. } else if (path) {
  48438. // 1. resolve relative redirect
  48439. var rawPath = resolveRecordPath(path, record);
  48440. // 2. resolve params
  48441. var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
  48442. // 3. rematch with existing query and hash
  48443. return match({
  48444. _normalized: true,
  48445. path: resolvedPath,
  48446. query: query,
  48447. hash: hash
  48448. }, undefined, location)
  48449. } else {
  48450. if (true) {
  48451. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
  48452. }
  48453. return _createRoute(null, location)
  48454. }
  48455. }
  48456. function alias (
  48457. record,
  48458. location,
  48459. matchAs
  48460. ) {
  48461. var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
  48462. var aliasedMatch = match({
  48463. _normalized: true,
  48464. path: aliasedPath
  48465. });
  48466. if (aliasedMatch) {
  48467. var matched = aliasedMatch.matched;
  48468. var aliasedRecord = matched[matched.length - 1];
  48469. location.params = aliasedMatch.params;
  48470. return _createRoute(aliasedRecord, location)
  48471. }
  48472. return _createRoute(null, location)
  48473. }
  48474. function _createRoute (
  48475. record,
  48476. location,
  48477. redirectedFrom
  48478. ) {
  48479. if (record && record.redirect) {
  48480. return redirect(record, redirectedFrom || location)
  48481. }
  48482. if (record && record.matchAs) {
  48483. return alias(record, location, record.matchAs)
  48484. }
  48485. return createRoute(record, location, redirectedFrom, router)
  48486. }
  48487. return {
  48488. match: match,
  48489. addRoutes: addRoutes
  48490. }
  48491. }
  48492. function matchRoute (
  48493. regex,
  48494. path,
  48495. params
  48496. ) {
  48497. var m = path.match(regex);
  48498. if (!m) {
  48499. return false
  48500. } else if (!params) {
  48501. return true
  48502. }
  48503. for (var i = 1, len = m.length; i < len; ++i) {
  48504. var key = regex.keys[i - 1];
  48505. var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
  48506. if (key) {
  48507. // Fix #1994: using * with props: true generates a param named 0
  48508. params[key.name || 'pathMatch'] = val;
  48509. }
  48510. }
  48511. return true
  48512. }
  48513. function resolveRecordPath (path, record) {
  48514. return resolvePath(path, record.parent ? record.parent.path : '/', true)
  48515. }
  48516. /* */
  48517. // use User Timing api (if present) for more accurate key precision
  48518. var Time =
  48519. inBrowser && window.performance && window.performance.now
  48520. ? window.performance
  48521. : Date;
  48522. function genStateKey () {
  48523. return Time.now().toFixed(3)
  48524. }
  48525. var _key = genStateKey();
  48526. function getStateKey () {
  48527. return _key
  48528. }
  48529. function setStateKey (key) {
  48530. return (_key = key)
  48531. }
  48532. /* */
  48533. var positionStore = Object.create(null);
  48534. function setupScroll () {
  48535. // Fix for #1585 for Firefox
  48536. // Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
  48537. // Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with
  48538. // window.location.protocol + '//' + window.location.host
  48539. // location.host contains the port and location.hostname doesn't
  48540. var protocolAndPath = window.location.protocol + '//' + window.location.host;
  48541. var absolutePath = window.location.href.replace(protocolAndPath, '');
  48542. // preserve existing history state as it could be overriden by the user
  48543. var stateCopy = extend({}, window.history.state);
  48544. stateCopy.key = getStateKey();
  48545. window.history.replaceState(stateCopy, '', absolutePath);
  48546. window.addEventListener('popstate', function (e) {
  48547. saveScrollPosition();
  48548. if (e.state && e.state.key) {
  48549. setStateKey(e.state.key);
  48550. }
  48551. });
  48552. }
  48553. function handleScroll (
  48554. router,
  48555. to,
  48556. from,
  48557. isPop
  48558. ) {
  48559. if (!router.app) {
  48560. return
  48561. }
  48562. var behavior = router.options.scrollBehavior;
  48563. if (!behavior) {
  48564. return
  48565. }
  48566. if (true) {
  48567. assert(typeof behavior === 'function', "scrollBehavior must be a function");
  48568. }
  48569. // wait until re-render finishes before scrolling
  48570. router.app.$nextTick(function () {
  48571. var position = getScrollPosition();
  48572. var shouldScroll = behavior.call(
  48573. router,
  48574. to,
  48575. from,
  48576. isPop ? position : null
  48577. );
  48578. if (!shouldScroll) {
  48579. return
  48580. }
  48581. if (typeof shouldScroll.then === 'function') {
  48582. shouldScroll
  48583. .then(function (shouldScroll) {
  48584. scrollToPosition((shouldScroll), position);
  48585. })
  48586. .catch(function (err) {
  48587. if (true) {
  48588. assert(false, err.toString());
  48589. }
  48590. });
  48591. } else {
  48592. scrollToPosition(shouldScroll, position);
  48593. }
  48594. });
  48595. }
  48596. function saveScrollPosition () {
  48597. var key = getStateKey();
  48598. if (key) {
  48599. positionStore[key] = {
  48600. x: window.pageXOffset,
  48601. y: window.pageYOffset
  48602. };
  48603. }
  48604. }
  48605. function getScrollPosition () {
  48606. var key = getStateKey();
  48607. if (key) {
  48608. return positionStore[key]
  48609. }
  48610. }
  48611. function getElementPosition (el, offset) {
  48612. var docEl = document.documentElement;
  48613. var docRect = docEl.getBoundingClientRect();
  48614. var elRect = el.getBoundingClientRect();
  48615. return {
  48616. x: elRect.left - docRect.left - offset.x,
  48617. y: elRect.top - docRect.top - offset.y
  48618. }
  48619. }
  48620. function isValidPosition (obj) {
  48621. return isNumber(obj.x) || isNumber(obj.y)
  48622. }
  48623. function normalizePosition (obj) {
  48624. return {
  48625. x: isNumber(obj.x) ? obj.x : window.pageXOffset,
  48626. y: isNumber(obj.y) ? obj.y : window.pageYOffset
  48627. }
  48628. }
  48629. function normalizeOffset (obj) {
  48630. return {
  48631. x: isNumber(obj.x) ? obj.x : 0,
  48632. y: isNumber(obj.y) ? obj.y : 0
  48633. }
  48634. }
  48635. function isNumber (v) {
  48636. return typeof v === 'number'
  48637. }
  48638. var hashStartsWithNumberRE = /^#\d/;
  48639. function scrollToPosition (shouldScroll, position) {
  48640. var isObject = typeof shouldScroll === 'object';
  48641. if (isObject && typeof shouldScroll.selector === 'string') {
  48642. // getElementById would still fail if the selector contains a more complicated query like #main[data-attr]
  48643. // but at the same time, it doesn't make much sense to select an element with an id and an extra selector
  48644. var el = hashStartsWithNumberRE.test(shouldScroll.selector) // $flow-disable-line
  48645. ? document.getElementById(shouldScroll.selector.slice(1)) // $flow-disable-line
  48646. : document.querySelector(shouldScroll.selector);
  48647. if (el) {
  48648. var offset =
  48649. shouldScroll.offset && typeof shouldScroll.offset === 'object'
  48650. ? shouldScroll.offset
  48651. : {};
  48652. offset = normalizeOffset(offset);
  48653. position = getElementPosition(el, offset);
  48654. } else if (isValidPosition(shouldScroll)) {
  48655. position = normalizePosition(shouldScroll);
  48656. }
  48657. } else if (isObject && isValidPosition(shouldScroll)) {
  48658. position = normalizePosition(shouldScroll);
  48659. }
  48660. if (position) {
  48661. window.scrollTo(position.x, position.y);
  48662. }
  48663. }
  48664. /* */
  48665. var supportsPushState =
  48666. inBrowser &&
  48667. (function () {
  48668. var ua = window.navigator.userAgent;
  48669. if (
  48670. (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
  48671. ua.indexOf('Mobile Safari') !== -1 &&
  48672. ua.indexOf('Chrome') === -1 &&
  48673. ua.indexOf('Windows Phone') === -1
  48674. ) {
  48675. return false
  48676. }
  48677. return window.history && 'pushState' in window.history
  48678. })();
  48679. function pushState (url, replace) {
  48680. saveScrollPosition();
  48681. // try...catch the pushState call to get around Safari
  48682. // DOM Exception 18 where it limits to 100 pushState calls
  48683. var history = window.history;
  48684. try {
  48685. if (replace) {
  48686. // preserve existing history state as it could be overriden by the user
  48687. var stateCopy = extend({}, history.state);
  48688. stateCopy.key = getStateKey();
  48689. history.replaceState(stateCopy, '', url);
  48690. } else {
  48691. history.pushState({ key: setStateKey(genStateKey()) }, '', url);
  48692. }
  48693. } catch (e) {
  48694. window.location[replace ? 'replace' : 'assign'](url);
  48695. }
  48696. }
  48697. function replaceState (url) {
  48698. pushState(url, true);
  48699. }
  48700. /* */
  48701. function runQueue (queue, fn, cb) {
  48702. var step = function (index) {
  48703. if (index >= queue.length) {
  48704. cb();
  48705. } else {
  48706. if (queue[index]) {
  48707. fn(queue[index], function () {
  48708. step(index + 1);
  48709. });
  48710. } else {
  48711. step(index + 1);
  48712. }
  48713. }
  48714. };
  48715. step(0);
  48716. }
  48717. /* */
  48718. function resolveAsyncComponents (matched) {
  48719. return function (to, from, next) {
  48720. var hasAsync = false;
  48721. var pending = 0;
  48722. var error = null;
  48723. flatMapComponents(matched, function (def, _, match, key) {
  48724. // if it's a function and doesn't have cid attached,
  48725. // assume it's an async component resolve function.
  48726. // we are not using Vue's default async resolving mechanism because
  48727. // we want to halt the navigation until the incoming component has been
  48728. // resolved.
  48729. if (typeof def === 'function' && def.cid === undefined) {
  48730. hasAsync = true;
  48731. pending++;
  48732. var resolve = once(function (resolvedDef) {
  48733. if (isESModule(resolvedDef)) {
  48734. resolvedDef = resolvedDef.default;
  48735. }
  48736. // save resolved on async factory in case it's used elsewhere
  48737. def.resolved = typeof resolvedDef === 'function'
  48738. ? resolvedDef
  48739. : _Vue.extend(resolvedDef);
  48740. match.components[key] = resolvedDef;
  48741. pending--;
  48742. if (pending <= 0) {
  48743. next();
  48744. }
  48745. });
  48746. var reject = once(function (reason) {
  48747. var msg = "Failed to resolve async component " + key + ": " + reason;
  48748. true && warn(false, msg);
  48749. if (!error) {
  48750. error = isError(reason)
  48751. ? reason
  48752. : new Error(msg);
  48753. next(error);
  48754. }
  48755. });
  48756. var res;
  48757. try {
  48758. res = def(resolve, reject);
  48759. } catch (e) {
  48760. reject(e);
  48761. }
  48762. if (res) {
  48763. if (typeof res.then === 'function') {
  48764. res.then(resolve, reject);
  48765. } else {
  48766. // new syntax in Vue 2.3
  48767. var comp = res.component;
  48768. if (comp && typeof comp.then === 'function') {
  48769. comp.then(resolve, reject);
  48770. }
  48771. }
  48772. }
  48773. }
  48774. });
  48775. if (!hasAsync) { next(); }
  48776. }
  48777. }
  48778. function flatMapComponents (
  48779. matched,
  48780. fn
  48781. ) {
  48782. return flatten(matched.map(function (m) {
  48783. return Object.keys(m.components).map(function (key) { return fn(
  48784. m.components[key],
  48785. m.instances[key],
  48786. m, key
  48787. ); })
  48788. }))
  48789. }
  48790. function flatten (arr) {
  48791. return Array.prototype.concat.apply([], arr)
  48792. }
  48793. var hasSymbol =
  48794. typeof Symbol === 'function' &&
  48795. typeof Symbol.toStringTag === 'symbol';
  48796. function isESModule (obj) {
  48797. return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
  48798. }
  48799. // in Webpack 2, require.ensure now also returns a Promise
  48800. // so the resolve/reject functions may get called an extra time
  48801. // if the user uses an arrow function shorthand that happens to
  48802. // return that Promise.
  48803. function once (fn) {
  48804. var called = false;
  48805. return function () {
  48806. var args = [], len = arguments.length;
  48807. while ( len-- ) args[ len ] = arguments[ len ];
  48808. if (called) { return }
  48809. called = true;
  48810. return fn.apply(this, args)
  48811. }
  48812. }
  48813. var NavigationDuplicated = /*@__PURE__*/(function (Error) {
  48814. function NavigationDuplicated (normalizedLocation) {
  48815. Error.call(this);
  48816. this.name = this._name = 'NavigationDuplicated';
  48817. // passing the message to super() doesn't seem to work in the transpiled version
  48818. this.message = "Navigating to current location (\"" + (normalizedLocation.fullPath) + "\") is not allowed";
  48819. // add a stack property so services like Sentry can correctly display it
  48820. Object.defineProperty(this, 'stack', {
  48821. value: new Error().stack,
  48822. writable: true,
  48823. configurable: true
  48824. });
  48825. // we could also have used
  48826. // Error.captureStackTrace(this, this.constructor)
  48827. // but it only exists on node and chrome
  48828. }
  48829. if ( Error ) NavigationDuplicated.__proto__ = Error;
  48830. NavigationDuplicated.prototype = Object.create( Error && Error.prototype );
  48831. NavigationDuplicated.prototype.constructor = NavigationDuplicated;
  48832. return NavigationDuplicated;
  48833. }(Error));
  48834. // support IE9
  48835. NavigationDuplicated._name = 'NavigationDuplicated';
  48836. /* */
  48837. var History = function History (router, base) {
  48838. this.router = router;
  48839. this.base = normalizeBase(base);
  48840. // start with a route object that stands for "nowhere"
  48841. this.current = START;
  48842. this.pending = null;
  48843. this.ready = false;
  48844. this.readyCbs = [];
  48845. this.readyErrorCbs = [];
  48846. this.errorCbs = [];
  48847. };
  48848. History.prototype.listen = function listen (cb) {
  48849. this.cb = cb;
  48850. };
  48851. History.prototype.onReady = function onReady (cb, errorCb) {
  48852. if (this.ready) {
  48853. cb();
  48854. } else {
  48855. this.readyCbs.push(cb);
  48856. if (errorCb) {
  48857. this.readyErrorCbs.push(errorCb);
  48858. }
  48859. }
  48860. };
  48861. History.prototype.onError = function onError (errorCb) {
  48862. this.errorCbs.push(errorCb);
  48863. };
  48864. History.prototype.transitionTo = function transitionTo (
  48865. location,
  48866. onComplete,
  48867. onAbort
  48868. ) {
  48869. var this$1 = this;
  48870. var route = this.router.match(location, this.current);
  48871. this.confirmTransition(
  48872. route,
  48873. function () {
  48874. this$1.updateRoute(route);
  48875. onComplete && onComplete(route);
  48876. this$1.ensureURL();
  48877. // fire ready cbs once
  48878. if (!this$1.ready) {
  48879. this$1.ready = true;
  48880. this$1.readyCbs.forEach(function (cb) {
  48881. cb(route);
  48882. });
  48883. }
  48884. },
  48885. function (err) {
  48886. if (onAbort) {
  48887. onAbort(err);
  48888. }
  48889. if (err && !this$1.ready) {
  48890. this$1.ready = true;
  48891. this$1.readyErrorCbs.forEach(function (cb) {
  48892. cb(err);
  48893. });
  48894. }
  48895. }
  48896. );
  48897. };
  48898. History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
  48899. var this$1 = this;
  48900. var current = this.current;
  48901. var abort = function (err) {
  48902. // after merging https://github.com/vuejs/vue-router/pull/2771 we
  48903. // When the user navigates through history through back/forward buttons
  48904. // we do not want to throw the error. We only throw it if directly calling
  48905. // push/replace. That's why it's not included in isError
  48906. if (!isExtendedError(NavigationDuplicated, err) && isError(err)) {
  48907. if (this$1.errorCbs.length) {
  48908. this$1.errorCbs.forEach(function (cb) {
  48909. cb(err);
  48910. });
  48911. } else {
  48912. warn(false, 'uncaught error during route navigation:');
  48913. console.error(err);
  48914. }
  48915. }
  48916. onAbort && onAbort(err);
  48917. };
  48918. if (
  48919. isSameRoute(route, current) &&
  48920. // in the case the route map has been dynamically appended to
  48921. route.matched.length === current.matched.length
  48922. ) {
  48923. this.ensureURL();
  48924. return abort(new NavigationDuplicated(route))
  48925. }
  48926. var ref = resolveQueue(
  48927. this.current.matched,
  48928. route.matched
  48929. );
  48930. var updated = ref.updated;
  48931. var deactivated = ref.deactivated;
  48932. var activated = ref.activated;
  48933. var queue = [].concat(
  48934. // in-component leave guards
  48935. extractLeaveGuards(deactivated),
  48936. // global before hooks
  48937. this.router.beforeHooks,
  48938. // in-component update hooks
  48939. extractUpdateHooks(updated),
  48940. // in-config enter guards
  48941. activated.map(function (m) { return m.beforeEnter; }),
  48942. // async components
  48943. resolveAsyncComponents(activated)
  48944. );
  48945. this.pending = route;
  48946. var iterator = function (hook, next) {
  48947. if (this$1.pending !== route) {
  48948. return abort()
  48949. }
  48950. try {
  48951. hook(route, current, function (to) {
  48952. if (to === false || isError(to)) {
  48953. // next(false) -> abort navigation, ensure current URL
  48954. this$1.ensureURL(true);
  48955. abort(to);
  48956. } else if (
  48957. typeof to === 'string' ||
  48958. (typeof to === 'object' &&
  48959. (typeof to.path === 'string' || typeof to.name === 'string'))
  48960. ) {
  48961. // next('/') or next({ path: '/' }) -> redirect
  48962. abort();
  48963. if (typeof to === 'object' && to.replace) {
  48964. this$1.replace(to);
  48965. } else {
  48966. this$1.push(to);
  48967. }
  48968. } else {
  48969. // confirm transition and pass on the value
  48970. next(to);
  48971. }
  48972. });
  48973. } catch (e) {
  48974. abort(e);
  48975. }
  48976. };
  48977. runQueue(queue, iterator, function () {
  48978. var postEnterCbs = [];
  48979. var isValid = function () { return this$1.current === route; };
  48980. // wait until async components are resolved before
  48981. // extracting in-component enter guards
  48982. var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
  48983. var queue = enterGuards.concat(this$1.router.resolveHooks);
  48984. runQueue(queue, iterator, function () {
  48985. if (this$1.pending !== route) {
  48986. return abort()
  48987. }
  48988. this$1.pending = null;
  48989. onComplete(route);
  48990. if (this$1.router.app) {
  48991. this$1.router.app.$nextTick(function () {
  48992. postEnterCbs.forEach(function (cb) {
  48993. cb();
  48994. });
  48995. });
  48996. }
  48997. });
  48998. });
  48999. };
  49000. History.prototype.updateRoute = function updateRoute (route) {
  49001. var prev = this.current;
  49002. this.current = route;
  49003. this.cb && this.cb(route);
  49004. this.router.afterHooks.forEach(function (hook) {
  49005. hook && hook(route, prev);
  49006. });
  49007. };
  49008. function normalizeBase (base) {
  49009. if (!base) {
  49010. if (inBrowser) {
  49011. // respect <base> tag
  49012. var baseEl = document.querySelector('base');
  49013. base = (baseEl && baseEl.getAttribute('href')) || '/';
  49014. // strip full URL origin
  49015. base = base.replace(/^https?:\/\/[^\/]+/, '');
  49016. } else {
  49017. base = '/';
  49018. }
  49019. }
  49020. // make sure there's the starting slash
  49021. if (base.charAt(0) !== '/') {
  49022. base = '/' + base;
  49023. }
  49024. // remove trailing slash
  49025. return base.replace(/\/$/, '')
  49026. }
  49027. function resolveQueue (
  49028. current,
  49029. next
  49030. ) {
  49031. var i;
  49032. var max = Math.max(current.length, next.length);
  49033. for (i = 0; i < max; i++) {
  49034. if (current[i] !== next[i]) {
  49035. break
  49036. }
  49037. }
  49038. return {
  49039. updated: next.slice(0, i),
  49040. activated: next.slice(i),
  49041. deactivated: current.slice(i)
  49042. }
  49043. }
  49044. function extractGuards (
  49045. records,
  49046. name,
  49047. bind,
  49048. reverse
  49049. ) {
  49050. var guards = flatMapComponents(records, function (def, instance, match, key) {
  49051. var guard = extractGuard(def, name);
  49052. if (guard) {
  49053. return Array.isArray(guard)
  49054. ? guard.map(function (guard) { return bind(guard, instance, match, key); })
  49055. : bind(guard, instance, match, key)
  49056. }
  49057. });
  49058. return flatten(reverse ? guards.reverse() : guards)
  49059. }
  49060. function extractGuard (
  49061. def,
  49062. key
  49063. ) {
  49064. if (typeof def !== 'function') {
  49065. // extend now so that global mixins are applied.
  49066. def = _Vue.extend(def);
  49067. }
  49068. return def.options[key]
  49069. }
  49070. function extractLeaveGuards (deactivated) {
  49071. return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
  49072. }
  49073. function extractUpdateHooks (updated) {
  49074. return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
  49075. }
  49076. function bindGuard (guard, instance) {
  49077. if (instance) {
  49078. return function boundRouteGuard () {
  49079. return guard.apply(instance, arguments)
  49080. }
  49081. }
  49082. }
  49083. function extractEnterGuards (
  49084. activated,
  49085. cbs,
  49086. isValid
  49087. ) {
  49088. return extractGuards(
  49089. activated,
  49090. 'beforeRouteEnter',
  49091. function (guard, _, match, key) {
  49092. return bindEnterGuard(guard, match, key, cbs, isValid)
  49093. }
  49094. )
  49095. }
  49096. function bindEnterGuard (
  49097. guard,
  49098. match,
  49099. key,
  49100. cbs,
  49101. isValid
  49102. ) {
  49103. return function routeEnterGuard (to, from, next) {
  49104. return guard(to, from, function (cb) {
  49105. if (typeof cb === 'function') {
  49106. cbs.push(function () {
  49107. // #750
  49108. // if a router-view is wrapped with an out-in transition,
  49109. // the instance may not have been registered at this time.
  49110. // we will need to poll for registration until current route
  49111. // is no longer valid.
  49112. poll(cb, match.instances, key, isValid);
  49113. });
  49114. }
  49115. next(cb);
  49116. })
  49117. }
  49118. }
  49119. function poll (
  49120. cb, // somehow flow cannot infer this is a function
  49121. instances,
  49122. key,
  49123. isValid
  49124. ) {
  49125. if (
  49126. instances[key] &&
  49127. !instances[key]._isBeingDestroyed // do not reuse being destroyed instance
  49128. ) {
  49129. cb(instances[key]);
  49130. } else if (isValid()) {
  49131. setTimeout(function () {
  49132. poll(cb, instances, key, isValid);
  49133. }, 16);
  49134. }
  49135. }
  49136. /* */
  49137. var HTML5History = /*@__PURE__*/(function (History) {
  49138. function HTML5History (router, base) {
  49139. var this$1 = this;
  49140. History.call(this, router, base);
  49141. var expectScroll = router.options.scrollBehavior;
  49142. var supportsScroll = supportsPushState && expectScroll;
  49143. if (supportsScroll) {
  49144. setupScroll();
  49145. }
  49146. var initLocation = getLocation(this.base);
  49147. window.addEventListener('popstate', function (e) {
  49148. var current = this$1.current;
  49149. // Avoiding first `popstate` event dispatched in some browsers but first
  49150. // history route not updated since async guard at the same time.
  49151. var location = getLocation(this$1.base);
  49152. if (this$1.current === START && location === initLocation) {
  49153. return
  49154. }
  49155. this$1.transitionTo(location, function (route) {
  49156. if (supportsScroll) {
  49157. handleScroll(router, route, current, true);
  49158. }
  49159. });
  49160. });
  49161. }
  49162. if ( History ) HTML5History.__proto__ = History;
  49163. HTML5History.prototype = Object.create( History && History.prototype );
  49164. HTML5History.prototype.constructor = HTML5History;
  49165. HTML5History.prototype.go = function go (n) {
  49166. window.history.go(n);
  49167. };
  49168. HTML5History.prototype.push = function push (location, onComplete, onAbort) {
  49169. var this$1 = this;
  49170. var ref = this;
  49171. var fromRoute = ref.current;
  49172. this.transitionTo(location, function (route) {
  49173. pushState(cleanPath(this$1.base + route.fullPath));
  49174. handleScroll(this$1.router, route, fromRoute, false);
  49175. onComplete && onComplete(route);
  49176. }, onAbort);
  49177. };
  49178. HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
  49179. var this$1 = this;
  49180. var ref = this;
  49181. var fromRoute = ref.current;
  49182. this.transitionTo(location, function (route) {
  49183. replaceState(cleanPath(this$1.base + route.fullPath));
  49184. handleScroll(this$1.router, route, fromRoute, false);
  49185. onComplete && onComplete(route);
  49186. }, onAbort);
  49187. };
  49188. HTML5History.prototype.ensureURL = function ensureURL (push) {
  49189. if (getLocation(this.base) !== this.current.fullPath) {
  49190. var current = cleanPath(this.base + this.current.fullPath);
  49191. push ? pushState(current) : replaceState(current);
  49192. }
  49193. };
  49194. HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
  49195. return getLocation(this.base)
  49196. };
  49197. return HTML5History;
  49198. }(History));
  49199. function getLocation (base) {
  49200. var path = decodeURI(window.location.pathname);
  49201. if (base && path.indexOf(base) === 0) {
  49202. path = path.slice(base.length);
  49203. }
  49204. return (path || '/') + window.location.search + window.location.hash
  49205. }
  49206. /* */
  49207. var HashHistory = /*@__PURE__*/(function (History) {
  49208. function HashHistory (router, base, fallback) {
  49209. History.call(this, router, base);
  49210. // check history fallback deeplinking
  49211. if (fallback && checkFallback(this.base)) {
  49212. return
  49213. }
  49214. ensureSlash();
  49215. }
  49216. if ( History ) HashHistory.__proto__ = History;
  49217. HashHistory.prototype = Object.create( History && History.prototype );
  49218. HashHistory.prototype.constructor = HashHistory;
  49219. // this is delayed until the app mounts
  49220. // to avoid the hashchange listener being fired too early
  49221. HashHistory.prototype.setupListeners = function setupListeners () {
  49222. var this$1 = this;
  49223. var router = this.router;
  49224. var expectScroll = router.options.scrollBehavior;
  49225. var supportsScroll = supportsPushState && expectScroll;
  49226. if (supportsScroll) {
  49227. setupScroll();
  49228. }
  49229. window.addEventListener(
  49230. supportsPushState ? 'popstate' : 'hashchange',
  49231. function () {
  49232. var current = this$1.current;
  49233. if (!ensureSlash()) {
  49234. return
  49235. }
  49236. this$1.transitionTo(getHash(), function (route) {
  49237. if (supportsScroll) {
  49238. handleScroll(this$1.router, route, current, true);
  49239. }
  49240. if (!supportsPushState) {
  49241. replaceHash(route.fullPath);
  49242. }
  49243. });
  49244. }
  49245. );
  49246. };
  49247. HashHistory.prototype.push = function push (location, onComplete, onAbort) {
  49248. var this$1 = this;
  49249. var ref = this;
  49250. var fromRoute = ref.current;
  49251. this.transitionTo(
  49252. location,
  49253. function (route) {
  49254. pushHash(route.fullPath);
  49255. handleScroll(this$1.router, route, fromRoute, false);
  49256. onComplete && onComplete(route);
  49257. },
  49258. onAbort
  49259. );
  49260. };
  49261. HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  49262. var this$1 = this;
  49263. var ref = this;
  49264. var fromRoute = ref.current;
  49265. this.transitionTo(
  49266. location,
  49267. function (route) {
  49268. replaceHash(route.fullPath);
  49269. handleScroll(this$1.router, route, fromRoute, false);
  49270. onComplete && onComplete(route);
  49271. },
  49272. onAbort
  49273. );
  49274. };
  49275. HashHistory.prototype.go = function go (n) {
  49276. window.history.go(n);
  49277. };
  49278. HashHistory.prototype.ensureURL = function ensureURL (push) {
  49279. var current = this.current.fullPath;
  49280. if (getHash() !== current) {
  49281. push ? pushHash(current) : replaceHash(current);
  49282. }
  49283. };
  49284. HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  49285. return getHash()
  49286. };
  49287. return HashHistory;
  49288. }(History));
  49289. function checkFallback (base) {
  49290. var location = getLocation(base);
  49291. if (!/^\/#/.test(location)) {
  49292. window.location.replace(cleanPath(base + '/#' + location));
  49293. return true
  49294. }
  49295. }
  49296. function ensureSlash () {
  49297. var path = getHash();
  49298. if (path.charAt(0) === '/') {
  49299. return true
  49300. }
  49301. replaceHash('/' + path);
  49302. return false
  49303. }
  49304. function getHash () {
  49305. // We can't use window.location.hash here because it's not
  49306. // consistent across browsers - Firefox will pre-decode it!
  49307. var href = window.location.href;
  49308. var index = href.indexOf('#');
  49309. // empty path
  49310. if (index < 0) { return '' }
  49311. href = href.slice(index + 1);
  49312. // decode the hash but not the search or hash
  49313. // as search(query) is already decoded
  49314. // https://github.com/vuejs/vue-router/issues/2708
  49315. var searchIndex = href.indexOf('?');
  49316. if (searchIndex < 0) {
  49317. var hashIndex = href.indexOf('#');
  49318. if (hashIndex > -1) {
  49319. href = decodeURI(href.slice(0, hashIndex)) + href.slice(hashIndex);
  49320. } else { href = decodeURI(href); }
  49321. } else {
  49322. href = decodeURI(href.slice(0, searchIndex)) + href.slice(searchIndex);
  49323. }
  49324. return href
  49325. }
  49326. function getUrl (path) {
  49327. var href = window.location.href;
  49328. var i = href.indexOf('#');
  49329. var base = i >= 0 ? href.slice(0, i) : href;
  49330. return (base + "#" + path)
  49331. }
  49332. function pushHash (path) {
  49333. if (supportsPushState) {
  49334. pushState(getUrl(path));
  49335. } else {
  49336. window.location.hash = path;
  49337. }
  49338. }
  49339. function replaceHash (path) {
  49340. if (supportsPushState) {
  49341. replaceState(getUrl(path));
  49342. } else {
  49343. window.location.replace(getUrl(path));
  49344. }
  49345. }
  49346. /* */
  49347. var AbstractHistory = /*@__PURE__*/(function (History) {
  49348. function AbstractHistory (router, base) {
  49349. History.call(this, router, base);
  49350. this.stack = [];
  49351. this.index = -1;
  49352. }
  49353. if ( History ) AbstractHistory.__proto__ = History;
  49354. AbstractHistory.prototype = Object.create( History && History.prototype );
  49355. AbstractHistory.prototype.constructor = AbstractHistory;
  49356. AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
  49357. var this$1 = this;
  49358. this.transitionTo(
  49359. location,
  49360. function (route) {
  49361. this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
  49362. this$1.index++;
  49363. onComplete && onComplete(route);
  49364. },
  49365. onAbort
  49366. );
  49367. };
  49368. AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  49369. var this$1 = this;
  49370. this.transitionTo(
  49371. location,
  49372. function (route) {
  49373. this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
  49374. onComplete && onComplete(route);
  49375. },
  49376. onAbort
  49377. );
  49378. };
  49379. AbstractHistory.prototype.go = function go (n) {
  49380. var this$1 = this;
  49381. var targetIndex = this.index + n;
  49382. if (targetIndex < 0 || targetIndex >= this.stack.length) {
  49383. return
  49384. }
  49385. var route = this.stack[targetIndex];
  49386. this.confirmTransition(
  49387. route,
  49388. function () {
  49389. this$1.index = targetIndex;
  49390. this$1.updateRoute(route);
  49391. },
  49392. function (err) {
  49393. if (isExtendedError(NavigationDuplicated, err)) {
  49394. this$1.index = targetIndex;
  49395. }
  49396. }
  49397. );
  49398. };
  49399. AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  49400. var current = this.stack[this.stack.length - 1];
  49401. return current ? current.fullPath : '/'
  49402. };
  49403. AbstractHistory.prototype.ensureURL = function ensureURL () {
  49404. // noop
  49405. };
  49406. return AbstractHistory;
  49407. }(History));
  49408. /* */
  49409. var VueRouter = function VueRouter (options) {
  49410. if ( options === void 0 ) options = {};
  49411. this.app = null;
  49412. this.apps = [];
  49413. this.options = options;
  49414. this.beforeHooks = [];
  49415. this.resolveHooks = [];
  49416. this.afterHooks = [];
  49417. this.matcher = createMatcher(options.routes || [], this);
  49418. var mode = options.mode || 'hash';
  49419. this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
  49420. if (this.fallback) {
  49421. mode = 'hash';
  49422. }
  49423. if (!inBrowser) {
  49424. mode = 'abstract';
  49425. }
  49426. this.mode = mode;
  49427. switch (mode) {
  49428. case 'history':
  49429. this.history = new HTML5History(this, options.base);
  49430. break
  49431. case 'hash':
  49432. this.history = new HashHistory(this, options.base, this.fallback);
  49433. break
  49434. case 'abstract':
  49435. this.history = new AbstractHistory(this, options.base);
  49436. break
  49437. default:
  49438. if (true) {
  49439. assert(false, ("invalid mode: " + mode));
  49440. }
  49441. }
  49442. };
  49443. var prototypeAccessors = { currentRoute: { configurable: true } };
  49444. VueRouter.prototype.match = function match (
  49445. raw,
  49446. current,
  49447. redirectedFrom
  49448. ) {
  49449. return this.matcher.match(raw, current, redirectedFrom)
  49450. };
  49451. prototypeAccessors.currentRoute.get = function () {
  49452. return this.history && this.history.current
  49453. };
  49454. VueRouter.prototype.init = function init (app /* Vue component instance */) {
  49455. var this$1 = this;
  49456. true && assert(
  49457. install.installed,
  49458. "not installed. Make sure to call `Vue.use(VueRouter)` " +
  49459. "before creating root instance."
  49460. );
  49461. this.apps.push(app);
  49462. // set up app destroyed handler
  49463. // https://github.com/vuejs/vue-router/issues/2639
  49464. app.$once('hook:destroyed', function () {
  49465. // clean out app from this.apps array once destroyed
  49466. var index = this$1.apps.indexOf(app);
  49467. if (index > -1) { this$1.apps.splice(index, 1); }
  49468. // ensure we still have a main app or null if no apps
  49469. // we do not release the router so it can be reused
  49470. if (this$1.app === app) { this$1.app = this$1.apps[0] || null; }
  49471. });
  49472. // main app previously initialized
  49473. // return as we don't need to set up new history listener
  49474. if (this.app) {
  49475. return
  49476. }
  49477. this.app = app;
  49478. var history = this.history;
  49479. if (history instanceof HTML5History) {
  49480. history.transitionTo(history.getCurrentLocation());
  49481. } else if (history instanceof HashHistory) {
  49482. var setupHashListener = function () {
  49483. history.setupListeners();
  49484. };
  49485. history.transitionTo(
  49486. history.getCurrentLocation(),
  49487. setupHashListener,
  49488. setupHashListener
  49489. );
  49490. }
  49491. history.listen(function (route) {
  49492. this$1.apps.forEach(function (app) {
  49493. app._route = route;
  49494. });
  49495. });
  49496. };
  49497. VueRouter.prototype.beforeEach = function beforeEach (fn) {
  49498. return registerHook(this.beforeHooks, fn)
  49499. };
  49500. VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
  49501. return registerHook(this.resolveHooks, fn)
  49502. };
  49503. VueRouter.prototype.afterEach = function afterEach (fn) {
  49504. return registerHook(this.afterHooks, fn)
  49505. };
  49506. VueRouter.prototype.onReady = function onReady (cb, errorCb) {
  49507. this.history.onReady(cb, errorCb);
  49508. };
  49509. VueRouter.prototype.onError = function onError (errorCb) {
  49510. this.history.onError(errorCb);
  49511. };
  49512. VueRouter.prototype.push = function push (location, onComplete, onAbort) {
  49513. var this$1 = this;
  49514. // $flow-disable-line
  49515. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  49516. return new Promise(function (resolve, reject) {
  49517. this$1.history.push(location, resolve, reject);
  49518. })
  49519. } else {
  49520. this.history.push(location, onComplete, onAbort);
  49521. }
  49522. };
  49523. VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
  49524. var this$1 = this;
  49525. // $flow-disable-line
  49526. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  49527. return new Promise(function (resolve, reject) {
  49528. this$1.history.replace(location, resolve, reject);
  49529. })
  49530. } else {
  49531. this.history.replace(location, onComplete, onAbort);
  49532. }
  49533. };
  49534. VueRouter.prototype.go = function go (n) {
  49535. this.history.go(n);
  49536. };
  49537. VueRouter.prototype.back = function back () {
  49538. this.go(-1);
  49539. };
  49540. VueRouter.prototype.forward = function forward () {
  49541. this.go(1);
  49542. };
  49543. VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
  49544. var route = to
  49545. ? to.matched
  49546. ? to
  49547. : this.resolve(to).route
  49548. : this.currentRoute;
  49549. if (!route) {
  49550. return []
  49551. }
  49552. return [].concat.apply([], route.matched.map(function (m) {
  49553. return Object.keys(m.components).map(function (key) {
  49554. return m.components[key]
  49555. })
  49556. }))
  49557. };
  49558. VueRouter.prototype.resolve = function resolve (
  49559. to,
  49560. current,
  49561. append
  49562. ) {
  49563. current = current || this.history.current;
  49564. var location = normalizeLocation(
  49565. to,
  49566. current,
  49567. append,
  49568. this
  49569. );
  49570. var route = this.match(location, current);
  49571. var fullPath = route.redirectedFrom || route.fullPath;
  49572. var base = this.history.base;
  49573. var href = createHref(base, fullPath, this.mode);
  49574. return {
  49575. location: location,
  49576. route: route,
  49577. href: href,
  49578. // for backwards compat
  49579. normalizedTo: location,
  49580. resolved: route
  49581. }
  49582. };
  49583. VueRouter.prototype.addRoutes = function addRoutes (routes) {
  49584. this.matcher.addRoutes(routes);
  49585. if (this.history.current !== START) {
  49586. this.history.transitionTo(this.history.getCurrentLocation());
  49587. }
  49588. };
  49589. Object.defineProperties( VueRouter.prototype, prototypeAccessors );
  49590. function registerHook (list, fn) {
  49591. list.push(fn);
  49592. return function () {
  49593. var i = list.indexOf(fn);
  49594. if (i > -1) { list.splice(i, 1); }
  49595. }
  49596. }
  49597. function createHref (base, fullPath, mode) {
  49598. var path = mode === 'hash' ? '#' + fullPath : fullPath;
  49599. return base ? cleanPath(base + '/' + path) : path
  49600. }
  49601. VueRouter.install = install;
  49602. VueRouter.version = '3.1.6';
  49603. if (inBrowser && window.Vue) {
  49604. window.Vue.use(VueRouter);
  49605. }
  49606. /* harmony default export */ __webpack_exports__["default"] = (VueRouter);
  49607. /***/ }),
  49608. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  49609. /*!*************************************************!*\
  49610. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  49611. \*************************************************/
  49612. /*! no static exports found */
  49613. /***/ (function(module, exports, __webpack_require__) {
  49614. "use strict";
  49615. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  49616. * Vue.js v2.6.11
  49617. * (c) 2014-2019 Evan You
  49618. * Released under the MIT License.
  49619. */
  49620. /* */
  49621. var emptyObject = Object.freeze({});
  49622. // These helpers produce better VM code in JS engines due to their
  49623. // explicitness and function inlining.
  49624. function isUndef (v) {
  49625. return v === undefined || v === null
  49626. }
  49627. function isDef (v) {
  49628. return v !== undefined && v !== null
  49629. }
  49630. function isTrue (v) {
  49631. return v === true
  49632. }
  49633. function isFalse (v) {
  49634. return v === false
  49635. }
  49636. /**
  49637. * Check if value is primitive.
  49638. */
  49639. function isPrimitive (value) {
  49640. return (
  49641. typeof value === 'string' ||
  49642. typeof value === 'number' ||
  49643. // $flow-disable-line
  49644. typeof value === 'symbol' ||
  49645. typeof value === 'boolean'
  49646. )
  49647. }
  49648. /**
  49649. * Quick object check - this is primarily used to tell
  49650. * Objects from primitive values when we know the value
  49651. * is a JSON-compliant type.
  49652. */
  49653. function isObject (obj) {
  49654. return obj !== null && typeof obj === 'object'
  49655. }
  49656. /**
  49657. * Get the raw type string of a value, e.g., [object Object].
  49658. */
  49659. var _toString = Object.prototype.toString;
  49660. function toRawType (value) {
  49661. return _toString.call(value).slice(8, -1)
  49662. }
  49663. /**
  49664. * Strict object type check. Only returns true
  49665. * for plain JavaScript objects.
  49666. */
  49667. function isPlainObject (obj) {
  49668. return _toString.call(obj) === '[object Object]'
  49669. }
  49670. function isRegExp (v) {
  49671. return _toString.call(v) === '[object RegExp]'
  49672. }
  49673. /**
  49674. * Check if val is a valid array index.
  49675. */
  49676. function isValidArrayIndex (val) {
  49677. var n = parseFloat(String(val));
  49678. return n >= 0 && Math.floor(n) === n && isFinite(val)
  49679. }
  49680. function isPromise (val) {
  49681. return (
  49682. isDef(val) &&
  49683. typeof val.then === 'function' &&
  49684. typeof val.catch === 'function'
  49685. )
  49686. }
  49687. /**
  49688. * Convert a value to a string that is actually rendered.
  49689. */
  49690. function toString (val) {
  49691. return val == null
  49692. ? ''
  49693. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  49694. ? JSON.stringify(val, null, 2)
  49695. : String(val)
  49696. }
  49697. /**
  49698. * Convert an input value to a number for persistence.
  49699. * If the conversion fails, return original string.
  49700. */
  49701. function toNumber (val) {
  49702. var n = parseFloat(val);
  49703. return isNaN(n) ? val : n
  49704. }
  49705. /**
  49706. * Make a map and return a function for checking if a key
  49707. * is in that map.
  49708. */
  49709. function makeMap (
  49710. str,
  49711. expectsLowerCase
  49712. ) {
  49713. var map = Object.create(null);
  49714. var list = str.split(',');
  49715. for (var i = 0; i < list.length; i++) {
  49716. map[list[i]] = true;
  49717. }
  49718. return expectsLowerCase
  49719. ? function (val) { return map[val.toLowerCase()]; }
  49720. : function (val) { return map[val]; }
  49721. }
  49722. /**
  49723. * Check if a tag is a built-in tag.
  49724. */
  49725. var isBuiltInTag = makeMap('slot,component', true);
  49726. /**
  49727. * Check if an attribute is a reserved attribute.
  49728. */
  49729. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  49730. /**
  49731. * Remove an item from an array.
  49732. */
  49733. function remove (arr, item) {
  49734. if (arr.length) {
  49735. var index = arr.indexOf(item);
  49736. if (index > -1) {
  49737. return arr.splice(index, 1)
  49738. }
  49739. }
  49740. }
  49741. /**
  49742. * Check whether an object has the property.
  49743. */
  49744. var hasOwnProperty = Object.prototype.hasOwnProperty;
  49745. function hasOwn (obj, key) {
  49746. return hasOwnProperty.call(obj, key)
  49747. }
  49748. /**
  49749. * Create a cached version of a pure function.
  49750. */
  49751. function cached (fn) {
  49752. var cache = Object.create(null);
  49753. return (function cachedFn (str) {
  49754. var hit = cache[str];
  49755. return hit || (cache[str] = fn(str))
  49756. })
  49757. }
  49758. /**
  49759. * Camelize a hyphen-delimited string.
  49760. */
  49761. var camelizeRE = /-(\w)/g;
  49762. var camelize = cached(function (str) {
  49763. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  49764. });
  49765. /**
  49766. * Capitalize a string.
  49767. */
  49768. var capitalize = cached(function (str) {
  49769. return str.charAt(0).toUpperCase() + str.slice(1)
  49770. });
  49771. /**
  49772. * Hyphenate a camelCase string.
  49773. */
  49774. var hyphenateRE = /\B([A-Z])/g;
  49775. var hyphenate = cached(function (str) {
  49776. return str.replace(hyphenateRE, '-$1').toLowerCase()
  49777. });
  49778. /**
  49779. * Simple bind polyfill for environments that do not support it,
  49780. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  49781. * since native bind is now performant enough in most browsers.
  49782. * But removing it would mean breaking code that was able to run in
  49783. * PhantomJS 1.x, so this must be kept for backward compatibility.
  49784. */
  49785. /* istanbul ignore next */
  49786. function polyfillBind (fn, ctx) {
  49787. function boundFn (a) {
  49788. var l = arguments.length;
  49789. return l
  49790. ? l > 1
  49791. ? fn.apply(ctx, arguments)
  49792. : fn.call(ctx, a)
  49793. : fn.call(ctx)
  49794. }
  49795. boundFn._length = fn.length;
  49796. return boundFn
  49797. }
  49798. function nativeBind (fn, ctx) {
  49799. return fn.bind(ctx)
  49800. }
  49801. var bind = Function.prototype.bind
  49802. ? nativeBind
  49803. : polyfillBind;
  49804. /**
  49805. * Convert an Array-like object to a real Array.
  49806. */
  49807. function toArray (list, start) {
  49808. start = start || 0;
  49809. var i = list.length - start;
  49810. var ret = new Array(i);
  49811. while (i--) {
  49812. ret[i] = list[i + start];
  49813. }
  49814. return ret
  49815. }
  49816. /**
  49817. * Mix properties into target object.
  49818. */
  49819. function extend (to, _from) {
  49820. for (var key in _from) {
  49821. to[key] = _from[key];
  49822. }
  49823. return to
  49824. }
  49825. /**
  49826. * Merge an Array of Objects into a single Object.
  49827. */
  49828. function toObject (arr) {
  49829. var res = {};
  49830. for (var i = 0; i < arr.length; i++) {
  49831. if (arr[i]) {
  49832. extend(res, arr[i]);
  49833. }
  49834. }
  49835. return res
  49836. }
  49837. /* eslint-disable no-unused-vars */
  49838. /**
  49839. * Perform no operation.
  49840. * Stubbing args to make Flow happy without leaving useless transpiled code
  49841. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  49842. */
  49843. function noop (a, b, c) {}
  49844. /**
  49845. * Always return false.
  49846. */
  49847. var no = function (a, b, c) { return false; };
  49848. /* eslint-enable no-unused-vars */
  49849. /**
  49850. * Return the same value.
  49851. */
  49852. var identity = function (_) { return _; };
  49853. /**
  49854. * Generate a string containing static keys from compiler modules.
  49855. */
  49856. function genStaticKeys (modules) {
  49857. return modules.reduce(function (keys, m) {
  49858. return keys.concat(m.staticKeys || [])
  49859. }, []).join(',')
  49860. }
  49861. /**
  49862. * Check if two values are loosely equal - that is,
  49863. * if they are plain objects, do they have the same shape?
  49864. */
  49865. function looseEqual (a, b) {
  49866. if (a === b) { return true }
  49867. var isObjectA = isObject(a);
  49868. var isObjectB = isObject(b);
  49869. if (isObjectA && isObjectB) {
  49870. try {
  49871. var isArrayA = Array.isArray(a);
  49872. var isArrayB = Array.isArray(b);
  49873. if (isArrayA && isArrayB) {
  49874. return a.length === b.length && a.every(function (e, i) {
  49875. return looseEqual(e, b[i])
  49876. })
  49877. } else if (a instanceof Date && b instanceof Date) {
  49878. return a.getTime() === b.getTime()
  49879. } else if (!isArrayA && !isArrayB) {
  49880. var keysA = Object.keys(a);
  49881. var keysB = Object.keys(b);
  49882. return keysA.length === keysB.length && keysA.every(function (key) {
  49883. return looseEqual(a[key], b[key])
  49884. })
  49885. } else {
  49886. /* istanbul ignore next */
  49887. return false
  49888. }
  49889. } catch (e) {
  49890. /* istanbul ignore next */
  49891. return false
  49892. }
  49893. } else if (!isObjectA && !isObjectB) {
  49894. return String(a) === String(b)
  49895. } else {
  49896. return false
  49897. }
  49898. }
  49899. /**
  49900. * Return the first index at which a loosely equal value can be
  49901. * found in the array (if value is a plain object, the array must
  49902. * contain an object of the same shape), or -1 if it is not present.
  49903. */
  49904. function looseIndexOf (arr, val) {
  49905. for (var i = 0; i < arr.length; i++) {
  49906. if (looseEqual(arr[i], val)) { return i }
  49907. }
  49908. return -1
  49909. }
  49910. /**
  49911. * Ensure a function is called only once.
  49912. */
  49913. function once (fn) {
  49914. var called = false;
  49915. return function () {
  49916. if (!called) {
  49917. called = true;
  49918. fn.apply(this, arguments);
  49919. }
  49920. }
  49921. }
  49922. var SSR_ATTR = 'data-server-rendered';
  49923. var ASSET_TYPES = [
  49924. 'component',
  49925. 'directive',
  49926. 'filter'
  49927. ];
  49928. var LIFECYCLE_HOOKS = [
  49929. 'beforeCreate',
  49930. 'created',
  49931. 'beforeMount',
  49932. 'mounted',
  49933. 'beforeUpdate',
  49934. 'updated',
  49935. 'beforeDestroy',
  49936. 'destroyed',
  49937. 'activated',
  49938. 'deactivated',
  49939. 'errorCaptured',
  49940. 'serverPrefetch'
  49941. ];
  49942. /* */
  49943. var config = ({
  49944. /**
  49945. * Option merge strategies (used in core/util/options)
  49946. */
  49947. // $flow-disable-line
  49948. optionMergeStrategies: Object.create(null),
  49949. /**
  49950. * Whether to suppress warnings.
  49951. */
  49952. silent: false,
  49953. /**
  49954. * Show production mode tip message on boot?
  49955. */
  49956. productionTip: "development" !== 'production',
  49957. /**
  49958. * Whether to enable devtools
  49959. */
  49960. devtools: "development" !== 'production',
  49961. /**
  49962. * Whether to record perf
  49963. */
  49964. performance: false,
  49965. /**
  49966. * Error handler for watcher errors
  49967. */
  49968. errorHandler: null,
  49969. /**
  49970. * Warn handler for watcher warns
  49971. */
  49972. warnHandler: null,
  49973. /**
  49974. * Ignore certain custom elements
  49975. */
  49976. ignoredElements: [],
  49977. /**
  49978. * Custom user key aliases for v-on
  49979. */
  49980. // $flow-disable-line
  49981. keyCodes: Object.create(null),
  49982. /**
  49983. * Check if a tag is reserved so that it cannot be registered as a
  49984. * component. This is platform-dependent and may be overwritten.
  49985. */
  49986. isReservedTag: no,
  49987. /**
  49988. * Check if an attribute is reserved so that it cannot be used as a component
  49989. * prop. This is platform-dependent and may be overwritten.
  49990. */
  49991. isReservedAttr: no,
  49992. /**
  49993. * Check if a tag is an unknown element.
  49994. * Platform-dependent.
  49995. */
  49996. isUnknownElement: no,
  49997. /**
  49998. * Get the namespace of an element
  49999. */
  50000. getTagNamespace: noop,
  50001. /**
  50002. * Parse the real tag name for the specific platform.
  50003. */
  50004. parsePlatformTagName: identity,
  50005. /**
  50006. * Check if an attribute must be bound using property, e.g. value
  50007. * Platform-dependent.
  50008. */
  50009. mustUseProp: no,
  50010. /**
  50011. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  50012. * This will significantly reduce performance if set to false.
  50013. */
  50014. async: true,
  50015. /**
  50016. * Exposed for legacy reasons
  50017. */
  50018. _lifecycleHooks: LIFECYCLE_HOOKS
  50019. });
  50020. /* */
  50021. /**
  50022. * unicode letters used for parsing html tags, component names and property paths.
  50023. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  50024. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  50025. */
  50026. 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/;
  50027. /**
  50028. * Check if a string starts with $ or _
  50029. */
  50030. function isReserved (str) {
  50031. var c = (str + '').charCodeAt(0);
  50032. return c === 0x24 || c === 0x5F
  50033. }
  50034. /**
  50035. * Define a property.
  50036. */
  50037. function def (obj, key, val, enumerable) {
  50038. Object.defineProperty(obj, key, {
  50039. value: val,
  50040. enumerable: !!enumerable,
  50041. writable: true,
  50042. configurable: true
  50043. });
  50044. }
  50045. /**
  50046. * Parse simple path.
  50047. */
  50048. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  50049. function parsePath (path) {
  50050. if (bailRE.test(path)) {
  50051. return
  50052. }
  50053. var segments = path.split('.');
  50054. return function (obj) {
  50055. for (var i = 0; i < segments.length; i++) {
  50056. if (!obj) { return }
  50057. obj = obj[segments[i]];
  50058. }
  50059. return obj
  50060. }
  50061. }
  50062. /* */
  50063. // can we use __proto__?
  50064. var hasProto = '__proto__' in {};
  50065. // Browser environment sniffing
  50066. var inBrowser = typeof window !== 'undefined';
  50067. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  50068. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  50069. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  50070. var isIE = UA && /msie|trident/.test(UA);
  50071. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  50072. var isEdge = UA && UA.indexOf('edge/') > 0;
  50073. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  50074. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  50075. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  50076. var isPhantomJS = UA && /phantomjs/.test(UA);
  50077. var isFF = UA && UA.match(/firefox\/(\d+)/);
  50078. // Firefox has a "watch" function on Object.prototype...
  50079. var nativeWatch = ({}).watch;
  50080. var supportsPassive = false;
  50081. if (inBrowser) {
  50082. try {
  50083. var opts = {};
  50084. Object.defineProperty(opts, 'passive', ({
  50085. get: function get () {
  50086. /* istanbul ignore next */
  50087. supportsPassive = true;
  50088. }
  50089. })); // https://github.com/facebook/flow/issues/285
  50090. window.addEventListener('test-passive', null, opts);
  50091. } catch (e) {}
  50092. }
  50093. // this needs to be lazy-evaled because vue may be required before
  50094. // vue-server-renderer can set VUE_ENV
  50095. var _isServer;
  50096. var isServerRendering = function () {
  50097. if (_isServer === undefined) {
  50098. /* istanbul ignore if */
  50099. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  50100. // detect presence of vue-server-renderer and avoid
  50101. // Webpack shimming the process
  50102. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  50103. } else {
  50104. _isServer = false;
  50105. }
  50106. }
  50107. return _isServer
  50108. };
  50109. // detect devtools
  50110. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  50111. /* istanbul ignore next */
  50112. function isNative (Ctor) {
  50113. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  50114. }
  50115. var hasSymbol =
  50116. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  50117. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  50118. var _Set;
  50119. /* istanbul ignore if */ // $flow-disable-line
  50120. if (typeof Set !== 'undefined' && isNative(Set)) {
  50121. // use native Set when available.
  50122. _Set = Set;
  50123. } else {
  50124. // a non-standard Set polyfill that only works with primitive keys.
  50125. _Set = /*@__PURE__*/(function () {
  50126. function Set () {
  50127. this.set = Object.create(null);
  50128. }
  50129. Set.prototype.has = function has (key) {
  50130. return this.set[key] === true
  50131. };
  50132. Set.prototype.add = function add (key) {
  50133. this.set[key] = true;
  50134. };
  50135. Set.prototype.clear = function clear () {
  50136. this.set = Object.create(null);
  50137. };
  50138. return Set;
  50139. }());
  50140. }
  50141. /* */
  50142. var warn = noop;
  50143. var tip = noop;
  50144. var generateComponentTrace = (noop); // work around flow check
  50145. var formatComponentName = (noop);
  50146. {
  50147. var hasConsole = typeof console !== 'undefined';
  50148. var classifyRE = /(?:^|[-_])(\w)/g;
  50149. var classify = function (str) { return str
  50150. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  50151. .replace(/[-_]/g, ''); };
  50152. warn = function (msg, vm) {
  50153. var trace = vm ? generateComponentTrace(vm) : '';
  50154. if (config.warnHandler) {
  50155. config.warnHandler.call(null, msg, vm, trace);
  50156. } else if (hasConsole && (!config.silent)) {
  50157. console.error(("[Vue warn]: " + msg + trace));
  50158. }
  50159. };
  50160. tip = function (msg, vm) {
  50161. if (hasConsole && (!config.silent)) {
  50162. console.warn("[Vue tip]: " + msg + (
  50163. vm ? generateComponentTrace(vm) : ''
  50164. ));
  50165. }
  50166. };
  50167. formatComponentName = function (vm, includeFile) {
  50168. if (vm.$root === vm) {
  50169. return '<Root>'
  50170. }
  50171. var options = typeof vm === 'function' && vm.cid != null
  50172. ? vm.options
  50173. : vm._isVue
  50174. ? vm.$options || vm.constructor.options
  50175. : vm;
  50176. var name = options.name || options._componentTag;
  50177. var file = options.__file;
  50178. if (!name && file) {
  50179. var match = file.match(/([^/\\]+)\.vue$/);
  50180. name = match && match[1];
  50181. }
  50182. return (
  50183. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  50184. (file && includeFile !== false ? (" at " + file) : '')
  50185. )
  50186. };
  50187. var repeat = function (str, n) {
  50188. var res = '';
  50189. while (n) {
  50190. if (n % 2 === 1) { res += str; }
  50191. if (n > 1) { str += str; }
  50192. n >>= 1;
  50193. }
  50194. return res
  50195. };
  50196. generateComponentTrace = function (vm) {
  50197. if (vm._isVue && vm.$parent) {
  50198. var tree = [];
  50199. var currentRecursiveSequence = 0;
  50200. while (vm) {
  50201. if (tree.length > 0) {
  50202. var last = tree[tree.length - 1];
  50203. if (last.constructor === vm.constructor) {
  50204. currentRecursiveSequence++;
  50205. vm = vm.$parent;
  50206. continue
  50207. } else if (currentRecursiveSequence > 0) {
  50208. tree[tree.length - 1] = [last, currentRecursiveSequence];
  50209. currentRecursiveSequence = 0;
  50210. }
  50211. }
  50212. tree.push(vm);
  50213. vm = vm.$parent;
  50214. }
  50215. return '\n\nfound in\n\n' + tree
  50216. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  50217. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  50218. : formatComponentName(vm))); })
  50219. .join('\n')
  50220. } else {
  50221. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  50222. }
  50223. };
  50224. }
  50225. /* */
  50226. var uid = 0;
  50227. /**
  50228. * A dep is an observable that can have multiple
  50229. * directives subscribing to it.
  50230. */
  50231. var Dep = function Dep () {
  50232. this.id = uid++;
  50233. this.subs = [];
  50234. };
  50235. Dep.prototype.addSub = function addSub (sub) {
  50236. this.subs.push(sub);
  50237. };
  50238. Dep.prototype.removeSub = function removeSub (sub) {
  50239. remove(this.subs, sub);
  50240. };
  50241. Dep.prototype.depend = function depend () {
  50242. if (Dep.target) {
  50243. Dep.target.addDep(this);
  50244. }
  50245. };
  50246. Dep.prototype.notify = function notify () {
  50247. // stabilize the subscriber list first
  50248. var subs = this.subs.slice();
  50249. if (!config.async) {
  50250. // subs aren't sorted in scheduler if not running async
  50251. // we need to sort them now to make sure they fire in correct
  50252. // order
  50253. subs.sort(function (a, b) { return a.id - b.id; });
  50254. }
  50255. for (var i = 0, l = subs.length; i < l; i++) {
  50256. subs[i].update();
  50257. }
  50258. };
  50259. // The current target watcher being evaluated.
  50260. // This is globally unique because only one watcher
  50261. // can be evaluated at a time.
  50262. Dep.target = null;
  50263. var targetStack = [];
  50264. function pushTarget (target) {
  50265. targetStack.push(target);
  50266. Dep.target = target;
  50267. }
  50268. function popTarget () {
  50269. targetStack.pop();
  50270. Dep.target = targetStack[targetStack.length - 1];
  50271. }
  50272. /* */
  50273. var VNode = function VNode (
  50274. tag,
  50275. data,
  50276. children,
  50277. text,
  50278. elm,
  50279. context,
  50280. componentOptions,
  50281. asyncFactory
  50282. ) {
  50283. this.tag = tag;
  50284. this.data = data;
  50285. this.children = children;
  50286. this.text = text;
  50287. this.elm = elm;
  50288. this.ns = undefined;
  50289. this.context = context;
  50290. this.fnContext = undefined;
  50291. this.fnOptions = undefined;
  50292. this.fnScopeId = undefined;
  50293. this.key = data && data.key;
  50294. this.componentOptions = componentOptions;
  50295. this.componentInstance = undefined;
  50296. this.parent = undefined;
  50297. this.raw = false;
  50298. this.isStatic = false;
  50299. this.isRootInsert = true;
  50300. this.isComment = false;
  50301. this.isCloned = false;
  50302. this.isOnce = false;
  50303. this.asyncFactory = asyncFactory;
  50304. this.asyncMeta = undefined;
  50305. this.isAsyncPlaceholder = false;
  50306. };
  50307. var prototypeAccessors = { child: { configurable: true } };
  50308. // DEPRECATED: alias for componentInstance for backwards compat.
  50309. /* istanbul ignore next */
  50310. prototypeAccessors.child.get = function () {
  50311. return this.componentInstance
  50312. };
  50313. Object.defineProperties( VNode.prototype, prototypeAccessors );
  50314. var createEmptyVNode = function (text) {
  50315. if ( text === void 0 ) text = '';
  50316. var node = new VNode();
  50317. node.text = text;
  50318. node.isComment = true;
  50319. return node
  50320. };
  50321. function createTextVNode (val) {
  50322. return new VNode(undefined, undefined, undefined, String(val))
  50323. }
  50324. // optimized shallow clone
  50325. // used for static nodes and slot nodes because they may be reused across
  50326. // multiple renders, cloning them avoids errors when DOM manipulations rely
  50327. // on their elm reference.
  50328. function cloneVNode (vnode) {
  50329. var cloned = new VNode(
  50330. vnode.tag,
  50331. vnode.data,
  50332. // #7975
  50333. // clone children array to avoid mutating original in case of cloning
  50334. // a child.
  50335. vnode.children && vnode.children.slice(),
  50336. vnode.text,
  50337. vnode.elm,
  50338. vnode.context,
  50339. vnode.componentOptions,
  50340. vnode.asyncFactory
  50341. );
  50342. cloned.ns = vnode.ns;
  50343. cloned.isStatic = vnode.isStatic;
  50344. cloned.key = vnode.key;
  50345. cloned.isComment = vnode.isComment;
  50346. cloned.fnContext = vnode.fnContext;
  50347. cloned.fnOptions = vnode.fnOptions;
  50348. cloned.fnScopeId = vnode.fnScopeId;
  50349. cloned.asyncMeta = vnode.asyncMeta;
  50350. cloned.isCloned = true;
  50351. return cloned
  50352. }
  50353. /*
  50354. * not type checking this file because flow doesn't play well with
  50355. * dynamically accessing methods on Array prototype
  50356. */
  50357. var arrayProto = Array.prototype;
  50358. var arrayMethods = Object.create(arrayProto);
  50359. var methodsToPatch = [
  50360. 'push',
  50361. 'pop',
  50362. 'shift',
  50363. 'unshift',
  50364. 'splice',
  50365. 'sort',
  50366. 'reverse'
  50367. ];
  50368. /**
  50369. * Intercept mutating methods and emit events
  50370. */
  50371. methodsToPatch.forEach(function (method) {
  50372. // cache original method
  50373. var original = arrayProto[method];
  50374. def(arrayMethods, method, function mutator () {
  50375. var args = [], len = arguments.length;
  50376. while ( len-- ) args[ len ] = arguments[ len ];
  50377. var result = original.apply(this, args);
  50378. var ob = this.__ob__;
  50379. var inserted;
  50380. switch (method) {
  50381. case 'push':
  50382. case 'unshift':
  50383. inserted = args;
  50384. break
  50385. case 'splice':
  50386. inserted = args.slice(2);
  50387. break
  50388. }
  50389. if (inserted) { ob.observeArray(inserted); }
  50390. // notify change
  50391. ob.dep.notify();
  50392. return result
  50393. });
  50394. });
  50395. /* */
  50396. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  50397. /**
  50398. * In some cases we may want to disable observation inside a component's
  50399. * update computation.
  50400. */
  50401. var shouldObserve = true;
  50402. function toggleObserving (value) {
  50403. shouldObserve = value;
  50404. }
  50405. /**
  50406. * Observer class that is attached to each observed
  50407. * object. Once attached, the observer converts the target
  50408. * object's property keys into getter/setters that
  50409. * collect dependencies and dispatch updates.
  50410. */
  50411. var Observer = function Observer (value) {
  50412. this.value = value;
  50413. this.dep = new Dep();
  50414. this.vmCount = 0;
  50415. def(value, '__ob__', this);
  50416. if (Array.isArray(value)) {
  50417. if (hasProto) {
  50418. protoAugment(value, arrayMethods);
  50419. } else {
  50420. copyAugment(value, arrayMethods, arrayKeys);
  50421. }
  50422. this.observeArray(value);
  50423. } else {
  50424. this.walk(value);
  50425. }
  50426. };
  50427. /**
  50428. * Walk through all properties and convert them into
  50429. * getter/setters. This method should only be called when
  50430. * value type is Object.
  50431. */
  50432. Observer.prototype.walk = function walk (obj) {
  50433. var keys = Object.keys(obj);
  50434. for (var i = 0; i < keys.length; i++) {
  50435. defineReactive$$1(obj, keys[i]);
  50436. }
  50437. };
  50438. /**
  50439. * Observe a list of Array items.
  50440. */
  50441. Observer.prototype.observeArray = function observeArray (items) {
  50442. for (var i = 0, l = items.length; i < l; i++) {
  50443. observe(items[i]);
  50444. }
  50445. };
  50446. // helpers
  50447. /**
  50448. * Augment a target Object or Array by intercepting
  50449. * the prototype chain using __proto__
  50450. */
  50451. function protoAugment (target, src) {
  50452. /* eslint-disable no-proto */
  50453. target.__proto__ = src;
  50454. /* eslint-enable no-proto */
  50455. }
  50456. /**
  50457. * Augment a target Object or Array by defining
  50458. * hidden properties.
  50459. */
  50460. /* istanbul ignore next */
  50461. function copyAugment (target, src, keys) {
  50462. for (var i = 0, l = keys.length; i < l; i++) {
  50463. var key = keys[i];
  50464. def(target, key, src[key]);
  50465. }
  50466. }
  50467. /**
  50468. * Attempt to create an observer instance for a value,
  50469. * returns the new observer if successfully observed,
  50470. * or the existing observer if the value already has one.
  50471. */
  50472. function observe (value, asRootData) {
  50473. if (!isObject(value) || value instanceof VNode) {
  50474. return
  50475. }
  50476. var ob;
  50477. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  50478. ob = value.__ob__;
  50479. } else if (
  50480. shouldObserve &&
  50481. !isServerRendering() &&
  50482. (Array.isArray(value) || isPlainObject(value)) &&
  50483. Object.isExtensible(value) &&
  50484. !value._isVue
  50485. ) {
  50486. ob = new Observer(value);
  50487. }
  50488. if (asRootData && ob) {
  50489. ob.vmCount++;
  50490. }
  50491. return ob
  50492. }
  50493. /**
  50494. * Define a reactive property on an Object.
  50495. */
  50496. function defineReactive$$1 (
  50497. obj,
  50498. key,
  50499. val,
  50500. customSetter,
  50501. shallow
  50502. ) {
  50503. var dep = new Dep();
  50504. var property = Object.getOwnPropertyDescriptor(obj, key);
  50505. if (property && property.configurable === false) {
  50506. return
  50507. }
  50508. // cater for pre-defined getter/setters
  50509. var getter = property && property.get;
  50510. var setter = property && property.set;
  50511. if ((!getter || setter) && arguments.length === 2) {
  50512. val = obj[key];
  50513. }
  50514. var childOb = !shallow && observe(val);
  50515. Object.defineProperty(obj, key, {
  50516. enumerable: true,
  50517. configurable: true,
  50518. get: function reactiveGetter () {
  50519. var value = getter ? getter.call(obj) : val;
  50520. if (Dep.target) {
  50521. dep.depend();
  50522. if (childOb) {
  50523. childOb.dep.depend();
  50524. if (Array.isArray(value)) {
  50525. dependArray(value);
  50526. }
  50527. }
  50528. }
  50529. return value
  50530. },
  50531. set: function reactiveSetter (newVal) {
  50532. var value = getter ? getter.call(obj) : val;
  50533. /* eslint-disable no-self-compare */
  50534. if (newVal === value || (newVal !== newVal && value !== value)) {
  50535. return
  50536. }
  50537. /* eslint-enable no-self-compare */
  50538. if (customSetter) {
  50539. customSetter();
  50540. }
  50541. // #7981: for accessor properties without setter
  50542. if (getter && !setter) { return }
  50543. if (setter) {
  50544. setter.call(obj, newVal);
  50545. } else {
  50546. val = newVal;
  50547. }
  50548. childOb = !shallow && observe(newVal);
  50549. dep.notify();
  50550. }
  50551. });
  50552. }
  50553. /**
  50554. * Set a property on an object. Adds the new property and
  50555. * triggers change notification if the property doesn't
  50556. * already exist.
  50557. */
  50558. function set (target, key, val) {
  50559. if (isUndef(target) || isPrimitive(target)
  50560. ) {
  50561. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  50562. }
  50563. if (Array.isArray(target) && isValidArrayIndex(key)) {
  50564. target.length = Math.max(target.length, key);
  50565. target.splice(key, 1, val);
  50566. return val
  50567. }
  50568. if (key in target && !(key in Object.prototype)) {
  50569. target[key] = val;
  50570. return val
  50571. }
  50572. var ob = (target).__ob__;
  50573. if (target._isVue || (ob && ob.vmCount)) {
  50574. warn(
  50575. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  50576. 'at runtime - declare it upfront in the data option.'
  50577. );
  50578. return val
  50579. }
  50580. if (!ob) {
  50581. target[key] = val;
  50582. return val
  50583. }
  50584. defineReactive$$1(ob.value, key, val);
  50585. ob.dep.notify();
  50586. return val
  50587. }
  50588. /**
  50589. * Delete a property and trigger change if necessary.
  50590. */
  50591. function del (target, key) {
  50592. if (isUndef(target) || isPrimitive(target)
  50593. ) {
  50594. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  50595. }
  50596. if (Array.isArray(target) && isValidArrayIndex(key)) {
  50597. target.splice(key, 1);
  50598. return
  50599. }
  50600. var ob = (target).__ob__;
  50601. if (target._isVue || (ob && ob.vmCount)) {
  50602. warn(
  50603. 'Avoid deleting properties on a Vue instance or its root $data ' +
  50604. '- just set it to null.'
  50605. );
  50606. return
  50607. }
  50608. if (!hasOwn(target, key)) {
  50609. return
  50610. }
  50611. delete target[key];
  50612. if (!ob) {
  50613. return
  50614. }
  50615. ob.dep.notify();
  50616. }
  50617. /**
  50618. * Collect dependencies on array elements when the array is touched, since
  50619. * we cannot intercept array element access like property getters.
  50620. */
  50621. function dependArray (value) {
  50622. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  50623. e = value[i];
  50624. e && e.__ob__ && e.__ob__.dep.depend();
  50625. if (Array.isArray(e)) {
  50626. dependArray(e);
  50627. }
  50628. }
  50629. }
  50630. /* */
  50631. /**
  50632. * Option overwriting strategies are functions that handle
  50633. * how to merge a parent option value and a child option
  50634. * value into the final value.
  50635. */
  50636. var strats = config.optionMergeStrategies;
  50637. /**
  50638. * Options with restrictions
  50639. */
  50640. {
  50641. strats.el = strats.propsData = function (parent, child, vm, key) {
  50642. if (!vm) {
  50643. warn(
  50644. "option \"" + key + "\" can only be used during instance " +
  50645. 'creation with the `new` keyword.'
  50646. );
  50647. }
  50648. return defaultStrat(parent, child)
  50649. };
  50650. }
  50651. /**
  50652. * Helper that recursively merges two data objects together.
  50653. */
  50654. function mergeData (to, from) {
  50655. if (!from) { return to }
  50656. var key, toVal, fromVal;
  50657. var keys = hasSymbol
  50658. ? Reflect.ownKeys(from)
  50659. : Object.keys(from);
  50660. for (var i = 0; i < keys.length; i++) {
  50661. key = keys[i];
  50662. // in case the object is already observed...
  50663. if (key === '__ob__') { continue }
  50664. toVal = to[key];
  50665. fromVal = from[key];
  50666. if (!hasOwn(to, key)) {
  50667. set(to, key, fromVal);
  50668. } else if (
  50669. toVal !== fromVal &&
  50670. isPlainObject(toVal) &&
  50671. isPlainObject(fromVal)
  50672. ) {
  50673. mergeData(toVal, fromVal);
  50674. }
  50675. }
  50676. return to
  50677. }
  50678. /**
  50679. * Data
  50680. */
  50681. function mergeDataOrFn (
  50682. parentVal,
  50683. childVal,
  50684. vm
  50685. ) {
  50686. if (!vm) {
  50687. // in a Vue.extend merge, both should be functions
  50688. if (!childVal) {
  50689. return parentVal
  50690. }
  50691. if (!parentVal) {
  50692. return childVal
  50693. }
  50694. // when parentVal & childVal are both present,
  50695. // we need to return a function that returns the
  50696. // merged result of both functions... no need to
  50697. // check if parentVal is a function here because
  50698. // it has to be a function to pass previous merges.
  50699. return function mergedDataFn () {
  50700. return mergeData(
  50701. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  50702. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  50703. )
  50704. }
  50705. } else {
  50706. return function mergedInstanceDataFn () {
  50707. // instance merge
  50708. var instanceData = typeof childVal === 'function'
  50709. ? childVal.call(vm, vm)
  50710. : childVal;
  50711. var defaultData = typeof parentVal === 'function'
  50712. ? parentVal.call(vm, vm)
  50713. : parentVal;
  50714. if (instanceData) {
  50715. return mergeData(instanceData, defaultData)
  50716. } else {
  50717. return defaultData
  50718. }
  50719. }
  50720. }
  50721. }
  50722. strats.data = function (
  50723. parentVal,
  50724. childVal,
  50725. vm
  50726. ) {
  50727. if (!vm) {
  50728. if (childVal && typeof childVal !== 'function') {
  50729. warn(
  50730. 'The "data" option should be a function ' +
  50731. 'that returns a per-instance value in component ' +
  50732. 'definitions.',
  50733. vm
  50734. );
  50735. return parentVal
  50736. }
  50737. return mergeDataOrFn(parentVal, childVal)
  50738. }
  50739. return mergeDataOrFn(parentVal, childVal, vm)
  50740. };
  50741. /**
  50742. * Hooks and props are merged as arrays.
  50743. */
  50744. function mergeHook (
  50745. parentVal,
  50746. childVal
  50747. ) {
  50748. var res = childVal
  50749. ? parentVal
  50750. ? parentVal.concat(childVal)
  50751. : Array.isArray(childVal)
  50752. ? childVal
  50753. : [childVal]
  50754. : parentVal;
  50755. return res
  50756. ? dedupeHooks(res)
  50757. : res
  50758. }
  50759. function dedupeHooks (hooks) {
  50760. var res = [];
  50761. for (var i = 0; i < hooks.length; i++) {
  50762. if (res.indexOf(hooks[i]) === -1) {
  50763. res.push(hooks[i]);
  50764. }
  50765. }
  50766. return res
  50767. }
  50768. LIFECYCLE_HOOKS.forEach(function (hook) {
  50769. strats[hook] = mergeHook;
  50770. });
  50771. /**
  50772. * Assets
  50773. *
  50774. * When a vm is present (instance creation), we need to do
  50775. * a three-way merge between constructor options, instance
  50776. * options and parent options.
  50777. */
  50778. function mergeAssets (
  50779. parentVal,
  50780. childVal,
  50781. vm,
  50782. key
  50783. ) {
  50784. var res = Object.create(parentVal || null);
  50785. if (childVal) {
  50786. assertObjectType(key, childVal, vm);
  50787. return extend(res, childVal)
  50788. } else {
  50789. return res
  50790. }
  50791. }
  50792. ASSET_TYPES.forEach(function (type) {
  50793. strats[type + 's'] = mergeAssets;
  50794. });
  50795. /**
  50796. * Watchers.
  50797. *
  50798. * Watchers hashes should not overwrite one
  50799. * another, so we merge them as arrays.
  50800. */
  50801. strats.watch = function (
  50802. parentVal,
  50803. childVal,
  50804. vm,
  50805. key
  50806. ) {
  50807. // work around Firefox's Object.prototype.watch...
  50808. if (parentVal === nativeWatch) { parentVal = undefined; }
  50809. if (childVal === nativeWatch) { childVal = undefined; }
  50810. /* istanbul ignore if */
  50811. if (!childVal) { return Object.create(parentVal || null) }
  50812. {
  50813. assertObjectType(key, childVal, vm);
  50814. }
  50815. if (!parentVal) { return childVal }
  50816. var ret = {};
  50817. extend(ret, parentVal);
  50818. for (var key$1 in childVal) {
  50819. var parent = ret[key$1];
  50820. var child = childVal[key$1];
  50821. if (parent && !Array.isArray(parent)) {
  50822. parent = [parent];
  50823. }
  50824. ret[key$1] = parent
  50825. ? parent.concat(child)
  50826. : Array.isArray(child) ? child : [child];
  50827. }
  50828. return ret
  50829. };
  50830. /**
  50831. * Other object hashes.
  50832. */
  50833. strats.props =
  50834. strats.methods =
  50835. strats.inject =
  50836. strats.computed = function (
  50837. parentVal,
  50838. childVal,
  50839. vm,
  50840. key
  50841. ) {
  50842. if (childVal && "development" !== 'production') {
  50843. assertObjectType(key, childVal, vm);
  50844. }
  50845. if (!parentVal) { return childVal }
  50846. var ret = Object.create(null);
  50847. extend(ret, parentVal);
  50848. if (childVal) { extend(ret, childVal); }
  50849. return ret
  50850. };
  50851. strats.provide = mergeDataOrFn;
  50852. /**
  50853. * Default strategy.
  50854. */
  50855. var defaultStrat = function (parentVal, childVal) {
  50856. return childVal === undefined
  50857. ? parentVal
  50858. : childVal
  50859. };
  50860. /**
  50861. * Validate component names
  50862. */
  50863. function checkComponents (options) {
  50864. for (var key in options.components) {
  50865. validateComponentName(key);
  50866. }
  50867. }
  50868. function validateComponentName (name) {
  50869. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  50870. warn(
  50871. 'Invalid component name: "' + name + '". Component names ' +
  50872. 'should conform to valid custom element name in html5 specification.'
  50873. );
  50874. }
  50875. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  50876. warn(
  50877. 'Do not use built-in or reserved HTML elements as component ' +
  50878. 'id: ' + name
  50879. );
  50880. }
  50881. }
  50882. /**
  50883. * Ensure all props option syntax are normalized into the
  50884. * Object-based format.
  50885. */
  50886. function normalizeProps (options, vm) {
  50887. var props = options.props;
  50888. if (!props) { return }
  50889. var res = {};
  50890. var i, val, name;
  50891. if (Array.isArray(props)) {
  50892. i = props.length;
  50893. while (i--) {
  50894. val = props[i];
  50895. if (typeof val === 'string') {
  50896. name = camelize(val);
  50897. res[name] = { type: null };
  50898. } else {
  50899. warn('props must be strings when using array syntax.');
  50900. }
  50901. }
  50902. } else if (isPlainObject(props)) {
  50903. for (var key in props) {
  50904. val = props[key];
  50905. name = camelize(key);
  50906. res[name] = isPlainObject(val)
  50907. ? val
  50908. : { type: val };
  50909. }
  50910. } else {
  50911. warn(
  50912. "Invalid value for option \"props\": expected an Array or an Object, " +
  50913. "but got " + (toRawType(props)) + ".",
  50914. vm
  50915. );
  50916. }
  50917. options.props = res;
  50918. }
  50919. /**
  50920. * Normalize all injections into Object-based format
  50921. */
  50922. function normalizeInject (options, vm) {
  50923. var inject = options.inject;
  50924. if (!inject) { return }
  50925. var normalized = options.inject = {};
  50926. if (Array.isArray(inject)) {
  50927. for (var i = 0; i < inject.length; i++) {
  50928. normalized[inject[i]] = { from: inject[i] };
  50929. }
  50930. } else if (isPlainObject(inject)) {
  50931. for (var key in inject) {
  50932. var val = inject[key];
  50933. normalized[key] = isPlainObject(val)
  50934. ? extend({ from: key }, val)
  50935. : { from: val };
  50936. }
  50937. } else {
  50938. warn(
  50939. "Invalid value for option \"inject\": expected an Array or an Object, " +
  50940. "but got " + (toRawType(inject)) + ".",
  50941. vm
  50942. );
  50943. }
  50944. }
  50945. /**
  50946. * Normalize raw function directives into object format.
  50947. */
  50948. function normalizeDirectives (options) {
  50949. var dirs = options.directives;
  50950. if (dirs) {
  50951. for (var key in dirs) {
  50952. var def$$1 = dirs[key];
  50953. if (typeof def$$1 === 'function') {
  50954. dirs[key] = { bind: def$$1, update: def$$1 };
  50955. }
  50956. }
  50957. }
  50958. }
  50959. function assertObjectType (name, value, vm) {
  50960. if (!isPlainObject(value)) {
  50961. warn(
  50962. "Invalid value for option \"" + name + "\": expected an Object, " +
  50963. "but got " + (toRawType(value)) + ".",
  50964. vm
  50965. );
  50966. }
  50967. }
  50968. /**
  50969. * Merge two option objects into a new one.
  50970. * Core utility used in both instantiation and inheritance.
  50971. */
  50972. function mergeOptions (
  50973. parent,
  50974. child,
  50975. vm
  50976. ) {
  50977. {
  50978. checkComponents(child);
  50979. }
  50980. if (typeof child === 'function') {
  50981. child = child.options;
  50982. }
  50983. normalizeProps(child, vm);
  50984. normalizeInject(child, vm);
  50985. normalizeDirectives(child);
  50986. // Apply extends and mixins on the child options,
  50987. // but only if it is a raw options object that isn't
  50988. // the result of another mergeOptions call.
  50989. // Only merged options has the _base property.
  50990. if (!child._base) {
  50991. if (child.extends) {
  50992. parent = mergeOptions(parent, child.extends, vm);
  50993. }
  50994. if (child.mixins) {
  50995. for (var i = 0, l = child.mixins.length; i < l; i++) {
  50996. parent = mergeOptions(parent, child.mixins[i], vm);
  50997. }
  50998. }
  50999. }
  51000. var options = {};
  51001. var key;
  51002. for (key in parent) {
  51003. mergeField(key);
  51004. }
  51005. for (key in child) {
  51006. if (!hasOwn(parent, key)) {
  51007. mergeField(key);
  51008. }
  51009. }
  51010. function mergeField (key) {
  51011. var strat = strats[key] || defaultStrat;
  51012. options[key] = strat(parent[key], child[key], vm, key);
  51013. }
  51014. return options
  51015. }
  51016. /**
  51017. * Resolve an asset.
  51018. * This function is used because child instances need access
  51019. * to assets defined in its ancestor chain.
  51020. */
  51021. function resolveAsset (
  51022. options,
  51023. type,
  51024. id,
  51025. warnMissing
  51026. ) {
  51027. /* istanbul ignore if */
  51028. if (typeof id !== 'string') {
  51029. return
  51030. }
  51031. var assets = options[type];
  51032. // check local registration variations first
  51033. if (hasOwn(assets, id)) { return assets[id] }
  51034. var camelizedId = camelize(id);
  51035. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  51036. var PascalCaseId = capitalize(camelizedId);
  51037. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  51038. // fallback to prototype chain
  51039. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  51040. if (warnMissing && !res) {
  51041. warn(
  51042. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  51043. options
  51044. );
  51045. }
  51046. return res
  51047. }
  51048. /* */
  51049. function validateProp (
  51050. key,
  51051. propOptions,
  51052. propsData,
  51053. vm
  51054. ) {
  51055. var prop = propOptions[key];
  51056. var absent = !hasOwn(propsData, key);
  51057. var value = propsData[key];
  51058. // boolean casting
  51059. var booleanIndex = getTypeIndex(Boolean, prop.type);
  51060. if (booleanIndex > -1) {
  51061. if (absent && !hasOwn(prop, 'default')) {
  51062. value = false;
  51063. } else if (value === '' || value === hyphenate(key)) {
  51064. // only cast empty string / same name to boolean if
  51065. // boolean has higher priority
  51066. var stringIndex = getTypeIndex(String, prop.type);
  51067. if (stringIndex < 0 || booleanIndex < stringIndex) {
  51068. value = true;
  51069. }
  51070. }
  51071. }
  51072. // check default value
  51073. if (value === undefined) {
  51074. value = getPropDefaultValue(vm, prop, key);
  51075. // since the default value is a fresh copy,
  51076. // make sure to observe it.
  51077. var prevShouldObserve = shouldObserve;
  51078. toggleObserving(true);
  51079. observe(value);
  51080. toggleObserving(prevShouldObserve);
  51081. }
  51082. {
  51083. assertProp(prop, key, value, vm, absent);
  51084. }
  51085. return value
  51086. }
  51087. /**
  51088. * Get the default value of a prop.
  51089. */
  51090. function getPropDefaultValue (vm, prop, key) {
  51091. // no default, return undefined
  51092. if (!hasOwn(prop, 'default')) {
  51093. return undefined
  51094. }
  51095. var def = prop.default;
  51096. // warn against non-factory defaults for Object & Array
  51097. if (isObject(def)) {
  51098. warn(
  51099. 'Invalid default value for prop "' + key + '": ' +
  51100. 'Props with type Object/Array must use a factory function ' +
  51101. 'to return the default value.',
  51102. vm
  51103. );
  51104. }
  51105. // the raw prop value was also undefined from previous render,
  51106. // return previous default value to avoid unnecessary watcher trigger
  51107. if (vm && vm.$options.propsData &&
  51108. vm.$options.propsData[key] === undefined &&
  51109. vm._props[key] !== undefined
  51110. ) {
  51111. return vm._props[key]
  51112. }
  51113. // call factory function for non-Function types
  51114. // a value is Function if its prototype is function even across different execution context
  51115. return typeof def === 'function' && getType(prop.type) !== 'Function'
  51116. ? def.call(vm)
  51117. : def
  51118. }
  51119. /**
  51120. * Assert whether a prop is valid.
  51121. */
  51122. function assertProp (
  51123. prop,
  51124. name,
  51125. value,
  51126. vm,
  51127. absent
  51128. ) {
  51129. if (prop.required && absent) {
  51130. warn(
  51131. 'Missing required prop: "' + name + '"',
  51132. vm
  51133. );
  51134. return
  51135. }
  51136. if (value == null && !prop.required) {
  51137. return
  51138. }
  51139. var type = prop.type;
  51140. var valid = !type || type === true;
  51141. var expectedTypes = [];
  51142. if (type) {
  51143. if (!Array.isArray(type)) {
  51144. type = [type];
  51145. }
  51146. for (var i = 0; i < type.length && !valid; i++) {
  51147. var assertedType = assertType(value, type[i]);
  51148. expectedTypes.push(assertedType.expectedType || '');
  51149. valid = assertedType.valid;
  51150. }
  51151. }
  51152. if (!valid) {
  51153. warn(
  51154. getInvalidTypeMessage(name, value, expectedTypes),
  51155. vm
  51156. );
  51157. return
  51158. }
  51159. var validator = prop.validator;
  51160. if (validator) {
  51161. if (!validator(value)) {
  51162. warn(
  51163. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  51164. vm
  51165. );
  51166. }
  51167. }
  51168. }
  51169. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  51170. function assertType (value, type) {
  51171. var valid;
  51172. var expectedType = getType(type);
  51173. if (simpleCheckRE.test(expectedType)) {
  51174. var t = typeof value;
  51175. valid = t === expectedType.toLowerCase();
  51176. // for primitive wrapper objects
  51177. if (!valid && t === 'object') {
  51178. valid = value instanceof type;
  51179. }
  51180. } else if (expectedType === 'Object') {
  51181. valid = isPlainObject(value);
  51182. } else if (expectedType === 'Array') {
  51183. valid = Array.isArray(value);
  51184. } else {
  51185. valid = value instanceof type;
  51186. }
  51187. return {
  51188. valid: valid,
  51189. expectedType: expectedType
  51190. }
  51191. }
  51192. /**
  51193. * Use function string name to check built-in types,
  51194. * because a simple equality check will fail when running
  51195. * across different vms / iframes.
  51196. */
  51197. function getType (fn) {
  51198. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  51199. return match ? match[1] : ''
  51200. }
  51201. function isSameType (a, b) {
  51202. return getType(a) === getType(b)
  51203. }
  51204. function getTypeIndex (type, expectedTypes) {
  51205. if (!Array.isArray(expectedTypes)) {
  51206. return isSameType(expectedTypes, type) ? 0 : -1
  51207. }
  51208. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  51209. if (isSameType(expectedTypes[i], type)) {
  51210. return i
  51211. }
  51212. }
  51213. return -1
  51214. }
  51215. function getInvalidTypeMessage (name, value, expectedTypes) {
  51216. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  51217. " Expected " + (expectedTypes.map(capitalize).join(', '));
  51218. var expectedType = expectedTypes[0];
  51219. var receivedType = toRawType(value);
  51220. var expectedValue = styleValue(value, expectedType);
  51221. var receivedValue = styleValue(value, receivedType);
  51222. // check if we need to specify expected value
  51223. if (expectedTypes.length === 1 &&
  51224. isExplicable(expectedType) &&
  51225. !isBoolean(expectedType, receivedType)) {
  51226. message += " with value " + expectedValue;
  51227. }
  51228. message += ", got " + receivedType + " ";
  51229. // check if we need to specify received value
  51230. if (isExplicable(receivedType)) {
  51231. message += "with value " + receivedValue + ".";
  51232. }
  51233. return message
  51234. }
  51235. function styleValue (value, type) {
  51236. if (type === 'String') {
  51237. return ("\"" + value + "\"")
  51238. } else if (type === 'Number') {
  51239. return ("" + (Number(value)))
  51240. } else {
  51241. return ("" + value)
  51242. }
  51243. }
  51244. function isExplicable (value) {
  51245. var explicitTypes = ['string', 'number', 'boolean'];
  51246. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  51247. }
  51248. function isBoolean () {
  51249. var args = [], len = arguments.length;
  51250. while ( len-- ) args[ len ] = arguments[ len ];
  51251. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  51252. }
  51253. /* */
  51254. function handleError (err, vm, info) {
  51255. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  51256. // See: https://github.com/vuejs/vuex/issues/1505
  51257. pushTarget();
  51258. try {
  51259. if (vm) {
  51260. var cur = vm;
  51261. while ((cur = cur.$parent)) {
  51262. var hooks = cur.$options.errorCaptured;
  51263. if (hooks) {
  51264. for (var i = 0; i < hooks.length; i++) {
  51265. try {
  51266. var capture = hooks[i].call(cur, err, vm, info) === false;
  51267. if (capture) { return }
  51268. } catch (e) {
  51269. globalHandleError(e, cur, 'errorCaptured hook');
  51270. }
  51271. }
  51272. }
  51273. }
  51274. }
  51275. globalHandleError(err, vm, info);
  51276. } finally {
  51277. popTarget();
  51278. }
  51279. }
  51280. function invokeWithErrorHandling (
  51281. handler,
  51282. context,
  51283. args,
  51284. vm,
  51285. info
  51286. ) {
  51287. var res;
  51288. try {
  51289. res = args ? handler.apply(context, args) : handler.call(context);
  51290. if (res && !res._isVue && isPromise(res) && !res._handled) {
  51291. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  51292. // issue #9511
  51293. // avoid catch triggering multiple times when nested calls
  51294. res._handled = true;
  51295. }
  51296. } catch (e) {
  51297. handleError(e, vm, info);
  51298. }
  51299. return res
  51300. }
  51301. function globalHandleError (err, vm, info) {
  51302. if (config.errorHandler) {
  51303. try {
  51304. return config.errorHandler.call(null, err, vm, info)
  51305. } catch (e) {
  51306. // if the user intentionally throws the original error in the handler,
  51307. // do not log it twice
  51308. if (e !== err) {
  51309. logError(e, null, 'config.errorHandler');
  51310. }
  51311. }
  51312. }
  51313. logError(err, vm, info);
  51314. }
  51315. function logError (err, vm, info) {
  51316. {
  51317. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  51318. }
  51319. /* istanbul ignore else */
  51320. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  51321. console.error(err);
  51322. } else {
  51323. throw err
  51324. }
  51325. }
  51326. /* */
  51327. var isUsingMicroTask = false;
  51328. var callbacks = [];
  51329. var pending = false;
  51330. function flushCallbacks () {
  51331. pending = false;
  51332. var copies = callbacks.slice(0);
  51333. callbacks.length = 0;
  51334. for (var i = 0; i < copies.length; i++) {
  51335. copies[i]();
  51336. }
  51337. }
  51338. // Here we have async deferring wrappers using microtasks.
  51339. // In 2.5 we used (macro) tasks (in combination with microtasks).
  51340. // However, it has subtle problems when state is changed right before repaint
  51341. // (e.g. #6813, out-in transitions).
  51342. // Also, using (macro) tasks in event handler would cause some weird behaviors
  51343. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  51344. // So we now use microtasks everywhere, again.
  51345. // A major drawback of this tradeoff is that there are some scenarios
  51346. // where microtasks have too high a priority and fire in between supposedly
  51347. // sequential events (e.g. #4521, #6690, which have workarounds)
  51348. // or even between bubbling of the same event (#6566).
  51349. var timerFunc;
  51350. // The nextTick behavior leverages the microtask queue, which can be accessed
  51351. // via either native Promise.then or MutationObserver.
  51352. // MutationObserver has wider support, however it is seriously bugged in
  51353. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  51354. // completely stops working after triggering a few times... so, if native
  51355. // Promise is available, we will use it:
  51356. /* istanbul ignore next, $flow-disable-line */
  51357. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  51358. var p = Promise.resolve();
  51359. timerFunc = function () {
  51360. p.then(flushCallbacks);
  51361. // In problematic UIWebViews, Promise.then doesn't completely break, but
  51362. // it can get stuck in a weird state where callbacks are pushed into the
  51363. // microtask queue but the queue isn't being flushed, until the browser
  51364. // needs to do some other work, e.g. handle a timer. Therefore we can
  51365. // "force" the microtask queue to be flushed by adding an empty timer.
  51366. if (isIOS) { setTimeout(noop); }
  51367. };
  51368. isUsingMicroTask = true;
  51369. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  51370. isNative(MutationObserver) ||
  51371. // PhantomJS and iOS 7.x
  51372. MutationObserver.toString() === '[object MutationObserverConstructor]'
  51373. )) {
  51374. // Use MutationObserver where native Promise is not available,
  51375. // e.g. PhantomJS, iOS7, Android 4.4
  51376. // (#6466 MutationObserver is unreliable in IE11)
  51377. var counter = 1;
  51378. var observer = new MutationObserver(flushCallbacks);
  51379. var textNode = document.createTextNode(String(counter));
  51380. observer.observe(textNode, {
  51381. characterData: true
  51382. });
  51383. timerFunc = function () {
  51384. counter = (counter + 1) % 2;
  51385. textNode.data = String(counter);
  51386. };
  51387. isUsingMicroTask = true;
  51388. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  51389. // Fallback to setImmediate.
  51390. // Technically it leverages the (macro) task queue,
  51391. // but it is still a better choice than setTimeout.
  51392. timerFunc = function () {
  51393. setImmediate(flushCallbacks);
  51394. };
  51395. } else {
  51396. // Fallback to setTimeout.
  51397. timerFunc = function () {
  51398. setTimeout(flushCallbacks, 0);
  51399. };
  51400. }
  51401. function nextTick (cb, ctx) {
  51402. var _resolve;
  51403. callbacks.push(function () {
  51404. if (cb) {
  51405. try {
  51406. cb.call(ctx);
  51407. } catch (e) {
  51408. handleError(e, ctx, 'nextTick');
  51409. }
  51410. } else if (_resolve) {
  51411. _resolve(ctx);
  51412. }
  51413. });
  51414. if (!pending) {
  51415. pending = true;
  51416. timerFunc();
  51417. }
  51418. // $flow-disable-line
  51419. if (!cb && typeof Promise !== 'undefined') {
  51420. return new Promise(function (resolve) {
  51421. _resolve = resolve;
  51422. })
  51423. }
  51424. }
  51425. /* */
  51426. var mark;
  51427. var measure;
  51428. {
  51429. var perf = inBrowser && window.performance;
  51430. /* istanbul ignore if */
  51431. if (
  51432. perf &&
  51433. perf.mark &&
  51434. perf.measure &&
  51435. perf.clearMarks &&
  51436. perf.clearMeasures
  51437. ) {
  51438. mark = function (tag) { return perf.mark(tag); };
  51439. measure = function (name, startTag, endTag) {
  51440. perf.measure(name, startTag, endTag);
  51441. perf.clearMarks(startTag);
  51442. perf.clearMarks(endTag);
  51443. // perf.clearMeasures(name)
  51444. };
  51445. }
  51446. }
  51447. /* not type checking this file because flow doesn't play well with Proxy */
  51448. var initProxy;
  51449. {
  51450. var allowedGlobals = makeMap(
  51451. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  51452. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  51453. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  51454. 'require' // for Webpack/Browserify
  51455. );
  51456. var warnNonPresent = function (target, key) {
  51457. warn(
  51458. "Property or method \"" + key + "\" is not defined on the instance but " +
  51459. 'referenced during render. Make sure that this property is reactive, ' +
  51460. 'either in the data option, or for class-based components, by ' +
  51461. 'initializing the property. ' +
  51462. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  51463. target
  51464. );
  51465. };
  51466. var warnReservedPrefix = function (target, key) {
  51467. warn(
  51468. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  51469. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  51470. 'prevent conflicts with Vue internals. ' +
  51471. 'See: https://vuejs.org/v2/api/#data',
  51472. target
  51473. );
  51474. };
  51475. var hasProxy =
  51476. typeof Proxy !== 'undefined' && isNative(Proxy);
  51477. if (hasProxy) {
  51478. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  51479. config.keyCodes = new Proxy(config.keyCodes, {
  51480. set: function set (target, key, value) {
  51481. if (isBuiltInModifier(key)) {
  51482. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  51483. return false
  51484. } else {
  51485. target[key] = value;
  51486. return true
  51487. }
  51488. }
  51489. });
  51490. }
  51491. var hasHandler = {
  51492. has: function has (target, key) {
  51493. var has = key in target;
  51494. var isAllowed = allowedGlobals(key) ||
  51495. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  51496. if (!has && !isAllowed) {
  51497. if (key in target.$data) { warnReservedPrefix(target, key); }
  51498. else { warnNonPresent(target, key); }
  51499. }
  51500. return has || !isAllowed
  51501. }
  51502. };
  51503. var getHandler = {
  51504. get: function get (target, key) {
  51505. if (typeof key === 'string' && !(key in target)) {
  51506. if (key in target.$data) { warnReservedPrefix(target, key); }
  51507. else { warnNonPresent(target, key); }
  51508. }
  51509. return target[key]
  51510. }
  51511. };
  51512. initProxy = function initProxy (vm) {
  51513. if (hasProxy) {
  51514. // determine which proxy handler to use
  51515. var options = vm.$options;
  51516. var handlers = options.render && options.render._withStripped
  51517. ? getHandler
  51518. : hasHandler;
  51519. vm._renderProxy = new Proxy(vm, handlers);
  51520. } else {
  51521. vm._renderProxy = vm;
  51522. }
  51523. };
  51524. }
  51525. /* */
  51526. var seenObjects = new _Set();
  51527. /**
  51528. * Recursively traverse an object to evoke all converted
  51529. * getters, so that every nested property inside the object
  51530. * is collected as a "deep" dependency.
  51531. */
  51532. function traverse (val) {
  51533. _traverse(val, seenObjects);
  51534. seenObjects.clear();
  51535. }
  51536. function _traverse (val, seen) {
  51537. var i, keys;
  51538. var isA = Array.isArray(val);
  51539. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  51540. return
  51541. }
  51542. if (val.__ob__) {
  51543. var depId = val.__ob__.dep.id;
  51544. if (seen.has(depId)) {
  51545. return
  51546. }
  51547. seen.add(depId);
  51548. }
  51549. if (isA) {
  51550. i = val.length;
  51551. while (i--) { _traverse(val[i], seen); }
  51552. } else {
  51553. keys = Object.keys(val);
  51554. i = keys.length;
  51555. while (i--) { _traverse(val[keys[i]], seen); }
  51556. }
  51557. }
  51558. /* */
  51559. var normalizeEvent = cached(function (name) {
  51560. var passive = name.charAt(0) === '&';
  51561. name = passive ? name.slice(1) : name;
  51562. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  51563. name = once$$1 ? name.slice(1) : name;
  51564. var capture = name.charAt(0) === '!';
  51565. name = capture ? name.slice(1) : name;
  51566. return {
  51567. name: name,
  51568. once: once$$1,
  51569. capture: capture,
  51570. passive: passive
  51571. }
  51572. });
  51573. function createFnInvoker (fns, vm) {
  51574. function invoker () {
  51575. var arguments$1 = arguments;
  51576. var fns = invoker.fns;
  51577. if (Array.isArray(fns)) {
  51578. var cloned = fns.slice();
  51579. for (var i = 0; i < cloned.length; i++) {
  51580. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  51581. }
  51582. } else {
  51583. // return handler return value for single handlers
  51584. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  51585. }
  51586. }
  51587. invoker.fns = fns;
  51588. return invoker
  51589. }
  51590. function updateListeners (
  51591. on,
  51592. oldOn,
  51593. add,
  51594. remove$$1,
  51595. createOnceHandler,
  51596. vm
  51597. ) {
  51598. var name, def$$1, cur, old, event;
  51599. for (name in on) {
  51600. def$$1 = cur = on[name];
  51601. old = oldOn[name];
  51602. event = normalizeEvent(name);
  51603. if (isUndef(cur)) {
  51604. warn(
  51605. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  51606. vm
  51607. );
  51608. } else if (isUndef(old)) {
  51609. if (isUndef(cur.fns)) {
  51610. cur = on[name] = createFnInvoker(cur, vm);
  51611. }
  51612. if (isTrue(event.once)) {
  51613. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  51614. }
  51615. add(event.name, cur, event.capture, event.passive, event.params);
  51616. } else if (cur !== old) {
  51617. old.fns = cur;
  51618. on[name] = old;
  51619. }
  51620. }
  51621. for (name in oldOn) {
  51622. if (isUndef(on[name])) {
  51623. event = normalizeEvent(name);
  51624. remove$$1(event.name, oldOn[name], event.capture);
  51625. }
  51626. }
  51627. }
  51628. /* */
  51629. function mergeVNodeHook (def, hookKey, hook) {
  51630. if (def instanceof VNode) {
  51631. def = def.data.hook || (def.data.hook = {});
  51632. }
  51633. var invoker;
  51634. var oldHook = def[hookKey];
  51635. function wrappedHook () {
  51636. hook.apply(this, arguments);
  51637. // important: remove merged hook to ensure it's called only once
  51638. // and prevent memory leak
  51639. remove(invoker.fns, wrappedHook);
  51640. }
  51641. if (isUndef(oldHook)) {
  51642. // no existing hook
  51643. invoker = createFnInvoker([wrappedHook]);
  51644. } else {
  51645. /* istanbul ignore if */
  51646. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  51647. // already a merged invoker
  51648. invoker = oldHook;
  51649. invoker.fns.push(wrappedHook);
  51650. } else {
  51651. // existing plain hook
  51652. invoker = createFnInvoker([oldHook, wrappedHook]);
  51653. }
  51654. }
  51655. invoker.merged = true;
  51656. def[hookKey] = invoker;
  51657. }
  51658. /* */
  51659. function extractPropsFromVNodeData (
  51660. data,
  51661. Ctor,
  51662. tag
  51663. ) {
  51664. // we are only extracting raw values here.
  51665. // validation and default values are handled in the child
  51666. // component itself.
  51667. var propOptions = Ctor.options.props;
  51668. if (isUndef(propOptions)) {
  51669. return
  51670. }
  51671. var res = {};
  51672. var attrs = data.attrs;
  51673. var props = data.props;
  51674. if (isDef(attrs) || isDef(props)) {
  51675. for (var key in propOptions) {
  51676. var altKey = hyphenate(key);
  51677. {
  51678. var keyInLowerCase = key.toLowerCase();
  51679. if (
  51680. key !== keyInLowerCase &&
  51681. attrs && hasOwn(attrs, keyInLowerCase)
  51682. ) {
  51683. tip(
  51684. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  51685. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  51686. " \"" + key + "\". " +
  51687. "Note that HTML attributes are case-insensitive and camelCased " +
  51688. "props need to use their kebab-case equivalents when using in-DOM " +
  51689. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  51690. );
  51691. }
  51692. }
  51693. checkProp(res, props, key, altKey, true) ||
  51694. checkProp(res, attrs, key, altKey, false);
  51695. }
  51696. }
  51697. return res
  51698. }
  51699. function checkProp (
  51700. res,
  51701. hash,
  51702. key,
  51703. altKey,
  51704. preserve
  51705. ) {
  51706. if (isDef(hash)) {
  51707. if (hasOwn(hash, key)) {
  51708. res[key] = hash[key];
  51709. if (!preserve) {
  51710. delete hash[key];
  51711. }
  51712. return true
  51713. } else if (hasOwn(hash, altKey)) {
  51714. res[key] = hash[altKey];
  51715. if (!preserve) {
  51716. delete hash[altKey];
  51717. }
  51718. return true
  51719. }
  51720. }
  51721. return false
  51722. }
  51723. /* */
  51724. // The template compiler attempts to minimize the need for normalization by
  51725. // statically analyzing the template at compile time.
  51726. //
  51727. // For plain HTML markup, normalization can be completely skipped because the
  51728. // generated render function is guaranteed to return Array<VNode>. There are
  51729. // two cases where extra normalization is needed:
  51730. // 1. When the children contains components - because a functional component
  51731. // may return an Array instead of a single root. In this case, just a simple
  51732. // normalization is needed - if any child is an Array, we flatten the whole
  51733. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  51734. // because functional components already normalize their own children.
  51735. function simpleNormalizeChildren (children) {
  51736. for (var i = 0; i < children.length; i++) {
  51737. if (Array.isArray(children[i])) {
  51738. return Array.prototype.concat.apply([], children)
  51739. }
  51740. }
  51741. return children
  51742. }
  51743. // 2. When the children contains constructs that always generated nested Arrays,
  51744. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  51745. // with hand-written render functions / JSX. In such cases a full normalization
  51746. // is needed to cater to all possible types of children values.
  51747. function normalizeChildren (children) {
  51748. return isPrimitive(children)
  51749. ? [createTextVNode(children)]
  51750. : Array.isArray(children)
  51751. ? normalizeArrayChildren(children)
  51752. : undefined
  51753. }
  51754. function isTextNode (node) {
  51755. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  51756. }
  51757. function normalizeArrayChildren (children, nestedIndex) {
  51758. var res = [];
  51759. var i, c, lastIndex, last;
  51760. for (i = 0; i < children.length; i++) {
  51761. c = children[i];
  51762. if (isUndef(c) || typeof c === 'boolean') { continue }
  51763. lastIndex = res.length - 1;
  51764. last = res[lastIndex];
  51765. // nested
  51766. if (Array.isArray(c)) {
  51767. if (c.length > 0) {
  51768. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  51769. // merge adjacent text nodes
  51770. if (isTextNode(c[0]) && isTextNode(last)) {
  51771. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  51772. c.shift();
  51773. }
  51774. res.push.apply(res, c);
  51775. }
  51776. } else if (isPrimitive(c)) {
  51777. if (isTextNode(last)) {
  51778. // merge adjacent text nodes
  51779. // this is necessary for SSR hydration because text nodes are
  51780. // essentially merged when rendered to HTML strings
  51781. res[lastIndex] = createTextVNode(last.text + c);
  51782. } else if (c !== '') {
  51783. // convert primitive to vnode
  51784. res.push(createTextVNode(c));
  51785. }
  51786. } else {
  51787. if (isTextNode(c) && isTextNode(last)) {
  51788. // merge adjacent text nodes
  51789. res[lastIndex] = createTextVNode(last.text + c.text);
  51790. } else {
  51791. // default key for nested array children (likely generated by v-for)
  51792. if (isTrue(children._isVList) &&
  51793. isDef(c.tag) &&
  51794. isUndef(c.key) &&
  51795. isDef(nestedIndex)) {
  51796. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  51797. }
  51798. res.push(c);
  51799. }
  51800. }
  51801. }
  51802. return res
  51803. }
  51804. /* */
  51805. function initProvide (vm) {
  51806. var provide = vm.$options.provide;
  51807. if (provide) {
  51808. vm._provided = typeof provide === 'function'
  51809. ? provide.call(vm)
  51810. : provide;
  51811. }
  51812. }
  51813. function initInjections (vm) {
  51814. var result = resolveInject(vm.$options.inject, vm);
  51815. if (result) {
  51816. toggleObserving(false);
  51817. Object.keys(result).forEach(function (key) {
  51818. /* istanbul ignore else */
  51819. {
  51820. defineReactive$$1(vm, key, result[key], function () {
  51821. warn(
  51822. "Avoid mutating an injected value directly since the changes will be " +
  51823. "overwritten whenever the provided component re-renders. " +
  51824. "injection being mutated: \"" + key + "\"",
  51825. vm
  51826. );
  51827. });
  51828. }
  51829. });
  51830. toggleObserving(true);
  51831. }
  51832. }
  51833. function resolveInject (inject, vm) {
  51834. if (inject) {
  51835. // inject is :any because flow is not smart enough to figure out cached
  51836. var result = Object.create(null);
  51837. var keys = hasSymbol
  51838. ? Reflect.ownKeys(inject)
  51839. : Object.keys(inject);
  51840. for (var i = 0; i < keys.length; i++) {
  51841. var key = keys[i];
  51842. // #6574 in case the inject object is observed...
  51843. if (key === '__ob__') { continue }
  51844. var provideKey = inject[key].from;
  51845. var source = vm;
  51846. while (source) {
  51847. if (source._provided && hasOwn(source._provided, provideKey)) {
  51848. result[key] = source._provided[provideKey];
  51849. break
  51850. }
  51851. source = source.$parent;
  51852. }
  51853. if (!source) {
  51854. if ('default' in inject[key]) {
  51855. var provideDefault = inject[key].default;
  51856. result[key] = typeof provideDefault === 'function'
  51857. ? provideDefault.call(vm)
  51858. : provideDefault;
  51859. } else {
  51860. warn(("Injection \"" + key + "\" not found"), vm);
  51861. }
  51862. }
  51863. }
  51864. return result
  51865. }
  51866. }
  51867. /* */
  51868. /**
  51869. * Runtime helper for resolving raw children VNodes into a slot object.
  51870. */
  51871. function resolveSlots (
  51872. children,
  51873. context
  51874. ) {
  51875. if (!children || !children.length) {
  51876. return {}
  51877. }
  51878. var slots = {};
  51879. for (var i = 0, l = children.length; i < l; i++) {
  51880. var child = children[i];
  51881. var data = child.data;
  51882. // remove slot attribute if the node is resolved as a Vue slot node
  51883. if (data && data.attrs && data.attrs.slot) {
  51884. delete data.attrs.slot;
  51885. }
  51886. // named slots should only be respected if the vnode was rendered in the
  51887. // same context.
  51888. if ((child.context === context || child.fnContext === context) &&
  51889. data && data.slot != null
  51890. ) {
  51891. var name = data.slot;
  51892. var slot = (slots[name] || (slots[name] = []));
  51893. if (child.tag === 'template') {
  51894. slot.push.apply(slot, child.children || []);
  51895. } else {
  51896. slot.push(child);
  51897. }
  51898. } else {
  51899. (slots.default || (slots.default = [])).push(child);
  51900. }
  51901. }
  51902. // ignore slots that contains only whitespace
  51903. for (var name$1 in slots) {
  51904. if (slots[name$1].every(isWhitespace)) {
  51905. delete slots[name$1];
  51906. }
  51907. }
  51908. return slots
  51909. }
  51910. function isWhitespace (node) {
  51911. return (node.isComment && !node.asyncFactory) || node.text === ' '
  51912. }
  51913. /* */
  51914. function normalizeScopedSlots (
  51915. slots,
  51916. normalSlots,
  51917. prevSlots
  51918. ) {
  51919. var res;
  51920. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  51921. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  51922. var key = slots && slots.$key;
  51923. if (!slots) {
  51924. res = {};
  51925. } else if (slots._normalized) {
  51926. // fast path 1: child component re-render only, parent did not change
  51927. return slots._normalized
  51928. } else if (
  51929. isStable &&
  51930. prevSlots &&
  51931. prevSlots !== emptyObject &&
  51932. key === prevSlots.$key &&
  51933. !hasNormalSlots &&
  51934. !prevSlots.$hasNormal
  51935. ) {
  51936. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  51937. // only need to normalize once
  51938. return prevSlots
  51939. } else {
  51940. res = {};
  51941. for (var key$1 in slots) {
  51942. if (slots[key$1] && key$1[0] !== '$') {
  51943. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  51944. }
  51945. }
  51946. }
  51947. // expose normal slots on scopedSlots
  51948. for (var key$2 in normalSlots) {
  51949. if (!(key$2 in res)) {
  51950. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  51951. }
  51952. }
  51953. // avoriaz seems to mock a non-extensible $scopedSlots object
  51954. // and when that is passed down this would cause an error
  51955. if (slots && Object.isExtensible(slots)) {
  51956. (slots)._normalized = res;
  51957. }
  51958. def(res, '$stable', isStable);
  51959. def(res, '$key', key);
  51960. def(res, '$hasNormal', hasNormalSlots);
  51961. return res
  51962. }
  51963. function normalizeScopedSlot(normalSlots, key, fn) {
  51964. var normalized = function () {
  51965. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  51966. res = res && typeof res === 'object' && !Array.isArray(res)
  51967. ? [res] // single vnode
  51968. : normalizeChildren(res);
  51969. return res && (
  51970. res.length === 0 ||
  51971. (res.length === 1 && res[0].isComment) // #9658
  51972. ) ? undefined
  51973. : res
  51974. };
  51975. // this is a slot using the new v-slot syntax without scope. although it is
  51976. // compiled as a scoped slot, render fn users would expect it to be present
  51977. // on this.$slots because the usage is semantically a normal slot.
  51978. if (fn.proxy) {
  51979. Object.defineProperty(normalSlots, key, {
  51980. get: normalized,
  51981. enumerable: true,
  51982. configurable: true
  51983. });
  51984. }
  51985. return normalized
  51986. }
  51987. function proxyNormalSlot(slots, key) {
  51988. return function () { return slots[key]; }
  51989. }
  51990. /* */
  51991. /**
  51992. * Runtime helper for rendering v-for lists.
  51993. */
  51994. function renderList (
  51995. val,
  51996. render
  51997. ) {
  51998. var ret, i, l, keys, key;
  51999. if (Array.isArray(val) || typeof val === 'string') {
  52000. ret = new Array(val.length);
  52001. for (i = 0, l = val.length; i < l; i++) {
  52002. ret[i] = render(val[i], i);
  52003. }
  52004. } else if (typeof val === 'number') {
  52005. ret = new Array(val);
  52006. for (i = 0; i < val; i++) {
  52007. ret[i] = render(i + 1, i);
  52008. }
  52009. } else if (isObject(val)) {
  52010. if (hasSymbol && val[Symbol.iterator]) {
  52011. ret = [];
  52012. var iterator = val[Symbol.iterator]();
  52013. var result = iterator.next();
  52014. while (!result.done) {
  52015. ret.push(render(result.value, ret.length));
  52016. result = iterator.next();
  52017. }
  52018. } else {
  52019. keys = Object.keys(val);
  52020. ret = new Array(keys.length);
  52021. for (i = 0, l = keys.length; i < l; i++) {
  52022. key = keys[i];
  52023. ret[i] = render(val[key], key, i);
  52024. }
  52025. }
  52026. }
  52027. if (!isDef(ret)) {
  52028. ret = [];
  52029. }
  52030. (ret)._isVList = true;
  52031. return ret
  52032. }
  52033. /* */
  52034. /**
  52035. * Runtime helper for rendering <slot>
  52036. */
  52037. function renderSlot (
  52038. name,
  52039. fallback,
  52040. props,
  52041. bindObject
  52042. ) {
  52043. var scopedSlotFn = this.$scopedSlots[name];
  52044. var nodes;
  52045. if (scopedSlotFn) { // scoped slot
  52046. props = props || {};
  52047. if (bindObject) {
  52048. if (!isObject(bindObject)) {
  52049. warn(
  52050. 'slot v-bind without argument expects an Object',
  52051. this
  52052. );
  52053. }
  52054. props = extend(extend({}, bindObject), props);
  52055. }
  52056. nodes = scopedSlotFn(props) || fallback;
  52057. } else {
  52058. nodes = this.$slots[name] || fallback;
  52059. }
  52060. var target = props && props.slot;
  52061. if (target) {
  52062. return this.$createElement('template', { slot: target }, nodes)
  52063. } else {
  52064. return nodes
  52065. }
  52066. }
  52067. /* */
  52068. /**
  52069. * Runtime helper for resolving filters
  52070. */
  52071. function resolveFilter (id) {
  52072. return resolveAsset(this.$options, 'filters', id, true) || identity
  52073. }
  52074. /* */
  52075. function isKeyNotMatch (expect, actual) {
  52076. if (Array.isArray(expect)) {
  52077. return expect.indexOf(actual) === -1
  52078. } else {
  52079. return expect !== actual
  52080. }
  52081. }
  52082. /**
  52083. * Runtime helper for checking keyCodes from config.
  52084. * exposed as Vue.prototype._k
  52085. * passing in eventKeyName as last argument separately for backwards compat
  52086. */
  52087. function checkKeyCodes (
  52088. eventKeyCode,
  52089. key,
  52090. builtInKeyCode,
  52091. eventKeyName,
  52092. builtInKeyName
  52093. ) {
  52094. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  52095. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  52096. return isKeyNotMatch(builtInKeyName, eventKeyName)
  52097. } else if (mappedKeyCode) {
  52098. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  52099. } else if (eventKeyName) {
  52100. return hyphenate(eventKeyName) !== key
  52101. }
  52102. }
  52103. /* */
  52104. /**
  52105. * Runtime helper for merging v-bind="object" into a VNode's data.
  52106. */
  52107. function bindObjectProps (
  52108. data,
  52109. tag,
  52110. value,
  52111. asProp,
  52112. isSync
  52113. ) {
  52114. if (value) {
  52115. if (!isObject(value)) {
  52116. warn(
  52117. 'v-bind without argument expects an Object or Array value',
  52118. this
  52119. );
  52120. } else {
  52121. if (Array.isArray(value)) {
  52122. value = toObject(value);
  52123. }
  52124. var hash;
  52125. var loop = function ( key ) {
  52126. if (
  52127. key === 'class' ||
  52128. key === 'style' ||
  52129. isReservedAttribute(key)
  52130. ) {
  52131. hash = data;
  52132. } else {
  52133. var type = data.attrs && data.attrs.type;
  52134. hash = asProp || config.mustUseProp(tag, type, key)
  52135. ? data.domProps || (data.domProps = {})
  52136. : data.attrs || (data.attrs = {});
  52137. }
  52138. var camelizedKey = camelize(key);
  52139. var hyphenatedKey = hyphenate(key);
  52140. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  52141. hash[key] = value[key];
  52142. if (isSync) {
  52143. var on = data.on || (data.on = {});
  52144. on[("update:" + key)] = function ($event) {
  52145. value[key] = $event;
  52146. };
  52147. }
  52148. }
  52149. };
  52150. for (var key in value) loop( key );
  52151. }
  52152. }
  52153. return data
  52154. }
  52155. /* */
  52156. /**
  52157. * Runtime helper for rendering static trees.
  52158. */
  52159. function renderStatic (
  52160. index,
  52161. isInFor
  52162. ) {
  52163. var cached = this._staticTrees || (this._staticTrees = []);
  52164. var tree = cached[index];
  52165. // if has already-rendered static tree and not inside v-for,
  52166. // we can reuse the same tree.
  52167. if (tree && !isInFor) {
  52168. return tree
  52169. }
  52170. // otherwise, render a fresh tree.
  52171. tree = cached[index] = this.$options.staticRenderFns[index].call(
  52172. this._renderProxy,
  52173. null,
  52174. this // for render fns generated for functional component templates
  52175. );
  52176. markStatic(tree, ("__static__" + index), false);
  52177. return tree
  52178. }
  52179. /**
  52180. * Runtime helper for v-once.
  52181. * Effectively it means marking the node as static with a unique key.
  52182. */
  52183. function markOnce (
  52184. tree,
  52185. index,
  52186. key
  52187. ) {
  52188. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  52189. return tree
  52190. }
  52191. function markStatic (
  52192. tree,
  52193. key,
  52194. isOnce
  52195. ) {
  52196. if (Array.isArray(tree)) {
  52197. for (var i = 0; i < tree.length; i++) {
  52198. if (tree[i] && typeof tree[i] !== 'string') {
  52199. markStaticNode(tree[i], (key + "_" + i), isOnce);
  52200. }
  52201. }
  52202. } else {
  52203. markStaticNode(tree, key, isOnce);
  52204. }
  52205. }
  52206. function markStaticNode (node, key, isOnce) {
  52207. node.isStatic = true;
  52208. node.key = key;
  52209. node.isOnce = isOnce;
  52210. }
  52211. /* */
  52212. function bindObjectListeners (data, value) {
  52213. if (value) {
  52214. if (!isPlainObject(value)) {
  52215. warn(
  52216. 'v-on without argument expects an Object value',
  52217. this
  52218. );
  52219. } else {
  52220. var on = data.on = data.on ? extend({}, data.on) : {};
  52221. for (var key in value) {
  52222. var existing = on[key];
  52223. var ours = value[key];
  52224. on[key] = existing ? [].concat(existing, ours) : ours;
  52225. }
  52226. }
  52227. }
  52228. return data
  52229. }
  52230. /* */
  52231. function resolveScopedSlots (
  52232. fns, // see flow/vnode
  52233. res,
  52234. // the following are added in 2.6
  52235. hasDynamicKeys,
  52236. contentHashKey
  52237. ) {
  52238. res = res || { $stable: !hasDynamicKeys };
  52239. for (var i = 0; i < fns.length; i++) {
  52240. var slot = fns[i];
  52241. if (Array.isArray(slot)) {
  52242. resolveScopedSlots(slot, res, hasDynamicKeys);
  52243. } else if (slot) {
  52244. // marker for reverse proxying v-slot without scope on this.$slots
  52245. if (slot.proxy) {
  52246. slot.fn.proxy = true;
  52247. }
  52248. res[slot.key] = slot.fn;
  52249. }
  52250. }
  52251. if (contentHashKey) {
  52252. (res).$key = contentHashKey;
  52253. }
  52254. return res
  52255. }
  52256. /* */
  52257. function bindDynamicKeys (baseObj, values) {
  52258. for (var i = 0; i < values.length; i += 2) {
  52259. var key = values[i];
  52260. if (typeof key === 'string' && key) {
  52261. baseObj[values[i]] = values[i + 1];
  52262. } else if (key !== '' && key !== null) {
  52263. // null is a special value for explicitly removing a binding
  52264. warn(
  52265. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  52266. this
  52267. );
  52268. }
  52269. }
  52270. return baseObj
  52271. }
  52272. // helper to dynamically append modifier runtime markers to event names.
  52273. // ensure only append when value is already string, otherwise it will be cast
  52274. // to string and cause the type check to miss.
  52275. function prependModifier (value, symbol) {
  52276. return typeof value === 'string' ? symbol + value : value
  52277. }
  52278. /* */
  52279. function installRenderHelpers (target) {
  52280. target._o = markOnce;
  52281. target._n = toNumber;
  52282. target._s = toString;
  52283. target._l = renderList;
  52284. target._t = renderSlot;
  52285. target._q = looseEqual;
  52286. target._i = looseIndexOf;
  52287. target._m = renderStatic;
  52288. target._f = resolveFilter;
  52289. target._k = checkKeyCodes;
  52290. target._b = bindObjectProps;
  52291. target._v = createTextVNode;
  52292. target._e = createEmptyVNode;
  52293. target._u = resolveScopedSlots;
  52294. target._g = bindObjectListeners;
  52295. target._d = bindDynamicKeys;
  52296. target._p = prependModifier;
  52297. }
  52298. /* */
  52299. function FunctionalRenderContext (
  52300. data,
  52301. props,
  52302. children,
  52303. parent,
  52304. Ctor
  52305. ) {
  52306. var this$1 = this;
  52307. var options = Ctor.options;
  52308. // ensure the createElement function in functional components
  52309. // gets a unique context - this is necessary for correct named slot check
  52310. var contextVm;
  52311. if (hasOwn(parent, '_uid')) {
  52312. contextVm = Object.create(parent);
  52313. // $flow-disable-line
  52314. contextVm._original = parent;
  52315. } else {
  52316. // the context vm passed in is a functional context as well.
  52317. // in this case we want to make sure we are able to get a hold to the
  52318. // real context instance.
  52319. contextVm = parent;
  52320. // $flow-disable-line
  52321. parent = parent._original;
  52322. }
  52323. var isCompiled = isTrue(options._compiled);
  52324. var needNormalization = !isCompiled;
  52325. this.data = data;
  52326. this.props = props;
  52327. this.children = children;
  52328. this.parent = parent;
  52329. this.listeners = data.on || emptyObject;
  52330. this.injections = resolveInject(options.inject, parent);
  52331. this.slots = function () {
  52332. if (!this$1.$slots) {
  52333. normalizeScopedSlots(
  52334. data.scopedSlots,
  52335. this$1.$slots = resolveSlots(children, parent)
  52336. );
  52337. }
  52338. return this$1.$slots
  52339. };
  52340. Object.defineProperty(this, 'scopedSlots', ({
  52341. enumerable: true,
  52342. get: function get () {
  52343. return normalizeScopedSlots(data.scopedSlots, this.slots())
  52344. }
  52345. }));
  52346. // support for compiled functional template
  52347. if (isCompiled) {
  52348. // exposing $options for renderStatic()
  52349. this.$options = options;
  52350. // pre-resolve slots for renderSlot()
  52351. this.$slots = this.slots();
  52352. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  52353. }
  52354. if (options._scopeId) {
  52355. this._c = function (a, b, c, d) {
  52356. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  52357. if (vnode && !Array.isArray(vnode)) {
  52358. vnode.fnScopeId = options._scopeId;
  52359. vnode.fnContext = parent;
  52360. }
  52361. return vnode
  52362. };
  52363. } else {
  52364. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  52365. }
  52366. }
  52367. installRenderHelpers(FunctionalRenderContext.prototype);
  52368. function createFunctionalComponent (
  52369. Ctor,
  52370. propsData,
  52371. data,
  52372. contextVm,
  52373. children
  52374. ) {
  52375. var options = Ctor.options;
  52376. var props = {};
  52377. var propOptions = options.props;
  52378. if (isDef(propOptions)) {
  52379. for (var key in propOptions) {
  52380. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  52381. }
  52382. } else {
  52383. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  52384. if (isDef(data.props)) { mergeProps(props, data.props); }
  52385. }
  52386. var renderContext = new FunctionalRenderContext(
  52387. data,
  52388. props,
  52389. children,
  52390. contextVm,
  52391. Ctor
  52392. );
  52393. var vnode = options.render.call(null, renderContext._c, renderContext);
  52394. if (vnode instanceof VNode) {
  52395. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  52396. } else if (Array.isArray(vnode)) {
  52397. var vnodes = normalizeChildren(vnode) || [];
  52398. var res = new Array(vnodes.length);
  52399. for (var i = 0; i < vnodes.length; i++) {
  52400. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  52401. }
  52402. return res
  52403. }
  52404. }
  52405. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  52406. // #7817 clone node before setting fnContext, otherwise if the node is reused
  52407. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  52408. // that should not be matched to match.
  52409. var clone = cloneVNode(vnode);
  52410. clone.fnContext = contextVm;
  52411. clone.fnOptions = options;
  52412. {
  52413. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  52414. }
  52415. if (data.slot) {
  52416. (clone.data || (clone.data = {})).slot = data.slot;
  52417. }
  52418. return clone
  52419. }
  52420. function mergeProps (to, from) {
  52421. for (var key in from) {
  52422. to[camelize(key)] = from[key];
  52423. }
  52424. }
  52425. /* */
  52426. /* */
  52427. /* */
  52428. /* */
  52429. // inline hooks to be invoked on component VNodes during patch
  52430. var componentVNodeHooks = {
  52431. init: function init (vnode, hydrating) {
  52432. if (
  52433. vnode.componentInstance &&
  52434. !vnode.componentInstance._isDestroyed &&
  52435. vnode.data.keepAlive
  52436. ) {
  52437. // kept-alive components, treat as a patch
  52438. var mountedNode = vnode; // work around flow
  52439. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  52440. } else {
  52441. var child = vnode.componentInstance = createComponentInstanceForVnode(
  52442. vnode,
  52443. activeInstance
  52444. );
  52445. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  52446. }
  52447. },
  52448. prepatch: function prepatch (oldVnode, vnode) {
  52449. var options = vnode.componentOptions;
  52450. var child = vnode.componentInstance = oldVnode.componentInstance;
  52451. updateChildComponent(
  52452. child,
  52453. options.propsData, // updated props
  52454. options.listeners, // updated listeners
  52455. vnode, // new parent vnode
  52456. options.children // new children
  52457. );
  52458. },
  52459. insert: function insert (vnode) {
  52460. var context = vnode.context;
  52461. var componentInstance = vnode.componentInstance;
  52462. if (!componentInstance._isMounted) {
  52463. componentInstance._isMounted = true;
  52464. callHook(componentInstance, 'mounted');
  52465. }
  52466. if (vnode.data.keepAlive) {
  52467. if (context._isMounted) {
  52468. // vue-router#1212
  52469. // During updates, a kept-alive component's child components may
  52470. // change, so directly walking the tree here may call activated hooks
  52471. // on incorrect children. Instead we push them into a queue which will
  52472. // be processed after the whole patch process ended.
  52473. queueActivatedComponent(componentInstance);
  52474. } else {
  52475. activateChildComponent(componentInstance, true /* direct */);
  52476. }
  52477. }
  52478. },
  52479. destroy: function destroy (vnode) {
  52480. var componentInstance = vnode.componentInstance;
  52481. if (!componentInstance._isDestroyed) {
  52482. if (!vnode.data.keepAlive) {
  52483. componentInstance.$destroy();
  52484. } else {
  52485. deactivateChildComponent(componentInstance, true /* direct */);
  52486. }
  52487. }
  52488. }
  52489. };
  52490. var hooksToMerge = Object.keys(componentVNodeHooks);
  52491. function createComponent (
  52492. Ctor,
  52493. data,
  52494. context,
  52495. children,
  52496. tag
  52497. ) {
  52498. if (isUndef(Ctor)) {
  52499. return
  52500. }
  52501. var baseCtor = context.$options._base;
  52502. // plain options object: turn it into a constructor
  52503. if (isObject(Ctor)) {
  52504. Ctor = baseCtor.extend(Ctor);
  52505. }
  52506. // if at this stage it's not a constructor or an async component factory,
  52507. // reject.
  52508. if (typeof Ctor !== 'function') {
  52509. {
  52510. warn(("Invalid Component definition: " + (String(Ctor))), context);
  52511. }
  52512. return
  52513. }
  52514. // async component
  52515. var asyncFactory;
  52516. if (isUndef(Ctor.cid)) {
  52517. asyncFactory = Ctor;
  52518. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  52519. if (Ctor === undefined) {
  52520. // return a placeholder node for async component, which is rendered
  52521. // as a comment node but preserves all the raw information for the node.
  52522. // the information will be used for async server-rendering and hydration.
  52523. return createAsyncPlaceholder(
  52524. asyncFactory,
  52525. data,
  52526. context,
  52527. children,
  52528. tag
  52529. )
  52530. }
  52531. }
  52532. data = data || {};
  52533. // resolve constructor options in case global mixins are applied after
  52534. // component constructor creation
  52535. resolveConstructorOptions(Ctor);
  52536. // transform component v-model data into props & events
  52537. if (isDef(data.model)) {
  52538. transformModel(Ctor.options, data);
  52539. }
  52540. // extract props
  52541. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  52542. // functional component
  52543. if (isTrue(Ctor.options.functional)) {
  52544. return createFunctionalComponent(Ctor, propsData, data, context, children)
  52545. }
  52546. // extract listeners, since these needs to be treated as
  52547. // child component listeners instead of DOM listeners
  52548. var listeners = data.on;
  52549. // replace with listeners with .native modifier
  52550. // so it gets processed during parent component patch.
  52551. data.on = data.nativeOn;
  52552. if (isTrue(Ctor.options.abstract)) {
  52553. // abstract components do not keep anything
  52554. // other than props & listeners & slot
  52555. // work around flow
  52556. var slot = data.slot;
  52557. data = {};
  52558. if (slot) {
  52559. data.slot = slot;
  52560. }
  52561. }
  52562. // install component management hooks onto the placeholder node
  52563. installComponentHooks(data);
  52564. // return a placeholder vnode
  52565. var name = Ctor.options.name || tag;
  52566. var vnode = new VNode(
  52567. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  52568. data, undefined, undefined, undefined, context,
  52569. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  52570. asyncFactory
  52571. );
  52572. return vnode
  52573. }
  52574. function createComponentInstanceForVnode (
  52575. vnode, // we know it's MountedComponentVNode but flow doesn't
  52576. parent // activeInstance in lifecycle state
  52577. ) {
  52578. var options = {
  52579. _isComponent: true,
  52580. _parentVnode: vnode,
  52581. parent: parent
  52582. };
  52583. // check inline-template render functions
  52584. var inlineTemplate = vnode.data.inlineTemplate;
  52585. if (isDef(inlineTemplate)) {
  52586. options.render = inlineTemplate.render;
  52587. options.staticRenderFns = inlineTemplate.staticRenderFns;
  52588. }
  52589. return new vnode.componentOptions.Ctor(options)
  52590. }
  52591. function installComponentHooks (data) {
  52592. var hooks = data.hook || (data.hook = {});
  52593. for (var i = 0; i < hooksToMerge.length; i++) {
  52594. var key = hooksToMerge[i];
  52595. var existing = hooks[key];
  52596. var toMerge = componentVNodeHooks[key];
  52597. if (existing !== toMerge && !(existing && existing._merged)) {
  52598. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  52599. }
  52600. }
  52601. }
  52602. function mergeHook$1 (f1, f2) {
  52603. var merged = function (a, b) {
  52604. // flow complains about extra args which is why we use any
  52605. f1(a, b);
  52606. f2(a, b);
  52607. };
  52608. merged._merged = true;
  52609. return merged
  52610. }
  52611. // transform component v-model info (value and callback) into
  52612. // prop and event handler respectively.
  52613. function transformModel (options, data) {
  52614. var prop = (options.model && options.model.prop) || 'value';
  52615. var event = (options.model && options.model.event) || 'input'
  52616. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  52617. var on = data.on || (data.on = {});
  52618. var existing = on[event];
  52619. var callback = data.model.callback;
  52620. if (isDef(existing)) {
  52621. if (
  52622. Array.isArray(existing)
  52623. ? existing.indexOf(callback) === -1
  52624. : existing !== callback
  52625. ) {
  52626. on[event] = [callback].concat(existing);
  52627. }
  52628. } else {
  52629. on[event] = callback;
  52630. }
  52631. }
  52632. /* */
  52633. var SIMPLE_NORMALIZE = 1;
  52634. var ALWAYS_NORMALIZE = 2;
  52635. // wrapper function for providing a more flexible interface
  52636. // without getting yelled at by flow
  52637. function createElement (
  52638. context,
  52639. tag,
  52640. data,
  52641. children,
  52642. normalizationType,
  52643. alwaysNormalize
  52644. ) {
  52645. if (Array.isArray(data) || isPrimitive(data)) {
  52646. normalizationType = children;
  52647. children = data;
  52648. data = undefined;
  52649. }
  52650. if (isTrue(alwaysNormalize)) {
  52651. normalizationType = ALWAYS_NORMALIZE;
  52652. }
  52653. return _createElement(context, tag, data, children, normalizationType)
  52654. }
  52655. function _createElement (
  52656. context,
  52657. tag,
  52658. data,
  52659. children,
  52660. normalizationType
  52661. ) {
  52662. if (isDef(data) && isDef((data).__ob__)) {
  52663. warn(
  52664. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  52665. 'Always create fresh vnode data objects in each render!',
  52666. context
  52667. );
  52668. return createEmptyVNode()
  52669. }
  52670. // object syntax in v-bind
  52671. if (isDef(data) && isDef(data.is)) {
  52672. tag = data.is;
  52673. }
  52674. if (!tag) {
  52675. // in case of component :is set to falsy value
  52676. return createEmptyVNode()
  52677. }
  52678. // warn against non-primitive key
  52679. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  52680. ) {
  52681. {
  52682. warn(
  52683. 'Avoid using non-primitive value as key, ' +
  52684. 'use string/number value instead.',
  52685. context
  52686. );
  52687. }
  52688. }
  52689. // support single function children as default scoped slot
  52690. if (Array.isArray(children) &&
  52691. typeof children[0] === 'function'
  52692. ) {
  52693. data = data || {};
  52694. data.scopedSlots = { default: children[0] };
  52695. children.length = 0;
  52696. }
  52697. if (normalizationType === ALWAYS_NORMALIZE) {
  52698. children = normalizeChildren(children);
  52699. } else if (normalizationType === SIMPLE_NORMALIZE) {
  52700. children = simpleNormalizeChildren(children);
  52701. }
  52702. var vnode, ns;
  52703. if (typeof tag === 'string') {
  52704. var Ctor;
  52705. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  52706. if (config.isReservedTag(tag)) {
  52707. // platform built-in elements
  52708. if (isDef(data) && isDef(data.nativeOn)) {
  52709. warn(
  52710. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  52711. context
  52712. );
  52713. }
  52714. vnode = new VNode(
  52715. config.parsePlatformTagName(tag), data, children,
  52716. undefined, undefined, context
  52717. );
  52718. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  52719. // component
  52720. vnode = createComponent(Ctor, data, context, children, tag);
  52721. } else {
  52722. // unknown or unlisted namespaced elements
  52723. // check at runtime because it may get assigned a namespace when its
  52724. // parent normalizes children
  52725. vnode = new VNode(
  52726. tag, data, children,
  52727. undefined, undefined, context
  52728. );
  52729. }
  52730. } else {
  52731. // direct component options / constructor
  52732. vnode = createComponent(tag, data, context, children);
  52733. }
  52734. if (Array.isArray(vnode)) {
  52735. return vnode
  52736. } else if (isDef(vnode)) {
  52737. if (isDef(ns)) { applyNS(vnode, ns); }
  52738. if (isDef(data)) { registerDeepBindings(data); }
  52739. return vnode
  52740. } else {
  52741. return createEmptyVNode()
  52742. }
  52743. }
  52744. function applyNS (vnode, ns, force) {
  52745. vnode.ns = ns;
  52746. if (vnode.tag === 'foreignObject') {
  52747. // use default namespace inside foreignObject
  52748. ns = undefined;
  52749. force = true;
  52750. }
  52751. if (isDef(vnode.children)) {
  52752. for (var i = 0, l = vnode.children.length; i < l; i++) {
  52753. var child = vnode.children[i];
  52754. if (isDef(child.tag) && (
  52755. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  52756. applyNS(child, ns, force);
  52757. }
  52758. }
  52759. }
  52760. }
  52761. // ref #5318
  52762. // necessary to ensure parent re-render when deep bindings like :style and
  52763. // :class are used on slot nodes
  52764. function registerDeepBindings (data) {
  52765. if (isObject(data.style)) {
  52766. traverse(data.style);
  52767. }
  52768. if (isObject(data.class)) {
  52769. traverse(data.class);
  52770. }
  52771. }
  52772. /* */
  52773. function initRender (vm) {
  52774. vm._vnode = null; // the root of the child tree
  52775. vm._staticTrees = null; // v-once cached trees
  52776. var options = vm.$options;
  52777. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  52778. var renderContext = parentVnode && parentVnode.context;
  52779. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  52780. vm.$scopedSlots = emptyObject;
  52781. // bind the createElement fn to this instance
  52782. // so that we get proper render context inside it.
  52783. // args order: tag, data, children, normalizationType, alwaysNormalize
  52784. // internal version is used by render functions compiled from templates
  52785. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  52786. // normalization is always applied for the public version, used in
  52787. // user-written render functions.
  52788. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  52789. // $attrs & $listeners are exposed for easier HOC creation.
  52790. // they need to be reactive so that HOCs using them are always updated
  52791. var parentData = parentVnode && parentVnode.data;
  52792. /* istanbul ignore else */
  52793. {
  52794. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  52795. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  52796. }, true);
  52797. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  52798. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  52799. }, true);
  52800. }
  52801. }
  52802. var currentRenderingInstance = null;
  52803. function renderMixin (Vue) {
  52804. // install runtime convenience helpers
  52805. installRenderHelpers(Vue.prototype);
  52806. Vue.prototype.$nextTick = function (fn) {
  52807. return nextTick(fn, this)
  52808. };
  52809. Vue.prototype._render = function () {
  52810. var vm = this;
  52811. var ref = vm.$options;
  52812. var render = ref.render;
  52813. var _parentVnode = ref._parentVnode;
  52814. if (_parentVnode) {
  52815. vm.$scopedSlots = normalizeScopedSlots(
  52816. _parentVnode.data.scopedSlots,
  52817. vm.$slots,
  52818. vm.$scopedSlots
  52819. );
  52820. }
  52821. // set parent vnode. this allows render functions to have access
  52822. // to the data on the placeholder node.
  52823. vm.$vnode = _parentVnode;
  52824. // render self
  52825. var vnode;
  52826. try {
  52827. // There's no need to maintain a stack because all render fns are called
  52828. // separately from one another. Nested component's render fns are called
  52829. // when parent component is patched.
  52830. currentRenderingInstance = vm;
  52831. vnode = render.call(vm._renderProxy, vm.$createElement);
  52832. } catch (e) {
  52833. handleError(e, vm, "render");
  52834. // return error render result,
  52835. // or previous vnode to prevent render error causing blank component
  52836. /* istanbul ignore else */
  52837. if (vm.$options.renderError) {
  52838. try {
  52839. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  52840. } catch (e) {
  52841. handleError(e, vm, "renderError");
  52842. vnode = vm._vnode;
  52843. }
  52844. } else {
  52845. vnode = vm._vnode;
  52846. }
  52847. } finally {
  52848. currentRenderingInstance = null;
  52849. }
  52850. // if the returned array contains only a single node, allow it
  52851. if (Array.isArray(vnode) && vnode.length === 1) {
  52852. vnode = vnode[0];
  52853. }
  52854. // return empty vnode in case the render function errored out
  52855. if (!(vnode instanceof VNode)) {
  52856. if (Array.isArray(vnode)) {
  52857. warn(
  52858. 'Multiple root nodes returned from render function. Render function ' +
  52859. 'should return a single root node.',
  52860. vm
  52861. );
  52862. }
  52863. vnode = createEmptyVNode();
  52864. }
  52865. // set parent
  52866. vnode.parent = _parentVnode;
  52867. return vnode
  52868. };
  52869. }
  52870. /* */
  52871. function ensureCtor (comp, base) {
  52872. if (
  52873. comp.__esModule ||
  52874. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  52875. ) {
  52876. comp = comp.default;
  52877. }
  52878. return isObject(comp)
  52879. ? base.extend(comp)
  52880. : comp
  52881. }
  52882. function createAsyncPlaceholder (
  52883. factory,
  52884. data,
  52885. context,
  52886. children,
  52887. tag
  52888. ) {
  52889. var node = createEmptyVNode();
  52890. node.asyncFactory = factory;
  52891. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  52892. return node
  52893. }
  52894. function resolveAsyncComponent (
  52895. factory,
  52896. baseCtor
  52897. ) {
  52898. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  52899. return factory.errorComp
  52900. }
  52901. if (isDef(factory.resolved)) {
  52902. return factory.resolved
  52903. }
  52904. var owner = currentRenderingInstance;
  52905. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  52906. // already pending
  52907. factory.owners.push(owner);
  52908. }
  52909. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  52910. return factory.loadingComp
  52911. }
  52912. if (owner && !isDef(factory.owners)) {
  52913. var owners = factory.owners = [owner];
  52914. var sync = true;
  52915. var timerLoading = null;
  52916. var timerTimeout = null
  52917. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  52918. var forceRender = function (renderCompleted) {
  52919. for (var i = 0, l = owners.length; i < l; i++) {
  52920. (owners[i]).$forceUpdate();
  52921. }
  52922. if (renderCompleted) {
  52923. owners.length = 0;
  52924. if (timerLoading !== null) {
  52925. clearTimeout(timerLoading);
  52926. timerLoading = null;
  52927. }
  52928. if (timerTimeout !== null) {
  52929. clearTimeout(timerTimeout);
  52930. timerTimeout = null;
  52931. }
  52932. }
  52933. };
  52934. var resolve = once(function (res) {
  52935. // cache resolved
  52936. factory.resolved = ensureCtor(res, baseCtor);
  52937. // invoke callbacks only if this is not a synchronous resolve
  52938. // (async resolves are shimmed as synchronous during SSR)
  52939. if (!sync) {
  52940. forceRender(true);
  52941. } else {
  52942. owners.length = 0;
  52943. }
  52944. });
  52945. var reject = once(function (reason) {
  52946. warn(
  52947. "Failed to resolve async component: " + (String(factory)) +
  52948. (reason ? ("\nReason: " + reason) : '')
  52949. );
  52950. if (isDef(factory.errorComp)) {
  52951. factory.error = true;
  52952. forceRender(true);
  52953. }
  52954. });
  52955. var res = factory(resolve, reject);
  52956. if (isObject(res)) {
  52957. if (isPromise(res)) {
  52958. // () => Promise
  52959. if (isUndef(factory.resolved)) {
  52960. res.then(resolve, reject);
  52961. }
  52962. } else if (isPromise(res.component)) {
  52963. res.component.then(resolve, reject);
  52964. if (isDef(res.error)) {
  52965. factory.errorComp = ensureCtor(res.error, baseCtor);
  52966. }
  52967. if (isDef(res.loading)) {
  52968. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  52969. if (res.delay === 0) {
  52970. factory.loading = true;
  52971. } else {
  52972. timerLoading = setTimeout(function () {
  52973. timerLoading = null;
  52974. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  52975. factory.loading = true;
  52976. forceRender(false);
  52977. }
  52978. }, res.delay || 200);
  52979. }
  52980. }
  52981. if (isDef(res.timeout)) {
  52982. timerTimeout = setTimeout(function () {
  52983. timerTimeout = null;
  52984. if (isUndef(factory.resolved)) {
  52985. reject(
  52986. "timeout (" + (res.timeout) + "ms)"
  52987. );
  52988. }
  52989. }, res.timeout);
  52990. }
  52991. }
  52992. }
  52993. sync = false;
  52994. // return in case resolved synchronously
  52995. return factory.loading
  52996. ? factory.loadingComp
  52997. : factory.resolved
  52998. }
  52999. }
  53000. /* */
  53001. function isAsyncPlaceholder (node) {
  53002. return node.isComment && node.asyncFactory
  53003. }
  53004. /* */
  53005. function getFirstComponentChild (children) {
  53006. if (Array.isArray(children)) {
  53007. for (var i = 0; i < children.length; i++) {
  53008. var c = children[i];
  53009. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  53010. return c
  53011. }
  53012. }
  53013. }
  53014. }
  53015. /* */
  53016. /* */
  53017. function initEvents (vm) {
  53018. vm._events = Object.create(null);
  53019. vm._hasHookEvent = false;
  53020. // init parent attached events
  53021. var listeners = vm.$options._parentListeners;
  53022. if (listeners) {
  53023. updateComponentListeners(vm, listeners);
  53024. }
  53025. }
  53026. var target;
  53027. function add (event, fn) {
  53028. target.$on(event, fn);
  53029. }
  53030. function remove$1 (event, fn) {
  53031. target.$off(event, fn);
  53032. }
  53033. function createOnceHandler (event, fn) {
  53034. var _target = target;
  53035. return function onceHandler () {
  53036. var res = fn.apply(null, arguments);
  53037. if (res !== null) {
  53038. _target.$off(event, onceHandler);
  53039. }
  53040. }
  53041. }
  53042. function updateComponentListeners (
  53043. vm,
  53044. listeners,
  53045. oldListeners
  53046. ) {
  53047. target = vm;
  53048. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  53049. target = undefined;
  53050. }
  53051. function eventsMixin (Vue) {
  53052. var hookRE = /^hook:/;
  53053. Vue.prototype.$on = function (event, fn) {
  53054. var vm = this;
  53055. if (Array.isArray(event)) {
  53056. for (var i = 0, l = event.length; i < l; i++) {
  53057. vm.$on(event[i], fn);
  53058. }
  53059. } else {
  53060. (vm._events[event] || (vm._events[event] = [])).push(fn);
  53061. // optimize hook:event cost by using a boolean flag marked at registration
  53062. // instead of a hash lookup
  53063. if (hookRE.test(event)) {
  53064. vm._hasHookEvent = true;
  53065. }
  53066. }
  53067. return vm
  53068. };
  53069. Vue.prototype.$once = function (event, fn) {
  53070. var vm = this;
  53071. function on () {
  53072. vm.$off(event, on);
  53073. fn.apply(vm, arguments);
  53074. }
  53075. on.fn = fn;
  53076. vm.$on(event, on);
  53077. return vm
  53078. };
  53079. Vue.prototype.$off = function (event, fn) {
  53080. var vm = this;
  53081. // all
  53082. if (!arguments.length) {
  53083. vm._events = Object.create(null);
  53084. return vm
  53085. }
  53086. // array of events
  53087. if (Array.isArray(event)) {
  53088. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  53089. vm.$off(event[i$1], fn);
  53090. }
  53091. return vm
  53092. }
  53093. // specific event
  53094. var cbs = vm._events[event];
  53095. if (!cbs) {
  53096. return vm
  53097. }
  53098. if (!fn) {
  53099. vm._events[event] = null;
  53100. return vm
  53101. }
  53102. // specific handler
  53103. var cb;
  53104. var i = cbs.length;
  53105. while (i--) {
  53106. cb = cbs[i];
  53107. if (cb === fn || cb.fn === fn) {
  53108. cbs.splice(i, 1);
  53109. break
  53110. }
  53111. }
  53112. return vm
  53113. };
  53114. Vue.prototype.$emit = function (event) {
  53115. var vm = this;
  53116. {
  53117. var lowerCaseEvent = event.toLowerCase();
  53118. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  53119. tip(
  53120. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  53121. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  53122. "Note that HTML attributes are case-insensitive and you cannot use " +
  53123. "v-on to listen to camelCase events when using in-DOM templates. " +
  53124. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  53125. );
  53126. }
  53127. }
  53128. var cbs = vm._events[event];
  53129. if (cbs) {
  53130. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  53131. var args = toArray(arguments, 1);
  53132. var info = "event handler for \"" + event + "\"";
  53133. for (var i = 0, l = cbs.length; i < l; i++) {
  53134. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  53135. }
  53136. }
  53137. return vm
  53138. };
  53139. }
  53140. /* */
  53141. var activeInstance = null;
  53142. var isUpdatingChildComponent = false;
  53143. function setActiveInstance(vm) {
  53144. var prevActiveInstance = activeInstance;
  53145. activeInstance = vm;
  53146. return function () {
  53147. activeInstance = prevActiveInstance;
  53148. }
  53149. }
  53150. function initLifecycle (vm) {
  53151. var options = vm.$options;
  53152. // locate first non-abstract parent
  53153. var parent = options.parent;
  53154. if (parent && !options.abstract) {
  53155. while (parent.$options.abstract && parent.$parent) {
  53156. parent = parent.$parent;
  53157. }
  53158. parent.$children.push(vm);
  53159. }
  53160. vm.$parent = parent;
  53161. vm.$root = parent ? parent.$root : vm;
  53162. vm.$children = [];
  53163. vm.$refs = {};
  53164. vm._watcher = null;
  53165. vm._inactive = null;
  53166. vm._directInactive = false;
  53167. vm._isMounted = false;
  53168. vm._isDestroyed = false;
  53169. vm._isBeingDestroyed = false;
  53170. }
  53171. function lifecycleMixin (Vue) {
  53172. Vue.prototype._update = function (vnode, hydrating) {
  53173. var vm = this;
  53174. var prevEl = vm.$el;
  53175. var prevVnode = vm._vnode;
  53176. var restoreActiveInstance = setActiveInstance(vm);
  53177. vm._vnode = vnode;
  53178. // Vue.prototype.__patch__ is injected in entry points
  53179. // based on the rendering backend used.
  53180. if (!prevVnode) {
  53181. // initial render
  53182. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  53183. } else {
  53184. // updates
  53185. vm.$el = vm.__patch__(prevVnode, vnode);
  53186. }
  53187. restoreActiveInstance();
  53188. // update __vue__ reference
  53189. if (prevEl) {
  53190. prevEl.__vue__ = null;
  53191. }
  53192. if (vm.$el) {
  53193. vm.$el.__vue__ = vm;
  53194. }
  53195. // if parent is an HOC, update its $el as well
  53196. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  53197. vm.$parent.$el = vm.$el;
  53198. }
  53199. // updated hook is called by the scheduler to ensure that children are
  53200. // updated in a parent's updated hook.
  53201. };
  53202. Vue.prototype.$forceUpdate = function () {
  53203. var vm = this;
  53204. if (vm._watcher) {
  53205. vm._watcher.update();
  53206. }
  53207. };
  53208. Vue.prototype.$destroy = function () {
  53209. var vm = this;
  53210. if (vm._isBeingDestroyed) {
  53211. return
  53212. }
  53213. callHook(vm, 'beforeDestroy');
  53214. vm._isBeingDestroyed = true;
  53215. // remove self from parent
  53216. var parent = vm.$parent;
  53217. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  53218. remove(parent.$children, vm);
  53219. }
  53220. // teardown watchers
  53221. if (vm._watcher) {
  53222. vm._watcher.teardown();
  53223. }
  53224. var i = vm._watchers.length;
  53225. while (i--) {
  53226. vm._watchers[i].teardown();
  53227. }
  53228. // remove reference from data ob
  53229. // frozen object may not have observer.
  53230. if (vm._data.__ob__) {
  53231. vm._data.__ob__.vmCount--;
  53232. }
  53233. // call the last hook...
  53234. vm._isDestroyed = true;
  53235. // invoke destroy hooks on current rendered tree
  53236. vm.__patch__(vm._vnode, null);
  53237. // fire destroyed hook
  53238. callHook(vm, 'destroyed');
  53239. // turn off all instance listeners.
  53240. vm.$off();
  53241. // remove __vue__ reference
  53242. if (vm.$el) {
  53243. vm.$el.__vue__ = null;
  53244. }
  53245. // release circular reference (#6759)
  53246. if (vm.$vnode) {
  53247. vm.$vnode.parent = null;
  53248. }
  53249. };
  53250. }
  53251. function mountComponent (
  53252. vm,
  53253. el,
  53254. hydrating
  53255. ) {
  53256. vm.$el = el;
  53257. if (!vm.$options.render) {
  53258. vm.$options.render = createEmptyVNode;
  53259. {
  53260. /* istanbul ignore if */
  53261. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  53262. vm.$options.el || el) {
  53263. warn(
  53264. 'You are using the runtime-only build of Vue where the template ' +
  53265. 'compiler is not available. Either pre-compile the templates into ' +
  53266. 'render functions, or use the compiler-included build.',
  53267. vm
  53268. );
  53269. } else {
  53270. warn(
  53271. 'Failed to mount component: template or render function not defined.',
  53272. vm
  53273. );
  53274. }
  53275. }
  53276. }
  53277. callHook(vm, 'beforeMount');
  53278. var updateComponent;
  53279. /* istanbul ignore if */
  53280. if (config.performance && mark) {
  53281. updateComponent = function () {
  53282. var name = vm._name;
  53283. var id = vm._uid;
  53284. var startTag = "vue-perf-start:" + id;
  53285. var endTag = "vue-perf-end:" + id;
  53286. mark(startTag);
  53287. var vnode = vm._render();
  53288. mark(endTag);
  53289. measure(("vue " + name + " render"), startTag, endTag);
  53290. mark(startTag);
  53291. vm._update(vnode, hydrating);
  53292. mark(endTag);
  53293. measure(("vue " + name + " patch"), startTag, endTag);
  53294. };
  53295. } else {
  53296. updateComponent = function () {
  53297. vm._update(vm._render(), hydrating);
  53298. };
  53299. }
  53300. // we set this to vm._watcher inside the watcher's constructor
  53301. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  53302. // component's mounted hook), which relies on vm._watcher being already defined
  53303. new Watcher(vm, updateComponent, noop, {
  53304. before: function before () {
  53305. if (vm._isMounted && !vm._isDestroyed) {
  53306. callHook(vm, 'beforeUpdate');
  53307. }
  53308. }
  53309. }, true /* isRenderWatcher */);
  53310. hydrating = false;
  53311. // manually mounted instance, call mounted on self
  53312. // mounted is called for render-created child components in its inserted hook
  53313. if (vm.$vnode == null) {
  53314. vm._isMounted = true;
  53315. callHook(vm, 'mounted');
  53316. }
  53317. return vm
  53318. }
  53319. function updateChildComponent (
  53320. vm,
  53321. propsData,
  53322. listeners,
  53323. parentVnode,
  53324. renderChildren
  53325. ) {
  53326. {
  53327. isUpdatingChildComponent = true;
  53328. }
  53329. // determine whether component has slot children
  53330. // we need to do this before overwriting $options._renderChildren.
  53331. // check if there are dynamic scopedSlots (hand-written or compiled but with
  53332. // dynamic slot names). Static scoped slots compiled from template has the
  53333. // "$stable" marker.
  53334. var newScopedSlots = parentVnode.data.scopedSlots;
  53335. var oldScopedSlots = vm.$scopedSlots;
  53336. var hasDynamicScopedSlot = !!(
  53337. (newScopedSlots && !newScopedSlots.$stable) ||
  53338. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  53339. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  53340. );
  53341. // Any static slot children from the parent may have changed during parent's
  53342. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  53343. // update is necessary to ensure correctness.
  53344. var needsForceUpdate = !!(
  53345. renderChildren || // has new static slots
  53346. vm.$options._renderChildren || // has old static slots
  53347. hasDynamicScopedSlot
  53348. );
  53349. vm.$options._parentVnode = parentVnode;
  53350. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  53351. if (vm._vnode) { // update child tree's parent
  53352. vm._vnode.parent = parentVnode;
  53353. }
  53354. vm.$options._renderChildren = renderChildren;
  53355. // update $attrs and $listeners hash
  53356. // these are also reactive so they may trigger child update if the child
  53357. // used them during render
  53358. vm.$attrs = parentVnode.data.attrs || emptyObject;
  53359. vm.$listeners = listeners || emptyObject;
  53360. // update props
  53361. if (propsData && vm.$options.props) {
  53362. toggleObserving(false);
  53363. var props = vm._props;
  53364. var propKeys = vm.$options._propKeys || [];
  53365. for (var i = 0; i < propKeys.length; i++) {
  53366. var key = propKeys[i];
  53367. var propOptions = vm.$options.props; // wtf flow?
  53368. props[key] = validateProp(key, propOptions, propsData, vm);
  53369. }
  53370. toggleObserving(true);
  53371. // keep a copy of raw propsData
  53372. vm.$options.propsData = propsData;
  53373. }
  53374. // update listeners
  53375. listeners = listeners || emptyObject;
  53376. var oldListeners = vm.$options._parentListeners;
  53377. vm.$options._parentListeners = listeners;
  53378. updateComponentListeners(vm, listeners, oldListeners);
  53379. // resolve slots + force update if has children
  53380. if (needsForceUpdate) {
  53381. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  53382. vm.$forceUpdate();
  53383. }
  53384. {
  53385. isUpdatingChildComponent = false;
  53386. }
  53387. }
  53388. function isInInactiveTree (vm) {
  53389. while (vm && (vm = vm.$parent)) {
  53390. if (vm._inactive) { return true }
  53391. }
  53392. return false
  53393. }
  53394. function activateChildComponent (vm, direct) {
  53395. if (direct) {
  53396. vm._directInactive = false;
  53397. if (isInInactiveTree(vm)) {
  53398. return
  53399. }
  53400. } else if (vm._directInactive) {
  53401. return
  53402. }
  53403. if (vm._inactive || vm._inactive === null) {
  53404. vm._inactive = false;
  53405. for (var i = 0; i < vm.$children.length; i++) {
  53406. activateChildComponent(vm.$children[i]);
  53407. }
  53408. callHook(vm, 'activated');
  53409. }
  53410. }
  53411. function deactivateChildComponent (vm, direct) {
  53412. if (direct) {
  53413. vm._directInactive = true;
  53414. if (isInInactiveTree(vm)) {
  53415. return
  53416. }
  53417. }
  53418. if (!vm._inactive) {
  53419. vm._inactive = true;
  53420. for (var i = 0; i < vm.$children.length; i++) {
  53421. deactivateChildComponent(vm.$children[i]);
  53422. }
  53423. callHook(vm, 'deactivated');
  53424. }
  53425. }
  53426. function callHook (vm, hook) {
  53427. // #7573 disable dep collection when invoking lifecycle hooks
  53428. pushTarget();
  53429. var handlers = vm.$options[hook];
  53430. var info = hook + " hook";
  53431. if (handlers) {
  53432. for (var i = 0, j = handlers.length; i < j; i++) {
  53433. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  53434. }
  53435. }
  53436. if (vm._hasHookEvent) {
  53437. vm.$emit('hook:' + hook);
  53438. }
  53439. popTarget();
  53440. }
  53441. /* */
  53442. var MAX_UPDATE_COUNT = 100;
  53443. var queue = [];
  53444. var activatedChildren = [];
  53445. var has = {};
  53446. var circular = {};
  53447. var waiting = false;
  53448. var flushing = false;
  53449. var index = 0;
  53450. /**
  53451. * Reset the scheduler's state.
  53452. */
  53453. function resetSchedulerState () {
  53454. index = queue.length = activatedChildren.length = 0;
  53455. has = {};
  53456. {
  53457. circular = {};
  53458. }
  53459. waiting = flushing = false;
  53460. }
  53461. // Async edge case #6566 requires saving the timestamp when event listeners are
  53462. // attached. However, calling performance.now() has a perf overhead especially
  53463. // if the page has thousands of event listeners. Instead, we take a timestamp
  53464. // every time the scheduler flushes and use that for all event listeners
  53465. // attached during that flush.
  53466. var currentFlushTimestamp = 0;
  53467. // Async edge case fix requires storing an event listener's attach timestamp.
  53468. var getNow = Date.now;
  53469. // Determine what event timestamp the browser is using. Annoyingly, the
  53470. // timestamp can either be hi-res (relative to page load) or low-res
  53471. // (relative to UNIX epoch), so in order to compare time we have to use the
  53472. // same timestamp type when saving the flush timestamp.
  53473. // All IE versions use low-res event timestamps, and have problematic clock
  53474. // implementations (#9632)
  53475. if (inBrowser && !isIE) {
  53476. var performance = window.performance;
  53477. if (
  53478. performance &&
  53479. typeof performance.now === 'function' &&
  53480. getNow() > document.createEvent('Event').timeStamp
  53481. ) {
  53482. // if the event timestamp, although evaluated AFTER the Date.now(), is
  53483. // smaller than it, it means the event is using a hi-res timestamp,
  53484. // and we need to use the hi-res version for event listener timestamps as
  53485. // well.
  53486. getNow = function () { return performance.now(); };
  53487. }
  53488. }
  53489. /**
  53490. * Flush both queues and run the watchers.
  53491. */
  53492. function flushSchedulerQueue () {
  53493. currentFlushTimestamp = getNow();
  53494. flushing = true;
  53495. var watcher, id;
  53496. // Sort queue before flush.
  53497. // This ensures that:
  53498. // 1. Components are updated from parent to child. (because parent is always
  53499. // created before the child)
  53500. // 2. A component's user watchers are run before its render watcher (because
  53501. // user watchers are created before the render watcher)
  53502. // 3. If a component is destroyed during a parent component's watcher run,
  53503. // its watchers can be skipped.
  53504. queue.sort(function (a, b) { return a.id - b.id; });
  53505. // do not cache length because more watchers might be pushed
  53506. // as we run existing watchers
  53507. for (index = 0; index < queue.length; index++) {
  53508. watcher = queue[index];
  53509. if (watcher.before) {
  53510. watcher.before();
  53511. }
  53512. id = watcher.id;
  53513. has[id] = null;
  53514. watcher.run();
  53515. // in dev build, check and stop circular updates.
  53516. if (has[id] != null) {
  53517. circular[id] = (circular[id] || 0) + 1;
  53518. if (circular[id] > MAX_UPDATE_COUNT) {
  53519. warn(
  53520. 'You may have an infinite update loop ' + (
  53521. watcher.user
  53522. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  53523. : "in a component render function."
  53524. ),
  53525. watcher.vm
  53526. );
  53527. break
  53528. }
  53529. }
  53530. }
  53531. // keep copies of post queues before resetting state
  53532. var activatedQueue = activatedChildren.slice();
  53533. var updatedQueue = queue.slice();
  53534. resetSchedulerState();
  53535. // call component updated and activated hooks
  53536. callActivatedHooks(activatedQueue);
  53537. callUpdatedHooks(updatedQueue);
  53538. // devtool hook
  53539. /* istanbul ignore if */
  53540. if (devtools && config.devtools) {
  53541. devtools.emit('flush');
  53542. }
  53543. }
  53544. function callUpdatedHooks (queue) {
  53545. var i = queue.length;
  53546. while (i--) {
  53547. var watcher = queue[i];
  53548. var vm = watcher.vm;
  53549. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  53550. callHook(vm, 'updated');
  53551. }
  53552. }
  53553. }
  53554. /**
  53555. * Queue a kept-alive component that was activated during patch.
  53556. * The queue will be processed after the entire tree has been patched.
  53557. */
  53558. function queueActivatedComponent (vm) {
  53559. // setting _inactive to false here so that a render function can
  53560. // rely on checking whether it's in an inactive tree (e.g. router-view)
  53561. vm._inactive = false;
  53562. activatedChildren.push(vm);
  53563. }
  53564. function callActivatedHooks (queue) {
  53565. for (var i = 0; i < queue.length; i++) {
  53566. queue[i]._inactive = true;
  53567. activateChildComponent(queue[i], true /* true */);
  53568. }
  53569. }
  53570. /**
  53571. * Push a watcher into the watcher queue.
  53572. * Jobs with duplicate IDs will be skipped unless it's
  53573. * pushed when the queue is being flushed.
  53574. */
  53575. function queueWatcher (watcher) {
  53576. var id = watcher.id;
  53577. if (has[id] == null) {
  53578. has[id] = true;
  53579. if (!flushing) {
  53580. queue.push(watcher);
  53581. } else {
  53582. // if already flushing, splice the watcher based on its id
  53583. // if already past its id, it will be run next immediately.
  53584. var i = queue.length - 1;
  53585. while (i > index && queue[i].id > watcher.id) {
  53586. i--;
  53587. }
  53588. queue.splice(i + 1, 0, watcher);
  53589. }
  53590. // queue the flush
  53591. if (!waiting) {
  53592. waiting = true;
  53593. if (!config.async) {
  53594. flushSchedulerQueue();
  53595. return
  53596. }
  53597. nextTick(flushSchedulerQueue);
  53598. }
  53599. }
  53600. }
  53601. /* */
  53602. var uid$2 = 0;
  53603. /**
  53604. * A watcher parses an expression, collects dependencies,
  53605. * and fires callback when the expression value changes.
  53606. * This is used for both the $watch() api and directives.
  53607. */
  53608. var Watcher = function Watcher (
  53609. vm,
  53610. expOrFn,
  53611. cb,
  53612. options,
  53613. isRenderWatcher
  53614. ) {
  53615. this.vm = vm;
  53616. if (isRenderWatcher) {
  53617. vm._watcher = this;
  53618. }
  53619. vm._watchers.push(this);
  53620. // options
  53621. if (options) {
  53622. this.deep = !!options.deep;
  53623. this.user = !!options.user;
  53624. this.lazy = !!options.lazy;
  53625. this.sync = !!options.sync;
  53626. this.before = options.before;
  53627. } else {
  53628. this.deep = this.user = this.lazy = this.sync = false;
  53629. }
  53630. this.cb = cb;
  53631. this.id = ++uid$2; // uid for batching
  53632. this.active = true;
  53633. this.dirty = this.lazy; // for lazy watchers
  53634. this.deps = [];
  53635. this.newDeps = [];
  53636. this.depIds = new _Set();
  53637. this.newDepIds = new _Set();
  53638. this.expression = expOrFn.toString();
  53639. // parse expression for getter
  53640. if (typeof expOrFn === 'function') {
  53641. this.getter = expOrFn;
  53642. } else {
  53643. this.getter = parsePath(expOrFn);
  53644. if (!this.getter) {
  53645. this.getter = noop;
  53646. warn(
  53647. "Failed watching path: \"" + expOrFn + "\" " +
  53648. 'Watcher only accepts simple dot-delimited paths. ' +
  53649. 'For full control, use a function instead.',
  53650. vm
  53651. );
  53652. }
  53653. }
  53654. this.value = this.lazy
  53655. ? undefined
  53656. : this.get();
  53657. };
  53658. /**
  53659. * Evaluate the getter, and re-collect dependencies.
  53660. */
  53661. Watcher.prototype.get = function get () {
  53662. pushTarget(this);
  53663. var value;
  53664. var vm = this.vm;
  53665. try {
  53666. value = this.getter.call(vm, vm);
  53667. } catch (e) {
  53668. if (this.user) {
  53669. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  53670. } else {
  53671. throw e
  53672. }
  53673. } finally {
  53674. // "touch" every property so they are all tracked as
  53675. // dependencies for deep watching
  53676. if (this.deep) {
  53677. traverse(value);
  53678. }
  53679. popTarget();
  53680. this.cleanupDeps();
  53681. }
  53682. return value
  53683. };
  53684. /**
  53685. * Add a dependency to this directive.
  53686. */
  53687. Watcher.prototype.addDep = function addDep (dep) {
  53688. var id = dep.id;
  53689. if (!this.newDepIds.has(id)) {
  53690. this.newDepIds.add(id);
  53691. this.newDeps.push(dep);
  53692. if (!this.depIds.has(id)) {
  53693. dep.addSub(this);
  53694. }
  53695. }
  53696. };
  53697. /**
  53698. * Clean up for dependency collection.
  53699. */
  53700. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  53701. var i = this.deps.length;
  53702. while (i--) {
  53703. var dep = this.deps[i];
  53704. if (!this.newDepIds.has(dep.id)) {
  53705. dep.removeSub(this);
  53706. }
  53707. }
  53708. var tmp = this.depIds;
  53709. this.depIds = this.newDepIds;
  53710. this.newDepIds = tmp;
  53711. this.newDepIds.clear();
  53712. tmp = this.deps;
  53713. this.deps = this.newDeps;
  53714. this.newDeps = tmp;
  53715. this.newDeps.length = 0;
  53716. };
  53717. /**
  53718. * Subscriber interface.
  53719. * Will be called when a dependency changes.
  53720. */
  53721. Watcher.prototype.update = function update () {
  53722. /* istanbul ignore else */
  53723. if (this.lazy) {
  53724. this.dirty = true;
  53725. } else if (this.sync) {
  53726. this.run();
  53727. } else {
  53728. queueWatcher(this);
  53729. }
  53730. };
  53731. /**
  53732. * Scheduler job interface.
  53733. * Will be called by the scheduler.
  53734. */
  53735. Watcher.prototype.run = function run () {
  53736. if (this.active) {
  53737. var value = this.get();
  53738. if (
  53739. value !== this.value ||
  53740. // Deep watchers and watchers on Object/Arrays should fire even
  53741. // when the value is the same, because the value may
  53742. // have mutated.
  53743. isObject(value) ||
  53744. this.deep
  53745. ) {
  53746. // set new value
  53747. var oldValue = this.value;
  53748. this.value = value;
  53749. if (this.user) {
  53750. try {
  53751. this.cb.call(this.vm, value, oldValue);
  53752. } catch (e) {
  53753. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  53754. }
  53755. } else {
  53756. this.cb.call(this.vm, value, oldValue);
  53757. }
  53758. }
  53759. }
  53760. };
  53761. /**
  53762. * Evaluate the value of the watcher.
  53763. * This only gets called for lazy watchers.
  53764. */
  53765. Watcher.prototype.evaluate = function evaluate () {
  53766. this.value = this.get();
  53767. this.dirty = false;
  53768. };
  53769. /**
  53770. * Depend on all deps collected by this watcher.
  53771. */
  53772. Watcher.prototype.depend = function depend () {
  53773. var i = this.deps.length;
  53774. while (i--) {
  53775. this.deps[i].depend();
  53776. }
  53777. };
  53778. /**
  53779. * Remove self from all dependencies' subscriber list.
  53780. */
  53781. Watcher.prototype.teardown = function teardown () {
  53782. if (this.active) {
  53783. // remove self from vm's watcher list
  53784. // this is a somewhat expensive operation so we skip it
  53785. // if the vm is being destroyed.
  53786. if (!this.vm._isBeingDestroyed) {
  53787. remove(this.vm._watchers, this);
  53788. }
  53789. var i = this.deps.length;
  53790. while (i--) {
  53791. this.deps[i].removeSub(this);
  53792. }
  53793. this.active = false;
  53794. }
  53795. };
  53796. /* */
  53797. var sharedPropertyDefinition = {
  53798. enumerable: true,
  53799. configurable: true,
  53800. get: noop,
  53801. set: noop
  53802. };
  53803. function proxy (target, sourceKey, key) {
  53804. sharedPropertyDefinition.get = function proxyGetter () {
  53805. return this[sourceKey][key]
  53806. };
  53807. sharedPropertyDefinition.set = function proxySetter (val) {
  53808. this[sourceKey][key] = val;
  53809. };
  53810. Object.defineProperty(target, key, sharedPropertyDefinition);
  53811. }
  53812. function initState (vm) {
  53813. vm._watchers = [];
  53814. var opts = vm.$options;
  53815. if (opts.props) { initProps(vm, opts.props); }
  53816. if (opts.methods) { initMethods(vm, opts.methods); }
  53817. if (opts.data) {
  53818. initData(vm);
  53819. } else {
  53820. observe(vm._data = {}, true /* asRootData */);
  53821. }
  53822. if (opts.computed) { initComputed(vm, opts.computed); }
  53823. if (opts.watch && opts.watch !== nativeWatch) {
  53824. initWatch(vm, opts.watch);
  53825. }
  53826. }
  53827. function initProps (vm, propsOptions) {
  53828. var propsData = vm.$options.propsData || {};
  53829. var props = vm._props = {};
  53830. // cache prop keys so that future props updates can iterate using Array
  53831. // instead of dynamic object key enumeration.
  53832. var keys = vm.$options._propKeys = [];
  53833. var isRoot = !vm.$parent;
  53834. // root instance props should be converted
  53835. if (!isRoot) {
  53836. toggleObserving(false);
  53837. }
  53838. var loop = function ( key ) {
  53839. keys.push(key);
  53840. var value = validateProp(key, propsOptions, propsData, vm);
  53841. /* istanbul ignore else */
  53842. {
  53843. var hyphenatedKey = hyphenate(key);
  53844. if (isReservedAttribute(hyphenatedKey) ||
  53845. config.isReservedAttr(hyphenatedKey)) {
  53846. warn(
  53847. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  53848. vm
  53849. );
  53850. }
  53851. defineReactive$$1(props, key, value, function () {
  53852. if (!isRoot && !isUpdatingChildComponent) {
  53853. warn(
  53854. "Avoid mutating a prop directly since the value will be " +
  53855. "overwritten whenever the parent component re-renders. " +
  53856. "Instead, use a data or computed property based on the prop's " +
  53857. "value. Prop being mutated: \"" + key + "\"",
  53858. vm
  53859. );
  53860. }
  53861. });
  53862. }
  53863. // static props are already proxied on the component's prototype
  53864. // during Vue.extend(). We only need to proxy props defined at
  53865. // instantiation here.
  53866. if (!(key in vm)) {
  53867. proxy(vm, "_props", key);
  53868. }
  53869. };
  53870. for (var key in propsOptions) loop( key );
  53871. toggleObserving(true);
  53872. }
  53873. function initData (vm) {
  53874. var data = vm.$options.data;
  53875. data = vm._data = typeof data === 'function'
  53876. ? getData(data, vm)
  53877. : data || {};
  53878. if (!isPlainObject(data)) {
  53879. data = {};
  53880. warn(
  53881. 'data functions should return an object:\n' +
  53882. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  53883. vm
  53884. );
  53885. }
  53886. // proxy data on instance
  53887. var keys = Object.keys(data);
  53888. var props = vm.$options.props;
  53889. var methods = vm.$options.methods;
  53890. var i = keys.length;
  53891. while (i--) {
  53892. var key = keys[i];
  53893. {
  53894. if (methods && hasOwn(methods, key)) {
  53895. warn(
  53896. ("Method \"" + key + "\" has already been defined as a data property."),
  53897. vm
  53898. );
  53899. }
  53900. }
  53901. if (props && hasOwn(props, key)) {
  53902. warn(
  53903. "The data property \"" + key + "\" is already declared as a prop. " +
  53904. "Use prop default value instead.",
  53905. vm
  53906. );
  53907. } else if (!isReserved(key)) {
  53908. proxy(vm, "_data", key);
  53909. }
  53910. }
  53911. // observe data
  53912. observe(data, true /* asRootData */);
  53913. }
  53914. function getData (data, vm) {
  53915. // #7573 disable dep collection when invoking data getters
  53916. pushTarget();
  53917. try {
  53918. return data.call(vm, vm)
  53919. } catch (e) {
  53920. handleError(e, vm, "data()");
  53921. return {}
  53922. } finally {
  53923. popTarget();
  53924. }
  53925. }
  53926. var computedWatcherOptions = { lazy: true };
  53927. function initComputed (vm, computed) {
  53928. // $flow-disable-line
  53929. var watchers = vm._computedWatchers = Object.create(null);
  53930. // computed properties are just getters during SSR
  53931. var isSSR = isServerRendering();
  53932. for (var key in computed) {
  53933. var userDef = computed[key];
  53934. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  53935. if (getter == null) {
  53936. warn(
  53937. ("Getter is missing for computed property \"" + key + "\"."),
  53938. vm
  53939. );
  53940. }
  53941. if (!isSSR) {
  53942. // create internal watcher for the computed property.
  53943. watchers[key] = new Watcher(
  53944. vm,
  53945. getter || noop,
  53946. noop,
  53947. computedWatcherOptions
  53948. );
  53949. }
  53950. // component-defined computed properties are already defined on the
  53951. // component prototype. We only need to define computed properties defined
  53952. // at instantiation here.
  53953. if (!(key in vm)) {
  53954. defineComputed(vm, key, userDef);
  53955. } else {
  53956. if (key in vm.$data) {
  53957. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  53958. } else if (vm.$options.props && key in vm.$options.props) {
  53959. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  53960. }
  53961. }
  53962. }
  53963. }
  53964. function defineComputed (
  53965. target,
  53966. key,
  53967. userDef
  53968. ) {
  53969. var shouldCache = !isServerRendering();
  53970. if (typeof userDef === 'function') {
  53971. sharedPropertyDefinition.get = shouldCache
  53972. ? createComputedGetter(key)
  53973. : createGetterInvoker(userDef);
  53974. sharedPropertyDefinition.set = noop;
  53975. } else {
  53976. sharedPropertyDefinition.get = userDef.get
  53977. ? shouldCache && userDef.cache !== false
  53978. ? createComputedGetter(key)
  53979. : createGetterInvoker(userDef.get)
  53980. : noop;
  53981. sharedPropertyDefinition.set = userDef.set || noop;
  53982. }
  53983. if (sharedPropertyDefinition.set === noop) {
  53984. sharedPropertyDefinition.set = function () {
  53985. warn(
  53986. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  53987. this
  53988. );
  53989. };
  53990. }
  53991. Object.defineProperty(target, key, sharedPropertyDefinition);
  53992. }
  53993. function createComputedGetter (key) {
  53994. return function computedGetter () {
  53995. var watcher = this._computedWatchers && this._computedWatchers[key];
  53996. if (watcher) {
  53997. if (watcher.dirty) {
  53998. watcher.evaluate();
  53999. }
  54000. if (Dep.target) {
  54001. watcher.depend();
  54002. }
  54003. return watcher.value
  54004. }
  54005. }
  54006. }
  54007. function createGetterInvoker(fn) {
  54008. return function computedGetter () {
  54009. return fn.call(this, this)
  54010. }
  54011. }
  54012. function initMethods (vm, methods) {
  54013. var props = vm.$options.props;
  54014. for (var key in methods) {
  54015. {
  54016. if (typeof methods[key] !== 'function') {
  54017. warn(
  54018. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  54019. "Did you reference the function correctly?",
  54020. vm
  54021. );
  54022. }
  54023. if (props && hasOwn(props, key)) {
  54024. warn(
  54025. ("Method \"" + key + "\" has already been defined as a prop."),
  54026. vm
  54027. );
  54028. }
  54029. if ((key in vm) && isReserved(key)) {
  54030. warn(
  54031. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  54032. "Avoid defining component methods that start with _ or $."
  54033. );
  54034. }
  54035. }
  54036. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  54037. }
  54038. }
  54039. function initWatch (vm, watch) {
  54040. for (var key in watch) {
  54041. var handler = watch[key];
  54042. if (Array.isArray(handler)) {
  54043. for (var i = 0; i < handler.length; i++) {
  54044. createWatcher(vm, key, handler[i]);
  54045. }
  54046. } else {
  54047. createWatcher(vm, key, handler);
  54048. }
  54049. }
  54050. }
  54051. function createWatcher (
  54052. vm,
  54053. expOrFn,
  54054. handler,
  54055. options
  54056. ) {
  54057. if (isPlainObject(handler)) {
  54058. options = handler;
  54059. handler = handler.handler;
  54060. }
  54061. if (typeof handler === 'string') {
  54062. handler = vm[handler];
  54063. }
  54064. return vm.$watch(expOrFn, handler, options)
  54065. }
  54066. function stateMixin (Vue) {
  54067. // flow somehow has problems with directly declared definition object
  54068. // when using Object.defineProperty, so we have to procedurally build up
  54069. // the object here.
  54070. var dataDef = {};
  54071. dataDef.get = function () { return this._data };
  54072. var propsDef = {};
  54073. propsDef.get = function () { return this._props };
  54074. {
  54075. dataDef.set = function () {
  54076. warn(
  54077. 'Avoid replacing instance root $data. ' +
  54078. 'Use nested data properties instead.',
  54079. this
  54080. );
  54081. };
  54082. propsDef.set = function () {
  54083. warn("$props is readonly.", this);
  54084. };
  54085. }
  54086. Object.defineProperty(Vue.prototype, '$data', dataDef);
  54087. Object.defineProperty(Vue.prototype, '$props', propsDef);
  54088. Vue.prototype.$set = set;
  54089. Vue.prototype.$delete = del;
  54090. Vue.prototype.$watch = function (
  54091. expOrFn,
  54092. cb,
  54093. options
  54094. ) {
  54095. var vm = this;
  54096. if (isPlainObject(cb)) {
  54097. return createWatcher(vm, expOrFn, cb, options)
  54098. }
  54099. options = options || {};
  54100. options.user = true;
  54101. var watcher = new Watcher(vm, expOrFn, cb, options);
  54102. if (options.immediate) {
  54103. try {
  54104. cb.call(vm, watcher.value);
  54105. } catch (error) {
  54106. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  54107. }
  54108. }
  54109. return function unwatchFn () {
  54110. watcher.teardown();
  54111. }
  54112. };
  54113. }
  54114. /* */
  54115. var uid$3 = 0;
  54116. function initMixin (Vue) {
  54117. Vue.prototype._init = function (options) {
  54118. var vm = this;
  54119. // a uid
  54120. vm._uid = uid$3++;
  54121. var startTag, endTag;
  54122. /* istanbul ignore if */
  54123. if (config.performance && mark) {
  54124. startTag = "vue-perf-start:" + (vm._uid);
  54125. endTag = "vue-perf-end:" + (vm._uid);
  54126. mark(startTag);
  54127. }
  54128. // a flag to avoid this being observed
  54129. vm._isVue = true;
  54130. // merge options
  54131. if (options && options._isComponent) {
  54132. // optimize internal component instantiation
  54133. // since dynamic options merging is pretty slow, and none of the
  54134. // internal component options needs special treatment.
  54135. initInternalComponent(vm, options);
  54136. } else {
  54137. vm.$options = mergeOptions(
  54138. resolveConstructorOptions(vm.constructor),
  54139. options || {},
  54140. vm
  54141. );
  54142. }
  54143. /* istanbul ignore else */
  54144. {
  54145. initProxy(vm);
  54146. }
  54147. // expose real self
  54148. vm._self = vm;
  54149. initLifecycle(vm);
  54150. initEvents(vm);
  54151. initRender(vm);
  54152. callHook(vm, 'beforeCreate');
  54153. initInjections(vm); // resolve injections before data/props
  54154. initState(vm);
  54155. initProvide(vm); // resolve provide after data/props
  54156. callHook(vm, 'created');
  54157. /* istanbul ignore if */
  54158. if (config.performance && mark) {
  54159. vm._name = formatComponentName(vm, false);
  54160. mark(endTag);
  54161. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  54162. }
  54163. if (vm.$options.el) {
  54164. vm.$mount(vm.$options.el);
  54165. }
  54166. };
  54167. }
  54168. function initInternalComponent (vm, options) {
  54169. var opts = vm.$options = Object.create(vm.constructor.options);
  54170. // doing this because it's faster than dynamic enumeration.
  54171. var parentVnode = options._parentVnode;
  54172. opts.parent = options.parent;
  54173. opts._parentVnode = parentVnode;
  54174. var vnodeComponentOptions = parentVnode.componentOptions;
  54175. opts.propsData = vnodeComponentOptions.propsData;
  54176. opts._parentListeners = vnodeComponentOptions.listeners;
  54177. opts._renderChildren = vnodeComponentOptions.children;
  54178. opts._componentTag = vnodeComponentOptions.tag;
  54179. if (options.render) {
  54180. opts.render = options.render;
  54181. opts.staticRenderFns = options.staticRenderFns;
  54182. }
  54183. }
  54184. function resolveConstructorOptions (Ctor) {
  54185. var options = Ctor.options;
  54186. if (Ctor.super) {
  54187. var superOptions = resolveConstructorOptions(Ctor.super);
  54188. var cachedSuperOptions = Ctor.superOptions;
  54189. if (superOptions !== cachedSuperOptions) {
  54190. // super option changed,
  54191. // need to resolve new options.
  54192. Ctor.superOptions = superOptions;
  54193. // check if there are any late-modified/attached options (#4976)
  54194. var modifiedOptions = resolveModifiedOptions(Ctor);
  54195. // update base extend options
  54196. if (modifiedOptions) {
  54197. extend(Ctor.extendOptions, modifiedOptions);
  54198. }
  54199. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  54200. if (options.name) {
  54201. options.components[options.name] = Ctor;
  54202. }
  54203. }
  54204. }
  54205. return options
  54206. }
  54207. function resolveModifiedOptions (Ctor) {
  54208. var modified;
  54209. var latest = Ctor.options;
  54210. var sealed = Ctor.sealedOptions;
  54211. for (var key in latest) {
  54212. if (latest[key] !== sealed[key]) {
  54213. if (!modified) { modified = {}; }
  54214. modified[key] = latest[key];
  54215. }
  54216. }
  54217. return modified
  54218. }
  54219. function Vue (options) {
  54220. if (!(this instanceof Vue)
  54221. ) {
  54222. warn('Vue is a constructor and should be called with the `new` keyword');
  54223. }
  54224. this._init(options);
  54225. }
  54226. initMixin(Vue);
  54227. stateMixin(Vue);
  54228. eventsMixin(Vue);
  54229. lifecycleMixin(Vue);
  54230. renderMixin(Vue);
  54231. /* */
  54232. function initUse (Vue) {
  54233. Vue.use = function (plugin) {
  54234. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  54235. if (installedPlugins.indexOf(plugin) > -1) {
  54236. return this
  54237. }
  54238. // additional parameters
  54239. var args = toArray(arguments, 1);
  54240. args.unshift(this);
  54241. if (typeof plugin.install === 'function') {
  54242. plugin.install.apply(plugin, args);
  54243. } else if (typeof plugin === 'function') {
  54244. plugin.apply(null, args);
  54245. }
  54246. installedPlugins.push(plugin);
  54247. return this
  54248. };
  54249. }
  54250. /* */
  54251. function initMixin$1 (Vue) {
  54252. Vue.mixin = function (mixin) {
  54253. this.options = mergeOptions(this.options, mixin);
  54254. return this
  54255. };
  54256. }
  54257. /* */
  54258. function initExtend (Vue) {
  54259. /**
  54260. * Each instance constructor, including Vue, has a unique
  54261. * cid. This enables us to create wrapped "child
  54262. * constructors" for prototypal inheritance and cache them.
  54263. */
  54264. Vue.cid = 0;
  54265. var cid = 1;
  54266. /**
  54267. * Class inheritance
  54268. */
  54269. Vue.extend = function (extendOptions) {
  54270. extendOptions = extendOptions || {};
  54271. var Super = this;
  54272. var SuperId = Super.cid;
  54273. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  54274. if (cachedCtors[SuperId]) {
  54275. return cachedCtors[SuperId]
  54276. }
  54277. var name = extendOptions.name || Super.options.name;
  54278. if (name) {
  54279. validateComponentName(name);
  54280. }
  54281. var Sub = function VueComponent (options) {
  54282. this._init(options);
  54283. };
  54284. Sub.prototype = Object.create(Super.prototype);
  54285. Sub.prototype.constructor = Sub;
  54286. Sub.cid = cid++;
  54287. Sub.options = mergeOptions(
  54288. Super.options,
  54289. extendOptions
  54290. );
  54291. Sub['super'] = Super;
  54292. // For props and computed properties, we define the proxy getters on
  54293. // the Vue instances at extension time, on the extended prototype. This
  54294. // avoids Object.defineProperty calls for each instance created.
  54295. if (Sub.options.props) {
  54296. initProps$1(Sub);
  54297. }
  54298. if (Sub.options.computed) {
  54299. initComputed$1(Sub);
  54300. }
  54301. // allow further extension/mixin/plugin usage
  54302. Sub.extend = Super.extend;
  54303. Sub.mixin = Super.mixin;
  54304. Sub.use = Super.use;
  54305. // create asset registers, so extended classes
  54306. // can have their private assets too.
  54307. ASSET_TYPES.forEach(function (type) {
  54308. Sub[type] = Super[type];
  54309. });
  54310. // enable recursive self-lookup
  54311. if (name) {
  54312. Sub.options.components[name] = Sub;
  54313. }
  54314. // keep a reference to the super options at extension time.
  54315. // later at instantiation we can check if Super's options have
  54316. // been updated.
  54317. Sub.superOptions = Super.options;
  54318. Sub.extendOptions = extendOptions;
  54319. Sub.sealedOptions = extend({}, Sub.options);
  54320. // cache constructor
  54321. cachedCtors[SuperId] = Sub;
  54322. return Sub
  54323. };
  54324. }
  54325. function initProps$1 (Comp) {
  54326. var props = Comp.options.props;
  54327. for (var key in props) {
  54328. proxy(Comp.prototype, "_props", key);
  54329. }
  54330. }
  54331. function initComputed$1 (Comp) {
  54332. var computed = Comp.options.computed;
  54333. for (var key in computed) {
  54334. defineComputed(Comp.prototype, key, computed[key]);
  54335. }
  54336. }
  54337. /* */
  54338. function initAssetRegisters (Vue) {
  54339. /**
  54340. * Create asset registration methods.
  54341. */
  54342. ASSET_TYPES.forEach(function (type) {
  54343. Vue[type] = function (
  54344. id,
  54345. definition
  54346. ) {
  54347. if (!definition) {
  54348. return this.options[type + 's'][id]
  54349. } else {
  54350. /* istanbul ignore if */
  54351. if (type === 'component') {
  54352. validateComponentName(id);
  54353. }
  54354. if (type === 'component' && isPlainObject(definition)) {
  54355. definition.name = definition.name || id;
  54356. definition = this.options._base.extend(definition);
  54357. }
  54358. if (type === 'directive' && typeof definition === 'function') {
  54359. definition = { bind: definition, update: definition };
  54360. }
  54361. this.options[type + 's'][id] = definition;
  54362. return definition
  54363. }
  54364. };
  54365. });
  54366. }
  54367. /* */
  54368. function getComponentName (opts) {
  54369. return opts && (opts.Ctor.options.name || opts.tag)
  54370. }
  54371. function matches (pattern, name) {
  54372. if (Array.isArray(pattern)) {
  54373. return pattern.indexOf(name) > -1
  54374. } else if (typeof pattern === 'string') {
  54375. return pattern.split(',').indexOf(name) > -1
  54376. } else if (isRegExp(pattern)) {
  54377. return pattern.test(name)
  54378. }
  54379. /* istanbul ignore next */
  54380. return false
  54381. }
  54382. function pruneCache (keepAliveInstance, filter) {
  54383. var cache = keepAliveInstance.cache;
  54384. var keys = keepAliveInstance.keys;
  54385. var _vnode = keepAliveInstance._vnode;
  54386. for (var key in cache) {
  54387. var cachedNode = cache[key];
  54388. if (cachedNode) {
  54389. var name = getComponentName(cachedNode.componentOptions);
  54390. if (name && !filter(name)) {
  54391. pruneCacheEntry(cache, key, keys, _vnode);
  54392. }
  54393. }
  54394. }
  54395. }
  54396. function pruneCacheEntry (
  54397. cache,
  54398. key,
  54399. keys,
  54400. current
  54401. ) {
  54402. var cached$$1 = cache[key];
  54403. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  54404. cached$$1.componentInstance.$destroy();
  54405. }
  54406. cache[key] = null;
  54407. remove(keys, key);
  54408. }
  54409. var patternTypes = [String, RegExp, Array];
  54410. var KeepAlive = {
  54411. name: 'keep-alive',
  54412. abstract: true,
  54413. props: {
  54414. include: patternTypes,
  54415. exclude: patternTypes,
  54416. max: [String, Number]
  54417. },
  54418. created: function created () {
  54419. this.cache = Object.create(null);
  54420. this.keys = [];
  54421. },
  54422. destroyed: function destroyed () {
  54423. for (var key in this.cache) {
  54424. pruneCacheEntry(this.cache, key, this.keys);
  54425. }
  54426. },
  54427. mounted: function mounted () {
  54428. var this$1 = this;
  54429. this.$watch('include', function (val) {
  54430. pruneCache(this$1, function (name) { return matches(val, name); });
  54431. });
  54432. this.$watch('exclude', function (val) {
  54433. pruneCache(this$1, function (name) { return !matches(val, name); });
  54434. });
  54435. },
  54436. render: function render () {
  54437. var slot = this.$slots.default;
  54438. var vnode = getFirstComponentChild(slot);
  54439. var componentOptions = vnode && vnode.componentOptions;
  54440. if (componentOptions) {
  54441. // check pattern
  54442. var name = getComponentName(componentOptions);
  54443. var ref = this;
  54444. var include = ref.include;
  54445. var exclude = ref.exclude;
  54446. if (
  54447. // not included
  54448. (include && (!name || !matches(include, name))) ||
  54449. // excluded
  54450. (exclude && name && matches(exclude, name))
  54451. ) {
  54452. return vnode
  54453. }
  54454. var ref$1 = this;
  54455. var cache = ref$1.cache;
  54456. var keys = ref$1.keys;
  54457. var key = vnode.key == null
  54458. // same constructor may get registered as different local components
  54459. // so cid alone is not enough (#3269)
  54460. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  54461. : vnode.key;
  54462. if (cache[key]) {
  54463. vnode.componentInstance = cache[key].componentInstance;
  54464. // make current key freshest
  54465. remove(keys, key);
  54466. keys.push(key);
  54467. } else {
  54468. cache[key] = vnode;
  54469. keys.push(key);
  54470. // prune oldest entry
  54471. if (this.max && keys.length > parseInt(this.max)) {
  54472. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  54473. }
  54474. }
  54475. vnode.data.keepAlive = true;
  54476. }
  54477. return vnode || (slot && slot[0])
  54478. }
  54479. };
  54480. var builtInComponents = {
  54481. KeepAlive: KeepAlive
  54482. };
  54483. /* */
  54484. function initGlobalAPI (Vue) {
  54485. // config
  54486. var configDef = {};
  54487. configDef.get = function () { return config; };
  54488. {
  54489. configDef.set = function () {
  54490. warn(
  54491. 'Do not replace the Vue.config object, set individual fields instead.'
  54492. );
  54493. };
  54494. }
  54495. Object.defineProperty(Vue, 'config', configDef);
  54496. // exposed util methods.
  54497. // NOTE: these are not considered part of the public API - avoid relying on
  54498. // them unless you are aware of the risk.
  54499. Vue.util = {
  54500. warn: warn,
  54501. extend: extend,
  54502. mergeOptions: mergeOptions,
  54503. defineReactive: defineReactive$$1
  54504. };
  54505. Vue.set = set;
  54506. Vue.delete = del;
  54507. Vue.nextTick = nextTick;
  54508. // 2.6 explicit observable API
  54509. Vue.observable = function (obj) {
  54510. observe(obj);
  54511. return obj
  54512. };
  54513. Vue.options = Object.create(null);
  54514. ASSET_TYPES.forEach(function (type) {
  54515. Vue.options[type + 's'] = Object.create(null);
  54516. });
  54517. // this is used to identify the "base" constructor to extend all plain-object
  54518. // components with in Weex's multi-instance scenarios.
  54519. Vue.options._base = Vue;
  54520. extend(Vue.options.components, builtInComponents);
  54521. initUse(Vue);
  54522. initMixin$1(Vue);
  54523. initExtend(Vue);
  54524. initAssetRegisters(Vue);
  54525. }
  54526. initGlobalAPI(Vue);
  54527. Object.defineProperty(Vue.prototype, '$isServer', {
  54528. get: isServerRendering
  54529. });
  54530. Object.defineProperty(Vue.prototype, '$ssrContext', {
  54531. get: function get () {
  54532. /* istanbul ignore next */
  54533. return this.$vnode && this.$vnode.ssrContext
  54534. }
  54535. });
  54536. // expose FunctionalRenderContext for ssr runtime helper installation
  54537. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  54538. value: FunctionalRenderContext
  54539. });
  54540. Vue.version = '2.6.11';
  54541. /* */
  54542. // these are reserved for web because they are directly compiled away
  54543. // during template compilation
  54544. var isReservedAttr = makeMap('style,class');
  54545. // attributes that should be using props for binding
  54546. var acceptValue = makeMap('input,textarea,option,select,progress');
  54547. var mustUseProp = function (tag, type, attr) {
  54548. return (
  54549. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  54550. (attr === 'selected' && tag === 'option') ||
  54551. (attr === 'checked' && tag === 'input') ||
  54552. (attr === 'muted' && tag === 'video')
  54553. )
  54554. };
  54555. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  54556. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  54557. var convertEnumeratedValue = function (key, value) {
  54558. return isFalsyAttrValue(value) || value === 'false'
  54559. ? 'false'
  54560. // allow arbitrary string value for contenteditable
  54561. : key === 'contenteditable' && isValidContentEditableValue(value)
  54562. ? value
  54563. : 'true'
  54564. };
  54565. var isBooleanAttr = makeMap(
  54566. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  54567. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  54568. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  54569. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  54570. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  54571. 'truespeed,typemustmatch,visible'
  54572. );
  54573. var xlinkNS = 'http://www.w3.org/1999/xlink';
  54574. var isXlink = function (name) {
  54575. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  54576. };
  54577. var getXlinkProp = function (name) {
  54578. return isXlink(name) ? name.slice(6, name.length) : ''
  54579. };
  54580. var isFalsyAttrValue = function (val) {
  54581. return val == null || val === false
  54582. };
  54583. /* */
  54584. function genClassForVnode (vnode) {
  54585. var data = vnode.data;
  54586. var parentNode = vnode;
  54587. var childNode = vnode;
  54588. while (isDef(childNode.componentInstance)) {
  54589. childNode = childNode.componentInstance._vnode;
  54590. if (childNode && childNode.data) {
  54591. data = mergeClassData(childNode.data, data);
  54592. }
  54593. }
  54594. while (isDef(parentNode = parentNode.parent)) {
  54595. if (parentNode && parentNode.data) {
  54596. data = mergeClassData(data, parentNode.data);
  54597. }
  54598. }
  54599. return renderClass(data.staticClass, data.class)
  54600. }
  54601. function mergeClassData (child, parent) {
  54602. return {
  54603. staticClass: concat(child.staticClass, parent.staticClass),
  54604. class: isDef(child.class)
  54605. ? [child.class, parent.class]
  54606. : parent.class
  54607. }
  54608. }
  54609. function renderClass (
  54610. staticClass,
  54611. dynamicClass
  54612. ) {
  54613. if (isDef(staticClass) || isDef(dynamicClass)) {
  54614. return concat(staticClass, stringifyClass(dynamicClass))
  54615. }
  54616. /* istanbul ignore next */
  54617. return ''
  54618. }
  54619. function concat (a, b) {
  54620. return a ? b ? (a + ' ' + b) : a : (b || '')
  54621. }
  54622. function stringifyClass (value) {
  54623. if (Array.isArray(value)) {
  54624. return stringifyArray(value)
  54625. }
  54626. if (isObject(value)) {
  54627. return stringifyObject(value)
  54628. }
  54629. if (typeof value === 'string') {
  54630. return value
  54631. }
  54632. /* istanbul ignore next */
  54633. return ''
  54634. }
  54635. function stringifyArray (value) {
  54636. var res = '';
  54637. var stringified;
  54638. for (var i = 0, l = value.length; i < l; i++) {
  54639. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  54640. if (res) { res += ' '; }
  54641. res += stringified;
  54642. }
  54643. }
  54644. return res
  54645. }
  54646. function stringifyObject (value) {
  54647. var res = '';
  54648. for (var key in value) {
  54649. if (value[key]) {
  54650. if (res) { res += ' '; }
  54651. res += key;
  54652. }
  54653. }
  54654. return res
  54655. }
  54656. /* */
  54657. var namespaceMap = {
  54658. svg: 'http://www.w3.org/2000/svg',
  54659. math: 'http://www.w3.org/1998/Math/MathML'
  54660. };
  54661. var isHTMLTag = makeMap(
  54662. 'html,body,base,head,link,meta,style,title,' +
  54663. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  54664. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  54665. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  54666. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  54667. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  54668. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  54669. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  54670. 'output,progress,select,textarea,' +
  54671. 'details,dialog,menu,menuitem,summary,' +
  54672. 'content,element,shadow,template,blockquote,iframe,tfoot'
  54673. );
  54674. // this map is intentionally selective, only covering SVG elements that may
  54675. // contain child elements.
  54676. var isSVG = makeMap(
  54677. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  54678. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  54679. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  54680. true
  54681. );
  54682. var isPreTag = function (tag) { return tag === 'pre'; };
  54683. var isReservedTag = function (tag) {
  54684. return isHTMLTag(tag) || isSVG(tag)
  54685. };
  54686. function getTagNamespace (tag) {
  54687. if (isSVG(tag)) {
  54688. return 'svg'
  54689. }
  54690. // basic support for MathML
  54691. // note it doesn't support other MathML elements being component roots
  54692. if (tag === 'math') {
  54693. return 'math'
  54694. }
  54695. }
  54696. var unknownElementCache = Object.create(null);
  54697. function isUnknownElement (tag) {
  54698. /* istanbul ignore if */
  54699. if (!inBrowser) {
  54700. return true
  54701. }
  54702. if (isReservedTag(tag)) {
  54703. return false
  54704. }
  54705. tag = tag.toLowerCase();
  54706. /* istanbul ignore if */
  54707. if (unknownElementCache[tag] != null) {
  54708. return unknownElementCache[tag]
  54709. }
  54710. var el = document.createElement(tag);
  54711. if (tag.indexOf('-') > -1) {
  54712. // http://stackoverflow.com/a/28210364/1070244
  54713. return (unknownElementCache[tag] = (
  54714. el.constructor === window.HTMLUnknownElement ||
  54715. el.constructor === window.HTMLElement
  54716. ))
  54717. } else {
  54718. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  54719. }
  54720. }
  54721. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  54722. /* */
  54723. /**
  54724. * Query an element selector if it's not an element already.
  54725. */
  54726. function query (el) {
  54727. if (typeof el === 'string') {
  54728. var selected = document.querySelector(el);
  54729. if (!selected) {
  54730. warn(
  54731. 'Cannot find element: ' + el
  54732. );
  54733. return document.createElement('div')
  54734. }
  54735. return selected
  54736. } else {
  54737. return el
  54738. }
  54739. }
  54740. /* */
  54741. function createElement$1 (tagName, vnode) {
  54742. var elm = document.createElement(tagName);
  54743. if (tagName !== 'select') {
  54744. return elm
  54745. }
  54746. // false or null will remove the attribute but undefined will not
  54747. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  54748. elm.setAttribute('multiple', 'multiple');
  54749. }
  54750. return elm
  54751. }
  54752. function createElementNS (namespace, tagName) {
  54753. return document.createElementNS(namespaceMap[namespace], tagName)
  54754. }
  54755. function createTextNode (text) {
  54756. return document.createTextNode(text)
  54757. }
  54758. function createComment (text) {
  54759. return document.createComment(text)
  54760. }
  54761. function insertBefore (parentNode, newNode, referenceNode) {
  54762. parentNode.insertBefore(newNode, referenceNode);
  54763. }
  54764. function removeChild (node, child) {
  54765. node.removeChild(child);
  54766. }
  54767. function appendChild (node, child) {
  54768. node.appendChild(child);
  54769. }
  54770. function parentNode (node) {
  54771. return node.parentNode
  54772. }
  54773. function nextSibling (node) {
  54774. return node.nextSibling
  54775. }
  54776. function tagName (node) {
  54777. return node.tagName
  54778. }
  54779. function setTextContent (node, text) {
  54780. node.textContent = text;
  54781. }
  54782. function setStyleScope (node, scopeId) {
  54783. node.setAttribute(scopeId, '');
  54784. }
  54785. var nodeOps = /*#__PURE__*/Object.freeze({
  54786. createElement: createElement$1,
  54787. createElementNS: createElementNS,
  54788. createTextNode: createTextNode,
  54789. createComment: createComment,
  54790. insertBefore: insertBefore,
  54791. removeChild: removeChild,
  54792. appendChild: appendChild,
  54793. parentNode: parentNode,
  54794. nextSibling: nextSibling,
  54795. tagName: tagName,
  54796. setTextContent: setTextContent,
  54797. setStyleScope: setStyleScope
  54798. });
  54799. /* */
  54800. var ref = {
  54801. create: function create (_, vnode) {
  54802. registerRef(vnode);
  54803. },
  54804. update: function update (oldVnode, vnode) {
  54805. if (oldVnode.data.ref !== vnode.data.ref) {
  54806. registerRef(oldVnode, true);
  54807. registerRef(vnode);
  54808. }
  54809. },
  54810. destroy: function destroy (vnode) {
  54811. registerRef(vnode, true);
  54812. }
  54813. };
  54814. function registerRef (vnode, isRemoval) {
  54815. var key = vnode.data.ref;
  54816. if (!isDef(key)) { return }
  54817. var vm = vnode.context;
  54818. var ref = vnode.componentInstance || vnode.elm;
  54819. var refs = vm.$refs;
  54820. if (isRemoval) {
  54821. if (Array.isArray(refs[key])) {
  54822. remove(refs[key], ref);
  54823. } else if (refs[key] === ref) {
  54824. refs[key] = undefined;
  54825. }
  54826. } else {
  54827. if (vnode.data.refInFor) {
  54828. if (!Array.isArray(refs[key])) {
  54829. refs[key] = [ref];
  54830. } else if (refs[key].indexOf(ref) < 0) {
  54831. // $flow-disable-line
  54832. refs[key].push(ref);
  54833. }
  54834. } else {
  54835. refs[key] = ref;
  54836. }
  54837. }
  54838. }
  54839. /**
  54840. * Virtual DOM patching algorithm based on Snabbdom by
  54841. * Simon Friis Vindum (@paldepind)
  54842. * Licensed under the MIT License
  54843. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  54844. *
  54845. * modified by Evan You (@yyx990803)
  54846. *
  54847. * Not type-checking this because this file is perf-critical and the cost
  54848. * of making flow understand it is not worth it.
  54849. */
  54850. var emptyNode = new VNode('', {}, []);
  54851. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  54852. function sameVnode (a, b) {
  54853. return (
  54854. a.key === b.key && (
  54855. (
  54856. a.tag === b.tag &&
  54857. a.isComment === b.isComment &&
  54858. isDef(a.data) === isDef(b.data) &&
  54859. sameInputType(a, b)
  54860. ) || (
  54861. isTrue(a.isAsyncPlaceholder) &&
  54862. a.asyncFactory === b.asyncFactory &&
  54863. isUndef(b.asyncFactory.error)
  54864. )
  54865. )
  54866. )
  54867. }
  54868. function sameInputType (a, b) {
  54869. if (a.tag !== 'input') { return true }
  54870. var i;
  54871. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  54872. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  54873. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  54874. }
  54875. function createKeyToOldIdx (children, beginIdx, endIdx) {
  54876. var i, key;
  54877. var map = {};
  54878. for (i = beginIdx; i <= endIdx; ++i) {
  54879. key = children[i].key;
  54880. if (isDef(key)) { map[key] = i; }
  54881. }
  54882. return map
  54883. }
  54884. function createPatchFunction (backend) {
  54885. var i, j;
  54886. var cbs = {};
  54887. var modules = backend.modules;
  54888. var nodeOps = backend.nodeOps;
  54889. for (i = 0; i < hooks.length; ++i) {
  54890. cbs[hooks[i]] = [];
  54891. for (j = 0; j < modules.length; ++j) {
  54892. if (isDef(modules[j][hooks[i]])) {
  54893. cbs[hooks[i]].push(modules[j][hooks[i]]);
  54894. }
  54895. }
  54896. }
  54897. function emptyNodeAt (elm) {
  54898. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  54899. }
  54900. function createRmCb (childElm, listeners) {
  54901. function remove$$1 () {
  54902. if (--remove$$1.listeners === 0) {
  54903. removeNode(childElm);
  54904. }
  54905. }
  54906. remove$$1.listeners = listeners;
  54907. return remove$$1
  54908. }
  54909. function removeNode (el) {
  54910. var parent = nodeOps.parentNode(el);
  54911. // element may have already been removed due to v-html / v-text
  54912. if (isDef(parent)) {
  54913. nodeOps.removeChild(parent, el);
  54914. }
  54915. }
  54916. function isUnknownElement$$1 (vnode, inVPre) {
  54917. return (
  54918. !inVPre &&
  54919. !vnode.ns &&
  54920. !(
  54921. config.ignoredElements.length &&
  54922. config.ignoredElements.some(function (ignore) {
  54923. return isRegExp(ignore)
  54924. ? ignore.test(vnode.tag)
  54925. : ignore === vnode.tag
  54926. })
  54927. ) &&
  54928. config.isUnknownElement(vnode.tag)
  54929. )
  54930. }
  54931. var creatingElmInVPre = 0;
  54932. function createElm (
  54933. vnode,
  54934. insertedVnodeQueue,
  54935. parentElm,
  54936. refElm,
  54937. nested,
  54938. ownerArray,
  54939. index
  54940. ) {
  54941. if (isDef(vnode.elm) && isDef(ownerArray)) {
  54942. // This vnode was used in a previous render!
  54943. // now it's used as a new node, overwriting its elm would cause
  54944. // potential patch errors down the road when it's used as an insertion
  54945. // reference node. Instead, we clone the node on-demand before creating
  54946. // associated DOM element for it.
  54947. vnode = ownerArray[index] = cloneVNode(vnode);
  54948. }
  54949. vnode.isRootInsert = !nested; // for transition enter check
  54950. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  54951. return
  54952. }
  54953. var data = vnode.data;
  54954. var children = vnode.children;
  54955. var tag = vnode.tag;
  54956. if (isDef(tag)) {
  54957. {
  54958. if (data && data.pre) {
  54959. creatingElmInVPre++;
  54960. }
  54961. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  54962. warn(
  54963. 'Unknown custom element: <' + tag + '> - did you ' +
  54964. 'register the component correctly? For recursive components, ' +
  54965. 'make sure to provide the "name" option.',
  54966. vnode.context
  54967. );
  54968. }
  54969. }
  54970. vnode.elm = vnode.ns
  54971. ? nodeOps.createElementNS(vnode.ns, tag)
  54972. : nodeOps.createElement(tag, vnode);
  54973. setScope(vnode);
  54974. /* istanbul ignore if */
  54975. {
  54976. createChildren(vnode, children, insertedVnodeQueue);
  54977. if (isDef(data)) {
  54978. invokeCreateHooks(vnode, insertedVnodeQueue);
  54979. }
  54980. insert(parentElm, vnode.elm, refElm);
  54981. }
  54982. if (data && data.pre) {
  54983. creatingElmInVPre--;
  54984. }
  54985. } else if (isTrue(vnode.isComment)) {
  54986. vnode.elm = nodeOps.createComment(vnode.text);
  54987. insert(parentElm, vnode.elm, refElm);
  54988. } else {
  54989. vnode.elm = nodeOps.createTextNode(vnode.text);
  54990. insert(parentElm, vnode.elm, refElm);
  54991. }
  54992. }
  54993. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  54994. var i = vnode.data;
  54995. if (isDef(i)) {
  54996. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  54997. if (isDef(i = i.hook) && isDef(i = i.init)) {
  54998. i(vnode, false /* hydrating */);
  54999. }
  55000. // after calling the init hook, if the vnode is a child component
  55001. // it should've created a child instance and mounted it. the child
  55002. // component also has set the placeholder vnode's elm.
  55003. // in that case we can just return the element and be done.
  55004. if (isDef(vnode.componentInstance)) {
  55005. initComponent(vnode, insertedVnodeQueue);
  55006. insert(parentElm, vnode.elm, refElm);
  55007. if (isTrue(isReactivated)) {
  55008. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  55009. }
  55010. return true
  55011. }
  55012. }
  55013. }
  55014. function initComponent (vnode, insertedVnodeQueue) {
  55015. if (isDef(vnode.data.pendingInsert)) {
  55016. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  55017. vnode.data.pendingInsert = null;
  55018. }
  55019. vnode.elm = vnode.componentInstance.$el;
  55020. if (isPatchable(vnode)) {
  55021. invokeCreateHooks(vnode, insertedVnodeQueue);
  55022. setScope(vnode);
  55023. } else {
  55024. // empty component root.
  55025. // skip all element-related modules except for ref (#3455)
  55026. registerRef(vnode);
  55027. // make sure to invoke the insert hook
  55028. insertedVnodeQueue.push(vnode);
  55029. }
  55030. }
  55031. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  55032. var i;
  55033. // hack for #4339: a reactivated component with inner transition
  55034. // does not trigger because the inner node's created hooks are not called
  55035. // again. It's not ideal to involve module-specific logic in here but
  55036. // there doesn't seem to be a better way to do it.
  55037. var innerNode = vnode;
  55038. while (innerNode.componentInstance) {
  55039. innerNode = innerNode.componentInstance._vnode;
  55040. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  55041. for (i = 0; i < cbs.activate.length; ++i) {
  55042. cbs.activate[i](emptyNode, innerNode);
  55043. }
  55044. insertedVnodeQueue.push(innerNode);
  55045. break
  55046. }
  55047. }
  55048. // unlike a newly created component,
  55049. // a reactivated keep-alive component doesn't insert itself
  55050. insert(parentElm, vnode.elm, refElm);
  55051. }
  55052. function insert (parent, elm, ref$$1) {
  55053. if (isDef(parent)) {
  55054. if (isDef(ref$$1)) {
  55055. if (nodeOps.parentNode(ref$$1) === parent) {
  55056. nodeOps.insertBefore(parent, elm, ref$$1);
  55057. }
  55058. } else {
  55059. nodeOps.appendChild(parent, elm);
  55060. }
  55061. }
  55062. }
  55063. function createChildren (vnode, children, insertedVnodeQueue) {
  55064. if (Array.isArray(children)) {
  55065. {
  55066. checkDuplicateKeys(children);
  55067. }
  55068. for (var i = 0; i < children.length; ++i) {
  55069. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  55070. }
  55071. } else if (isPrimitive(vnode.text)) {
  55072. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  55073. }
  55074. }
  55075. function isPatchable (vnode) {
  55076. while (vnode.componentInstance) {
  55077. vnode = vnode.componentInstance._vnode;
  55078. }
  55079. return isDef(vnode.tag)
  55080. }
  55081. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  55082. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  55083. cbs.create[i$1](emptyNode, vnode);
  55084. }
  55085. i = vnode.data.hook; // Reuse variable
  55086. if (isDef(i)) {
  55087. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  55088. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  55089. }
  55090. }
  55091. // set scope id attribute for scoped CSS.
  55092. // this is implemented as a special case to avoid the overhead
  55093. // of going through the normal attribute patching process.
  55094. function setScope (vnode) {
  55095. var i;
  55096. if (isDef(i = vnode.fnScopeId)) {
  55097. nodeOps.setStyleScope(vnode.elm, i);
  55098. } else {
  55099. var ancestor = vnode;
  55100. while (ancestor) {
  55101. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  55102. nodeOps.setStyleScope(vnode.elm, i);
  55103. }
  55104. ancestor = ancestor.parent;
  55105. }
  55106. }
  55107. // for slot content they should also get the scopeId from the host instance.
  55108. if (isDef(i = activeInstance) &&
  55109. i !== vnode.context &&
  55110. i !== vnode.fnContext &&
  55111. isDef(i = i.$options._scopeId)
  55112. ) {
  55113. nodeOps.setStyleScope(vnode.elm, i);
  55114. }
  55115. }
  55116. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  55117. for (; startIdx <= endIdx; ++startIdx) {
  55118. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  55119. }
  55120. }
  55121. function invokeDestroyHook (vnode) {
  55122. var i, j;
  55123. var data = vnode.data;
  55124. if (isDef(data)) {
  55125. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  55126. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  55127. }
  55128. if (isDef(i = vnode.children)) {
  55129. for (j = 0; j < vnode.children.length; ++j) {
  55130. invokeDestroyHook(vnode.children[j]);
  55131. }
  55132. }
  55133. }
  55134. function removeVnodes (vnodes, startIdx, endIdx) {
  55135. for (; startIdx <= endIdx; ++startIdx) {
  55136. var ch = vnodes[startIdx];
  55137. if (isDef(ch)) {
  55138. if (isDef(ch.tag)) {
  55139. removeAndInvokeRemoveHook(ch);
  55140. invokeDestroyHook(ch);
  55141. } else { // Text node
  55142. removeNode(ch.elm);
  55143. }
  55144. }
  55145. }
  55146. }
  55147. function removeAndInvokeRemoveHook (vnode, rm) {
  55148. if (isDef(rm) || isDef(vnode.data)) {
  55149. var i;
  55150. var listeners = cbs.remove.length + 1;
  55151. if (isDef(rm)) {
  55152. // we have a recursively passed down rm callback
  55153. // increase the listeners count
  55154. rm.listeners += listeners;
  55155. } else {
  55156. // directly removing
  55157. rm = createRmCb(vnode.elm, listeners);
  55158. }
  55159. // recursively invoke hooks on child component root node
  55160. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  55161. removeAndInvokeRemoveHook(i, rm);
  55162. }
  55163. for (i = 0; i < cbs.remove.length; ++i) {
  55164. cbs.remove[i](vnode, rm);
  55165. }
  55166. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  55167. i(vnode, rm);
  55168. } else {
  55169. rm();
  55170. }
  55171. } else {
  55172. removeNode(vnode.elm);
  55173. }
  55174. }
  55175. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  55176. var oldStartIdx = 0;
  55177. var newStartIdx = 0;
  55178. var oldEndIdx = oldCh.length - 1;
  55179. var oldStartVnode = oldCh[0];
  55180. var oldEndVnode = oldCh[oldEndIdx];
  55181. var newEndIdx = newCh.length - 1;
  55182. var newStartVnode = newCh[0];
  55183. var newEndVnode = newCh[newEndIdx];
  55184. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  55185. // removeOnly is a special flag used only by <transition-group>
  55186. // to ensure removed elements stay in correct relative positions
  55187. // during leaving transitions
  55188. var canMove = !removeOnly;
  55189. {
  55190. checkDuplicateKeys(newCh);
  55191. }
  55192. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  55193. if (isUndef(oldStartVnode)) {
  55194. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  55195. } else if (isUndef(oldEndVnode)) {
  55196. oldEndVnode = oldCh[--oldEndIdx];
  55197. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  55198. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  55199. oldStartVnode = oldCh[++oldStartIdx];
  55200. newStartVnode = newCh[++newStartIdx];
  55201. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  55202. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  55203. oldEndVnode = oldCh[--oldEndIdx];
  55204. newEndVnode = newCh[--newEndIdx];
  55205. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  55206. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  55207. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  55208. oldStartVnode = oldCh[++oldStartIdx];
  55209. newEndVnode = newCh[--newEndIdx];
  55210. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  55211. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  55212. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  55213. oldEndVnode = oldCh[--oldEndIdx];
  55214. newStartVnode = newCh[++newStartIdx];
  55215. } else {
  55216. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  55217. idxInOld = isDef(newStartVnode.key)
  55218. ? oldKeyToIdx[newStartVnode.key]
  55219. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  55220. if (isUndef(idxInOld)) { // New element
  55221. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  55222. } else {
  55223. vnodeToMove = oldCh[idxInOld];
  55224. if (sameVnode(vnodeToMove, newStartVnode)) {
  55225. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  55226. oldCh[idxInOld] = undefined;
  55227. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  55228. } else {
  55229. // same key but different element. treat as new element
  55230. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  55231. }
  55232. }
  55233. newStartVnode = newCh[++newStartIdx];
  55234. }
  55235. }
  55236. if (oldStartIdx > oldEndIdx) {
  55237. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  55238. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  55239. } else if (newStartIdx > newEndIdx) {
  55240. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  55241. }
  55242. }
  55243. function checkDuplicateKeys (children) {
  55244. var seenKeys = {};
  55245. for (var i = 0; i < children.length; i++) {
  55246. var vnode = children[i];
  55247. var key = vnode.key;
  55248. if (isDef(key)) {
  55249. if (seenKeys[key]) {
  55250. warn(
  55251. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  55252. vnode.context
  55253. );
  55254. } else {
  55255. seenKeys[key] = true;
  55256. }
  55257. }
  55258. }
  55259. }
  55260. function findIdxInOld (node, oldCh, start, end) {
  55261. for (var i = start; i < end; i++) {
  55262. var c = oldCh[i];
  55263. if (isDef(c) && sameVnode(node, c)) { return i }
  55264. }
  55265. }
  55266. function patchVnode (
  55267. oldVnode,
  55268. vnode,
  55269. insertedVnodeQueue,
  55270. ownerArray,
  55271. index,
  55272. removeOnly
  55273. ) {
  55274. if (oldVnode === vnode) {
  55275. return
  55276. }
  55277. if (isDef(vnode.elm) && isDef(ownerArray)) {
  55278. // clone reused vnode
  55279. vnode = ownerArray[index] = cloneVNode(vnode);
  55280. }
  55281. var elm = vnode.elm = oldVnode.elm;
  55282. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  55283. if (isDef(vnode.asyncFactory.resolved)) {
  55284. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  55285. } else {
  55286. vnode.isAsyncPlaceholder = true;
  55287. }
  55288. return
  55289. }
  55290. // reuse element for static trees.
  55291. // note we only do this if the vnode is cloned -
  55292. // if the new node is not cloned it means the render functions have been
  55293. // reset by the hot-reload-api and we need to do a proper re-render.
  55294. if (isTrue(vnode.isStatic) &&
  55295. isTrue(oldVnode.isStatic) &&
  55296. vnode.key === oldVnode.key &&
  55297. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  55298. ) {
  55299. vnode.componentInstance = oldVnode.componentInstance;
  55300. return
  55301. }
  55302. var i;
  55303. var data = vnode.data;
  55304. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  55305. i(oldVnode, vnode);
  55306. }
  55307. var oldCh = oldVnode.children;
  55308. var ch = vnode.children;
  55309. if (isDef(data) && isPatchable(vnode)) {
  55310. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  55311. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  55312. }
  55313. if (isUndef(vnode.text)) {
  55314. if (isDef(oldCh) && isDef(ch)) {
  55315. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  55316. } else if (isDef(ch)) {
  55317. {
  55318. checkDuplicateKeys(ch);
  55319. }
  55320. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  55321. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  55322. } else if (isDef(oldCh)) {
  55323. removeVnodes(oldCh, 0, oldCh.length - 1);
  55324. } else if (isDef(oldVnode.text)) {
  55325. nodeOps.setTextContent(elm, '');
  55326. }
  55327. } else if (oldVnode.text !== vnode.text) {
  55328. nodeOps.setTextContent(elm, vnode.text);
  55329. }
  55330. if (isDef(data)) {
  55331. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  55332. }
  55333. }
  55334. function invokeInsertHook (vnode, queue, initial) {
  55335. // delay insert hooks for component root nodes, invoke them after the
  55336. // element is really inserted
  55337. if (isTrue(initial) && isDef(vnode.parent)) {
  55338. vnode.parent.data.pendingInsert = queue;
  55339. } else {
  55340. for (var i = 0; i < queue.length; ++i) {
  55341. queue[i].data.hook.insert(queue[i]);
  55342. }
  55343. }
  55344. }
  55345. var hydrationBailed = false;
  55346. // list of modules that can skip create hook during hydration because they
  55347. // are already rendered on the client or has no need for initialization
  55348. // Note: style is excluded because it relies on initial clone for future
  55349. // deep updates (#7063).
  55350. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  55351. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  55352. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  55353. var i;
  55354. var tag = vnode.tag;
  55355. var data = vnode.data;
  55356. var children = vnode.children;
  55357. inVPre = inVPre || (data && data.pre);
  55358. vnode.elm = elm;
  55359. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  55360. vnode.isAsyncPlaceholder = true;
  55361. return true
  55362. }
  55363. // assert node match
  55364. {
  55365. if (!assertNodeMatch(elm, vnode, inVPre)) {
  55366. return false
  55367. }
  55368. }
  55369. if (isDef(data)) {
  55370. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  55371. if (isDef(i = vnode.componentInstance)) {
  55372. // child component. it should have hydrated its own tree.
  55373. initComponent(vnode, insertedVnodeQueue);
  55374. return true
  55375. }
  55376. }
  55377. if (isDef(tag)) {
  55378. if (isDef(children)) {
  55379. // empty element, allow client to pick up and populate children
  55380. if (!elm.hasChildNodes()) {
  55381. createChildren(vnode, children, insertedVnodeQueue);
  55382. } else {
  55383. // v-html and domProps: innerHTML
  55384. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  55385. if (i !== elm.innerHTML) {
  55386. /* istanbul ignore if */
  55387. if (typeof console !== 'undefined' &&
  55388. !hydrationBailed
  55389. ) {
  55390. hydrationBailed = true;
  55391. console.warn('Parent: ', elm);
  55392. console.warn('server innerHTML: ', i);
  55393. console.warn('client innerHTML: ', elm.innerHTML);
  55394. }
  55395. return false
  55396. }
  55397. } else {
  55398. // iterate and compare children lists
  55399. var childrenMatch = true;
  55400. var childNode = elm.firstChild;
  55401. for (var i$1 = 0; i$1 < children.length; i$1++) {
  55402. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  55403. childrenMatch = false;
  55404. break
  55405. }
  55406. childNode = childNode.nextSibling;
  55407. }
  55408. // if childNode is not null, it means the actual childNodes list is
  55409. // longer than the virtual children list.
  55410. if (!childrenMatch || childNode) {
  55411. /* istanbul ignore if */
  55412. if (typeof console !== 'undefined' &&
  55413. !hydrationBailed
  55414. ) {
  55415. hydrationBailed = true;
  55416. console.warn('Parent: ', elm);
  55417. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  55418. }
  55419. return false
  55420. }
  55421. }
  55422. }
  55423. }
  55424. if (isDef(data)) {
  55425. var fullInvoke = false;
  55426. for (var key in data) {
  55427. if (!isRenderedModule(key)) {
  55428. fullInvoke = true;
  55429. invokeCreateHooks(vnode, insertedVnodeQueue);
  55430. break
  55431. }
  55432. }
  55433. if (!fullInvoke && data['class']) {
  55434. // ensure collecting deps for deep class bindings for future updates
  55435. traverse(data['class']);
  55436. }
  55437. }
  55438. } else if (elm.data !== vnode.text) {
  55439. elm.data = vnode.text;
  55440. }
  55441. return true
  55442. }
  55443. function assertNodeMatch (node, vnode, inVPre) {
  55444. if (isDef(vnode.tag)) {
  55445. return vnode.tag.indexOf('vue-component') === 0 || (
  55446. !isUnknownElement$$1(vnode, inVPre) &&
  55447. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  55448. )
  55449. } else {
  55450. return node.nodeType === (vnode.isComment ? 8 : 3)
  55451. }
  55452. }
  55453. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  55454. if (isUndef(vnode)) {
  55455. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  55456. return
  55457. }
  55458. var isInitialPatch = false;
  55459. var insertedVnodeQueue = [];
  55460. if (isUndef(oldVnode)) {
  55461. // empty mount (likely as component), create new root element
  55462. isInitialPatch = true;
  55463. createElm(vnode, insertedVnodeQueue);
  55464. } else {
  55465. var isRealElement = isDef(oldVnode.nodeType);
  55466. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  55467. // patch existing root node
  55468. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  55469. } else {
  55470. if (isRealElement) {
  55471. // mounting to a real element
  55472. // check if this is server-rendered content and if we can perform
  55473. // a successful hydration.
  55474. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  55475. oldVnode.removeAttribute(SSR_ATTR);
  55476. hydrating = true;
  55477. }
  55478. if (isTrue(hydrating)) {
  55479. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  55480. invokeInsertHook(vnode, insertedVnodeQueue, true);
  55481. return oldVnode
  55482. } else {
  55483. warn(
  55484. 'The client-side rendered virtual DOM tree is not matching ' +
  55485. 'server-rendered content. This is likely caused by incorrect ' +
  55486. 'HTML markup, for example nesting block-level elements inside ' +
  55487. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  55488. 'full client-side render.'
  55489. );
  55490. }
  55491. }
  55492. // either not server-rendered, or hydration failed.
  55493. // create an empty node and replace it
  55494. oldVnode = emptyNodeAt(oldVnode);
  55495. }
  55496. // replacing existing element
  55497. var oldElm = oldVnode.elm;
  55498. var parentElm = nodeOps.parentNode(oldElm);
  55499. // create new node
  55500. createElm(
  55501. vnode,
  55502. insertedVnodeQueue,
  55503. // extremely rare edge case: do not insert if old element is in a
  55504. // leaving transition. Only happens when combining transition +
  55505. // keep-alive + HOCs. (#4590)
  55506. oldElm._leaveCb ? null : parentElm,
  55507. nodeOps.nextSibling(oldElm)
  55508. );
  55509. // update parent placeholder node element, recursively
  55510. if (isDef(vnode.parent)) {
  55511. var ancestor = vnode.parent;
  55512. var patchable = isPatchable(vnode);
  55513. while (ancestor) {
  55514. for (var i = 0; i < cbs.destroy.length; ++i) {
  55515. cbs.destroy[i](ancestor);
  55516. }
  55517. ancestor.elm = vnode.elm;
  55518. if (patchable) {
  55519. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  55520. cbs.create[i$1](emptyNode, ancestor);
  55521. }
  55522. // #6513
  55523. // invoke insert hooks that may have been merged by create hooks.
  55524. // e.g. for directives that uses the "inserted" hook.
  55525. var insert = ancestor.data.hook.insert;
  55526. if (insert.merged) {
  55527. // start at index 1 to avoid re-invoking component mounted hook
  55528. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  55529. insert.fns[i$2]();
  55530. }
  55531. }
  55532. } else {
  55533. registerRef(ancestor);
  55534. }
  55535. ancestor = ancestor.parent;
  55536. }
  55537. }
  55538. // destroy old node
  55539. if (isDef(parentElm)) {
  55540. removeVnodes([oldVnode], 0, 0);
  55541. } else if (isDef(oldVnode.tag)) {
  55542. invokeDestroyHook(oldVnode);
  55543. }
  55544. }
  55545. }
  55546. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  55547. return vnode.elm
  55548. }
  55549. }
  55550. /* */
  55551. var directives = {
  55552. create: updateDirectives,
  55553. update: updateDirectives,
  55554. destroy: function unbindDirectives (vnode) {
  55555. updateDirectives(vnode, emptyNode);
  55556. }
  55557. };
  55558. function updateDirectives (oldVnode, vnode) {
  55559. if (oldVnode.data.directives || vnode.data.directives) {
  55560. _update(oldVnode, vnode);
  55561. }
  55562. }
  55563. function _update (oldVnode, vnode) {
  55564. var isCreate = oldVnode === emptyNode;
  55565. var isDestroy = vnode === emptyNode;
  55566. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  55567. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  55568. var dirsWithInsert = [];
  55569. var dirsWithPostpatch = [];
  55570. var key, oldDir, dir;
  55571. for (key in newDirs) {
  55572. oldDir = oldDirs[key];
  55573. dir = newDirs[key];
  55574. if (!oldDir) {
  55575. // new directive, bind
  55576. callHook$1(dir, 'bind', vnode, oldVnode);
  55577. if (dir.def && dir.def.inserted) {
  55578. dirsWithInsert.push(dir);
  55579. }
  55580. } else {
  55581. // existing directive, update
  55582. dir.oldValue = oldDir.value;
  55583. dir.oldArg = oldDir.arg;
  55584. callHook$1(dir, 'update', vnode, oldVnode);
  55585. if (dir.def && dir.def.componentUpdated) {
  55586. dirsWithPostpatch.push(dir);
  55587. }
  55588. }
  55589. }
  55590. if (dirsWithInsert.length) {
  55591. var callInsert = function () {
  55592. for (var i = 0; i < dirsWithInsert.length; i++) {
  55593. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  55594. }
  55595. };
  55596. if (isCreate) {
  55597. mergeVNodeHook(vnode, 'insert', callInsert);
  55598. } else {
  55599. callInsert();
  55600. }
  55601. }
  55602. if (dirsWithPostpatch.length) {
  55603. mergeVNodeHook(vnode, 'postpatch', function () {
  55604. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  55605. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  55606. }
  55607. });
  55608. }
  55609. if (!isCreate) {
  55610. for (key in oldDirs) {
  55611. if (!newDirs[key]) {
  55612. // no longer present, unbind
  55613. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  55614. }
  55615. }
  55616. }
  55617. }
  55618. var emptyModifiers = Object.create(null);
  55619. function normalizeDirectives$1 (
  55620. dirs,
  55621. vm
  55622. ) {
  55623. var res = Object.create(null);
  55624. if (!dirs) {
  55625. // $flow-disable-line
  55626. return res
  55627. }
  55628. var i, dir;
  55629. for (i = 0; i < dirs.length; i++) {
  55630. dir = dirs[i];
  55631. if (!dir.modifiers) {
  55632. // $flow-disable-line
  55633. dir.modifiers = emptyModifiers;
  55634. }
  55635. res[getRawDirName(dir)] = dir;
  55636. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  55637. }
  55638. // $flow-disable-line
  55639. return res
  55640. }
  55641. function getRawDirName (dir) {
  55642. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  55643. }
  55644. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  55645. var fn = dir.def && dir.def[hook];
  55646. if (fn) {
  55647. try {
  55648. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  55649. } catch (e) {
  55650. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  55651. }
  55652. }
  55653. }
  55654. var baseModules = [
  55655. ref,
  55656. directives
  55657. ];
  55658. /* */
  55659. function updateAttrs (oldVnode, vnode) {
  55660. var opts = vnode.componentOptions;
  55661. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  55662. return
  55663. }
  55664. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  55665. return
  55666. }
  55667. var key, cur, old;
  55668. var elm = vnode.elm;
  55669. var oldAttrs = oldVnode.data.attrs || {};
  55670. var attrs = vnode.data.attrs || {};
  55671. // clone observed objects, as the user probably wants to mutate it
  55672. if (isDef(attrs.__ob__)) {
  55673. attrs = vnode.data.attrs = extend({}, attrs);
  55674. }
  55675. for (key in attrs) {
  55676. cur = attrs[key];
  55677. old = oldAttrs[key];
  55678. if (old !== cur) {
  55679. setAttr(elm, key, cur);
  55680. }
  55681. }
  55682. // #4391: in IE9, setting type can reset value for input[type=radio]
  55683. // #6666: IE/Edge forces progress value down to 1 before setting a max
  55684. /* istanbul ignore if */
  55685. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  55686. setAttr(elm, 'value', attrs.value);
  55687. }
  55688. for (key in oldAttrs) {
  55689. if (isUndef(attrs[key])) {
  55690. if (isXlink(key)) {
  55691. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  55692. } else if (!isEnumeratedAttr(key)) {
  55693. elm.removeAttribute(key);
  55694. }
  55695. }
  55696. }
  55697. }
  55698. function setAttr (el, key, value) {
  55699. if (el.tagName.indexOf('-') > -1) {
  55700. baseSetAttr(el, key, value);
  55701. } else if (isBooleanAttr(key)) {
  55702. // set attribute for blank value
  55703. // e.g. <option disabled>Select one</option>
  55704. if (isFalsyAttrValue(value)) {
  55705. el.removeAttribute(key);
  55706. } else {
  55707. // technically allowfullscreen is a boolean attribute for <iframe>,
  55708. // but Flash expects a value of "true" when used on <embed> tag
  55709. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  55710. ? 'true'
  55711. : key;
  55712. el.setAttribute(key, value);
  55713. }
  55714. } else if (isEnumeratedAttr(key)) {
  55715. el.setAttribute(key, convertEnumeratedValue(key, value));
  55716. } else if (isXlink(key)) {
  55717. if (isFalsyAttrValue(value)) {
  55718. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  55719. } else {
  55720. el.setAttributeNS(xlinkNS, key, value);
  55721. }
  55722. } else {
  55723. baseSetAttr(el, key, value);
  55724. }
  55725. }
  55726. function baseSetAttr (el, key, value) {
  55727. if (isFalsyAttrValue(value)) {
  55728. el.removeAttribute(key);
  55729. } else {
  55730. // #7138: IE10 & 11 fires input event when setting placeholder on
  55731. // <textarea>... block the first input event and remove the blocker
  55732. // immediately.
  55733. /* istanbul ignore if */
  55734. if (
  55735. isIE && !isIE9 &&
  55736. el.tagName === 'TEXTAREA' &&
  55737. key === 'placeholder' && value !== '' && !el.__ieph
  55738. ) {
  55739. var blocker = function (e) {
  55740. e.stopImmediatePropagation();
  55741. el.removeEventListener('input', blocker);
  55742. };
  55743. el.addEventListener('input', blocker);
  55744. // $flow-disable-line
  55745. el.__ieph = true; /* IE placeholder patched */
  55746. }
  55747. el.setAttribute(key, value);
  55748. }
  55749. }
  55750. var attrs = {
  55751. create: updateAttrs,
  55752. update: updateAttrs
  55753. };
  55754. /* */
  55755. function updateClass (oldVnode, vnode) {
  55756. var el = vnode.elm;
  55757. var data = vnode.data;
  55758. var oldData = oldVnode.data;
  55759. if (
  55760. isUndef(data.staticClass) &&
  55761. isUndef(data.class) && (
  55762. isUndef(oldData) || (
  55763. isUndef(oldData.staticClass) &&
  55764. isUndef(oldData.class)
  55765. )
  55766. )
  55767. ) {
  55768. return
  55769. }
  55770. var cls = genClassForVnode(vnode);
  55771. // handle transition classes
  55772. var transitionClass = el._transitionClasses;
  55773. if (isDef(transitionClass)) {
  55774. cls = concat(cls, stringifyClass(transitionClass));
  55775. }
  55776. // set the class
  55777. if (cls !== el._prevClass) {
  55778. el.setAttribute('class', cls);
  55779. el._prevClass = cls;
  55780. }
  55781. }
  55782. var klass = {
  55783. create: updateClass,
  55784. update: updateClass
  55785. };
  55786. /* */
  55787. var validDivisionCharRE = /[\w).+\-_$\]]/;
  55788. function parseFilters (exp) {
  55789. var inSingle = false;
  55790. var inDouble = false;
  55791. var inTemplateString = false;
  55792. var inRegex = false;
  55793. var curly = 0;
  55794. var square = 0;
  55795. var paren = 0;
  55796. var lastFilterIndex = 0;
  55797. var c, prev, i, expression, filters;
  55798. for (i = 0; i < exp.length; i++) {
  55799. prev = c;
  55800. c = exp.charCodeAt(i);
  55801. if (inSingle) {
  55802. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  55803. } else if (inDouble) {
  55804. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  55805. } else if (inTemplateString) {
  55806. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  55807. } else if (inRegex) {
  55808. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  55809. } else if (
  55810. c === 0x7C && // pipe
  55811. exp.charCodeAt(i + 1) !== 0x7C &&
  55812. exp.charCodeAt(i - 1) !== 0x7C &&
  55813. !curly && !square && !paren
  55814. ) {
  55815. if (expression === undefined) {
  55816. // first filter, end of expression
  55817. lastFilterIndex = i + 1;
  55818. expression = exp.slice(0, i).trim();
  55819. } else {
  55820. pushFilter();
  55821. }
  55822. } else {
  55823. switch (c) {
  55824. case 0x22: inDouble = true; break // "
  55825. case 0x27: inSingle = true; break // '
  55826. case 0x60: inTemplateString = true; break // `
  55827. case 0x28: paren++; break // (
  55828. case 0x29: paren--; break // )
  55829. case 0x5B: square++; break // [
  55830. case 0x5D: square--; break // ]
  55831. case 0x7B: curly++; break // {
  55832. case 0x7D: curly--; break // }
  55833. }
  55834. if (c === 0x2f) { // /
  55835. var j = i - 1;
  55836. var p = (void 0);
  55837. // find first non-whitespace prev char
  55838. for (; j >= 0; j--) {
  55839. p = exp.charAt(j);
  55840. if (p !== ' ') { break }
  55841. }
  55842. if (!p || !validDivisionCharRE.test(p)) {
  55843. inRegex = true;
  55844. }
  55845. }
  55846. }
  55847. }
  55848. if (expression === undefined) {
  55849. expression = exp.slice(0, i).trim();
  55850. } else if (lastFilterIndex !== 0) {
  55851. pushFilter();
  55852. }
  55853. function pushFilter () {
  55854. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  55855. lastFilterIndex = i + 1;
  55856. }
  55857. if (filters) {
  55858. for (i = 0; i < filters.length; i++) {
  55859. expression = wrapFilter(expression, filters[i]);
  55860. }
  55861. }
  55862. return expression
  55863. }
  55864. function wrapFilter (exp, filter) {
  55865. var i = filter.indexOf('(');
  55866. if (i < 0) {
  55867. // _f: resolveFilter
  55868. return ("_f(\"" + filter + "\")(" + exp + ")")
  55869. } else {
  55870. var name = filter.slice(0, i);
  55871. var args = filter.slice(i + 1);
  55872. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  55873. }
  55874. }
  55875. /* */
  55876. /* eslint-disable no-unused-vars */
  55877. function baseWarn (msg, range) {
  55878. console.error(("[Vue compiler]: " + msg));
  55879. }
  55880. /* eslint-enable no-unused-vars */
  55881. function pluckModuleFunction (
  55882. modules,
  55883. key
  55884. ) {
  55885. return modules
  55886. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  55887. : []
  55888. }
  55889. function addProp (el, name, value, range, dynamic) {
  55890. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  55891. el.plain = false;
  55892. }
  55893. function addAttr (el, name, value, range, dynamic) {
  55894. var attrs = dynamic
  55895. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  55896. : (el.attrs || (el.attrs = []));
  55897. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  55898. el.plain = false;
  55899. }
  55900. // add a raw attr (use this in preTransforms)
  55901. function addRawAttr (el, name, value, range) {
  55902. el.attrsMap[name] = value;
  55903. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  55904. }
  55905. function addDirective (
  55906. el,
  55907. name,
  55908. rawName,
  55909. value,
  55910. arg,
  55911. isDynamicArg,
  55912. modifiers,
  55913. range
  55914. ) {
  55915. (el.directives || (el.directives = [])).push(rangeSetItem({
  55916. name: name,
  55917. rawName: rawName,
  55918. value: value,
  55919. arg: arg,
  55920. isDynamicArg: isDynamicArg,
  55921. modifiers: modifiers
  55922. }, range));
  55923. el.plain = false;
  55924. }
  55925. function prependModifierMarker (symbol, name, dynamic) {
  55926. return dynamic
  55927. ? ("_p(" + name + ",\"" + symbol + "\")")
  55928. : symbol + name // mark the event as captured
  55929. }
  55930. function addHandler (
  55931. el,
  55932. name,
  55933. value,
  55934. modifiers,
  55935. important,
  55936. warn,
  55937. range,
  55938. dynamic
  55939. ) {
  55940. modifiers = modifiers || emptyObject;
  55941. // warn prevent and passive modifier
  55942. /* istanbul ignore if */
  55943. if (
  55944. warn &&
  55945. modifiers.prevent && modifiers.passive
  55946. ) {
  55947. warn(
  55948. 'passive and prevent can\'t be used together. ' +
  55949. 'Passive handler can\'t prevent default event.',
  55950. range
  55951. );
  55952. }
  55953. // normalize click.right and click.middle since they don't actually fire
  55954. // this is technically browser-specific, but at least for now browsers are
  55955. // the only target envs that have right/middle clicks.
  55956. if (modifiers.right) {
  55957. if (dynamic) {
  55958. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  55959. } else if (name === 'click') {
  55960. name = 'contextmenu';
  55961. delete modifiers.right;
  55962. }
  55963. } else if (modifiers.middle) {
  55964. if (dynamic) {
  55965. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  55966. } else if (name === 'click') {
  55967. name = 'mouseup';
  55968. }
  55969. }
  55970. // check capture modifier
  55971. if (modifiers.capture) {
  55972. delete modifiers.capture;
  55973. name = prependModifierMarker('!', name, dynamic);
  55974. }
  55975. if (modifiers.once) {
  55976. delete modifiers.once;
  55977. name = prependModifierMarker('~', name, dynamic);
  55978. }
  55979. /* istanbul ignore if */
  55980. if (modifiers.passive) {
  55981. delete modifiers.passive;
  55982. name = prependModifierMarker('&', name, dynamic);
  55983. }
  55984. var events;
  55985. if (modifiers.native) {
  55986. delete modifiers.native;
  55987. events = el.nativeEvents || (el.nativeEvents = {});
  55988. } else {
  55989. events = el.events || (el.events = {});
  55990. }
  55991. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  55992. if (modifiers !== emptyObject) {
  55993. newHandler.modifiers = modifiers;
  55994. }
  55995. var handlers = events[name];
  55996. /* istanbul ignore if */
  55997. if (Array.isArray(handlers)) {
  55998. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  55999. } else if (handlers) {
  56000. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  56001. } else {
  56002. events[name] = newHandler;
  56003. }
  56004. el.plain = false;
  56005. }
  56006. function getRawBindingAttr (
  56007. el,
  56008. name
  56009. ) {
  56010. return el.rawAttrsMap[':' + name] ||
  56011. el.rawAttrsMap['v-bind:' + name] ||
  56012. el.rawAttrsMap[name]
  56013. }
  56014. function getBindingAttr (
  56015. el,
  56016. name,
  56017. getStatic
  56018. ) {
  56019. var dynamicValue =
  56020. getAndRemoveAttr(el, ':' + name) ||
  56021. getAndRemoveAttr(el, 'v-bind:' + name);
  56022. if (dynamicValue != null) {
  56023. return parseFilters(dynamicValue)
  56024. } else if (getStatic !== false) {
  56025. var staticValue = getAndRemoveAttr(el, name);
  56026. if (staticValue != null) {
  56027. return JSON.stringify(staticValue)
  56028. }
  56029. }
  56030. }
  56031. // note: this only removes the attr from the Array (attrsList) so that it
  56032. // doesn't get processed by processAttrs.
  56033. // By default it does NOT remove it from the map (attrsMap) because the map is
  56034. // needed during codegen.
  56035. function getAndRemoveAttr (
  56036. el,
  56037. name,
  56038. removeFromMap
  56039. ) {
  56040. var val;
  56041. if ((val = el.attrsMap[name]) != null) {
  56042. var list = el.attrsList;
  56043. for (var i = 0, l = list.length; i < l; i++) {
  56044. if (list[i].name === name) {
  56045. list.splice(i, 1);
  56046. break
  56047. }
  56048. }
  56049. }
  56050. if (removeFromMap) {
  56051. delete el.attrsMap[name];
  56052. }
  56053. return val
  56054. }
  56055. function getAndRemoveAttrByRegex (
  56056. el,
  56057. name
  56058. ) {
  56059. var list = el.attrsList;
  56060. for (var i = 0, l = list.length; i < l; i++) {
  56061. var attr = list[i];
  56062. if (name.test(attr.name)) {
  56063. list.splice(i, 1);
  56064. return attr
  56065. }
  56066. }
  56067. }
  56068. function rangeSetItem (
  56069. item,
  56070. range
  56071. ) {
  56072. if (range) {
  56073. if (range.start != null) {
  56074. item.start = range.start;
  56075. }
  56076. if (range.end != null) {
  56077. item.end = range.end;
  56078. }
  56079. }
  56080. return item
  56081. }
  56082. /* */
  56083. /**
  56084. * Cross-platform code generation for component v-model
  56085. */
  56086. function genComponentModel (
  56087. el,
  56088. value,
  56089. modifiers
  56090. ) {
  56091. var ref = modifiers || {};
  56092. var number = ref.number;
  56093. var trim = ref.trim;
  56094. var baseValueExpression = '$$v';
  56095. var valueExpression = baseValueExpression;
  56096. if (trim) {
  56097. valueExpression =
  56098. "(typeof " + baseValueExpression + " === 'string'" +
  56099. "? " + baseValueExpression + ".trim()" +
  56100. ": " + baseValueExpression + ")";
  56101. }
  56102. if (number) {
  56103. valueExpression = "_n(" + valueExpression + ")";
  56104. }
  56105. var assignment = genAssignmentCode(value, valueExpression);
  56106. el.model = {
  56107. value: ("(" + value + ")"),
  56108. expression: JSON.stringify(value),
  56109. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  56110. };
  56111. }
  56112. /**
  56113. * Cross-platform codegen helper for generating v-model value assignment code.
  56114. */
  56115. function genAssignmentCode (
  56116. value,
  56117. assignment
  56118. ) {
  56119. var res = parseModel(value);
  56120. if (res.key === null) {
  56121. return (value + "=" + assignment)
  56122. } else {
  56123. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  56124. }
  56125. }
  56126. /**
  56127. * Parse a v-model expression into a base path and a final key segment.
  56128. * Handles both dot-path and possible square brackets.
  56129. *
  56130. * Possible cases:
  56131. *
  56132. * - test
  56133. * - test[key]
  56134. * - test[test1[key]]
  56135. * - test["a"][key]
  56136. * - xxx.test[a[a].test1[key]]
  56137. * - test.xxx.a["asa"][test1[key]]
  56138. *
  56139. */
  56140. var len, str, chr, index$1, expressionPos, expressionEndPos;
  56141. function parseModel (val) {
  56142. // Fix https://github.com/vuejs/vue/pull/7730
  56143. // allow v-model="obj.val " (trailing whitespace)
  56144. val = val.trim();
  56145. len = val.length;
  56146. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  56147. index$1 = val.lastIndexOf('.');
  56148. if (index$1 > -1) {
  56149. return {
  56150. exp: val.slice(0, index$1),
  56151. key: '"' + val.slice(index$1 + 1) + '"'
  56152. }
  56153. } else {
  56154. return {
  56155. exp: val,
  56156. key: null
  56157. }
  56158. }
  56159. }
  56160. str = val;
  56161. index$1 = expressionPos = expressionEndPos = 0;
  56162. while (!eof()) {
  56163. chr = next();
  56164. /* istanbul ignore if */
  56165. if (isStringStart(chr)) {
  56166. parseString(chr);
  56167. } else if (chr === 0x5B) {
  56168. parseBracket(chr);
  56169. }
  56170. }
  56171. return {
  56172. exp: val.slice(0, expressionPos),
  56173. key: val.slice(expressionPos + 1, expressionEndPos)
  56174. }
  56175. }
  56176. function next () {
  56177. return str.charCodeAt(++index$1)
  56178. }
  56179. function eof () {
  56180. return index$1 >= len
  56181. }
  56182. function isStringStart (chr) {
  56183. return chr === 0x22 || chr === 0x27
  56184. }
  56185. function parseBracket (chr) {
  56186. var inBracket = 1;
  56187. expressionPos = index$1;
  56188. while (!eof()) {
  56189. chr = next();
  56190. if (isStringStart(chr)) {
  56191. parseString(chr);
  56192. continue
  56193. }
  56194. if (chr === 0x5B) { inBracket++; }
  56195. if (chr === 0x5D) { inBracket--; }
  56196. if (inBracket === 0) {
  56197. expressionEndPos = index$1;
  56198. break
  56199. }
  56200. }
  56201. }
  56202. function parseString (chr) {
  56203. var stringQuote = chr;
  56204. while (!eof()) {
  56205. chr = next();
  56206. if (chr === stringQuote) {
  56207. break
  56208. }
  56209. }
  56210. }
  56211. /* */
  56212. var warn$1;
  56213. // in some cases, the event used has to be determined at runtime
  56214. // so we used some reserved tokens during compile.
  56215. var RANGE_TOKEN = '__r';
  56216. var CHECKBOX_RADIO_TOKEN = '__c';
  56217. function model (
  56218. el,
  56219. dir,
  56220. _warn
  56221. ) {
  56222. warn$1 = _warn;
  56223. var value = dir.value;
  56224. var modifiers = dir.modifiers;
  56225. var tag = el.tag;
  56226. var type = el.attrsMap.type;
  56227. {
  56228. // inputs with type="file" are read only and setting the input's
  56229. // value will throw an error.
  56230. if (tag === 'input' && type === 'file') {
  56231. warn$1(
  56232. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  56233. "File inputs are read only. Use a v-on:change listener instead.",
  56234. el.rawAttrsMap['v-model']
  56235. );
  56236. }
  56237. }
  56238. if (el.component) {
  56239. genComponentModel(el, value, modifiers);
  56240. // component v-model doesn't need extra runtime
  56241. return false
  56242. } else if (tag === 'select') {
  56243. genSelect(el, value, modifiers);
  56244. } else if (tag === 'input' && type === 'checkbox') {
  56245. genCheckboxModel(el, value, modifiers);
  56246. } else if (tag === 'input' && type === 'radio') {
  56247. genRadioModel(el, value, modifiers);
  56248. } else if (tag === 'input' || tag === 'textarea') {
  56249. genDefaultModel(el, value, modifiers);
  56250. } else if (!config.isReservedTag(tag)) {
  56251. genComponentModel(el, value, modifiers);
  56252. // component v-model doesn't need extra runtime
  56253. return false
  56254. } else {
  56255. warn$1(
  56256. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  56257. "v-model is not supported on this element type. " +
  56258. 'If you are working with contenteditable, it\'s recommended to ' +
  56259. 'wrap a library dedicated for that purpose inside a custom component.',
  56260. el.rawAttrsMap['v-model']
  56261. );
  56262. }
  56263. // ensure runtime directive metadata
  56264. return true
  56265. }
  56266. function genCheckboxModel (
  56267. el,
  56268. value,
  56269. modifiers
  56270. ) {
  56271. var number = modifiers && modifiers.number;
  56272. var valueBinding = getBindingAttr(el, 'value') || 'null';
  56273. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  56274. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  56275. addProp(el, 'checked',
  56276. "Array.isArray(" + value + ")" +
  56277. "?_i(" + value + "," + valueBinding + ")>-1" + (
  56278. trueValueBinding === 'true'
  56279. ? (":(" + value + ")")
  56280. : (":_q(" + value + "," + trueValueBinding + ")")
  56281. )
  56282. );
  56283. addHandler(el, 'change',
  56284. "var $$a=" + value + "," +
  56285. '$$el=$event.target,' +
  56286. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  56287. 'if(Array.isArray($$a)){' +
  56288. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  56289. '$$i=_i($$a,$$v);' +
  56290. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  56291. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  56292. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  56293. null, true
  56294. );
  56295. }
  56296. function genRadioModel (
  56297. el,
  56298. value,
  56299. modifiers
  56300. ) {
  56301. var number = modifiers && modifiers.number;
  56302. var valueBinding = getBindingAttr(el, 'value') || 'null';
  56303. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  56304. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  56305. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  56306. }
  56307. function genSelect (
  56308. el,
  56309. value,
  56310. modifiers
  56311. ) {
  56312. var number = modifiers && modifiers.number;
  56313. var selectedVal = "Array.prototype.filter" +
  56314. ".call($event.target.options,function(o){return o.selected})" +
  56315. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  56316. "return " + (number ? '_n(val)' : 'val') + "})";
  56317. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  56318. var code = "var $$selectedVal = " + selectedVal + ";";
  56319. code = code + " " + (genAssignmentCode(value, assignment));
  56320. addHandler(el, 'change', code, null, true);
  56321. }
  56322. function genDefaultModel (
  56323. el,
  56324. value,
  56325. modifiers
  56326. ) {
  56327. var type = el.attrsMap.type;
  56328. // warn if v-bind:value conflicts with v-model
  56329. // except for inputs with v-bind:type
  56330. {
  56331. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  56332. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  56333. if (value$1 && !typeBinding) {
  56334. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  56335. warn$1(
  56336. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  56337. 'because the latter already expands to a value binding internally',
  56338. el.rawAttrsMap[binding]
  56339. );
  56340. }
  56341. }
  56342. var ref = modifiers || {};
  56343. var lazy = ref.lazy;
  56344. var number = ref.number;
  56345. var trim = ref.trim;
  56346. var needCompositionGuard = !lazy && type !== 'range';
  56347. var event = lazy
  56348. ? 'change'
  56349. : type === 'range'
  56350. ? RANGE_TOKEN
  56351. : 'input';
  56352. var valueExpression = '$event.target.value';
  56353. if (trim) {
  56354. valueExpression = "$event.target.value.trim()";
  56355. }
  56356. if (number) {
  56357. valueExpression = "_n(" + valueExpression + ")";
  56358. }
  56359. var code = genAssignmentCode(value, valueExpression);
  56360. if (needCompositionGuard) {
  56361. code = "if($event.target.composing)return;" + code;
  56362. }
  56363. addProp(el, 'value', ("(" + value + ")"));
  56364. addHandler(el, event, code, null, true);
  56365. if (trim || number) {
  56366. addHandler(el, 'blur', '$forceUpdate()');
  56367. }
  56368. }
  56369. /* */
  56370. // normalize v-model event tokens that can only be determined at runtime.
  56371. // it's important to place the event as the first in the array because
  56372. // the whole point is ensuring the v-model callback gets called before
  56373. // user-attached handlers.
  56374. function normalizeEvents (on) {
  56375. /* istanbul ignore if */
  56376. if (isDef(on[RANGE_TOKEN])) {
  56377. // IE input[type=range] only supports `change` event
  56378. var event = isIE ? 'change' : 'input';
  56379. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  56380. delete on[RANGE_TOKEN];
  56381. }
  56382. // This was originally intended to fix #4521 but no longer necessary
  56383. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  56384. /* istanbul ignore if */
  56385. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  56386. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  56387. delete on[CHECKBOX_RADIO_TOKEN];
  56388. }
  56389. }
  56390. var target$1;
  56391. function createOnceHandler$1 (event, handler, capture) {
  56392. var _target = target$1; // save current target element in closure
  56393. return function onceHandler () {
  56394. var res = handler.apply(null, arguments);
  56395. if (res !== null) {
  56396. remove$2(event, onceHandler, capture, _target);
  56397. }
  56398. }
  56399. }
  56400. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  56401. // implementation and does not fire microtasks in between event propagation, so
  56402. // safe to exclude.
  56403. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  56404. function add$1 (
  56405. name,
  56406. handler,
  56407. capture,
  56408. passive
  56409. ) {
  56410. // async edge case #6566: inner click event triggers patch, event handler
  56411. // attached to outer element during patch, and triggered again. This
  56412. // happens because browsers fire microtask ticks between event propagation.
  56413. // the solution is simple: we save the timestamp when a handler is attached,
  56414. // and the handler would only fire if the event passed to it was fired
  56415. // AFTER it was attached.
  56416. if (useMicrotaskFix) {
  56417. var attachedTimestamp = currentFlushTimestamp;
  56418. var original = handler;
  56419. handler = original._wrapper = function (e) {
  56420. if (
  56421. // no bubbling, should always fire.
  56422. // this is just a safety net in case event.timeStamp is unreliable in
  56423. // certain weird environments...
  56424. e.target === e.currentTarget ||
  56425. // event is fired after handler attachment
  56426. e.timeStamp >= attachedTimestamp ||
  56427. // bail for environments that have buggy event.timeStamp implementations
  56428. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  56429. // #9681 QtWebEngine event.timeStamp is negative value
  56430. e.timeStamp <= 0 ||
  56431. // #9448 bail if event is fired in another document in a multi-page
  56432. // electron/nw.js app, since event.timeStamp will be using a different
  56433. // starting reference
  56434. e.target.ownerDocument !== document
  56435. ) {
  56436. return original.apply(this, arguments)
  56437. }
  56438. };
  56439. }
  56440. target$1.addEventListener(
  56441. name,
  56442. handler,
  56443. supportsPassive
  56444. ? { capture: capture, passive: passive }
  56445. : capture
  56446. );
  56447. }
  56448. function remove$2 (
  56449. name,
  56450. handler,
  56451. capture,
  56452. _target
  56453. ) {
  56454. (_target || target$1).removeEventListener(
  56455. name,
  56456. handler._wrapper || handler,
  56457. capture
  56458. );
  56459. }
  56460. function updateDOMListeners (oldVnode, vnode) {
  56461. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  56462. return
  56463. }
  56464. var on = vnode.data.on || {};
  56465. var oldOn = oldVnode.data.on || {};
  56466. target$1 = vnode.elm;
  56467. normalizeEvents(on);
  56468. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  56469. target$1 = undefined;
  56470. }
  56471. var events = {
  56472. create: updateDOMListeners,
  56473. update: updateDOMListeners
  56474. };
  56475. /* */
  56476. var svgContainer;
  56477. function updateDOMProps (oldVnode, vnode) {
  56478. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  56479. return
  56480. }
  56481. var key, cur;
  56482. var elm = vnode.elm;
  56483. var oldProps = oldVnode.data.domProps || {};
  56484. var props = vnode.data.domProps || {};
  56485. // clone observed objects, as the user probably wants to mutate it
  56486. if (isDef(props.__ob__)) {
  56487. props = vnode.data.domProps = extend({}, props);
  56488. }
  56489. for (key in oldProps) {
  56490. if (!(key in props)) {
  56491. elm[key] = '';
  56492. }
  56493. }
  56494. for (key in props) {
  56495. cur = props[key];
  56496. // ignore children if the node has textContent or innerHTML,
  56497. // as these will throw away existing DOM nodes and cause removal errors
  56498. // on subsequent patches (#3360)
  56499. if (key === 'textContent' || key === 'innerHTML') {
  56500. if (vnode.children) { vnode.children.length = 0; }
  56501. if (cur === oldProps[key]) { continue }
  56502. // #6601 work around Chrome version <= 55 bug where single textNode
  56503. // replaced by innerHTML/textContent retains its parentNode property
  56504. if (elm.childNodes.length === 1) {
  56505. elm.removeChild(elm.childNodes[0]);
  56506. }
  56507. }
  56508. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  56509. // store value as _value as well since
  56510. // non-string values will be stringified
  56511. elm._value = cur;
  56512. // avoid resetting cursor position when value is the same
  56513. var strCur = isUndef(cur) ? '' : String(cur);
  56514. if (shouldUpdateValue(elm, strCur)) {
  56515. elm.value = strCur;
  56516. }
  56517. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  56518. // IE doesn't support innerHTML for SVG elements
  56519. svgContainer = svgContainer || document.createElement('div');
  56520. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  56521. var svg = svgContainer.firstChild;
  56522. while (elm.firstChild) {
  56523. elm.removeChild(elm.firstChild);
  56524. }
  56525. while (svg.firstChild) {
  56526. elm.appendChild(svg.firstChild);
  56527. }
  56528. } else if (
  56529. // skip the update if old and new VDOM state is the same.
  56530. // `value` is handled separately because the DOM value may be temporarily
  56531. // out of sync with VDOM state due to focus, composition and modifiers.
  56532. // This #4521 by skipping the unnecesarry `checked` update.
  56533. cur !== oldProps[key]
  56534. ) {
  56535. // some property updates can throw
  56536. // e.g. `value` on <progress> w/ non-finite value
  56537. try {
  56538. elm[key] = cur;
  56539. } catch (e) {}
  56540. }
  56541. }
  56542. }
  56543. // check platforms/web/util/attrs.js acceptValue
  56544. function shouldUpdateValue (elm, checkVal) {
  56545. return (!elm.composing && (
  56546. elm.tagName === 'OPTION' ||
  56547. isNotInFocusAndDirty(elm, checkVal) ||
  56548. isDirtyWithModifiers(elm, checkVal)
  56549. ))
  56550. }
  56551. function isNotInFocusAndDirty (elm, checkVal) {
  56552. // return true when textbox (.number and .trim) loses focus and its value is
  56553. // not equal to the updated value
  56554. var notInFocus = true;
  56555. // #6157
  56556. // work around IE bug when accessing document.activeElement in an iframe
  56557. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  56558. return notInFocus && elm.value !== checkVal
  56559. }
  56560. function isDirtyWithModifiers (elm, newVal) {
  56561. var value = elm.value;
  56562. var modifiers = elm._vModifiers; // injected by v-model runtime
  56563. if (isDef(modifiers)) {
  56564. if (modifiers.number) {
  56565. return toNumber(value) !== toNumber(newVal)
  56566. }
  56567. if (modifiers.trim) {
  56568. return value.trim() !== newVal.trim()
  56569. }
  56570. }
  56571. return value !== newVal
  56572. }
  56573. var domProps = {
  56574. create: updateDOMProps,
  56575. update: updateDOMProps
  56576. };
  56577. /* */
  56578. var parseStyleText = cached(function (cssText) {
  56579. var res = {};
  56580. var listDelimiter = /;(?![^(]*\))/g;
  56581. var propertyDelimiter = /:(.+)/;
  56582. cssText.split(listDelimiter).forEach(function (item) {
  56583. if (item) {
  56584. var tmp = item.split(propertyDelimiter);
  56585. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  56586. }
  56587. });
  56588. return res
  56589. });
  56590. // merge static and dynamic style data on the same vnode
  56591. function normalizeStyleData (data) {
  56592. var style = normalizeStyleBinding(data.style);
  56593. // static style is pre-processed into an object during compilation
  56594. // and is always a fresh object, so it's safe to merge into it
  56595. return data.staticStyle
  56596. ? extend(data.staticStyle, style)
  56597. : style
  56598. }
  56599. // normalize possible array / string values into Object
  56600. function normalizeStyleBinding (bindingStyle) {
  56601. if (Array.isArray(bindingStyle)) {
  56602. return toObject(bindingStyle)
  56603. }
  56604. if (typeof bindingStyle === 'string') {
  56605. return parseStyleText(bindingStyle)
  56606. }
  56607. return bindingStyle
  56608. }
  56609. /**
  56610. * parent component style should be after child's
  56611. * so that parent component's style could override it
  56612. */
  56613. function getStyle (vnode, checkChild) {
  56614. var res = {};
  56615. var styleData;
  56616. if (checkChild) {
  56617. var childNode = vnode;
  56618. while (childNode.componentInstance) {
  56619. childNode = childNode.componentInstance._vnode;
  56620. if (
  56621. childNode && childNode.data &&
  56622. (styleData = normalizeStyleData(childNode.data))
  56623. ) {
  56624. extend(res, styleData);
  56625. }
  56626. }
  56627. }
  56628. if ((styleData = normalizeStyleData(vnode.data))) {
  56629. extend(res, styleData);
  56630. }
  56631. var parentNode = vnode;
  56632. while ((parentNode = parentNode.parent)) {
  56633. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  56634. extend(res, styleData);
  56635. }
  56636. }
  56637. return res
  56638. }
  56639. /* */
  56640. var cssVarRE = /^--/;
  56641. var importantRE = /\s*!important$/;
  56642. var setProp = function (el, name, val) {
  56643. /* istanbul ignore if */
  56644. if (cssVarRE.test(name)) {
  56645. el.style.setProperty(name, val);
  56646. } else if (importantRE.test(val)) {
  56647. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  56648. } else {
  56649. var normalizedName = normalize(name);
  56650. if (Array.isArray(val)) {
  56651. // Support values array created by autoprefixer, e.g.
  56652. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  56653. // Set them one by one, and the browser will only set those it can recognize
  56654. for (var i = 0, len = val.length; i < len; i++) {
  56655. el.style[normalizedName] = val[i];
  56656. }
  56657. } else {
  56658. el.style[normalizedName] = val;
  56659. }
  56660. }
  56661. };
  56662. var vendorNames = ['Webkit', 'Moz', 'ms'];
  56663. var emptyStyle;
  56664. var normalize = cached(function (prop) {
  56665. emptyStyle = emptyStyle || document.createElement('div').style;
  56666. prop = camelize(prop);
  56667. if (prop !== 'filter' && (prop in emptyStyle)) {
  56668. return prop
  56669. }
  56670. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  56671. for (var i = 0; i < vendorNames.length; i++) {
  56672. var name = vendorNames[i] + capName;
  56673. if (name in emptyStyle) {
  56674. return name
  56675. }
  56676. }
  56677. });
  56678. function updateStyle (oldVnode, vnode) {
  56679. var data = vnode.data;
  56680. var oldData = oldVnode.data;
  56681. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  56682. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  56683. ) {
  56684. return
  56685. }
  56686. var cur, name;
  56687. var el = vnode.elm;
  56688. var oldStaticStyle = oldData.staticStyle;
  56689. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  56690. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  56691. var oldStyle = oldStaticStyle || oldStyleBinding;
  56692. var style = normalizeStyleBinding(vnode.data.style) || {};
  56693. // store normalized style under a different key for next diff
  56694. // make sure to clone it if it's reactive, since the user likely wants
  56695. // to mutate it.
  56696. vnode.data.normalizedStyle = isDef(style.__ob__)
  56697. ? extend({}, style)
  56698. : style;
  56699. var newStyle = getStyle(vnode, true);
  56700. for (name in oldStyle) {
  56701. if (isUndef(newStyle[name])) {
  56702. setProp(el, name, '');
  56703. }
  56704. }
  56705. for (name in newStyle) {
  56706. cur = newStyle[name];
  56707. if (cur !== oldStyle[name]) {
  56708. // ie9 setting to null has no effect, must use empty string
  56709. setProp(el, name, cur == null ? '' : cur);
  56710. }
  56711. }
  56712. }
  56713. var style = {
  56714. create: updateStyle,
  56715. update: updateStyle
  56716. };
  56717. /* */
  56718. var whitespaceRE = /\s+/;
  56719. /**
  56720. * Add class with compatibility for SVG since classList is not supported on
  56721. * SVG elements in IE
  56722. */
  56723. function addClass (el, cls) {
  56724. /* istanbul ignore if */
  56725. if (!cls || !(cls = cls.trim())) {
  56726. return
  56727. }
  56728. /* istanbul ignore else */
  56729. if (el.classList) {
  56730. if (cls.indexOf(' ') > -1) {
  56731. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  56732. } else {
  56733. el.classList.add(cls);
  56734. }
  56735. } else {
  56736. var cur = " " + (el.getAttribute('class') || '') + " ";
  56737. if (cur.indexOf(' ' + cls + ' ') < 0) {
  56738. el.setAttribute('class', (cur + cls).trim());
  56739. }
  56740. }
  56741. }
  56742. /**
  56743. * Remove class with compatibility for SVG since classList is not supported on
  56744. * SVG elements in IE
  56745. */
  56746. function removeClass (el, cls) {
  56747. /* istanbul ignore if */
  56748. if (!cls || !(cls = cls.trim())) {
  56749. return
  56750. }
  56751. /* istanbul ignore else */
  56752. if (el.classList) {
  56753. if (cls.indexOf(' ') > -1) {
  56754. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  56755. } else {
  56756. el.classList.remove(cls);
  56757. }
  56758. if (!el.classList.length) {
  56759. el.removeAttribute('class');
  56760. }
  56761. } else {
  56762. var cur = " " + (el.getAttribute('class') || '') + " ";
  56763. var tar = ' ' + cls + ' ';
  56764. while (cur.indexOf(tar) >= 0) {
  56765. cur = cur.replace(tar, ' ');
  56766. }
  56767. cur = cur.trim();
  56768. if (cur) {
  56769. el.setAttribute('class', cur);
  56770. } else {
  56771. el.removeAttribute('class');
  56772. }
  56773. }
  56774. }
  56775. /* */
  56776. function resolveTransition (def$$1) {
  56777. if (!def$$1) {
  56778. return
  56779. }
  56780. /* istanbul ignore else */
  56781. if (typeof def$$1 === 'object') {
  56782. var res = {};
  56783. if (def$$1.css !== false) {
  56784. extend(res, autoCssTransition(def$$1.name || 'v'));
  56785. }
  56786. extend(res, def$$1);
  56787. return res
  56788. } else if (typeof def$$1 === 'string') {
  56789. return autoCssTransition(def$$1)
  56790. }
  56791. }
  56792. var autoCssTransition = cached(function (name) {
  56793. return {
  56794. enterClass: (name + "-enter"),
  56795. enterToClass: (name + "-enter-to"),
  56796. enterActiveClass: (name + "-enter-active"),
  56797. leaveClass: (name + "-leave"),
  56798. leaveToClass: (name + "-leave-to"),
  56799. leaveActiveClass: (name + "-leave-active")
  56800. }
  56801. });
  56802. var hasTransition = inBrowser && !isIE9;
  56803. var TRANSITION = 'transition';
  56804. var ANIMATION = 'animation';
  56805. // Transition property/event sniffing
  56806. var transitionProp = 'transition';
  56807. var transitionEndEvent = 'transitionend';
  56808. var animationProp = 'animation';
  56809. var animationEndEvent = 'animationend';
  56810. if (hasTransition) {
  56811. /* istanbul ignore if */
  56812. if (window.ontransitionend === undefined &&
  56813. window.onwebkittransitionend !== undefined
  56814. ) {
  56815. transitionProp = 'WebkitTransition';
  56816. transitionEndEvent = 'webkitTransitionEnd';
  56817. }
  56818. if (window.onanimationend === undefined &&
  56819. window.onwebkitanimationend !== undefined
  56820. ) {
  56821. animationProp = 'WebkitAnimation';
  56822. animationEndEvent = 'webkitAnimationEnd';
  56823. }
  56824. }
  56825. // binding to window is necessary to make hot reload work in IE in strict mode
  56826. var raf = inBrowser
  56827. ? window.requestAnimationFrame
  56828. ? window.requestAnimationFrame.bind(window)
  56829. : setTimeout
  56830. : /* istanbul ignore next */ function (fn) { return fn(); };
  56831. function nextFrame (fn) {
  56832. raf(function () {
  56833. raf(fn);
  56834. });
  56835. }
  56836. function addTransitionClass (el, cls) {
  56837. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  56838. if (transitionClasses.indexOf(cls) < 0) {
  56839. transitionClasses.push(cls);
  56840. addClass(el, cls);
  56841. }
  56842. }
  56843. function removeTransitionClass (el, cls) {
  56844. if (el._transitionClasses) {
  56845. remove(el._transitionClasses, cls);
  56846. }
  56847. removeClass(el, cls);
  56848. }
  56849. function whenTransitionEnds (
  56850. el,
  56851. expectedType,
  56852. cb
  56853. ) {
  56854. var ref = getTransitionInfo(el, expectedType);
  56855. var type = ref.type;
  56856. var timeout = ref.timeout;
  56857. var propCount = ref.propCount;
  56858. if (!type) { return cb() }
  56859. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  56860. var ended = 0;
  56861. var end = function () {
  56862. el.removeEventListener(event, onEnd);
  56863. cb();
  56864. };
  56865. var onEnd = function (e) {
  56866. if (e.target === el) {
  56867. if (++ended >= propCount) {
  56868. end();
  56869. }
  56870. }
  56871. };
  56872. setTimeout(function () {
  56873. if (ended < propCount) {
  56874. end();
  56875. }
  56876. }, timeout + 1);
  56877. el.addEventListener(event, onEnd);
  56878. }
  56879. var transformRE = /\b(transform|all)(,|$)/;
  56880. function getTransitionInfo (el, expectedType) {
  56881. var styles = window.getComputedStyle(el);
  56882. // JSDOM may return undefined for transition properties
  56883. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  56884. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  56885. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  56886. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  56887. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  56888. var animationTimeout = getTimeout(animationDelays, animationDurations);
  56889. var type;
  56890. var timeout = 0;
  56891. var propCount = 0;
  56892. /* istanbul ignore if */
  56893. if (expectedType === TRANSITION) {
  56894. if (transitionTimeout > 0) {
  56895. type = TRANSITION;
  56896. timeout = transitionTimeout;
  56897. propCount = transitionDurations.length;
  56898. }
  56899. } else if (expectedType === ANIMATION) {
  56900. if (animationTimeout > 0) {
  56901. type = ANIMATION;
  56902. timeout = animationTimeout;
  56903. propCount = animationDurations.length;
  56904. }
  56905. } else {
  56906. timeout = Math.max(transitionTimeout, animationTimeout);
  56907. type = timeout > 0
  56908. ? transitionTimeout > animationTimeout
  56909. ? TRANSITION
  56910. : ANIMATION
  56911. : null;
  56912. propCount = type
  56913. ? type === TRANSITION
  56914. ? transitionDurations.length
  56915. : animationDurations.length
  56916. : 0;
  56917. }
  56918. var hasTransform =
  56919. type === TRANSITION &&
  56920. transformRE.test(styles[transitionProp + 'Property']);
  56921. return {
  56922. type: type,
  56923. timeout: timeout,
  56924. propCount: propCount,
  56925. hasTransform: hasTransform
  56926. }
  56927. }
  56928. function getTimeout (delays, durations) {
  56929. /* istanbul ignore next */
  56930. while (delays.length < durations.length) {
  56931. delays = delays.concat(delays);
  56932. }
  56933. return Math.max.apply(null, durations.map(function (d, i) {
  56934. return toMs(d) + toMs(delays[i])
  56935. }))
  56936. }
  56937. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  56938. // in a locale-dependent way, using a comma instead of a dot.
  56939. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  56940. // as a floor function) causing unexpected behaviors
  56941. function toMs (s) {
  56942. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  56943. }
  56944. /* */
  56945. function enter (vnode, toggleDisplay) {
  56946. var el = vnode.elm;
  56947. // call leave callback now
  56948. if (isDef(el._leaveCb)) {
  56949. el._leaveCb.cancelled = true;
  56950. el._leaveCb();
  56951. }
  56952. var data = resolveTransition(vnode.data.transition);
  56953. if (isUndef(data)) {
  56954. return
  56955. }
  56956. /* istanbul ignore if */
  56957. if (isDef(el._enterCb) || el.nodeType !== 1) {
  56958. return
  56959. }
  56960. var css = data.css;
  56961. var type = data.type;
  56962. var enterClass = data.enterClass;
  56963. var enterToClass = data.enterToClass;
  56964. var enterActiveClass = data.enterActiveClass;
  56965. var appearClass = data.appearClass;
  56966. var appearToClass = data.appearToClass;
  56967. var appearActiveClass = data.appearActiveClass;
  56968. var beforeEnter = data.beforeEnter;
  56969. var enter = data.enter;
  56970. var afterEnter = data.afterEnter;
  56971. var enterCancelled = data.enterCancelled;
  56972. var beforeAppear = data.beforeAppear;
  56973. var appear = data.appear;
  56974. var afterAppear = data.afterAppear;
  56975. var appearCancelled = data.appearCancelled;
  56976. var duration = data.duration;
  56977. // activeInstance will always be the <transition> component managing this
  56978. // transition. One edge case to check is when the <transition> is placed
  56979. // as the root node of a child component. In that case we need to check
  56980. // <transition>'s parent for appear check.
  56981. var context = activeInstance;
  56982. var transitionNode = activeInstance.$vnode;
  56983. while (transitionNode && transitionNode.parent) {
  56984. context = transitionNode.context;
  56985. transitionNode = transitionNode.parent;
  56986. }
  56987. var isAppear = !context._isMounted || !vnode.isRootInsert;
  56988. if (isAppear && !appear && appear !== '') {
  56989. return
  56990. }
  56991. var startClass = isAppear && appearClass
  56992. ? appearClass
  56993. : enterClass;
  56994. var activeClass = isAppear && appearActiveClass
  56995. ? appearActiveClass
  56996. : enterActiveClass;
  56997. var toClass = isAppear && appearToClass
  56998. ? appearToClass
  56999. : enterToClass;
  57000. var beforeEnterHook = isAppear
  57001. ? (beforeAppear || beforeEnter)
  57002. : beforeEnter;
  57003. var enterHook = isAppear
  57004. ? (typeof appear === 'function' ? appear : enter)
  57005. : enter;
  57006. var afterEnterHook = isAppear
  57007. ? (afterAppear || afterEnter)
  57008. : afterEnter;
  57009. var enterCancelledHook = isAppear
  57010. ? (appearCancelled || enterCancelled)
  57011. : enterCancelled;
  57012. var explicitEnterDuration = toNumber(
  57013. isObject(duration)
  57014. ? duration.enter
  57015. : duration
  57016. );
  57017. if (explicitEnterDuration != null) {
  57018. checkDuration(explicitEnterDuration, 'enter', vnode);
  57019. }
  57020. var expectsCSS = css !== false && !isIE9;
  57021. var userWantsControl = getHookArgumentsLength(enterHook);
  57022. var cb = el._enterCb = once(function () {
  57023. if (expectsCSS) {
  57024. removeTransitionClass(el, toClass);
  57025. removeTransitionClass(el, activeClass);
  57026. }
  57027. if (cb.cancelled) {
  57028. if (expectsCSS) {
  57029. removeTransitionClass(el, startClass);
  57030. }
  57031. enterCancelledHook && enterCancelledHook(el);
  57032. } else {
  57033. afterEnterHook && afterEnterHook(el);
  57034. }
  57035. el._enterCb = null;
  57036. });
  57037. if (!vnode.data.show) {
  57038. // remove pending leave element on enter by injecting an insert hook
  57039. mergeVNodeHook(vnode, 'insert', function () {
  57040. var parent = el.parentNode;
  57041. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  57042. if (pendingNode &&
  57043. pendingNode.tag === vnode.tag &&
  57044. pendingNode.elm._leaveCb
  57045. ) {
  57046. pendingNode.elm._leaveCb();
  57047. }
  57048. enterHook && enterHook(el, cb);
  57049. });
  57050. }
  57051. // start enter transition
  57052. beforeEnterHook && beforeEnterHook(el);
  57053. if (expectsCSS) {
  57054. addTransitionClass(el, startClass);
  57055. addTransitionClass(el, activeClass);
  57056. nextFrame(function () {
  57057. removeTransitionClass(el, startClass);
  57058. if (!cb.cancelled) {
  57059. addTransitionClass(el, toClass);
  57060. if (!userWantsControl) {
  57061. if (isValidDuration(explicitEnterDuration)) {
  57062. setTimeout(cb, explicitEnterDuration);
  57063. } else {
  57064. whenTransitionEnds(el, type, cb);
  57065. }
  57066. }
  57067. }
  57068. });
  57069. }
  57070. if (vnode.data.show) {
  57071. toggleDisplay && toggleDisplay();
  57072. enterHook && enterHook(el, cb);
  57073. }
  57074. if (!expectsCSS && !userWantsControl) {
  57075. cb();
  57076. }
  57077. }
  57078. function leave (vnode, rm) {
  57079. var el = vnode.elm;
  57080. // call enter callback now
  57081. if (isDef(el._enterCb)) {
  57082. el._enterCb.cancelled = true;
  57083. el._enterCb();
  57084. }
  57085. var data = resolveTransition(vnode.data.transition);
  57086. if (isUndef(data) || el.nodeType !== 1) {
  57087. return rm()
  57088. }
  57089. /* istanbul ignore if */
  57090. if (isDef(el._leaveCb)) {
  57091. return
  57092. }
  57093. var css = data.css;
  57094. var type = data.type;
  57095. var leaveClass = data.leaveClass;
  57096. var leaveToClass = data.leaveToClass;
  57097. var leaveActiveClass = data.leaveActiveClass;
  57098. var beforeLeave = data.beforeLeave;
  57099. var leave = data.leave;
  57100. var afterLeave = data.afterLeave;
  57101. var leaveCancelled = data.leaveCancelled;
  57102. var delayLeave = data.delayLeave;
  57103. var duration = data.duration;
  57104. var expectsCSS = css !== false && !isIE9;
  57105. var userWantsControl = getHookArgumentsLength(leave);
  57106. var explicitLeaveDuration = toNumber(
  57107. isObject(duration)
  57108. ? duration.leave
  57109. : duration
  57110. );
  57111. if (isDef(explicitLeaveDuration)) {
  57112. checkDuration(explicitLeaveDuration, 'leave', vnode);
  57113. }
  57114. var cb = el._leaveCb = once(function () {
  57115. if (el.parentNode && el.parentNode._pending) {
  57116. el.parentNode._pending[vnode.key] = null;
  57117. }
  57118. if (expectsCSS) {
  57119. removeTransitionClass(el, leaveToClass);
  57120. removeTransitionClass(el, leaveActiveClass);
  57121. }
  57122. if (cb.cancelled) {
  57123. if (expectsCSS) {
  57124. removeTransitionClass(el, leaveClass);
  57125. }
  57126. leaveCancelled && leaveCancelled(el);
  57127. } else {
  57128. rm();
  57129. afterLeave && afterLeave(el);
  57130. }
  57131. el._leaveCb = null;
  57132. });
  57133. if (delayLeave) {
  57134. delayLeave(performLeave);
  57135. } else {
  57136. performLeave();
  57137. }
  57138. function performLeave () {
  57139. // the delayed leave may have already been cancelled
  57140. if (cb.cancelled) {
  57141. return
  57142. }
  57143. // record leaving element
  57144. if (!vnode.data.show && el.parentNode) {
  57145. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  57146. }
  57147. beforeLeave && beforeLeave(el);
  57148. if (expectsCSS) {
  57149. addTransitionClass(el, leaveClass);
  57150. addTransitionClass(el, leaveActiveClass);
  57151. nextFrame(function () {
  57152. removeTransitionClass(el, leaveClass);
  57153. if (!cb.cancelled) {
  57154. addTransitionClass(el, leaveToClass);
  57155. if (!userWantsControl) {
  57156. if (isValidDuration(explicitLeaveDuration)) {
  57157. setTimeout(cb, explicitLeaveDuration);
  57158. } else {
  57159. whenTransitionEnds(el, type, cb);
  57160. }
  57161. }
  57162. }
  57163. });
  57164. }
  57165. leave && leave(el, cb);
  57166. if (!expectsCSS && !userWantsControl) {
  57167. cb();
  57168. }
  57169. }
  57170. }
  57171. // only used in dev mode
  57172. function checkDuration (val, name, vnode) {
  57173. if (typeof val !== 'number') {
  57174. warn(
  57175. "<transition> explicit " + name + " duration is not a valid number - " +
  57176. "got " + (JSON.stringify(val)) + ".",
  57177. vnode.context
  57178. );
  57179. } else if (isNaN(val)) {
  57180. warn(
  57181. "<transition> explicit " + name + " duration is NaN - " +
  57182. 'the duration expression might be incorrect.',
  57183. vnode.context
  57184. );
  57185. }
  57186. }
  57187. function isValidDuration (val) {
  57188. return typeof val === 'number' && !isNaN(val)
  57189. }
  57190. /**
  57191. * Normalize a transition hook's argument length. The hook may be:
  57192. * - a merged hook (invoker) with the original in .fns
  57193. * - a wrapped component method (check ._length)
  57194. * - a plain function (.length)
  57195. */
  57196. function getHookArgumentsLength (fn) {
  57197. if (isUndef(fn)) {
  57198. return false
  57199. }
  57200. var invokerFns = fn.fns;
  57201. if (isDef(invokerFns)) {
  57202. // invoker
  57203. return getHookArgumentsLength(
  57204. Array.isArray(invokerFns)
  57205. ? invokerFns[0]
  57206. : invokerFns
  57207. )
  57208. } else {
  57209. return (fn._length || fn.length) > 1
  57210. }
  57211. }
  57212. function _enter (_, vnode) {
  57213. if (vnode.data.show !== true) {
  57214. enter(vnode);
  57215. }
  57216. }
  57217. var transition = inBrowser ? {
  57218. create: _enter,
  57219. activate: _enter,
  57220. remove: function remove$$1 (vnode, rm) {
  57221. /* istanbul ignore else */
  57222. if (vnode.data.show !== true) {
  57223. leave(vnode, rm);
  57224. } else {
  57225. rm();
  57226. }
  57227. }
  57228. } : {};
  57229. var platformModules = [
  57230. attrs,
  57231. klass,
  57232. events,
  57233. domProps,
  57234. style,
  57235. transition
  57236. ];
  57237. /* */
  57238. // the directive module should be applied last, after all
  57239. // built-in modules have been applied.
  57240. var modules = platformModules.concat(baseModules);
  57241. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  57242. /**
  57243. * Not type checking this file because flow doesn't like attaching
  57244. * properties to Elements.
  57245. */
  57246. /* istanbul ignore if */
  57247. if (isIE9) {
  57248. // http://www.matts411.com/post/internet-explorer-9-oninput/
  57249. document.addEventListener('selectionchange', function () {
  57250. var el = document.activeElement;
  57251. if (el && el.vmodel) {
  57252. trigger(el, 'input');
  57253. }
  57254. });
  57255. }
  57256. var directive = {
  57257. inserted: function inserted (el, binding, vnode, oldVnode) {
  57258. if (vnode.tag === 'select') {
  57259. // #6903
  57260. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  57261. mergeVNodeHook(vnode, 'postpatch', function () {
  57262. directive.componentUpdated(el, binding, vnode);
  57263. });
  57264. } else {
  57265. setSelected(el, binding, vnode.context);
  57266. }
  57267. el._vOptions = [].map.call(el.options, getValue);
  57268. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  57269. el._vModifiers = binding.modifiers;
  57270. if (!binding.modifiers.lazy) {
  57271. el.addEventListener('compositionstart', onCompositionStart);
  57272. el.addEventListener('compositionend', onCompositionEnd);
  57273. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  57274. // switching focus before confirming composition choice
  57275. // this also fixes the issue where some browsers e.g. iOS Chrome
  57276. // fires "change" instead of "input" on autocomplete.
  57277. el.addEventListener('change', onCompositionEnd);
  57278. /* istanbul ignore if */
  57279. if (isIE9) {
  57280. el.vmodel = true;
  57281. }
  57282. }
  57283. }
  57284. },
  57285. componentUpdated: function componentUpdated (el, binding, vnode) {
  57286. if (vnode.tag === 'select') {
  57287. setSelected(el, binding, vnode.context);
  57288. // in case the options rendered by v-for have changed,
  57289. // it's possible that the value is out-of-sync with the rendered options.
  57290. // detect such cases and filter out values that no longer has a matching
  57291. // option in the DOM.
  57292. var prevOptions = el._vOptions;
  57293. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  57294. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  57295. // trigger change event if
  57296. // no matching option found for at least one value
  57297. var needReset = el.multiple
  57298. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  57299. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  57300. if (needReset) {
  57301. trigger(el, 'change');
  57302. }
  57303. }
  57304. }
  57305. }
  57306. };
  57307. function setSelected (el, binding, vm) {
  57308. actuallySetSelected(el, binding, vm);
  57309. /* istanbul ignore if */
  57310. if (isIE || isEdge) {
  57311. setTimeout(function () {
  57312. actuallySetSelected(el, binding, vm);
  57313. }, 0);
  57314. }
  57315. }
  57316. function actuallySetSelected (el, binding, vm) {
  57317. var value = binding.value;
  57318. var isMultiple = el.multiple;
  57319. if (isMultiple && !Array.isArray(value)) {
  57320. warn(
  57321. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  57322. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  57323. vm
  57324. );
  57325. return
  57326. }
  57327. var selected, option;
  57328. for (var i = 0, l = el.options.length; i < l; i++) {
  57329. option = el.options[i];
  57330. if (isMultiple) {
  57331. selected = looseIndexOf(value, getValue(option)) > -1;
  57332. if (option.selected !== selected) {
  57333. option.selected = selected;
  57334. }
  57335. } else {
  57336. if (looseEqual(getValue(option), value)) {
  57337. if (el.selectedIndex !== i) {
  57338. el.selectedIndex = i;
  57339. }
  57340. return
  57341. }
  57342. }
  57343. }
  57344. if (!isMultiple) {
  57345. el.selectedIndex = -1;
  57346. }
  57347. }
  57348. function hasNoMatchingOption (value, options) {
  57349. return options.every(function (o) { return !looseEqual(o, value); })
  57350. }
  57351. function getValue (option) {
  57352. return '_value' in option
  57353. ? option._value
  57354. : option.value
  57355. }
  57356. function onCompositionStart (e) {
  57357. e.target.composing = true;
  57358. }
  57359. function onCompositionEnd (e) {
  57360. // prevent triggering an input event for no reason
  57361. if (!e.target.composing) { return }
  57362. e.target.composing = false;
  57363. trigger(e.target, 'input');
  57364. }
  57365. function trigger (el, type) {
  57366. var e = document.createEvent('HTMLEvents');
  57367. e.initEvent(type, true, true);
  57368. el.dispatchEvent(e);
  57369. }
  57370. /* */
  57371. // recursively search for possible transition defined inside the component root
  57372. function locateNode (vnode) {
  57373. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  57374. ? locateNode(vnode.componentInstance._vnode)
  57375. : vnode
  57376. }
  57377. var show = {
  57378. bind: function bind (el, ref, vnode) {
  57379. var value = ref.value;
  57380. vnode = locateNode(vnode);
  57381. var transition$$1 = vnode.data && vnode.data.transition;
  57382. var originalDisplay = el.__vOriginalDisplay =
  57383. el.style.display === 'none' ? '' : el.style.display;
  57384. if (value && transition$$1) {
  57385. vnode.data.show = true;
  57386. enter(vnode, function () {
  57387. el.style.display = originalDisplay;
  57388. });
  57389. } else {
  57390. el.style.display = value ? originalDisplay : 'none';
  57391. }
  57392. },
  57393. update: function update (el, ref, vnode) {
  57394. var value = ref.value;
  57395. var oldValue = ref.oldValue;
  57396. /* istanbul ignore if */
  57397. if (!value === !oldValue) { return }
  57398. vnode = locateNode(vnode);
  57399. var transition$$1 = vnode.data && vnode.data.transition;
  57400. if (transition$$1) {
  57401. vnode.data.show = true;
  57402. if (value) {
  57403. enter(vnode, function () {
  57404. el.style.display = el.__vOriginalDisplay;
  57405. });
  57406. } else {
  57407. leave(vnode, function () {
  57408. el.style.display = 'none';
  57409. });
  57410. }
  57411. } else {
  57412. el.style.display = value ? el.__vOriginalDisplay : 'none';
  57413. }
  57414. },
  57415. unbind: function unbind (
  57416. el,
  57417. binding,
  57418. vnode,
  57419. oldVnode,
  57420. isDestroy
  57421. ) {
  57422. if (!isDestroy) {
  57423. el.style.display = el.__vOriginalDisplay;
  57424. }
  57425. }
  57426. };
  57427. var platformDirectives = {
  57428. model: directive,
  57429. show: show
  57430. };
  57431. /* */
  57432. var transitionProps = {
  57433. name: String,
  57434. appear: Boolean,
  57435. css: Boolean,
  57436. mode: String,
  57437. type: String,
  57438. enterClass: String,
  57439. leaveClass: String,
  57440. enterToClass: String,
  57441. leaveToClass: String,
  57442. enterActiveClass: String,
  57443. leaveActiveClass: String,
  57444. appearClass: String,
  57445. appearActiveClass: String,
  57446. appearToClass: String,
  57447. duration: [Number, String, Object]
  57448. };
  57449. // in case the child is also an abstract component, e.g. <keep-alive>
  57450. // we want to recursively retrieve the real component to be rendered
  57451. function getRealChild (vnode) {
  57452. var compOptions = vnode && vnode.componentOptions;
  57453. if (compOptions && compOptions.Ctor.options.abstract) {
  57454. return getRealChild(getFirstComponentChild(compOptions.children))
  57455. } else {
  57456. return vnode
  57457. }
  57458. }
  57459. function extractTransitionData (comp) {
  57460. var data = {};
  57461. var options = comp.$options;
  57462. // props
  57463. for (var key in options.propsData) {
  57464. data[key] = comp[key];
  57465. }
  57466. // events.
  57467. // extract listeners and pass them directly to the transition methods
  57468. var listeners = options._parentListeners;
  57469. for (var key$1 in listeners) {
  57470. data[camelize(key$1)] = listeners[key$1];
  57471. }
  57472. return data
  57473. }
  57474. function placeholder (h, rawChild) {
  57475. if (/\d-keep-alive$/.test(rawChild.tag)) {
  57476. return h('keep-alive', {
  57477. props: rawChild.componentOptions.propsData
  57478. })
  57479. }
  57480. }
  57481. function hasParentTransition (vnode) {
  57482. while ((vnode = vnode.parent)) {
  57483. if (vnode.data.transition) {
  57484. return true
  57485. }
  57486. }
  57487. }
  57488. function isSameChild (child, oldChild) {
  57489. return oldChild.key === child.key && oldChild.tag === child.tag
  57490. }
  57491. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  57492. var isVShowDirective = function (d) { return d.name === 'show'; };
  57493. var Transition = {
  57494. name: 'transition',
  57495. props: transitionProps,
  57496. abstract: true,
  57497. render: function render (h) {
  57498. var this$1 = this;
  57499. var children = this.$slots.default;
  57500. if (!children) {
  57501. return
  57502. }
  57503. // filter out text nodes (possible whitespaces)
  57504. children = children.filter(isNotTextNode);
  57505. /* istanbul ignore if */
  57506. if (!children.length) {
  57507. return
  57508. }
  57509. // warn multiple elements
  57510. if (children.length > 1) {
  57511. warn(
  57512. '<transition> can only be used on a single element. Use ' +
  57513. '<transition-group> for lists.',
  57514. this.$parent
  57515. );
  57516. }
  57517. var mode = this.mode;
  57518. // warn invalid mode
  57519. if (mode && mode !== 'in-out' && mode !== 'out-in'
  57520. ) {
  57521. warn(
  57522. 'invalid <transition> mode: ' + mode,
  57523. this.$parent
  57524. );
  57525. }
  57526. var rawChild = children[0];
  57527. // if this is a component root node and the component's
  57528. // parent container node also has transition, skip.
  57529. if (hasParentTransition(this.$vnode)) {
  57530. return rawChild
  57531. }
  57532. // apply transition data to child
  57533. // use getRealChild() to ignore abstract components e.g. keep-alive
  57534. var child = getRealChild(rawChild);
  57535. /* istanbul ignore if */
  57536. if (!child) {
  57537. return rawChild
  57538. }
  57539. if (this._leaving) {
  57540. return placeholder(h, rawChild)
  57541. }
  57542. // ensure a key that is unique to the vnode type and to this transition
  57543. // component instance. This key will be used to remove pending leaving nodes
  57544. // during entering.
  57545. var id = "__transition-" + (this._uid) + "-";
  57546. child.key = child.key == null
  57547. ? child.isComment
  57548. ? id + 'comment'
  57549. : id + child.tag
  57550. : isPrimitive(child.key)
  57551. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  57552. : child.key;
  57553. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  57554. var oldRawChild = this._vnode;
  57555. var oldChild = getRealChild(oldRawChild);
  57556. // mark v-show
  57557. // so that the transition module can hand over the control to the directive
  57558. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  57559. child.data.show = true;
  57560. }
  57561. if (
  57562. oldChild &&
  57563. oldChild.data &&
  57564. !isSameChild(child, oldChild) &&
  57565. !isAsyncPlaceholder(oldChild) &&
  57566. // #6687 component root is a comment node
  57567. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  57568. ) {
  57569. // replace old child transition data with fresh one
  57570. // important for dynamic transitions!
  57571. var oldData = oldChild.data.transition = extend({}, data);
  57572. // handle transition mode
  57573. if (mode === 'out-in') {
  57574. // return placeholder node and queue update when leave finishes
  57575. this._leaving = true;
  57576. mergeVNodeHook(oldData, 'afterLeave', function () {
  57577. this$1._leaving = false;
  57578. this$1.$forceUpdate();
  57579. });
  57580. return placeholder(h, rawChild)
  57581. } else if (mode === 'in-out') {
  57582. if (isAsyncPlaceholder(child)) {
  57583. return oldRawChild
  57584. }
  57585. var delayedLeave;
  57586. var performLeave = function () { delayedLeave(); };
  57587. mergeVNodeHook(data, 'afterEnter', performLeave);
  57588. mergeVNodeHook(data, 'enterCancelled', performLeave);
  57589. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  57590. }
  57591. }
  57592. return rawChild
  57593. }
  57594. };
  57595. /* */
  57596. var props = extend({
  57597. tag: String,
  57598. moveClass: String
  57599. }, transitionProps);
  57600. delete props.mode;
  57601. var TransitionGroup = {
  57602. props: props,
  57603. beforeMount: function beforeMount () {
  57604. var this$1 = this;
  57605. var update = this._update;
  57606. this._update = function (vnode, hydrating) {
  57607. var restoreActiveInstance = setActiveInstance(this$1);
  57608. // force removing pass
  57609. this$1.__patch__(
  57610. this$1._vnode,
  57611. this$1.kept,
  57612. false, // hydrating
  57613. true // removeOnly (!important, avoids unnecessary moves)
  57614. );
  57615. this$1._vnode = this$1.kept;
  57616. restoreActiveInstance();
  57617. update.call(this$1, vnode, hydrating);
  57618. };
  57619. },
  57620. render: function render (h) {
  57621. var tag = this.tag || this.$vnode.data.tag || 'span';
  57622. var map = Object.create(null);
  57623. var prevChildren = this.prevChildren = this.children;
  57624. var rawChildren = this.$slots.default || [];
  57625. var children = this.children = [];
  57626. var transitionData = extractTransitionData(this);
  57627. for (var i = 0; i < rawChildren.length; i++) {
  57628. var c = rawChildren[i];
  57629. if (c.tag) {
  57630. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  57631. children.push(c);
  57632. map[c.key] = c
  57633. ;(c.data || (c.data = {})).transition = transitionData;
  57634. } else {
  57635. var opts = c.componentOptions;
  57636. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  57637. warn(("<transition-group> children must be keyed: <" + name + ">"));
  57638. }
  57639. }
  57640. }
  57641. if (prevChildren) {
  57642. var kept = [];
  57643. var removed = [];
  57644. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  57645. var c$1 = prevChildren[i$1];
  57646. c$1.data.transition = transitionData;
  57647. c$1.data.pos = c$1.elm.getBoundingClientRect();
  57648. if (map[c$1.key]) {
  57649. kept.push(c$1);
  57650. } else {
  57651. removed.push(c$1);
  57652. }
  57653. }
  57654. this.kept = h(tag, null, kept);
  57655. this.removed = removed;
  57656. }
  57657. return h(tag, null, children)
  57658. },
  57659. updated: function updated () {
  57660. var children = this.prevChildren;
  57661. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  57662. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  57663. return
  57664. }
  57665. // we divide the work into three loops to avoid mixing DOM reads and writes
  57666. // in each iteration - which helps prevent layout thrashing.
  57667. children.forEach(callPendingCbs);
  57668. children.forEach(recordPosition);
  57669. children.forEach(applyTranslation);
  57670. // force reflow to put everything in position
  57671. // assign to this to avoid being removed in tree-shaking
  57672. // $flow-disable-line
  57673. this._reflow = document.body.offsetHeight;
  57674. children.forEach(function (c) {
  57675. if (c.data.moved) {
  57676. var el = c.elm;
  57677. var s = el.style;
  57678. addTransitionClass(el, moveClass);
  57679. s.transform = s.WebkitTransform = s.transitionDuration = '';
  57680. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  57681. if (e && e.target !== el) {
  57682. return
  57683. }
  57684. if (!e || /transform$/.test(e.propertyName)) {
  57685. el.removeEventListener(transitionEndEvent, cb);
  57686. el._moveCb = null;
  57687. removeTransitionClass(el, moveClass);
  57688. }
  57689. });
  57690. }
  57691. });
  57692. },
  57693. methods: {
  57694. hasMove: function hasMove (el, moveClass) {
  57695. /* istanbul ignore if */
  57696. if (!hasTransition) {
  57697. return false
  57698. }
  57699. /* istanbul ignore if */
  57700. if (this._hasMove) {
  57701. return this._hasMove
  57702. }
  57703. // Detect whether an element with the move class applied has
  57704. // CSS transitions. Since the element may be inside an entering
  57705. // transition at this very moment, we make a clone of it and remove
  57706. // all other transition classes applied to ensure only the move class
  57707. // is applied.
  57708. var clone = el.cloneNode();
  57709. if (el._transitionClasses) {
  57710. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  57711. }
  57712. addClass(clone, moveClass);
  57713. clone.style.display = 'none';
  57714. this.$el.appendChild(clone);
  57715. var info = getTransitionInfo(clone);
  57716. this.$el.removeChild(clone);
  57717. return (this._hasMove = info.hasTransform)
  57718. }
  57719. }
  57720. };
  57721. function callPendingCbs (c) {
  57722. /* istanbul ignore if */
  57723. if (c.elm._moveCb) {
  57724. c.elm._moveCb();
  57725. }
  57726. /* istanbul ignore if */
  57727. if (c.elm._enterCb) {
  57728. c.elm._enterCb();
  57729. }
  57730. }
  57731. function recordPosition (c) {
  57732. c.data.newPos = c.elm.getBoundingClientRect();
  57733. }
  57734. function applyTranslation (c) {
  57735. var oldPos = c.data.pos;
  57736. var newPos = c.data.newPos;
  57737. var dx = oldPos.left - newPos.left;
  57738. var dy = oldPos.top - newPos.top;
  57739. if (dx || dy) {
  57740. c.data.moved = true;
  57741. var s = c.elm.style;
  57742. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  57743. s.transitionDuration = '0s';
  57744. }
  57745. }
  57746. var platformComponents = {
  57747. Transition: Transition,
  57748. TransitionGroup: TransitionGroup
  57749. };
  57750. /* */
  57751. // install platform specific utils
  57752. Vue.config.mustUseProp = mustUseProp;
  57753. Vue.config.isReservedTag = isReservedTag;
  57754. Vue.config.isReservedAttr = isReservedAttr;
  57755. Vue.config.getTagNamespace = getTagNamespace;
  57756. Vue.config.isUnknownElement = isUnknownElement;
  57757. // install platform runtime directives & components
  57758. extend(Vue.options.directives, platformDirectives);
  57759. extend(Vue.options.components, platformComponents);
  57760. // install platform patch function
  57761. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  57762. // public mount method
  57763. Vue.prototype.$mount = function (
  57764. el,
  57765. hydrating
  57766. ) {
  57767. el = el && inBrowser ? query(el) : undefined;
  57768. return mountComponent(this, el, hydrating)
  57769. };
  57770. // devtools global hook
  57771. /* istanbul ignore next */
  57772. if (inBrowser) {
  57773. setTimeout(function () {
  57774. if (config.devtools) {
  57775. if (devtools) {
  57776. devtools.emit('init', Vue);
  57777. } else {
  57778. console[console.info ? 'info' : 'log'](
  57779. 'Download the Vue Devtools extension for a better development experience:\n' +
  57780. 'https://github.com/vuejs/vue-devtools'
  57781. );
  57782. }
  57783. }
  57784. if (config.productionTip !== false &&
  57785. typeof console !== 'undefined'
  57786. ) {
  57787. console[console.info ? 'info' : 'log'](
  57788. "You are running Vue in development mode.\n" +
  57789. "Make sure to turn on production mode when deploying for production.\n" +
  57790. "See more tips at https://vuejs.org/guide/deployment.html"
  57791. );
  57792. }
  57793. }, 0);
  57794. }
  57795. /* */
  57796. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  57797. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  57798. var buildRegex = cached(function (delimiters) {
  57799. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  57800. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  57801. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  57802. });
  57803. function parseText (
  57804. text,
  57805. delimiters
  57806. ) {
  57807. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  57808. if (!tagRE.test(text)) {
  57809. return
  57810. }
  57811. var tokens = [];
  57812. var rawTokens = [];
  57813. var lastIndex = tagRE.lastIndex = 0;
  57814. var match, index, tokenValue;
  57815. while ((match = tagRE.exec(text))) {
  57816. index = match.index;
  57817. // push text token
  57818. if (index > lastIndex) {
  57819. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  57820. tokens.push(JSON.stringify(tokenValue));
  57821. }
  57822. // tag token
  57823. var exp = parseFilters(match[1].trim());
  57824. tokens.push(("_s(" + exp + ")"));
  57825. rawTokens.push({ '@binding': exp });
  57826. lastIndex = index + match[0].length;
  57827. }
  57828. if (lastIndex < text.length) {
  57829. rawTokens.push(tokenValue = text.slice(lastIndex));
  57830. tokens.push(JSON.stringify(tokenValue));
  57831. }
  57832. return {
  57833. expression: tokens.join('+'),
  57834. tokens: rawTokens
  57835. }
  57836. }
  57837. /* */
  57838. function transformNode (el, options) {
  57839. var warn = options.warn || baseWarn;
  57840. var staticClass = getAndRemoveAttr(el, 'class');
  57841. if (staticClass) {
  57842. var res = parseText(staticClass, options.delimiters);
  57843. if (res) {
  57844. warn(
  57845. "class=\"" + staticClass + "\": " +
  57846. 'Interpolation inside attributes has been removed. ' +
  57847. 'Use v-bind or the colon shorthand instead. For example, ' +
  57848. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  57849. el.rawAttrsMap['class']
  57850. );
  57851. }
  57852. }
  57853. if (staticClass) {
  57854. el.staticClass = JSON.stringify(staticClass);
  57855. }
  57856. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  57857. if (classBinding) {
  57858. el.classBinding = classBinding;
  57859. }
  57860. }
  57861. function genData (el) {
  57862. var data = '';
  57863. if (el.staticClass) {
  57864. data += "staticClass:" + (el.staticClass) + ",";
  57865. }
  57866. if (el.classBinding) {
  57867. data += "class:" + (el.classBinding) + ",";
  57868. }
  57869. return data
  57870. }
  57871. var klass$1 = {
  57872. staticKeys: ['staticClass'],
  57873. transformNode: transformNode,
  57874. genData: genData
  57875. };
  57876. /* */
  57877. function transformNode$1 (el, options) {
  57878. var warn = options.warn || baseWarn;
  57879. var staticStyle = getAndRemoveAttr(el, 'style');
  57880. if (staticStyle) {
  57881. /* istanbul ignore if */
  57882. {
  57883. var res = parseText(staticStyle, options.delimiters);
  57884. if (res) {
  57885. warn(
  57886. "style=\"" + staticStyle + "\": " +
  57887. 'Interpolation inside attributes has been removed. ' +
  57888. 'Use v-bind or the colon shorthand instead. For example, ' +
  57889. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  57890. el.rawAttrsMap['style']
  57891. );
  57892. }
  57893. }
  57894. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  57895. }
  57896. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  57897. if (styleBinding) {
  57898. el.styleBinding = styleBinding;
  57899. }
  57900. }
  57901. function genData$1 (el) {
  57902. var data = '';
  57903. if (el.staticStyle) {
  57904. data += "staticStyle:" + (el.staticStyle) + ",";
  57905. }
  57906. if (el.styleBinding) {
  57907. data += "style:(" + (el.styleBinding) + "),";
  57908. }
  57909. return data
  57910. }
  57911. var style$1 = {
  57912. staticKeys: ['staticStyle'],
  57913. transformNode: transformNode$1,
  57914. genData: genData$1
  57915. };
  57916. /* */
  57917. var decoder;
  57918. var he = {
  57919. decode: function decode (html) {
  57920. decoder = decoder || document.createElement('div');
  57921. decoder.innerHTML = html;
  57922. return decoder.textContent
  57923. }
  57924. };
  57925. /* */
  57926. var isUnaryTag = makeMap(
  57927. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  57928. 'link,meta,param,source,track,wbr'
  57929. );
  57930. // Elements that you can, intentionally, leave open
  57931. // (and which close themselves)
  57932. var canBeLeftOpenTag = makeMap(
  57933. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  57934. );
  57935. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  57936. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  57937. var isNonPhrasingTag = makeMap(
  57938. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  57939. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  57940. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  57941. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  57942. 'title,tr,track'
  57943. );
  57944. /**
  57945. * Not type-checking this file because it's mostly vendor code.
  57946. */
  57947. // Regular Expressions for parsing tags and attributes
  57948. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  57949. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  57950. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  57951. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  57952. var startTagOpen = new RegExp(("^<" + qnameCapture));
  57953. var startTagClose = /^\s*(\/?)>/;
  57954. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  57955. var doctype = /^<!DOCTYPE [^>]+>/i;
  57956. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  57957. var comment = /^<!\--/;
  57958. var conditionalComment = /^<!\[/;
  57959. // Special Elements (can contain anything)
  57960. var isPlainTextElement = makeMap('script,style,textarea', true);
  57961. var reCache = {};
  57962. var decodingMap = {
  57963. '&lt;': '<',
  57964. '&gt;': '>',
  57965. '&quot;': '"',
  57966. '&amp;': '&',
  57967. '&#10;': '\n',
  57968. '&#9;': '\t',
  57969. '&#39;': "'"
  57970. };
  57971. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  57972. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  57973. // #5992
  57974. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  57975. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  57976. function decodeAttr (value, shouldDecodeNewlines) {
  57977. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  57978. return value.replace(re, function (match) { return decodingMap[match]; })
  57979. }
  57980. function parseHTML (html, options) {
  57981. var stack = [];
  57982. var expectHTML = options.expectHTML;
  57983. var isUnaryTag$$1 = options.isUnaryTag || no;
  57984. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  57985. var index = 0;
  57986. var last, lastTag;
  57987. while (html) {
  57988. last = html;
  57989. // Make sure we're not in a plaintext content element like script/style
  57990. if (!lastTag || !isPlainTextElement(lastTag)) {
  57991. var textEnd = html.indexOf('<');
  57992. if (textEnd === 0) {
  57993. // Comment:
  57994. if (comment.test(html)) {
  57995. var commentEnd = html.indexOf('-->');
  57996. if (commentEnd >= 0) {
  57997. if (options.shouldKeepComment) {
  57998. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  57999. }
  58000. advance(commentEnd + 3);
  58001. continue
  58002. }
  58003. }
  58004. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  58005. if (conditionalComment.test(html)) {
  58006. var conditionalEnd = html.indexOf(']>');
  58007. if (conditionalEnd >= 0) {
  58008. advance(conditionalEnd + 2);
  58009. continue
  58010. }
  58011. }
  58012. // Doctype:
  58013. var doctypeMatch = html.match(doctype);
  58014. if (doctypeMatch) {
  58015. advance(doctypeMatch[0].length);
  58016. continue
  58017. }
  58018. // End tag:
  58019. var endTagMatch = html.match(endTag);
  58020. if (endTagMatch) {
  58021. var curIndex = index;
  58022. advance(endTagMatch[0].length);
  58023. parseEndTag(endTagMatch[1], curIndex, index);
  58024. continue
  58025. }
  58026. // Start tag:
  58027. var startTagMatch = parseStartTag();
  58028. if (startTagMatch) {
  58029. handleStartTag(startTagMatch);
  58030. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  58031. advance(1);
  58032. }
  58033. continue
  58034. }
  58035. }
  58036. var text = (void 0), rest = (void 0), next = (void 0);
  58037. if (textEnd >= 0) {
  58038. rest = html.slice(textEnd);
  58039. while (
  58040. !endTag.test(rest) &&
  58041. !startTagOpen.test(rest) &&
  58042. !comment.test(rest) &&
  58043. !conditionalComment.test(rest)
  58044. ) {
  58045. // < in plain text, be forgiving and treat it as text
  58046. next = rest.indexOf('<', 1);
  58047. if (next < 0) { break }
  58048. textEnd += next;
  58049. rest = html.slice(textEnd);
  58050. }
  58051. text = html.substring(0, textEnd);
  58052. }
  58053. if (textEnd < 0) {
  58054. text = html;
  58055. }
  58056. if (text) {
  58057. advance(text.length);
  58058. }
  58059. if (options.chars && text) {
  58060. options.chars(text, index - text.length, index);
  58061. }
  58062. } else {
  58063. var endTagLength = 0;
  58064. var stackedTag = lastTag.toLowerCase();
  58065. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  58066. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  58067. endTagLength = endTag.length;
  58068. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  58069. text = text
  58070. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  58071. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  58072. }
  58073. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  58074. text = text.slice(1);
  58075. }
  58076. if (options.chars) {
  58077. options.chars(text);
  58078. }
  58079. return ''
  58080. });
  58081. index += html.length - rest$1.length;
  58082. html = rest$1;
  58083. parseEndTag(stackedTag, index - endTagLength, index);
  58084. }
  58085. if (html === last) {
  58086. options.chars && options.chars(html);
  58087. if (!stack.length && options.warn) {
  58088. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  58089. }
  58090. break
  58091. }
  58092. }
  58093. // Clean up any remaining tags
  58094. parseEndTag();
  58095. function advance (n) {
  58096. index += n;
  58097. html = html.substring(n);
  58098. }
  58099. function parseStartTag () {
  58100. var start = html.match(startTagOpen);
  58101. if (start) {
  58102. var match = {
  58103. tagName: start[1],
  58104. attrs: [],
  58105. start: index
  58106. };
  58107. advance(start[0].length);
  58108. var end, attr;
  58109. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  58110. attr.start = index;
  58111. advance(attr[0].length);
  58112. attr.end = index;
  58113. match.attrs.push(attr);
  58114. }
  58115. if (end) {
  58116. match.unarySlash = end[1];
  58117. advance(end[0].length);
  58118. match.end = index;
  58119. return match
  58120. }
  58121. }
  58122. }
  58123. function handleStartTag (match) {
  58124. var tagName = match.tagName;
  58125. var unarySlash = match.unarySlash;
  58126. if (expectHTML) {
  58127. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  58128. parseEndTag(lastTag);
  58129. }
  58130. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  58131. parseEndTag(tagName);
  58132. }
  58133. }
  58134. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  58135. var l = match.attrs.length;
  58136. var attrs = new Array(l);
  58137. for (var i = 0; i < l; i++) {
  58138. var args = match.attrs[i];
  58139. var value = args[3] || args[4] || args[5] || '';
  58140. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  58141. ? options.shouldDecodeNewlinesForHref
  58142. : options.shouldDecodeNewlines;
  58143. attrs[i] = {
  58144. name: args[1],
  58145. value: decodeAttr(value, shouldDecodeNewlines)
  58146. };
  58147. if (options.outputSourceRange) {
  58148. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  58149. attrs[i].end = args.end;
  58150. }
  58151. }
  58152. if (!unary) {
  58153. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  58154. lastTag = tagName;
  58155. }
  58156. if (options.start) {
  58157. options.start(tagName, attrs, unary, match.start, match.end);
  58158. }
  58159. }
  58160. function parseEndTag (tagName, start, end) {
  58161. var pos, lowerCasedTagName;
  58162. if (start == null) { start = index; }
  58163. if (end == null) { end = index; }
  58164. // Find the closest opened tag of the same type
  58165. if (tagName) {
  58166. lowerCasedTagName = tagName.toLowerCase();
  58167. for (pos = stack.length - 1; pos >= 0; pos--) {
  58168. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  58169. break
  58170. }
  58171. }
  58172. } else {
  58173. // If no tag name is provided, clean shop
  58174. pos = 0;
  58175. }
  58176. if (pos >= 0) {
  58177. // Close all the open elements, up the stack
  58178. for (var i = stack.length - 1; i >= pos; i--) {
  58179. if (i > pos || !tagName &&
  58180. options.warn
  58181. ) {
  58182. options.warn(
  58183. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  58184. { start: stack[i].start, end: stack[i].end }
  58185. );
  58186. }
  58187. if (options.end) {
  58188. options.end(stack[i].tag, start, end);
  58189. }
  58190. }
  58191. // Remove the open elements from the stack
  58192. stack.length = pos;
  58193. lastTag = pos && stack[pos - 1].tag;
  58194. } else if (lowerCasedTagName === 'br') {
  58195. if (options.start) {
  58196. options.start(tagName, [], true, start, end);
  58197. }
  58198. } else if (lowerCasedTagName === 'p') {
  58199. if (options.start) {
  58200. options.start(tagName, [], false, start, end);
  58201. }
  58202. if (options.end) {
  58203. options.end(tagName, start, end);
  58204. }
  58205. }
  58206. }
  58207. }
  58208. /* */
  58209. var onRE = /^@|^v-on:/;
  58210. var dirRE = /^v-|^@|^:|^#/;
  58211. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  58212. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  58213. var stripParensRE = /^\(|\)$/g;
  58214. var dynamicArgRE = /^\[.*\]$/;
  58215. var argRE = /:(.*)$/;
  58216. var bindRE = /^:|^\.|^v-bind:/;
  58217. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  58218. var slotRE = /^v-slot(:|$)|^#/;
  58219. var lineBreakRE = /[\r\n]/;
  58220. var whitespaceRE$1 = /\s+/g;
  58221. var invalidAttributeRE = /[\s"'<>\/=]/;
  58222. var decodeHTMLCached = cached(he.decode);
  58223. var emptySlotScopeToken = "_empty_";
  58224. // configurable state
  58225. var warn$2;
  58226. var delimiters;
  58227. var transforms;
  58228. var preTransforms;
  58229. var postTransforms;
  58230. var platformIsPreTag;
  58231. var platformMustUseProp;
  58232. var platformGetTagNamespace;
  58233. var maybeComponent;
  58234. function createASTElement (
  58235. tag,
  58236. attrs,
  58237. parent
  58238. ) {
  58239. return {
  58240. type: 1,
  58241. tag: tag,
  58242. attrsList: attrs,
  58243. attrsMap: makeAttrsMap(attrs),
  58244. rawAttrsMap: {},
  58245. parent: parent,
  58246. children: []
  58247. }
  58248. }
  58249. /**
  58250. * Convert HTML string to AST.
  58251. */
  58252. function parse (
  58253. template,
  58254. options
  58255. ) {
  58256. warn$2 = options.warn || baseWarn;
  58257. platformIsPreTag = options.isPreTag || no;
  58258. platformMustUseProp = options.mustUseProp || no;
  58259. platformGetTagNamespace = options.getTagNamespace || no;
  58260. var isReservedTag = options.isReservedTag || no;
  58261. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  58262. transforms = pluckModuleFunction(options.modules, 'transformNode');
  58263. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  58264. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  58265. delimiters = options.delimiters;
  58266. var stack = [];
  58267. var preserveWhitespace = options.preserveWhitespace !== false;
  58268. var whitespaceOption = options.whitespace;
  58269. var root;
  58270. var currentParent;
  58271. var inVPre = false;
  58272. var inPre = false;
  58273. var warned = false;
  58274. function warnOnce (msg, range) {
  58275. if (!warned) {
  58276. warned = true;
  58277. warn$2(msg, range);
  58278. }
  58279. }
  58280. function closeElement (element) {
  58281. trimEndingWhitespace(element);
  58282. if (!inVPre && !element.processed) {
  58283. element = processElement(element, options);
  58284. }
  58285. // tree management
  58286. if (!stack.length && element !== root) {
  58287. // allow root elements with v-if, v-else-if and v-else
  58288. if (root.if && (element.elseif || element.else)) {
  58289. {
  58290. checkRootConstraints(element);
  58291. }
  58292. addIfCondition(root, {
  58293. exp: element.elseif,
  58294. block: element
  58295. });
  58296. } else {
  58297. warnOnce(
  58298. "Component template should contain exactly one root element. " +
  58299. "If you are using v-if on multiple elements, " +
  58300. "use v-else-if to chain them instead.",
  58301. { start: element.start }
  58302. );
  58303. }
  58304. }
  58305. if (currentParent && !element.forbidden) {
  58306. if (element.elseif || element.else) {
  58307. processIfConditions(element, currentParent);
  58308. } else {
  58309. if (element.slotScope) {
  58310. // scoped slot
  58311. // keep it in the children list so that v-else(-if) conditions can
  58312. // find it as the prev node.
  58313. var name = element.slotTarget || '"default"'
  58314. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  58315. }
  58316. currentParent.children.push(element);
  58317. element.parent = currentParent;
  58318. }
  58319. }
  58320. // final children cleanup
  58321. // filter out scoped slots
  58322. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  58323. // remove trailing whitespace node again
  58324. trimEndingWhitespace(element);
  58325. // check pre state
  58326. if (element.pre) {
  58327. inVPre = false;
  58328. }
  58329. if (platformIsPreTag(element.tag)) {
  58330. inPre = false;
  58331. }
  58332. // apply post-transforms
  58333. for (var i = 0; i < postTransforms.length; i++) {
  58334. postTransforms[i](element, options);
  58335. }
  58336. }
  58337. function trimEndingWhitespace (el) {
  58338. // remove trailing whitespace node
  58339. if (!inPre) {
  58340. var lastNode;
  58341. while (
  58342. (lastNode = el.children[el.children.length - 1]) &&
  58343. lastNode.type === 3 &&
  58344. lastNode.text === ' '
  58345. ) {
  58346. el.children.pop();
  58347. }
  58348. }
  58349. }
  58350. function checkRootConstraints (el) {
  58351. if (el.tag === 'slot' || el.tag === 'template') {
  58352. warnOnce(
  58353. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  58354. 'contain multiple nodes.',
  58355. { start: el.start }
  58356. );
  58357. }
  58358. if (el.attrsMap.hasOwnProperty('v-for')) {
  58359. warnOnce(
  58360. 'Cannot use v-for on stateful component root element because ' +
  58361. 'it renders multiple elements.',
  58362. el.rawAttrsMap['v-for']
  58363. );
  58364. }
  58365. }
  58366. parseHTML(template, {
  58367. warn: warn$2,
  58368. expectHTML: options.expectHTML,
  58369. isUnaryTag: options.isUnaryTag,
  58370. canBeLeftOpenTag: options.canBeLeftOpenTag,
  58371. shouldDecodeNewlines: options.shouldDecodeNewlines,
  58372. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  58373. shouldKeepComment: options.comments,
  58374. outputSourceRange: options.outputSourceRange,
  58375. start: function start (tag, attrs, unary, start$1, end) {
  58376. // check namespace.
  58377. // inherit parent ns if there is one
  58378. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  58379. // handle IE svg bug
  58380. /* istanbul ignore if */
  58381. if (isIE && ns === 'svg') {
  58382. attrs = guardIESVGBug(attrs);
  58383. }
  58384. var element = createASTElement(tag, attrs, currentParent);
  58385. if (ns) {
  58386. element.ns = ns;
  58387. }
  58388. {
  58389. if (options.outputSourceRange) {
  58390. element.start = start$1;
  58391. element.end = end;
  58392. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  58393. cumulated[attr.name] = attr;
  58394. return cumulated
  58395. }, {});
  58396. }
  58397. attrs.forEach(function (attr) {
  58398. if (invalidAttributeRE.test(attr.name)) {
  58399. warn$2(
  58400. "Invalid dynamic argument expression: attribute names cannot contain " +
  58401. "spaces, quotes, <, >, / or =.",
  58402. {
  58403. start: attr.start + attr.name.indexOf("["),
  58404. end: attr.start + attr.name.length
  58405. }
  58406. );
  58407. }
  58408. });
  58409. }
  58410. if (isForbiddenTag(element) && !isServerRendering()) {
  58411. element.forbidden = true;
  58412. warn$2(
  58413. 'Templates should only be responsible for mapping the state to the ' +
  58414. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  58415. "<" + tag + ">" + ', as they will not be parsed.',
  58416. { start: element.start }
  58417. );
  58418. }
  58419. // apply pre-transforms
  58420. for (var i = 0; i < preTransforms.length; i++) {
  58421. element = preTransforms[i](element, options) || element;
  58422. }
  58423. if (!inVPre) {
  58424. processPre(element);
  58425. if (element.pre) {
  58426. inVPre = true;
  58427. }
  58428. }
  58429. if (platformIsPreTag(element.tag)) {
  58430. inPre = true;
  58431. }
  58432. if (inVPre) {
  58433. processRawAttrs(element);
  58434. } else if (!element.processed) {
  58435. // structural directives
  58436. processFor(element);
  58437. processIf(element);
  58438. processOnce(element);
  58439. }
  58440. if (!root) {
  58441. root = element;
  58442. {
  58443. checkRootConstraints(root);
  58444. }
  58445. }
  58446. if (!unary) {
  58447. currentParent = element;
  58448. stack.push(element);
  58449. } else {
  58450. closeElement(element);
  58451. }
  58452. },
  58453. end: function end (tag, start, end$1) {
  58454. var element = stack[stack.length - 1];
  58455. // pop stack
  58456. stack.length -= 1;
  58457. currentParent = stack[stack.length - 1];
  58458. if (options.outputSourceRange) {
  58459. element.end = end$1;
  58460. }
  58461. closeElement(element);
  58462. },
  58463. chars: function chars (text, start, end) {
  58464. if (!currentParent) {
  58465. {
  58466. if (text === template) {
  58467. warnOnce(
  58468. 'Component template requires a root element, rather than just text.',
  58469. { start: start }
  58470. );
  58471. } else if ((text = text.trim())) {
  58472. warnOnce(
  58473. ("text \"" + text + "\" outside root element will be ignored."),
  58474. { start: start }
  58475. );
  58476. }
  58477. }
  58478. return
  58479. }
  58480. // IE textarea placeholder bug
  58481. /* istanbul ignore if */
  58482. if (isIE &&
  58483. currentParent.tag === 'textarea' &&
  58484. currentParent.attrsMap.placeholder === text
  58485. ) {
  58486. return
  58487. }
  58488. var children = currentParent.children;
  58489. if (inPre || text.trim()) {
  58490. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  58491. } else if (!children.length) {
  58492. // remove the whitespace-only node right after an opening tag
  58493. text = '';
  58494. } else if (whitespaceOption) {
  58495. if (whitespaceOption === 'condense') {
  58496. // in condense mode, remove the whitespace node if it contains
  58497. // line break, otherwise condense to a single space
  58498. text = lineBreakRE.test(text) ? '' : ' ';
  58499. } else {
  58500. text = ' ';
  58501. }
  58502. } else {
  58503. text = preserveWhitespace ? ' ' : '';
  58504. }
  58505. if (text) {
  58506. if (!inPre && whitespaceOption === 'condense') {
  58507. // condense consecutive whitespaces into single space
  58508. text = text.replace(whitespaceRE$1, ' ');
  58509. }
  58510. var res;
  58511. var child;
  58512. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  58513. child = {
  58514. type: 2,
  58515. expression: res.expression,
  58516. tokens: res.tokens,
  58517. text: text
  58518. };
  58519. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  58520. child = {
  58521. type: 3,
  58522. text: text
  58523. };
  58524. }
  58525. if (child) {
  58526. if (options.outputSourceRange) {
  58527. child.start = start;
  58528. child.end = end;
  58529. }
  58530. children.push(child);
  58531. }
  58532. }
  58533. },
  58534. comment: function comment (text, start, end) {
  58535. // adding anyting as a sibling to the root node is forbidden
  58536. // comments should still be allowed, but ignored
  58537. if (currentParent) {
  58538. var child = {
  58539. type: 3,
  58540. text: text,
  58541. isComment: true
  58542. };
  58543. if (options.outputSourceRange) {
  58544. child.start = start;
  58545. child.end = end;
  58546. }
  58547. currentParent.children.push(child);
  58548. }
  58549. }
  58550. });
  58551. return root
  58552. }
  58553. function processPre (el) {
  58554. if (getAndRemoveAttr(el, 'v-pre') != null) {
  58555. el.pre = true;
  58556. }
  58557. }
  58558. function processRawAttrs (el) {
  58559. var list = el.attrsList;
  58560. var len = list.length;
  58561. if (len) {
  58562. var attrs = el.attrs = new Array(len);
  58563. for (var i = 0; i < len; i++) {
  58564. attrs[i] = {
  58565. name: list[i].name,
  58566. value: JSON.stringify(list[i].value)
  58567. };
  58568. if (list[i].start != null) {
  58569. attrs[i].start = list[i].start;
  58570. attrs[i].end = list[i].end;
  58571. }
  58572. }
  58573. } else if (!el.pre) {
  58574. // non root node in pre blocks with no attributes
  58575. el.plain = true;
  58576. }
  58577. }
  58578. function processElement (
  58579. element,
  58580. options
  58581. ) {
  58582. processKey(element);
  58583. // determine whether this is a plain element after
  58584. // removing structural attributes
  58585. element.plain = (
  58586. !element.key &&
  58587. !element.scopedSlots &&
  58588. !element.attrsList.length
  58589. );
  58590. processRef(element);
  58591. processSlotContent(element);
  58592. processSlotOutlet(element);
  58593. processComponent(element);
  58594. for (var i = 0; i < transforms.length; i++) {
  58595. element = transforms[i](element, options) || element;
  58596. }
  58597. processAttrs(element);
  58598. return element
  58599. }
  58600. function processKey (el) {
  58601. var exp = getBindingAttr(el, 'key');
  58602. if (exp) {
  58603. {
  58604. if (el.tag === 'template') {
  58605. warn$2(
  58606. "<template> cannot be keyed. Place the key on real elements instead.",
  58607. getRawBindingAttr(el, 'key')
  58608. );
  58609. }
  58610. if (el.for) {
  58611. var iterator = el.iterator2 || el.iterator1;
  58612. var parent = el.parent;
  58613. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  58614. warn$2(
  58615. "Do not use v-for index as key on <transition-group> children, " +
  58616. "this is the same as not using keys.",
  58617. getRawBindingAttr(el, 'key'),
  58618. true /* tip */
  58619. );
  58620. }
  58621. }
  58622. }
  58623. el.key = exp;
  58624. }
  58625. }
  58626. function processRef (el) {
  58627. var ref = getBindingAttr(el, 'ref');
  58628. if (ref) {
  58629. el.ref = ref;
  58630. el.refInFor = checkInFor(el);
  58631. }
  58632. }
  58633. function processFor (el) {
  58634. var exp;
  58635. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  58636. var res = parseFor(exp);
  58637. if (res) {
  58638. extend(el, res);
  58639. } else {
  58640. warn$2(
  58641. ("Invalid v-for expression: " + exp),
  58642. el.rawAttrsMap['v-for']
  58643. );
  58644. }
  58645. }
  58646. }
  58647. function parseFor (exp) {
  58648. var inMatch = exp.match(forAliasRE);
  58649. if (!inMatch) { return }
  58650. var res = {};
  58651. res.for = inMatch[2].trim();
  58652. var alias = inMatch[1].trim().replace(stripParensRE, '');
  58653. var iteratorMatch = alias.match(forIteratorRE);
  58654. if (iteratorMatch) {
  58655. res.alias = alias.replace(forIteratorRE, '').trim();
  58656. res.iterator1 = iteratorMatch[1].trim();
  58657. if (iteratorMatch[2]) {
  58658. res.iterator2 = iteratorMatch[2].trim();
  58659. }
  58660. } else {
  58661. res.alias = alias;
  58662. }
  58663. return res
  58664. }
  58665. function processIf (el) {
  58666. var exp = getAndRemoveAttr(el, 'v-if');
  58667. if (exp) {
  58668. el.if = exp;
  58669. addIfCondition(el, {
  58670. exp: exp,
  58671. block: el
  58672. });
  58673. } else {
  58674. if (getAndRemoveAttr(el, 'v-else') != null) {
  58675. el.else = true;
  58676. }
  58677. var elseif = getAndRemoveAttr(el, 'v-else-if');
  58678. if (elseif) {
  58679. el.elseif = elseif;
  58680. }
  58681. }
  58682. }
  58683. function processIfConditions (el, parent) {
  58684. var prev = findPrevElement(parent.children);
  58685. if (prev && prev.if) {
  58686. addIfCondition(prev, {
  58687. exp: el.elseif,
  58688. block: el
  58689. });
  58690. } else {
  58691. warn$2(
  58692. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  58693. "used on element <" + (el.tag) + "> without corresponding v-if.",
  58694. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  58695. );
  58696. }
  58697. }
  58698. function findPrevElement (children) {
  58699. var i = children.length;
  58700. while (i--) {
  58701. if (children[i].type === 1) {
  58702. return children[i]
  58703. } else {
  58704. if (children[i].text !== ' ') {
  58705. warn$2(
  58706. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  58707. "will be ignored.",
  58708. children[i]
  58709. );
  58710. }
  58711. children.pop();
  58712. }
  58713. }
  58714. }
  58715. function addIfCondition (el, condition) {
  58716. if (!el.ifConditions) {
  58717. el.ifConditions = [];
  58718. }
  58719. el.ifConditions.push(condition);
  58720. }
  58721. function processOnce (el) {
  58722. var once$$1 = getAndRemoveAttr(el, 'v-once');
  58723. if (once$$1 != null) {
  58724. el.once = true;
  58725. }
  58726. }
  58727. // handle content being passed to a component as slot,
  58728. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  58729. function processSlotContent (el) {
  58730. var slotScope;
  58731. if (el.tag === 'template') {
  58732. slotScope = getAndRemoveAttr(el, 'scope');
  58733. /* istanbul ignore if */
  58734. if (slotScope) {
  58735. warn$2(
  58736. "the \"scope\" attribute for scoped slots have been deprecated and " +
  58737. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  58738. "can also be used on plain elements in addition to <template> to " +
  58739. "denote scoped slots.",
  58740. el.rawAttrsMap['scope'],
  58741. true
  58742. );
  58743. }
  58744. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  58745. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  58746. /* istanbul ignore if */
  58747. if (el.attrsMap['v-for']) {
  58748. warn$2(
  58749. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  58750. "(v-for takes higher priority). Use a wrapper <template> for the " +
  58751. "scoped slot to make it clearer.",
  58752. el.rawAttrsMap['slot-scope'],
  58753. true
  58754. );
  58755. }
  58756. el.slotScope = slotScope;
  58757. }
  58758. // slot="xxx"
  58759. var slotTarget = getBindingAttr(el, 'slot');
  58760. if (slotTarget) {
  58761. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  58762. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  58763. // preserve slot as an attribute for native shadow DOM compat
  58764. // only for non-scoped slots.
  58765. if (el.tag !== 'template' && !el.slotScope) {
  58766. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  58767. }
  58768. }
  58769. // 2.6 v-slot syntax
  58770. {
  58771. if (el.tag === 'template') {
  58772. // v-slot on <template>
  58773. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  58774. if (slotBinding) {
  58775. {
  58776. if (el.slotTarget || el.slotScope) {
  58777. warn$2(
  58778. "Unexpected mixed usage of different slot syntaxes.",
  58779. el
  58780. );
  58781. }
  58782. if (el.parent && !maybeComponent(el.parent)) {
  58783. warn$2(
  58784. "<template v-slot> can only appear at the root level inside " +
  58785. "the receiving component",
  58786. el
  58787. );
  58788. }
  58789. }
  58790. var ref = getSlotName(slotBinding);
  58791. var name = ref.name;
  58792. var dynamic = ref.dynamic;
  58793. el.slotTarget = name;
  58794. el.slotTargetDynamic = dynamic;
  58795. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  58796. }
  58797. } else {
  58798. // v-slot on component, denotes default slot
  58799. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  58800. if (slotBinding$1) {
  58801. {
  58802. if (!maybeComponent(el)) {
  58803. warn$2(
  58804. "v-slot can only be used on components or <template>.",
  58805. slotBinding$1
  58806. );
  58807. }
  58808. if (el.slotScope || el.slotTarget) {
  58809. warn$2(
  58810. "Unexpected mixed usage of different slot syntaxes.",
  58811. el
  58812. );
  58813. }
  58814. if (el.scopedSlots) {
  58815. warn$2(
  58816. "To avoid scope ambiguity, the default slot should also use " +
  58817. "<template> syntax when there are other named slots.",
  58818. slotBinding$1
  58819. );
  58820. }
  58821. }
  58822. // add the component's children to its default slot
  58823. var slots = el.scopedSlots || (el.scopedSlots = {});
  58824. var ref$1 = getSlotName(slotBinding$1);
  58825. var name$1 = ref$1.name;
  58826. var dynamic$1 = ref$1.dynamic;
  58827. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  58828. slotContainer.slotTarget = name$1;
  58829. slotContainer.slotTargetDynamic = dynamic$1;
  58830. slotContainer.children = el.children.filter(function (c) {
  58831. if (!c.slotScope) {
  58832. c.parent = slotContainer;
  58833. return true
  58834. }
  58835. });
  58836. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  58837. // remove children as they are returned from scopedSlots now
  58838. el.children = [];
  58839. // mark el non-plain so data gets generated
  58840. el.plain = false;
  58841. }
  58842. }
  58843. }
  58844. }
  58845. function getSlotName (binding) {
  58846. var name = binding.name.replace(slotRE, '');
  58847. if (!name) {
  58848. if (binding.name[0] !== '#') {
  58849. name = 'default';
  58850. } else {
  58851. warn$2(
  58852. "v-slot shorthand syntax requires a slot name.",
  58853. binding
  58854. );
  58855. }
  58856. }
  58857. return dynamicArgRE.test(name)
  58858. // dynamic [name]
  58859. ? { name: name.slice(1, -1), dynamic: true }
  58860. // static name
  58861. : { name: ("\"" + name + "\""), dynamic: false }
  58862. }
  58863. // handle <slot/> outlets
  58864. function processSlotOutlet (el) {
  58865. if (el.tag === 'slot') {
  58866. el.slotName = getBindingAttr(el, 'name');
  58867. if (el.key) {
  58868. warn$2(
  58869. "`key` does not work on <slot> because slots are abstract outlets " +
  58870. "and can possibly expand into multiple elements. " +
  58871. "Use the key on a wrapping element instead.",
  58872. getRawBindingAttr(el, 'key')
  58873. );
  58874. }
  58875. }
  58876. }
  58877. function processComponent (el) {
  58878. var binding;
  58879. if ((binding = getBindingAttr(el, 'is'))) {
  58880. el.component = binding;
  58881. }
  58882. if (getAndRemoveAttr(el, 'inline-template') != null) {
  58883. el.inlineTemplate = true;
  58884. }
  58885. }
  58886. function processAttrs (el) {
  58887. var list = el.attrsList;
  58888. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  58889. for (i = 0, l = list.length; i < l; i++) {
  58890. name = rawName = list[i].name;
  58891. value = list[i].value;
  58892. if (dirRE.test(name)) {
  58893. // mark element as dynamic
  58894. el.hasBindings = true;
  58895. // modifiers
  58896. modifiers = parseModifiers(name.replace(dirRE, ''));
  58897. // support .foo shorthand syntax for the .prop modifier
  58898. if (modifiers) {
  58899. name = name.replace(modifierRE, '');
  58900. }
  58901. if (bindRE.test(name)) { // v-bind
  58902. name = name.replace(bindRE, '');
  58903. value = parseFilters(value);
  58904. isDynamic = dynamicArgRE.test(name);
  58905. if (isDynamic) {
  58906. name = name.slice(1, -1);
  58907. }
  58908. if (
  58909. value.trim().length === 0
  58910. ) {
  58911. warn$2(
  58912. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  58913. );
  58914. }
  58915. if (modifiers) {
  58916. if (modifiers.prop && !isDynamic) {
  58917. name = camelize(name);
  58918. if (name === 'innerHtml') { name = 'innerHTML'; }
  58919. }
  58920. if (modifiers.camel && !isDynamic) {
  58921. name = camelize(name);
  58922. }
  58923. if (modifiers.sync) {
  58924. syncGen = genAssignmentCode(value, "$event");
  58925. if (!isDynamic) {
  58926. addHandler(
  58927. el,
  58928. ("update:" + (camelize(name))),
  58929. syncGen,
  58930. null,
  58931. false,
  58932. warn$2,
  58933. list[i]
  58934. );
  58935. if (hyphenate(name) !== camelize(name)) {
  58936. addHandler(
  58937. el,
  58938. ("update:" + (hyphenate(name))),
  58939. syncGen,
  58940. null,
  58941. false,
  58942. warn$2,
  58943. list[i]
  58944. );
  58945. }
  58946. } else {
  58947. // handler w/ dynamic event name
  58948. addHandler(
  58949. el,
  58950. ("\"update:\"+(" + name + ")"),
  58951. syncGen,
  58952. null,
  58953. false,
  58954. warn$2,
  58955. list[i],
  58956. true // dynamic
  58957. );
  58958. }
  58959. }
  58960. }
  58961. if ((modifiers && modifiers.prop) || (
  58962. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  58963. )) {
  58964. addProp(el, name, value, list[i], isDynamic);
  58965. } else {
  58966. addAttr(el, name, value, list[i], isDynamic);
  58967. }
  58968. } else if (onRE.test(name)) { // v-on
  58969. name = name.replace(onRE, '');
  58970. isDynamic = dynamicArgRE.test(name);
  58971. if (isDynamic) {
  58972. name = name.slice(1, -1);
  58973. }
  58974. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  58975. } else { // normal directives
  58976. name = name.replace(dirRE, '');
  58977. // parse arg
  58978. var argMatch = name.match(argRE);
  58979. var arg = argMatch && argMatch[1];
  58980. isDynamic = false;
  58981. if (arg) {
  58982. name = name.slice(0, -(arg.length + 1));
  58983. if (dynamicArgRE.test(arg)) {
  58984. arg = arg.slice(1, -1);
  58985. isDynamic = true;
  58986. }
  58987. }
  58988. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  58989. if (name === 'model') {
  58990. checkForAliasModel(el, value);
  58991. }
  58992. }
  58993. } else {
  58994. // literal attribute
  58995. {
  58996. var res = parseText(value, delimiters);
  58997. if (res) {
  58998. warn$2(
  58999. name + "=\"" + value + "\": " +
  59000. 'Interpolation inside attributes has been removed. ' +
  59001. 'Use v-bind or the colon shorthand instead. For example, ' +
  59002. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  59003. list[i]
  59004. );
  59005. }
  59006. }
  59007. addAttr(el, name, JSON.stringify(value), list[i]);
  59008. // #6887 firefox doesn't update muted state if set via attribute
  59009. // even immediately after element creation
  59010. if (!el.component &&
  59011. name === 'muted' &&
  59012. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  59013. addProp(el, name, 'true', list[i]);
  59014. }
  59015. }
  59016. }
  59017. }
  59018. function checkInFor (el) {
  59019. var parent = el;
  59020. while (parent) {
  59021. if (parent.for !== undefined) {
  59022. return true
  59023. }
  59024. parent = parent.parent;
  59025. }
  59026. return false
  59027. }
  59028. function parseModifiers (name) {
  59029. var match = name.match(modifierRE);
  59030. if (match) {
  59031. var ret = {};
  59032. match.forEach(function (m) { ret[m.slice(1)] = true; });
  59033. return ret
  59034. }
  59035. }
  59036. function makeAttrsMap (attrs) {
  59037. var map = {};
  59038. for (var i = 0, l = attrs.length; i < l; i++) {
  59039. if (
  59040. map[attrs[i].name] && !isIE && !isEdge
  59041. ) {
  59042. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  59043. }
  59044. map[attrs[i].name] = attrs[i].value;
  59045. }
  59046. return map
  59047. }
  59048. // for script (e.g. type="x/template") or style, do not decode content
  59049. function isTextTag (el) {
  59050. return el.tag === 'script' || el.tag === 'style'
  59051. }
  59052. function isForbiddenTag (el) {
  59053. return (
  59054. el.tag === 'style' ||
  59055. (el.tag === 'script' && (
  59056. !el.attrsMap.type ||
  59057. el.attrsMap.type === 'text/javascript'
  59058. ))
  59059. )
  59060. }
  59061. var ieNSBug = /^xmlns:NS\d+/;
  59062. var ieNSPrefix = /^NS\d+:/;
  59063. /* istanbul ignore next */
  59064. function guardIESVGBug (attrs) {
  59065. var res = [];
  59066. for (var i = 0; i < attrs.length; i++) {
  59067. var attr = attrs[i];
  59068. if (!ieNSBug.test(attr.name)) {
  59069. attr.name = attr.name.replace(ieNSPrefix, '');
  59070. res.push(attr);
  59071. }
  59072. }
  59073. return res
  59074. }
  59075. function checkForAliasModel (el, value) {
  59076. var _el = el;
  59077. while (_el) {
  59078. if (_el.for && _el.alias === value) {
  59079. warn$2(
  59080. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  59081. "You are binding v-model directly to a v-for iteration alias. " +
  59082. "This will not be able to modify the v-for source array because " +
  59083. "writing to the alias is like modifying a function local variable. " +
  59084. "Consider using an array of objects and use v-model on an object property instead.",
  59085. el.rawAttrsMap['v-model']
  59086. );
  59087. }
  59088. _el = _el.parent;
  59089. }
  59090. }
  59091. /* */
  59092. function preTransformNode (el, options) {
  59093. if (el.tag === 'input') {
  59094. var map = el.attrsMap;
  59095. if (!map['v-model']) {
  59096. return
  59097. }
  59098. var typeBinding;
  59099. if (map[':type'] || map['v-bind:type']) {
  59100. typeBinding = getBindingAttr(el, 'type');
  59101. }
  59102. if (!map.type && !typeBinding && map['v-bind']) {
  59103. typeBinding = "(" + (map['v-bind']) + ").type";
  59104. }
  59105. if (typeBinding) {
  59106. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  59107. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  59108. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  59109. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  59110. // 1. checkbox
  59111. var branch0 = cloneASTElement(el);
  59112. // process for on the main node
  59113. processFor(branch0);
  59114. addRawAttr(branch0, 'type', 'checkbox');
  59115. processElement(branch0, options);
  59116. branch0.processed = true; // prevent it from double-processed
  59117. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  59118. addIfCondition(branch0, {
  59119. exp: branch0.if,
  59120. block: branch0
  59121. });
  59122. // 2. add radio else-if condition
  59123. var branch1 = cloneASTElement(el);
  59124. getAndRemoveAttr(branch1, 'v-for', true);
  59125. addRawAttr(branch1, 'type', 'radio');
  59126. processElement(branch1, options);
  59127. addIfCondition(branch0, {
  59128. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  59129. block: branch1
  59130. });
  59131. // 3. other
  59132. var branch2 = cloneASTElement(el);
  59133. getAndRemoveAttr(branch2, 'v-for', true);
  59134. addRawAttr(branch2, ':type', typeBinding);
  59135. processElement(branch2, options);
  59136. addIfCondition(branch0, {
  59137. exp: ifCondition,
  59138. block: branch2
  59139. });
  59140. if (hasElse) {
  59141. branch0.else = true;
  59142. } else if (elseIfCondition) {
  59143. branch0.elseif = elseIfCondition;
  59144. }
  59145. return branch0
  59146. }
  59147. }
  59148. }
  59149. function cloneASTElement (el) {
  59150. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  59151. }
  59152. var model$1 = {
  59153. preTransformNode: preTransformNode
  59154. };
  59155. var modules$1 = [
  59156. klass$1,
  59157. style$1,
  59158. model$1
  59159. ];
  59160. /* */
  59161. function text (el, dir) {
  59162. if (dir.value) {
  59163. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  59164. }
  59165. }
  59166. /* */
  59167. function html (el, dir) {
  59168. if (dir.value) {
  59169. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  59170. }
  59171. }
  59172. var directives$1 = {
  59173. model: model,
  59174. text: text,
  59175. html: html
  59176. };
  59177. /* */
  59178. var baseOptions = {
  59179. expectHTML: true,
  59180. modules: modules$1,
  59181. directives: directives$1,
  59182. isPreTag: isPreTag,
  59183. isUnaryTag: isUnaryTag,
  59184. mustUseProp: mustUseProp,
  59185. canBeLeftOpenTag: canBeLeftOpenTag,
  59186. isReservedTag: isReservedTag,
  59187. getTagNamespace: getTagNamespace,
  59188. staticKeys: genStaticKeys(modules$1)
  59189. };
  59190. /* */
  59191. var isStaticKey;
  59192. var isPlatformReservedTag;
  59193. var genStaticKeysCached = cached(genStaticKeys$1);
  59194. /**
  59195. * Goal of the optimizer: walk the generated template AST tree
  59196. * and detect sub-trees that are purely static, i.e. parts of
  59197. * the DOM that never needs to change.
  59198. *
  59199. * Once we detect these sub-trees, we can:
  59200. *
  59201. * 1. Hoist them into constants, so that we no longer need to
  59202. * create fresh nodes for them on each re-render;
  59203. * 2. Completely skip them in the patching process.
  59204. */
  59205. function optimize (root, options) {
  59206. if (!root) { return }
  59207. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  59208. isPlatformReservedTag = options.isReservedTag || no;
  59209. // first pass: mark all non-static nodes.
  59210. markStatic$1(root);
  59211. // second pass: mark static roots.
  59212. markStaticRoots(root, false);
  59213. }
  59214. function genStaticKeys$1 (keys) {
  59215. return makeMap(
  59216. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  59217. (keys ? ',' + keys : '')
  59218. )
  59219. }
  59220. function markStatic$1 (node) {
  59221. node.static = isStatic(node);
  59222. if (node.type === 1) {
  59223. // do not make component slot content static. this avoids
  59224. // 1. components not able to mutate slot nodes
  59225. // 2. static slot content fails for hot-reloading
  59226. if (
  59227. !isPlatformReservedTag(node.tag) &&
  59228. node.tag !== 'slot' &&
  59229. node.attrsMap['inline-template'] == null
  59230. ) {
  59231. return
  59232. }
  59233. for (var i = 0, l = node.children.length; i < l; i++) {
  59234. var child = node.children[i];
  59235. markStatic$1(child);
  59236. if (!child.static) {
  59237. node.static = false;
  59238. }
  59239. }
  59240. if (node.ifConditions) {
  59241. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  59242. var block = node.ifConditions[i$1].block;
  59243. markStatic$1(block);
  59244. if (!block.static) {
  59245. node.static = false;
  59246. }
  59247. }
  59248. }
  59249. }
  59250. }
  59251. function markStaticRoots (node, isInFor) {
  59252. if (node.type === 1) {
  59253. if (node.static || node.once) {
  59254. node.staticInFor = isInFor;
  59255. }
  59256. // For a node to qualify as a static root, it should have children that
  59257. // are not just static text. Otherwise the cost of hoisting out will
  59258. // outweigh the benefits and it's better off to just always render it fresh.
  59259. if (node.static && node.children.length && !(
  59260. node.children.length === 1 &&
  59261. node.children[0].type === 3
  59262. )) {
  59263. node.staticRoot = true;
  59264. return
  59265. } else {
  59266. node.staticRoot = false;
  59267. }
  59268. if (node.children) {
  59269. for (var i = 0, l = node.children.length; i < l; i++) {
  59270. markStaticRoots(node.children[i], isInFor || !!node.for);
  59271. }
  59272. }
  59273. if (node.ifConditions) {
  59274. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  59275. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  59276. }
  59277. }
  59278. }
  59279. }
  59280. function isStatic (node) {
  59281. if (node.type === 2) { // expression
  59282. return false
  59283. }
  59284. if (node.type === 3) { // text
  59285. return true
  59286. }
  59287. return !!(node.pre || (
  59288. !node.hasBindings && // no dynamic bindings
  59289. !node.if && !node.for && // not v-if or v-for or v-else
  59290. !isBuiltInTag(node.tag) && // not a built-in
  59291. isPlatformReservedTag(node.tag) && // not a component
  59292. !isDirectChildOfTemplateFor(node) &&
  59293. Object.keys(node).every(isStaticKey)
  59294. ))
  59295. }
  59296. function isDirectChildOfTemplateFor (node) {
  59297. while (node.parent) {
  59298. node = node.parent;
  59299. if (node.tag !== 'template') {
  59300. return false
  59301. }
  59302. if (node.for) {
  59303. return true
  59304. }
  59305. }
  59306. return false
  59307. }
  59308. /* */
  59309. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  59310. var fnInvokeRE = /\([^)]*?\);*$/;
  59311. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  59312. // KeyboardEvent.keyCode aliases
  59313. var keyCodes = {
  59314. esc: 27,
  59315. tab: 9,
  59316. enter: 13,
  59317. space: 32,
  59318. up: 38,
  59319. left: 37,
  59320. right: 39,
  59321. down: 40,
  59322. 'delete': [8, 46]
  59323. };
  59324. // KeyboardEvent.key aliases
  59325. var keyNames = {
  59326. // #7880: IE11 and Edge use `Esc` for Escape key name.
  59327. esc: ['Esc', 'Escape'],
  59328. tab: 'Tab',
  59329. enter: 'Enter',
  59330. // #9112: IE11 uses `Spacebar` for Space key name.
  59331. space: [' ', 'Spacebar'],
  59332. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  59333. up: ['Up', 'ArrowUp'],
  59334. left: ['Left', 'ArrowLeft'],
  59335. right: ['Right', 'ArrowRight'],
  59336. down: ['Down', 'ArrowDown'],
  59337. // #9112: IE11 uses `Del` for Delete key name.
  59338. 'delete': ['Backspace', 'Delete', 'Del']
  59339. };
  59340. // #4868: modifiers that prevent the execution of the listener
  59341. // need to explicitly return null so that we can determine whether to remove
  59342. // the listener for .once
  59343. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  59344. var modifierCode = {
  59345. stop: '$event.stopPropagation();',
  59346. prevent: '$event.preventDefault();',
  59347. self: genGuard("$event.target !== $event.currentTarget"),
  59348. ctrl: genGuard("!$event.ctrlKey"),
  59349. shift: genGuard("!$event.shiftKey"),
  59350. alt: genGuard("!$event.altKey"),
  59351. meta: genGuard("!$event.metaKey"),
  59352. left: genGuard("'button' in $event && $event.button !== 0"),
  59353. middle: genGuard("'button' in $event && $event.button !== 1"),
  59354. right: genGuard("'button' in $event && $event.button !== 2")
  59355. };
  59356. function genHandlers (
  59357. events,
  59358. isNative
  59359. ) {
  59360. var prefix = isNative ? 'nativeOn:' : 'on:';
  59361. var staticHandlers = "";
  59362. var dynamicHandlers = "";
  59363. for (var name in events) {
  59364. var handlerCode = genHandler(events[name]);
  59365. if (events[name] && events[name].dynamic) {
  59366. dynamicHandlers += name + "," + handlerCode + ",";
  59367. } else {
  59368. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  59369. }
  59370. }
  59371. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  59372. if (dynamicHandlers) {
  59373. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  59374. } else {
  59375. return prefix + staticHandlers
  59376. }
  59377. }
  59378. function genHandler (handler) {
  59379. if (!handler) {
  59380. return 'function(){}'
  59381. }
  59382. if (Array.isArray(handler)) {
  59383. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  59384. }
  59385. var isMethodPath = simplePathRE.test(handler.value);
  59386. var isFunctionExpression = fnExpRE.test(handler.value);
  59387. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  59388. if (!handler.modifiers) {
  59389. if (isMethodPath || isFunctionExpression) {
  59390. return handler.value
  59391. }
  59392. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  59393. } else {
  59394. var code = '';
  59395. var genModifierCode = '';
  59396. var keys = [];
  59397. for (var key in handler.modifiers) {
  59398. if (modifierCode[key]) {
  59399. genModifierCode += modifierCode[key];
  59400. // left/right
  59401. if (keyCodes[key]) {
  59402. keys.push(key);
  59403. }
  59404. } else if (key === 'exact') {
  59405. var modifiers = (handler.modifiers);
  59406. genModifierCode += genGuard(
  59407. ['ctrl', 'shift', 'alt', 'meta']
  59408. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  59409. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  59410. .join('||')
  59411. );
  59412. } else {
  59413. keys.push(key);
  59414. }
  59415. }
  59416. if (keys.length) {
  59417. code += genKeyFilter(keys);
  59418. }
  59419. // Make sure modifiers like prevent and stop get executed after key filtering
  59420. if (genModifierCode) {
  59421. code += genModifierCode;
  59422. }
  59423. var handlerCode = isMethodPath
  59424. ? ("return " + (handler.value) + "($event)")
  59425. : isFunctionExpression
  59426. ? ("return (" + (handler.value) + ")($event)")
  59427. : isFunctionInvocation
  59428. ? ("return " + (handler.value))
  59429. : handler.value;
  59430. return ("function($event){" + code + handlerCode + "}")
  59431. }
  59432. }
  59433. function genKeyFilter (keys) {
  59434. return (
  59435. // make sure the key filters only apply to KeyboardEvents
  59436. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  59437. // key events that do not have keyCode property...
  59438. "if(!$event.type.indexOf('key')&&" +
  59439. (keys.map(genFilterCode).join('&&')) + ")return null;"
  59440. )
  59441. }
  59442. function genFilterCode (key) {
  59443. var keyVal = parseInt(key, 10);
  59444. if (keyVal) {
  59445. return ("$event.keyCode!==" + keyVal)
  59446. }
  59447. var keyCode = keyCodes[key];
  59448. var keyName = keyNames[key];
  59449. return (
  59450. "_k($event.keyCode," +
  59451. (JSON.stringify(key)) + "," +
  59452. (JSON.stringify(keyCode)) + "," +
  59453. "$event.key," +
  59454. "" + (JSON.stringify(keyName)) +
  59455. ")"
  59456. )
  59457. }
  59458. /* */
  59459. function on (el, dir) {
  59460. if (dir.modifiers) {
  59461. warn("v-on without argument does not support modifiers.");
  59462. }
  59463. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  59464. }
  59465. /* */
  59466. function bind$1 (el, dir) {
  59467. el.wrapData = function (code) {
  59468. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  59469. };
  59470. }
  59471. /* */
  59472. var baseDirectives = {
  59473. on: on,
  59474. bind: bind$1,
  59475. cloak: noop
  59476. };
  59477. /* */
  59478. var CodegenState = function CodegenState (options) {
  59479. this.options = options;
  59480. this.warn = options.warn || baseWarn;
  59481. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  59482. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  59483. this.directives = extend(extend({}, baseDirectives), options.directives);
  59484. var isReservedTag = options.isReservedTag || no;
  59485. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  59486. this.onceId = 0;
  59487. this.staticRenderFns = [];
  59488. this.pre = false;
  59489. };
  59490. function generate (
  59491. ast,
  59492. options
  59493. ) {
  59494. var state = new CodegenState(options);
  59495. var code = ast ? genElement(ast, state) : '_c("div")';
  59496. return {
  59497. render: ("with(this){return " + code + "}"),
  59498. staticRenderFns: state.staticRenderFns
  59499. }
  59500. }
  59501. function genElement (el, state) {
  59502. if (el.parent) {
  59503. el.pre = el.pre || el.parent.pre;
  59504. }
  59505. if (el.staticRoot && !el.staticProcessed) {
  59506. return genStatic(el, state)
  59507. } else if (el.once && !el.onceProcessed) {
  59508. return genOnce(el, state)
  59509. } else if (el.for && !el.forProcessed) {
  59510. return genFor(el, state)
  59511. } else if (el.if && !el.ifProcessed) {
  59512. return genIf(el, state)
  59513. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  59514. return genChildren(el, state) || 'void 0'
  59515. } else if (el.tag === 'slot') {
  59516. return genSlot(el, state)
  59517. } else {
  59518. // component or element
  59519. var code;
  59520. if (el.component) {
  59521. code = genComponent(el.component, el, state);
  59522. } else {
  59523. var data;
  59524. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  59525. data = genData$2(el, state);
  59526. }
  59527. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  59528. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  59529. }
  59530. // module transforms
  59531. for (var i = 0; i < state.transforms.length; i++) {
  59532. code = state.transforms[i](el, code);
  59533. }
  59534. return code
  59535. }
  59536. }
  59537. // hoist static sub-trees out
  59538. function genStatic (el, state) {
  59539. el.staticProcessed = true;
  59540. // Some elements (templates) need to behave differently inside of a v-pre
  59541. // node. All pre nodes are static roots, so we can use this as a location to
  59542. // wrap a state change and reset it upon exiting the pre node.
  59543. var originalPreState = state.pre;
  59544. if (el.pre) {
  59545. state.pre = el.pre;
  59546. }
  59547. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  59548. state.pre = originalPreState;
  59549. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  59550. }
  59551. // v-once
  59552. function genOnce (el, state) {
  59553. el.onceProcessed = true;
  59554. if (el.if && !el.ifProcessed) {
  59555. return genIf(el, state)
  59556. } else if (el.staticInFor) {
  59557. var key = '';
  59558. var parent = el.parent;
  59559. while (parent) {
  59560. if (parent.for) {
  59561. key = parent.key;
  59562. break
  59563. }
  59564. parent = parent.parent;
  59565. }
  59566. if (!key) {
  59567. state.warn(
  59568. "v-once can only be used inside v-for that is keyed. ",
  59569. el.rawAttrsMap['v-once']
  59570. );
  59571. return genElement(el, state)
  59572. }
  59573. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  59574. } else {
  59575. return genStatic(el, state)
  59576. }
  59577. }
  59578. function genIf (
  59579. el,
  59580. state,
  59581. altGen,
  59582. altEmpty
  59583. ) {
  59584. el.ifProcessed = true; // avoid recursion
  59585. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  59586. }
  59587. function genIfConditions (
  59588. conditions,
  59589. state,
  59590. altGen,
  59591. altEmpty
  59592. ) {
  59593. if (!conditions.length) {
  59594. return altEmpty || '_e()'
  59595. }
  59596. var condition = conditions.shift();
  59597. if (condition.exp) {
  59598. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  59599. } else {
  59600. return ("" + (genTernaryExp(condition.block)))
  59601. }
  59602. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  59603. function genTernaryExp (el) {
  59604. return altGen
  59605. ? altGen(el, state)
  59606. : el.once
  59607. ? genOnce(el, state)
  59608. : genElement(el, state)
  59609. }
  59610. }
  59611. function genFor (
  59612. el,
  59613. state,
  59614. altGen,
  59615. altHelper
  59616. ) {
  59617. var exp = el.for;
  59618. var alias = el.alias;
  59619. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  59620. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  59621. if (state.maybeComponent(el) &&
  59622. el.tag !== 'slot' &&
  59623. el.tag !== 'template' &&
  59624. !el.key
  59625. ) {
  59626. state.warn(
  59627. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  59628. "v-for should have explicit keys. " +
  59629. "See https://vuejs.org/guide/list.html#key for more info.",
  59630. el.rawAttrsMap['v-for'],
  59631. true /* tip */
  59632. );
  59633. }
  59634. el.forProcessed = true; // avoid recursion
  59635. return (altHelper || '_l') + "((" + exp + ")," +
  59636. "function(" + alias + iterator1 + iterator2 + "){" +
  59637. "return " + ((altGen || genElement)(el, state)) +
  59638. '})'
  59639. }
  59640. function genData$2 (el, state) {
  59641. var data = '{';
  59642. // directives first.
  59643. // directives may mutate the el's other properties before they are generated.
  59644. var dirs = genDirectives(el, state);
  59645. if (dirs) { data += dirs + ','; }
  59646. // key
  59647. if (el.key) {
  59648. data += "key:" + (el.key) + ",";
  59649. }
  59650. // ref
  59651. if (el.ref) {
  59652. data += "ref:" + (el.ref) + ",";
  59653. }
  59654. if (el.refInFor) {
  59655. data += "refInFor:true,";
  59656. }
  59657. // pre
  59658. if (el.pre) {
  59659. data += "pre:true,";
  59660. }
  59661. // record original tag name for components using "is" attribute
  59662. if (el.component) {
  59663. data += "tag:\"" + (el.tag) + "\",";
  59664. }
  59665. // module data generation functions
  59666. for (var i = 0; i < state.dataGenFns.length; i++) {
  59667. data += state.dataGenFns[i](el);
  59668. }
  59669. // attributes
  59670. if (el.attrs) {
  59671. data += "attrs:" + (genProps(el.attrs)) + ",";
  59672. }
  59673. // DOM props
  59674. if (el.props) {
  59675. data += "domProps:" + (genProps(el.props)) + ",";
  59676. }
  59677. // event handlers
  59678. if (el.events) {
  59679. data += (genHandlers(el.events, false)) + ",";
  59680. }
  59681. if (el.nativeEvents) {
  59682. data += (genHandlers(el.nativeEvents, true)) + ",";
  59683. }
  59684. // slot target
  59685. // only for non-scoped slots
  59686. if (el.slotTarget && !el.slotScope) {
  59687. data += "slot:" + (el.slotTarget) + ",";
  59688. }
  59689. // scoped slots
  59690. if (el.scopedSlots) {
  59691. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  59692. }
  59693. // component v-model
  59694. if (el.model) {
  59695. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  59696. }
  59697. // inline-template
  59698. if (el.inlineTemplate) {
  59699. var inlineTemplate = genInlineTemplate(el, state);
  59700. if (inlineTemplate) {
  59701. data += inlineTemplate + ",";
  59702. }
  59703. }
  59704. data = data.replace(/,$/, '') + '}';
  59705. // v-bind dynamic argument wrap
  59706. // v-bind with dynamic arguments must be applied using the same v-bind object
  59707. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  59708. if (el.dynamicAttrs) {
  59709. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  59710. }
  59711. // v-bind data wrap
  59712. if (el.wrapData) {
  59713. data = el.wrapData(data);
  59714. }
  59715. // v-on data wrap
  59716. if (el.wrapListeners) {
  59717. data = el.wrapListeners(data);
  59718. }
  59719. return data
  59720. }
  59721. function genDirectives (el, state) {
  59722. var dirs = el.directives;
  59723. if (!dirs) { return }
  59724. var res = 'directives:[';
  59725. var hasRuntime = false;
  59726. var i, l, dir, needRuntime;
  59727. for (i = 0, l = dirs.length; i < l; i++) {
  59728. dir = dirs[i];
  59729. needRuntime = true;
  59730. var gen = state.directives[dir.name];
  59731. if (gen) {
  59732. // compile-time directive that manipulates AST.
  59733. // returns true if it also needs a runtime counterpart.
  59734. needRuntime = !!gen(el, dir, state.warn);
  59735. }
  59736. if (needRuntime) {
  59737. hasRuntime = true;
  59738. 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))) : '') + "},";
  59739. }
  59740. }
  59741. if (hasRuntime) {
  59742. return res.slice(0, -1) + ']'
  59743. }
  59744. }
  59745. function genInlineTemplate (el, state) {
  59746. var ast = el.children[0];
  59747. if (el.children.length !== 1 || ast.type !== 1) {
  59748. state.warn(
  59749. 'Inline-template components must have exactly one child element.',
  59750. { start: el.start }
  59751. );
  59752. }
  59753. if (ast && ast.type === 1) {
  59754. var inlineRenderFns = generate(ast, state.options);
  59755. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  59756. }
  59757. }
  59758. function genScopedSlots (
  59759. el,
  59760. slots,
  59761. state
  59762. ) {
  59763. // by default scoped slots are considered "stable", this allows child
  59764. // components with only scoped slots to skip forced updates from parent.
  59765. // but in some cases we have to bail-out of this optimization
  59766. // for example if the slot contains dynamic names, has v-if or v-for on them...
  59767. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  59768. var slot = slots[key];
  59769. return (
  59770. slot.slotTargetDynamic ||
  59771. slot.if ||
  59772. slot.for ||
  59773. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  59774. )
  59775. });
  59776. // #9534: if a component with scoped slots is inside a conditional branch,
  59777. // it's possible for the same component to be reused but with different
  59778. // compiled slot content. To avoid that, we generate a unique key based on
  59779. // the generated code of all the slot contents.
  59780. var needsKey = !!el.if;
  59781. // OR when it is inside another scoped slot or v-for (the reactivity may be
  59782. // disconnected due to the intermediate scope variable)
  59783. // #9438, #9506
  59784. // TODO: this can be further optimized by properly analyzing in-scope bindings
  59785. // and skip force updating ones that do not actually use scope variables.
  59786. if (!needsForceUpdate) {
  59787. var parent = el.parent;
  59788. while (parent) {
  59789. if (
  59790. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  59791. parent.for
  59792. ) {
  59793. needsForceUpdate = true;
  59794. break
  59795. }
  59796. if (parent.if) {
  59797. needsKey = true;
  59798. }
  59799. parent = parent.parent;
  59800. }
  59801. }
  59802. var generatedSlots = Object.keys(slots)
  59803. .map(function (key) { return genScopedSlot(slots[key], state); })
  59804. .join(',');
  59805. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  59806. }
  59807. function hash(str) {
  59808. var hash = 5381;
  59809. var i = str.length;
  59810. while(i) {
  59811. hash = (hash * 33) ^ str.charCodeAt(--i);
  59812. }
  59813. return hash >>> 0
  59814. }
  59815. function containsSlotChild (el) {
  59816. if (el.type === 1) {
  59817. if (el.tag === 'slot') {
  59818. return true
  59819. }
  59820. return el.children.some(containsSlotChild)
  59821. }
  59822. return false
  59823. }
  59824. function genScopedSlot (
  59825. el,
  59826. state
  59827. ) {
  59828. var isLegacySyntax = el.attrsMap['slot-scope'];
  59829. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  59830. return genIf(el, state, genScopedSlot, "null")
  59831. }
  59832. if (el.for && !el.forProcessed) {
  59833. return genFor(el, state, genScopedSlot)
  59834. }
  59835. var slotScope = el.slotScope === emptySlotScopeToken
  59836. ? ""
  59837. : String(el.slotScope);
  59838. var fn = "function(" + slotScope + "){" +
  59839. "return " + (el.tag === 'template'
  59840. ? el.if && isLegacySyntax
  59841. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  59842. : genChildren(el, state) || 'undefined'
  59843. : genElement(el, state)) + "}";
  59844. // reverse proxy v-slot without scope on this.$slots
  59845. var reverseProxy = slotScope ? "" : ",proxy:true";
  59846. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  59847. }
  59848. function genChildren (
  59849. el,
  59850. state,
  59851. checkSkip,
  59852. altGenElement,
  59853. altGenNode
  59854. ) {
  59855. var children = el.children;
  59856. if (children.length) {
  59857. var el$1 = children[0];
  59858. // optimize single v-for
  59859. if (children.length === 1 &&
  59860. el$1.for &&
  59861. el$1.tag !== 'template' &&
  59862. el$1.tag !== 'slot'
  59863. ) {
  59864. var normalizationType = checkSkip
  59865. ? state.maybeComponent(el$1) ? ",1" : ",0"
  59866. : "";
  59867. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  59868. }
  59869. var normalizationType$1 = checkSkip
  59870. ? getNormalizationType(children, state.maybeComponent)
  59871. : 0;
  59872. var gen = altGenNode || genNode;
  59873. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  59874. }
  59875. }
  59876. // determine the normalization needed for the children array.
  59877. // 0: no normalization needed
  59878. // 1: simple normalization needed (possible 1-level deep nested array)
  59879. // 2: full normalization needed
  59880. function getNormalizationType (
  59881. children,
  59882. maybeComponent
  59883. ) {
  59884. var res = 0;
  59885. for (var i = 0; i < children.length; i++) {
  59886. var el = children[i];
  59887. if (el.type !== 1) {
  59888. continue
  59889. }
  59890. if (needsNormalization(el) ||
  59891. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  59892. res = 2;
  59893. break
  59894. }
  59895. if (maybeComponent(el) ||
  59896. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  59897. res = 1;
  59898. }
  59899. }
  59900. return res
  59901. }
  59902. function needsNormalization (el) {
  59903. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  59904. }
  59905. function genNode (node, state) {
  59906. if (node.type === 1) {
  59907. return genElement(node, state)
  59908. } else if (node.type === 3 && node.isComment) {
  59909. return genComment(node)
  59910. } else {
  59911. return genText(node)
  59912. }
  59913. }
  59914. function genText (text) {
  59915. return ("_v(" + (text.type === 2
  59916. ? text.expression // no need for () because already wrapped in _s()
  59917. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  59918. }
  59919. function genComment (comment) {
  59920. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  59921. }
  59922. function genSlot (el, state) {
  59923. var slotName = el.slotName || '"default"';
  59924. var children = genChildren(el, state);
  59925. var res = "_t(" + slotName + (children ? ("," + children) : '');
  59926. var attrs = el.attrs || el.dynamicAttrs
  59927. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  59928. // slot props are camelized
  59929. name: camelize(attr.name),
  59930. value: attr.value,
  59931. dynamic: attr.dynamic
  59932. }); }))
  59933. : null;
  59934. var bind$$1 = el.attrsMap['v-bind'];
  59935. if ((attrs || bind$$1) && !children) {
  59936. res += ",null";
  59937. }
  59938. if (attrs) {
  59939. res += "," + attrs;
  59940. }
  59941. if (bind$$1) {
  59942. res += (attrs ? '' : ',null') + "," + bind$$1;
  59943. }
  59944. return res + ')'
  59945. }
  59946. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  59947. function genComponent (
  59948. componentName,
  59949. el,
  59950. state
  59951. ) {
  59952. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  59953. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  59954. }
  59955. function genProps (props) {
  59956. var staticProps = "";
  59957. var dynamicProps = "";
  59958. for (var i = 0; i < props.length; i++) {
  59959. var prop = props[i];
  59960. var value = transformSpecialNewlines(prop.value);
  59961. if (prop.dynamic) {
  59962. dynamicProps += (prop.name) + "," + value + ",";
  59963. } else {
  59964. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  59965. }
  59966. }
  59967. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  59968. if (dynamicProps) {
  59969. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  59970. } else {
  59971. return staticProps
  59972. }
  59973. }
  59974. // #3895, #4268
  59975. function transformSpecialNewlines (text) {
  59976. return text
  59977. .replace(/\u2028/g, '\\u2028')
  59978. .replace(/\u2029/g, '\\u2029')
  59979. }
  59980. /* */
  59981. // these keywords should not appear inside expressions, but operators like
  59982. // typeof, instanceof and in are allowed
  59983. var prohibitedKeywordRE = new RegExp('\\b' + (
  59984. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  59985. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  59986. 'extends,finally,continue,debugger,function,arguments'
  59987. ).split(',').join('\\b|\\b') + '\\b');
  59988. // these unary operators should not be used as property/method names
  59989. var unaryOperatorsRE = new RegExp('\\b' + (
  59990. 'delete,typeof,void'
  59991. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  59992. // strip strings in expressions
  59993. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  59994. // detect problematic expressions in a template
  59995. function detectErrors (ast, warn) {
  59996. if (ast) {
  59997. checkNode(ast, warn);
  59998. }
  59999. }
  60000. function checkNode (node, warn) {
  60001. if (node.type === 1) {
  60002. for (var name in node.attrsMap) {
  60003. if (dirRE.test(name)) {
  60004. var value = node.attrsMap[name];
  60005. if (value) {
  60006. var range = node.rawAttrsMap[name];
  60007. if (name === 'v-for') {
  60008. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  60009. } else if (name === 'v-slot' || name[0] === '#') {
  60010. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  60011. } else if (onRE.test(name)) {
  60012. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  60013. } else {
  60014. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  60015. }
  60016. }
  60017. }
  60018. }
  60019. if (node.children) {
  60020. for (var i = 0; i < node.children.length; i++) {
  60021. checkNode(node.children[i], warn);
  60022. }
  60023. }
  60024. } else if (node.type === 2) {
  60025. checkExpression(node.expression, node.text, warn, node);
  60026. }
  60027. }
  60028. function checkEvent (exp, text, warn, range) {
  60029. var stripped = exp.replace(stripStringRE, '');
  60030. var keywordMatch = stripped.match(unaryOperatorsRE);
  60031. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  60032. warn(
  60033. "avoid using JavaScript unary operator as property name: " +
  60034. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  60035. range
  60036. );
  60037. }
  60038. checkExpression(exp, text, warn, range);
  60039. }
  60040. function checkFor (node, text, warn, range) {
  60041. checkExpression(node.for || '', text, warn, range);
  60042. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  60043. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  60044. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  60045. }
  60046. function checkIdentifier (
  60047. ident,
  60048. type,
  60049. text,
  60050. warn,
  60051. range
  60052. ) {
  60053. if (typeof ident === 'string') {
  60054. try {
  60055. new Function(("var " + ident + "=_"));
  60056. } catch (e) {
  60057. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  60058. }
  60059. }
  60060. }
  60061. function checkExpression (exp, text, warn, range) {
  60062. try {
  60063. new Function(("return " + exp));
  60064. } catch (e) {
  60065. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  60066. if (keywordMatch) {
  60067. warn(
  60068. "avoid using JavaScript keyword as property name: " +
  60069. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  60070. range
  60071. );
  60072. } else {
  60073. warn(
  60074. "invalid expression: " + (e.message) + " in\n\n" +
  60075. " " + exp + "\n\n" +
  60076. " Raw expression: " + (text.trim()) + "\n",
  60077. range
  60078. );
  60079. }
  60080. }
  60081. }
  60082. function checkFunctionParameterExpression (exp, text, warn, range) {
  60083. try {
  60084. new Function(exp, '');
  60085. } catch (e) {
  60086. warn(
  60087. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  60088. " " + exp + "\n\n" +
  60089. " Raw expression: " + (text.trim()) + "\n",
  60090. range
  60091. );
  60092. }
  60093. }
  60094. /* */
  60095. var range = 2;
  60096. function generateCodeFrame (
  60097. source,
  60098. start,
  60099. end
  60100. ) {
  60101. if ( start === void 0 ) start = 0;
  60102. if ( end === void 0 ) end = source.length;
  60103. var lines = source.split(/\r?\n/);
  60104. var count = 0;
  60105. var res = [];
  60106. for (var i = 0; i < lines.length; i++) {
  60107. count += lines[i].length + 1;
  60108. if (count >= start) {
  60109. for (var j = i - range; j <= i + range || end > count; j++) {
  60110. if (j < 0 || j >= lines.length) { continue }
  60111. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  60112. var lineLength = lines[j].length;
  60113. if (j === i) {
  60114. // push underline
  60115. var pad = start - (count - lineLength) + 1;
  60116. var length = end > count ? lineLength - pad : end - start;
  60117. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  60118. } else if (j > i) {
  60119. if (end > count) {
  60120. var length$1 = Math.min(end - count, lineLength);
  60121. res.push(" | " + repeat$1("^", length$1));
  60122. }
  60123. count += lineLength + 1;
  60124. }
  60125. }
  60126. break
  60127. }
  60128. }
  60129. return res.join('\n')
  60130. }
  60131. function repeat$1 (str, n) {
  60132. var result = '';
  60133. if (n > 0) {
  60134. while (true) { // eslint-disable-line
  60135. if (n & 1) { result += str; }
  60136. n >>>= 1;
  60137. if (n <= 0) { break }
  60138. str += str;
  60139. }
  60140. }
  60141. return result
  60142. }
  60143. /* */
  60144. function createFunction (code, errors) {
  60145. try {
  60146. return new Function(code)
  60147. } catch (err) {
  60148. errors.push({ err: err, code: code });
  60149. return noop
  60150. }
  60151. }
  60152. function createCompileToFunctionFn (compile) {
  60153. var cache = Object.create(null);
  60154. return function compileToFunctions (
  60155. template,
  60156. options,
  60157. vm
  60158. ) {
  60159. options = extend({}, options);
  60160. var warn$$1 = options.warn || warn;
  60161. delete options.warn;
  60162. /* istanbul ignore if */
  60163. {
  60164. // detect possible CSP restriction
  60165. try {
  60166. new Function('return 1');
  60167. } catch (e) {
  60168. if (e.toString().match(/unsafe-eval|CSP/)) {
  60169. warn$$1(
  60170. 'It seems you are using the standalone build of Vue.js in an ' +
  60171. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  60172. 'The template compiler cannot work in this environment. Consider ' +
  60173. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  60174. 'templates into render functions.'
  60175. );
  60176. }
  60177. }
  60178. }
  60179. // check cache
  60180. var key = options.delimiters
  60181. ? String(options.delimiters) + template
  60182. : template;
  60183. if (cache[key]) {
  60184. return cache[key]
  60185. }
  60186. // compile
  60187. var compiled = compile(template, options);
  60188. // check compilation errors/tips
  60189. {
  60190. if (compiled.errors && compiled.errors.length) {
  60191. if (options.outputSourceRange) {
  60192. compiled.errors.forEach(function (e) {
  60193. warn$$1(
  60194. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  60195. generateCodeFrame(template, e.start, e.end),
  60196. vm
  60197. );
  60198. });
  60199. } else {
  60200. warn$$1(
  60201. "Error compiling template:\n\n" + template + "\n\n" +
  60202. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  60203. vm
  60204. );
  60205. }
  60206. }
  60207. if (compiled.tips && compiled.tips.length) {
  60208. if (options.outputSourceRange) {
  60209. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  60210. } else {
  60211. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  60212. }
  60213. }
  60214. }
  60215. // turn code into functions
  60216. var res = {};
  60217. var fnGenErrors = [];
  60218. res.render = createFunction(compiled.render, fnGenErrors);
  60219. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  60220. return createFunction(code, fnGenErrors)
  60221. });
  60222. // check function generation errors.
  60223. // this should only happen if there is a bug in the compiler itself.
  60224. // mostly for codegen development use
  60225. /* istanbul ignore if */
  60226. {
  60227. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  60228. warn$$1(
  60229. "Failed to generate render function:\n\n" +
  60230. fnGenErrors.map(function (ref) {
  60231. var err = ref.err;
  60232. var code = ref.code;
  60233. return ((err.toString()) + " in\n\n" + code + "\n");
  60234. }).join('\n'),
  60235. vm
  60236. );
  60237. }
  60238. }
  60239. return (cache[key] = res)
  60240. }
  60241. }
  60242. /* */
  60243. function createCompilerCreator (baseCompile) {
  60244. return function createCompiler (baseOptions) {
  60245. function compile (
  60246. template,
  60247. options
  60248. ) {
  60249. var finalOptions = Object.create(baseOptions);
  60250. var errors = [];
  60251. var tips = [];
  60252. var warn = function (msg, range, tip) {
  60253. (tip ? tips : errors).push(msg);
  60254. };
  60255. if (options) {
  60256. if (options.outputSourceRange) {
  60257. // $flow-disable-line
  60258. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  60259. warn = function (msg, range, tip) {
  60260. var data = { msg: msg };
  60261. if (range) {
  60262. if (range.start != null) {
  60263. data.start = range.start + leadingSpaceLength;
  60264. }
  60265. if (range.end != null) {
  60266. data.end = range.end + leadingSpaceLength;
  60267. }
  60268. }
  60269. (tip ? tips : errors).push(data);
  60270. };
  60271. }
  60272. // merge custom modules
  60273. if (options.modules) {
  60274. finalOptions.modules =
  60275. (baseOptions.modules || []).concat(options.modules);
  60276. }
  60277. // merge custom directives
  60278. if (options.directives) {
  60279. finalOptions.directives = extend(
  60280. Object.create(baseOptions.directives || null),
  60281. options.directives
  60282. );
  60283. }
  60284. // copy other options
  60285. for (var key in options) {
  60286. if (key !== 'modules' && key !== 'directives') {
  60287. finalOptions[key] = options[key];
  60288. }
  60289. }
  60290. }
  60291. finalOptions.warn = warn;
  60292. var compiled = baseCompile(template.trim(), finalOptions);
  60293. {
  60294. detectErrors(compiled.ast, warn);
  60295. }
  60296. compiled.errors = errors;
  60297. compiled.tips = tips;
  60298. return compiled
  60299. }
  60300. return {
  60301. compile: compile,
  60302. compileToFunctions: createCompileToFunctionFn(compile)
  60303. }
  60304. }
  60305. }
  60306. /* */
  60307. // `createCompilerCreator` allows creating compilers that use alternative
  60308. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  60309. // Here we just export a default compiler using the default parts.
  60310. var createCompiler = createCompilerCreator(function baseCompile (
  60311. template,
  60312. options
  60313. ) {
  60314. var ast = parse(template.trim(), options);
  60315. if (options.optimize !== false) {
  60316. optimize(ast, options);
  60317. }
  60318. var code = generate(ast, options);
  60319. return {
  60320. ast: ast,
  60321. render: code.render,
  60322. staticRenderFns: code.staticRenderFns
  60323. }
  60324. });
  60325. /* */
  60326. var ref$1 = createCompiler(baseOptions);
  60327. var compile = ref$1.compile;
  60328. var compileToFunctions = ref$1.compileToFunctions;
  60329. /* */
  60330. // check whether current browser encodes a char inside attribute values
  60331. var div;
  60332. function getShouldDecode (href) {
  60333. div = div || document.createElement('div');
  60334. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  60335. return div.innerHTML.indexOf('&#10;') > 0
  60336. }
  60337. // #3663: IE encodes newlines inside attribute values while other browsers don't
  60338. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  60339. // #6828: chrome encodes content in a[href]
  60340. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  60341. /* */
  60342. var idToTemplate = cached(function (id) {
  60343. var el = query(id);
  60344. return el && el.innerHTML
  60345. });
  60346. var mount = Vue.prototype.$mount;
  60347. Vue.prototype.$mount = function (
  60348. el,
  60349. hydrating
  60350. ) {
  60351. el = el && query(el);
  60352. /* istanbul ignore if */
  60353. if (el === document.body || el === document.documentElement) {
  60354. warn(
  60355. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  60356. );
  60357. return this
  60358. }
  60359. var options = this.$options;
  60360. // resolve template/el and convert to render function
  60361. if (!options.render) {
  60362. var template = options.template;
  60363. if (template) {
  60364. if (typeof template === 'string') {
  60365. if (template.charAt(0) === '#') {
  60366. template = idToTemplate(template);
  60367. /* istanbul ignore if */
  60368. if (!template) {
  60369. warn(
  60370. ("Template element not found or is empty: " + (options.template)),
  60371. this
  60372. );
  60373. }
  60374. }
  60375. } else if (template.nodeType) {
  60376. template = template.innerHTML;
  60377. } else {
  60378. {
  60379. warn('invalid template option:' + template, this);
  60380. }
  60381. return this
  60382. }
  60383. } else if (el) {
  60384. template = getOuterHTML(el);
  60385. }
  60386. if (template) {
  60387. /* istanbul ignore if */
  60388. if (config.performance && mark) {
  60389. mark('compile');
  60390. }
  60391. var ref = compileToFunctions(template, {
  60392. outputSourceRange: "development" !== 'production',
  60393. shouldDecodeNewlines: shouldDecodeNewlines,
  60394. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  60395. delimiters: options.delimiters,
  60396. comments: options.comments
  60397. }, this);
  60398. var render = ref.render;
  60399. var staticRenderFns = ref.staticRenderFns;
  60400. options.render = render;
  60401. options.staticRenderFns = staticRenderFns;
  60402. /* istanbul ignore if */
  60403. if (config.performance && mark) {
  60404. mark('compile end');
  60405. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  60406. }
  60407. }
  60408. }
  60409. return mount.call(this, el, hydrating)
  60410. };
  60411. /**
  60412. * Get outerHTML of elements, taking care
  60413. * of SVG elements in IE as well.
  60414. */
  60415. function getOuterHTML (el) {
  60416. if (el.outerHTML) {
  60417. return el.outerHTML
  60418. } else {
  60419. var container = document.createElement('div');
  60420. container.appendChild(el.cloneNode(true));
  60421. return container.innerHTML
  60422. }
  60423. }
  60424. Vue.compile = compileToFunctions;
  60425. module.exports = Vue;
  60426. /* 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))
  60427. /***/ }),
  60428. /***/ "./node_modules/vue/dist/vue.common.js":
  60429. /*!*********************************************!*\
  60430. !*** ./node_modules/vue/dist/vue.common.js ***!
  60431. \*********************************************/
  60432. /*! no static exports found */
  60433. /***/ (function(module, exports, __webpack_require__) {
  60434. if (false) {} else {
  60435. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  60436. }
  60437. /***/ }),
  60438. /***/ "./node_modules/webpack/buildin/global.js":
  60439. /*!***********************************!*\
  60440. !*** (webpack)/buildin/global.js ***!
  60441. \***********************************/
  60442. /*! no static exports found */
  60443. /***/ (function(module, exports) {
  60444. var g;
  60445. // This works in non-strict mode
  60446. g = (function() {
  60447. return this;
  60448. })();
  60449. try {
  60450. // This works if eval is allowed (see CSP)
  60451. g = g || new Function("return this")();
  60452. } catch (e) {
  60453. // This works if the window reference is available
  60454. if (typeof window === "object") g = window;
  60455. }
  60456. // g can still be undefined, but nothing to do about it...
  60457. // We return undefined, instead of nothing here, so it's
  60458. // easier to handle this case. if(!global) { ...}
  60459. module.exports = g;
  60460. /***/ }),
  60461. /***/ "./node_modules/webpack/buildin/module.js":
  60462. /*!***********************************!*\
  60463. !*** (webpack)/buildin/module.js ***!
  60464. \***********************************/
  60465. /*! no static exports found */
  60466. /***/ (function(module, exports) {
  60467. module.exports = function(module) {
  60468. if (!module.webpackPolyfill) {
  60469. module.deprecate = function() {};
  60470. module.paths = [];
  60471. // module.parent = undefined by default
  60472. if (!module.children) module.children = [];
  60473. Object.defineProperty(module, "loaded", {
  60474. enumerable: true,
  60475. get: function() {
  60476. return module.l;
  60477. }
  60478. });
  60479. Object.defineProperty(module, "id", {
  60480. enumerable: true,
  60481. get: function() {
  60482. return module.i;
  60483. }
  60484. });
  60485. module.webpackPolyfill = 1;
  60486. }
  60487. return module;
  60488. };
  60489. /***/ }),
  60490. /***/ "./resources/js/app.js":
  60491. /*!*****************************!*\
  60492. !*** ./resources/js/app.js ***!
  60493. \*****************************/
  60494. /*! no exports provided */
  60495. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60496. "use strict";
  60497. __webpack_require__.r(__webpack_exports__);
  60498. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  60499. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
  60500. /* harmony import */ var vue_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-router */ "./node_modules/vue-router/dist/vue-router.esm.js");
  60501. /* harmony import */ var _views_App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./views/App */ "./resources/js/views/App.vue");
  60502. /* harmony import */ var _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./views/Dashboard */ "./resources/js/views/Dashboard.vue");
  60503. /* harmony import */ var _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./views/WorkOrder */ "./resources/js/views/WorkOrder.vue");
  60504. /* harmony import */ var _views_Login__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./views/Login */ "./resources/js/views/Login.vue");
  60505. /* harmony import */ var _views_Welcome__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./views/Welcome */ "./resources/js/views/Welcome.vue");
  60506. /**
  60507. * First we will load all of this project's JavaScript dependencies which
  60508. * includes Vue and other libraries. It is a great starting point when
  60509. * building robust, powerful web applications using Vue and Laravel.
  60510. */
  60511. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  60512. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  60513. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  60514. vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]);
  60515. var router = new vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]({
  60516. mode: 'history',
  60517. routes: [{
  60518. path: '/',
  60519. name: 'home',
  60520. component: _views_Welcome__WEBPACK_IMPORTED_MODULE_6__["default"]
  60521. }, {
  60522. path: '/login',
  60523. name: 'login',
  60524. component: _views_Login__WEBPACK_IMPORTED_MODULE_5__["default"]
  60525. }, {
  60526. path: '/dashboard',
  60527. name: 'dashboard',
  60528. component: _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__["default"]
  60529. }, {
  60530. path: '/workorders/:id',
  60531. name: 'workorders',
  60532. component: _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__["default"],
  60533. props: getIdAsString
  60534. }]
  60535. });
  60536. function getIdAsString(route) {
  60537. return {
  60538. id: route.params.id.toString()
  60539. };
  60540. }
  60541. var app = new vue__WEBPACK_IMPORTED_MODULE_0___default.a({
  60542. el: '#app',
  60543. components: {
  60544. App: _views_App__WEBPACK_IMPORTED_MODULE_2__["default"]
  60545. },
  60546. router: router
  60547. });
  60548. $(function () {
  60549. $('[data-toggle="tooltip"]').tooltip();
  60550. });
  60551. var clipboard = new Clipboard('.btn-clip');
  60552. clipboard.on('success', function (e) {
  60553. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  60554. position: "right",
  60555. className: 'success'
  60556. });
  60557. e.clearSelection();
  60558. });
  60559. /***/ }),
  60560. /***/ "./resources/js/bootstrap.js":
  60561. /*!***********************************!*\
  60562. !*** ./resources/js/bootstrap.js ***!
  60563. \***********************************/
  60564. /*! no exports provided */
  60565. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60566. "use strict";
  60567. __webpack_require__.r(__webpack_exports__);
  60568. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  60569. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  60570. /**
  60571. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  60572. * for JavaScript based Bootstrap features such as modals and tabs. This
  60573. * code may be modified to fit the specific needs of your application.
  60574. */
  60575. try {
  60576. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  60577. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  60578. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  60579. } catch (e) {}
  60580. /**
  60581. * We'll load the axios HTTP library which allows us to easily issue requests
  60582. * to our Laravel back-end. This library automatically handles sending the
  60583. * CSRF token as a header based on the value of the "XSRF" token cookie.
  60584. */
  60585. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  60586. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  60587. /**
  60588. * Echo exposes an expressive API for subscribing to channels and listening
  60589. * for events that are broadcast by Laravel. Echo and event broadcasting
  60590. * allows your team to easily build robust real-time web applications.
  60591. */
  60592. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  60593. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  60594. broadcaster: 'pusher',
  60595. key: "upccrt",
  60596. wsHost: window.location.hostname,
  60597. wsPort: 6001,
  60598. disableStats: true
  60599. });
  60600. /***/ }),
  60601. /***/ "./resources/js/components/AssetInfo.vue":
  60602. /*!***********************************************!*\
  60603. !*** ./resources/js/components/AssetInfo.vue ***!
  60604. \***********************************************/
  60605. /*! exports provided: default */
  60606. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60607. "use strict";
  60608. __webpack_require__.r(__webpack_exports__);
  60609. /* 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&");
  60610. /* 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&");
  60611. /* 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");
  60612. /* normalize component */
  60613. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60614. _AssetInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60615. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["render"],
  60616. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60617. false,
  60618. null,
  60619. null,
  60620. null
  60621. )
  60622. /* hot reload */
  60623. if (false) { var api; }
  60624. component.options.__file = "resources/js/components/AssetInfo.vue"
  60625. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60626. /***/ }),
  60627. /***/ "./resources/js/components/AssetInfo.vue?vue&type=script&lang=js&":
  60628. /*!************************************************************************!*\
  60629. !*** ./resources/js/components/AssetInfo.vue?vue&type=script&lang=js& ***!
  60630. \************************************************************************/
  60631. /*! exports provided: default */
  60632. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60633. "use strict";
  60634. __webpack_require__.r(__webpack_exports__);
  60635. /* 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&");
  60636. /* 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"]);
  60637. /***/ }),
  60638. /***/ "./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&":
  60639. /*!******************************************************************************!*\
  60640. !*** ./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a& ***!
  60641. \******************************************************************************/
  60642. /*! exports provided: render, staticRenderFns */
  60643. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60644. "use strict";
  60645. __webpack_require__.r(__webpack_exports__);
  60646. /* 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&");
  60647. /* 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"]; });
  60648. /* 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"]; });
  60649. /***/ }),
  60650. /***/ "./resources/js/components/AssetInfoEditModal.vue":
  60651. /*!********************************************************!*\
  60652. !*** ./resources/js/components/AssetInfoEditModal.vue ***!
  60653. \********************************************************/
  60654. /*! exports provided: default */
  60655. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60656. "use strict";
  60657. __webpack_require__.r(__webpack_exports__);
  60658. /* 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&");
  60659. /* 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&");
  60660. /* 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");
  60661. /* normalize component */
  60662. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60663. _AssetInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60664. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["render"],
  60665. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60666. false,
  60667. null,
  60668. null,
  60669. null
  60670. )
  60671. /* hot reload */
  60672. if (false) { var api; }
  60673. component.options.__file = "resources/js/components/AssetInfoEditModal.vue"
  60674. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60675. /***/ }),
  60676. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  60677. /*!*********************************************************************************!*\
  60678. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js& ***!
  60679. \*********************************************************************************/
  60680. /*! exports provided: default */
  60681. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60682. "use strict";
  60683. __webpack_require__.r(__webpack_exports__);
  60684. /* 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&");
  60685. /* 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"]);
  60686. /***/ }),
  60687. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&":
  60688. /*!***************************************************************************************!*\
  60689. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& ***!
  60690. \***************************************************************************************/
  60691. /*! exports provided: render, staticRenderFns */
  60692. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60693. "use strict";
  60694. __webpack_require__.r(__webpack_exports__);
  60695. /* 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&");
  60696. /* 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"]; });
  60697. /* 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"]; });
  60698. /***/ }),
  60699. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue":
  60700. /*!****************************************************************!*\
  60701. !*** ./resources/js/components/AutocompleteCustomDropdown.vue ***!
  60702. \****************************************************************/
  60703. /*! exports provided: default */
  60704. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60705. "use strict";
  60706. __webpack_require__.r(__webpack_exports__);
  60707. /* 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&");
  60708. /* 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&");
  60709. /* 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");
  60710. /* normalize component */
  60711. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60712. _AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60713. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["render"],
  60714. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60715. false,
  60716. null,
  60717. null,
  60718. null
  60719. )
  60720. /* hot reload */
  60721. if (false) { var api; }
  60722. component.options.__file = "resources/js/components/AutocompleteCustomDropdown.vue"
  60723. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60724. /***/ }),
  60725. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  60726. /*!*****************************************************************************************!*\
  60727. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js& ***!
  60728. \*****************************************************************************************/
  60729. /*! exports provided: default */
  60730. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60731. "use strict";
  60732. __webpack_require__.r(__webpack_exports__);
  60733. /* 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&");
  60734. /* 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"]);
  60735. /***/ }),
  60736. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&":
  60737. /*!***********************************************************************************************!*\
  60738. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& ***!
  60739. \***********************************************************************************************/
  60740. /*! exports provided: render, staticRenderFns */
  60741. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60742. "use strict";
  60743. __webpack_require__.r(__webpack_exports__);
  60744. /* 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&");
  60745. /* 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"]; });
  60746. /* 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"]; });
  60747. /***/ }),
  60748. /***/ "./resources/js/components/CircleSpinner.vue":
  60749. /*!***************************************************!*\
  60750. !*** ./resources/js/components/CircleSpinner.vue ***!
  60751. \***************************************************/
  60752. /*! exports provided: default */
  60753. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60754. "use strict";
  60755. __webpack_require__.r(__webpack_exports__);
  60756. /* 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&");
  60757. /* 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&");
  60758. /* 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&");
  60759. /* 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");
  60760. /* normalize component */
  60761. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  60762. _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60763. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  60764. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60765. false,
  60766. null,
  60767. "9a543b64",
  60768. null
  60769. )
  60770. /* hot reload */
  60771. if (false) { var api; }
  60772. component.options.__file = "resources/js/components/CircleSpinner.vue"
  60773. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60774. /***/ }),
  60775. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  60776. /*!****************************************************************************!*\
  60777. !*** ./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js& ***!
  60778. \****************************************************************************/
  60779. /*! exports provided: default */
  60780. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60781. "use strict";
  60782. __webpack_require__.r(__webpack_exports__);
  60783. /* 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&");
  60784. /* 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"]);
  60785. /***/ }),
  60786. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  60787. /*!************************************************************************************************************!*\
  60788. !*** ./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  60789. \************************************************************************************************************/
  60790. /*! no static exports found */
  60791. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60792. "use strict";
  60793. __webpack_require__.r(__webpack_exports__);
  60794. /* 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&");
  60795. /* 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__);
  60796. /* 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__));
  60797. /* 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);
  60798. /***/ }),
  60799. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&":
  60800. /*!**********************************************************************************************!*\
  60801. !*** ./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& ***!
  60802. \**********************************************************************************************/
  60803. /*! exports provided: render, staticRenderFns */
  60804. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60805. "use strict";
  60806. __webpack_require__.r(__webpack_exports__);
  60807. /* 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&");
  60808. /* 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"]; });
  60809. /* 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"]; });
  60810. /***/ }),
  60811. /***/ "./resources/js/components/Credential.vue":
  60812. /*!************************************************!*\
  60813. !*** ./resources/js/components/Credential.vue ***!
  60814. \************************************************/
  60815. /*! exports provided: default */
  60816. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60817. "use strict";
  60818. __webpack_require__.r(__webpack_exports__);
  60819. /* 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&");
  60820. /* 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&");
  60821. /* 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");
  60822. /* normalize component */
  60823. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60824. _Credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60825. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["render"],
  60826. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60827. false,
  60828. null,
  60829. null,
  60830. null
  60831. )
  60832. /* hot reload */
  60833. if (false) { var api; }
  60834. component.options.__file = "resources/js/components/Credential.vue"
  60835. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60836. /***/ }),
  60837. /***/ "./resources/js/components/Credential.vue?vue&type=script&lang=js&":
  60838. /*!*************************************************************************!*\
  60839. !*** ./resources/js/components/Credential.vue?vue&type=script&lang=js& ***!
  60840. \*************************************************************************/
  60841. /*! exports provided: default */
  60842. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60843. "use strict";
  60844. __webpack_require__.r(__webpack_exports__);
  60845. /* 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&");
  60846. /* 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"]);
  60847. /***/ }),
  60848. /***/ "./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&":
  60849. /*!*******************************************************************************!*\
  60850. !*** ./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc& ***!
  60851. \*******************************************************************************/
  60852. /*! exports provided: render, staticRenderFns */
  60853. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60854. "use strict";
  60855. __webpack_require__.r(__webpack_exports__);
  60856. /* 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&");
  60857. /* 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"]; });
  60858. /* 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"]; });
  60859. /***/ }),
  60860. /***/ "./resources/js/components/CredentialFormModal.vue":
  60861. /*!*********************************************************!*\
  60862. !*** ./resources/js/components/CredentialFormModal.vue ***!
  60863. \*********************************************************/
  60864. /*! exports provided: default */
  60865. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60866. "use strict";
  60867. __webpack_require__.r(__webpack_exports__);
  60868. /* 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&");
  60869. /* 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&");
  60870. /* 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");
  60871. /* normalize component */
  60872. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60873. _CredentialFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60874. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["render"],
  60875. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60876. false,
  60877. null,
  60878. null,
  60879. null
  60880. )
  60881. /* hot reload */
  60882. if (false) { var api; }
  60883. component.options.__file = "resources/js/components/CredentialFormModal.vue"
  60884. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60885. /***/ }),
  60886. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&":
  60887. /*!**********************************************************************************!*\
  60888. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js& ***!
  60889. \**********************************************************************************/
  60890. /*! exports provided: default */
  60891. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60892. "use strict";
  60893. __webpack_require__.r(__webpack_exports__);
  60894. /* 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&");
  60895. /* 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"]);
  60896. /***/ }),
  60897. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&":
  60898. /*!****************************************************************************************!*\
  60899. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697& ***!
  60900. \****************************************************************************************/
  60901. /*! exports provided: render, staticRenderFns */
  60902. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60903. "use strict";
  60904. __webpack_require__.r(__webpack_exports__);
  60905. /* 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&");
  60906. /* 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"]; });
  60907. /* 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"]; });
  60908. /***/ }),
  60909. /***/ "./resources/js/components/CredentialList.vue":
  60910. /*!****************************************************!*\
  60911. !*** ./resources/js/components/CredentialList.vue ***!
  60912. \****************************************************/
  60913. /*! exports provided: default */
  60914. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60915. "use strict";
  60916. __webpack_require__.r(__webpack_exports__);
  60917. /* 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&");
  60918. /* 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&");
  60919. /* 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");
  60920. /* normalize component */
  60921. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60922. _CredentialList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60923. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["render"],
  60924. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60925. false,
  60926. null,
  60927. null,
  60928. null
  60929. )
  60930. /* hot reload */
  60931. if (false) { var api; }
  60932. component.options.__file = "resources/js/components/CredentialList.vue"
  60933. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60934. /***/ }),
  60935. /***/ "./resources/js/components/CredentialList.vue?vue&type=script&lang=js&":
  60936. /*!*****************************************************************************!*\
  60937. !*** ./resources/js/components/CredentialList.vue?vue&type=script&lang=js& ***!
  60938. \*****************************************************************************/
  60939. /*! exports provided: default */
  60940. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60941. "use strict";
  60942. __webpack_require__.r(__webpack_exports__);
  60943. /* 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&");
  60944. /* 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"]);
  60945. /***/ }),
  60946. /***/ "./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&":
  60947. /*!***********************************************************************************!*\
  60948. !*** ./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80& ***!
  60949. \***********************************************************************************/
  60950. /*! exports provided: render, staticRenderFns */
  60951. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60952. "use strict";
  60953. __webpack_require__.r(__webpack_exports__);
  60954. /* 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&");
  60955. /* 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"]; });
  60956. /* 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"]; });
  60957. /***/ }),
  60958. /***/ "./resources/js/components/ErrorList.vue":
  60959. /*!***********************************************!*\
  60960. !*** ./resources/js/components/ErrorList.vue ***!
  60961. \***********************************************/
  60962. /*! exports provided: default */
  60963. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60964. "use strict";
  60965. __webpack_require__.r(__webpack_exports__);
  60966. /* 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&");
  60967. /* 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&");
  60968. /* 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");
  60969. /* normalize component */
  60970. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60971. _ErrorList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60972. _ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  60973. _ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60974. false,
  60975. null,
  60976. null,
  60977. null
  60978. )
  60979. /* hot reload */
  60980. if (false) { var api; }
  60981. component.options.__file = "resources/js/components/ErrorList.vue"
  60982. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60983. /***/ }),
  60984. /***/ "./resources/js/components/ErrorList.vue?vue&type=script&lang=js&":
  60985. /*!************************************************************************!*\
  60986. !*** ./resources/js/components/ErrorList.vue?vue&type=script&lang=js& ***!
  60987. \************************************************************************/
  60988. /*! exports provided: default */
  60989. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60990. "use strict";
  60991. __webpack_require__.r(__webpack_exports__);
  60992. /* 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&");
  60993. /* 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"]);
  60994. /***/ }),
  60995. /***/ "./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb&":
  60996. /*!******************************************************************************!*\
  60997. !*** ./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb& ***!
  60998. \******************************************************************************/
  60999. /*! exports provided: render, staticRenderFns */
  61000. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61001. "use strict";
  61002. __webpack_require__.r(__webpack_exports__);
  61003. /* 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&");
  61004. /* 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"]; });
  61005. /* 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"]; });
  61006. /***/ }),
  61007. /***/ "./resources/js/components/Modal.vue":
  61008. /*!*******************************************!*\
  61009. !*** ./resources/js/components/Modal.vue ***!
  61010. \*******************************************/
  61011. /*! exports provided: default */
  61012. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61013. "use strict";
  61014. __webpack_require__.r(__webpack_exports__);
  61015. /* 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&");
  61016. /* 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");
  61017. var script = {}
  61018. /* normalize component */
  61019. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  61020. script,
  61021. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["render"],
  61022. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61023. false,
  61024. null,
  61025. null,
  61026. null
  61027. )
  61028. /* hot reload */
  61029. if (false) { var api; }
  61030. component.options.__file = "resources/js/components/Modal.vue"
  61031. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61032. /***/ }),
  61033. /***/ "./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&":
  61034. /*!**************************************************************************!*\
  61035. !*** ./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2& ***!
  61036. \**************************************************************************/
  61037. /*! exports provided: render, staticRenderFns */
  61038. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61039. "use strict";
  61040. __webpack_require__.r(__webpack_exports__);
  61041. /* 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&");
  61042. /* 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"]; });
  61043. /* 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"]; });
  61044. /***/ }),
  61045. /***/ "./resources/js/components/NoteDeleteModal.vue":
  61046. /*!*****************************************************!*\
  61047. !*** ./resources/js/components/NoteDeleteModal.vue ***!
  61048. \*****************************************************/
  61049. /*! exports provided: default */
  61050. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61051. "use strict";
  61052. __webpack_require__.r(__webpack_exports__);
  61053. /* 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&");
  61054. /* 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&");
  61055. /* 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");
  61056. /* normalize component */
  61057. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61058. _NoteDeleteModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61059. _NoteDeleteModal_vue_vue_type_template_id_49f798d5___WEBPACK_IMPORTED_MODULE_0__["render"],
  61060. _NoteDeleteModal_vue_vue_type_template_id_49f798d5___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61061. false,
  61062. null,
  61063. null,
  61064. null
  61065. )
  61066. /* hot reload */
  61067. if (false) { var api; }
  61068. component.options.__file = "resources/js/components/NoteDeleteModal.vue"
  61069. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61070. /***/ }),
  61071. /***/ "./resources/js/components/NoteDeleteModal.vue?vue&type=script&lang=js&":
  61072. /*!******************************************************************************!*\
  61073. !*** ./resources/js/components/NoteDeleteModal.vue?vue&type=script&lang=js& ***!
  61074. \******************************************************************************/
  61075. /*! exports provided: default */
  61076. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61077. "use strict";
  61078. __webpack_require__.r(__webpack_exports__);
  61079. /* 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&");
  61080. /* 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"]);
  61081. /***/ }),
  61082. /***/ "./resources/js/components/NoteDeleteModal.vue?vue&type=template&id=49f798d5&":
  61083. /*!************************************************************************************!*\
  61084. !*** ./resources/js/components/NoteDeleteModal.vue?vue&type=template&id=49f798d5& ***!
  61085. \************************************************************************************/
  61086. /*! exports provided: render, staticRenderFns */
  61087. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61088. "use strict";
  61089. __webpack_require__.r(__webpack_exports__);
  61090. /* 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&");
  61091. /* 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"]; });
  61092. /* 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"]; });
  61093. /***/ }),
  61094. /***/ "./resources/js/components/NoteFormModal.vue":
  61095. /*!***************************************************!*\
  61096. !*** ./resources/js/components/NoteFormModal.vue ***!
  61097. \***************************************************/
  61098. /*! exports provided: default */
  61099. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61100. "use strict";
  61101. __webpack_require__.r(__webpack_exports__);
  61102. /* 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&");
  61103. /* 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&");
  61104. /* 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");
  61105. /* normalize component */
  61106. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61107. _NoteFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61108. _NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["render"],
  61109. _NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61110. false,
  61111. null,
  61112. null,
  61113. null
  61114. )
  61115. /* hot reload */
  61116. if (false) { var api; }
  61117. component.options.__file = "resources/js/components/NoteFormModal.vue"
  61118. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61119. /***/ }),
  61120. /***/ "./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js&":
  61121. /*!****************************************************************************!*\
  61122. !*** ./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js& ***!
  61123. \****************************************************************************/
  61124. /*! exports provided: default */
  61125. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61126. "use strict";
  61127. __webpack_require__.r(__webpack_exports__);
  61128. /* 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&");
  61129. /* 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"]);
  61130. /***/ }),
  61131. /***/ "./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c&":
  61132. /*!**********************************************************************************!*\
  61133. !*** ./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c& ***!
  61134. \**********************************************************************************/
  61135. /*! exports provided: render, staticRenderFns */
  61136. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61137. "use strict";
  61138. __webpack_require__.r(__webpack_exports__);
  61139. /* 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&");
  61140. /* 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"]; });
  61141. /* 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"]; });
  61142. /***/ }),
  61143. /***/ "./resources/js/components/Notes.vue":
  61144. /*!*******************************************!*\
  61145. !*** ./resources/js/components/Notes.vue ***!
  61146. \*******************************************/
  61147. /*! exports provided: default */
  61148. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61149. "use strict";
  61150. __webpack_require__.r(__webpack_exports__);
  61151. /* 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&");
  61152. /* 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&");
  61153. /* 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");
  61154. /* normalize component */
  61155. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61156. _Notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61157. _Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["render"],
  61158. _Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61159. false,
  61160. null,
  61161. null,
  61162. null
  61163. )
  61164. /* hot reload */
  61165. if (false) { var api; }
  61166. component.options.__file = "resources/js/components/Notes.vue"
  61167. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61168. /***/ }),
  61169. /***/ "./resources/js/components/Notes.vue?vue&type=script&lang=js&":
  61170. /*!********************************************************************!*\
  61171. !*** ./resources/js/components/Notes.vue?vue&type=script&lang=js& ***!
  61172. \********************************************************************/
  61173. /*! exports provided: default */
  61174. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61175. "use strict";
  61176. __webpack_require__.r(__webpack_exports__);
  61177. /* 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&");
  61178. /* 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"]);
  61179. /***/ }),
  61180. /***/ "./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6&":
  61181. /*!**************************************************************************!*\
  61182. !*** ./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6& ***!
  61183. \**************************************************************************/
  61184. /*! exports provided: render, staticRenderFns */
  61185. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61186. "use strict";
  61187. __webpack_require__.r(__webpack_exports__);
  61188. /* 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&");
  61189. /* 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"]; });
  61190. /* 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"]; });
  61191. /***/ }),
  61192. /***/ "./resources/js/components/WoInfoEditModal.vue":
  61193. /*!*****************************************************!*\
  61194. !*** ./resources/js/components/WoInfoEditModal.vue ***!
  61195. \*****************************************************/
  61196. /*! exports provided: default */
  61197. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61198. "use strict";
  61199. __webpack_require__.r(__webpack_exports__);
  61200. /* 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&");
  61201. /* 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&");
  61202. /* 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");
  61203. /* normalize component */
  61204. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61205. _WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61206. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["render"],
  61207. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61208. false,
  61209. null,
  61210. null,
  61211. null
  61212. )
  61213. /* hot reload */
  61214. if (false) { var api; }
  61215. component.options.__file = "resources/js/components/WoInfoEditModal.vue"
  61216. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61217. /***/ }),
  61218. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  61219. /*!******************************************************************************!*\
  61220. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js& ***!
  61221. \******************************************************************************/
  61222. /*! exports provided: default */
  61223. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61224. "use strict";
  61225. __webpack_require__.r(__webpack_exports__);
  61226. /* 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&");
  61227. /* 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"]);
  61228. /***/ }),
  61229. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&":
  61230. /*!************************************************************************************!*\
  61231. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2& ***!
  61232. \************************************************************************************/
  61233. /*! exports provided: render, staticRenderFns */
  61234. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61235. "use strict";
  61236. __webpack_require__.r(__webpack_exports__);
  61237. /* 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&");
  61238. /* 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"]; });
  61239. /* 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"]; });
  61240. /***/ }),
  61241. /***/ "./resources/js/components/WorkOrderInfo.vue":
  61242. /*!***************************************************!*\
  61243. !*** ./resources/js/components/WorkOrderInfo.vue ***!
  61244. \***************************************************/
  61245. /*! exports provided: default */
  61246. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61247. "use strict";
  61248. __webpack_require__.r(__webpack_exports__);
  61249. /* 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&");
  61250. /* 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&");
  61251. /* 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");
  61252. /* normalize component */
  61253. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61254. _WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61255. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["render"],
  61256. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61257. false,
  61258. null,
  61259. null,
  61260. null
  61261. )
  61262. /* hot reload */
  61263. if (false) { var api; }
  61264. component.options.__file = "resources/js/components/WorkOrderInfo.vue"
  61265. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61266. /***/ }),
  61267. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  61268. /*!****************************************************************************!*\
  61269. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js& ***!
  61270. \****************************************************************************/
  61271. /*! exports provided: default */
  61272. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61273. "use strict";
  61274. __webpack_require__.r(__webpack_exports__);
  61275. /* 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&");
  61276. /* 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"]);
  61277. /***/ }),
  61278. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&":
  61279. /*!**********************************************************************************!*\
  61280. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330& ***!
  61281. \**********************************************************************************/
  61282. /*! exports provided: render, staticRenderFns */
  61283. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61284. "use strict";
  61285. __webpack_require__.r(__webpack_exports__);
  61286. /* 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&");
  61287. /* 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"]; });
  61288. /* 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"]; });
  61289. /***/ }),
  61290. /***/ "./resources/js/mixins/dateMixin.js":
  61291. /*!******************************************!*\
  61292. !*** ./resources/js/mixins/dateMixin.js ***!
  61293. \******************************************/
  61294. /*! exports provided: default */
  61295. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61296. "use strict";
  61297. __webpack_require__.r(__webpack_exports__);
  61298. /* harmony default export */ __webpack_exports__["default"] = ({
  61299. methods: {
  61300. treatAsUTC: function treatAsUTC(date) {
  61301. var result = new Date(date);
  61302. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  61303. return result;
  61304. },
  61305. daysSinceToday: function daysSinceToday(date) {
  61306. var currentDate = new Date();
  61307. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  61308. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  61309. },
  61310. getHRDate: function getHRDate(dateString) {
  61311. var date = new Date(dateString);
  61312. return date.toLocaleString('default', {
  61313. month: 'short',
  61314. day: 'numeric',
  61315. year: 'numeric',
  61316. hour: 'numeric',
  61317. minute: 'numeric'
  61318. });
  61319. },
  61320. isZero: function isZero(dateString) {
  61321. return dateString === '0000-00-00 00:00:00';
  61322. }
  61323. }
  61324. });
  61325. /***/ }),
  61326. /***/ "./resources/js/notify.min.js":
  61327. /*!************************************!*\
  61328. !*** ./resources/js/notify.min.js ***!
  61329. \************************************/
  61330. /*! no static exports found */
  61331. /***/ (function(module, exports, __webpack_require__) {
  61332. 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); }
  61333. (function (e) {
  61334. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  61335. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  61336. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  61337. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  61338. })(function (e) {
  61339. function A(t, n, i) {
  61340. typeof i == "string" && (i = {
  61341. className: i
  61342. }), 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);
  61343. }
  61344. var t = [].indexOf || function (e) {
  61345. for (var t = 0, n = this.length; t < n; t++) {
  61346. if (t in this && this[t] === e) return t;
  61347. }
  61348. return -1;
  61349. },
  61350. n = "notify",
  61351. r = n + "js",
  61352. i = n + "!blank",
  61353. s = {
  61354. t: "top",
  61355. m: "middle",
  61356. b: "bottom",
  61357. l: "left",
  61358. c: "center",
  61359. r: "right"
  61360. },
  61361. o = ["l", "c", "r"],
  61362. u = ["t", "m", "b"],
  61363. a = ["t", "b", "l", "r"],
  61364. f = {
  61365. t: "b",
  61366. m: null,
  61367. b: "t",
  61368. l: "r",
  61369. c: null,
  61370. r: "l"
  61371. },
  61372. l = function l(t) {
  61373. var n;
  61374. return n = [], e.each(t.split(/\W+/), function (e, t) {
  61375. var r;
  61376. r = t.toLowerCase().charAt(0);
  61377. if (s[r]) return n.push(r);
  61378. }), n;
  61379. },
  61380. c = {},
  61381. h = {
  61382. name: "core",
  61383. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  61384. 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}"
  61385. },
  61386. p = {
  61387. "border-radius": ["-webkit-", "-moz-"]
  61388. },
  61389. d = function d(e) {
  61390. return c[e];
  61391. },
  61392. v = function v(e) {
  61393. if (!e) throw "Missing Style name";
  61394. c[e] && delete c[e];
  61395. },
  61396. m = function m(t, i) {
  61397. if (!t) throw "Missing Style name";
  61398. if (!i) throw "Missing Style definition";
  61399. if (!i.html) throw "Missing Style HTML";
  61400. var s = c[t];
  61401. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  61402. var o = "";
  61403. i.classes && e.each(i.classes, function (t, n) {
  61404. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  61405. return p[t] && e.each(p[t], function (e, r) {
  61406. return o += " " + r + t + ": " + n + ";\n";
  61407. }), o += " " + t + ": " + n + ";\n";
  61408. }), o += "}\n";
  61409. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  61410. var u = {},
  61411. a = e(i.html);
  61412. y("html", a, u), y("text", a, u), i.fields = u;
  61413. },
  61414. g = function g(t) {
  61415. var n, r, i;
  61416. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  61417. try {
  61418. r.html(t);
  61419. } catch (s) {
  61420. r[0].styleSheet.cssText = t;
  61421. }
  61422. return r;
  61423. },
  61424. y = function y(t, n, r) {
  61425. var s;
  61426. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  61427. var n;
  61428. n = e(this).attr(s), n || (n = i), r[n] = t;
  61429. });
  61430. },
  61431. b = function b(e, t) {
  61432. return e.is(t) ? e : e.find(t);
  61433. },
  61434. w = {
  61435. clickToHide: !0,
  61436. autoHide: !0,
  61437. autoHideDelay: 5e3,
  61438. arrowShow: !0,
  61439. arrowSize: 5,
  61440. breakNewLines: !0,
  61441. elementPosition: "bottom",
  61442. globalPosition: "top right",
  61443. style: "bootstrap",
  61444. className: "error",
  61445. showAnimation: "slideDown",
  61446. showDuration: 400,
  61447. hideAnimation: "slideUp",
  61448. hideDuration: 200,
  61449. gap: 5
  61450. },
  61451. E = function E(t, n) {
  61452. var r;
  61453. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  61454. },
  61455. S = function S(t) {
  61456. return e.extend(w, t);
  61457. },
  61458. x = function x(t) {
  61459. return e("<" + t + "></" + t + ">");
  61460. },
  61461. T = {},
  61462. N = function N(t) {
  61463. var n;
  61464. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  61465. return e(r).attr("name") === t.attr("name");
  61466. }), t = n.first()), t;
  61467. },
  61468. C = function C(e, t, n) {
  61469. var r, i;
  61470. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  61471. if (isNaN(n)) return;
  61472. 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;
  61473. },
  61474. k = function k(e, t, n) {
  61475. if (e === "l" || e === "t") return 0;
  61476. if (e === "c" || e === "m") return n / 2 - t / 2;
  61477. if (e === "r" || e === "b") return n - t;
  61478. throw "Invalid alignment";
  61479. },
  61480. L = function L(e) {
  61481. return L.e = L.e || x("div"), L.e.text(e).html();
  61482. };
  61483. A.prototype.loadHTML = function () {
  61484. var t;
  61485. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  61486. }, A.prototype.show = function (e, t) {
  61487. var n, r, i, s, o;
  61488. r = function (n) {
  61489. return function () {
  61490. !e && !n.elem && n.destroy();
  61491. if (t) return t();
  61492. };
  61493. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  61494. 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 {
  61495. if (!!o || !!e) return r();
  61496. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  61497. }
  61498. return n.push(r), i[s].apply(i, n);
  61499. }, A.prototype.setGlobalPosition = function () {
  61500. var t = this.getPosition(),
  61501. n = t[0],
  61502. i = t[1],
  61503. o = s[n],
  61504. u = s[i],
  61505. a = n + "|" + i,
  61506. f = T[a];
  61507. if (!f || !document.body.contains(f[0])) {
  61508. f = T[a] = x("div");
  61509. var l = {};
  61510. 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);
  61511. }
  61512. return f.prepend(this.wrapper);
  61513. }, A.prototype.setElementPosition = function () {
  61514. 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;
  61515. 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"];
  61516. for (w = 0, S = B.length; w < S; w++) {
  61517. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  61518. }
  61519. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  61520. if (!this.options.arrowShow) this.arrow.hide();else {
  61521. 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";
  61522. for (E = 0, x = a.length; E < x; E++) {
  61523. D = a[E], P = s[D];
  61524. if (D === L) continue;
  61525. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  61526. }
  61527. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  61528. }
  61529. 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);
  61530. if (r) return this.arrow.removeAttr("style").css(r);
  61531. }, A.prototype.getPosition = function () {
  61532. var e, n, r, i, s, f, c, h;
  61533. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  61534. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  61535. 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";
  61536. return e.length === 2 && (e[2] = e[1]), e;
  61537. }, A.prototype.getStyle = function (e) {
  61538. var t;
  61539. e || (e = this.options.style), e || (e = "default"), t = c[e];
  61540. if (!t) throw "Missing style: " + e;
  61541. return t;
  61542. }, A.prototype.updateClasses = function () {
  61543. var t, n;
  61544. 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) {
  61545. return r + "-" + n.name + "-" + e;
  61546. }).join(" "), this.userContainer.attr("class", t);
  61547. }, A.prototype.run = function (t, n) {
  61548. var r, s, o, u, a;
  61549. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  61550. if (this.container && !t) {
  61551. this.show(!1);
  61552. return;
  61553. }
  61554. if (!this.container && !t) return;
  61555. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  61556. for (o in s) {
  61557. r = s[o], u = this.userFields[o];
  61558. if (!u) continue;
  61559. 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);
  61560. }
  61561. 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));
  61562. }, A.prototype.destroy = function () {
  61563. this.wrapper.data(r, null), this.wrapper.remove();
  61564. }, e[n] = function (t, r, i) {
  61565. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  61566. }, e.fn[n] = function (t, n) {
  61567. return e(this).each(function () {
  61568. var i = N(e(this)).data(r);
  61569. i && i.destroy();
  61570. var s = new A(e(this), t, n);
  61571. }), this;
  61572. }, e.extend(e[n], {
  61573. defaults: S,
  61574. addStyle: m,
  61575. removeStyle: v,
  61576. pluginOptions: w,
  61577. getStyle: d,
  61578. insertCSS: g
  61579. }), m("bootstrap", {
  61580. html: "<div>\n<span data-notify-text></span>\n</div>",
  61581. classes: {
  61582. base: {
  61583. "font-weight": "bold",
  61584. padding: "8px 15px 8px 14px",
  61585. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  61586. "background-color": "#fcf8e3",
  61587. border: "1px solid #fbeed5",
  61588. "border-radius": "4px",
  61589. "white-space": "nowrap",
  61590. "padding-left": "25px",
  61591. "background-repeat": "no-repeat",
  61592. "background-position": "3px 7px"
  61593. },
  61594. error: {
  61595. color: "#B94A48",
  61596. "background-color": "#F2DEDE",
  61597. "border-color": "#EED3D7",
  61598. "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=)"
  61599. },
  61600. success: {
  61601. color: "#468847",
  61602. "background-color": "#DFF0D8",
  61603. "border-color": "#D6E9C6",
  61604. "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==)"
  61605. },
  61606. info: {
  61607. color: "#3A87AD",
  61608. "background-color": "#D9EDF7",
  61609. "border-color": "#BCE8F1",
  61610. "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=)"
  61611. },
  61612. warn: {
  61613. color: "#C09853",
  61614. "background-color": "#FCF8E3",
  61615. "border-color": "#FBEED5",
  61616. "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)"
  61617. }
  61618. }
  61619. }), e(function () {
  61620. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  61621. e(this).trigger("notify-hide");
  61622. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  61623. var n = e(this).data(r);
  61624. n && n.show(!1);
  61625. });
  61626. });
  61627. });
  61628. /***/ }),
  61629. /***/ "./resources/js/views/App.vue":
  61630. /*!************************************!*\
  61631. !*** ./resources/js/views/App.vue ***!
  61632. \************************************/
  61633. /*! exports provided: default */
  61634. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61635. "use strict";
  61636. __webpack_require__.r(__webpack_exports__);
  61637. /* 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&");
  61638. /* 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&");
  61639. /* 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");
  61640. /* normalize component */
  61641. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61642. _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61643. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"],
  61644. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61645. false,
  61646. null,
  61647. null,
  61648. null
  61649. )
  61650. /* hot reload */
  61651. if (false) { var api; }
  61652. component.options.__file = "resources/js/views/App.vue"
  61653. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61654. /***/ }),
  61655. /***/ "./resources/js/views/App.vue?vue&type=script&lang=js&":
  61656. /*!*************************************************************!*\
  61657. !*** ./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  61658. \*************************************************************/
  61659. /*! exports provided: default */
  61660. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61661. "use strict";
  61662. __webpack_require__.r(__webpack_exports__);
  61663. /* 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&");
  61664. /* 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"]);
  61665. /***/ }),
  61666. /***/ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  61667. /*!*******************************************************************!*\
  61668. !*** ./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  61669. \*******************************************************************/
  61670. /*! exports provided: render, staticRenderFns */
  61671. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61672. "use strict";
  61673. __webpack_require__.r(__webpack_exports__);
  61674. /* 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&");
  61675. /* 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"]; });
  61676. /* 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"]; });
  61677. /***/ }),
  61678. /***/ "./resources/js/views/Dashboard.vue":
  61679. /*!******************************************!*\
  61680. !*** ./resources/js/views/Dashboard.vue ***!
  61681. \******************************************/
  61682. /*! exports provided: default */
  61683. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61684. "use strict";
  61685. __webpack_require__.r(__webpack_exports__);
  61686. /* 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&");
  61687. /* 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&");
  61688. /* 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");
  61689. /* normalize component */
  61690. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61691. _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61692. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"],
  61693. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61694. false,
  61695. null,
  61696. null,
  61697. null
  61698. )
  61699. /* hot reload */
  61700. if (false) { var api; }
  61701. component.options.__file = "resources/js/views/Dashboard.vue"
  61702. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61703. /***/ }),
  61704. /***/ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  61705. /*!*******************************************************************!*\
  61706. !*** ./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  61707. \*******************************************************************/
  61708. /*! exports provided: default */
  61709. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61710. "use strict";
  61711. __webpack_require__.r(__webpack_exports__);
  61712. /* 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&");
  61713. /* 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"]);
  61714. /***/ }),
  61715. /***/ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  61716. /*!*************************************************************************!*\
  61717. !*** ./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  61718. \*************************************************************************/
  61719. /*! exports provided: render, staticRenderFns */
  61720. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61721. "use strict";
  61722. __webpack_require__.r(__webpack_exports__);
  61723. /* 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&");
  61724. /* 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"]; });
  61725. /* 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"]; });
  61726. /***/ }),
  61727. /***/ "./resources/js/views/Login.vue":
  61728. /*!**************************************!*\
  61729. !*** ./resources/js/views/Login.vue ***!
  61730. \**************************************/
  61731. /*! exports provided: default */
  61732. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61733. "use strict";
  61734. __webpack_require__.r(__webpack_exports__);
  61735. /* 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&");
  61736. /* 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&");
  61737. /* 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");
  61738. /* normalize component */
  61739. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61740. _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61741. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"],
  61742. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61743. false,
  61744. null,
  61745. null,
  61746. null
  61747. )
  61748. /* hot reload */
  61749. if (false) { var api; }
  61750. component.options.__file = "resources/js/views/Login.vue"
  61751. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61752. /***/ }),
  61753. /***/ "./resources/js/views/Login.vue?vue&type=script&lang=js&":
  61754. /*!***************************************************************!*\
  61755. !*** ./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  61756. \***************************************************************/
  61757. /*! exports provided: default */
  61758. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61759. "use strict";
  61760. __webpack_require__.r(__webpack_exports__);
  61761. /* 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&");
  61762. /* 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"]);
  61763. /***/ }),
  61764. /***/ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  61765. /*!*********************************************************************!*\
  61766. !*** ./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  61767. \*********************************************************************/
  61768. /*! exports provided: render, staticRenderFns */
  61769. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61770. "use strict";
  61771. __webpack_require__.r(__webpack_exports__);
  61772. /* 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&");
  61773. /* 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"]; });
  61774. /* 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"]; });
  61775. /***/ }),
  61776. /***/ "./resources/js/views/Welcome.vue":
  61777. /*!****************************************!*\
  61778. !*** ./resources/js/views/Welcome.vue ***!
  61779. \****************************************/
  61780. /*! exports provided: default */
  61781. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61782. "use strict";
  61783. __webpack_require__.r(__webpack_exports__);
  61784. /* 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&");
  61785. /* 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&");
  61786. /* 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&");
  61787. /* 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");
  61788. /* normalize component */
  61789. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  61790. _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61791. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  61792. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61793. false,
  61794. null,
  61795. "1ae8ae93",
  61796. null
  61797. )
  61798. /* hot reload */
  61799. if (false) { var api; }
  61800. component.options.__file = "resources/js/views/Welcome.vue"
  61801. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61802. /***/ }),
  61803. /***/ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  61804. /*!*****************************************************************!*\
  61805. !*** ./resources/js/views/Welcome.vue?vue&type=script&lang=js& ***!
  61806. \*****************************************************************/
  61807. /*! exports provided: default */
  61808. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61809. "use strict";
  61810. __webpack_require__.r(__webpack_exports__);
  61811. /* 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&");
  61812. /* 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"]);
  61813. /***/ }),
  61814. /***/ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  61815. /*!*************************************************************************************************!*\
  61816. !*** ./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  61817. \*************************************************************************************************/
  61818. /*! no static exports found */
  61819. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61820. "use strict";
  61821. __webpack_require__.r(__webpack_exports__);
  61822. /* 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&");
  61823. /* 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__);
  61824. /* 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__));
  61825. /* 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);
  61826. /***/ }),
  61827. /***/ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  61828. /*!***********************************************************************************!*\
  61829. !*** ./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  61830. \***********************************************************************************/
  61831. /*! exports provided: render, staticRenderFns */
  61832. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61833. "use strict";
  61834. __webpack_require__.r(__webpack_exports__);
  61835. /* 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&");
  61836. /* 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"]; });
  61837. /* 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"]; });
  61838. /***/ }),
  61839. /***/ "./resources/js/views/WorkOrder.vue":
  61840. /*!******************************************!*\
  61841. !*** ./resources/js/views/WorkOrder.vue ***!
  61842. \******************************************/
  61843. /*! exports provided: default */
  61844. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61845. "use strict";
  61846. __webpack_require__.r(__webpack_exports__);
  61847. /* 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&");
  61848. /* 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&");
  61849. /* 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");
  61850. /* normalize component */
  61851. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61852. _WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61853. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["render"],
  61854. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61855. false,
  61856. null,
  61857. null,
  61858. null
  61859. )
  61860. /* hot reload */
  61861. if (false) { var api; }
  61862. component.options.__file = "resources/js/views/WorkOrder.vue"
  61863. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61864. /***/ }),
  61865. /***/ "./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  61866. /*!*******************************************************************!*\
  61867. !*** ./resources/js/views/WorkOrder.vue?vue&type=script&lang=js& ***!
  61868. \*******************************************************************/
  61869. /*! exports provided: default */
  61870. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61871. "use strict";
  61872. __webpack_require__.r(__webpack_exports__);
  61873. /* 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&");
  61874. /* 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"]);
  61875. /***/ }),
  61876. /***/ "./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&":
  61877. /*!*************************************************************************!*\
  61878. !*** ./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e& ***!
  61879. \*************************************************************************/
  61880. /*! exports provided: render, staticRenderFns */
  61881. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61882. "use strict";
  61883. __webpack_require__.r(__webpack_exports__);
  61884. /* 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&");
  61885. /* 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"]; });
  61886. /* 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"]; });
  61887. /***/ }),
  61888. /***/ "./resources/sass/app.scss":
  61889. /*!*********************************!*\
  61890. !*** ./resources/sass/app.scss ***!
  61891. \*********************************/
  61892. /*! no static exports found */
  61893. /***/ (function(module, exports) {
  61894. // removed by extract-text-webpack-plugin
  61895. /***/ }),
  61896. /***/ 0:
  61897. /*!*************************************************************!*\
  61898. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  61899. \*************************************************************/
  61900. /*! no static exports found */
  61901. /***/ (function(module, exports, __webpack_require__) {
  61902. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  61903. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  61904. /***/ })
  61905. /******/ });