WebSerial.js 640 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431
  1. (function () {
  2. const W = document.createElement("link").relList;
  3. if (W && W.supports && W.supports("modulepreload"))
  4. return;
  5. for (const U of document.querySelectorAll('link[rel="modulepreload"]'))
  6. G(U);
  7. new MutationObserver(U => {
  8. for (const q of U)
  9. if (q.type === "childList")
  10. for (const x of q.addedNodes)
  11. x.tagName === "LINK" && x.rel === "modulepreload" && G(x)
  12. }
  13. ).observe(document, {
  14. childList: !0,
  15. subtree: !0
  16. });
  17. function V(U) {
  18. const q = {};
  19. return U.integrity && (q.integrity = U.integrity),
  20. U.referrerpolicy && (q.referrerPolicy = U.referrerpolicy),
  21. U.crossorigin === "use-credentials" ? q.credentials = "include" : U.crossorigin === "anonymous" ? q.credentials = "omit" : q.credentials = "same-origin",
  22. q
  23. }
  24. function G(U) {
  25. if (U.ep)
  26. return;
  27. U.ep = !0;
  28. const q = V(U);
  29. fetch(U.href, q)
  30. }
  31. }
  32. )();
  33. var Ce = {
  34. exports: {}
  35. };
  36. (function (z, W) {
  37. (function (V, G) {
  38. z.exports = G()
  39. }
  40. )(self, function () {
  41. return (() => {
  42. var V = {
  43. 4567: (x, r, a) => {
  44. Object.defineProperty(r, "__esModule", {
  45. value: !0
  46. }),
  47. r.AccessibilityManager = void 0;
  48. const n = a(9042)
  49. , _ = a(6114)
  50. , h = a(9924)
  51. , f = a(3656)
  52. , d = a(844)
  53. , l = a(5596)
  54. , o = a(9631);
  55. class t extends d.Disposable {
  56. constructor(e, i) {
  57. super(),
  58. this._terminal = e,
  59. this._renderService = i,
  60. this._liveRegionLineCount = 0,
  61. this._charsToConsume = [],
  62. this._charsToAnnounce = "",
  63. this._accessibilityTreeRoot = document.createElement("div"),
  64. this._accessibilityTreeRoot.classList.add("xterm-accessibility"),
  65. this._accessibilityTreeRoot.tabIndex = 0,
  66. this._rowContainer = document.createElement("div"),
  67. this._rowContainer.setAttribute("role", "list"),
  68. this._rowContainer.classList.add("xterm-accessibility-tree"),
  69. this._rowElements = [];
  70. for (let c = 0; c < this._terminal.rows; c++)
  71. this._rowElements[c] = this._createAccessibilityTreeNode(),
  72. this._rowContainer.appendChild(this._rowElements[c]);
  73. if (this._topBoundaryFocusListener = c => this._onBoundaryFocus(c, 0),
  74. this._bottomBoundaryFocusListener = c => this._onBoundaryFocus(c, 1),
  75. this._rowElements[0].addEventListener("focus", this._topBoundaryFocusListener),
  76. this._rowElements[this._rowElements.length - 1].addEventListener("focus", this._bottomBoundaryFocusListener),
  77. this._refreshRowsDimensions(),
  78. this._accessibilityTreeRoot.appendChild(this._rowContainer),
  79. this._renderRowsDebouncer = new h.TimeBasedDebouncer(this._renderRows.bind(this)),
  80. this._refreshRows(),
  81. this._liveRegion = document.createElement("div"),
  82. this._liveRegion.classList.add("live-region"),
  83. this._liveRegion.setAttribute("aria-live", "assertive"),
  84. this._accessibilityTreeRoot.appendChild(this._liveRegion),
  85. !this._terminal.element)
  86. throw new Error("Cannot enable accessibility before Terminal.open");
  87. this._terminal.element.insertAdjacentElement("afterbegin", this._accessibilityTreeRoot),
  88. this.register(this._renderRowsDebouncer),
  89. this.register(this._terminal.onResize(c => this._onResize(c.rows))),
  90. this.register(this._terminal.onRender(c => this._refreshRows(c.start, c.end))),
  91. this.register(this._terminal.onScroll(() => this._refreshRows())),
  92. this.register(this._terminal.onA11yChar(c => this._onChar(c))),
  93. this.register(this._terminal.onLineFeed(() => this._onChar(`
  94. `))),
  95. this.register(this._terminal.onA11yTab(c => this._onTab(c))),
  96. this.register(this._terminal.onKey(c => this._onKey(c.key))),
  97. this.register(this._terminal.onBlur(() => this._clearLiveRegion())),
  98. this.register(this._renderService.onDimensionsChange(() => this._refreshRowsDimensions())),
  99. this._screenDprMonitor = new l.ScreenDprMonitor(window),
  100. this.register(this._screenDprMonitor),
  101. this._screenDprMonitor.setListener(() => this._refreshRowsDimensions()),
  102. this.register((0,
  103. f.addDisposableDomListener)(window, "resize", () => this._refreshRowsDimensions()))
  104. }
  105. dispose() {
  106. super.dispose(),
  107. (0,
  108. o.removeElementFromParent)(this._accessibilityTreeRoot),
  109. this._rowElements.length = 0
  110. }
  111. _onBoundaryFocus(e, i) {
  112. const c = e.target
  113. , g = this._rowElements[i === 0 ? 1 : this._rowElements.length - 2];
  114. if (c.getAttribute("aria-posinset") === (i === 0 ? "1" : `${this._terminal.buffer.lines.length}`) || e.relatedTarget !== g)
  115. return;
  116. let v, S;
  117. if (i === 0 ? (v = c,
  118. S = this._rowElements.pop(),
  119. this._rowContainer.removeChild(S)) : (v = this._rowElements.shift(),
  120. S = c,
  121. this._rowContainer.removeChild(v)),
  122. v.removeEventListener("focus", this._topBoundaryFocusListener),
  123. S.removeEventListener("focus", this._bottomBoundaryFocusListener),
  124. i === 0) {
  125. const u = this._createAccessibilityTreeNode();
  126. this._rowElements.unshift(u),
  127. this._rowContainer.insertAdjacentElement("afterbegin", u)
  128. } else {
  129. const u = this._createAccessibilityTreeNode();
  130. this._rowElements.push(u),
  131. this._rowContainer.appendChild(u)
  132. }
  133. this._rowElements[0].addEventListener("focus", this._topBoundaryFocusListener),
  134. this._rowElements[this._rowElements.length - 1].addEventListener("focus", this._bottomBoundaryFocusListener),
  135. this._terminal.scrollLines(i === 0 ? -1 : 1),
  136. this._rowElements[i === 0 ? 1 : this._rowElements.length - 2].focus(),
  137. e.preventDefault(),
  138. e.stopImmediatePropagation()
  139. }
  140. _onResize(e) {
  141. this._rowElements[this._rowElements.length - 1].removeEventListener("focus", this._bottomBoundaryFocusListener);
  142. for (let i = this._rowContainer.children.length; i < this._terminal.rows; i++)
  143. this._rowElements[i] = this._createAccessibilityTreeNode(),
  144. this._rowContainer.appendChild(this._rowElements[i]);
  145. for (; this._rowElements.length > e;)
  146. this._rowContainer.removeChild(this._rowElements.pop());
  147. this._rowElements[this._rowElements.length - 1].addEventListener("focus", this._bottomBoundaryFocusListener),
  148. this._refreshRowsDimensions()
  149. }
  150. _createAccessibilityTreeNode() {
  151. const e = document.createElement("div");
  152. return e.setAttribute("role", "listitem"),
  153. e.tabIndex = -1,
  154. this._refreshRowDimensions(e),
  155. e
  156. }
  157. _onTab(e) {
  158. for (let i = 0; i < e; i++)
  159. this._onChar(" ")
  160. }
  161. _onChar(e) {
  162. this._liveRegionLineCount < 21 && (this._charsToConsume.length > 0 ? this._charsToConsume.shift() !== e && (this._charsToAnnounce += e) : this._charsToAnnounce += e,
  163. e === `
  164. ` && (this._liveRegionLineCount++,
  165. this._liveRegionLineCount === 21 && (this._liveRegion.textContent += n.tooMuchOutput)),
  166. _.isMac && this._liveRegion.textContent && this._liveRegion.textContent.length > 0 && !this._liveRegion.parentNode && setTimeout(() => {
  167. this._accessibilityTreeRoot.appendChild(this._liveRegion)
  168. }
  169. , 0))
  170. }
  171. _clearLiveRegion() {
  172. this._liveRegion.textContent = "",
  173. this._liveRegionLineCount = 0,
  174. _.isMac && (0,
  175. o.removeElementFromParent)(this._liveRegion)
  176. }
  177. _onKey(e) {
  178. this._clearLiveRegion(),
  179. this._charsToConsume.push(e)
  180. }
  181. _refreshRows(e, i) {
  182. this._renderRowsDebouncer.refresh(e, i, this._terminal.rows)
  183. }
  184. _renderRows(e, i) {
  185. const c = this._terminal.buffer
  186. , g = c.lines.length.toString();
  187. for (let v = e; v <= i; v++) {
  188. const S = c.translateBufferLineToString(c.ydisp + v, !0)
  189. , u = (c.ydisp + v + 1).toString()
  190. , m = this._rowElements[v];
  191. m && (S.length === 0 ? m.innerText = "\xA0" : m.textContent = S,
  192. m.setAttribute("aria-posinset", u),
  193. m.setAttribute("aria-setsize", g))
  194. }
  195. this._announceCharacters()
  196. }
  197. _refreshRowsDimensions() {
  198. if (this._renderService.dimensions.actualCellHeight) {
  199. this._rowElements.length !== this._terminal.rows && this._onResize(this._terminal.rows);
  200. for (let e = 0; e < this._terminal.rows; e++)
  201. this._refreshRowDimensions(this._rowElements[e])
  202. }
  203. }
  204. _refreshRowDimensions(e) {
  205. e.style.height = `${this._renderService.dimensions.actualCellHeight}px`
  206. }
  207. _announceCharacters() {
  208. this._charsToAnnounce.length !== 0 && (this._liveRegion.textContent += this._charsToAnnounce,
  209. this._charsToAnnounce = "")
  210. }
  211. }
  212. r.AccessibilityManager = t
  213. }
  214. ,
  215. 3614: (x, r) => {
  216. function a(f) {
  217. return f.replace(/\r?\n/g, "\r")
  218. }
  219. function n(f, d) {
  220. return d ? "\x1B[200~" + f + "\x1B[201~" : f
  221. }
  222. function _(f, d, l) {
  223. f = n(f = a(f), l.decPrivateModes.bracketedPasteMode),
  224. l.triggerDataEvent(f, !0),
  225. d.value = ""
  226. }
  227. function h(f, d, l) {
  228. const o = l.getBoundingClientRect()
  229. , t = f.clientX - o.left - 10
  230. , s = f.clientY - o.top - 10;
  231. d.style.width = "20px",
  232. d.style.height = "20px",
  233. d.style.left = `${t}px`,
  234. d.style.top = `${s}px`,
  235. d.style.zIndex = "1000",
  236. d.focus()
  237. }
  238. Object.defineProperty(r, "__esModule", {
  239. value: !0
  240. }),
  241. r.rightClickHandler = r.moveTextAreaUnderMouseCursor = r.paste = r.handlePasteEvent = r.copyHandler = r.bracketTextForPaste = r.prepareTextForTerminal = void 0,
  242. r.prepareTextForTerminal = a,
  243. r.bracketTextForPaste = n,
  244. r.copyHandler = function (f, d) {
  245. f.clipboardData && f.clipboardData.setData("text/plain", d.selectionText),
  246. f.preventDefault()
  247. }
  248. ,
  249. r.handlePasteEvent = function (f, d, l) {
  250. f.stopPropagation(),
  251. f.clipboardData && _(f.clipboardData.getData("text/plain"), d, l)
  252. }
  253. ,
  254. r.paste = _,
  255. r.moveTextAreaUnderMouseCursor = h,
  256. r.rightClickHandler = function (f, d, l, o, t) {
  257. h(f, d, l),
  258. t && o.rightClickSelect(f),
  259. d.value = o.selectionText,
  260. d.select()
  261. }
  262. }
  263. ,
  264. 7239: (x, r, a) => {
  265. Object.defineProperty(r, "__esModule", {
  266. value: !0
  267. }),
  268. r.ColorContrastCache = void 0;
  269. const n = a(1505);
  270. r.ColorContrastCache = class {
  271. constructor() {
  272. this._color = new n.TwoKeyMap,
  273. this._css = new n.TwoKeyMap
  274. }
  275. setCss(_, h, f) {
  276. this._css.set(_, h, f)
  277. }
  278. getCss(_, h) {
  279. return this._css.get(_, h)
  280. }
  281. setColor(_, h, f) {
  282. this._color.set(_, h, f)
  283. }
  284. getColor(_, h) {
  285. return this._color.get(_, h)
  286. }
  287. clear() {
  288. this._color.clear(),
  289. this._css.clear()
  290. }
  291. }
  292. }
  293. ,
  294. 5680: (x, r, a) => {
  295. Object.defineProperty(r, "__esModule", {
  296. value: !0
  297. }),
  298. r.ColorManager = r.DEFAULT_ANSI_COLORS = void 0;
  299. const n = a(8055)
  300. , _ = a(7239)
  301. , h = n.css.toColor("#ffffff")
  302. , f = n.css.toColor("#000000")
  303. , d = n.css.toColor("#ffffff")
  304. , l = n.css.toColor("#000000")
  305. , o = {
  306. css: "rgba(255, 255, 255, 0.3)",
  307. rgba: 4294967117
  308. };
  309. r.DEFAULT_ANSI_COLORS = Object.freeze((() => {
  310. const t = [n.css.toColor("#2e3436"), n.css.toColor("#cc0000"), n.css.toColor("#4e9a06"), n.css.toColor("#c4a000"), n.css.toColor("#3465a4"), n.css.toColor("#75507b"), n.css.toColor("#06989a"), n.css.toColor("#d3d7cf"), n.css.toColor("#555753"), n.css.toColor("#ef2929"), n.css.toColor("#8ae234"), n.css.toColor("#fce94f"), n.css.toColor("#729fcf"), n.css.toColor("#ad7fa8"), n.css.toColor("#34e2e2"), n.css.toColor("#eeeeec")]
  311. , s = [0, 95, 135, 175, 215, 255];
  312. for (let e = 0; e < 216; e++) {
  313. const i = s[e / 36 % 6 | 0]
  314. , c = s[e / 6 % 6 | 0]
  315. , g = s[e % 6];
  316. t.push({
  317. css: n.channels.toCss(i, c, g),
  318. rgba: n.channels.toRgba(i, c, g)
  319. })
  320. }
  321. for (let e = 0; e < 24; e++) {
  322. const i = 8 + 10 * e;
  323. t.push({
  324. css: n.channels.toCss(i, i, i),
  325. rgba: n.channels.toRgba(i, i, i)
  326. })
  327. }
  328. return t
  329. }
  330. )()),
  331. r.ColorManager = class {
  332. constructor(t, s) {
  333. this.allowTransparency = s;
  334. const e = t.createElement("canvas");
  335. e.width = 1,
  336. e.height = 1;
  337. const i = e.getContext("2d");
  338. if (!i)
  339. throw new Error("Could not get rendering context");
  340. this._ctx = i,
  341. this._ctx.globalCompositeOperation = "copy",
  342. this._litmusColor = this._ctx.createLinearGradient(0, 0, 1, 1),
  343. this._contrastCache = new _.ColorContrastCache,
  344. this.colors = {
  345. foreground: h,
  346. background: f,
  347. cursor: d,
  348. cursorAccent: l,
  349. selectionForeground: void 0,
  350. selectionBackgroundTransparent: o,
  351. selectionBackgroundOpaque: n.color.blend(f, o),
  352. selectionInactiveBackgroundTransparent: o,
  353. selectionInactiveBackgroundOpaque: n.color.blend(f, o),
  354. ansi: r.DEFAULT_ANSI_COLORS.slice(),
  355. contrastCache: this._contrastCache
  356. },
  357. this._updateRestoreColors()
  358. }
  359. onOptionsChange(t, s) {
  360. switch (t) {
  361. case "minimumContrastRatio":
  362. this._contrastCache.clear();
  363. break;
  364. case "allowTransparency":
  365. this.allowTransparency = s
  366. }
  367. }
  368. setTheme(t = {}) {
  369. this.colors.foreground = this._parseColor(t.foreground, h),
  370. this.colors.background = this._parseColor(t.background, f),
  371. this.colors.cursor = this._parseColor(t.cursor, d, !0),
  372. this.colors.cursorAccent = this._parseColor(t.cursorAccent, l, !0),
  373. this.colors.selectionBackgroundTransparent = this._parseColor(t.selectionBackground, o, !0),
  374. this.colors.selectionBackgroundOpaque = n.color.blend(this.colors.background, this.colors.selectionBackgroundTransparent),
  375. this.colors.selectionInactiveBackgroundTransparent = this._parseColor(t.selectionInactiveBackground, this.colors.selectionBackgroundTransparent, !0),
  376. this.colors.selectionInactiveBackgroundOpaque = n.color.blend(this.colors.background, this.colors.selectionInactiveBackgroundTransparent);
  377. const s = {
  378. css: "",
  379. rgba: 0
  380. };
  381. if (this.colors.selectionForeground = t.selectionForeground ? this._parseColor(t.selectionForeground, s) : void 0,
  382. this.colors.selectionForeground === s && (this.colors.selectionForeground = void 0),
  383. n.color.isOpaque(this.colors.selectionBackgroundTransparent) && (this.colors.selectionBackgroundTransparent = n.color.opacity(this.colors.selectionBackgroundTransparent, .3)),
  384. n.color.isOpaque(this.colors.selectionInactiveBackgroundTransparent) && (this.colors.selectionInactiveBackgroundTransparent = n.color.opacity(this.colors.selectionInactiveBackgroundTransparent, .3)),
  385. this.colors.ansi = r.DEFAULT_ANSI_COLORS.slice(),
  386. this.colors.ansi[0] = this._parseColor(t.black, r.DEFAULT_ANSI_COLORS[0]),
  387. this.colors.ansi[1] = this._parseColor(t.red, r.DEFAULT_ANSI_COLORS[1]),
  388. this.colors.ansi[2] = this._parseColor(t.green, r.DEFAULT_ANSI_COLORS[2]),
  389. this.colors.ansi[3] = this._parseColor(t.yellow, r.DEFAULT_ANSI_COLORS[3]),
  390. this.colors.ansi[4] = this._parseColor(t.blue, r.DEFAULT_ANSI_COLORS[4]),
  391. this.colors.ansi[5] = this._parseColor(t.magenta, r.DEFAULT_ANSI_COLORS[5]),
  392. this.colors.ansi[6] = this._parseColor(t.cyan, r.DEFAULT_ANSI_COLORS[6]),
  393. this.colors.ansi[7] = this._parseColor(t.white, r.DEFAULT_ANSI_COLORS[7]),
  394. this.colors.ansi[8] = this._parseColor(t.brightBlack, r.DEFAULT_ANSI_COLORS[8]),
  395. this.colors.ansi[9] = this._parseColor(t.brightRed, r.DEFAULT_ANSI_COLORS[9]),
  396. this.colors.ansi[10] = this._parseColor(t.brightGreen, r.DEFAULT_ANSI_COLORS[10]),
  397. this.colors.ansi[11] = this._parseColor(t.brightYellow, r.DEFAULT_ANSI_COLORS[11]),
  398. this.colors.ansi[12] = this._parseColor(t.brightBlue, r.DEFAULT_ANSI_COLORS[12]),
  399. this.colors.ansi[13] = this._parseColor(t.brightMagenta, r.DEFAULT_ANSI_COLORS[13]),
  400. this.colors.ansi[14] = this._parseColor(t.brightCyan, r.DEFAULT_ANSI_COLORS[14]),
  401. this.colors.ansi[15] = this._parseColor(t.brightWhite, r.DEFAULT_ANSI_COLORS[15]),
  402. t.extendedAnsi) {
  403. const e = Math.min(this.colors.ansi.length - 16, t.extendedAnsi.length);
  404. for (let i = 0; i < e; i++)
  405. this.colors.ansi[i + 16] = this._parseColor(t.extendedAnsi[i], r.DEFAULT_ANSI_COLORS[i + 16])
  406. }
  407. this._contrastCache.clear(),
  408. this._updateRestoreColors()
  409. }
  410. restoreColor(t) {
  411. if (t !== void 0)
  412. switch (t) {
  413. case 256:
  414. this.colors.foreground = this._restoreColors.foreground;
  415. break;
  416. case 257:
  417. this.colors.background = this._restoreColors.background;
  418. break;
  419. case 258:
  420. this.colors.cursor = this._restoreColors.cursor;
  421. break;
  422. default:
  423. this.colors.ansi[t] = this._restoreColors.ansi[t]
  424. }
  425. else
  426. for (let s = 0; s < this._restoreColors.ansi.length; ++s)
  427. this.colors.ansi[s] = this._restoreColors.ansi[s]
  428. }
  429. _updateRestoreColors() {
  430. this._restoreColors = {
  431. foreground: this.colors.foreground,
  432. background: this.colors.background,
  433. cursor: this.colors.cursor,
  434. ansi: this.colors.ansi.slice()
  435. }
  436. }
  437. _parseColor(t, s, e = this.allowTransparency) {
  438. if (t === void 0)
  439. return s;
  440. if (this._ctx.fillStyle = this._litmusColor,
  441. this._ctx.fillStyle = t,
  442. typeof this._ctx.fillStyle != "string")
  443. return console.warn(`Color: ${t} is invalid using fallback ${s.css}`),
  444. s;
  445. this._ctx.fillRect(0, 0, 1, 1);
  446. const i = this._ctx.getImageData(0, 0, 1, 1).data;
  447. if (i[3] !== 255) {
  448. if (!e)
  449. return console.warn(`Color: ${t} is using transparency, but allowTransparency is false. Using fallback ${s.css}.`),
  450. s;
  451. const [c, g, v, S] = this._ctx.fillStyle.substring(5, this._ctx.fillStyle.length - 1).split(",").map(m => Number(m))
  452. , u = Math.round(255 * S);
  453. return {
  454. rgba: n.channels.toRgba(c, g, v, u),
  455. css: t
  456. }
  457. }
  458. return {
  459. css: this._ctx.fillStyle,
  460. rgba: n.channels.toRgba(i[0], i[1], i[2], i[3])
  461. }
  462. }
  463. }
  464. }
  465. ,
  466. 9631: (x, r) => {
  467. Object.defineProperty(r, "__esModule", {
  468. value: !0
  469. }),
  470. r.removeElementFromParent = void 0,
  471. r.removeElementFromParent = function (...a) {
  472. var n;
  473. for (const _ of a)
  474. (n = _ == null ? void 0 : _.parentElement) === null || n === void 0 || n.removeChild(_)
  475. }
  476. }
  477. ,
  478. 3656: (x, r) => {
  479. Object.defineProperty(r, "__esModule", {
  480. value: !0
  481. }),
  482. r.addDisposableDomListener = void 0,
  483. r.addDisposableDomListener = function (a, n, _, h) {
  484. a.addEventListener(n, _, h);
  485. let f = !1;
  486. return {
  487. dispose: () => {
  488. f || (f = !0,
  489. a.removeEventListener(n, _, h))
  490. }
  491. }
  492. }
  493. }
  494. ,
  495. 6465: function (x, r, a) {
  496. var n = this && this.__decorate || function (t, s, e, i) {
  497. var c, g = arguments.length, v = g < 3 ? s : i === null ? i = Object.getOwnPropertyDescriptor(s, e) : i;
  498. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  499. v = Reflect.decorate(t, s, e, i);
  500. else
  501. for (var S = t.length - 1; S >= 0; S--)
  502. (c = t[S]) && (v = (g < 3 ? c(v) : g > 3 ? c(s, e, v) : c(s, e)) || v);
  503. return g > 3 && v && Object.defineProperty(s, e, v),
  504. v
  505. }
  506. , _ = this && this.__param || function (t, s) {
  507. return function (e, i) {
  508. s(e, i, t)
  509. }
  510. }
  511. ;
  512. Object.defineProperty(r, "__esModule", {
  513. value: !0
  514. }),
  515. r.Linkifier2 = void 0;
  516. const h = a(2585)
  517. , f = a(8460)
  518. , d = a(844)
  519. , l = a(3656);
  520. let o = class extends d.Disposable {
  521. constructor(t) {
  522. super(),
  523. this._bufferService = t,
  524. this._linkProviders = [],
  525. this._linkCacheDisposables = [],
  526. this._isMouseOut = !0,
  527. this._activeLine = -1,
  528. this._onShowLinkUnderline = this.register(new f.EventEmitter),
  529. this._onHideLinkUnderline = this.register(new f.EventEmitter),
  530. this.register((0,
  531. d.getDisposeArrayDisposable)(this._linkCacheDisposables))
  532. }
  533. get currentLink() {
  534. return this._currentLink
  535. }
  536. get onShowLinkUnderline() {
  537. return this._onShowLinkUnderline.event
  538. }
  539. get onHideLinkUnderline() {
  540. return this._onHideLinkUnderline.event
  541. }
  542. dispose() {
  543. super.dispose(),
  544. this._lastMouseEvent = void 0
  545. }
  546. registerLinkProvider(t) {
  547. return this._linkProviders.push(t),
  548. {
  549. dispose: () => {
  550. const s = this._linkProviders.indexOf(t);
  551. s !== -1 && this._linkProviders.splice(s, 1)
  552. }
  553. }
  554. }
  555. attachToDom(t, s, e) {
  556. this._element = t,
  557. this._mouseService = s,
  558. this._renderService = e,
  559. this.register((0,
  560. l.addDisposableDomListener)(this._element, "mouseleave", () => {
  561. this._isMouseOut = !0,
  562. this._clearCurrentLink()
  563. }
  564. )),
  565. this.register((0,
  566. l.addDisposableDomListener)(this._element, "mousemove", this._onMouseMove.bind(this))),
  567. this.register((0,
  568. l.addDisposableDomListener)(this._element, "mousedown", this._handleMouseDown.bind(this))),
  569. this.register((0,
  570. l.addDisposableDomListener)(this._element, "mouseup", this._handleMouseUp.bind(this)))
  571. }
  572. _onMouseMove(t) {
  573. if (this._lastMouseEvent = t,
  574. !this._element || !this._mouseService)
  575. return;
  576. const s = this._positionFromMouseEvent(t, this._element, this._mouseService);
  577. if (!s)
  578. return;
  579. this._isMouseOut = !1;
  580. const e = t.composedPath();
  581. for (let i = 0; i < e.length; i++) {
  582. const c = e[i];
  583. if (c.classList.contains("xterm"))
  584. break;
  585. if (c.classList.contains("xterm-hover"))
  586. return
  587. }
  588. this._lastBufferCell && s.x === this._lastBufferCell.x && s.y === this._lastBufferCell.y || (this._onHover(s),
  589. this._lastBufferCell = s)
  590. }
  591. _onHover(t) {
  592. if (this._activeLine !== t.y)
  593. return this._clearCurrentLink(),
  594. void this._askForLink(t, !1);
  595. this._currentLink && this._linkAtPosition(this._currentLink.link, t) || (this._clearCurrentLink(),
  596. this._askForLink(t, !0))
  597. }
  598. _askForLink(t, s) {
  599. var e, i;
  600. this._activeProviderReplies && s || ((e = this._activeProviderReplies) === null || e === void 0 || e.forEach(g => {
  601. g == null || g.forEach(v => {
  602. v.link.dispose && v.link.dispose()
  603. }
  604. )
  605. }
  606. ),
  607. this._activeProviderReplies = new Map,
  608. this._activeLine = t.y);
  609. let c = !1;
  610. for (const [g, v] of this._linkProviders.entries())
  611. s ? !((i = this._activeProviderReplies) === null || i === void 0) && i.get(g) && (c = this._checkLinkProviderResult(g, t, c)) : v.provideLinks(t.y, S => {
  612. var u, m;
  613. if (this._isMouseOut)
  614. return;
  615. const w = S == null ? void 0 : S.map(R => ({
  616. link: R
  617. }));
  618. (u = this._activeProviderReplies) === null || u === void 0 || u.set(g, w),
  619. c = this._checkLinkProviderResult(g, t, c),
  620. ((m = this._activeProviderReplies) === null || m === void 0 ? void 0 : m.size) === this._linkProviders.length && this._removeIntersectingLinks(t.y, this._activeProviderReplies)
  621. }
  622. )
  623. }
  624. _removeIntersectingLinks(t, s) {
  625. const e = new Set;
  626. for (let i = 0; i < s.size; i++) {
  627. const c = s.get(i);
  628. if (c)
  629. for (let g = 0; g < c.length; g++) {
  630. const v = c[g]
  631. , S = v.link.range.start.y < t ? 0 : v.link.range.start.x
  632. , u = v.link.range.end.y > t ? this._bufferService.cols : v.link.range.end.x;
  633. for (let m = S; m <= u; m++) {
  634. if (e.has(m)) {
  635. c.splice(g--, 1);
  636. break
  637. }
  638. e.add(m)
  639. }
  640. }
  641. }
  642. }
  643. _checkLinkProviderResult(t, s, e) {
  644. var i;
  645. if (!this._activeProviderReplies)
  646. return e;
  647. const c = this._activeProviderReplies.get(t);
  648. let g = !1;
  649. for (let v = 0; v < t; v++)
  650. this._activeProviderReplies.has(v) && !this._activeProviderReplies.get(v) || (g = !0);
  651. if (!g && c) {
  652. const v = c.find(S => this._linkAtPosition(S.link, s));
  653. v && (e = !0,
  654. this._handleNewLink(v))
  655. }
  656. if (this._activeProviderReplies.size === this._linkProviders.length && !e)
  657. for (let v = 0; v < this._activeProviderReplies.size; v++) {
  658. const S = (i = this._activeProviderReplies.get(v)) === null || i === void 0 ? void 0 : i.find(u => this._linkAtPosition(u.link, s));
  659. if (S) {
  660. e = !0,
  661. this._handleNewLink(S);
  662. break
  663. }
  664. }
  665. return e
  666. }
  667. _handleMouseDown() {
  668. this._mouseDownLink = this._currentLink
  669. }
  670. _handleMouseUp(t) {
  671. if (!this._element || !this._mouseService || !this._currentLink)
  672. return;
  673. const s = this._positionFromMouseEvent(t, this._element, this._mouseService);
  674. s && this._mouseDownLink === this._currentLink && this._linkAtPosition(this._currentLink.link, s) && this._currentLink.link.activate(t, this._currentLink.link.text)
  675. }
  676. _clearCurrentLink(t, s) {
  677. this._element && this._currentLink && this._lastMouseEvent && (!t || !s || this._currentLink.link.range.start.y >= t && this._currentLink.link.range.end.y <= s) && (this._linkLeave(this._element, this._currentLink.link, this._lastMouseEvent),
  678. this._currentLink = void 0,
  679. (0,
  680. d.disposeArray)(this._linkCacheDisposables))
  681. }
  682. _handleNewLink(t) {
  683. if (!this._element || !this._lastMouseEvent || !this._mouseService)
  684. return;
  685. const s = this._positionFromMouseEvent(this._lastMouseEvent, this._element, this._mouseService);
  686. s && this._linkAtPosition(t.link, s) && (this._currentLink = t,
  687. this._currentLink.state = {
  688. decorations: {
  689. underline: t.link.decorations === void 0 || t.link.decorations.underline,
  690. pointerCursor: t.link.decorations === void 0 || t.link.decorations.pointerCursor
  691. },
  692. isHovered: !0
  693. },
  694. this._linkHover(this._element, t.link, this._lastMouseEvent),
  695. t.link.decorations = {},
  696. Object.defineProperties(t.link.decorations, {
  697. pointerCursor: {
  698. get: () => {
  699. var e, i;
  700. return (i = (e = this._currentLink) === null || e === void 0 ? void 0 : e.state) === null || i === void 0 ? void 0 : i.decorations.pointerCursor
  701. }
  702. ,
  703. set: e => {
  704. var i, c;
  705. ((i = this._currentLink) === null || i === void 0 ? void 0 : i.state) && this._currentLink.state.decorations.pointerCursor !== e && (this._currentLink.state.decorations.pointerCursor = e,
  706. this._currentLink.state.isHovered && ((c = this._element) === null || c === void 0 || c.classList.toggle("xterm-cursor-pointer", e)))
  707. }
  708. },
  709. underline: {
  710. get: () => {
  711. var e, i;
  712. return (i = (e = this._currentLink) === null || e === void 0 ? void 0 : e.state) === null || i === void 0 ? void 0 : i.decorations.underline
  713. }
  714. ,
  715. set: e => {
  716. var i, c, g;
  717. ((i = this._currentLink) === null || i === void 0 ? void 0 : i.state) && ((g = (c = this._currentLink) === null || c === void 0 ? void 0 : c.state) === null || g === void 0 ? void 0 : g.decorations.underline) !== e && (this._currentLink.state.decorations.underline = e,
  718. this._currentLink.state.isHovered && this._fireUnderlineEvent(t.link, e))
  719. }
  720. }
  721. }),
  722. this._renderService && this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e => {
  723. const i = e.start === 0 ? 0 : e.start + 1 + this._bufferService.buffer.ydisp;
  724. this._clearCurrentLink(i, e.end + 1 + this._bufferService.buffer.ydisp)
  725. }
  726. )))
  727. }
  728. _linkHover(t, s, e) {
  729. var i;
  730. !((i = this._currentLink) === null || i === void 0) && i.state && (this._currentLink.state.isHovered = !0,
  731. this._currentLink.state.decorations.underline && this._fireUnderlineEvent(s, !0),
  732. this._currentLink.state.decorations.pointerCursor && t.classList.add("xterm-cursor-pointer")),
  733. s.hover && s.hover(e, s.text)
  734. }
  735. _fireUnderlineEvent(t, s) {
  736. const e = t.range
  737. , i = this._bufferService.buffer.ydisp
  738. , c = this._createLinkUnderlineEvent(e.start.x - 1, e.start.y - i - 1, e.end.x, e.end.y - i - 1, void 0);
  739. (s ? this._onShowLinkUnderline : this._onHideLinkUnderline).fire(c)
  740. }
  741. _linkLeave(t, s, e) {
  742. var i;
  743. !((i = this._currentLink) === null || i === void 0) && i.state && (this._currentLink.state.isHovered = !1,
  744. this._currentLink.state.decorations.underline && this._fireUnderlineEvent(s, !1),
  745. this._currentLink.state.decorations.pointerCursor && t.classList.remove("xterm-cursor-pointer")),
  746. s.leave && s.leave(e, s.text)
  747. }
  748. _linkAtPosition(t, s) {
  749. const e = t.range.start.y === t.range.end.y
  750. , i = t.range.start.y < s.y
  751. , c = t.range.end.y > s.y;
  752. return (e && t.range.start.x <= s.x && t.range.end.x >= s.x || i && t.range.end.x >= s.x || c && t.range.start.x <= s.x || i && c) && t.range.start.y <= s.y && t.range.end.y >= s.y
  753. }
  754. _positionFromMouseEvent(t, s, e) {
  755. const i = e.getCoords(t, s, this._bufferService.cols, this._bufferService.rows);
  756. if (i)
  757. return {
  758. x: i[0],
  759. y: i[1] + this._bufferService.buffer.ydisp
  760. }
  761. }
  762. _createLinkUnderlineEvent(t, s, e, i, c) {
  763. return {
  764. x1: t,
  765. y1: s,
  766. x2: e,
  767. y2: i,
  768. cols: this._bufferService.cols,
  769. fg: c
  770. }
  771. }
  772. }
  773. ;
  774. o = n([_(0, h.IBufferService)], o),
  775. r.Linkifier2 = o
  776. },
  777. 9042: (x, r) => {
  778. Object.defineProperty(r, "__esModule", {
  779. value: !0
  780. }),
  781. r.tooMuchOutput = r.promptLabel = void 0,
  782. r.promptLabel = "Terminal input",
  783. r.tooMuchOutput = "Too much output to announce, navigate to rows manually to read"
  784. }
  785. ,
  786. 2962: function (x, r, a) {
  787. var n = this && this.__decorate || function (o, t, s, e) {
  788. var i, c = arguments.length, g = c < 3 ? t : e === null ? e = Object.getOwnPropertyDescriptor(t, s) : e;
  789. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  790. g = Reflect.decorate(o, t, s, e);
  791. else
  792. for (var v = o.length - 1; v >= 0; v--)
  793. (i = o[v]) && (g = (c < 3 ? i(g) : c > 3 ? i(t, s, g) : i(t, s)) || g);
  794. return c > 3 && g && Object.defineProperty(t, s, g),
  795. g
  796. }
  797. , _ = this && this.__param || function (o, t) {
  798. return function (s, e) {
  799. t(s, e, o)
  800. }
  801. }
  802. ;
  803. Object.defineProperty(r, "__esModule", {
  804. value: !0
  805. }),
  806. r.OscLinkProvider = void 0;
  807. const h = a(511)
  808. , f = a(2585);
  809. let d = class {
  810. constructor(o, t, s) {
  811. this._bufferService = o,
  812. this._optionsService = t,
  813. this._oscLinkService = s
  814. }
  815. provideLinks(o, t) {
  816. var s;
  817. const e = this._bufferService.buffer.lines.get(o - 1);
  818. if (!e)
  819. return void t(void 0);
  820. const i = []
  821. , c = this._optionsService.rawOptions.linkHandler
  822. , g = new h.CellData
  823. , v = e.getTrimmedLength();
  824. let S = -1
  825. , u = -1
  826. , m = !1;
  827. for (let w = 0; w < v; w++)
  828. if (u !== -1 || e.hasContent(w)) {
  829. if (e.loadCell(w, g),
  830. g.hasExtendedAttrs() && g.extended.urlId) {
  831. if (u === -1) {
  832. u = w,
  833. S = g.extended.urlId;
  834. continue
  835. }
  836. m = g.extended.urlId !== S
  837. } else
  838. u !== -1 && (m = !0);
  839. if (m || u !== -1 && w === v - 1) {
  840. const R = (s = this._oscLinkService.getLinkData(S)) === null || s === void 0 ? void 0 : s.uri;
  841. if (R) {
  842. const L = {
  843. start: {
  844. x: u + 1,
  845. y: o
  846. },
  847. end: {
  848. x: w + (m || w !== v - 1 ? 0 : 1),
  849. y: o
  850. }
  851. };
  852. i.push({
  853. text: R,
  854. range: L,
  855. activate: (p, C) => c ? c.activate(p, C, L) : l(0, C),
  856. hover: (p, C) => {
  857. var b;
  858. return (b = c == null ? void 0 : c.hover) === null || b === void 0 ? void 0 : b.call(c, p, C, L)
  859. }
  860. ,
  861. leave: (p, C) => {
  862. var b;
  863. return (b = c == null ? void 0 : c.leave) === null || b === void 0 ? void 0 : b.call(c, p, C, L)
  864. }
  865. })
  866. }
  867. m = !1,
  868. g.hasExtendedAttrs() && g.extended.urlId ? (u = w,
  869. S = g.extended.urlId) : (u = -1,
  870. S = -1)
  871. }
  872. }
  873. t(i)
  874. }
  875. }
  876. ;
  877. function l(o, t) {
  878. if (confirm(`Do you want to navigate to ${t}?`)) {
  879. const s = window.open();
  880. if (s) {
  881. try {
  882. s.opener = null
  883. } catch { }
  884. s.location.href = t
  885. } else
  886. console.warn("Opening link blocked as opener could not be cleared")
  887. }
  888. }
  889. d = n([_(0, f.IBufferService), _(1, f.IOptionsService), _(2, f.IOscLinkService)], d),
  890. r.OscLinkProvider = d
  891. },
  892. 6193: (x, r) => {
  893. Object.defineProperty(r, "__esModule", {
  894. value: !0
  895. }),
  896. r.RenderDebouncer = void 0,
  897. r.RenderDebouncer = class {
  898. constructor(a, n) {
  899. this._parentWindow = a,
  900. this._renderCallback = n,
  901. this._refreshCallbacks = []
  902. }
  903. dispose() {
  904. this._animationFrame && (this._parentWindow.cancelAnimationFrame(this._animationFrame),
  905. this._animationFrame = void 0)
  906. }
  907. addRefreshCallback(a) {
  908. return this._refreshCallbacks.push(a),
  909. this._animationFrame || (this._animationFrame = this._parentWindow.requestAnimationFrame(() => this._innerRefresh())),
  910. this._animationFrame
  911. }
  912. refresh(a, n, _) {
  913. this._rowCount = _,
  914. a = a !== void 0 ? a : 0,
  915. n = n !== void 0 ? n : this._rowCount - 1,
  916. this._rowStart = this._rowStart !== void 0 ? Math.min(this._rowStart, a) : a,
  917. this._rowEnd = this._rowEnd !== void 0 ? Math.max(this._rowEnd, n) : n,
  918. this._animationFrame || (this._animationFrame = this._parentWindow.requestAnimationFrame(() => this._innerRefresh()))
  919. }
  920. _innerRefresh() {
  921. if (this._animationFrame = void 0,
  922. this._rowStart === void 0 || this._rowEnd === void 0 || this._rowCount === void 0)
  923. return void this._runRefreshCallbacks();
  924. const a = Math.max(this._rowStart, 0)
  925. , n = Math.min(this._rowEnd, this._rowCount - 1);
  926. this._rowStart = void 0,
  927. this._rowEnd = void 0,
  928. this._renderCallback(a, n),
  929. this._runRefreshCallbacks()
  930. }
  931. _runRefreshCallbacks() {
  932. for (const a of this._refreshCallbacks)
  933. a(0);
  934. this._refreshCallbacks = []
  935. }
  936. }
  937. }
  938. ,
  939. 5596: (x, r, a) => {
  940. Object.defineProperty(r, "__esModule", {
  941. value: !0
  942. }),
  943. r.ScreenDprMonitor = void 0;
  944. const n = a(844);
  945. class _ extends n.Disposable {
  946. constructor(f) {
  947. super(),
  948. this._parentWindow = f,
  949. this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio
  950. }
  951. setListener(f) {
  952. this._listener && this.clearListener(),
  953. this._listener = f,
  954. this._outerListener = () => {
  955. this._listener && (this._listener(this._parentWindow.devicePixelRatio, this._currentDevicePixelRatio),
  956. this._updateDpr())
  957. }
  958. ,
  959. this._updateDpr()
  960. }
  961. dispose() {
  962. super.dispose(),
  963. this.clearListener()
  964. }
  965. _updateDpr() {
  966. var f;
  967. this._outerListener && ((f = this._resolutionMediaMatchList) === null || f === void 0 || f.removeListener(this._outerListener),
  968. this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio,
  969. this._resolutionMediaMatchList = this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),
  970. this._resolutionMediaMatchList.addListener(this._outerListener))
  971. }
  972. clearListener() {
  973. this._resolutionMediaMatchList && this._listener && this._outerListener && (this._resolutionMediaMatchList.removeListener(this._outerListener),
  974. this._resolutionMediaMatchList = void 0,
  975. this._listener = void 0,
  976. this._outerListener = void 0)
  977. }
  978. }
  979. r.ScreenDprMonitor = _
  980. }
  981. ,
  982. 3236: (x, r, a) => {
  983. Object.defineProperty(r, "__esModule", {
  984. value: !0
  985. }),
  986. r.Terminal = void 0;
  987. const n = a(2950)
  988. , _ = a(1680)
  989. , h = a(3614)
  990. , f = a(2584)
  991. , d = a(5435)
  992. , l = a(9312)
  993. , o = a(6114)
  994. , t = a(3656)
  995. , s = a(9042)
  996. , e = a(4567)
  997. , i = a(1296)
  998. , c = a(7399)
  999. , g = a(8460)
  1000. , v = a(8437)
  1001. , S = a(5680)
  1002. , u = a(3230)
  1003. , m = a(4725)
  1004. , w = a(428)
  1005. , R = a(8934)
  1006. , L = a(6465)
  1007. , p = a(5114)
  1008. , C = a(8969)
  1009. , b = a(8055)
  1010. , E = a(4269)
  1011. , A = a(5941)
  1012. , H = a(3107)
  1013. , j = a(5744)
  1014. , $ = a(9074)
  1015. , P = a(2585)
  1016. , N = a(2962)
  1017. , y = typeof window < "u" ? window.document : null;
  1018. class T extends C.CoreTerminal {
  1019. constructor(k = {}) {
  1020. super(k),
  1021. this.browser = o,
  1022. this._keyDownHandled = !1,
  1023. this._keyDownSeen = !1,
  1024. this._keyPressHandled = !1,
  1025. this._unprocessedDeadKey = !1,
  1026. this._onCursorMove = new g.EventEmitter,
  1027. this._onKey = new g.EventEmitter,
  1028. this._onRender = new g.EventEmitter,
  1029. this._onSelectionChange = new g.EventEmitter,
  1030. this._onTitleChange = new g.EventEmitter,
  1031. this._onBell = new g.EventEmitter,
  1032. this._onFocus = new g.EventEmitter,
  1033. this._onBlur = new g.EventEmitter,
  1034. this._onA11yCharEmitter = new g.EventEmitter,
  1035. this._onA11yTabEmitter = new g.EventEmitter,
  1036. this._setup(),
  1037. this.linkifier2 = this.register(this._instantiationService.createInstance(L.Linkifier2)),
  1038. this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(N.OscLinkProvider)),
  1039. this._decorationService = this._instantiationService.createInstance($.DecorationService),
  1040. this._instantiationService.setService(P.IDecorationService, this._decorationService),
  1041. this.register(this._inputHandler.onRequestBell(() => this._onBell.fire())),
  1042. this.register(this._inputHandler.onRequestRefreshRows((D, B) => this.refresh(D, B))),
  1043. this.register(this._inputHandler.onRequestSendFocus(() => this._reportFocus())),
  1044. this.register(this._inputHandler.onRequestReset(() => this.reset())),
  1045. this.register(this._inputHandler.onRequestWindowsOptionsReport(D => this._reportWindowsOptions(D))),
  1046. this.register(this._inputHandler.onColor(D => this._handleColorEvent(D))),
  1047. this.register((0,
  1048. g.forwardEvent)(this._inputHandler.onCursorMove, this._onCursorMove)),
  1049. this.register((0,
  1050. g.forwardEvent)(this._inputHandler.onTitleChange, this._onTitleChange)),
  1051. this.register((0,
  1052. g.forwardEvent)(this._inputHandler.onA11yChar, this._onA11yCharEmitter)),
  1053. this.register((0,
  1054. g.forwardEvent)(this._inputHandler.onA11yTab, this._onA11yTabEmitter)),
  1055. this.register(this._bufferService.onResize(D => this._afterResize(D.cols, D.rows)))
  1056. }
  1057. get onCursorMove() {
  1058. return this._onCursorMove.event
  1059. }
  1060. get onKey() {
  1061. return this._onKey.event
  1062. }
  1063. get onRender() {
  1064. return this._onRender.event
  1065. }
  1066. get onSelectionChange() {
  1067. return this._onSelectionChange.event
  1068. }
  1069. get onTitleChange() {
  1070. return this._onTitleChange.event
  1071. }
  1072. get onBell() {
  1073. return this._onBell.event
  1074. }
  1075. get onFocus() {
  1076. return this._onFocus.event
  1077. }
  1078. get onBlur() {
  1079. return this._onBlur.event
  1080. }
  1081. get onA11yChar() {
  1082. return this._onA11yCharEmitter.event
  1083. }
  1084. get onA11yTab() {
  1085. return this._onA11yTabEmitter.event
  1086. }
  1087. _handleColorEvent(k) {
  1088. var D, B;
  1089. if (this._colorManager) {
  1090. for (const I of k) {
  1091. let F, M = "";
  1092. switch (I.index) {
  1093. case 256:
  1094. F = "foreground",
  1095. M = "10";
  1096. break;
  1097. case 257:
  1098. F = "background",
  1099. M = "11";
  1100. break;
  1101. case 258:
  1102. F = "cursor",
  1103. M = "12";
  1104. break;
  1105. default:
  1106. F = "ansi",
  1107. M = "4;" + I.index
  1108. }
  1109. switch (I.type) {
  1110. case 0:
  1111. const X = b.color.toColorRGB(F === "ansi" ? this._colorManager.colors.ansi[I.index] : this._colorManager.colors[F]);
  1112. this.coreService.triggerDataEvent(`${f.C0.ESC}]${M};${(0,
  1113. A.toRgbString)(X)}${f.C1_ESCAPED.ST}`);
  1114. break;
  1115. case 1:
  1116. F === "ansi" ? this._colorManager.colors.ansi[I.index] = b.rgba.toColor(...I.color) : this._colorManager.colors[F] = b.rgba.toColor(...I.color);
  1117. break;
  1118. case 2:
  1119. this._colorManager.restoreColor(I.index)
  1120. }
  1121. }
  1122. (D = this._renderService) === null || D === void 0 || D.setColors(this._colorManager.colors),
  1123. (B = this.viewport) === null || B === void 0 || B.onThemeChange(this._colorManager.colors)
  1124. }
  1125. }
  1126. dispose() {
  1127. var k, D, B;
  1128. this._isDisposed || (super.dispose(),
  1129. (k = this._renderService) === null || k === void 0 || k.dispose(),
  1130. this._customKeyEventHandler = void 0,
  1131. this.write = () => { }
  1132. ,
  1133. (B = (D = this.element) === null || D === void 0 ? void 0 : D.parentNode) === null || B === void 0 || B.removeChild(this.element))
  1134. }
  1135. _setup() {
  1136. super._setup(),
  1137. this._customKeyEventHandler = void 0
  1138. }
  1139. get buffer() {
  1140. return this.buffers.active
  1141. }
  1142. focus() {
  1143. this.textarea && this.textarea.focus({
  1144. preventScroll: !0
  1145. })
  1146. }
  1147. _updateOptions(k) {
  1148. var D, B, I, F;
  1149. switch (super._updateOptions(k),
  1150. k) {
  1151. case "fontFamily":
  1152. case "fontSize":
  1153. (D = this._renderService) === null || D === void 0 || D.clear(),
  1154. (B = this._charSizeService) === null || B === void 0 || B.measure();
  1155. break;
  1156. case "cursorBlink":
  1157. case "cursorStyle":
  1158. this.refresh(this.buffer.y, this.buffer.y);
  1159. break;
  1160. case "customGlyphs":
  1161. case "drawBoldTextInBrightColors":
  1162. case "letterSpacing":
  1163. case "lineHeight":
  1164. case "fontWeight":
  1165. case "fontWeightBold":
  1166. case "minimumContrastRatio":
  1167. this._renderService && (this._renderService.clear(),
  1168. this._renderService.onResize(this.cols, this.rows),
  1169. this.refresh(0, this.rows - 1));
  1170. break;
  1171. case "scrollback":
  1172. (I = this.viewport) === null || I === void 0 || I.syncScrollArea();
  1173. break;
  1174. case "screenReaderMode":
  1175. this.optionsService.rawOptions.screenReaderMode ? !this._accessibilityManager && this._renderService && (this._accessibilityManager = new e.AccessibilityManager(this, this._renderService)) : ((F = this._accessibilityManager) === null || F === void 0 || F.dispose(),
  1176. this._accessibilityManager = void 0);
  1177. break;
  1178. case "tabStopWidth":
  1179. this.buffers.setupTabStops();
  1180. break;
  1181. case "theme":
  1182. this._setTheme(this.optionsService.rawOptions.theme)
  1183. }
  1184. }
  1185. _onTextAreaFocus(k) {
  1186. this.coreService.decPrivateModes.sendFocus && this.coreService.triggerDataEvent(f.C0.ESC + "[I"),
  1187. this.updateCursorStyle(k),
  1188. this.element.classList.add("focus"),
  1189. this._showCursor(),
  1190. this._onFocus.fire()
  1191. }
  1192. blur() {
  1193. var k;
  1194. return (k = this.textarea) === null || k === void 0 ? void 0 : k.blur()
  1195. }
  1196. _onTextAreaBlur() {
  1197. this.textarea.value = "",
  1198. this.refresh(this.buffer.y, this.buffer.y),
  1199. this.coreService.decPrivateModes.sendFocus && this.coreService.triggerDataEvent(f.C0.ESC + "[O"),
  1200. this.element.classList.remove("focus"),
  1201. this._onBlur.fire()
  1202. }
  1203. _syncTextArea() {
  1204. if (!this.textarea || !this.buffer.isCursorInViewport || this._compositionHelper.isComposing || !this._renderService)
  1205. return;
  1206. const k = this.buffer.ybase + this.buffer.y
  1207. , D = this.buffer.lines.get(k);
  1208. if (!D)
  1209. return;
  1210. const B = Math.min(this.buffer.x, this.cols - 1)
  1211. , I = this._renderService.dimensions.actualCellHeight
  1212. , F = D.getWidth(B)
  1213. , M = this._renderService.dimensions.actualCellWidth * F
  1214. , X = this.buffer.y * this._renderService.dimensions.actualCellHeight
  1215. , K = B * this._renderService.dimensions.actualCellWidth;
  1216. this.textarea.style.left = K + "px",
  1217. this.textarea.style.top = X + "px",
  1218. this.textarea.style.width = M + "px",
  1219. this.textarea.style.height = I + "px",
  1220. this.textarea.style.lineHeight = I + "px",
  1221. this.textarea.style.zIndex = "-5"
  1222. }
  1223. _initGlobal() {
  1224. this._bindKeys(),
  1225. this.register((0,
  1226. t.addDisposableDomListener)(this.element, "copy", D => {
  1227. this.hasSelection() && (0,
  1228. h.copyHandler)(D, this._selectionService)
  1229. }
  1230. ));
  1231. const k = D => (0,
  1232. h.handlePasteEvent)(D, this.textarea, this.coreService);
  1233. this.register((0,
  1234. t.addDisposableDomListener)(this.textarea, "paste", k)),
  1235. this.register((0,
  1236. t.addDisposableDomListener)(this.element, "paste", k)),
  1237. o.isFirefox ? this.register((0,
  1238. t.addDisposableDomListener)(this.element, "mousedown", D => {
  1239. D.button === 2 && (0,
  1240. h.rightClickHandler)(D, this.textarea, this.screenElement, this._selectionService, this.options.rightClickSelectsWord)
  1241. }
  1242. )) : this.register((0,
  1243. t.addDisposableDomListener)(this.element, "contextmenu", D => {
  1244. (0,
  1245. h.rightClickHandler)(D, this.textarea, this.screenElement, this._selectionService, this.options.rightClickSelectsWord)
  1246. }
  1247. )),
  1248. o.isLinux && this.register((0,
  1249. t.addDisposableDomListener)(this.element, "auxclick", D => {
  1250. D.button === 1 && (0,
  1251. h.moveTextAreaUnderMouseCursor)(D, this.textarea, this.screenElement)
  1252. }
  1253. ))
  1254. }
  1255. _bindKeys() {
  1256. this.register((0,
  1257. t.addDisposableDomListener)(this.textarea, "keyup", k => this._keyUp(k), !0)),
  1258. this.register((0,
  1259. t.addDisposableDomListener)(this.textarea, "keydown", k => this._keyDown(k), !0)),
  1260. this.register((0,
  1261. t.addDisposableDomListener)(this.textarea, "keypress", k => this._keyPress(k), !0)),
  1262. this.register((0,
  1263. t.addDisposableDomListener)(this.textarea, "compositionstart", () => this._compositionHelper.compositionstart())),
  1264. this.register((0,
  1265. t.addDisposableDomListener)(this.textarea, "compositionupdate", k => this._compositionHelper.compositionupdate(k))),
  1266. this.register((0,
  1267. t.addDisposableDomListener)(this.textarea, "compositionend", () => this._compositionHelper.compositionend())),
  1268. this.register((0,
  1269. t.addDisposableDomListener)(this.textarea, "input", k => this._inputEvent(k), !0)),
  1270. this.register(this.onRender(() => this._compositionHelper.updateCompositionElements()))
  1271. }
  1272. open(k) {
  1273. var D;
  1274. if (!k)
  1275. throw new Error("Terminal requires a parent element.");
  1276. k.isConnected || this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),
  1277. this._document = k.ownerDocument,
  1278. this.element = this._document.createElement("div"),
  1279. this.element.dir = "ltr",
  1280. this.element.classList.add("terminal"),
  1281. this.element.classList.add("xterm"),
  1282. this.element.setAttribute("tabindex", "0"),
  1283. k.appendChild(this.element);
  1284. const B = y.createDocumentFragment();
  1285. this._viewportElement = y.createElement("div"),
  1286. this._viewportElement.classList.add("xterm-viewport"),
  1287. B.appendChild(this._viewportElement),
  1288. this._viewportScrollArea = y.createElement("div"),
  1289. this._viewportScrollArea.classList.add("xterm-scroll-area"),
  1290. this._viewportElement.appendChild(this._viewportScrollArea),
  1291. this.screenElement = y.createElement("div"),
  1292. this.screenElement.classList.add("xterm-screen"),
  1293. this._helperContainer = y.createElement("div"),
  1294. this._helperContainer.classList.add("xterm-helpers"),
  1295. this.screenElement.appendChild(this._helperContainer),
  1296. B.appendChild(this.screenElement),
  1297. this.textarea = y.createElement("textarea"),
  1298. this.textarea.classList.add("xterm-helper-textarea"),
  1299. this.textarea.setAttribute("aria-label", s.promptLabel),
  1300. this.textarea.setAttribute("aria-multiline", "false"),
  1301. this.textarea.setAttribute("autocorrect", "off"),
  1302. this.textarea.setAttribute("autocapitalize", "off"),
  1303. this.textarea.setAttribute("spellcheck", "false"),
  1304. this.textarea.tabIndex = 0,
  1305. this.register((0,
  1306. t.addDisposableDomListener)(this.textarea, "focus", F => this._onTextAreaFocus(F))),
  1307. this.register((0,
  1308. t.addDisposableDomListener)(this.textarea, "blur", () => this._onTextAreaBlur())),
  1309. this._helperContainer.appendChild(this.textarea),
  1310. this._coreBrowserService = this._instantiationService.createInstance(p.CoreBrowserService, this.textarea, (D = this._document.defaultView) !== null && D !== void 0 ? D : window),
  1311. this._instantiationService.setService(m.ICoreBrowserService, this._coreBrowserService),
  1312. this._charSizeService = this._instantiationService.createInstance(w.CharSizeService, this._document, this._helperContainer),
  1313. this._instantiationService.setService(m.ICharSizeService, this._charSizeService),
  1314. this._theme = this.options.theme || this._theme,
  1315. this._colorManager = new S.ColorManager(y, this.options.allowTransparency),
  1316. this.register(this.optionsService.onOptionChange(F => this._colorManager.onOptionsChange(F, this.optionsService.rawOptions[F]))),
  1317. this._colorManager.setTheme(this._theme),
  1318. this._characterJoinerService = this._instantiationService.createInstance(E.CharacterJoinerService),
  1319. this._instantiationService.setService(m.ICharacterJoinerService, this._characterJoinerService);
  1320. const I = this._createRenderer();
  1321. this._renderService = this.register(this._instantiationService.createInstance(u.RenderService, I, this.rows, this.screenElement)),
  1322. this._instantiationService.setService(m.IRenderService, this._renderService),
  1323. this.register(this._renderService.onRenderedViewportChange(F => this._onRender.fire(F))),
  1324. this.onResize(F => this._renderService.resize(F.cols, F.rows)),
  1325. this._compositionView = y.createElement("div"),
  1326. this._compositionView.classList.add("composition-view"),
  1327. this._compositionHelper = this._instantiationService.createInstance(n.CompositionHelper, this.textarea, this._compositionView),
  1328. this._helperContainer.appendChild(this._compositionView),
  1329. this.element.appendChild(B),
  1330. this._mouseService = this._instantiationService.createInstance(R.MouseService),
  1331. this._instantiationService.setService(m.IMouseService, this._mouseService),
  1332. this.viewport = this._instantiationService.createInstance(_.Viewport, F => this.scrollLines(F, !0, 1), this._viewportElement, this._viewportScrollArea, this.element),
  1333. this.viewport.onThemeChange(this._colorManager.colors),
  1334. this.register(this._inputHandler.onRequestSyncScrollBar(() => this.viewport.syncScrollArea())),
  1335. this.register(this.viewport),
  1336. this.register(this.onCursorMove(() => {
  1337. this._renderService.onCursorMove(),
  1338. this._syncTextArea()
  1339. }
  1340. )),
  1341. this.register(this.onResize(() => this._renderService.onResize(this.cols, this.rows))),
  1342. this.register(this.onBlur(() => this._renderService.onBlur())),
  1343. this.register(this.onFocus(() => this._renderService.onFocus())),
  1344. this.register(this._renderService.onDimensionsChange(() => this.viewport.syncScrollArea())),
  1345. this._selectionService = this.register(this._instantiationService.createInstance(l.SelectionService, this.element, this.screenElement, this.linkifier2)),
  1346. this._instantiationService.setService(m.ISelectionService, this._selectionService),
  1347. this.register(this._selectionService.onRequestScrollLines(F => this.scrollLines(F.amount, F.suppressScrollEvent))),
  1348. this.register(this._selectionService.onSelectionChange(() => this._onSelectionChange.fire())),
  1349. this.register(this._selectionService.onRequestRedraw(F => this._renderService.onSelectionChanged(F.start, F.end, F.columnSelectMode))),
  1350. this.register(this._selectionService.onLinuxMouseSelection(F => {
  1351. this.textarea.value = F,
  1352. this.textarea.focus(),
  1353. this.textarea.select()
  1354. }
  1355. )),
  1356. this.register(this._onScroll.event(F => {
  1357. this.viewport.syncScrollArea(),
  1358. this._selectionService.refresh()
  1359. }
  1360. )),
  1361. this.register((0,
  1362. t.addDisposableDomListener)(this._viewportElement, "scroll", () => this._selectionService.refresh())),
  1363. this.linkifier2.attachToDom(this.screenElement, this._mouseService, this._renderService),
  1364. this.register(this._instantiationService.createInstance(H.BufferDecorationRenderer, this.screenElement)),
  1365. this.register((0,
  1366. t.addDisposableDomListener)(this.element, "mousedown", F => this._selectionService.onMouseDown(F))),
  1367. this.coreMouseService.areMouseEventsActive ? (this._selectionService.disable(),
  1368. this.element.classList.add("enable-mouse-events")) : this._selectionService.enable(),
  1369. this.options.screenReaderMode && (this._accessibilityManager = new e.AccessibilityManager(this, this._renderService)),
  1370. this.options.overviewRulerWidth && (this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(j.OverviewRulerRenderer, this._viewportElement, this.screenElement))),
  1371. this.optionsService.onOptionChange(() => {
  1372. !this._overviewRulerRenderer && this.options.overviewRulerWidth && this._viewportElement && this.screenElement && (this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(j.OverviewRulerRenderer, this._viewportElement, this.screenElement)))
  1373. }
  1374. ),
  1375. this._charSizeService.measure(),
  1376. this.refresh(0, this.rows - 1),
  1377. this._initGlobal(),
  1378. this.bindMouse()
  1379. }
  1380. _createRenderer() {
  1381. return this._instantiationService.createInstance(i.DomRenderer, this._colorManager.colors, this.element, this.screenElement, this._viewportElement, this.linkifier2)
  1382. }
  1383. _setTheme(k) {
  1384. var D, B, I;
  1385. this._theme = k,
  1386. (D = this._colorManager) === null || D === void 0 || D.setTheme(k),
  1387. (B = this._renderService) === null || B === void 0 || B.setColors(this._colorManager.colors),
  1388. (I = this.viewport) === null || I === void 0 || I.onThemeChange(this._colorManager.colors)
  1389. }
  1390. bindMouse() {
  1391. const k = this
  1392. , D = this.element;
  1393. function B(M) {
  1394. const X = k._mouseService.getMouseReportCoords(M, k.screenElement);
  1395. if (!X)
  1396. return !1;
  1397. let K, Z;
  1398. switch (M.overrideType || M.type) {
  1399. case "mousemove":
  1400. Z = 32,
  1401. M.buttons === void 0 ? (K = 3,
  1402. M.button !== void 0 && (K = M.button < 3 ? M.button : 3)) : K = 1 & M.buttons ? 0 : 4 & M.buttons ? 1 : 2 & M.buttons ? 2 : 3;
  1403. break;
  1404. case "mouseup":
  1405. Z = 0,
  1406. K = M.button < 3 ? M.button : 3;
  1407. break;
  1408. case "mousedown":
  1409. Z = 1,
  1410. K = M.button < 3 ? M.button : 3;
  1411. break;
  1412. case "wheel":
  1413. if (k.viewport.getLinesScrolled(M) === 0)
  1414. return !1;
  1415. Z = M.deltaY < 0 ? 0 : 1,
  1416. K = 4;
  1417. break;
  1418. default:
  1419. return !1
  1420. }
  1421. return !(Z === void 0 || K === void 0 || K > 4) && k.coreMouseService.triggerMouseEvent({
  1422. col: X.col,
  1423. row: X.row,
  1424. x: X.x,
  1425. y: X.y,
  1426. button: K,
  1427. action: Z,
  1428. ctrl: M.ctrlKey,
  1429. alt: M.altKey,
  1430. shift: M.shiftKey
  1431. })
  1432. }
  1433. const I = {
  1434. mouseup: null,
  1435. wheel: null,
  1436. mousedrag: null,
  1437. mousemove: null
  1438. }
  1439. , F = {
  1440. mouseup: M => (B(M),
  1441. M.buttons || (this._document.removeEventListener("mouseup", I.mouseup),
  1442. I.mousedrag && this._document.removeEventListener("mousemove", I.mousedrag)),
  1443. this.cancel(M)),
  1444. wheel: M => (B(M),
  1445. this.cancel(M, !0)),
  1446. mousedrag: M => {
  1447. M.buttons && B(M)
  1448. }
  1449. ,
  1450. mousemove: M => {
  1451. M.buttons || B(M)
  1452. }
  1453. };
  1454. this.register(this.coreMouseService.onProtocolChange(M => {
  1455. M ? (this.optionsService.rawOptions.logLevel === "debug" && this._logService.debug("Binding to mouse events:", this.coreMouseService.explainEvents(M)),
  1456. this.element.classList.add("enable-mouse-events"),
  1457. this._selectionService.disable()) : (this._logService.debug("Unbinding from mouse events."),
  1458. this.element.classList.remove("enable-mouse-events"),
  1459. this._selectionService.enable()),
  1460. 8 & M ? I.mousemove || (D.addEventListener("mousemove", F.mousemove),
  1461. I.mousemove = F.mousemove) : (D.removeEventListener("mousemove", I.mousemove),
  1462. I.mousemove = null),
  1463. 16 & M ? I.wheel || (D.addEventListener("wheel", F.wheel, {
  1464. passive: !1
  1465. }),
  1466. I.wheel = F.wheel) : (D.removeEventListener("wheel", I.wheel),
  1467. I.wheel = null),
  1468. 2 & M ? I.mouseup || (I.mouseup = F.mouseup) : (this._document.removeEventListener("mouseup", I.mouseup),
  1469. I.mouseup = null),
  1470. 4 & M ? I.mousedrag || (I.mousedrag = F.mousedrag) : (this._document.removeEventListener("mousemove", I.mousedrag),
  1471. I.mousedrag = null)
  1472. }
  1473. )),
  1474. this.coreMouseService.activeProtocol = this.coreMouseService.activeProtocol,
  1475. this.register((0,
  1476. t.addDisposableDomListener)(D, "mousedown", M => {
  1477. if (M.preventDefault(),
  1478. this.focus(),
  1479. this.coreMouseService.areMouseEventsActive && !this._selectionService.shouldForceSelection(M))
  1480. return B(M),
  1481. I.mouseup && this._document.addEventListener("mouseup", I.mouseup),
  1482. I.mousedrag && this._document.addEventListener("mousemove", I.mousedrag),
  1483. this.cancel(M)
  1484. }
  1485. )),
  1486. this.register((0,
  1487. t.addDisposableDomListener)(D, "wheel", M => {
  1488. if (!I.wheel) {
  1489. if (!this.buffer.hasScrollback) {
  1490. const X = this.viewport.getLinesScrolled(M);
  1491. if (X === 0)
  1492. return;
  1493. const K = f.C0.ESC + (this.coreService.decPrivateModes.applicationCursorKeys ? "O" : "[") + (M.deltaY < 0 ? "A" : "B");
  1494. let Z = "";
  1495. for (let ve = 0; ve < Math.abs(X); ve++)
  1496. Z += K;
  1497. return this.coreService.triggerDataEvent(Z, !0),
  1498. this.cancel(M, !0)
  1499. }
  1500. return this.viewport.onWheel(M) ? this.cancel(M) : void 0
  1501. }
  1502. }
  1503. , {
  1504. passive: !1
  1505. })),
  1506. this.register((0,
  1507. t.addDisposableDomListener)(D, "touchstart", M => {
  1508. if (!this.coreMouseService.areMouseEventsActive)
  1509. return this.viewport.onTouchStart(M),
  1510. this.cancel(M)
  1511. }
  1512. , {
  1513. passive: !0
  1514. })),
  1515. this.register((0,
  1516. t.addDisposableDomListener)(D, "touchmove", M => {
  1517. if (!this.coreMouseService.areMouseEventsActive)
  1518. return this.viewport.onTouchMove(M) ? void 0 : this.cancel(M)
  1519. }
  1520. , {
  1521. passive: !1
  1522. }))
  1523. }
  1524. refresh(k, D) {
  1525. var B;
  1526. (B = this._renderService) === null || B === void 0 || B.refreshRows(k, D)
  1527. }
  1528. updateCursorStyle(k) {
  1529. var D;
  1530. !((D = this._selectionService) === null || D === void 0) && D.shouldColumnSelect(k) ? this.element.classList.add("column-select") : this.element.classList.remove("column-select")
  1531. }
  1532. _showCursor() {
  1533. this.coreService.isCursorInitialized || (this.coreService.isCursorInitialized = !0,
  1534. this.refresh(this.buffer.y, this.buffer.y))
  1535. }
  1536. scrollLines(k, D, B = 0) {
  1537. super.scrollLines(k, D, B),
  1538. this.refresh(0, this.rows - 1)
  1539. }
  1540. paste(k) {
  1541. (0,
  1542. h.paste)(k, this.textarea, this.coreService)
  1543. }
  1544. attachCustomKeyEventHandler(k) {
  1545. this._customKeyEventHandler = k
  1546. }
  1547. registerLinkProvider(k) {
  1548. return this.linkifier2.registerLinkProvider(k)
  1549. }
  1550. registerCharacterJoiner(k) {
  1551. if (!this._characterJoinerService)
  1552. throw new Error("Terminal must be opened first");
  1553. const D = this._characterJoinerService.register(k);
  1554. return this.refresh(0, this.rows - 1),
  1555. D
  1556. }
  1557. deregisterCharacterJoiner(k) {
  1558. if (!this._characterJoinerService)
  1559. throw new Error("Terminal must be opened first");
  1560. this._characterJoinerService.deregister(k) && this.refresh(0, this.rows - 1)
  1561. }
  1562. get markers() {
  1563. return this.buffer.markers
  1564. }
  1565. addMarker(k) {
  1566. return this.buffer.addMarker(this.buffer.ybase + this.buffer.y + k)
  1567. }
  1568. registerDecoration(k) {
  1569. return this._decorationService.registerDecoration(k)
  1570. }
  1571. hasSelection() {
  1572. return !!this._selectionService && this._selectionService.hasSelection
  1573. }
  1574. select(k, D, B) {
  1575. this._selectionService.setSelection(k, D, B)
  1576. }
  1577. getSelection() {
  1578. return this._selectionService ? this._selectionService.selectionText : ""
  1579. }
  1580. getSelectionPosition() {
  1581. if (this._selectionService && this._selectionService.hasSelection)
  1582. return {
  1583. start: {
  1584. x: this._selectionService.selectionStart[0],
  1585. y: this._selectionService.selectionStart[1]
  1586. },
  1587. end: {
  1588. x: this._selectionService.selectionEnd[0],
  1589. y: this._selectionService.selectionEnd[1]
  1590. }
  1591. }
  1592. }
  1593. clearSelection() {
  1594. var k;
  1595. (k = this._selectionService) === null || k === void 0 || k.clearSelection()
  1596. }
  1597. selectAll() {
  1598. var k;
  1599. (k = this._selectionService) === null || k === void 0 || k.selectAll()
  1600. }
  1601. selectLines(k, D) {
  1602. var B;
  1603. (B = this._selectionService) === null || B === void 0 || B.selectLines(k, D)
  1604. }
  1605. _keyDown(k) {
  1606. if (this._keyDownHandled = !1,
  1607. this._keyDownSeen = !0,
  1608. this._customKeyEventHandler && this._customKeyEventHandler(k) === !1)
  1609. return !1;
  1610. const D = this.browser.isMac && this.options.macOptionIsMeta && k.altKey;
  1611. if (!D && !this._compositionHelper.keydown(k))
  1612. return this.buffer.ybase !== this.buffer.ydisp && this._bufferService.scrollToBottom(),
  1613. !1;
  1614. D || k.key !== "Dead" && k.key !== "AltGraph" || (this._unprocessedDeadKey = !0);
  1615. const B = (0,
  1616. c.evaluateKeyboardEvent)(k, this.coreService.decPrivateModes.applicationCursorKeys, this.browser.isMac, this.options.macOptionIsMeta);
  1617. if (this.updateCursorStyle(k),
  1618. B.type === 3 || B.type === 2) {
  1619. const I = this.rows - 1;
  1620. return this.scrollLines(B.type === 2 ? -I : I),
  1621. this.cancel(k, !0)
  1622. }
  1623. return B.type === 1 && this.selectAll(),
  1624. !!this._isThirdLevelShift(this.browser, k) || (B.cancel && this.cancel(k, !0),
  1625. !B.key || !!(k.key && !k.ctrlKey && !k.altKey && !k.metaKey && k.key.length === 1 && k.key.charCodeAt(0) >= 65 && k.key.charCodeAt(0) <= 90) || (this._unprocessedDeadKey ? (this._unprocessedDeadKey = !1,
  1626. !0) : (B.key !== f.C0.ETX && B.key !== f.C0.CR || (this.textarea.value = ""),
  1627. this._onKey.fire({
  1628. key: B.key,
  1629. domEvent: k
  1630. }),
  1631. this._showCursor(),
  1632. this.coreService.triggerDataEvent(B.key, !0),
  1633. this.optionsService.rawOptions.screenReaderMode ? void (this._keyDownHandled = !0) : this.cancel(k, !0))))
  1634. }
  1635. _isThirdLevelShift(k, D) {
  1636. const B = k.isMac && !this.options.macOptionIsMeta && D.altKey && !D.ctrlKey && !D.metaKey || k.isWindows && D.altKey && D.ctrlKey && !D.metaKey || k.isWindows && D.getModifierState("AltGraph");
  1637. return D.type === "keypress" ? B : B && (!D.keyCode || D.keyCode > 47)
  1638. }
  1639. _keyUp(k) {
  1640. this._keyDownSeen = !1,
  1641. this._customKeyEventHandler && this._customKeyEventHandler(k) === !1 || (function (D) {
  1642. return D.keyCode === 16 || D.keyCode === 17 || D.keyCode === 18
  1643. }(k) || this.focus(),
  1644. this.updateCursorStyle(k),
  1645. this._keyPressHandled = !1)
  1646. }
  1647. _keyPress(k) {
  1648. let D;
  1649. if (this._keyPressHandled = !1,
  1650. this._keyDownHandled || this._customKeyEventHandler && this._customKeyEventHandler(k) === !1)
  1651. return !1;
  1652. if (this.cancel(k),
  1653. k.charCode)
  1654. D = k.charCode;
  1655. else if (k.which === null || k.which === void 0)
  1656. D = k.keyCode;
  1657. else {
  1658. if (k.which === 0 || k.charCode === 0)
  1659. return !1;
  1660. D = k.which
  1661. }
  1662. return !(!D || (k.altKey || k.ctrlKey || k.metaKey) && !this._isThirdLevelShift(this.browser, k) || (D = String.fromCharCode(D),
  1663. this._onKey.fire({
  1664. key: D,
  1665. domEvent: k
  1666. }),
  1667. this._showCursor(),
  1668. this.coreService.triggerDataEvent(D, !0),
  1669. this._keyPressHandled = !0,
  1670. this._unprocessedDeadKey = !1,
  1671. 0))
  1672. }
  1673. _inputEvent(k) {
  1674. if (k.data && k.inputType === "insertText" && (!k.composed || !this._keyDownSeen) && !this.optionsService.rawOptions.screenReaderMode) {
  1675. if (this._keyPressHandled)
  1676. return !1;
  1677. this._unprocessedDeadKey = !1;
  1678. const D = k.data;
  1679. return this.coreService.triggerDataEvent(D, !0),
  1680. this.cancel(k),
  1681. !0
  1682. }
  1683. return !1
  1684. }
  1685. resize(k, D) {
  1686. k !== this.cols || D !== this.rows ? super.resize(k, D) : this._charSizeService && !this._charSizeService.hasValidSize && this._charSizeService.measure()
  1687. }
  1688. _afterResize(k, D) {
  1689. var B, I;
  1690. (B = this._charSizeService) === null || B === void 0 || B.measure(),
  1691. (I = this.viewport) === null || I === void 0 || I.syncScrollArea(!0)
  1692. }
  1693. clear() {
  1694. if (this.buffer.ybase !== 0 || this.buffer.y !== 0) {
  1695. this.buffer.clearAllMarkers(),
  1696. this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)),
  1697. this.buffer.lines.length = 1,
  1698. this.buffer.ydisp = 0,
  1699. this.buffer.ybase = 0,
  1700. this.buffer.y = 0;
  1701. for (let k = 1; k < this.rows; k++)
  1702. this.buffer.lines.push(this.buffer.getBlankLine(v.DEFAULT_ATTR_DATA));
  1703. this.refresh(0, this.rows - 1),
  1704. this._onScroll.fire({
  1705. position: this.buffer.ydisp,
  1706. source: 0
  1707. })
  1708. }
  1709. }
  1710. reset() {
  1711. var k, D;
  1712. this.options.rows = this.rows,
  1713. this.options.cols = this.cols;
  1714. const B = this._customKeyEventHandler;
  1715. this._setup(),
  1716. super.reset(),
  1717. (k = this._selectionService) === null || k === void 0 || k.reset(),
  1718. this._decorationService.reset(),
  1719. this._customKeyEventHandler = B,
  1720. this.refresh(0, this.rows - 1),
  1721. (D = this.viewport) === null || D === void 0 || D.syncScrollArea()
  1722. }
  1723. clearTextureAtlas() {
  1724. var k;
  1725. (k = this._renderService) === null || k === void 0 || k.clearTextureAtlas()
  1726. }
  1727. _reportFocus() {
  1728. var k;
  1729. !((k = this.element) === null || k === void 0) && k.classList.contains("focus") ? this.coreService.triggerDataEvent(f.C0.ESC + "[I") : this.coreService.triggerDataEvent(f.C0.ESC + "[O")
  1730. }
  1731. _reportWindowsOptions(k) {
  1732. if (this._renderService)
  1733. switch (k) {
  1734. case d.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:
  1735. const D = this._renderService.dimensions.canvasWidth.toFixed(0)
  1736. , B = this._renderService.dimensions.canvasHeight.toFixed(0);
  1737. this.coreService.triggerDataEvent(`${f.C0.ESC}[4;${B};${D}t`);
  1738. break;
  1739. case d.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:
  1740. const I = this._renderService.dimensions.actualCellWidth.toFixed(0)
  1741. , F = this._renderService.dimensions.actualCellHeight.toFixed(0);
  1742. this.coreService.triggerDataEvent(`${f.C0.ESC}[6;${F};${I}t`)
  1743. }
  1744. }
  1745. cancel(k, D) {
  1746. if (this.options.cancelEvents || D)
  1747. return k.preventDefault(),
  1748. k.stopPropagation(),
  1749. !1
  1750. }
  1751. }
  1752. r.Terminal = T
  1753. }
  1754. ,
  1755. 9924: (x, r) => {
  1756. Object.defineProperty(r, "__esModule", {
  1757. value: !0
  1758. }),
  1759. r.TimeBasedDebouncer = void 0,
  1760. r.TimeBasedDebouncer = class {
  1761. constructor(a, n = 1e3) {
  1762. this._renderCallback = a,
  1763. this._debounceThresholdMS = n,
  1764. this._lastRefreshMs = 0,
  1765. this._additionalRefreshRequested = !1
  1766. }
  1767. dispose() {
  1768. this._refreshTimeoutID && clearTimeout(this._refreshTimeoutID)
  1769. }
  1770. refresh(a, n, _) {
  1771. this._rowCount = _,
  1772. a = a !== void 0 ? a : 0,
  1773. n = n !== void 0 ? n : this._rowCount - 1,
  1774. this._rowStart = this._rowStart !== void 0 ? Math.min(this._rowStart, a) : a,
  1775. this._rowEnd = this._rowEnd !== void 0 ? Math.max(this._rowEnd, n) : n;
  1776. const h = Date.now();
  1777. if (h - this._lastRefreshMs >= this._debounceThresholdMS)
  1778. this._lastRefreshMs = h,
  1779. this._innerRefresh();
  1780. else if (!this._additionalRefreshRequested) {
  1781. const f = h - this._lastRefreshMs
  1782. , d = this._debounceThresholdMS - f;
  1783. this._additionalRefreshRequested = !0,
  1784. this._refreshTimeoutID = window.setTimeout(() => {
  1785. this._lastRefreshMs = Date.now(),
  1786. this._innerRefresh(),
  1787. this._additionalRefreshRequested = !1,
  1788. this._refreshTimeoutID = void 0
  1789. }
  1790. , d)
  1791. }
  1792. }
  1793. _innerRefresh() {
  1794. if (this._rowStart === void 0 || this._rowEnd === void 0 || this._rowCount === void 0)
  1795. return;
  1796. const a = Math.max(this._rowStart, 0)
  1797. , n = Math.min(this._rowEnd, this._rowCount - 1);
  1798. this._rowStart = void 0,
  1799. this._rowEnd = void 0,
  1800. this._renderCallback(a, n)
  1801. }
  1802. }
  1803. }
  1804. ,
  1805. 1680: function (x, r, a) {
  1806. var n = this && this.__decorate || function (t, s, e, i) {
  1807. var c, g = arguments.length, v = g < 3 ? s : i === null ? i = Object.getOwnPropertyDescriptor(s, e) : i;
  1808. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  1809. v = Reflect.decorate(t, s, e, i);
  1810. else
  1811. for (var S = t.length - 1; S >= 0; S--)
  1812. (c = t[S]) && (v = (g < 3 ? c(v) : g > 3 ? c(s, e, v) : c(s, e)) || v);
  1813. return g > 3 && v && Object.defineProperty(s, e, v),
  1814. v
  1815. }
  1816. , _ = this && this.__param || function (t, s) {
  1817. return function (e, i) {
  1818. s(e, i, t)
  1819. }
  1820. }
  1821. ;
  1822. Object.defineProperty(r, "__esModule", {
  1823. value: !0
  1824. }),
  1825. r.Viewport = void 0;
  1826. const h = a(844)
  1827. , f = a(3656)
  1828. , d = a(4725)
  1829. , l = a(2585);
  1830. let o = class extends h.Disposable {
  1831. constructor(t, s, e, i, c, g, v, S, u) {
  1832. super(),
  1833. this._scrollLines = t,
  1834. this._viewportElement = s,
  1835. this._scrollArea = e,
  1836. this._element = i,
  1837. this._bufferService = c,
  1838. this._optionsService = g,
  1839. this._charSizeService = v,
  1840. this._renderService = S,
  1841. this._coreBrowserService = u,
  1842. this.scrollBarWidth = 0,
  1843. this._currentRowHeight = 0,
  1844. this._currentScaledCellHeight = 0,
  1845. this._lastRecordedBufferLength = 0,
  1846. this._lastRecordedViewportHeight = 0,
  1847. this._lastRecordedBufferHeight = 0,
  1848. this._lastTouchY = 0,
  1849. this._lastScrollTop = 0,
  1850. this._wheelPartialScroll = 0,
  1851. this._refreshAnimationFrame = null,
  1852. this._ignoreNextScrollEvent = !1,
  1853. this._smoothScrollState = {
  1854. startTime: 0,
  1855. origin: -1,
  1856. target: -1
  1857. },
  1858. this.scrollBarWidth = this._viewportElement.offsetWidth - this._scrollArea.offsetWidth || 15,
  1859. this.register((0,
  1860. f.addDisposableDomListener)(this._viewportElement, "scroll", this._onScroll.bind(this))),
  1861. this._activeBuffer = this._bufferService.buffer,
  1862. this.register(this._bufferService.buffers.onBufferActivate(m => this._activeBuffer = m.activeBuffer)),
  1863. this._renderDimensions = this._renderService.dimensions,
  1864. this.register(this._renderService.onDimensionsChange(m => this._renderDimensions = m)),
  1865. setTimeout(() => this.syncScrollArea(), 0)
  1866. }
  1867. onThemeChange(t) {
  1868. this._viewportElement.style.backgroundColor = t.background.css
  1869. }
  1870. _refresh(t) {
  1871. if (t)
  1872. return this._innerRefresh(),
  1873. void (this._refreshAnimationFrame !== null && this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));
  1874. this._refreshAnimationFrame === null && (this._refreshAnimationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh()))
  1875. }
  1876. _innerRefresh() {
  1877. if (this._charSizeService.height > 0) {
  1878. this._currentRowHeight = this._renderService.dimensions.scaledCellHeight / this._coreBrowserService.dpr,
  1879. this._currentScaledCellHeight = this._renderService.dimensions.scaledCellHeight,
  1880. this._lastRecordedViewportHeight = this._viewportElement.offsetHeight;
  1881. const s = Math.round(this._currentRowHeight * this._lastRecordedBufferLength) + (this._lastRecordedViewportHeight - this._renderService.dimensions.canvasHeight);
  1882. this._lastRecordedBufferHeight !== s && (this._lastRecordedBufferHeight = s,
  1883. this._scrollArea.style.height = this._lastRecordedBufferHeight + "px")
  1884. }
  1885. const t = this._bufferService.buffer.ydisp * this._currentRowHeight;
  1886. this._viewportElement.scrollTop !== t && (this._ignoreNextScrollEvent = !0,
  1887. this._viewportElement.scrollTop = t),
  1888. this._refreshAnimationFrame = null
  1889. }
  1890. syncScrollArea(t = !1) {
  1891. if (this._lastRecordedBufferLength !== this._bufferService.buffer.lines.length)
  1892. return this._lastRecordedBufferLength = this._bufferService.buffer.lines.length,
  1893. void this._refresh(t);
  1894. this._lastRecordedViewportHeight === this._renderService.dimensions.canvasHeight && this._lastScrollTop === this._activeBuffer.ydisp * this._currentRowHeight && this._renderDimensions.scaledCellHeight === this._currentScaledCellHeight || this._refresh(t)
  1895. }
  1896. _onScroll(t) {
  1897. if (this._lastScrollTop = this._viewportElement.scrollTop,
  1898. !this._viewportElement.offsetParent)
  1899. return;
  1900. if (this._ignoreNextScrollEvent)
  1901. return this._ignoreNextScrollEvent = !1,
  1902. void this._scrollLines(0);
  1903. const s = Math.round(this._lastScrollTop / this._currentRowHeight) - this._bufferService.buffer.ydisp;
  1904. this._scrollLines(s)
  1905. }
  1906. _smoothScroll() {
  1907. if (this._isDisposed || this._smoothScrollState.origin === -1 || this._smoothScrollState.target === -1)
  1908. return;
  1909. const t = this._smoothScrollPercent();
  1910. this._viewportElement.scrollTop = this._smoothScrollState.origin + Math.round(t * (this._smoothScrollState.target - this._smoothScrollState.origin)),
  1911. t < 1 ? this._coreBrowserService.window.requestAnimationFrame(() => this._smoothScroll()) : this._clearSmoothScrollState()
  1912. }
  1913. _smoothScrollPercent() {
  1914. return this._optionsService.rawOptions.smoothScrollDuration && this._smoothScrollState.startTime ? Math.max(Math.min((Date.now() - this._smoothScrollState.startTime) / this._optionsService.rawOptions.smoothScrollDuration, 1), 0) : 1
  1915. }
  1916. _clearSmoothScrollState() {
  1917. this._smoothScrollState.startTime = 0,
  1918. this._smoothScrollState.origin = -1,
  1919. this._smoothScrollState.target = -1
  1920. }
  1921. _bubbleScroll(t, s) {
  1922. const e = this._viewportElement.scrollTop + this._lastRecordedViewportHeight;
  1923. return !(s < 0 && this._viewportElement.scrollTop !== 0 || s > 0 && e < this._lastRecordedBufferHeight) || (t.cancelable && t.preventDefault(),
  1924. !1)
  1925. }
  1926. onWheel(t) {
  1927. const s = this._getPixelsScrolled(t);
  1928. return s !== 0 && (this._optionsService.rawOptions.smoothScrollDuration ? (this._smoothScrollState.startTime = Date.now(),
  1929. this._smoothScrollPercent() < 1 ? (this._smoothScrollState.origin = this._viewportElement.scrollTop,
  1930. this._smoothScrollState.target === -1 ? this._smoothScrollState.target = this._viewportElement.scrollTop + s : this._smoothScrollState.target += s,
  1931. this._smoothScrollState.target = Math.max(Math.min(this._smoothScrollState.target, this._viewportElement.scrollHeight), 0),
  1932. this._smoothScroll()) : this._clearSmoothScrollState()) : this._viewportElement.scrollTop += s,
  1933. this._bubbleScroll(t, s))
  1934. }
  1935. _getPixelsScrolled(t) {
  1936. if (t.deltaY === 0 || t.shiftKey)
  1937. return 0;
  1938. let s = this._applyScrollModifier(t.deltaY, t);
  1939. return t.deltaMode === WheelEvent.DOM_DELTA_LINE ? s *= this._currentRowHeight : t.deltaMode === WheelEvent.DOM_DELTA_PAGE && (s *= this._currentRowHeight * this._bufferService.rows),
  1940. s
  1941. }
  1942. getLinesScrolled(t) {
  1943. if (t.deltaY === 0 || t.shiftKey)
  1944. return 0;
  1945. let s = this._applyScrollModifier(t.deltaY, t);
  1946. return t.deltaMode === WheelEvent.DOM_DELTA_PIXEL ? (s /= this._currentRowHeight + 0,
  1947. this._wheelPartialScroll += s,
  1948. s = Math.floor(Math.abs(this._wheelPartialScroll)) * (this._wheelPartialScroll > 0 ? 1 : -1),
  1949. this._wheelPartialScroll %= 1) : t.deltaMode === WheelEvent.DOM_DELTA_PAGE && (s *= this._bufferService.rows),
  1950. s
  1951. }
  1952. _applyScrollModifier(t, s) {
  1953. const e = this._optionsService.rawOptions.fastScrollModifier;
  1954. return e === "alt" && s.altKey || e === "ctrl" && s.ctrlKey || e === "shift" && s.shiftKey ? t * this._optionsService.rawOptions.fastScrollSensitivity * this._optionsService.rawOptions.scrollSensitivity : t * this._optionsService.rawOptions.scrollSensitivity
  1955. }
  1956. onTouchStart(t) {
  1957. this._lastTouchY = t.touches[0].pageY
  1958. }
  1959. onTouchMove(t) {
  1960. const s = this._lastTouchY - t.touches[0].pageY;
  1961. return this._lastTouchY = t.touches[0].pageY,
  1962. s !== 0 && (this._viewportElement.scrollTop += s,
  1963. this._bubbleScroll(t, s))
  1964. }
  1965. }
  1966. ;
  1967. o = n([_(4, l.IBufferService), _(5, l.IOptionsService), _(6, d.ICharSizeService), _(7, d.IRenderService), _(8, d.ICoreBrowserService)], o),
  1968. r.Viewport = o
  1969. },
  1970. 3107: function (x, r, a) {
  1971. var n = this && this.__decorate || function (t, s, e, i) {
  1972. var c, g = arguments.length, v = g < 3 ? s : i === null ? i = Object.getOwnPropertyDescriptor(s, e) : i;
  1973. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  1974. v = Reflect.decorate(t, s, e, i);
  1975. else
  1976. for (var S = t.length - 1; S >= 0; S--)
  1977. (c = t[S]) && (v = (g < 3 ? c(v) : g > 3 ? c(s, e, v) : c(s, e)) || v);
  1978. return g > 3 && v && Object.defineProperty(s, e, v),
  1979. v
  1980. }
  1981. , _ = this && this.__param || function (t, s) {
  1982. return function (e, i) {
  1983. s(e, i, t)
  1984. }
  1985. }
  1986. ;
  1987. Object.defineProperty(r, "__esModule", {
  1988. value: !0
  1989. }),
  1990. r.BufferDecorationRenderer = void 0;
  1991. const h = a(3656)
  1992. , f = a(4725)
  1993. , d = a(844)
  1994. , l = a(2585);
  1995. let o = class extends d.Disposable {
  1996. constructor(t, s, e, i) {
  1997. super(),
  1998. this._screenElement = t,
  1999. this._bufferService = s,
  2000. this._decorationService = e,
  2001. this._renderService = i,
  2002. this._decorationElements = new Map,
  2003. this._altBufferIsActive = !1,
  2004. this._dimensionsChanged = !1,
  2005. this._container = document.createElement("div"),
  2006. this._container.classList.add("xterm-decoration-container"),
  2007. this._screenElement.appendChild(this._container),
  2008. this.register(this._renderService.onRenderedViewportChange(() => this._queueRefresh())),
  2009. this.register(this._renderService.onDimensionsChange(() => {
  2010. this._dimensionsChanged = !0,
  2011. this._queueRefresh()
  2012. }
  2013. )),
  2014. this.register((0,
  2015. h.addDisposableDomListener)(window, "resize", () => this._queueRefresh())),
  2016. this.register(this._bufferService.buffers.onBufferActivate(() => {
  2017. this._altBufferIsActive = this._bufferService.buffer === this._bufferService.buffers.alt
  2018. }
  2019. )),
  2020. this.register(this._decorationService.onDecorationRegistered(() => this._queueRefresh())),
  2021. this.register(this._decorationService.onDecorationRemoved(c => this._removeDecoration(c)))
  2022. }
  2023. dispose() {
  2024. this._container.remove(),
  2025. this._decorationElements.clear(),
  2026. super.dispose()
  2027. }
  2028. _queueRefresh() {
  2029. this._animationFrame === void 0 && (this._animationFrame = this._renderService.addRefreshCallback(() => {
  2030. this.refreshDecorations(),
  2031. this._animationFrame = void 0
  2032. }
  2033. ))
  2034. }
  2035. refreshDecorations() {
  2036. for (const t of this._decorationService.decorations)
  2037. this._renderDecoration(t);
  2038. this._dimensionsChanged = !1
  2039. }
  2040. _renderDecoration(t) {
  2041. this._refreshStyle(t),
  2042. this._dimensionsChanged && this._refreshXPosition(t)
  2043. }
  2044. _createElement(t) {
  2045. var s;
  2046. const e = document.createElement("div");
  2047. e.classList.add("xterm-decoration"),
  2048. e.style.width = `${Math.round((t.options.width || 1) * this._renderService.dimensions.actualCellWidth)}px`,
  2049. e.style.height = (t.options.height || 1) * this._renderService.dimensions.actualCellHeight + "px",
  2050. e.style.top = (t.marker.line - this._bufferService.buffers.active.ydisp) * this._renderService.dimensions.actualCellHeight + "px",
  2051. e.style.lineHeight = `${this._renderService.dimensions.actualCellHeight}px`;
  2052. const i = (s = t.options.x) !== null && s !== void 0 ? s : 0;
  2053. return i && i > this._bufferService.cols && (e.style.display = "none"),
  2054. this._refreshXPosition(t, e),
  2055. e
  2056. }
  2057. _refreshStyle(t) {
  2058. const s = t.marker.line - this._bufferService.buffers.active.ydisp;
  2059. if (s < 0 || s >= this._bufferService.rows)
  2060. t.element && (t.element.style.display = "none",
  2061. t.onRenderEmitter.fire(t.element));
  2062. else {
  2063. let e = this._decorationElements.get(t);
  2064. e || (t.onDispose(() => this._removeDecoration(t)),
  2065. e = this._createElement(t),
  2066. t.element = e,
  2067. this._decorationElements.set(t, e),
  2068. this._container.appendChild(e)),
  2069. e.style.top = s * this._renderService.dimensions.actualCellHeight + "px",
  2070. e.style.display = this._altBufferIsActive ? "none" : "block",
  2071. t.onRenderEmitter.fire(e)
  2072. }
  2073. }
  2074. _refreshXPosition(t, s = t.element) {
  2075. var e;
  2076. if (!s)
  2077. return;
  2078. const i = (e = t.options.x) !== null && e !== void 0 ? e : 0;
  2079. (t.options.anchor || "left") === "right" ? s.style.right = i ? i * this._renderService.dimensions.actualCellWidth + "px" : "" : s.style.left = i ? i * this._renderService.dimensions.actualCellWidth + "px" : ""
  2080. }
  2081. _removeDecoration(t) {
  2082. var s;
  2083. (s = this._decorationElements.get(t)) === null || s === void 0 || s.remove(),
  2084. this._decorationElements.delete(t)
  2085. }
  2086. }
  2087. ;
  2088. o = n([_(1, l.IBufferService), _(2, l.IDecorationService), _(3, f.IRenderService)], o),
  2089. r.BufferDecorationRenderer = o
  2090. },
  2091. 5871: (x, r) => {
  2092. Object.defineProperty(r, "__esModule", {
  2093. value: !0
  2094. }),
  2095. r.ColorZoneStore = void 0,
  2096. r.ColorZoneStore = class {
  2097. constructor() {
  2098. this._zones = [],
  2099. this._zonePool = [],
  2100. this._zonePoolIndex = 0,
  2101. this._linePadding = {
  2102. full: 0,
  2103. left: 0,
  2104. center: 0,
  2105. right: 0
  2106. }
  2107. }
  2108. get zones() {
  2109. return this._zonePool.length = Math.min(this._zonePool.length, this._zones.length),
  2110. this._zones
  2111. }
  2112. clear() {
  2113. this._zones.length = 0,
  2114. this._zonePoolIndex = 0
  2115. }
  2116. addDecoration(a) {
  2117. if (a.options.overviewRulerOptions) {
  2118. for (const n of this._zones)
  2119. if (n.color === a.options.overviewRulerOptions.color && n.position === a.options.overviewRulerOptions.position) {
  2120. if (this._lineIntersectsZone(n, a.marker.line))
  2121. return;
  2122. if (this._lineAdjacentToZone(n, a.marker.line, a.options.overviewRulerOptions.position))
  2123. return void this._addLineToZone(n, a.marker.line)
  2124. }
  2125. if (this._zonePoolIndex < this._zonePool.length)
  2126. return this._zonePool[this._zonePoolIndex].color = a.options.overviewRulerOptions.color,
  2127. this._zonePool[this._zonePoolIndex].position = a.options.overviewRulerOptions.position,
  2128. this._zonePool[this._zonePoolIndex].startBufferLine = a.marker.line,
  2129. this._zonePool[this._zonePoolIndex].endBufferLine = a.marker.line,
  2130. void this._zones.push(this._zonePool[this._zonePoolIndex++]);
  2131. this._zones.push({
  2132. color: a.options.overviewRulerOptions.color,
  2133. position: a.options.overviewRulerOptions.position,
  2134. startBufferLine: a.marker.line,
  2135. endBufferLine: a.marker.line
  2136. }),
  2137. this._zonePool.push(this._zones[this._zones.length - 1]),
  2138. this._zonePoolIndex++
  2139. }
  2140. }
  2141. setPadding(a) {
  2142. this._linePadding = a
  2143. }
  2144. _lineIntersectsZone(a, n) {
  2145. return n >= a.startBufferLine && n <= a.endBufferLine
  2146. }
  2147. _lineAdjacentToZone(a, n, _) {
  2148. return n >= a.startBufferLine - this._linePadding[_ || "full"] && n <= a.endBufferLine + this._linePadding[_ || "full"]
  2149. }
  2150. _addLineToZone(a, n) {
  2151. a.startBufferLine = Math.min(a.startBufferLine, n),
  2152. a.endBufferLine = Math.max(a.endBufferLine, n)
  2153. }
  2154. }
  2155. }
  2156. ,
  2157. 5744: function (x, r, a) {
  2158. var n = this && this.__decorate || function (c, g, v, S) {
  2159. var u, m = arguments.length, w = m < 3 ? g : S === null ? S = Object.getOwnPropertyDescriptor(g, v) : S;
  2160. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  2161. w = Reflect.decorate(c, g, v, S);
  2162. else
  2163. for (var R = c.length - 1; R >= 0; R--)
  2164. (u = c[R]) && (w = (m < 3 ? u(w) : m > 3 ? u(g, v, w) : u(g, v)) || w);
  2165. return m > 3 && w && Object.defineProperty(g, v, w),
  2166. w
  2167. }
  2168. , _ = this && this.__param || function (c, g) {
  2169. return function (v, S) {
  2170. g(v, S, c)
  2171. }
  2172. }
  2173. ;
  2174. Object.defineProperty(r, "__esModule", {
  2175. value: !0
  2176. }),
  2177. r.OverviewRulerRenderer = void 0;
  2178. const h = a(5871)
  2179. , f = a(3656)
  2180. , d = a(4725)
  2181. , l = a(844)
  2182. , o = a(2585)
  2183. , t = {
  2184. full: 0,
  2185. left: 0,
  2186. center: 0,
  2187. right: 0
  2188. }
  2189. , s = {
  2190. full: 0,
  2191. left: 0,
  2192. center: 0,
  2193. right: 0
  2194. }
  2195. , e = {
  2196. full: 0,
  2197. left: 0,
  2198. center: 0,
  2199. right: 0
  2200. };
  2201. let i = class extends l.Disposable {
  2202. constructor(c, g, v, S, u, m, w) {
  2203. var R;
  2204. super(),
  2205. this._viewportElement = c,
  2206. this._screenElement = g,
  2207. this._bufferService = v,
  2208. this._decorationService = S,
  2209. this._renderService = u,
  2210. this._optionsService = m,
  2211. this._coreBrowseService = w,
  2212. this._colorZoneStore = new h.ColorZoneStore,
  2213. this._shouldUpdateDimensions = !0,
  2214. this._shouldUpdateAnchor = !0,
  2215. this._lastKnownBufferLength = 0,
  2216. this._canvas = document.createElement("canvas"),
  2217. this._canvas.classList.add("xterm-decoration-overview-ruler"),
  2218. this._refreshCanvasDimensions(),
  2219. (R = this._viewportElement.parentElement) === null || R === void 0 || R.insertBefore(this._canvas, this._viewportElement);
  2220. const L = this._canvas.getContext("2d");
  2221. if (!L)
  2222. throw new Error("Ctx cannot be null");
  2223. this._ctx = L,
  2224. this._registerDecorationListeners(),
  2225. this._registerBufferChangeListeners(),
  2226. this._registerDimensionChangeListeners()
  2227. }
  2228. get _width() {
  2229. return this._optionsService.options.overviewRulerWidth || 0
  2230. }
  2231. _registerDecorationListeners() {
  2232. this.register(this._decorationService.onDecorationRegistered(() => this._queueRefresh(void 0, !0))),
  2233. this.register(this._decorationService.onDecorationRemoved(() => this._queueRefresh(void 0, !0)))
  2234. }
  2235. _registerBufferChangeListeners() {
  2236. this.register(this._renderService.onRenderedViewportChange(() => this._queueRefresh())),
  2237. this.register(this._bufferService.buffers.onBufferActivate(() => {
  2238. this._canvas.style.display = this._bufferService.buffer === this._bufferService.buffers.alt ? "none" : "block"
  2239. }
  2240. )),
  2241. this.register(this._bufferService.onScroll(() => {
  2242. this._lastKnownBufferLength !== this._bufferService.buffers.normal.lines.length && (this._refreshDrawHeightConstants(),
  2243. this._refreshColorZonePadding())
  2244. }
  2245. ))
  2246. }
  2247. _registerDimensionChangeListeners() {
  2248. this.register(this._renderService.onRender(() => {
  2249. this._containerHeight && this._containerHeight === this._screenElement.clientHeight || (this._queueRefresh(!0),
  2250. this._containerHeight = this._screenElement.clientHeight)
  2251. }
  2252. )),
  2253. this.register(this._optionsService.onOptionChange(c => {
  2254. c === "overviewRulerWidth" && this._queueRefresh(!0)
  2255. }
  2256. )),
  2257. this.register((0,
  2258. f.addDisposableDomListener)(this._coreBrowseService.window, "resize", () => {
  2259. this._queueRefresh(!0)
  2260. }
  2261. )),
  2262. this._queueRefresh(!0)
  2263. }
  2264. dispose() {
  2265. var c;
  2266. (c = this._canvas) === null || c === void 0 || c.remove(),
  2267. super.dispose()
  2268. }
  2269. _refreshDrawConstants() {
  2270. const c = Math.floor(this._canvas.width / 3)
  2271. , g = Math.ceil(this._canvas.width / 3);
  2272. s.full = this._canvas.width,
  2273. s.left = c,
  2274. s.center = g,
  2275. s.right = c,
  2276. this._refreshDrawHeightConstants(),
  2277. e.full = 0,
  2278. e.left = 0,
  2279. e.center = s.left,
  2280. e.right = s.left + s.center
  2281. }
  2282. _refreshDrawHeightConstants() {
  2283. t.full = Math.round(2 * this._coreBrowseService.dpr);
  2284. const c = this._canvas.height / this._bufferService.buffer.lines.length
  2285. , g = Math.round(Math.max(Math.min(c, 12), 6) * this._coreBrowseService.dpr);
  2286. t.left = g,
  2287. t.center = g,
  2288. t.right = g
  2289. }
  2290. _refreshColorZonePadding() {
  2291. this._colorZoneStore.setPadding({
  2292. full: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * t.full),
  2293. left: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * t.left),
  2294. center: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * t.center),
  2295. right: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * t.right)
  2296. }),
  2297. this._lastKnownBufferLength = this._bufferService.buffers.normal.lines.length
  2298. }
  2299. _refreshCanvasDimensions() {
  2300. this._canvas.style.width = `${this._width}px`,
  2301. this._canvas.width = Math.round(this._width * this._coreBrowseService.dpr),
  2302. this._canvas.style.height = `${this._screenElement.clientHeight}px`,
  2303. this._canvas.height = Math.round(this._screenElement.clientHeight * this._coreBrowseService.dpr),
  2304. this._refreshDrawConstants(),
  2305. this._refreshColorZonePadding()
  2306. }
  2307. _refreshDecorations() {
  2308. this._shouldUpdateDimensions && this._refreshCanvasDimensions(),
  2309. this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height),
  2310. this._colorZoneStore.clear();
  2311. for (const g of this._decorationService.decorations)
  2312. this._colorZoneStore.addDecoration(g);
  2313. this._ctx.lineWidth = 1;
  2314. const c = this._colorZoneStore.zones;
  2315. for (const g of c)
  2316. g.position !== "full" && this._renderColorZone(g);
  2317. for (const g of c)
  2318. g.position === "full" && this._renderColorZone(g);
  2319. this._shouldUpdateDimensions = !1,
  2320. this._shouldUpdateAnchor = !1
  2321. }
  2322. _renderColorZone(c) {
  2323. this._ctx.fillStyle = c.color,
  2324. this._ctx.fillRect(e[c.position || "full"], Math.round((this._canvas.height - 1) * (c.startBufferLine / this._bufferService.buffers.active.lines.length) - t[c.position || "full"] / 2), s[c.position || "full"], Math.round((this._canvas.height - 1) * ((c.endBufferLine - c.startBufferLine) / this._bufferService.buffers.active.lines.length) + t[c.position || "full"]))
  2325. }
  2326. _queueRefresh(c, g) {
  2327. this._shouldUpdateDimensions = c || this._shouldUpdateDimensions,
  2328. this._shouldUpdateAnchor = g || this._shouldUpdateAnchor,
  2329. this._animationFrame === void 0 && (this._animationFrame = this._coreBrowseService.window.requestAnimationFrame(() => {
  2330. this._refreshDecorations(),
  2331. this._animationFrame = void 0
  2332. }
  2333. ))
  2334. }
  2335. }
  2336. ;
  2337. i = n([_(2, o.IBufferService), _(3, o.IDecorationService), _(4, d.IRenderService), _(5, o.IOptionsService), _(6, d.ICoreBrowserService)], i),
  2338. r.OverviewRulerRenderer = i
  2339. },
  2340. 2950: function (x, r, a) {
  2341. var n = this && this.__decorate || function (o, t, s, e) {
  2342. var i, c = arguments.length, g = c < 3 ? t : e === null ? e = Object.getOwnPropertyDescriptor(t, s) : e;
  2343. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  2344. g = Reflect.decorate(o, t, s, e);
  2345. else
  2346. for (var v = o.length - 1; v >= 0; v--)
  2347. (i = o[v]) && (g = (c < 3 ? i(g) : c > 3 ? i(t, s, g) : i(t, s)) || g);
  2348. return c > 3 && g && Object.defineProperty(t, s, g),
  2349. g
  2350. }
  2351. , _ = this && this.__param || function (o, t) {
  2352. return function (s, e) {
  2353. t(s, e, o)
  2354. }
  2355. }
  2356. ;
  2357. Object.defineProperty(r, "__esModule", {
  2358. value: !0
  2359. }),
  2360. r.CompositionHelper = void 0;
  2361. const h = a(4725)
  2362. , f = a(2585)
  2363. , d = a(2584);
  2364. let l = class {
  2365. constructor(o, t, s, e, i, c) {
  2366. this._textarea = o,
  2367. this._compositionView = t,
  2368. this._bufferService = s,
  2369. this._optionsService = e,
  2370. this._coreService = i,
  2371. this._renderService = c,
  2372. this._isComposing = !1,
  2373. this._isSendingComposition = !1,
  2374. this._compositionPosition = {
  2375. start: 0,
  2376. end: 0
  2377. },
  2378. this._dataAlreadySent = ""
  2379. }
  2380. get isComposing() {
  2381. return this._isComposing
  2382. }
  2383. compositionstart() {
  2384. this._isComposing = !0,
  2385. this._compositionPosition.start = this._textarea.value.length,
  2386. this._compositionView.textContent = "",
  2387. this._dataAlreadySent = "",
  2388. this._compositionView.classList.add("active")
  2389. }
  2390. compositionupdate(o) {
  2391. this._compositionView.textContent = o.data,
  2392. this.updateCompositionElements(),
  2393. setTimeout(() => {
  2394. this._compositionPosition.end = this._textarea.value.length
  2395. }
  2396. , 0)
  2397. }
  2398. compositionend() {
  2399. this._finalizeComposition(!0)
  2400. }
  2401. keydown(o) {
  2402. if (this._isComposing || this._isSendingComposition) {
  2403. if (o.keyCode === 229 || o.keyCode === 16 || o.keyCode === 17 || o.keyCode === 18)
  2404. return !1;
  2405. this._finalizeComposition(!1)
  2406. }
  2407. return o.keyCode !== 229 || (this._handleAnyTextareaChanges(),
  2408. !1)
  2409. }
  2410. _finalizeComposition(o) {
  2411. if (this._compositionView.classList.remove("active"),
  2412. this._isComposing = !1,
  2413. o) {
  2414. const t = {
  2415. start: this._compositionPosition.start,
  2416. end: this._compositionPosition.end
  2417. };
  2418. this._isSendingComposition = !0,
  2419. setTimeout(() => {
  2420. if (this._isSendingComposition) {
  2421. let s;
  2422. this._isSendingComposition = !1,
  2423. t.start += this._dataAlreadySent.length,
  2424. s = this._isComposing ? this._textarea.value.substring(t.start, t.end) : this._textarea.value.substring(t.start),
  2425. s.length > 0 && this._coreService.triggerDataEvent(s, !0)
  2426. }
  2427. }
  2428. , 0)
  2429. } else {
  2430. this._isSendingComposition = !1;
  2431. const t = this._textarea.value.substring(this._compositionPosition.start, this._compositionPosition.end);
  2432. this._coreService.triggerDataEvent(t, !0)
  2433. }
  2434. }
  2435. _handleAnyTextareaChanges() {
  2436. const o = this._textarea.value;
  2437. setTimeout(() => {
  2438. if (!this._isComposing) {
  2439. const t = this._textarea.value
  2440. , s = t.replace(o, "");
  2441. this._dataAlreadySent = s,
  2442. t.length > o.length ? this._coreService.triggerDataEvent(s, !0) : t.length < o.length ? this._coreService.triggerDataEvent(`${d.C0.DEL}`, !0) : t.length === o.length && t !== o && this._coreService.triggerDataEvent(t, !0)
  2443. }
  2444. }
  2445. , 0)
  2446. }
  2447. updateCompositionElements(o) {
  2448. if (this._isComposing) {
  2449. if (this._bufferService.buffer.isCursorInViewport) {
  2450. const t = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1)
  2451. , s = this._renderService.dimensions.actualCellHeight
  2452. , e = this._bufferService.buffer.y * this._renderService.dimensions.actualCellHeight
  2453. , i = t * this._renderService.dimensions.actualCellWidth;
  2454. this._compositionView.style.left = i + "px",
  2455. this._compositionView.style.top = e + "px",
  2456. this._compositionView.style.height = s + "px",
  2457. this._compositionView.style.lineHeight = s + "px",
  2458. this._compositionView.style.fontFamily = this._optionsService.rawOptions.fontFamily,
  2459. this._compositionView.style.fontSize = this._optionsService.rawOptions.fontSize + "px";
  2460. const c = this._compositionView.getBoundingClientRect();
  2461. this._textarea.style.left = i + "px",
  2462. this._textarea.style.top = e + "px",
  2463. this._textarea.style.width = Math.max(c.width, 1) + "px",
  2464. this._textarea.style.height = Math.max(c.height, 1) + "px",
  2465. this._textarea.style.lineHeight = c.height + "px"
  2466. }
  2467. o || setTimeout(() => this.updateCompositionElements(!0), 0)
  2468. }
  2469. }
  2470. }
  2471. ;
  2472. l = n([_(2, f.IBufferService), _(3, f.IOptionsService), _(4, f.ICoreService), _(5, h.IRenderService)], l),
  2473. r.CompositionHelper = l
  2474. },
  2475. 9806: (x, r) => {
  2476. function a(n, _, h) {
  2477. const f = h.getBoundingClientRect()
  2478. , d = n.getComputedStyle(h)
  2479. , l = parseInt(d.getPropertyValue("padding-left"))
  2480. , o = parseInt(d.getPropertyValue("padding-top"));
  2481. return [_.clientX - f.left - l, _.clientY - f.top - o]
  2482. }
  2483. Object.defineProperty(r, "__esModule", {
  2484. value: !0
  2485. }),
  2486. r.getCoords = r.getCoordsRelativeToElement = void 0,
  2487. r.getCoordsRelativeToElement = a,
  2488. r.getCoords = function (n, _, h, f, d, l, o, t, s) {
  2489. if (!l)
  2490. return;
  2491. const e = a(n, _, h);
  2492. return e ? (e[0] = Math.ceil((e[0] + (s ? o / 2 : 0)) / o),
  2493. e[1] = Math.ceil(e[1] / t),
  2494. e[0] = Math.min(Math.max(e[0], 1), f + (s ? 1 : 0)),
  2495. e[1] = Math.min(Math.max(e[1], 1), d),
  2496. e) : void 0
  2497. }
  2498. }
  2499. ,
  2500. 9504: (x, r, a) => {
  2501. Object.defineProperty(r, "__esModule", {
  2502. value: !0
  2503. }),
  2504. r.moveToCellSequence = void 0;
  2505. const n = a(2584);
  2506. function _(t, s, e, i) {
  2507. const c = t - h(e, t)
  2508. , g = s - h(e, s)
  2509. , v = Math.abs(c - g) - function (S, u, m) {
  2510. let w = 0;
  2511. const R = S - h(m, S)
  2512. , L = u - h(m, u);
  2513. for (let p = 0; p < Math.abs(R - L); p++) {
  2514. const C = f(S, u) === "A" ? -1 : 1
  2515. , b = m.buffer.lines.get(R + C * p);
  2516. b != null && b.isWrapped && w++
  2517. }
  2518. return w
  2519. }(t, s, e);
  2520. return o(v, l(f(t, s), i))
  2521. }
  2522. function h(t, s) {
  2523. let e = 0
  2524. , i = t.buffer.lines.get(s)
  2525. , c = i == null ? void 0 : i.isWrapped;
  2526. for (; c && s >= 0 && s < t.rows;)
  2527. e++,
  2528. i = t.buffer.lines.get(--s),
  2529. c = i == null ? void 0 : i.isWrapped;
  2530. return e
  2531. }
  2532. function f(t, s) {
  2533. return t > s ? "A" : "B"
  2534. }
  2535. function d(t, s, e, i, c, g) {
  2536. let v = t
  2537. , S = s
  2538. , u = "";
  2539. for (; v !== e || S !== i;)
  2540. v += c ? 1 : -1,
  2541. c && v > g.cols - 1 ? (u += g.buffer.translateBufferLineToString(S, !1, t, v),
  2542. v = 0,
  2543. t = 0,
  2544. S++) : !c && v < 0 && (u += g.buffer.translateBufferLineToString(S, !1, 0, t + 1),
  2545. v = g.cols - 1,
  2546. t = v,
  2547. S--);
  2548. return u + g.buffer.translateBufferLineToString(S, !1, t, v)
  2549. }
  2550. function l(t, s) {
  2551. const e = s ? "O" : "[";
  2552. return n.C0.ESC + e + t
  2553. }
  2554. function o(t, s) {
  2555. t = Math.floor(t);
  2556. let e = "";
  2557. for (let i = 0; i < t; i++)
  2558. e += s;
  2559. return e
  2560. }
  2561. r.moveToCellSequence = function (t, s, e, i) {
  2562. const c = e.buffer.x
  2563. , g = e.buffer.y;
  2564. if (!e.buffer.hasScrollback)
  2565. return function (u, m, w, R, L, p) {
  2566. return _(m, R, L, p).length === 0 ? "" : o(d(u, m, u, m - h(L, m), !1, L).length, l("D", p))
  2567. }(c, g, 0, s, e, i) + _(g, s, e, i) + function (u, m, w, R, L, p) {
  2568. let C;
  2569. C = _(m, R, L, p).length > 0 ? R - h(L, R) : m;
  2570. const b = R
  2571. , E = function (A, H, j, $, P, N) {
  2572. let y;
  2573. return y = _(j, $, P, N).length > 0 ? $ - h(P, $) : H,
  2574. A < j && y <= $ || A >= j && y < $ ? "C" : "D"
  2575. }(u, m, w, R, L, p);
  2576. return o(d(u, C, w, b, E === "C", L).length, l(E, p))
  2577. }(c, g, t, s, e, i);
  2578. let v;
  2579. if (g === s)
  2580. return v = c > t ? "D" : "C",
  2581. o(Math.abs(c - t), l(v, i));
  2582. v = g > s ? "D" : "C";
  2583. const S = Math.abs(g - s);
  2584. return o(function (u, m) {
  2585. return m.cols - u
  2586. }(g > s ? t : c, e) + (S - 1) * e.cols + 1 + ((g > s ? c : t) - 1), l(v, i))
  2587. }
  2588. }
  2589. ,
  2590. 8036: (x, r, a) => {
  2591. Object.defineProperty(r, "__esModule", {
  2592. value: !0
  2593. }),
  2594. r.TEXT_BASELINE = r.DIM_OPACITY = r.INVERTED_DEFAULT_COLOR = void 0;
  2595. const n = a(6114);
  2596. r.INVERTED_DEFAULT_COLOR = 257,
  2597. r.DIM_OPACITY = .5,
  2598. r.TEXT_BASELINE = n.isFirefox || n.isLegacyEdge ? "bottom" : "ideographic"
  2599. }
  2600. ,
  2601. 1752: (x, r) => {
  2602. function a(n) {
  2603. return 57508 <= n && n <= 57558
  2604. }
  2605. Object.defineProperty(r, "__esModule", {
  2606. value: !0
  2607. }),
  2608. r.excludeFromContrastRatioDemands = r.isRestrictedPowerlineGlyph = r.isPowerlineGlyph = r.throwIfFalsy = void 0,
  2609. r.throwIfFalsy = function (n) {
  2610. if (!n)
  2611. throw new Error("value must not be falsy");
  2612. return n
  2613. }
  2614. ,
  2615. r.isPowerlineGlyph = a,
  2616. r.isRestrictedPowerlineGlyph = function (n) {
  2617. return 57520 <= n && n <= 57527
  2618. }
  2619. ,
  2620. r.excludeFromContrastRatioDemands = function (n) {
  2621. return a(n) || function (_) {
  2622. return 9472 <= _ && _ <= 9631
  2623. }(n)
  2624. }
  2625. }
  2626. ,
  2627. 1296: function (x, r, a) {
  2628. var n = this && this.__decorate || function (S, u, m, w) {
  2629. var R, L = arguments.length, p = L < 3 ? u : w === null ? w = Object.getOwnPropertyDescriptor(u, m) : w;
  2630. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  2631. p = Reflect.decorate(S, u, m, w);
  2632. else
  2633. for (var C = S.length - 1; C >= 0; C--)
  2634. (R = S[C]) && (p = (L < 3 ? R(p) : L > 3 ? R(u, m, p) : R(u, m)) || p);
  2635. return L > 3 && p && Object.defineProperty(u, m, p),
  2636. p
  2637. }
  2638. , _ = this && this.__param || function (S, u) {
  2639. return function (m, w) {
  2640. u(m, w, S)
  2641. }
  2642. }
  2643. ;
  2644. Object.defineProperty(r, "__esModule", {
  2645. value: !0
  2646. }),
  2647. r.DomRenderer = void 0;
  2648. const h = a(3787)
  2649. , f = a(8036)
  2650. , d = a(844)
  2651. , l = a(4725)
  2652. , o = a(2585)
  2653. , t = a(8460)
  2654. , s = a(8055)
  2655. , e = a(9631)
  2656. , i = "xterm-dom-renderer-owner-"
  2657. , c = "xterm-focus";
  2658. let g = 1
  2659. , v = class extends d.Disposable {
  2660. constructor(S, u, m, w, R, L, p, C, b, E) {
  2661. super(),
  2662. this._colors = S,
  2663. this._element = u,
  2664. this._screenElement = m,
  2665. this._viewportElement = w,
  2666. this._linkifier2 = R,
  2667. this._charSizeService = p,
  2668. this._optionsService = C,
  2669. this._bufferService = b,
  2670. this._coreBrowserService = E,
  2671. this._terminalClass = g++,
  2672. this._rowElements = [],
  2673. this._rowContainer = document.createElement("div"),
  2674. this._rowContainer.classList.add("xterm-rows"),
  2675. this._rowContainer.style.lineHeight = "normal",
  2676. this._rowContainer.setAttribute("aria-hidden", "true"),
  2677. this._refreshRowElements(this._bufferService.cols, this._bufferService.rows),
  2678. this._selectionContainer = document.createElement("div"),
  2679. this._selectionContainer.classList.add("xterm-selection"),
  2680. this._selectionContainer.setAttribute("aria-hidden", "true"),
  2681. this.dimensions = {
  2682. scaledCharWidth: 0,
  2683. scaledCharHeight: 0,
  2684. scaledCellWidth: 0,
  2685. scaledCellHeight: 0,
  2686. scaledCharLeft: 0,
  2687. scaledCharTop: 0,
  2688. scaledCanvasWidth: 0,
  2689. scaledCanvasHeight: 0,
  2690. canvasWidth: 0,
  2691. canvasHeight: 0,
  2692. actualCellWidth: 0,
  2693. actualCellHeight: 0
  2694. },
  2695. this._updateDimensions(),
  2696. this._injectCss(),
  2697. this._rowFactory = L.createInstance(h.DomRendererRowFactory, document, this._colors),
  2698. this._element.classList.add(i + this._terminalClass),
  2699. this._screenElement.appendChild(this._rowContainer),
  2700. this._screenElement.appendChild(this._selectionContainer),
  2701. this.register(this._linkifier2.onShowLinkUnderline(A => this._onLinkHover(A))),
  2702. this.register(this._linkifier2.onHideLinkUnderline(A => this._onLinkLeave(A)))
  2703. }
  2704. get onRequestRedraw() {
  2705. return new t.EventEmitter().event
  2706. }
  2707. dispose() {
  2708. this._element.classList.remove(i + this._terminalClass),
  2709. (0,
  2710. e.removeElementFromParent)(this._rowContainer, this._selectionContainer, this._themeStyleElement, this._dimensionsStyleElement),
  2711. super.dispose()
  2712. }
  2713. _updateDimensions() {
  2714. const S = this._coreBrowserService.dpr;
  2715. this.dimensions.scaledCharWidth = this._charSizeService.width * S,
  2716. this.dimensions.scaledCharHeight = Math.ceil(this._charSizeService.height * S),
  2717. this.dimensions.scaledCellWidth = this.dimensions.scaledCharWidth + Math.round(this._optionsService.rawOptions.letterSpacing),
  2718. this.dimensions.scaledCellHeight = Math.floor(this.dimensions.scaledCharHeight * this._optionsService.rawOptions.lineHeight),
  2719. this.dimensions.scaledCharLeft = 0,
  2720. this.dimensions.scaledCharTop = 0,
  2721. this.dimensions.scaledCanvasWidth = this.dimensions.scaledCellWidth * this._bufferService.cols,
  2722. this.dimensions.scaledCanvasHeight = this.dimensions.scaledCellHeight * this._bufferService.rows,
  2723. this.dimensions.canvasWidth = Math.round(this.dimensions.scaledCanvasWidth / S),
  2724. this.dimensions.canvasHeight = Math.round(this.dimensions.scaledCanvasHeight / S),
  2725. this.dimensions.actualCellWidth = this.dimensions.canvasWidth / this._bufferService.cols,
  2726. this.dimensions.actualCellHeight = this.dimensions.canvasHeight / this._bufferService.rows;
  2727. for (const m of this._rowElements)
  2728. m.style.width = `${this.dimensions.canvasWidth}px`,
  2729. m.style.height = `${this.dimensions.actualCellHeight}px`,
  2730. m.style.lineHeight = `${this.dimensions.actualCellHeight}px`,
  2731. m.style.overflow = "hidden";
  2732. this._dimensionsStyleElement || (this._dimensionsStyleElement = document.createElement("style"),
  2733. this._screenElement.appendChild(this._dimensionsStyleElement));
  2734. const u = `${this._terminalSelector} .xterm-rows span { display: inline-block; height: 100%; vertical-align: top; width: ${this.dimensions.actualCellWidth}px}`;
  2735. this._dimensionsStyleElement.textContent = u,
  2736. this._selectionContainer.style.height = this._viewportElement.style.height,
  2737. this._screenElement.style.width = `${this.dimensions.canvasWidth}px`,
  2738. this._screenElement.style.height = `${this.dimensions.canvasHeight}px`
  2739. }
  2740. setColors(S) {
  2741. this._colors = S,
  2742. this._injectCss()
  2743. }
  2744. _injectCss() {
  2745. this._themeStyleElement || (this._themeStyleElement = document.createElement("style"),
  2746. this._screenElement.appendChild(this._themeStyleElement));
  2747. let S = `${this._terminalSelector} .xterm-rows { color: ${this._colors.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px;}`;
  2748. S += `${this._terminalSelector} span:not(.${h.BOLD_CLASS}) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.${h.BOLD_CLASS} { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.${h.ITALIC_CLASS} { font-style: italic;}`,
  2749. S += "@keyframes blink_box_shadow_" + this._terminalClass + " { 50% { box-shadow: none; }}",
  2750. S += "@keyframes blink_block_" + this._terminalClass + ` { 0% { background-color: ${this._colors.cursor.css}; color: ${this._colors.cursorAccent.css}; } 50% { background-color: ${this._colors.cursorAccent.css}; color: ${this._colors.cursor.css}; }}`,
  2751. S += `${this._terminalSelector} .xterm-rows:not(.xterm-focus) .${h.CURSOR_CLASS}.${h.CURSOR_STYLE_BLOCK_CLASS} { outline: 1px solid ${this._colors.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .xterm-rows.xterm-focus .${h.CURSOR_CLASS}.${h.CURSOR_BLINK_CLASS}:not(.${h.CURSOR_STYLE_BLOCK_CLASS}) { animation: blink_box_shadow_` + this._terminalClass + ` 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .${h.CURSOR_CLASS}.${h.CURSOR_BLINK_CLASS}.${h.CURSOR_STYLE_BLOCK_CLASS} { animation: blink_block_` + this._terminalClass + ` 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .${h.CURSOR_CLASS}.${h.CURSOR_STYLE_BLOCK_CLASS} { background-color: ${this._colors.cursor.css}; color: ${this._colors.cursorAccent.css};}${this._terminalSelector} .xterm-rows .${h.CURSOR_CLASS}.${h.CURSOR_STYLE_BAR_CLASS} { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${this._colors.cursor.css} inset;}${this._terminalSelector} .xterm-rows .${h.CURSOR_CLASS}.${h.CURSOR_STYLE_UNDERLINE_CLASS} { box-shadow: 0 -1px 0 ${this._colors.cursor.css} inset;}`,
  2752. S += `${this._terminalSelector} .xterm-selection { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .xterm-selection div { position: absolute; background-color: ${this._colors.selectionBackgroundOpaque.css};}${this._terminalSelector} .xterm-selection div { position: absolute; background-color: ${this._colors.selectionInactiveBackgroundOpaque.css};}`,
  2753. this._colors.ansi.forEach((u, m) => {
  2754. S += `${this._terminalSelector} .xterm-fg-${m} { color: ${u.css}; }${this._terminalSelector} .xterm-bg-${m} { background-color: ${u.css}; }`
  2755. }
  2756. ),
  2757. S += `${this._terminalSelector} .xterm-fg-${f.INVERTED_DEFAULT_COLOR} { color: ${s.color.opaque(this._colors.background).css}; }${this._terminalSelector} .xterm-bg-${f.INVERTED_DEFAULT_COLOR} { background-color: ${this._colors.foreground.css}; }`,
  2758. this._themeStyleElement.textContent = S
  2759. }
  2760. onDevicePixelRatioChange() {
  2761. this._updateDimensions()
  2762. }
  2763. _refreshRowElements(S, u) {
  2764. for (let m = this._rowElements.length; m <= u; m++) {
  2765. const w = document.createElement("div");
  2766. this._rowContainer.appendChild(w),
  2767. this._rowElements.push(w)
  2768. }
  2769. for (; this._rowElements.length > u;)
  2770. this._rowContainer.removeChild(this._rowElements.pop())
  2771. }
  2772. onResize(S, u) {
  2773. this._refreshRowElements(S, u),
  2774. this._updateDimensions()
  2775. }
  2776. onCharSizeChanged() {
  2777. this._updateDimensions()
  2778. }
  2779. onBlur() {
  2780. this._rowContainer.classList.remove(c)
  2781. }
  2782. onFocus() {
  2783. this._rowContainer.classList.add(c)
  2784. }
  2785. onSelectionChanged(S, u, m) {
  2786. for (; this._selectionContainer.children.length;)
  2787. this._selectionContainer.removeChild(this._selectionContainer.children[0]);
  2788. if (this._rowFactory.onSelectionChanged(S, u, m),
  2789. this.renderRows(0, this._bufferService.rows - 1),
  2790. !S || !u)
  2791. return;
  2792. const w = S[1] - this._bufferService.buffer.ydisp
  2793. , R = u[1] - this._bufferService.buffer.ydisp
  2794. , L = Math.max(w, 0)
  2795. , p = Math.min(R, this._bufferService.rows - 1);
  2796. if (L >= this._bufferService.rows || p < 0)
  2797. return;
  2798. const C = document.createDocumentFragment();
  2799. if (m) {
  2800. const b = S[0] > u[0];
  2801. C.appendChild(this._createSelectionElement(L, b ? u[0] : S[0], b ? S[0] : u[0], p - L + 1))
  2802. } else {
  2803. const b = w === L ? S[0] : 0
  2804. , E = L === R ? u[0] : this._bufferService.cols;
  2805. C.appendChild(this._createSelectionElement(L, b, E));
  2806. const A = p - L - 1;
  2807. if (C.appendChild(this._createSelectionElement(L + 1, 0, this._bufferService.cols, A)),
  2808. L !== p) {
  2809. const H = R === p ? u[0] : this._bufferService.cols;
  2810. C.appendChild(this._createSelectionElement(p, 0, H))
  2811. }
  2812. }
  2813. this._selectionContainer.appendChild(C)
  2814. }
  2815. _createSelectionElement(S, u, m, w = 1) {
  2816. const R = document.createElement("div");
  2817. return R.style.height = w * this.dimensions.actualCellHeight + "px",
  2818. R.style.top = S * this.dimensions.actualCellHeight + "px",
  2819. R.style.left = u * this.dimensions.actualCellWidth + "px",
  2820. R.style.width = this.dimensions.actualCellWidth * (m - u) + "px",
  2821. R
  2822. }
  2823. onCursorMove() { }
  2824. onOptionsChanged() {
  2825. this._updateDimensions(),
  2826. this._injectCss()
  2827. }
  2828. clear() {
  2829. for (const S of this._rowElements)
  2830. S.innerText = ""
  2831. }
  2832. renderRows(S, u) {
  2833. const m = this._bufferService.buffer.ybase + this._bufferService.buffer.y
  2834. , w = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1)
  2835. , R = this._optionsService.rawOptions.cursorBlink;
  2836. for (let L = S; L <= u; L++) {
  2837. const p = this._rowElements[L];
  2838. p.innerText = "";
  2839. const C = L + this._bufferService.buffer.ydisp
  2840. , b = this._bufferService.buffer.lines.get(C)
  2841. , E = this._optionsService.rawOptions.cursorStyle;
  2842. p.appendChild(this._rowFactory.createRow(b, C, C === m, E, w, R, this.dimensions.actualCellWidth, this._bufferService.cols))
  2843. }
  2844. }
  2845. get _terminalSelector() {
  2846. return `.${i}${this._terminalClass}`
  2847. }
  2848. _onLinkHover(S) {
  2849. this._setCellUnderline(S.x1, S.x2, S.y1, S.y2, S.cols, !0)
  2850. }
  2851. _onLinkLeave(S) {
  2852. this._setCellUnderline(S.x1, S.x2, S.y1, S.y2, S.cols, !1)
  2853. }
  2854. _setCellUnderline(S, u, m, w, R, L) {
  2855. for (; S !== u || m !== w;) {
  2856. const p = this._rowElements[m];
  2857. if (!p)
  2858. return;
  2859. const C = p.children[S];
  2860. C && (C.style.textDecoration = L ? "underline" : "none"),
  2861. ++S >= R && (S = 0,
  2862. m++)
  2863. }
  2864. }
  2865. }
  2866. ;
  2867. v = n([_(5, o.IInstantiationService), _(6, l.ICharSizeService), _(7, o.IOptionsService), _(8, o.IBufferService), _(9, l.ICoreBrowserService)], v),
  2868. r.DomRenderer = v
  2869. },
  2870. 3787: function (x, r, a) {
  2871. var n = this && this.__decorate || function (v, S, u, m) {
  2872. var w, R = arguments.length, L = R < 3 ? S : m === null ? m = Object.getOwnPropertyDescriptor(S, u) : m;
  2873. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  2874. L = Reflect.decorate(v, S, u, m);
  2875. else
  2876. for (var p = v.length - 1; p >= 0; p--)
  2877. (w = v[p]) && (L = (R < 3 ? w(L) : R > 3 ? w(S, u, L) : w(S, u)) || L);
  2878. return R > 3 && L && Object.defineProperty(S, u, L),
  2879. L
  2880. }
  2881. , _ = this && this.__param || function (v, S) {
  2882. return function (u, m) {
  2883. S(u, m, v)
  2884. }
  2885. }
  2886. ;
  2887. Object.defineProperty(r, "__esModule", {
  2888. value: !0
  2889. }),
  2890. r.DomRendererRowFactory = r.CURSOR_STYLE_UNDERLINE_CLASS = r.CURSOR_STYLE_BAR_CLASS = r.CURSOR_STYLE_BLOCK_CLASS = r.CURSOR_BLINK_CLASS = r.CURSOR_CLASS = r.STRIKETHROUGH_CLASS = r.UNDERLINE_CLASS = r.ITALIC_CLASS = r.DIM_CLASS = r.BOLD_CLASS = void 0;
  2891. const h = a(8036)
  2892. , f = a(643)
  2893. , d = a(511)
  2894. , l = a(2585)
  2895. , o = a(8055)
  2896. , t = a(4725)
  2897. , s = a(4269)
  2898. , e = a(1752)
  2899. , i = a(3734);
  2900. r.BOLD_CLASS = "xterm-bold",
  2901. r.DIM_CLASS = "xterm-dim",
  2902. r.ITALIC_CLASS = "xterm-italic",
  2903. r.UNDERLINE_CLASS = "xterm-underline",
  2904. r.STRIKETHROUGH_CLASS = "xterm-strikethrough",
  2905. r.CURSOR_CLASS = "xterm-cursor",
  2906. r.CURSOR_BLINK_CLASS = "xterm-cursor-blink",
  2907. r.CURSOR_STYLE_BLOCK_CLASS = "xterm-cursor-block",
  2908. r.CURSOR_STYLE_BAR_CLASS = "xterm-cursor-bar",
  2909. r.CURSOR_STYLE_UNDERLINE_CLASS = "xterm-cursor-underline";
  2910. let c = class {
  2911. constructor(v, S, u, m, w, R, L) {
  2912. this._document = v,
  2913. this._colors = S,
  2914. this._characterJoinerService = u,
  2915. this._optionsService = m,
  2916. this._coreBrowserService = w,
  2917. this._coreService = R,
  2918. this._decorationService = L,
  2919. this._workCell = new d.CellData,
  2920. this._columnSelectMode = !1
  2921. }
  2922. setColors(v) {
  2923. this._colors = v
  2924. }
  2925. onSelectionChanged(v, S, u) {
  2926. this._selectionStart = v,
  2927. this._selectionEnd = S,
  2928. this._columnSelectMode = u
  2929. }
  2930. createRow(v, S, u, m, w, R, L, p) {
  2931. const C = this._document.createDocumentFragment()
  2932. , b = this._characterJoinerService.getJoinedCharacters(S);
  2933. let E = 0;
  2934. for (let A = Math.min(v.length, p) - 1; A >= 0; A--)
  2935. if (v.loadCell(A, this._workCell).getCode() !== f.NULL_CELL_CODE || u && A === w) {
  2936. E = A + 1;
  2937. break
  2938. }
  2939. for (let A = 0; A < E; A++) {
  2940. v.loadCell(A, this._workCell);
  2941. let H = this._workCell.getWidth();
  2942. if (H === 0)
  2943. continue;
  2944. let j = !1
  2945. , $ = A
  2946. , P = this._workCell;
  2947. if (b.length > 0 && A === b[0][0]) {
  2948. j = !0;
  2949. const K = b.shift();
  2950. P = new s.JoinedCellData(this._workCell, v.translateToString(!0, K[0], K[1]), K[1] - K[0]),
  2951. $ = K[1] - 1,
  2952. H = P.getWidth()
  2953. }
  2954. const N = this._document.createElement("span");
  2955. if (H > 1 && (N.style.width = L * H + "px"),
  2956. j && (N.style.display = "inline",
  2957. w >= A && w <= $ && (w = A)),
  2958. !this._coreService.isCursorHidden && u && A === w)
  2959. switch (N.classList.add(r.CURSOR_CLASS),
  2960. R && N.classList.add(r.CURSOR_BLINK_CLASS),
  2961. m) {
  2962. case "bar":
  2963. N.classList.add(r.CURSOR_STYLE_BAR_CLASS);
  2964. break;
  2965. case "underline":
  2966. N.classList.add(r.CURSOR_STYLE_UNDERLINE_CLASS);
  2967. break;
  2968. default:
  2969. N.classList.add(r.CURSOR_STYLE_BLOCK_CLASS)
  2970. }
  2971. if (P.isBold() && N.classList.add(r.BOLD_CLASS),
  2972. P.isItalic() && N.classList.add(r.ITALIC_CLASS),
  2973. P.isDim() && N.classList.add(r.DIM_CLASS),
  2974. P.isInvisible() ? N.textContent = f.WHITESPACE_CELL_CHAR : N.textContent = P.getChars() || f.WHITESPACE_CELL_CHAR,
  2975. P.isUnderline() && (N.classList.add(`${r.UNDERLINE_CLASS}-${P.extended.underlineStyle}`),
  2976. N.textContent === " " && (N.innerHTML = "&nbsp;"),
  2977. !P.isUnderlineColorDefault()))
  2978. if (P.isUnderlineColorRGB())
  2979. N.style.textDecorationColor = `rgb(${i.AttributeData.toColorRGB(P.getUnderlineColor()).join(",")})`;
  2980. else {
  2981. let K = P.getUnderlineColor();
  2982. this._optionsService.rawOptions.drawBoldTextInBrightColors && P.isBold() && K < 8 && (K += 8),
  2983. N.style.textDecorationColor = this._colors.ansi[K].css
  2984. }
  2985. P.isStrikethrough() && N.classList.add(r.STRIKETHROUGH_CLASS);
  2986. let y = P.getFgColor()
  2987. , T = P.getFgColorMode()
  2988. , O = P.getBgColor()
  2989. , k = P.getBgColorMode();
  2990. const D = !!P.isInverse();
  2991. if (D) {
  2992. const K = y;
  2993. y = O,
  2994. O = K;
  2995. const Z = T;
  2996. T = k,
  2997. k = Z
  2998. }
  2999. let B, I, F = !1;
  3000. this._decorationService.forEachDecorationAtCell(A, S, void 0, K => {
  3001. K.options.layer !== "top" && F || (K.backgroundColorRGB && (k = 50331648,
  3002. O = K.backgroundColorRGB.rgba >> 8 & 16777215,
  3003. B = K.backgroundColorRGB),
  3004. K.foregroundColorRGB && (T = 50331648,
  3005. y = K.foregroundColorRGB.rgba >> 8 & 16777215,
  3006. I = K.foregroundColorRGB),
  3007. F = K.options.layer === "top")
  3008. }
  3009. );
  3010. const M = this._isCellInSelection(A, S);
  3011. let X;
  3012. switch (F || this._colors.selectionForeground && M && (T = 50331648,
  3013. y = this._colors.selectionForeground.rgba >> 8 & 16777215,
  3014. I = this._colors.selectionForeground),
  3015. M && (B = this._coreBrowserService.isFocused ? this._colors.selectionBackgroundOpaque : this._colors.selectionInactiveBackgroundOpaque,
  3016. F = !0),
  3017. F && N.classList.add("xterm-decoration-top"),
  3018. k) {
  3019. case 16777216:
  3020. case 33554432:
  3021. X = this._colors.ansi[O],
  3022. N.classList.add(`xterm-bg-${O}`);
  3023. break;
  3024. case 50331648:
  3025. X = o.rgba.toColor(O >> 16, O >> 8 & 255, 255 & O),
  3026. this._addStyle(N, `background-color:#${g((O >>> 0).toString(16), "0", 6)}`);
  3027. break;
  3028. default:
  3029. D ? (X = this._colors.foreground,
  3030. N.classList.add(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)) : X = this._colors.background
  3031. }
  3032. switch (B || P.isDim() && (B = o.color.multiplyOpacity(X, .5)),
  3033. T) {
  3034. case 16777216:
  3035. case 33554432:
  3036. P.isBold() && y < 8 && this._optionsService.rawOptions.drawBoldTextInBrightColors && (y += 8),
  3037. this._applyMinimumContrast(N, X, this._colors.ansi[y], P, B, void 0) || N.classList.add(`xterm-fg-${y}`);
  3038. break;
  3039. case 50331648:
  3040. const K = o.rgba.toColor(y >> 16 & 255, y >> 8 & 255, 255 & y);
  3041. this._applyMinimumContrast(N, X, K, P, B, I) || this._addStyle(N, `color:#${g(y.toString(16), "0", 6)}`);
  3042. break;
  3043. default:
  3044. this._applyMinimumContrast(N, X, this._colors.foreground, P, B, void 0) || D && N.classList.add(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)
  3045. }
  3046. C.appendChild(N),
  3047. A = $
  3048. }
  3049. return C
  3050. }
  3051. _applyMinimumContrast(v, S, u, m, w, R) {
  3052. if (this._optionsService.rawOptions.minimumContrastRatio === 1 || (0,
  3053. e.excludeFromContrastRatioDemands)(m.getCode()))
  3054. return !1;
  3055. let L;
  3056. return w || R || (L = this._colors.contrastCache.getColor(S.rgba, u.rgba)),
  3057. L === void 0 && (L = o.color.ensureContrastRatio(w || S, R || u, this._optionsService.rawOptions.minimumContrastRatio),
  3058. this._colors.contrastCache.setColor((w || S).rgba, (R || u).rgba, L != null ? L : null)),
  3059. !!L && (this._addStyle(v, `color:${L.css}`),
  3060. !0)
  3061. }
  3062. _addStyle(v, S) {
  3063. v.setAttribute("style", `${v.getAttribute("style") || ""}${S};`)
  3064. }
  3065. _isCellInSelection(v, S) {
  3066. const u = this._selectionStart
  3067. , m = this._selectionEnd;
  3068. return !(!u || !m) && (this._columnSelectMode ? u[0] <= m[0] ? v >= u[0] && S >= u[1] && v < m[0] && S <= m[1] : v < u[0] && S >= u[1] && v >= m[0] && S <= m[1] : S > u[1] && S < m[1] || u[1] === m[1] && S === u[1] && v >= u[0] && v < m[0] || u[1] < m[1] && S === m[1] && v < m[0] || u[1] < m[1] && S === u[1] && v >= u[0])
  3069. }
  3070. }
  3071. ;
  3072. function g(v, S, u) {
  3073. for (; v.length < u;)
  3074. v = S + v;
  3075. return v
  3076. }
  3077. c = n([_(2, t.ICharacterJoinerService), _(3, l.IOptionsService), _(4, t.ICoreBrowserService), _(5, l.ICoreService), _(6, l.IDecorationService)], c),
  3078. r.DomRendererRowFactory = c
  3079. },
  3080. 456: (x, r) => {
  3081. Object.defineProperty(r, "__esModule", {
  3082. value: !0
  3083. }),
  3084. r.SelectionModel = void 0,
  3085. r.SelectionModel = class {
  3086. constructor(a) {
  3087. this._bufferService = a,
  3088. this.isSelectAllActive = !1,
  3089. this.selectionStartLength = 0
  3090. }
  3091. clearSelection() {
  3092. this.selectionStart = void 0,
  3093. this.selectionEnd = void 0,
  3094. this.isSelectAllActive = !1,
  3095. this.selectionStartLength = 0
  3096. }
  3097. get finalSelectionStart() {
  3098. return this.isSelectAllActive ? [0, 0] : this.selectionEnd && this.selectionStart && this.areSelectionValuesReversed() ? this.selectionEnd : this.selectionStart
  3099. }
  3100. get finalSelectionEnd() {
  3101. if (this.isSelectAllActive)
  3102. return [this._bufferService.cols, this._bufferService.buffer.ybase + this._bufferService.rows - 1];
  3103. if (this.selectionStart) {
  3104. if (!this.selectionEnd || this.areSelectionValuesReversed()) {
  3105. const a = this.selectionStart[0] + this.selectionStartLength;
  3106. return a > this._bufferService.cols ? a % this._bufferService.cols == 0 ? [this._bufferService.cols, this.selectionStart[1] + Math.floor(a / this._bufferService.cols) - 1] : [a % this._bufferService.cols, this.selectionStart[1] + Math.floor(a / this._bufferService.cols)] : [a, this.selectionStart[1]]
  3107. }
  3108. if (this.selectionStartLength && this.selectionEnd[1] === this.selectionStart[1]) {
  3109. const a = this.selectionStart[0] + this.selectionStartLength;
  3110. return a > this._bufferService.cols ? [a % this._bufferService.cols, this.selectionStart[1] + Math.floor(a / this._bufferService.cols)] : [Math.max(a, this.selectionEnd[0]), this.selectionEnd[1]]
  3111. }
  3112. return this.selectionEnd
  3113. }
  3114. }
  3115. areSelectionValuesReversed() {
  3116. const a = this.selectionStart
  3117. , n = this.selectionEnd;
  3118. return !(!a || !n) && (a[1] > n[1] || a[1] === n[1] && a[0] > n[0])
  3119. }
  3120. onTrim(a) {
  3121. return this.selectionStart && (this.selectionStart[1] -= a),
  3122. this.selectionEnd && (this.selectionEnd[1] -= a),
  3123. this.selectionEnd && this.selectionEnd[1] < 0 ? (this.clearSelection(),
  3124. !0) : (this.selectionStart && this.selectionStart[1] < 0 && (this.selectionStart[1] = 0),
  3125. !1)
  3126. }
  3127. }
  3128. }
  3129. ,
  3130. 428: function (x, r, a) {
  3131. var n = this && this.__decorate || function (o, t, s, e) {
  3132. var i, c = arguments.length, g = c < 3 ? t : e === null ? e = Object.getOwnPropertyDescriptor(t, s) : e;
  3133. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  3134. g = Reflect.decorate(o, t, s, e);
  3135. else
  3136. for (var v = o.length - 1; v >= 0; v--)
  3137. (i = o[v]) && (g = (c < 3 ? i(g) : c > 3 ? i(t, s, g) : i(t, s)) || g);
  3138. return c > 3 && g && Object.defineProperty(t, s, g),
  3139. g
  3140. }
  3141. , _ = this && this.__param || function (o, t) {
  3142. return function (s, e) {
  3143. t(s, e, o)
  3144. }
  3145. }
  3146. ;
  3147. Object.defineProperty(r, "__esModule", {
  3148. value: !0
  3149. }),
  3150. r.CharSizeService = void 0;
  3151. const h = a(2585)
  3152. , f = a(8460);
  3153. let d = class {
  3154. constructor(o, t, s) {
  3155. this._optionsService = s,
  3156. this.width = 0,
  3157. this.height = 0,
  3158. this._onCharSizeChange = new f.EventEmitter,
  3159. this._measureStrategy = new l(o, t, this._optionsService)
  3160. }
  3161. get hasValidSize() {
  3162. return this.width > 0 && this.height > 0
  3163. }
  3164. get onCharSizeChange() {
  3165. return this._onCharSizeChange.event
  3166. }
  3167. measure() {
  3168. const o = this._measureStrategy.measure();
  3169. o.width === this.width && o.height === this.height || (this.width = o.width,
  3170. this.height = o.height,
  3171. this._onCharSizeChange.fire())
  3172. }
  3173. }
  3174. ;
  3175. d = n([_(2, h.IOptionsService)], d),
  3176. r.CharSizeService = d;
  3177. class l {
  3178. constructor(t, s, e) {
  3179. this._document = t,
  3180. this._parentElement = s,
  3181. this._optionsService = e,
  3182. this._result = {
  3183. width: 0,
  3184. height: 0
  3185. },
  3186. this._measureElement = this._document.createElement("span"),
  3187. this._measureElement.classList.add("xterm-char-measure-element"),
  3188. this._measureElement.textContent = "W",
  3189. this._measureElement.setAttribute("aria-hidden", "true"),
  3190. this._parentElement.appendChild(this._measureElement)
  3191. }
  3192. measure() {
  3193. this._measureElement.style.fontFamily = this._optionsService.rawOptions.fontFamily,
  3194. this._measureElement.style.fontSize = `${this._optionsService.rawOptions.fontSize}px`;
  3195. const t = this._measureElement.getBoundingClientRect();
  3196. return t.width !== 0 && t.height !== 0 && (this._result.width = t.width,
  3197. this._result.height = Math.ceil(t.height)),
  3198. this._result
  3199. }
  3200. }
  3201. },
  3202. 4269: function (x, r, a) {
  3203. var n = this && this.__decorate || function (s, e, i, c) {
  3204. var g, v = arguments.length, S = v < 3 ? e : c === null ? c = Object.getOwnPropertyDescriptor(e, i) : c;
  3205. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  3206. S = Reflect.decorate(s, e, i, c);
  3207. else
  3208. for (var u = s.length - 1; u >= 0; u--)
  3209. (g = s[u]) && (S = (v < 3 ? g(S) : v > 3 ? g(e, i, S) : g(e, i)) || S);
  3210. return v > 3 && S && Object.defineProperty(e, i, S),
  3211. S
  3212. }
  3213. , _ = this && this.__param || function (s, e) {
  3214. return function (i, c) {
  3215. e(i, c, s)
  3216. }
  3217. }
  3218. ;
  3219. Object.defineProperty(r, "__esModule", {
  3220. value: !0
  3221. }),
  3222. r.CharacterJoinerService = r.JoinedCellData = void 0;
  3223. const h = a(3734)
  3224. , f = a(643)
  3225. , d = a(511)
  3226. , l = a(2585);
  3227. class o extends h.AttributeData {
  3228. constructor(e, i, c) {
  3229. super(),
  3230. this.content = 0,
  3231. this.combinedData = "",
  3232. this.fg = e.fg,
  3233. this.bg = e.bg,
  3234. this.combinedData = i,
  3235. this._width = c
  3236. }
  3237. isCombined() {
  3238. return 2097152
  3239. }
  3240. getWidth() {
  3241. return this._width
  3242. }
  3243. getChars() {
  3244. return this.combinedData
  3245. }
  3246. getCode() {
  3247. return 2097151
  3248. }
  3249. setFromCharData(e) {
  3250. throw new Error("not implemented")
  3251. }
  3252. getAsCharData() {
  3253. return [this.fg, this.getChars(), this.getWidth(), this.getCode()]
  3254. }
  3255. }
  3256. r.JoinedCellData = o;
  3257. let t = class be {
  3258. constructor(e) {
  3259. this._bufferService = e,
  3260. this._characterJoiners = [],
  3261. this._nextCharacterJoinerId = 0,
  3262. this._workCell = new d.CellData
  3263. }
  3264. register(e) {
  3265. const i = {
  3266. id: this._nextCharacterJoinerId++,
  3267. handler: e
  3268. };
  3269. return this._characterJoiners.push(i),
  3270. i.id
  3271. }
  3272. deregister(e) {
  3273. for (let i = 0; i < this._characterJoiners.length; i++)
  3274. if (this._characterJoiners[i].id === e)
  3275. return this._characterJoiners.splice(i, 1),
  3276. !0;
  3277. return !1
  3278. }
  3279. getJoinedCharacters(e) {
  3280. if (this._characterJoiners.length === 0)
  3281. return [];
  3282. const i = this._bufferService.buffer.lines.get(e);
  3283. if (!i || i.length === 0)
  3284. return [];
  3285. const c = []
  3286. , g = i.translateToString(!0);
  3287. let v = 0
  3288. , S = 0
  3289. , u = 0
  3290. , m = i.getFg(0)
  3291. , w = i.getBg(0);
  3292. for (let R = 0; R < i.getTrimmedLength(); R++)
  3293. if (i.loadCell(R, this._workCell),
  3294. this._workCell.getWidth() !== 0) {
  3295. if (this._workCell.fg !== m || this._workCell.bg !== w) {
  3296. if (R - v > 1) {
  3297. const L = this._getJoinedRanges(g, u, S, i, v);
  3298. for (let p = 0; p < L.length; p++)
  3299. c.push(L[p])
  3300. }
  3301. v = R,
  3302. u = S,
  3303. m = this._workCell.fg,
  3304. w = this._workCell.bg
  3305. }
  3306. S += this._workCell.getChars().length || f.WHITESPACE_CELL_CHAR.length
  3307. }
  3308. if (this._bufferService.cols - v > 1) {
  3309. const R = this._getJoinedRanges(g, u, S, i, v);
  3310. for (let L = 0; L < R.length; L++)
  3311. c.push(R[L])
  3312. }
  3313. return c
  3314. }
  3315. _getJoinedRanges(e, i, c, g, v) {
  3316. const S = e.substring(i, c);
  3317. let u = [];
  3318. try {
  3319. u = this._characterJoiners[0].handler(S)
  3320. } catch (m) {
  3321. console.error(m)
  3322. }
  3323. for (let m = 1; m < this._characterJoiners.length; m++)
  3324. try {
  3325. const w = this._characterJoiners[m].handler(S);
  3326. for (let R = 0; R < w.length; R++)
  3327. be._mergeRanges(u, w[R])
  3328. } catch (w) {
  3329. console.error(w)
  3330. }
  3331. return this._stringRangesToCellRanges(u, g, v),
  3332. u
  3333. }
  3334. _stringRangesToCellRanges(e, i, c) {
  3335. let g = 0
  3336. , v = !1
  3337. , S = 0
  3338. , u = e[g];
  3339. if (u) {
  3340. for (let m = c; m < this._bufferService.cols; m++) {
  3341. const w = i.getWidth(m)
  3342. , R = i.getString(m).length || f.WHITESPACE_CELL_CHAR.length;
  3343. if (w !== 0) {
  3344. if (!v && u[0] <= S && (u[0] = m,
  3345. v = !0),
  3346. u[1] <= S) {
  3347. if (u[1] = m,
  3348. u = e[++g],
  3349. !u)
  3350. break;
  3351. u[0] <= S ? (u[0] = m,
  3352. v = !0) : v = !1
  3353. }
  3354. S += R
  3355. }
  3356. }
  3357. u && (u[1] = this._bufferService.cols)
  3358. }
  3359. }
  3360. static _mergeRanges(e, i) {
  3361. let c = !1;
  3362. for (let g = 0; g < e.length; g++) {
  3363. const v = e[g];
  3364. if (c) {
  3365. if (i[1] <= v[0])
  3366. return e[g - 1][1] = i[1],
  3367. e;
  3368. if (i[1] <= v[1])
  3369. return e[g - 1][1] = Math.max(i[1], v[1]),
  3370. e.splice(g, 1),
  3371. e;
  3372. e.splice(g, 1),
  3373. g--
  3374. } else {
  3375. if (i[1] <= v[0])
  3376. return e.splice(g, 0, i),
  3377. e;
  3378. if (i[1] <= v[1])
  3379. return v[0] = Math.min(i[0], v[0]),
  3380. e;
  3381. i[0] < v[1] && (v[0] = Math.min(i[0], v[0]),
  3382. c = !0)
  3383. }
  3384. }
  3385. return c ? e[e.length - 1][1] = i[1] : e.push(i),
  3386. e
  3387. }
  3388. }
  3389. ;
  3390. t = n([_(0, l.IBufferService)], t),
  3391. r.CharacterJoinerService = t
  3392. },
  3393. 5114: (x, r) => {
  3394. Object.defineProperty(r, "__esModule", {
  3395. value: !0
  3396. }),
  3397. r.CoreBrowserService = void 0,
  3398. r.CoreBrowserService = class {
  3399. constructor(a, n) {
  3400. this._textarea = a,
  3401. this.window = n
  3402. }
  3403. get dpr() {
  3404. return this.window.devicePixelRatio
  3405. }
  3406. get isFocused() {
  3407. return (this._textarea.getRootNode ? this._textarea.getRootNode() : this._textarea.ownerDocument).activeElement === this._textarea && this._textarea.ownerDocument.hasFocus()
  3408. }
  3409. }
  3410. }
  3411. ,
  3412. 8934: function (x, r, a) {
  3413. var n = this && this.__decorate || function (l, o, t, s) {
  3414. var e, i = arguments.length, c = i < 3 ? o : s === null ? s = Object.getOwnPropertyDescriptor(o, t) : s;
  3415. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  3416. c = Reflect.decorate(l, o, t, s);
  3417. else
  3418. for (var g = l.length - 1; g >= 0; g--)
  3419. (e = l[g]) && (c = (i < 3 ? e(c) : i > 3 ? e(o, t, c) : e(o, t)) || c);
  3420. return i > 3 && c && Object.defineProperty(o, t, c),
  3421. c
  3422. }
  3423. , _ = this && this.__param || function (l, o) {
  3424. return function (t, s) {
  3425. o(t, s, l)
  3426. }
  3427. }
  3428. ;
  3429. Object.defineProperty(r, "__esModule", {
  3430. value: !0
  3431. }),
  3432. r.MouseService = void 0;
  3433. const h = a(4725)
  3434. , f = a(9806);
  3435. let d = class {
  3436. constructor(l, o) {
  3437. this._renderService = l,
  3438. this._charSizeService = o
  3439. }
  3440. getCoords(l, o, t, s, e) {
  3441. return (0,
  3442. f.getCoords)(window, l, o, t, s, this._charSizeService.hasValidSize, this._renderService.dimensions.actualCellWidth, this._renderService.dimensions.actualCellHeight, e)
  3443. }
  3444. getMouseReportCoords(l, o) {
  3445. const t = (0,
  3446. f.getCoordsRelativeToElement)(window, l, o);
  3447. if (!(!this._charSizeService.hasValidSize || t[0] < 0 || t[1] < 0 || t[0] >= this._renderService.dimensions.canvasWidth || t[1] >= this._renderService.dimensions.canvasHeight))
  3448. return {
  3449. col: Math.floor(t[0] / this._renderService.dimensions.actualCellWidth),
  3450. row: Math.floor(t[1] / this._renderService.dimensions.actualCellHeight),
  3451. x: Math.floor(t[0]),
  3452. y: Math.floor(t[1])
  3453. }
  3454. }
  3455. }
  3456. ;
  3457. d = n([_(0, h.IRenderService), _(1, h.ICharSizeService)], d),
  3458. r.MouseService = d
  3459. },
  3460. 3230: function (x, r, a) {
  3461. var n = this && this.__decorate || function (i, c, g, v) {
  3462. var S, u = arguments.length, m = u < 3 ? c : v === null ? v = Object.getOwnPropertyDescriptor(c, g) : v;
  3463. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  3464. m = Reflect.decorate(i, c, g, v);
  3465. else
  3466. for (var w = i.length - 1; w >= 0; w--)
  3467. (S = i[w]) && (m = (u < 3 ? S(m) : u > 3 ? S(c, g, m) : S(c, g)) || m);
  3468. return u > 3 && m && Object.defineProperty(c, g, m),
  3469. m
  3470. }
  3471. , _ = this && this.__param || function (i, c) {
  3472. return function (g, v) {
  3473. c(g, v, i)
  3474. }
  3475. }
  3476. ;
  3477. Object.defineProperty(r, "__esModule", {
  3478. value: !0
  3479. }),
  3480. r.RenderService = void 0;
  3481. const h = a(6193)
  3482. , f = a(8460)
  3483. , d = a(844)
  3484. , l = a(5596)
  3485. , o = a(3656)
  3486. , t = a(2585)
  3487. , s = a(4725);
  3488. let e = class extends d.Disposable {
  3489. constructor(i, c, g, v, S, u, m, w) {
  3490. if (super(),
  3491. this._renderer = i,
  3492. this._rowCount = c,
  3493. this._charSizeService = S,
  3494. this._isPaused = !1,
  3495. this._needsFullRefresh = !1,
  3496. this._isNextRenderRedrawOnly = !0,
  3497. this._needsSelectionRefresh = !1,
  3498. this._canvasWidth = 0,
  3499. this._canvasHeight = 0,
  3500. this._selectionState = {
  3501. start: void 0,
  3502. end: void 0,
  3503. columnSelectMode: !1
  3504. },
  3505. this._onDimensionsChange = new f.EventEmitter,
  3506. this._onRenderedViewportChange = new f.EventEmitter,
  3507. this._onRender = new f.EventEmitter,
  3508. this._onRefreshRequest = new f.EventEmitter,
  3509. this.register({
  3510. dispose: () => this._renderer.dispose()
  3511. }),
  3512. this._renderDebouncer = new h.RenderDebouncer(w.window, (R, L) => this._renderRows(R, L)),
  3513. this.register(this._renderDebouncer),
  3514. this._screenDprMonitor = new l.ScreenDprMonitor(w.window),
  3515. this._screenDprMonitor.setListener(() => this.onDevicePixelRatioChange()),
  3516. this.register(this._screenDprMonitor),
  3517. this.register(m.onResize(() => this._fullRefresh())),
  3518. this.register(m.buffers.onBufferActivate(() => {
  3519. var R;
  3520. return (R = this._renderer) === null || R === void 0 ? void 0 : R.clear()
  3521. }
  3522. )),
  3523. this.register(v.onOptionChange(() => this._handleOptionsChanged())),
  3524. this.register(this._charSizeService.onCharSizeChange(() => this.onCharSizeChanged())),
  3525. this.register(u.onDecorationRegistered(() => this._fullRefresh())),
  3526. this.register(u.onDecorationRemoved(() => this._fullRefresh())),
  3527. this._renderer.onRequestRedraw(R => this.refreshRows(R.start, R.end, !0)),
  3528. this.register((0,
  3529. o.addDisposableDomListener)(w.window, "resize", () => this.onDevicePixelRatioChange())),
  3530. "IntersectionObserver" in w.window) {
  3531. const R = new w.window.IntersectionObserver(L => this._onIntersectionChange(L[L.length - 1]), {
  3532. threshold: 0
  3533. });
  3534. R.observe(g),
  3535. this.register({
  3536. dispose: () => R.disconnect()
  3537. })
  3538. }
  3539. }
  3540. get onDimensionsChange() {
  3541. return this._onDimensionsChange.event
  3542. }
  3543. get onRenderedViewportChange() {
  3544. return this._onRenderedViewportChange.event
  3545. }
  3546. get onRender() {
  3547. return this._onRender.event
  3548. }
  3549. get onRefreshRequest() {
  3550. return this._onRefreshRequest.event
  3551. }
  3552. get dimensions() {
  3553. return this._renderer.dimensions
  3554. }
  3555. _onIntersectionChange(i) {
  3556. this._isPaused = i.isIntersecting === void 0 ? i.intersectionRatio === 0 : !i.isIntersecting,
  3557. this._isPaused || this._charSizeService.hasValidSize || this._charSizeService.measure(),
  3558. !this._isPaused && this._needsFullRefresh && (this.refreshRows(0, this._rowCount - 1),
  3559. this._needsFullRefresh = !1)
  3560. }
  3561. refreshRows(i, c, g = !1) {
  3562. this._isPaused ? this._needsFullRefresh = !0 : (g || (this._isNextRenderRedrawOnly = !1),
  3563. this._renderDebouncer.refresh(i, c, this._rowCount))
  3564. }
  3565. _renderRows(i, c) {
  3566. this._renderer.renderRows(i, c),
  3567. this._needsSelectionRefresh && (this._renderer.onSelectionChanged(this._selectionState.start, this._selectionState.end, this._selectionState.columnSelectMode),
  3568. this._needsSelectionRefresh = !1),
  3569. this._isNextRenderRedrawOnly || this._onRenderedViewportChange.fire({
  3570. start: i,
  3571. end: c
  3572. }),
  3573. this._onRender.fire({
  3574. start: i,
  3575. end: c
  3576. }),
  3577. this._isNextRenderRedrawOnly = !0
  3578. }
  3579. resize(i, c) {
  3580. this._rowCount = c,
  3581. this._fireOnCanvasResize()
  3582. }
  3583. _handleOptionsChanged() {
  3584. this._renderer.onOptionsChanged(),
  3585. this.refreshRows(0, this._rowCount - 1),
  3586. this._fireOnCanvasResize()
  3587. }
  3588. _fireOnCanvasResize() {
  3589. this._renderer.dimensions.canvasWidth === this._canvasWidth && this._renderer.dimensions.canvasHeight === this._canvasHeight || this._onDimensionsChange.fire(this._renderer.dimensions)
  3590. }
  3591. dispose() {
  3592. super.dispose()
  3593. }
  3594. setRenderer(i) {
  3595. this._renderer.dispose(),
  3596. this._renderer = i,
  3597. this._renderer.onRequestRedraw(c => this.refreshRows(c.start, c.end, !0)),
  3598. this._needsSelectionRefresh = !0,
  3599. this._fullRefresh()
  3600. }
  3601. addRefreshCallback(i) {
  3602. return this._renderDebouncer.addRefreshCallback(i)
  3603. }
  3604. _fullRefresh() {
  3605. this._isPaused ? this._needsFullRefresh = !0 : this.refreshRows(0, this._rowCount - 1)
  3606. }
  3607. clearTextureAtlas() {
  3608. var i, c;
  3609. (c = (i = this._renderer) === null || i === void 0 ? void 0 : i.clearTextureAtlas) === null || c === void 0 || c.call(i),
  3610. this._fullRefresh()
  3611. }
  3612. setColors(i) {
  3613. this._renderer.setColors(i),
  3614. this._fullRefresh()
  3615. }
  3616. onDevicePixelRatioChange() {
  3617. this._charSizeService.measure(),
  3618. this._renderer.onDevicePixelRatioChange(),
  3619. this.refreshRows(0, this._rowCount - 1)
  3620. }
  3621. onResize(i, c) {
  3622. this._renderer.onResize(i, c),
  3623. this._fullRefresh()
  3624. }
  3625. onCharSizeChanged() {
  3626. this._renderer.onCharSizeChanged()
  3627. }
  3628. onBlur() {
  3629. this._renderer.onBlur()
  3630. }
  3631. onFocus() {
  3632. this._renderer.onFocus()
  3633. }
  3634. onSelectionChanged(i, c, g) {
  3635. this._selectionState.start = i,
  3636. this._selectionState.end = c,
  3637. this._selectionState.columnSelectMode = g,
  3638. this._renderer.onSelectionChanged(i, c, g)
  3639. }
  3640. onCursorMove() {
  3641. this._renderer.onCursorMove()
  3642. }
  3643. clear() {
  3644. this._renderer.clear()
  3645. }
  3646. }
  3647. ;
  3648. e = n([_(3, t.IOptionsService), _(4, s.ICharSizeService), _(5, t.IDecorationService), _(6, t.IBufferService), _(7, s.ICoreBrowserService)], e),
  3649. r.RenderService = e
  3650. },
  3651. 9312: function (x, r, a) {
  3652. var n = this && this.__decorate || function (u, m, w, R) {
  3653. var L, p = arguments.length, C = p < 3 ? m : R === null ? R = Object.getOwnPropertyDescriptor(m, w) : R;
  3654. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  3655. C = Reflect.decorate(u, m, w, R);
  3656. else
  3657. for (var b = u.length - 1; b >= 0; b--)
  3658. (L = u[b]) && (C = (p < 3 ? L(C) : p > 3 ? L(m, w, C) : L(m, w)) || C);
  3659. return p > 3 && C && Object.defineProperty(m, w, C),
  3660. C
  3661. }
  3662. , _ = this && this.__param || function (u, m) {
  3663. return function (w, R) {
  3664. m(w, R, u)
  3665. }
  3666. }
  3667. ;
  3668. Object.defineProperty(r, "__esModule", {
  3669. value: !0
  3670. }),
  3671. r.SelectionService = void 0;
  3672. const h = a(6114)
  3673. , f = a(456)
  3674. , d = a(511)
  3675. , l = a(8460)
  3676. , o = a(4725)
  3677. , t = a(2585)
  3678. , s = a(9806)
  3679. , e = a(9504)
  3680. , i = a(844)
  3681. , c = a(4841)
  3682. , g = String.fromCharCode(160)
  3683. , v = new RegExp(g, "g");
  3684. let S = class extends i.Disposable {
  3685. constructor(u, m, w, R, L, p, C, b, E) {
  3686. super(),
  3687. this._element = u,
  3688. this._screenElement = m,
  3689. this._linkifier = w,
  3690. this._bufferService = R,
  3691. this._coreService = L,
  3692. this._mouseService = p,
  3693. this._optionsService = C,
  3694. this._renderService = b,
  3695. this._coreBrowserService = E,
  3696. this._dragScrollAmount = 0,
  3697. this._enabled = !0,
  3698. this._workCell = new d.CellData,
  3699. this._mouseDownTimeStamp = 0,
  3700. this._oldHasSelection = !1,
  3701. this._oldSelectionStart = void 0,
  3702. this._oldSelectionEnd = void 0,
  3703. this._onLinuxMouseSelection = this.register(new l.EventEmitter),
  3704. this._onRedrawRequest = this.register(new l.EventEmitter),
  3705. this._onSelectionChange = this.register(new l.EventEmitter),
  3706. this._onRequestScrollLines = this.register(new l.EventEmitter),
  3707. this._mouseMoveListener = A => this._onMouseMove(A),
  3708. this._mouseUpListener = A => this._onMouseUp(A),
  3709. this._coreService.onUserInput(() => {
  3710. this.hasSelection && this.clearSelection()
  3711. }
  3712. ),
  3713. this._trimListener = this._bufferService.buffer.lines.onTrim(A => this._onTrim(A)),
  3714. this.register(this._bufferService.buffers.onBufferActivate(A => this._onBufferActivate(A))),
  3715. this.enable(),
  3716. this._model = new f.SelectionModel(this._bufferService),
  3717. this._activeSelectionMode = 0
  3718. }
  3719. get onLinuxMouseSelection() {
  3720. return this._onLinuxMouseSelection.event
  3721. }
  3722. get onRequestRedraw() {
  3723. return this._onRedrawRequest.event
  3724. }
  3725. get onSelectionChange() {
  3726. return this._onSelectionChange.event
  3727. }
  3728. get onRequestScrollLines() {
  3729. return this._onRequestScrollLines.event
  3730. }
  3731. dispose() {
  3732. this._removeMouseDownListeners()
  3733. }
  3734. reset() {
  3735. this.clearSelection()
  3736. }
  3737. disable() {
  3738. this.clearSelection(),
  3739. this._enabled = !1
  3740. }
  3741. enable() {
  3742. this._enabled = !0
  3743. }
  3744. get selectionStart() {
  3745. return this._model.finalSelectionStart
  3746. }
  3747. get selectionEnd() {
  3748. return this._model.finalSelectionEnd
  3749. }
  3750. get hasSelection() {
  3751. const u = this._model.finalSelectionStart
  3752. , m = this._model.finalSelectionEnd;
  3753. return !(!u || !m || u[0] === m[0] && u[1] === m[1])
  3754. }
  3755. get selectionText() {
  3756. const u = this._model.finalSelectionStart
  3757. , m = this._model.finalSelectionEnd;
  3758. if (!u || !m)
  3759. return "";
  3760. const w = this._bufferService.buffer
  3761. , R = [];
  3762. if (this._activeSelectionMode === 3) {
  3763. if (u[0] === m[0])
  3764. return "";
  3765. const L = u[0] < m[0] ? u[0] : m[0]
  3766. , p = u[0] < m[0] ? m[0] : u[0];
  3767. for (let C = u[1]; C <= m[1]; C++) {
  3768. const b = w.translateBufferLineToString(C, !0, L, p);
  3769. R.push(b)
  3770. }
  3771. } else {
  3772. const L = u[1] === m[1] ? m[0] : void 0;
  3773. R.push(w.translateBufferLineToString(u[1], !0, u[0], L));
  3774. for (let p = u[1] + 1; p <= m[1] - 1; p++) {
  3775. const C = w.lines.get(p)
  3776. , b = w.translateBufferLineToString(p, !0);
  3777. C != null && C.isWrapped ? R[R.length - 1] += b : R.push(b)
  3778. }
  3779. if (u[1] !== m[1]) {
  3780. const p = w.lines.get(m[1])
  3781. , C = w.translateBufferLineToString(m[1], !0, 0, m[0]);
  3782. p && p.isWrapped ? R[R.length - 1] += C : R.push(C)
  3783. }
  3784. }
  3785. return R.map(L => L.replace(v, " ")).join(h.isWindows ? `\r
  3786. ` : `
  3787. `)
  3788. }
  3789. clearSelection() {
  3790. this._model.clearSelection(),
  3791. this._removeMouseDownListeners(),
  3792. this.refresh(),
  3793. this._onSelectionChange.fire()
  3794. }
  3795. refresh(u) {
  3796. this._refreshAnimationFrame || (this._refreshAnimationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._refresh())),
  3797. h.isLinux && u && this.selectionText.length && this._onLinuxMouseSelection.fire(this.selectionText)
  3798. }
  3799. _refresh() {
  3800. this._refreshAnimationFrame = void 0,
  3801. this._onRedrawRequest.fire({
  3802. start: this._model.finalSelectionStart,
  3803. end: this._model.finalSelectionEnd,
  3804. columnSelectMode: this._activeSelectionMode === 3
  3805. })
  3806. }
  3807. _isClickInSelection(u) {
  3808. const m = this._getMouseBufferCoords(u)
  3809. , w = this._model.finalSelectionStart
  3810. , R = this._model.finalSelectionEnd;
  3811. return !!(w && R && m) && this._areCoordsInSelection(m, w, R)
  3812. }
  3813. isCellInSelection(u, m) {
  3814. const w = this._model.finalSelectionStart
  3815. , R = this._model.finalSelectionEnd;
  3816. return !(!w || !R) && this._areCoordsInSelection([u, m], w, R)
  3817. }
  3818. _areCoordsInSelection(u, m, w) {
  3819. return u[1] > m[1] && u[1] < w[1] || m[1] === w[1] && u[1] === m[1] && u[0] >= m[0] && u[0] < w[0] || m[1] < w[1] && u[1] === w[1] && u[0] < w[0] || m[1] < w[1] && u[1] === m[1] && u[0] >= m[0]
  3820. }
  3821. _selectWordAtCursor(u, m) {
  3822. var w, R;
  3823. const L = (R = (w = this._linkifier.currentLink) === null || w === void 0 ? void 0 : w.link) === null || R === void 0 ? void 0 : R.range;
  3824. if (L)
  3825. return this._model.selectionStart = [L.start.x - 1, L.start.y - 1],
  3826. this._model.selectionStartLength = (0,
  3827. c.getRangeLength)(L, this._bufferService.cols),
  3828. this._model.selectionEnd = void 0,
  3829. !0;
  3830. const p = this._getMouseBufferCoords(u);
  3831. return !!p && (this._selectWordAt(p, m),
  3832. this._model.selectionEnd = void 0,
  3833. !0)
  3834. }
  3835. selectAll() {
  3836. this._model.isSelectAllActive = !0,
  3837. this.refresh(),
  3838. this._onSelectionChange.fire()
  3839. }
  3840. selectLines(u, m) {
  3841. this._model.clearSelection(),
  3842. u = Math.max(u, 0),
  3843. m = Math.min(m, this._bufferService.buffer.lines.length - 1),
  3844. this._model.selectionStart = [0, u],
  3845. this._model.selectionEnd = [this._bufferService.cols, m],
  3846. this.refresh(),
  3847. this._onSelectionChange.fire()
  3848. }
  3849. _onTrim(u) {
  3850. this._model.onTrim(u) && this.refresh()
  3851. }
  3852. _getMouseBufferCoords(u) {
  3853. const m = this._mouseService.getCoords(u, this._screenElement, this._bufferService.cols, this._bufferService.rows, !0);
  3854. if (m)
  3855. return m[0]--,
  3856. m[1]--,
  3857. m[1] += this._bufferService.buffer.ydisp,
  3858. m
  3859. }
  3860. _getMouseEventScrollAmount(u) {
  3861. let m = (0,
  3862. s.getCoordsRelativeToElement)(this._coreBrowserService.window, u, this._screenElement)[1];
  3863. const w = this._renderService.dimensions.canvasHeight;
  3864. return m >= 0 && m <= w ? 0 : (m > w && (m -= w),
  3865. m = Math.min(Math.max(m, -50), 50),
  3866. m /= 50,
  3867. m / Math.abs(m) + Math.round(14 * m))
  3868. }
  3869. shouldForceSelection(u) {
  3870. return h.isMac ? u.altKey && this._optionsService.rawOptions.macOptionClickForcesSelection : u.shiftKey
  3871. }
  3872. onMouseDown(u) {
  3873. if (this._mouseDownTimeStamp = u.timeStamp,
  3874. (u.button !== 2 || !this.hasSelection) && u.button === 0) {
  3875. if (!this._enabled) {
  3876. if (!this.shouldForceSelection(u))
  3877. return;
  3878. u.stopPropagation()
  3879. }
  3880. u.preventDefault(),
  3881. this._dragScrollAmount = 0,
  3882. this._enabled && u.shiftKey ? this._onIncrementalClick(u) : u.detail === 1 ? this._onSingleClick(u) : u.detail === 2 ? this._onDoubleClick(u) : u.detail === 3 && this._onTripleClick(u),
  3883. this._addMouseDownListeners(),
  3884. this.refresh(!0)
  3885. }
  3886. }
  3887. _addMouseDownListeners() {
  3888. this._screenElement.ownerDocument && (this._screenElement.ownerDocument.addEventListener("mousemove", this._mouseMoveListener),
  3889. this._screenElement.ownerDocument.addEventListener("mouseup", this._mouseUpListener)),
  3890. this._dragScrollIntervalTimer = this._coreBrowserService.window.setInterval(() => this._dragScroll(), 50)
  3891. }
  3892. _removeMouseDownListeners() {
  3893. this._screenElement.ownerDocument && (this._screenElement.ownerDocument.removeEventListener("mousemove", this._mouseMoveListener),
  3894. this._screenElement.ownerDocument.removeEventListener("mouseup", this._mouseUpListener)),
  3895. this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),
  3896. this._dragScrollIntervalTimer = void 0
  3897. }
  3898. _onIncrementalClick(u) {
  3899. this._model.selectionStart && (this._model.selectionEnd = this._getMouseBufferCoords(u))
  3900. }
  3901. _onSingleClick(u) {
  3902. if (this._model.selectionStartLength = 0,
  3903. this._model.isSelectAllActive = !1,
  3904. this._activeSelectionMode = this.shouldColumnSelect(u) ? 3 : 0,
  3905. this._model.selectionStart = this._getMouseBufferCoords(u),
  3906. !this._model.selectionStart)
  3907. return;
  3908. this._model.selectionEnd = void 0;
  3909. const m = this._bufferService.buffer.lines.get(this._model.selectionStart[1]);
  3910. m && m.length !== this._model.selectionStart[0] && m.hasWidth(this._model.selectionStart[0]) === 0 && this._model.selectionStart[0]++
  3911. }
  3912. _onDoubleClick(u) {
  3913. this._selectWordAtCursor(u, !0) && (this._activeSelectionMode = 1)
  3914. }
  3915. _onTripleClick(u) {
  3916. const m = this._getMouseBufferCoords(u);
  3917. m && (this._activeSelectionMode = 2,
  3918. this._selectLineAt(m[1]))
  3919. }
  3920. shouldColumnSelect(u) {
  3921. return u.altKey && !(h.isMac && this._optionsService.rawOptions.macOptionClickForcesSelection)
  3922. }
  3923. _onMouseMove(u) {
  3924. if (u.stopImmediatePropagation(),
  3925. !this._model.selectionStart)
  3926. return;
  3927. const m = this._model.selectionEnd ? [this._model.selectionEnd[0], this._model.selectionEnd[1]] : null;
  3928. if (this._model.selectionEnd = this._getMouseBufferCoords(u),
  3929. !this._model.selectionEnd)
  3930. return void this.refresh(!0);
  3931. this._activeSelectionMode === 2 ? this._model.selectionEnd[1] < this._model.selectionStart[1] ? this._model.selectionEnd[0] = 0 : this._model.selectionEnd[0] = this._bufferService.cols : this._activeSelectionMode === 1 && this._selectToWordAt(this._model.selectionEnd),
  3932. this._dragScrollAmount = this._getMouseEventScrollAmount(u),
  3933. this._activeSelectionMode !== 3 && (this._dragScrollAmount > 0 ? this._model.selectionEnd[0] = this._bufferService.cols : this._dragScrollAmount < 0 && (this._model.selectionEnd[0] = 0));
  3934. const w = this._bufferService.buffer;
  3935. if (this._model.selectionEnd[1] < w.lines.length) {
  3936. const R = w.lines.get(this._model.selectionEnd[1]);
  3937. R && R.hasWidth(this._model.selectionEnd[0]) === 0 && this._model.selectionEnd[0]++
  3938. }
  3939. m && m[0] === this._model.selectionEnd[0] && m[1] === this._model.selectionEnd[1] || this.refresh(!0)
  3940. }
  3941. _dragScroll() {
  3942. if (this._model.selectionEnd && this._model.selectionStart && this._dragScrollAmount) {
  3943. this._onRequestScrollLines.fire({
  3944. amount: this._dragScrollAmount,
  3945. suppressScrollEvent: !1
  3946. });
  3947. const u = this._bufferService.buffer;
  3948. this._dragScrollAmount > 0 ? (this._activeSelectionMode !== 3 && (this._model.selectionEnd[0] = this._bufferService.cols),
  3949. this._model.selectionEnd[1] = Math.min(u.ydisp + this._bufferService.rows, u.lines.length - 1)) : (this._activeSelectionMode !== 3 && (this._model.selectionEnd[0] = 0),
  3950. this._model.selectionEnd[1] = u.ydisp),
  3951. this.refresh()
  3952. }
  3953. }
  3954. _onMouseUp(u) {
  3955. const m = u.timeStamp - this._mouseDownTimeStamp;
  3956. if (this._removeMouseDownListeners(),
  3957. this.selectionText.length <= 1 && m < 500 && u.altKey && this._optionsService.rawOptions.altClickMovesCursor) {
  3958. if (this._bufferService.buffer.ybase === this._bufferService.buffer.ydisp) {
  3959. const w = this._mouseService.getCoords(u, this._element, this._bufferService.cols, this._bufferService.rows, !1);
  3960. if (w && w[0] !== void 0 && w[1] !== void 0) {
  3961. const R = (0,
  3962. e.moveToCellSequence)(w[0] - 1, w[1] - 1, this._bufferService, this._coreService.decPrivateModes.applicationCursorKeys);
  3963. this._coreService.triggerDataEvent(R, !0)
  3964. }
  3965. }
  3966. } else
  3967. this._fireEventIfSelectionChanged()
  3968. }
  3969. _fireEventIfSelectionChanged() {
  3970. const u = this._model.finalSelectionStart
  3971. , m = this._model.finalSelectionEnd
  3972. , w = !(!u || !m || u[0] === m[0] && u[1] === m[1]);
  3973. w ? u && m && (this._oldSelectionStart && this._oldSelectionEnd && u[0] === this._oldSelectionStart[0] && u[1] === this._oldSelectionStart[1] && m[0] === this._oldSelectionEnd[0] && m[1] === this._oldSelectionEnd[1] || this._fireOnSelectionChange(u, m, w)) : this._oldHasSelection && this._fireOnSelectionChange(u, m, w)
  3974. }
  3975. _fireOnSelectionChange(u, m, w) {
  3976. this._oldSelectionStart = u,
  3977. this._oldSelectionEnd = m,
  3978. this._oldHasSelection = w,
  3979. this._onSelectionChange.fire()
  3980. }
  3981. _onBufferActivate(u) {
  3982. this.clearSelection(),
  3983. this._trimListener.dispose(),
  3984. this._trimListener = u.activeBuffer.lines.onTrim(m => this._onTrim(m))
  3985. }
  3986. _convertViewportColToCharacterIndex(u, m) {
  3987. let w = m[0];
  3988. for (let R = 0; m[0] >= R; R++) {
  3989. const L = u.loadCell(R, this._workCell).getChars().length;
  3990. this._workCell.getWidth() === 0 ? w-- : L > 1 && m[0] !== R && (w += L - 1)
  3991. }
  3992. return w
  3993. }
  3994. setSelection(u, m, w) {
  3995. this._model.clearSelection(),
  3996. this._removeMouseDownListeners(),
  3997. this._model.selectionStart = [u, m],
  3998. this._model.selectionStartLength = w,
  3999. this.refresh(),
  4000. this._fireEventIfSelectionChanged()
  4001. }
  4002. rightClickSelect(u) {
  4003. this._isClickInSelection(u) || (this._selectWordAtCursor(u, !1) && this.refresh(!0),
  4004. this._fireEventIfSelectionChanged())
  4005. }
  4006. _getWordAt(u, m, w = !0, R = !0) {
  4007. if (u[0] >= this._bufferService.cols)
  4008. return;
  4009. const L = this._bufferService.buffer
  4010. , p = L.lines.get(u[1]);
  4011. if (!p)
  4012. return;
  4013. const C = L.translateBufferLineToString(u[1], !1);
  4014. let b = this._convertViewportColToCharacterIndex(p, u)
  4015. , E = b;
  4016. const A = u[0] - b;
  4017. let H = 0
  4018. , j = 0
  4019. , $ = 0
  4020. , P = 0;
  4021. if (C.charAt(b) === " ") {
  4022. for (; b > 0 && C.charAt(b - 1) === " ";)
  4023. b--;
  4024. for (; E < C.length && C.charAt(E + 1) === " ";)
  4025. E++
  4026. } else {
  4027. let T = u[0]
  4028. , O = u[0];
  4029. p.getWidth(T) === 0 && (H++,
  4030. T--),
  4031. p.getWidth(O) === 2 && (j++,
  4032. O++);
  4033. const k = p.getString(O).length;
  4034. for (k > 1 && (P += k - 1,
  4035. E += k - 1); T > 0 && b > 0 && !this._isCharWordSeparator(p.loadCell(T - 1, this._workCell));) {
  4036. p.loadCell(T - 1, this._workCell);
  4037. const D = this._workCell.getChars().length;
  4038. this._workCell.getWidth() === 0 ? (H++,
  4039. T--) : D > 1 && ($ += D - 1,
  4040. b -= D - 1),
  4041. b--,
  4042. T--
  4043. }
  4044. for (; O < p.length && E + 1 < C.length && !this._isCharWordSeparator(p.loadCell(O + 1, this._workCell));) {
  4045. p.loadCell(O + 1, this._workCell);
  4046. const D = this._workCell.getChars().length;
  4047. this._workCell.getWidth() === 2 ? (j++,
  4048. O++) : D > 1 && (P += D - 1,
  4049. E += D - 1),
  4050. E++,
  4051. O++
  4052. }
  4053. }
  4054. E++;
  4055. let N = b + A - H + $
  4056. , y = Math.min(this._bufferService.cols, E - b + H + j - $ - P);
  4057. if (m || C.slice(b, E).trim() !== "") {
  4058. if (w && N === 0 && p.getCodePoint(0) !== 32) {
  4059. const T = L.lines.get(u[1] - 1);
  4060. if (T && p.isWrapped && T.getCodePoint(this._bufferService.cols - 1) !== 32) {
  4061. const O = this._getWordAt([this._bufferService.cols - 1, u[1] - 1], !1, !0, !1);
  4062. if (O) {
  4063. const k = this._bufferService.cols - O.start;
  4064. N -= k,
  4065. y += k
  4066. }
  4067. }
  4068. }
  4069. if (R && N + y === this._bufferService.cols && p.getCodePoint(this._bufferService.cols - 1) !== 32) {
  4070. const T = L.lines.get(u[1] + 1);
  4071. if ((T == null ? void 0 : T.isWrapped) && T.getCodePoint(0) !== 32) {
  4072. const O = this._getWordAt([0, u[1] + 1], !1, !1, !0);
  4073. O && (y += O.length)
  4074. }
  4075. }
  4076. return {
  4077. start: N,
  4078. length: y
  4079. }
  4080. }
  4081. }
  4082. _selectWordAt(u, m) {
  4083. const w = this._getWordAt(u, m);
  4084. if (w) {
  4085. for (; w.start < 0;)
  4086. w.start += this._bufferService.cols,
  4087. u[1]--;
  4088. this._model.selectionStart = [w.start, u[1]],
  4089. this._model.selectionStartLength = w.length
  4090. }
  4091. }
  4092. _selectToWordAt(u) {
  4093. const m = this._getWordAt(u, !0);
  4094. if (m) {
  4095. let w = u[1];
  4096. for (; m.start < 0;)
  4097. m.start += this._bufferService.cols,
  4098. w--;
  4099. if (!this._model.areSelectionValuesReversed())
  4100. for (; m.start + m.length > this._bufferService.cols;)
  4101. m.length -= this._bufferService.cols,
  4102. w++;
  4103. this._model.selectionEnd = [this._model.areSelectionValuesReversed() ? m.start : m.start + m.length, w]
  4104. }
  4105. }
  4106. _isCharWordSeparator(u) {
  4107. return u.getWidth() !== 0 && this._optionsService.rawOptions.wordSeparator.indexOf(u.getChars()) >= 0
  4108. }
  4109. _selectLineAt(u) {
  4110. const m = this._bufferService.buffer.getWrappedRangeForLine(u)
  4111. , w = {
  4112. start: {
  4113. x: 0,
  4114. y: m.first
  4115. },
  4116. end: {
  4117. x: this._bufferService.cols - 1,
  4118. y: m.last
  4119. }
  4120. };
  4121. this._model.selectionStart = [0, m.first],
  4122. this._model.selectionEnd = void 0,
  4123. this._model.selectionStartLength = (0,
  4124. c.getRangeLength)(w, this._bufferService.cols)
  4125. }
  4126. }
  4127. ;
  4128. S = n([_(3, t.IBufferService), _(4, t.ICoreService), _(5, o.IMouseService), _(6, t.IOptionsService), _(7, o.IRenderService), _(8, o.ICoreBrowserService)], S),
  4129. r.SelectionService = S
  4130. },
  4131. 4725: (x, r, a) => {
  4132. Object.defineProperty(r, "__esModule", {
  4133. value: !0
  4134. }),
  4135. r.ICharacterJoinerService = r.ISelectionService = r.IRenderService = r.IMouseService = r.ICoreBrowserService = r.ICharSizeService = void 0;
  4136. const n = a(8343);
  4137. r.ICharSizeService = (0,
  4138. n.createDecorator)("CharSizeService"),
  4139. r.ICoreBrowserService = (0,
  4140. n.createDecorator)("CoreBrowserService"),
  4141. r.IMouseService = (0,
  4142. n.createDecorator)("MouseService"),
  4143. r.IRenderService = (0,
  4144. n.createDecorator)("RenderService"),
  4145. r.ISelectionService = (0,
  4146. n.createDecorator)("SelectionService"),
  4147. r.ICharacterJoinerService = (0,
  4148. n.createDecorator)("CharacterJoinerService")
  4149. }
  4150. ,
  4151. 6349: (x, r, a) => {
  4152. Object.defineProperty(r, "__esModule", {
  4153. value: !0
  4154. }),
  4155. r.CircularList = void 0;
  4156. const n = a(8460);
  4157. r.CircularList = class {
  4158. constructor(_) {
  4159. this._maxLength = _,
  4160. this.onDeleteEmitter = new n.EventEmitter,
  4161. this.onInsertEmitter = new n.EventEmitter,
  4162. this.onTrimEmitter = new n.EventEmitter,
  4163. this._array = new Array(this._maxLength),
  4164. this._startIndex = 0,
  4165. this._length = 0
  4166. }
  4167. get onDelete() {
  4168. return this.onDeleteEmitter.event
  4169. }
  4170. get onInsert() {
  4171. return this.onInsertEmitter.event
  4172. }
  4173. get onTrim() {
  4174. return this.onTrimEmitter.event
  4175. }
  4176. get maxLength() {
  4177. return this._maxLength
  4178. }
  4179. set maxLength(_) {
  4180. if (this._maxLength === _)
  4181. return;
  4182. const h = new Array(_);
  4183. for (let f = 0; f < Math.min(_, this.length); f++)
  4184. h[f] = this._array[this._getCyclicIndex(f)];
  4185. this._array = h,
  4186. this._maxLength = _,
  4187. this._startIndex = 0
  4188. }
  4189. get length() {
  4190. return this._length
  4191. }
  4192. set length(_) {
  4193. if (_ > this._length)
  4194. for (let h = this._length; h < _; h++)
  4195. this._array[h] = void 0;
  4196. this._length = _
  4197. }
  4198. get(_) {
  4199. return this._array[this._getCyclicIndex(_)]
  4200. }
  4201. set(_, h) {
  4202. this._array[this._getCyclicIndex(_)] = h
  4203. }
  4204. push(_) {
  4205. this._array[this._getCyclicIndex(this._length)] = _,
  4206. this._length === this._maxLength ? (this._startIndex = ++this._startIndex % this._maxLength,
  4207. this.onTrimEmitter.fire(1)) : this._length++
  4208. }
  4209. recycle() {
  4210. if (this._length !== this._maxLength)
  4211. throw new Error("Can only recycle when the buffer is full");
  4212. return this._startIndex = ++this._startIndex % this._maxLength,
  4213. this.onTrimEmitter.fire(1),
  4214. this._array[this._getCyclicIndex(this._length - 1)]
  4215. }
  4216. get isFull() {
  4217. return this._length === this._maxLength
  4218. }
  4219. pop() {
  4220. return this._array[this._getCyclicIndex(this._length-- - 1)]
  4221. }
  4222. splice(_, h, ...f) {
  4223. if (h) {
  4224. for (let d = _; d < this._length - h; d++)
  4225. this._array[this._getCyclicIndex(d)] = this._array[this._getCyclicIndex(d + h)];
  4226. this._length -= h,
  4227. this.onDeleteEmitter.fire({
  4228. index: _,
  4229. amount: h
  4230. })
  4231. }
  4232. for (let d = this._length - 1; d >= _; d--)
  4233. this._array[this._getCyclicIndex(d + f.length)] = this._array[this._getCyclicIndex(d)];
  4234. for (let d = 0; d < f.length; d++)
  4235. this._array[this._getCyclicIndex(_ + d)] = f[d];
  4236. if (f.length && this.onInsertEmitter.fire({
  4237. index: _,
  4238. amount: f.length
  4239. }),
  4240. this._length + f.length > this._maxLength) {
  4241. const d = this._length + f.length - this._maxLength;
  4242. this._startIndex += d,
  4243. this._length = this._maxLength,
  4244. this.onTrimEmitter.fire(d)
  4245. } else
  4246. this._length += f.length
  4247. }
  4248. trimStart(_) {
  4249. _ > this._length && (_ = this._length),
  4250. this._startIndex += _,
  4251. this._length -= _,
  4252. this.onTrimEmitter.fire(_)
  4253. }
  4254. shiftElements(_, h, f) {
  4255. if (!(h <= 0)) {
  4256. if (_ < 0 || _ >= this._length)
  4257. throw new Error("start argument out of range");
  4258. if (_ + f < 0)
  4259. throw new Error("Cannot shift elements in list beyond index 0");
  4260. if (f > 0) {
  4261. for (let l = h - 1; l >= 0; l--)
  4262. this.set(_ + l + f, this.get(_ + l));
  4263. const d = _ + h + f - this._length;
  4264. if (d > 0)
  4265. for (this._length += d; this._length > this._maxLength;)
  4266. this._length--,
  4267. this._startIndex++,
  4268. this.onTrimEmitter.fire(1)
  4269. } else
  4270. for (let d = 0; d < h; d++)
  4271. this.set(_ + d + f, this.get(_ + d))
  4272. }
  4273. }
  4274. _getCyclicIndex(_) {
  4275. return (this._startIndex + _) % this._maxLength
  4276. }
  4277. }
  4278. }
  4279. ,
  4280. 1439: (x, r) => {
  4281. Object.defineProperty(r, "__esModule", {
  4282. value: !0
  4283. }),
  4284. r.clone = void 0,
  4285. r.clone = function a(n, _ = 5) {
  4286. if (typeof n != "object")
  4287. return n;
  4288. const h = Array.isArray(n) ? [] : {};
  4289. for (const f in n)
  4290. h[f] = _ <= 1 ? n[f] : n[f] && a(n[f], _ - 1);
  4291. return h
  4292. }
  4293. }
  4294. ,
  4295. 8055: (x, r) => {
  4296. var a, n, _;
  4297. function h(d) {
  4298. const l = d.toString(16);
  4299. return l.length < 2 ? "0" + l : l
  4300. }
  4301. function f(d, l) {
  4302. return d < l ? (l + .05) / (d + .05) : (d + .05) / (l + .05)
  4303. }
  4304. Object.defineProperty(r, "__esModule", {
  4305. value: !0
  4306. }),
  4307. r.contrastRatio = r.toPaddedHex = r.rgba = r.rgb = r.css = r.color = r.channels = void 0,
  4308. function (d) {
  4309. d.toCss = function (l, o, t, s) {
  4310. return s !== void 0 ? `#${h(l)}${h(o)}${h(t)}${h(s)}` : `#${h(l)}${h(o)}${h(t)}`
  4311. }
  4312. ,
  4313. d.toRgba = function (l, o, t, s = 255) {
  4314. return (l << 24 | o << 16 | t << 8 | s) >>> 0
  4315. }
  4316. }(a = r.channels || (r.channels = {})),
  4317. function (d) {
  4318. function l(o, t) {
  4319. const s = Math.round(255 * t)
  4320. , [e, i, c] = _.toChannels(o.rgba);
  4321. return {
  4322. css: a.toCss(e, i, c, s),
  4323. rgba: a.toRgba(e, i, c, s)
  4324. }
  4325. }
  4326. d.blend = function (o, t) {
  4327. const s = (255 & t.rgba) / 255;
  4328. if (s === 1)
  4329. return {
  4330. css: t.css,
  4331. rgba: t.rgba
  4332. };
  4333. const e = t.rgba >> 24 & 255
  4334. , i = t.rgba >> 16 & 255
  4335. , c = t.rgba >> 8 & 255
  4336. , g = o.rgba >> 24 & 255
  4337. , v = o.rgba >> 16 & 255
  4338. , S = o.rgba >> 8 & 255
  4339. , u = g + Math.round((e - g) * s)
  4340. , m = v + Math.round((i - v) * s)
  4341. , w = S + Math.round((c - S) * s);
  4342. return {
  4343. css: a.toCss(u, m, w),
  4344. rgba: a.toRgba(u, m, w)
  4345. }
  4346. }
  4347. ,
  4348. d.isOpaque = function (o) {
  4349. return (255 & o.rgba) == 255
  4350. }
  4351. ,
  4352. d.ensureContrastRatio = function (o, t, s) {
  4353. const e = _.ensureContrastRatio(o.rgba, t.rgba, s);
  4354. if (e)
  4355. return _.toColor(e >> 24 & 255, e >> 16 & 255, e >> 8 & 255)
  4356. }
  4357. ,
  4358. d.opaque = function (o) {
  4359. const t = (255 | o.rgba) >>> 0
  4360. , [s, e, i] = _.toChannels(t);
  4361. return {
  4362. css: a.toCss(s, e, i),
  4363. rgba: t
  4364. }
  4365. }
  4366. ,
  4367. d.opacity = l,
  4368. d.multiplyOpacity = function (o, t) {
  4369. return l(o, (255 & o.rgba) * t / 255)
  4370. }
  4371. ,
  4372. d.toColorRGB = function (o) {
  4373. return [o.rgba >> 24 & 255, o.rgba >> 16 & 255, o.rgba >> 8 & 255]
  4374. }
  4375. }(r.color || (r.color = {})),
  4376. (r.css || (r.css = {})).toColor = function (d) {
  4377. if (d.match(/#[0-9a-f]{3,8}/i))
  4378. switch (d.length) {
  4379. case 4:
  4380. {
  4381. const o = parseInt(d.slice(1, 2).repeat(2), 16)
  4382. , t = parseInt(d.slice(2, 3).repeat(2), 16)
  4383. , s = parseInt(d.slice(3, 4).repeat(2), 16);
  4384. return _.toColor(o, t, s)
  4385. }
  4386. case 5:
  4387. {
  4388. const o = parseInt(d.slice(1, 2).repeat(2), 16)
  4389. , t = parseInt(d.slice(2, 3).repeat(2), 16)
  4390. , s = parseInt(d.slice(3, 4).repeat(2), 16)
  4391. , e = parseInt(d.slice(4, 5).repeat(2), 16);
  4392. return _.toColor(o, t, s, e)
  4393. }
  4394. case 7:
  4395. return {
  4396. css: d,
  4397. rgba: (parseInt(d.slice(1), 16) << 8 | 255) >>> 0
  4398. };
  4399. case 9:
  4400. return {
  4401. css: d,
  4402. rgba: parseInt(d.slice(1), 16) >>> 0
  4403. }
  4404. }
  4405. const l = d.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);
  4406. if (l) {
  4407. const o = parseInt(l[1])
  4408. , t = parseInt(l[2])
  4409. , s = parseInt(l[3])
  4410. , e = Math.round(255 * (l[5] === void 0 ? 1 : parseFloat(l[5])));
  4411. return _.toColor(o, t, s, e)
  4412. }
  4413. throw new Error("css.toColor: Unsupported css format")
  4414. }
  4415. ,
  4416. function (d) {
  4417. function l(o, t, s) {
  4418. const e = o / 255
  4419. , i = t / 255
  4420. , c = s / 255;
  4421. return .2126 * (e <= .03928 ? e / 12.92 : Math.pow((e + .055) / 1.055, 2.4)) + .7152 * (i <= .03928 ? i / 12.92 : Math.pow((i + .055) / 1.055, 2.4)) + .0722 * (c <= .03928 ? c / 12.92 : Math.pow((c + .055) / 1.055, 2.4))
  4422. }
  4423. d.relativeLuminance = function (o) {
  4424. return l(o >> 16 & 255, o >> 8 & 255, 255 & o)
  4425. }
  4426. ,
  4427. d.relativeLuminance2 = l
  4428. }(n = r.rgb || (r.rgb = {})),
  4429. function (d) {
  4430. function l(t, s, e) {
  4431. const i = t >> 24 & 255
  4432. , c = t >> 16 & 255
  4433. , g = t >> 8 & 255;
  4434. let v = s >> 24 & 255
  4435. , S = s >> 16 & 255
  4436. , u = s >> 8 & 255
  4437. , m = f(n.relativeLuminance2(v, S, u), n.relativeLuminance2(i, c, g));
  4438. for (; m < e && (v > 0 || S > 0 || u > 0);)
  4439. v -= Math.max(0, Math.ceil(.1 * v)),
  4440. S -= Math.max(0, Math.ceil(.1 * S)),
  4441. u -= Math.max(0, Math.ceil(.1 * u)),
  4442. m = f(n.relativeLuminance2(v, S, u), n.relativeLuminance2(i, c, g));
  4443. return (v << 24 | S << 16 | u << 8 | 255) >>> 0
  4444. }
  4445. function o(t, s, e) {
  4446. const i = t >> 24 & 255
  4447. , c = t >> 16 & 255
  4448. , g = t >> 8 & 255;
  4449. let v = s >> 24 & 255
  4450. , S = s >> 16 & 255
  4451. , u = s >> 8 & 255
  4452. , m = f(n.relativeLuminance2(v, S, u), n.relativeLuminance2(i, c, g));
  4453. for (; m < e && (v < 255 || S < 255 || u < 255);)
  4454. v = Math.min(255, v + Math.ceil(.1 * (255 - v))),
  4455. S = Math.min(255, S + Math.ceil(.1 * (255 - S))),
  4456. u = Math.min(255, u + Math.ceil(.1 * (255 - u))),
  4457. m = f(n.relativeLuminance2(v, S, u), n.relativeLuminance2(i, c, g));
  4458. return (v << 24 | S << 16 | u << 8 | 255) >>> 0
  4459. }
  4460. d.ensureContrastRatio = function (t, s, e) {
  4461. const i = n.relativeLuminance(t >> 8)
  4462. , c = n.relativeLuminance(s >> 8);
  4463. if (f(i, c) < e) {
  4464. if (c < i) {
  4465. const S = l(t, s, e)
  4466. , u = f(i, n.relativeLuminance(S >> 8));
  4467. if (u < e) {
  4468. const m = o(t, s, e);
  4469. return u > f(i, n.relativeLuminance(m >> 8)) ? S : m
  4470. }
  4471. return S
  4472. }
  4473. const g = o(t, s, e)
  4474. , v = f(i, n.relativeLuminance(g >> 8));
  4475. if (v < e) {
  4476. const S = l(t, s, e);
  4477. return v > f(i, n.relativeLuminance(S >> 8)) ? g : S
  4478. }
  4479. return g
  4480. }
  4481. }
  4482. ,
  4483. d.reduceLuminance = l,
  4484. d.increaseLuminance = o,
  4485. d.toChannels = function (t) {
  4486. return [t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, 255 & t]
  4487. }
  4488. ,
  4489. d.toColor = function (t, s, e, i) {
  4490. return {
  4491. css: a.toCss(t, s, e, i),
  4492. rgba: a.toRgba(t, s, e, i)
  4493. }
  4494. }
  4495. }(_ = r.rgba || (r.rgba = {})),
  4496. r.toPaddedHex = h,
  4497. r.contrastRatio = f
  4498. }
  4499. ,
  4500. 8969: (x, r, a) => {
  4501. Object.defineProperty(r, "__esModule", {
  4502. value: !0
  4503. }),
  4504. r.CoreTerminal = void 0;
  4505. const n = a(844)
  4506. , _ = a(2585)
  4507. , h = a(4348)
  4508. , f = a(7866)
  4509. , d = a(744)
  4510. , l = a(7302)
  4511. , o = a(6975)
  4512. , t = a(8460)
  4513. , s = a(1753)
  4514. , e = a(3730)
  4515. , i = a(1480)
  4516. , c = a(7994)
  4517. , g = a(9282)
  4518. , v = a(5435)
  4519. , S = a(5981)
  4520. , u = a(2660);
  4521. let m = !1;
  4522. class w extends n.Disposable {
  4523. constructor(L) {
  4524. super(),
  4525. this._onBinary = new t.EventEmitter,
  4526. this._onData = new t.EventEmitter,
  4527. this._onLineFeed = new t.EventEmitter,
  4528. this._onResize = new t.EventEmitter,
  4529. this._onScroll = new t.EventEmitter,
  4530. this._onWriteParsed = new t.EventEmitter,
  4531. this._instantiationService = new h.InstantiationService,
  4532. this.optionsService = new l.OptionsService(L),
  4533. this._instantiationService.setService(_.IOptionsService, this.optionsService),
  4534. this._bufferService = this.register(this._instantiationService.createInstance(d.BufferService)),
  4535. this._instantiationService.setService(_.IBufferService, this._bufferService),
  4536. this._logService = this._instantiationService.createInstance(f.LogService),
  4537. this._instantiationService.setService(_.ILogService, this._logService),
  4538. this.coreService = this.register(this._instantiationService.createInstance(o.CoreService, () => this.scrollToBottom())),
  4539. this._instantiationService.setService(_.ICoreService, this.coreService),
  4540. this.coreMouseService = this._instantiationService.createInstance(s.CoreMouseService),
  4541. this._instantiationService.setService(_.ICoreMouseService, this.coreMouseService),
  4542. this._dirtyRowService = this._instantiationService.createInstance(e.DirtyRowService),
  4543. this._instantiationService.setService(_.IDirtyRowService, this._dirtyRowService),
  4544. this.unicodeService = this._instantiationService.createInstance(i.UnicodeService),
  4545. this._instantiationService.setService(_.IUnicodeService, this.unicodeService),
  4546. this._charsetService = this._instantiationService.createInstance(c.CharsetService),
  4547. this._instantiationService.setService(_.ICharsetService, this._charsetService),
  4548. this._oscLinkService = this._instantiationService.createInstance(u.OscLinkService),
  4549. this._instantiationService.setService(_.IOscLinkService, this._oscLinkService),
  4550. this._inputHandler = new v.InputHandler(this._bufferService, this._charsetService, this.coreService, this._dirtyRowService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService),
  4551. this.register((0,
  4552. t.forwardEvent)(this._inputHandler.onLineFeed, this._onLineFeed)),
  4553. this.register(this._inputHandler),
  4554. this.register((0,
  4555. t.forwardEvent)(this._bufferService.onResize, this._onResize)),
  4556. this.register((0,
  4557. t.forwardEvent)(this.coreService.onData, this._onData)),
  4558. this.register((0,
  4559. t.forwardEvent)(this.coreService.onBinary, this._onBinary)),
  4560. this.register(this.optionsService.onOptionChange(p => this._updateOptions(p))),
  4561. this.register(this._bufferService.onScroll(p => {
  4562. this._onScroll.fire({
  4563. position: this._bufferService.buffer.ydisp,
  4564. source: 0
  4565. }),
  4566. this._dirtyRowService.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom)
  4567. }
  4568. )),
  4569. this.register(this._inputHandler.onScroll(p => {
  4570. this._onScroll.fire({
  4571. position: this._bufferService.buffer.ydisp,
  4572. source: 0
  4573. }),
  4574. this._dirtyRowService.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom)
  4575. }
  4576. )),
  4577. this._writeBuffer = new S.WriteBuffer((p, C) => this._inputHandler.parse(p, C)),
  4578. this.register((0,
  4579. t.forwardEvent)(this._writeBuffer.onWriteParsed, this._onWriteParsed))
  4580. }
  4581. get onBinary() {
  4582. return this._onBinary.event
  4583. }
  4584. get onData() {
  4585. return this._onData.event
  4586. }
  4587. get onLineFeed() {
  4588. return this._onLineFeed.event
  4589. }
  4590. get onResize() {
  4591. return this._onResize.event
  4592. }
  4593. get onWriteParsed() {
  4594. return this._onWriteParsed.event
  4595. }
  4596. get onScroll() {
  4597. return this._onScrollApi || (this._onScrollApi = new t.EventEmitter,
  4598. this.register(this._onScroll.event(L => {
  4599. var p;
  4600. (p = this._onScrollApi) === null || p === void 0 || p.fire(L.position)
  4601. }
  4602. ))),
  4603. this._onScrollApi.event
  4604. }
  4605. get cols() {
  4606. return this._bufferService.cols
  4607. }
  4608. get rows() {
  4609. return this._bufferService.rows
  4610. }
  4611. get buffers() {
  4612. return this._bufferService.buffers
  4613. }
  4614. get options() {
  4615. return this.optionsService.options
  4616. }
  4617. set options(L) {
  4618. for (const p in L)
  4619. this.optionsService.options[p] = L[p]
  4620. }
  4621. dispose() {
  4622. var L;
  4623. this._isDisposed || (super.dispose(),
  4624. (L = this._windowsMode) === null || L === void 0 || L.dispose(),
  4625. this._windowsMode = void 0)
  4626. }
  4627. write(L, p) {
  4628. this._writeBuffer.write(L, p)
  4629. }
  4630. writeSync(L, p) {
  4631. this._logService.logLevel <= _.LogLevelEnum.WARN && !m && (this._logService.warn("writeSync is unreliable and will be removed soon."),
  4632. m = !0),
  4633. this._writeBuffer.writeSync(L, p)
  4634. }
  4635. resize(L, p) {
  4636. isNaN(L) || isNaN(p) || (L = Math.max(L, d.MINIMUM_COLS),
  4637. p = Math.max(p, d.MINIMUM_ROWS),
  4638. this._bufferService.resize(L, p))
  4639. }
  4640. scroll(L, p = !1) {
  4641. this._bufferService.scroll(L, p)
  4642. }
  4643. scrollLines(L, p, C) {
  4644. this._bufferService.scrollLines(L, p, C)
  4645. }
  4646. scrollPages(L) {
  4647. this._bufferService.scrollPages(L)
  4648. }
  4649. scrollToTop() {
  4650. this._bufferService.scrollToTop()
  4651. }
  4652. scrollToBottom() {
  4653. this._bufferService.scrollToBottom()
  4654. }
  4655. scrollToLine(L) {
  4656. this._bufferService.scrollToLine(L)
  4657. }
  4658. registerEscHandler(L, p) {
  4659. return this._inputHandler.registerEscHandler(L, p)
  4660. }
  4661. registerDcsHandler(L, p) {
  4662. return this._inputHandler.registerDcsHandler(L, p)
  4663. }
  4664. registerCsiHandler(L, p) {
  4665. return this._inputHandler.registerCsiHandler(L, p)
  4666. }
  4667. registerOscHandler(L, p) {
  4668. return this._inputHandler.registerOscHandler(L, p)
  4669. }
  4670. _setup() {
  4671. this.optionsService.rawOptions.windowsMode && this._enableWindowsMode()
  4672. }
  4673. reset() {
  4674. this._inputHandler.reset(),
  4675. this._bufferService.reset(),
  4676. this._charsetService.reset(),
  4677. this.coreService.reset(),
  4678. this.coreMouseService.reset()
  4679. }
  4680. _updateOptions(L) {
  4681. var p;
  4682. switch (L) {
  4683. case "scrollback":
  4684. this.buffers.resize(this.cols, this.rows);
  4685. break;
  4686. case "windowsMode":
  4687. this.optionsService.rawOptions.windowsMode ? this._enableWindowsMode() : ((p = this._windowsMode) === null || p === void 0 || p.dispose(),
  4688. this._windowsMode = void 0)
  4689. }
  4690. }
  4691. _enableWindowsMode() {
  4692. if (!this._windowsMode) {
  4693. const L = [];
  4694. L.push(this.onLineFeed(g.updateWindowsModeWrappedState.bind(null, this._bufferService))),
  4695. L.push(this.registerCsiHandler({
  4696. final: "H"
  4697. }, () => ((0,
  4698. g.updateWindowsModeWrappedState)(this._bufferService),
  4699. !1))),
  4700. this._windowsMode = {
  4701. dispose: () => {
  4702. for (const p of L)
  4703. p.dispose()
  4704. }
  4705. }
  4706. }
  4707. }
  4708. }
  4709. r.CoreTerminal = w
  4710. }
  4711. ,
  4712. 8460: (x, r) => {
  4713. Object.defineProperty(r, "__esModule", {
  4714. value: !0
  4715. }),
  4716. r.forwardEvent = r.EventEmitter = void 0,
  4717. r.EventEmitter = class {
  4718. constructor() {
  4719. this._listeners = [],
  4720. this._disposed = !1
  4721. }
  4722. get event() {
  4723. return this._event || (this._event = a => (this._listeners.push(a),
  4724. {
  4725. dispose: () => {
  4726. if (!this._disposed) {
  4727. for (let n = 0; n < this._listeners.length; n++)
  4728. if (this._listeners[n] === a)
  4729. return void this._listeners.splice(n, 1)
  4730. }
  4731. }
  4732. })),
  4733. this._event
  4734. }
  4735. fire(a, n) {
  4736. const _ = [];
  4737. for (let h = 0; h < this._listeners.length; h++)
  4738. _.push(this._listeners[h]);
  4739. for (let h = 0; h < _.length; h++)
  4740. _[h].call(void 0, a, n)
  4741. }
  4742. dispose() {
  4743. this._listeners && (this._listeners.length = 0),
  4744. this._disposed = !0
  4745. }
  4746. }
  4747. ,
  4748. r.forwardEvent = function (a, n) {
  4749. return a(_ => n.fire(_))
  4750. }
  4751. }
  4752. ,
  4753. 5435: (x, r, a) => {
  4754. Object.defineProperty(r, "__esModule", {
  4755. value: !0
  4756. }),
  4757. r.InputHandler = r.WindowsOptionsReportType = void 0;
  4758. const n = a(2584)
  4759. , _ = a(7116)
  4760. , h = a(2015)
  4761. , f = a(844)
  4762. , d = a(482)
  4763. , l = a(8437)
  4764. , o = a(8460)
  4765. , t = a(643)
  4766. , s = a(511)
  4767. , e = a(3734)
  4768. , i = a(2585)
  4769. , c = a(6242)
  4770. , g = a(6351)
  4771. , v = a(5941)
  4772. , S = {
  4773. "(": 0,
  4774. ")": 1,
  4775. "*": 2,
  4776. "+": 3,
  4777. "-": 1,
  4778. ".": 2
  4779. }
  4780. , u = 131072;
  4781. function m(L, p) {
  4782. if (L > 24)
  4783. return p.setWinLines || !1;
  4784. switch (L) {
  4785. case 1:
  4786. return !!p.restoreWin;
  4787. case 2:
  4788. return !!p.minimizeWin;
  4789. case 3:
  4790. return !!p.setWinPosition;
  4791. case 4:
  4792. return !!p.setWinSizePixels;
  4793. case 5:
  4794. return !!p.raiseWin;
  4795. case 6:
  4796. return !!p.lowerWin;
  4797. case 7:
  4798. return !!p.refreshWin;
  4799. case 8:
  4800. return !!p.setWinSizeChars;
  4801. case 9:
  4802. return !!p.maximizeWin;
  4803. case 10:
  4804. return !!p.fullscreenWin;
  4805. case 11:
  4806. return !!p.getWinState;
  4807. case 13:
  4808. return !!p.getWinPosition;
  4809. case 14:
  4810. return !!p.getWinSizePixels;
  4811. case 15:
  4812. return !!p.getScreenSizePixels;
  4813. case 16:
  4814. return !!p.getCellSizePixels;
  4815. case 18:
  4816. return !!p.getWinSizeChars;
  4817. case 19:
  4818. return !!p.getScreenSizeChars;
  4819. case 20:
  4820. return !!p.getIconTitle;
  4821. case 21:
  4822. return !!p.getWinTitle;
  4823. case 22:
  4824. return !!p.pushTitle;
  4825. case 23:
  4826. return !!p.popTitle;
  4827. case 24:
  4828. return !!p.setWinLines
  4829. }
  4830. return !1
  4831. }
  4832. var w;
  4833. (function (L) {
  4834. L[L.GET_WIN_SIZE_PIXELS = 0] = "GET_WIN_SIZE_PIXELS",
  4835. L[L.GET_CELL_SIZE_PIXELS = 1] = "GET_CELL_SIZE_PIXELS"
  4836. }
  4837. )(w = r.WindowsOptionsReportType || (r.WindowsOptionsReportType = {}));
  4838. class R extends f.Disposable {
  4839. constructor(p, C, b, E, A, H, j, $, P, N = new h.EscapeSequenceParser) {
  4840. super(),
  4841. this._bufferService = p,
  4842. this._charsetService = C,
  4843. this._coreService = b,
  4844. this._dirtyRowService = E,
  4845. this._logService = A,
  4846. this._optionsService = H,
  4847. this._oscLinkService = j,
  4848. this._coreMouseService = $,
  4849. this._unicodeService = P,
  4850. this._parser = N,
  4851. this._parseBuffer = new Uint32Array(4096),
  4852. this._stringDecoder = new d.StringToUtf32,
  4853. this._utf8Decoder = new d.Utf8ToUtf32,
  4854. this._workCell = new s.CellData,
  4855. this._windowTitle = "",
  4856. this._iconName = "",
  4857. this._windowTitleStack = [],
  4858. this._iconNameStack = [],
  4859. this._curAttrData = l.DEFAULT_ATTR_DATA.clone(),
  4860. this._eraseAttrDataInternal = l.DEFAULT_ATTR_DATA.clone(),
  4861. this._onRequestBell = new o.EventEmitter,
  4862. this._onRequestRefreshRows = new o.EventEmitter,
  4863. this._onRequestReset = new o.EventEmitter,
  4864. this._onRequestSendFocus = new o.EventEmitter,
  4865. this._onRequestSyncScrollBar = new o.EventEmitter,
  4866. this._onRequestWindowsOptionsReport = new o.EventEmitter,
  4867. this._onA11yChar = new o.EventEmitter,
  4868. this._onA11yTab = new o.EventEmitter,
  4869. this._onCursorMove = new o.EventEmitter,
  4870. this._onLineFeed = new o.EventEmitter,
  4871. this._onScroll = new o.EventEmitter,
  4872. this._onTitleChange = new o.EventEmitter,
  4873. this._onColor = new o.EventEmitter,
  4874. this._parseStack = {
  4875. paused: !1,
  4876. cursorStartX: 0,
  4877. cursorStartY: 0,
  4878. decodedLength: 0,
  4879. position: 0
  4880. },
  4881. this._specialColors = [256, 257, 258],
  4882. this.register(this._parser),
  4883. this._activeBuffer = this._bufferService.buffer,
  4884. this.register(this._bufferService.buffers.onBufferActivate(y => this._activeBuffer = y.activeBuffer)),
  4885. this._parser.setCsiHandlerFallback((y, T) => {
  4886. this._logService.debug("Unknown CSI code: ", {
  4887. identifier: this._parser.identToString(y),
  4888. params: T.toArray()
  4889. })
  4890. }
  4891. ),
  4892. this._parser.setEscHandlerFallback(y => {
  4893. this._logService.debug("Unknown ESC code: ", {
  4894. identifier: this._parser.identToString(y)
  4895. })
  4896. }
  4897. ),
  4898. this._parser.setExecuteHandlerFallback(y => {
  4899. this._logService.debug("Unknown EXECUTE code: ", {
  4900. code: y
  4901. })
  4902. }
  4903. ),
  4904. this._parser.setOscHandlerFallback((y, T, O) => {
  4905. this._logService.debug("Unknown OSC code: ", {
  4906. identifier: y,
  4907. action: T,
  4908. data: O
  4909. })
  4910. }
  4911. ),
  4912. this._parser.setDcsHandlerFallback((y, T, O) => {
  4913. T === "HOOK" && (O = O.toArray()),
  4914. this._logService.debug("Unknown DCS code: ", {
  4915. identifier: this._parser.identToString(y),
  4916. action: T,
  4917. payload: O
  4918. })
  4919. }
  4920. ),
  4921. this._parser.setPrintHandler((y, T, O) => this.print(y, T, O)),
  4922. this._parser.registerCsiHandler({
  4923. final: "@"
  4924. }, y => this.insertChars(y)),
  4925. this._parser.registerCsiHandler({
  4926. intermediates: " ",
  4927. final: "@"
  4928. }, y => this.scrollLeft(y)),
  4929. this._parser.registerCsiHandler({
  4930. final: "A"
  4931. }, y => this.cursorUp(y)),
  4932. this._parser.registerCsiHandler({
  4933. intermediates: " ",
  4934. final: "A"
  4935. }, y => this.scrollRight(y)),
  4936. this._parser.registerCsiHandler({
  4937. final: "B"
  4938. }, y => this.cursorDown(y)),
  4939. this._parser.registerCsiHandler({
  4940. final: "C"
  4941. }, y => this.cursorForward(y)),
  4942. this._parser.registerCsiHandler({
  4943. final: "D"
  4944. }, y => this.cursorBackward(y)),
  4945. this._parser.registerCsiHandler({
  4946. final: "E"
  4947. }, y => this.cursorNextLine(y)),
  4948. this._parser.registerCsiHandler({
  4949. final: "F"
  4950. }, y => this.cursorPrecedingLine(y)),
  4951. this._parser.registerCsiHandler({
  4952. final: "G"
  4953. }, y => this.cursorCharAbsolute(y)),
  4954. this._parser.registerCsiHandler({
  4955. final: "H"
  4956. }, y => this.cursorPosition(y)),
  4957. this._parser.registerCsiHandler({
  4958. final: "I"
  4959. }, y => this.cursorForwardTab(y)),
  4960. this._parser.registerCsiHandler({
  4961. final: "J"
  4962. }, y => this.eraseInDisplay(y, !1)),
  4963. this._parser.registerCsiHandler({
  4964. prefix: "?",
  4965. final: "J"
  4966. }, y => this.eraseInDisplay(y, !0)),
  4967. this._parser.registerCsiHandler({
  4968. final: "K"
  4969. }, y => this.eraseInLine(y, !1)),
  4970. this._parser.registerCsiHandler({
  4971. prefix: "?",
  4972. final: "K"
  4973. }, y => this.eraseInLine(y, !0)),
  4974. this._parser.registerCsiHandler({
  4975. final: "L"
  4976. }, y => this.insertLines(y)),
  4977. this._parser.registerCsiHandler({
  4978. final: "M"
  4979. }, y => this.deleteLines(y)),
  4980. this._parser.registerCsiHandler({
  4981. final: "P"
  4982. }, y => this.deleteChars(y)),
  4983. this._parser.registerCsiHandler({
  4984. final: "S"
  4985. }, y => this.scrollUp(y)),
  4986. this._parser.registerCsiHandler({
  4987. final: "T"
  4988. }, y => this.scrollDown(y)),
  4989. this._parser.registerCsiHandler({
  4990. final: "X"
  4991. }, y => this.eraseChars(y)),
  4992. this._parser.registerCsiHandler({
  4993. final: "Z"
  4994. }, y => this.cursorBackwardTab(y)),
  4995. this._parser.registerCsiHandler({
  4996. final: "`"
  4997. }, y => this.charPosAbsolute(y)),
  4998. this._parser.registerCsiHandler({
  4999. final: "a"
  5000. }, y => this.hPositionRelative(y)),
  5001. this._parser.registerCsiHandler({
  5002. final: "b"
  5003. }, y => this.repeatPrecedingCharacter(y)),
  5004. this._parser.registerCsiHandler({
  5005. final: "c"
  5006. }, y => this.sendDeviceAttributesPrimary(y)),
  5007. this._parser.registerCsiHandler({
  5008. prefix: ">",
  5009. final: "c"
  5010. }, y => this.sendDeviceAttributesSecondary(y)),
  5011. this._parser.registerCsiHandler({
  5012. final: "d"
  5013. }, y => this.linePosAbsolute(y)),
  5014. this._parser.registerCsiHandler({
  5015. final: "e"
  5016. }, y => this.vPositionRelative(y)),
  5017. this._parser.registerCsiHandler({
  5018. final: "f"
  5019. }, y => this.hVPosition(y)),
  5020. this._parser.registerCsiHandler({
  5021. final: "g"
  5022. }, y => this.tabClear(y)),
  5023. this._parser.registerCsiHandler({
  5024. final: "h"
  5025. }, y => this.setMode(y)),
  5026. this._parser.registerCsiHandler({
  5027. prefix: "?",
  5028. final: "h"
  5029. }, y => this.setModePrivate(y)),
  5030. this._parser.registerCsiHandler({
  5031. final: "l"
  5032. }, y => this.resetMode(y)),
  5033. this._parser.registerCsiHandler({
  5034. prefix: "?",
  5035. final: "l"
  5036. }, y => this.resetModePrivate(y)),
  5037. this._parser.registerCsiHandler({
  5038. final: "m"
  5039. }, y => this.charAttributes(y)),
  5040. this._parser.registerCsiHandler({
  5041. final: "n"
  5042. }, y => this.deviceStatus(y)),
  5043. this._parser.registerCsiHandler({
  5044. prefix: "?",
  5045. final: "n"
  5046. }, y => this.deviceStatusPrivate(y)),
  5047. this._parser.registerCsiHandler({
  5048. intermediates: "!",
  5049. final: "p"
  5050. }, y => this.softReset(y)),
  5051. this._parser.registerCsiHandler({
  5052. intermediates: " ",
  5053. final: "q"
  5054. }, y => this.setCursorStyle(y)),
  5055. this._parser.registerCsiHandler({
  5056. final: "r"
  5057. }, y => this.setScrollRegion(y)),
  5058. this._parser.registerCsiHandler({
  5059. final: "s"
  5060. }, y => this.saveCursor(y)),
  5061. this._parser.registerCsiHandler({
  5062. final: "t"
  5063. }, y => this.windowOptions(y)),
  5064. this._parser.registerCsiHandler({
  5065. final: "u"
  5066. }, y => this.restoreCursor(y)),
  5067. this._parser.registerCsiHandler({
  5068. intermediates: "'",
  5069. final: "}"
  5070. }, y => this.insertColumns(y)),
  5071. this._parser.registerCsiHandler({
  5072. intermediates: "'",
  5073. final: "~"
  5074. }, y => this.deleteColumns(y)),
  5075. this._parser.registerCsiHandler({
  5076. intermediates: '"',
  5077. final: "q"
  5078. }, y => this.selectProtected(y)),
  5079. this._parser.registerCsiHandler({
  5080. intermediates: "$",
  5081. final: "p"
  5082. }, y => this.requestMode(y, !0)),
  5083. this._parser.registerCsiHandler({
  5084. prefix: "?",
  5085. intermediates: "$",
  5086. final: "p"
  5087. }, y => this.requestMode(y, !1)),
  5088. this._parser.setExecuteHandler(n.C0.BEL, () => this.bell()),
  5089. this._parser.setExecuteHandler(n.C0.LF, () => this.lineFeed()),
  5090. this._parser.setExecuteHandler(n.C0.VT, () => this.lineFeed()),
  5091. this._parser.setExecuteHandler(n.C0.FF, () => this.lineFeed()),
  5092. this._parser.setExecuteHandler(n.C0.CR, () => this.carriageReturn()),
  5093. this._parser.setExecuteHandler(n.C0.BS, () => this.backspace()),
  5094. this._parser.setExecuteHandler(n.C0.HT, () => this.tab()),
  5095. this._parser.setExecuteHandler(n.C0.SO, () => this.shiftOut()),
  5096. this._parser.setExecuteHandler(n.C0.SI, () => this.shiftIn()),
  5097. this._parser.setExecuteHandler(n.C1.IND, () => this.index()),
  5098. this._parser.setExecuteHandler(n.C1.NEL, () => this.nextLine()),
  5099. this._parser.setExecuteHandler(n.C1.HTS, () => this.tabSet()),
  5100. this._parser.registerOscHandler(0, new c.OscHandler(y => (this.setTitle(y),
  5101. this.setIconName(y),
  5102. !0))),
  5103. this._parser.registerOscHandler(1, new c.OscHandler(y => this.setIconName(y))),
  5104. this._parser.registerOscHandler(2, new c.OscHandler(y => this.setTitle(y))),
  5105. this._parser.registerOscHandler(4, new c.OscHandler(y => this.setOrReportIndexedColor(y))),
  5106. this._parser.registerOscHandler(8, new c.OscHandler(y => this.setHyperlink(y))),
  5107. this._parser.registerOscHandler(10, new c.OscHandler(y => this.setOrReportFgColor(y))),
  5108. this._parser.registerOscHandler(11, new c.OscHandler(y => this.setOrReportBgColor(y))),
  5109. this._parser.registerOscHandler(12, new c.OscHandler(y => this.setOrReportCursorColor(y))),
  5110. this._parser.registerOscHandler(104, new c.OscHandler(y => this.restoreIndexedColor(y))),
  5111. this._parser.registerOscHandler(110, new c.OscHandler(y => this.restoreFgColor(y))),
  5112. this._parser.registerOscHandler(111, new c.OscHandler(y => this.restoreBgColor(y))),
  5113. this._parser.registerOscHandler(112, new c.OscHandler(y => this.restoreCursorColor(y))),
  5114. this._parser.registerEscHandler({
  5115. final: "7"
  5116. }, () => this.saveCursor()),
  5117. this._parser.registerEscHandler({
  5118. final: "8"
  5119. }, () => this.restoreCursor()),
  5120. this._parser.registerEscHandler({
  5121. final: "D"
  5122. }, () => this.index()),
  5123. this._parser.registerEscHandler({
  5124. final: "E"
  5125. }, () => this.nextLine()),
  5126. this._parser.registerEscHandler({
  5127. final: "H"
  5128. }, () => this.tabSet()),
  5129. this._parser.registerEscHandler({
  5130. final: "M"
  5131. }, () => this.reverseIndex()),
  5132. this._parser.registerEscHandler({
  5133. final: "="
  5134. }, () => this.keypadApplicationMode()),
  5135. this._parser.registerEscHandler({
  5136. final: ">"
  5137. }, () => this.keypadNumericMode()),
  5138. this._parser.registerEscHandler({
  5139. final: "c"
  5140. }, () => this.fullReset()),
  5141. this._parser.registerEscHandler({
  5142. final: "n"
  5143. }, () => this.setgLevel(2)),
  5144. this._parser.registerEscHandler({
  5145. final: "o"
  5146. }, () => this.setgLevel(3)),
  5147. this._parser.registerEscHandler({
  5148. final: "|"
  5149. }, () => this.setgLevel(3)),
  5150. this._parser.registerEscHandler({
  5151. final: "}"
  5152. }, () => this.setgLevel(2)),
  5153. this._parser.registerEscHandler({
  5154. final: "~"
  5155. }, () => this.setgLevel(1)),
  5156. this._parser.registerEscHandler({
  5157. intermediates: "%",
  5158. final: "@"
  5159. }, () => this.selectDefaultCharset()),
  5160. this._parser.registerEscHandler({
  5161. intermediates: "%",
  5162. final: "G"
  5163. }, () => this.selectDefaultCharset());
  5164. for (const y in _.CHARSETS)
  5165. this._parser.registerEscHandler({
  5166. intermediates: "(",
  5167. final: y
  5168. }, () => this.selectCharset("(" + y)),
  5169. this._parser.registerEscHandler({
  5170. intermediates: ")",
  5171. final: y
  5172. }, () => this.selectCharset(")" + y)),
  5173. this._parser.registerEscHandler({
  5174. intermediates: "*",
  5175. final: y
  5176. }, () => this.selectCharset("*" + y)),
  5177. this._parser.registerEscHandler({
  5178. intermediates: "+",
  5179. final: y
  5180. }, () => this.selectCharset("+" + y)),
  5181. this._parser.registerEscHandler({
  5182. intermediates: "-",
  5183. final: y
  5184. }, () => this.selectCharset("-" + y)),
  5185. this._parser.registerEscHandler({
  5186. intermediates: ".",
  5187. final: y
  5188. }, () => this.selectCharset("." + y)),
  5189. this._parser.registerEscHandler({
  5190. intermediates: "/",
  5191. final: y
  5192. }, () => this.selectCharset("/" + y));
  5193. this._parser.registerEscHandler({
  5194. intermediates: "#",
  5195. final: "8"
  5196. }, () => this.screenAlignmentPattern()),
  5197. this._parser.setErrorHandler(y => (this._logService.error("Parsing error: ", y),
  5198. y)),
  5199. this._parser.registerDcsHandler({
  5200. intermediates: "$",
  5201. final: "q"
  5202. }, new g.DcsHandler((y, T) => this.requestStatusString(y, T)))
  5203. }
  5204. getAttrData() {
  5205. return this._curAttrData
  5206. }
  5207. get onRequestBell() {
  5208. return this._onRequestBell.event
  5209. }
  5210. get onRequestRefreshRows() {
  5211. return this._onRequestRefreshRows.event
  5212. }
  5213. get onRequestReset() {
  5214. return this._onRequestReset.event
  5215. }
  5216. get onRequestSendFocus() {
  5217. return this._onRequestSendFocus.event
  5218. }
  5219. get onRequestSyncScrollBar() {
  5220. return this._onRequestSyncScrollBar.event
  5221. }
  5222. get onRequestWindowsOptionsReport() {
  5223. return this._onRequestWindowsOptionsReport.event
  5224. }
  5225. get onA11yChar() {
  5226. return this._onA11yChar.event
  5227. }
  5228. get onA11yTab() {
  5229. return this._onA11yTab.event
  5230. }
  5231. get onCursorMove() {
  5232. return this._onCursorMove.event
  5233. }
  5234. get onLineFeed() {
  5235. return this._onLineFeed.event
  5236. }
  5237. get onScroll() {
  5238. return this._onScroll.event
  5239. }
  5240. get onTitleChange() {
  5241. return this._onTitleChange.event
  5242. }
  5243. get onColor() {
  5244. return this._onColor.event
  5245. }
  5246. dispose() {
  5247. super.dispose()
  5248. }
  5249. _preserveStack(p, C, b, E) {
  5250. this._parseStack.paused = !0,
  5251. this._parseStack.cursorStartX = p,
  5252. this._parseStack.cursorStartY = C,
  5253. this._parseStack.decodedLength = b,
  5254. this._parseStack.position = E
  5255. }
  5256. _logSlowResolvingAsync(p) {
  5257. this._logService.logLevel <= i.LogLevelEnum.WARN && Promise.race([p, new Promise((C, b) => setTimeout(() => b("#SLOW_TIMEOUT"), 5e3))]).catch(C => {
  5258. if (C !== "#SLOW_TIMEOUT")
  5259. throw C;
  5260. console.warn("async parser handler taking longer than 5000 ms")
  5261. }
  5262. )
  5263. }
  5264. parse(p, C) {
  5265. let b, E = this._activeBuffer.x, A = this._activeBuffer.y, H = 0;
  5266. const j = this._parseStack.paused;
  5267. if (j) {
  5268. if (b = this._parser.parse(this._parseBuffer, this._parseStack.decodedLength, C))
  5269. return this._logSlowResolvingAsync(b),
  5270. b;
  5271. E = this._parseStack.cursorStartX,
  5272. A = this._parseStack.cursorStartY,
  5273. this._parseStack.paused = !1,
  5274. p.length > u && (H = this._parseStack.position + u)
  5275. }
  5276. if (this._logService.logLevel <= i.LogLevelEnum.DEBUG && this._logService.debug("parsing data" + (typeof p == "string" ? ` "${p}"` : ` "${Array.prototype.map.call(p, $ => String.fromCharCode($)).join("")}"`), typeof p == "string" ? p.split("").map($ => $.charCodeAt(0)) : p),
  5277. this._parseBuffer.length < p.length && this._parseBuffer.length < u && (this._parseBuffer = new Uint32Array(Math.min(p.length, u))),
  5278. j || this._dirtyRowService.clearRange(),
  5279. p.length > u)
  5280. for (let$ = H; $ < p.length; $ += u) {
  5281. const P = $ + u < p.length ? $ + u : p.length
  5282. , N = typeof p == "string" ? this._stringDecoder.decode(p.substring($, P), this._parseBuffer) : this._utf8Decoder.decode(p.subarray($, P), this._parseBuffer);
  5283. if (b = this._parser.parse(this._parseBuffer, N))
  5284. return this._preserveStack(E, A, N, $),
  5285. this._logSlowResolvingAsync(b),
  5286. b
  5287. }
  5288. else if (!j) {
  5289. const $ = typeof p == "string" ? this._stringDecoder.decode(p, this._parseBuffer) : this._utf8Decoder.decode(p, this._parseBuffer);
  5290. if (b = this._parser.parse(this._parseBuffer, $))
  5291. return this._preserveStack(E, A, $, 0),
  5292. this._logSlowResolvingAsync(b),
  5293. b
  5294. }
  5295. this._activeBuffer.x === E && this._activeBuffer.y === A || this._onCursorMove.fire(),
  5296. this._onRequestRefreshRows.fire(this._dirtyRowService.start, this._dirtyRowService.end)
  5297. }
  5298. print(p, C, b) {
  5299. let E, A;
  5300. const H = this._charsetService.charset
  5301. , j = this._optionsService.rawOptions.screenReaderMode
  5302. , $ = this._bufferService.cols
  5303. , P = this._coreService.decPrivateModes.wraparound
  5304. , N = this._coreService.modes.insertMode
  5305. , y = this._curAttrData;
  5306. let T = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
  5307. this._dirtyRowService.markDirty(this._activeBuffer.y),
  5308. this._activeBuffer.x && b - C > 0 && T.getWidth(this._activeBuffer.x - 1) === 2 && T.setCellFromCodePoint(this._activeBuffer.x - 1, 0, 1, y.fg, y.bg, y.extended);
  5309. for (let O = C; O < b; ++O) {
  5310. if (E = p[O],
  5311. A = this._unicodeService.wcwidth(E),
  5312. E < 127 && H) {
  5313. const k = H[String.fromCharCode(E)];
  5314. k && (E = k.charCodeAt(0))
  5315. }
  5316. if (j && this._onA11yChar.fire((0,
  5317. d.stringFromCodePoint)(E)),
  5318. this._currentLinkId !== void 0 && this._oscLinkService.addLineToLink(this._currentLinkId, this._activeBuffer.ybase + this._activeBuffer.y),
  5319. A || !this._activeBuffer.x) {
  5320. if (this._activeBuffer.x + A - 1 >= $) {
  5321. if (P) {
  5322. for (; this._activeBuffer.x < $;)
  5323. T.setCellFromCodePoint(this._activeBuffer.x++, 0, 1, y.fg, y.bg, y.extended);
  5324. this._activeBuffer.x = 0,
  5325. this._activeBuffer.y++,
  5326. this._activeBuffer.y === this._activeBuffer.scrollBottom + 1 ? (this._activeBuffer.y--,
  5327. this._bufferService.scroll(this._eraseAttrData(), !0)) : (this._activeBuffer.y >= this._bufferService.rows && (this._activeBuffer.y = this._bufferService.rows - 1),
  5328. this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).isWrapped = !0),
  5329. T = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)
  5330. } else if (this._activeBuffer.x = $ - 1,
  5331. A === 2)
  5332. continue
  5333. }
  5334. if (N && (T.insertCells(this._activeBuffer.x, A, this._activeBuffer.getNullCell(y), y),
  5335. T.getWidth($ - 1) === 2 && T.setCellFromCodePoint($ - 1, t.NULL_CELL_CODE, t.NULL_CELL_WIDTH, y.fg, y.bg, y.extended)),
  5336. T.setCellFromCodePoint(this._activeBuffer.x++, E, A, y.fg, y.bg, y.extended),
  5337. A > 0)
  5338. for (; --A;)
  5339. T.setCellFromCodePoint(this._activeBuffer.x++, 0, 0, y.fg, y.bg, y.extended)
  5340. } else
  5341. T.getWidth(this._activeBuffer.x - 1) ? T.addCodepointToCell(this._activeBuffer.x - 1, E) : T.addCodepointToCell(this._activeBuffer.x - 2, E)
  5342. }
  5343. b - C > 0 && (T.loadCell(this._activeBuffer.x - 1, this._workCell),
  5344. this._workCell.getWidth() === 2 || this._workCell.getCode() > 65535 ? this._parser.precedingCodepoint = 0 : this._workCell.isCombined() ? this._parser.precedingCodepoint = this._workCell.getChars().charCodeAt(0) : this._parser.precedingCodepoint = this._workCell.content),
  5345. this._activeBuffer.x < $ && b - C > 0 && T.getWidth(this._activeBuffer.x) === 0 && !T.hasContent(this._activeBuffer.x) && T.setCellFromCodePoint(this._activeBuffer.x, 0, 1, y.fg, y.bg, y.extended),
  5346. this._dirtyRowService.markDirty(this._activeBuffer.y)
  5347. }
  5348. registerCsiHandler(p, C) {
  5349. return p.final !== "t" || p.prefix || p.intermediates ? this._parser.registerCsiHandler(p, C) : this._parser.registerCsiHandler(p, b => !m(b.params[0], this._optionsService.rawOptions.windowOptions) || C(b))
  5350. }
  5351. registerDcsHandler(p, C) {
  5352. return this._parser.registerDcsHandler(p, new g.DcsHandler(C))
  5353. }
  5354. registerEscHandler(p, C) {
  5355. return this._parser.registerEscHandler(p, C)
  5356. }
  5357. registerOscHandler(p, C) {
  5358. return this._parser.registerOscHandler(p, new c.OscHandler(C))
  5359. }
  5360. bell() {
  5361. return this._onRequestBell.fire(),
  5362. !0
  5363. }
  5364. lineFeed() {
  5365. return this._dirtyRowService.markDirty(this._activeBuffer.y),
  5366. this._optionsService.rawOptions.convertEol && (this._activeBuffer.x = 0),
  5367. this._activeBuffer.y++,
  5368. this._activeBuffer.y === this._activeBuffer.scrollBottom + 1 ? (this._activeBuffer.y--,
  5369. this._bufferService.scroll(this._eraseAttrData())) : this._activeBuffer.y >= this._bufferService.rows && (this._activeBuffer.y = this._bufferService.rows - 1),
  5370. this._activeBuffer.x >= this._bufferService.cols && this._activeBuffer.x--,
  5371. this._dirtyRowService.markDirty(this._activeBuffer.y),
  5372. this._onLineFeed.fire(),
  5373. !0
  5374. }
  5375. carriageReturn() {
  5376. return this._activeBuffer.x = 0,
  5377. !0
  5378. }
  5379. backspace() {
  5380. var p;
  5381. if (!this._coreService.decPrivateModes.reverseWraparound)
  5382. return this._restrictCursor(),
  5383. this._activeBuffer.x > 0 && this._activeBuffer.x--,
  5384. !0;
  5385. if (this._restrictCursor(this._bufferService.cols),
  5386. this._activeBuffer.x > 0)
  5387. this._activeBuffer.x--;
  5388. else if (this._activeBuffer.x === 0 && this._activeBuffer.y > this._activeBuffer.scrollTop && this._activeBuffer.y <= this._activeBuffer.scrollBottom && ((p = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)) === null || p === void 0 ? void 0 : p.isWrapped)) {
  5389. this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).isWrapped = !1,
  5390. this._activeBuffer.y--,
  5391. this._activeBuffer.x = this._bufferService.cols - 1;
  5392. const C = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
  5393. C.hasWidth(this._activeBuffer.x) && !C.hasContent(this._activeBuffer.x) && this._activeBuffer.x--
  5394. }
  5395. return this._restrictCursor(),
  5396. !0
  5397. }
  5398. tab() {
  5399. if (this._activeBuffer.x >= this._bufferService.cols)
  5400. return !0;
  5401. const p = this._activeBuffer.x;
  5402. return this._activeBuffer.x = this._activeBuffer.nextStop(),
  5403. this._optionsService.rawOptions.screenReaderMode && this._onA11yTab.fire(this._activeBuffer.x - p),
  5404. !0
  5405. }
  5406. shiftOut() {
  5407. return this._charsetService.setgLevel(1),
  5408. !0
  5409. }
  5410. shiftIn() {
  5411. return this._charsetService.setgLevel(0),
  5412. !0
  5413. }
  5414. _restrictCursor(p = this._bufferService.cols - 1) {
  5415. this._activeBuffer.x = Math.min(p, Math.max(0, this._activeBuffer.x)),
  5416. this._activeBuffer.y = this._coreService.decPrivateModes.origin ? Math.min(this._activeBuffer.scrollBottom, Math.max(this._activeBuffer.scrollTop, this._activeBuffer.y)) : Math.min(this._bufferService.rows - 1, Math.max(0, this._activeBuffer.y)),
  5417. this._dirtyRowService.markDirty(this._activeBuffer.y)
  5418. }
  5419. _setCursor(p, C) {
  5420. this._dirtyRowService.markDirty(this._activeBuffer.y),
  5421. this._coreService.decPrivateModes.origin ? (this._activeBuffer.x = p,
  5422. this._activeBuffer.y = this._activeBuffer.scrollTop + C) : (this._activeBuffer.x = p,
  5423. this._activeBuffer.y = C),
  5424. this._restrictCursor(),
  5425. this._dirtyRowService.markDirty(this._activeBuffer.y)
  5426. }
  5427. _moveCursor(p, C) {
  5428. this._restrictCursor(),
  5429. this._setCursor(this._activeBuffer.x + p, this._activeBuffer.y + C)
  5430. }
  5431. cursorUp(p) {
  5432. const C = this._activeBuffer.y - this._activeBuffer.scrollTop;
  5433. return C >= 0 ? this._moveCursor(0, -Math.min(C, p.params[0] || 1)) : this._moveCursor(0, -(p.params[0] || 1)),
  5434. !0
  5435. }
  5436. cursorDown(p) {
  5437. const C = this._activeBuffer.scrollBottom - this._activeBuffer.y;
  5438. return C >= 0 ? this._moveCursor(0, Math.min(C, p.params[0] || 1)) : this._moveCursor(0, p.params[0] || 1),
  5439. !0
  5440. }
  5441. cursorForward(p) {
  5442. return this._moveCursor(p.params[0] || 1, 0),
  5443. !0
  5444. }
  5445. cursorBackward(p) {
  5446. return this._moveCursor(-(p.params[0] || 1), 0),
  5447. !0
  5448. }
  5449. cursorNextLine(p) {
  5450. return this.cursorDown(p),
  5451. this._activeBuffer.x = 0,
  5452. !0
  5453. }
  5454. cursorPrecedingLine(p) {
  5455. return this.cursorUp(p),
  5456. this._activeBuffer.x = 0,
  5457. !0
  5458. }
  5459. cursorCharAbsolute(p) {
  5460. return this._setCursor((p.params[0] || 1) - 1, this._activeBuffer.y),
  5461. !0
  5462. }
  5463. cursorPosition(p) {
  5464. return this._setCursor(p.length >= 2 ? (p.params[1] || 1) - 1 : 0, (p.params[0] || 1) - 1),
  5465. !0
  5466. }
  5467. charPosAbsolute(p) {
  5468. return this._setCursor((p.params[0] || 1) - 1, this._activeBuffer.y),
  5469. !0
  5470. }
  5471. hPositionRelative(p) {
  5472. return this._moveCursor(p.params[0] || 1, 0),
  5473. !0
  5474. }
  5475. linePosAbsolute(p) {
  5476. return this._setCursor(this._activeBuffer.x, (p.params[0] || 1) - 1),
  5477. !0
  5478. }
  5479. vPositionRelative(p) {
  5480. return this._moveCursor(0, p.params[0] || 1),
  5481. !0
  5482. }
  5483. hVPosition(p) {
  5484. return this.cursorPosition(p),
  5485. !0
  5486. }
  5487. tabClear(p) {
  5488. const C = p.params[0];
  5489. return C === 0 ? delete this._activeBuffer.tabs[this._activeBuffer.x] : C === 3 && (this._activeBuffer.tabs = {}),
  5490. !0
  5491. }
  5492. cursorForwardTab(p) {
  5493. if (this._activeBuffer.x >= this._bufferService.cols)
  5494. return !0;
  5495. let C = p.params[0] || 1;
  5496. for (; C--;)
  5497. this._activeBuffer.x = this._activeBuffer.nextStop();
  5498. return !0
  5499. }
  5500. cursorBackwardTab(p) {
  5501. if (this._activeBuffer.x >= this._bufferService.cols)
  5502. return !0;
  5503. let C = p.params[0] || 1;
  5504. for (; C--;)
  5505. this._activeBuffer.x = this._activeBuffer.prevStop();
  5506. return !0
  5507. }
  5508. selectProtected(p) {
  5509. const C = p.params[0];
  5510. return C === 1 && (this._curAttrData.bg |= 536870912),
  5511. C !== 2 && C !== 0 || (this._curAttrData.bg &= -536870913),
  5512. !0
  5513. }
  5514. _eraseInBufferLine(p, C, b, E = !1, A = !1) {
  5515. const H = this._activeBuffer.lines.get(this._activeBuffer.ybase + p);
  5516. H.replaceCells(C, b, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData(), A),
  5517. E && (H.isWrapped = !1)
  5518. }
  5519. _resetBufferLine(p, C = !1) {
  5520. const b = this._activeBuffer.lines.get(this._activeBuffer.ybase + p);
  5521. b.fill(this._activeBuffer.getNullCell(this._eraseAttrData()), C),
  5522. this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase + p),
  5523. b.isWrapped = !1
  5524. }
  5525. eraseInDisplay(p, C = !1) {
  5526. let b;
  5527. switch (this._restrictCursor(this._bufferService.cols),
  5528. p.params[0]) {
  5529. case 0:
  5530. for (b = this._activeBuffer.y,
  5531. this._dirtyRowService.markDirty(b),
  5532. this._eraseInBufferLine(b++, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, C); b < this._bufferService.rows; b++)
  5533. this._resetBufferLine(b, C);
  5534. this._dirtyRowService.markDirty(b);
  5535. break;
  5536. case 1:
  5537. for (b = this._activeBuffer.y,
  5538. this._dirtyRowService.markDirty(b),
  5539. this._eraseInBufferLine(b, 0, this._activeBuffer.x + 1, !0, C),
  5540. this._activeBuffer.x + 1 >= this._bufferService.cols && (this._activeBuffer.lines.get(b + 1).isWrapped = !1); b--;)
  5541. this._resetBufferLine(b, C);
  5542. this._dirtyRowService.markDirty(0);
  5543. break;
  5544. case 2:
  5545. for (b = this._bufferService.rows,
  5546. this._dirtyRowService.markDirty(b - 1); b--;)
  5547. this._resetBufferLine(b, C);
  5548. this._dirtyRowService.markDirty(0);
  5549. break;
  5550. case 3:
  5551. const E = this._activeBuffer.lines.length - this._bufferService.rows;
  5552. E > 0 && (this._activeBuffer.lines.trimStart(E),
  5553. this._activeBuffer.ybase = Math.max(this._activeBuffer.ybase - E, 0),
  5554. this._activeBuffer.ydisp = Math.max(this._activeBuffer.ydisp - E, 0),
  5555. this._onScroll.fire(0))
  5556. }
  5557. return !0
  5558. }
  5559. eraseInLine(p, C = !1) {
  5560. switch (this._restrictCursor(this._bufferService.cols),
  5561. p.params[0]) {
  5562. case 0:
  5563. this._eraseInBufferLine(this._activeBuffer.y, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, C);
  5564. break;
  5565. case 1:
  5566. this._eraseInBufferLine(this._activeBuffer.y, 0, this._activeBuffer.x + 1, !1, C);
  5567. break;
  5568. case 2:
  5569. this._eraseInBufferLine(this._activeBuffer.y, 0, this._bufferService.cols, !0, C)
  5570. }
  5571. return this._dirtyRowService.markDirty(this._activeBuffer.y),
  5572. !0
  5573. }
  5574. insertLines(p) {
  5575. this._restrictCursor();
  5576. let C = p.params[0] || 1;
  5577. if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
  5578. return !0;
  5579. const b = this._activeBuffer.ybase + this._activeBuffer.y
  5580. , E = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom
  5581. , A = this._bufferService.rows - 1 + this._activeBuffer.ybase - E + 1;
  5582. for (; C--;)
  5583. this._activeBuffer.lines.splice(A - 1, 1),
  5584. this._activeBuffer.lines.splice(b, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));
  5585. return this._dirtyRowService.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom),
  5586. this._activeBuffer.x = 0,
  5587. !0
  5588. }
  5589. deleteLines(p) {
  5590. this._restrictCursor();
  5591. let C = p.params[0] || 1;
  5592. if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
  5593. return !0;
  5594. const b = this._activeBuffer.ybase + this._activeBuffer.y;
  5595. let E;
  5596. for (E = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom,
  5597. E = this._bufferService.rows - 1 + this._activeBuffer.ybase - E; C--;)
  5598. this._activeBuffer.lines.splice(b, 1),
  5599. this._activeBuffer.lines.splice(E, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));
  5600. return this._dirtyRowService.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom),
  5601. this._activeBuffer.x = 0,
  5602. !0
  5603. }
  5604. insertChars(p) {
  5605. this._restrictCursor();
  5606. const C = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
  5607. return C && (C.insertCells(this._activeBuffer.x, p.params[0] || 1, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()),
  5608. this._dirtyRowService.markDirty(this._activeBuffer.y)),
  5609. !0
  5610. }
  5611. deleteChars(p) {
  5612. this._restrictCursor();
  5613. const C = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
  5614. return C && (C.deleteCells(this._activeBuffer.x, p.params[0] || 1, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()),
  5615. this._dirtyRowService.markDirty(this._activeBuffer.y)),
  5616. !0
  5617. }
  5618. scrollUp(p) {
  5619. let C = p.params[0] || 1;
  5620. for (; C--;)
  5621. this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollTop, 1),
  5622. this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollBottom, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));
  5623. return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom),
  5624. !0
  5625. }
  5626. scrollDown(p) {
  5627. let C = p.params[0] || 1;
  5628. for (; C--;)
  5629. this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollBottom, 1),
  5630. this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollTop, 0, this._activeBuffer.getBlankLine(l.DEFAULT_ATTR_DATA));
  5631. return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom),
  5632. !0
  5633. }
  5634. scrollLeft(p) {
  5635. if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
  5636. return !0;
  5637. const C = p.params[0] || 1;
  5638. for (let b = this._activeBuffer.scrollTop; b <= this._activeBuffer.scrollBottom; ++b) {
  5639. const E = this._activeBuffer.lines.get(this._activeBuffer.ybase + b);
  5640. E.deleteCells(0, C, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()),
  5641. E.isWrapped = !1
  5642. }
  5643. return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom),
  5644. !0
  5645. }
  5646. scrollRight(p) {
  5647. if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
  5648. return !0;
  5649. const C = p.params[0] || 1;
  5650. for (let b = this._activeBuffer.scrollTop; b <= this._activeBuffer.scrollBottom; ++b) {
  5651. const E = this._activeBuffer.lines.get(this._activeBuffer.ybase + b);
  5652. E.insertCells(0, C, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()),
  5653. E.isWrapped = !1
  5654. }
  5655. return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom),
  5656. !0
  5657. }
  5658. insertColumns(p) {
  5659. if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
  5660. return !0;
  5661. const C = p.params[0] || 1;
  5662. for (let b = this._activeBuffer.scrollTop; b <= this._activeBuffer.scrollBottom; ++b) {
  5663. const E = this._activeBuffer.lines.get(this._activeBuffer.ybase + b);
  5664. E.insertCells(this._activeBuffer.x, C, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()),
  5665. E.isWrapped = !1
  5666. }
  5667. return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom),
  5668. !0
  5669. }
  5670. deleteColumns(p) {
  5671. if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
  5672. return !0;
  5673. const C = p.params[0] || 1;
  5674. for (let b = this._activeBuffer.scrollTop; b <= this._activeBuffer.scrollBottom; ++b) {
  5675. const E = this._activeBuffer.lines.get(this._activeBuffer.ybase + b);
  5676. E.deleteCells(this._activeBuffer.x, C, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()),
  5677. E.isWrapped = !1
  5678. }
  5679. return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom),
  5680. !0
  5681. }
  5682. eraseChars(p) {
  5683. this._restrictCursor();
  5684. const C = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
  5685. return C && (C.replaceCells(this._activeBuffer.x, this._activeBuffer.x + (p.params[0] || 1), this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()),
  5686. this._dirtyRowService.markDirty(this._activeBuffer.y)),
  5687. !0
  5688. }
  5689. repeatPrecedingCharacter(p) {
  5690. if (!this._parser.precedingCodepoint)
  5691. return !0;
  5692. const C = p.params[0] || 1
  5693. , b = new Uint32Array(C);
  5694. for (let E = 0; E < C; ++E)
  5695. b[E] = this._parser.precedingCodepoint;
  5696. return this.print(b, 0, b.length),
  5697. !0
  5698. }
  5699. sendDeviceAttributesPrimary(p) {
  5700. return p.params[0] > 0 || (this._is("xterm") || this._is("rxvt-unicode") || this._is("screen") ? this._coreService.triggerDataEvent(n.C0.ESC + "[?1;2c") : this._is("linux") && this._coreService.triggerDataEvent(n.C0.ESC + "[?6c")),
  5701. !0
  5702. }
  5703. sendDeviceAttributesSecondary(p) {
  5704. return p.params[0] > 0 || (this._is("xterm") ? this._coreService.triggerDataEvent(n.C0.ESC + "[>0;276;0c") : this._is("rxvt-unicode") ? this._coreService.triggerDataEvent(n.C0.ESC + "[>85;95;0c") : this._is("linux") ? this._coreService.triggerDataEvent(p.params[0] + "c") : this._is("screen") && this._coreService.triggerDataEvent(n.C0.ESC + "[>83;40003;0c")),
  5705. !0
  5706. }
  5707. _is(p) {
  5708. return (this._optionsService.rawOptions.termName + "").indexOf(p) === 0
  5709. }
  5710. setMode(p) {
  5711. for (let C = 0; C < p.length; C++)
  5712. switch (p.params[C]) {
  5713. case 4:
  5714. this._coreService.modes.insertMode = !0;
  5715. break;
  5716. case 20:
  5717. this._optionsService.options.convertEol = !0
  5718. }
  5719. return !0
  5720. }
  5721. setModePrivate(p) {
  5722. for (let C = 0; C < p.length; C++)
  5723. switch (p.params[C]) {
  5724. case 1:
  5725. this._coreService.decPrivateModes.applicationCursorKeys = !0;
  5726. break;
  5727. case 2:
  5728. this._charsetService.setgCharset(0, _.DEFAULT_CHARSET),
  5729. this._charsetService.setgCharset(1, _.DEFAULT_CHARSET),
  5730. this._charsetService.setgCharset(2, _.DEFAULT_CHARSET),
  5731. this._charsetService.setgCharset(3, _.DEFAULT_CHARSET);
  5732. break;
  5733. case 3:
  5734. this._optionsService.rawOptions.windowOptions.setWinLines && (this._bufferService.resize(132, this._bufferService.rows),
  5735. this._onRequestReset.fire());
  5736. break;
  5737. case 6:
  5738. this._coreService.decPrivateModes.origin = !0,
  5739. this._setCursor(0, 0);
  5740. break;
  5741. case 7:
  5742. this._coreService.decPrivateModes.wraparound = !0;
  5743. break;
  5744. case 12:
  5745. this._optionsService.options.cursorBlink = !0;
  5746. break;
  5747. case 45:
  5748. this._coreService.decPrivateModes.reverseWraparound = !0;
  5749. break;
  5750. case 66:
  5751. this._logService.debug("Serial port requested application keypad."),
  5752. this._coreService.decPrivateModes.applicationKeypad = !0,
  5753. this._onRequestSyncScrollBar.fire();
  5754. break;
  5755. case 9:
  5756. this._coreMouseService.activeProtocol = "X10";
  5757. break;
  5758. case 1e3:
  5759. this._coreMouseService.activeProtocol = "VT200";
  5760. break;
  5761. case 1002:
  5762. this._coreMouseService.activeProtocol = "DRAG";
  5763. break;
  5764. case 1003:
  5765. this._coreMouseService.activeProtocol = "ANY";
  5766. break;
  5767. case 1004:
  5768. this._coreService.decPrivateModes.sendFocus = !0,
  5769. this._onRequestSendFocus.fire();
  5770. break;
  5771. case 1005:
  5772. this._logService.debug("DECSET 1005 not supported (see #2507)");
  5773. break;
  5774. case 1006:
  5775. this._coreMouseService.activeEncoding = "SGR";
  5776. break;
  5777. case 1015:
  5778. this._logService.debug("DECSET 1015 not supported (see #2507)");
  5779. break;
  5780. case 1016:
  5781. this._coreMouseService.activeEncoding = "SGR_PIXELS";
  5782. break;
  5783. case 25:
  5784. this._coreService.isCursorHidden = !1;
  5785. break;
  5786. case 1048:
  5787. this.saveCursor();
  5788. break;
  5789. case 1049:
  5790. this.saveCursor();
  5791. case 47:
  5792. case 1047:
  5793. this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),
  5794. this._coreService.isCursorInitialized = !0,
  5795. this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1),
  5796. this._onRequestSyncScrollBar.fire();
  5797. break;
  5798. case 2004:
  5799. this._coreService.decPrivateModes.bracketedPasteMode = !0
  5800. }
  5801. return !0
  5802. }
  5803. resetMode(p) {
  5804. for (let C = 0; C < p.length; C++)
  5805. switch (p.params[C]) {
  5806. case 4:
  5807. this._coreService.modes.insertMode = !1;
  5808. break;
  5809. case 20:
  5810. this._optionsService.options.convertEol = !1
  5811. }
  5812. return !0
  5813. }
  5814. resetModePrivate(p) {
  5815. for (let C = 0; C < p.length; C++)
  5816. switch (p.params[C]) {
  5817. case 1:
  5818. this._coreService.decPrivateModes.applicationCursorKeys = !1;
  5819. break;
  5820. case 3:
  5821. this._optionsService.rawOptions.windowOptions.setWinLines && (this._bufferService.resize(80, this._bufferService.rows),
  5822. this._onRequestReset.fire());
  5823. break;
  5824. case 6:
  5825. this._coreService.decPrivateModes.origin = !1,
  5826. this._setCursor(0, 0);
  5827. break;
  5828. case 7:
  5829. this._coreService.decPrivateModes.wraparound = !1;
  5830. break;
  5831. case 12:
  5832. this._optionsService.options.cursorBlink = !1;
  5833. break;
  5834. case 45:
  5835. this._coreService.decPrivateModes.reverseWraparound = !1;
  5836. break;
  5837. case 66:
  5838. this._logService.debug("Switching back to normal keypad."),
  5839. this._coreService.decPrivateModes.applicationKeypad = !1,
  5840. this._onRequestSyncScrollBar.fire();
  5841. break;
  5842. case 9:
  5843. case 1e3:
  5844. case 1002:
  5845. case 1003:
  5846. this._coreMouseService.activeProtocol = "NONE";
  5847. break;
  5848. case 1004:
  5849. this._coreService.decPrivateModes.sendFocus = !1;
  5850. break;
  5851. case 1005:
  5852. this._logService.debug("DECRST 1005 not supported (see #2507)");
  5853. break;
  5854. case 1006:
  5855. case 1016:
  5856. this._coreMouseService.activeEncoding = "DEFAULT";
  5857. break;
  5858. case 1015:
  5859. this._logService.debug("DECRST 1015 not supported (see #2507)");
  5860. break;
  5861. case 25:
  5862. this._coreService.isCursorHidden = !0;
  5863. break;
  5864. case 1048:
  5865. this.restoreCursor();
  5866. break;
  5867. case 1049:
  5868. case 47:
  5869. case 1047:
  5870. this._bufferService.buffers.activateNormalBuffer(),
  5871. p.params[C] === 1049 && this.restoreCursor(),
  5872. this._coreService.isCursorInitialized = !0,
  5873. this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1),
  5874. this._onRequestSyncScrollBar.fire();
  5875. break;
  5876. case 2004:
  5877. this._coreService.decPrivateModes.bracketedPasteMode = !1
  5878. }
  5879. return !0
  5880. }
  5881. requestMode(p, C) {
  5882. const b = this._coreService.decPrivateModes
  5883. , { activeProtocol: E, activeEncoding: A } = this._coreMouseService
  5884. , H = this._coreService
  5885. , { buffers: j, cols: $ } = this._bufferService
  5886. , { active: P, alt: N } = j
  5887. , y = this._optionsService.rawOptions
  5888. , T = B => B ? 1 : 2
  5889. , O = p.params[0];
  5890. return k = O,
  5891. D = C ? O === 2 ? 3 : O === 4 ? T(H.modes.insertMode) : O === 12 ? 4 : O === 20 ? T(y.convertEol) : 0 : O === 1 ? T(b.applicationCursorKeys) : O === 3 ? y.windowOptions.setWinLines ? $ === 80 ? 2 : $ === 132 ? 1 : 0 : 0 : O === 6 ? T(b.origin) : O === 7 ? T(b.wraparound) : O === 8 ? 3 : O === 9 ? T(E === "X10") : O === 12 ? T(y.cursorBlink) : O === 25 ? T(!H.isCursorHidden) : O === 45 ? T(b.reverseWraparound) : O === 66 ? T(b.applicationKeypad) : O === 1e3 ? T(E === "VT200") : O === 1002 ? T(E === "DRAG") : O === 1003 ? T(E === "ANY") : O === 1004 ? T(b.sendFocus) : O === 1005 ? 4 : O === 1006 ? T(A === "SGR") : O === 1015 ? 4 : O === 1016 ? T(A === "SGR_PIXELS") : O === 1048 ? 1 : O === 47 || O === 1047 || O === 1049 ? T(P === N) : O === 2004 ? T(b.bracketedPasteMode) : 0,
  5892. H.triggerDataEvent(`${n.C0.ESC}[${C ? "" : "?"}${k};${D}$y`),
  5893. !0;
  5894. var k, D
  5895. }
  5896. _updateAttrColor(p, C, b, E, A) {
  5897. return C === 2 ? (p |= 50331648,
  5898. p &= -16777216,
  5899. p |= e.AttributeData.fromColorRGB([b, E, A])) : C === 5 && (p &= -50331904,
  5900. p |= 33554432 | 255 & b),
  5901. p
  5902. }
  5903. _extractColor(p, C, b) {
  5904. const E = [0, 0, -1, 0, 0, 0];
  5905. let A = 0
  5906. , H = 0;
  5907. do {
  5908. if (E[H + A] = p.params[C + H],
  5909. p.hasSubParams(C + H)) {
  5910. const j = p.getSubParams(C + H);
  5911. let$ = 0;
  5912. do
  5913. E[1] === 5 && (A = 1),
  5914. E[H + $ + 1 + A] = j[$];
  5915. while (++$ < j.length && $ + H + 1 + A < E.length);
  5916. break
  5917. }
  5918. if (E[1] === 5 && H + A >= 2 || E[1] === 2 && H + A >= 5)
  5919. break;
  5920. E[1] && (A = 1)
  5921. } while (++H + C < p.length && H + A < E.length);
  5922. for (let j = 2; j < E.length; ++j)
  5923. E[j] === -1 && (E[j] = 0);
  5924. switch (E[0]) {
  5925. case 38:
  5926. b.fg = this._updateAttrColor(b.fg, E[1], E[3], E[4], E[5]);
  5927. break;
  5928. case 48:
  5929. b.bg = this._updateAttrColor(b.bg, E[1], E[3], E[4], E[5]);
  5930. break;
  5931. case 58:
  5932. b.extended = b.extended.clone(),
  5933. b.extended.underlineColor = this._updateAttrColor(b.extended.underlineColor, E[1], E[3], E[4], E[5])
  5934. }
  5935. return H
  5936. }
  5937. _processUnderline(p, C) {
  5938. C.extended = C.extended.clone(),
  5939. (!~p || p > 5) && (p = 1),
  5940. C.extended.underlineStyle = p,
  5941. C.fg |= 268435456,
  5942. p === 0 && (C.fg &= -268435457),
  5943. C.updateExtended()
  5944. }
  5945. charAttributes(p) {
  5946. if (p.length === 1 && p.params[0] === 0)
  5947. return this._curAttrData.fg = l.DEFAULT_ATTR_DATA.fg,
  5948. this._curAttrData.bg = l.DEFAULT_ATTR_DATA.bg,
  5949. !0;
  5950. const C = p.length;
  5951. let b;
  5952. const E = this._curAttrData;
  5953. for (let A = 0; A < C; A++)
  5954. b = p.params[A],
  5955. b >= 30 && b <= 37 ? (E.fg &= -50331904,
  5956. E.fg |= 16777216 | b - 30) : b >= 40 && b <= 47 ? (E.bg &= -50331904,
  5957. E.bg |= 16777216 | b - 40) : b >= 90 && b <= 97 ? (E.fg &= -50331904,
  5958. E.fg |= 16777224 | b - 90) : b >= 100 && b <= 107 ? (E.bg &= -50331904,
  5959. E.bg |= 16777224 | b - 100) : b === 0 ? (E.fg = l.DEFAULT_ATTR_DATA.fg,
  5960. E.bg = l.DEFAULT_ATTR_DATA.bg) : b === 1 ? E.fg |= 134217728 : b === 3 ? E.bg |= 67108864 : b === 4 ? (E.fg |= 268435456,
  5961. this._processUnderline(p.hasSubParams(A) ? p.getSubParams(A)[0] : 1, E)) : b === 5 ? E.fg |= 536870912 : b === 7 ? E.fg |= 67108864 : b === 8 ? E.fg |= 1073741824 : b === 9 ? E.fg |= 2147483648 : b === 2 ? E.bg |= 134217728 : b === 21 ? this._processUnderline(2, E) : b === 22 ? (E.fg &= -134217729,
  5962. E.bg &= -134217729) : b === 23 ? E.bg &= -67108865 : b === 24 ? (E.fg &= -268435457,
  5963. this._processUnderline(0, E)) : b === 25 ? E.fg &= -536870913 : b === 27 ? E.fg &= -67108865 : b === 28 ? E.fg &= -1073741825 : b === 29 ? E.fg &= 2147483647 : b === 39 ? (E.fg &= -67108864,
  5964. E.fg |= 16777215 & l.DEFAULT_ATTR_DATA.fg) : b === 49 ? (E.bg &= -67108864,
  5965. E.bg |= 16777215 & l.DEFAULT_ATTR_DATA.bg) : b === 38 || b === 48 || b === 58 ? A += this._extractColor(p, A, E) : b === 59 ? (E.extended = E.extended.clone(),
  5966. E.extended.underlineColor = -1,
  5967. E.updateExtended()) : b === 100 ? (E.fg &= -67108864,
  5968. E.fg |= 16777215 & l.DEFAULT_ATTR_DATA.fg,
  5969. E.bg &= -67108864,
  5970. E.bg |= 16777215 & l.DEFAULT_ATTR_DATA.bg) : this._logService.debug("Unknown SGR attribute: %d.", b);
  5971. return !0
  5972. }
  5973. deviceStatus(p) {
  5974. switch (p.params[0]) {
  5975. case 5:
  5976. this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);
  5977. break;
  5978. case 6:
  5979. const C = this._activeBuffer.y + 1
  5980. , b = this._activeBuffer.x + 1;
  5981. this._coreService.triggerDataEvent(`${n.C0.ESC}[${C};${b}R`)
  5982. }
  5983. return !0
  5984. }
  5985. deviceStatusPrivate(p) {
  5986. if (p.params[0] === 6) {
  5987. const C = this._activeBuffer.y + 1
  5988. , b = this._activeBuffer.x + 1;
  5989. this._coreService.triggerDataEvent(`${n.C0.ESC}[?${C};${b}R`)
  5990. }
  5991. return !0
  5992. }
  5993. softReset(p) {
  5994. return this._coreService.isCursorHidden = !1,
  5995. this._onRequestSyncScrollBar.fire(),
  5996. this._activeBuffer.scrollTop = 0,
  5997. this._activeBuffer.scrollBottom = this._bufferService.rows - 1,
  5998. this._curAttrData = l.DEFAULT_ATTR_DATA.clone(),
  5999. this._coreService.reset(),
  6000. this._charsetService.reset(),
  6001. this._activeBuffer.savedX = 0,
  6002. this._activeBuffer.savedY = this._activeBuffer.ybase,
  6003. this._activeBuffer.savedCurAttrData.fg = this._curAttrData.fg,
  6004. this._activeBuffer.savedCurAttrData.bg = this._curAttrData.bg,
  6005. this._activeBuffer.savedCharset = this._charsetService.charset,
  6006. this._coreService.decPrivateModes.origin = !1,
  6007. !0
  6008. }
  6009. setCursorStyle(p) {
  6010. const C = p.params[0] || 1;
  6011. switch (C) {
  6012. case 1:
  6013. case 2:
  6014. this._optionsService.options.cursorStyle = "block";
  6015. break;
  6016. case 3:
  6017. case 4:
  6018. this._optionsService.options.cursorStyle = "underline";
  6019. break;
  6020. case 5:
  6021. case 6:
  6022. this._optionsService.options.cursorStyle = "bar"
  6023. }
  6024. const b = C % 2 == 1;
  6025. return this._optionsService.options.cursorBlink = b,
  6026. !0
  6027. }
  6028. setScrollRegion(p) {
  6029. const C = p.params[0] || 1;
  6030. let b;
  6031. return (p.length < 2 || (b = p.params[1]) > this._bufferService.rows || b === 0) && (b = this._bufferService.rows),
  6032. b > C && (this._activeBuffer.scrollTop = C - 1,
  6033. this._activeBuffer.scrollBottom = b - 1,
  6034. this._setCursor(0, 0)),
  6035. !0
  6036. }
  6037. windowOptions(p) {
  6038. if (!m(p.params[0], this._optionsService.rawOptions.windowOptions))
  6039. return !0;
  6040. const C = p.length > 1 ? p.params[1] : 0;
  6041. switch (p.params[0]) {
  6042. case 14:
  6043. C !== 2 && this._onRequestWindowsOptionsReport.fire(w.GET_WIN_SIZE_PIXELS);
  6044. break;
  6045. case 16:
  6046. this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);
  6047. break;
  6048. case 18:
  6049. this._bufferService && this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);
  6050. break;
  6051. case 22:
  6052. C !== 0 && C !== 2 || (this._windowTitleStack.push(this._windowTitle),
  6053. this._windowTitleStack.length > 10 && this._windowTitleStack.shift()),
  6054. C !== 0 && C !== 1 || (this._iconNameStack.push(this._iconName),
  6055. this._iconNameStack.length > 10 && this._iconNameStack.shift());
  6056. break;
  6057. case 23:
  6058. C !== 0 && C !== 2 || this._windowTitleStack.length && this.setTitle(this._windowTitleStack.pop()),
  6059. C !== 0 && C !== 1 || this._iconNameStack.length && this.setIconName(this._iconNameStack.pop())
  6060. }
  6061. return !0
  6062. }
  6063. saveCursor(p) {
  6064. return this._activeBuffer.savedX = this._activeBuffer.x,
  6065. this._activeBuffer.savedY = this._activeBuffer.ybase + this._activeBuffer.y,
  6066. this._activeBuffer.savedCurAttrData.fg = this._curAttrData.fg,
  6067. this._activeBuffer.savedCurAttrData.bg = this._curAttrData.bg,
  6068. this._activeBuffer.savedCharset = this._charsetService.charset,
  6069. !0
  6070. }
  6071. restoreCursor(p) {
  6072. return this._activeBuffer.x = this._activeBuffer.savedX || 0,
  6073. this._activeBuffer.y = Math.max(this._activeBuffer.savedY - this._activeBuffer.ybase, 0),
  6074. this._curAttrData.fg = this._activeBuffer.savedCurAttrData.fg,
  6075. this._curAttrData.bg = this._activeBuffer.savedCurAttrData.bg,
  6076. this._charsetService.charset = this._savedCharset,
  6077. this._activeBuffer.savedCharset && (this._charsetService.charset = this._activeBuffer.savedCharset),
  6078. this._restrictCursor(),
  6079. !0
  6080. }
  6081. setTitle(p) {
  6082. return this._windowTitle = p,
  6083. this._onTitleChange.fire(p),
  6084. !0
  6085. }
  6086. setIconName(p) {
  6087. return this._iconName = p,
  6088. !0
  6089. }
  6090. setOrReportIndexedColor(p) {
  6091. const C = []
  6092. , b = p.split(";");
  6093. for (; b.length > 1;) {
  6094. const E = b.shift()
  6095. , A = b.shift();
  6096. if (/^\d+$/.exec(E)) {
  6097. const H = parseInt(E);
  6098. if (0 <= H && H < 256)
  6099. if (A === "?")
  6100. C.push({
  6101. type: 0,
  6102. index: H
  6103. });
  6104. else {
  6105. const j = (0,
  6106. v.parseColor)(A);
  6107. j && C.push({
  6108. type: 1,
  6109. index: H,
  6110. color: j
  6111. })
  6112. }
  6113. }
  6114. }
  6115. return C.length && this._onColor.fire(C),
  6116. !0
  6117. }
  6118. setHyperlink(p) {
  6119. const C = p.split(";");
  6120. return !(C.length < 2) && (C[1] ? this._createHyperlink(C[0], C[1]) : !C[0] && this._finishHyperlink())
  6121. }
  6122. _createHyperlink(p, C) {
  6123. this._currentLinkId !== void 0 && this._finishHyperlink();
  6124. const b = p.split(":");
  6125. let E;
  6126. const A = b.findIndex(H => H.startsWith("id="));
  6127. return A !== -1 && (E = b[A].slice(3) || void 0),
  6128. this._curAttrData.extended = this._curAttrData.extended.clone(),
  6129. this._currentLinkId = this._oscLinkService.registerLink({
  6130. id: E,
  6131. uri: C
  6132. }),
  6133. this._curAttrData.extended.urlId = this._currentLinkId,
  6134. this._curAttrData.updateExtended(),
  6135. !0
  6136. }
  6137. _finishHyperlink() {
  6138. return this._curAttrData.extended = this._curAttrData.extended.clone(),
  6139. this._curAttrData.extended.urlId = 0,
  6140. this._curAttrData.updateExtended(),
  6141. this._currentLinkId = void 0,
  6142. !0
  6143. }
  6144. _setOrReportSpecialColor(p, C) {
  6145. const b = p.split(";");
  6146. for (let E = 0; E < b.length && !(C >= this._specialColors.length); ++E,
  6147. ++C)
  6148. if (b[E] === "?")
  6149. this._onColor.fire([{
  6150. type: 0,
  6151. index: this._specialColors[C]
  6152. }]);
  6153. else {
  6154. const A = (0,
  6155. v.parseColor)(b[E]);
  6156. A && this._onColor.fire([{
  6157. type: 1,
  6158. index: this._specialColors[C],
  6159. color: A
  6160. }])
  6161. }
  6162. return !0
  6163. }
  6164. setOrReportFgColor(p) {
  6165. return this._setOrReportSpecialColor(p, 0)
  6166. }
  6167. setOrReportBgColor(p) {
  6168. return this._setOrReportSpecialColor(p, 1)
  6169. }
  6170. setOrReportCursorColor(p) {
  6171. return this._setOrReportSpecialColor(p, 2)
  6172. }
  6173. restoreIndexedColor(p) {
  6174. if (!p)
  6175. return this._onColor.fire([{
  6176. type: 2
  6177. }]),
  6178. !0;
  6179. const C = []
  6180. , b = p.split(";");
  6181. for (let E = 0; E < b.length; ++E)
  6182. if (/^\d+$/.exec(b[E])) {
  6183. const A = parseInt(b[E]);
  6184. 0 <= A && A < 256 && C.push({
  6185. type: 2,
  6186. index: A
  6187. })
  6188. }
  6189. return C.length && this._onColor.fire(C),
  6190. !0
  6191. }
  6192. restoreFgColor(p) {
  6193. return this._onColor.fire([{
  6194. type: 2,
  6195. index: 256
  6196. }]),
  6197. !0
  6198. }
  6199. restoreBgColor(p) {
  6200. return this._onColor.fire([{
  6201. type: 2,
  6202. index: 257
  6203. }]),
  6204. !0
  6205. }
  6206. restoreCursorColor(p) {
  6207. return this._onColor.fire([{
  6208. type: 2,
  6209. index: 258
  6210. }]),
  6211. !0
  6212. }
  6213. nextLine() {
  6214. return this._activeBuffer.x = 0,
  6215. this.index(),
  6216. !0
  6217. }
  6218. keypadApplicationMode() {
  6219. return this._logService.debug("Serial port requested application keypad."),
  6220. this._coreService.decPrivateModes.applicationKeypad = !0,
  6221. this._onRequestSyncScrollBar.fire(),
  6222. !0
  6223. }
  6224. keypadNumericMode() {
  6225. return this._logService.debug("Switching back to normal keypad."),
  6226. this._coreService.decPrivateModes.applicationKeypad = !1,
  6227. this._onRequestSyncScrollBar.fire(),
  6228. !0
  6229. }
  6230. selectDefaultCharset() {
  6231. return this._charsetService.setgLevel(0),
  6232. this._charsetService.setgCharset(0, _.DEFAULT_CHARSET),
  6233. !0
  6234. }
  6235. selectCharset(p) {
  6236. return p.length !== 2 ? (this.selectDefaultCharset(),
  6237. !0) : (p[0] === "/" || this._charsetService.setgCharset(S[p[0]], _.CHARSETS[p[1]] || _.DEFAULT_CHARSET),
  6238. !0)
  6239. }
  6240. index() {
  6241. return this._restrictCursor(),
  6242. this._activeBuffer.y++,
  6243. this._activeBuffer.y === this._activeBuffer.scrollBottom + 1 ? (this._activeBuffer.y--,
  6244. this._bufferService.scroll(this._eraseAttrData())) : this._activeBuffer.y >= this._bufferService.rows && (this._activeBuffer.y = this._bufferService.rows - 1),
  6245. this._restrictCursor(),
  6246. !0
  6247. }
  6248. tabSet() {
  6249. return this._activeBuffer.tabs[this._activeBuffer.x] = !0,
  6250. !0
  6251. }
  6252. reverseIndex() {
  6253. if (this._restrictCursor(),
  6254. this._activeBuffer.y === this._activeBuffer.scrollTop) {
  6255. const p = this._activeBuffer.scrollBottom - this._activeBuffer.scrollTop;
  6256. this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase + this._activeBuffer.y, p, 1),
  6257. this._activeBuffer.lines.set(this._activeBuffer.ybase + this._activeBuffer.y, this._activeBuffer.getBlankLine(this._eraseAttrData())),
  6258. this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom)
  6259. } else
  6260. this._activeBuffer.y--,
  6261. this._restrictCursor();
  6262. return !0
  6263. }
  6264. fullReset() {
  6265. return this._parser.reset(),
  6266. this._onRequestReset.fire(),
  6267. !0
  6268. }
  6269. reset() {
  6270. this._curAttrData = l.DEFAULT_ATTR_DATA.clone(),
  6271. this._eraseAttrDataInternal = l.DEFAULT_ATTR_DATA.clone()
  6272. }
  6273. _eraseAttrData() {
  6274. return this._eraseAttrDataInternal.bg &= -67108864,
  6275. this._eraseAttrDataInternal.bg |= 67108863 & this._curAttrData.bg,
  6276. this._eraseAttrDataInternal
  6277. }
  6278. setgLevel(p) {
  6279. return this._charsetService.setgLevel(p),
  6280. !0
  6281. }
  6282. screenAlignmentPattern() {
  6283. const p = new s.CellData;
  6284. p.content = 4194304 | "E".charCodeAt(0),
  6285. p.fg = this._curAttrData.fg,
  6286. p.bg = this._curAttrData.bg,
  6287. this._setCursor(0, 0);
  6288. for (let C = 0; C < this._bufferService.rows; ++C) {
  6289. const b = this._activeBuffer.ybase + this._activeBuffer.y + C
  6290. , E = this._activeBuffer.lines.get(b);
  6291. E && (E.fill(p),
  6292. E.isWrapped = !1)
  6293. }
  6294. return this._dirtyRowService.markAllDirty(),
  6295. this._setCursor(0, 0),
  6296. !0
  6297. }
  6298. requestStatusString(p, C) {
  6299. const b = this._bufferService.buffer
  6300. , E = this._optionsService.rawOptions;
  6301. return (A => (this._coreService.triggerDataEvent(`${n.C0.ESC}${A}${n.C0.ESC}\\`),
  6302. !0))(p === '"q' ? `P1$r${this._curAttrData.isProtected() ? 1 : 0}"q` : p === '"p' ? 'P1$r61;1"p' : p === "r" ? `P1$r${b.scrollTop + 1};${b.scrollBottom + 1}r` : p === "m" ? "P1$r0m" : p === " q" ? `P1$r${{
  6303. block: 2,
  6304. underline: 4,
  6305. bar: 6
  6306. }[E.cursorStyle] - (E.cursorBlink ? 1 : 0)} q` : "P0$r")
  6307. }
  6308. }
  6309. r.InputHandler = R
  6310. }
  6311. ,
  6312. 844: (x, r) => {
  6313. function a(n) {
  6314. for (const _ of n)
  6315. _.dispose();
  6316. n.length = 0
  6317. }
  6318. Object.defineProperty(r, "__esModule", {
  6319. value: !0
  6320. }),
  6321. r.getDisposeArrayDisposable = r.disposeArray = r.toDisposable = r.Disposable = void 0,
  6322. r.Disposable = class {
  6323. constructor() {
  6324. this._disposables = [],
  6325. this._isDisposed = !1
  6326. }
  6327. dispose() {
  6328. this._isDisposed = !0;
  6329. for (const n of this._disposables)
  6330. n.dispose();
  6331. this._disposables.length = 0
  6332. }
  6333. register(n) {
  6334. return this._disposables.push(n),
  6335. n
  6336. }
  6337. unregister(n) {
  6338. const _ = this._disposables.indexOf(n);
  6339. _ !== -1 && this._disposables.splice(_, 1)
  6340. }
  6341. }
  6342. ,
  6343. r.toDisposable = function (n) {
  6344. return {
  6345. dispose: n
  6346. }
  6347. }
  6348. ,
  6349. r.disposeArray = a,
  6350. r.getDisposeArrayDisposable = function (n) {
  6351. return {
  6352. dispose: () => a(n)
  6353. }
  6354. }
  6355. }
  6356. ,
  6357. 1505: (x, r) => {
  6358. Object.defineProperty(r, "__esModule", {
  6359. value: !0
  6360. }),
  6361. r.FourKeyMap = r.TwoKeyMap = void 0;
  6362. class a {
  6363. constructor() {
  6364. this._data = {}
  6365. }
  6366. set(_, h, f) {
  6367. this._data[_] || (this._data[_] = {}),
  6368. this._data[_][h] = f
  6369. }
  6370. get(_, h) {
  6371. return this._data[_] ? this._data[_][h] : void 0
  6372. }
  6373. clear() {
  6374. this._data = {}
  6375. }
  6376. }
  6377. r.TwoKeyMap = a,
  6378. r.FourKeyMap = class {
  6379. constructor() {
  6380. this._data = new a
  6381. }
  6382. set(n, _, h, f, d) {
  6383. this._data.get(n, _) || this._data.set(n, _, new a),
  6384. this._data.get(n, _).set(h, f, d)
  6385. }
  6386. get(n, _, h, f) {
  6387. var d;
  6388. return (d = this._data.get(n, _)) === null || d === void 0 ? void 0 : d.get(h, f)
  6389. }
  6390. clear() {
  6391. this._data.clear()
  6392. }
  6393. }
  6394. }
  6395. ,
  6396. 6114: (x, r) => {
  6397. Object.defineProperty(r, "__esModule", {
  6398. value: !0
  6399. }),
  6400. r.isLinux = r.isWindows = r.isIphone = r.isIpad = r.isMac = r.isSafari = r.isLegacyEdge = r.isFirefox = void 0;
  6401. const a = typeof navigator > "u"
  6402. , n = a ? "node" : navigator.userAgent
  6403. , _ = a ? "node" : navigator.platform;
  6404. r.isFirefox = n.includes("Firefox"),
  6405. r.isLegacyEdge = n.includes("Edge"),
  6406. r.isSafari = /^((?!chrome|android).)*safari/i.test(n),
  6407. r.isMac = ["Macintosh", "MacIntel", "MacPPC", "Mac68K"].includes(_),
  6408. r.isIpad = _ === "iPad",
  6409. r.isIphone = _ === "iPhone",
  6410. r.isWindows = ["Windows", "Win16", "Win32", "WinCE"].includes(_),
  6411. r.isLinux = _.indexOf("Linux") >= 0
  6412. }
  6413. ,
  6414. 6106: (x, r) => {
  6415. Object.defineProperty(r, "__esModule", {
  6416. value: !0
  6417. }),
  6418. r.SortedList = void 0;
  6419. let a = 0;
  6420. r.SortedList = class {
  6421. constructor(n) {
  6422. this._getKey = n,
  6423. this._array = []
  6424. }
  6425. clear() {
  6426. this._array.length = 0
  6427. }
  6428. insert(n) {
  6429. this._array.length !== 0 ? (a = this._search(this._getKey(n), 0, this._array.length - 1),
  6430. this._array.splice(a, 0, n)) : this._array.push(n)
  6431. }
  6432. delete(n) {
  6433. if (this._array.length === 0)
  6434. return !1;
  6435. const _ = this._getKey(n);
  6436. if (_ === void 0 || (a = this._search(_, 0, this._array.length - 1),
  6437. a === -1) || this._getKey(this._array[a]) !== _)
  6438. return !1;
  6439. do
  6440. if (this._array[a] === n)
  6441. return this._array.splice(a, 1),
  6442. !0;
  6443. while (++a < this._array.length && this._getKey(this._array[a]) === _);
  6444. return !1
  6445. }
  6446. *getKeyIterator(n) {
  6447. if (this._array.length !== 0 && (a = this._search(n, 0, this._array.length - 1),
  6448. !(a < 0 || a >= this._array.length) && this._getKey(this._array[a]) === n))
  6449. do
  6450. yield this._array[a];
  6451. while (++a < this._array.length && this._getKey(this._array[a]) === n)
  6452. }
  6453. forEachByKey(n, _) {
  6454. if (this._array.length !== 0 && (a = this._search(n, 0, this._array.length - 1),
  6455. !(a < 0 || a >= this._array.length) && this._getKey(this._array[a]) === n))
  6456. do
  6457. _(this._array[a]);
  6458. while (++a < this._array.length && this._getKey(this._array[a]) === n)
  6459. }
  6460. values() {
  6461. return this._array.values()
  6462. }
  6463. _search(n, _, h) {
  6464. if (h < _)
  6465. return _;
  6466. let f = Math.floor((_ + h) / 2);
  6467. const d = this._getKey(this._array[f]);
  6468. if (d > n)
  6469. return this._search(n, _, f - 1);
  6470. if (d < n)
  6471. return this._search(n, f + 1, h);
  6472. for (; f > 0 && this._getKey(this._array[f - 1]) === n;)
  6473. f--;
  6474. return f
  6475. }
  6476. }
  6477. }
  6478. ,
  6479. 8273: (x, r) => {
  6480. function a(n, _, h = 0, f = n.length) {
  6481. if (h >= n.length)
  6482. return n;
  6483. h = (n.length + h) % n.length,
  6484. f = f >= n.length ? n.length : (n.length + f) % n.length;
  6485. for (let d = h; d < f; ++d)
  6486. n[d] = _;
  6487. return n
  6488. }
  6489. Object.defineProperty(r, "__esModule", {
  6490. value: !0
  6491. }),
  6492. r.concat = r.fillFallback = r.fill = void 0,
  6493. r.fill = function (n, _, h, f) {
  6494. return n.fill ? n.fill(_, h, f) : a(n, _, h, f)
  6495. }
  6496. ,
  6497. r.fillFallback = a,
  6498. r.concat = function (n, _) {
  6499. const h = new n.constructor(n.length + _.length);
  6500. return h.set(n),
  6501. h.set(_, n.length),
  6502. h
  6503. }
  6504. }
  6505. ,
  6506. 9282: (x, r, a) => {
  6507. Object.defineProperty(r, "__esModule", {
  6508. value: !0
  6509. }),
  6510. r.updateWindowsModeWrappedState = void 0;
  6511. const n = a(643);
  6512. r.updateWindowsModeWrappedState = function (_) {
  6513. const h = _.buffer.lines.get(_.buffer.ybase + _.buffer.y - 1)
  6514. , f = h == null ? void 0 : h.get(_.cols - 1)
  6515. , d = _.buffer.lines.get(_.buffer.ybase + _.buffer.y);
  6516. d && f && (d.isWrapped = f[n.CHAR_DATA_CODE_INDEX] !== n.NULL_CELL_CODE && f[n.CHAR_DATA_CODE_INDEX] !== n.WHITESPACE_CELL_CODE)
  6517. }
  6518. }
  6519. ,
  6520. 3734: (x, r) => {
  6521. Object.defineProperty(r, "__esModule", {
  6522. value: !0
  6523. }),
  6524. r.ExtendedAttrs = r.AttributeData = void 0;
  6525. class a {
  6526. constructor() {
  6527. this.fg = 0,
  6528. this.bg = 0,
  6529. this.extended = new n
  6530. }
  6531. static toColorRGB(h) {
  6532. return [h >>> 16 & 255, h >>> 8 & 255, 255 & h]
  6533. }
  6534. static fromColorRGB(h) {
  6535. return (255 & h[0]) << 16 | (255 & h[1]) << 8 | 255 & h[2]
  6536. }
  6537. clone() {
  6538. const h = new a;
  6539. return h.fg = this.fg,
  6540. h.bg = this.bg,
  6541. h.extended = this.extended.clone(),
  6542. h
  6543. }
  6544. isInverse() {
  6545. return 67108864 & this.fg
  6546. }
  6547. isBold() {
  6548. return 134217728 & this.fg
  6549. }
  6550. isUnderline() {
  6551. return this.hasExtendedAttrs() && this.extended.underlineStyle !== 0 ? 1 : 268435456 & this.fg
  6552. }
  6553. isBlink() {
  6554. return 536870912 & this.fg
  6555. }
  6556. isInvisible() {
  6557. return 1073741824 & this.fg
  6558. }
  6559. isItalic() {
  6560. return 67108864 & this.bg
  6561. }
  6562. isDim() {
  6563. return 134217728 & this.bg
  6564. }
  6565. isStrikethrough() {
  6566. return 2147483648 & this.fg
  6567. }
  6568. isProtected() {
  6569. return 536870912 & this.bg
  6570. }
  6571. getFgColorMode() {
  6572. return 50331648 & this.fg
  6573. }
  6574. getBgColorMode() {
  6575. return 50331648 & this.bg
  6576. }
  6577. isFgRGB() {
  6578. return (50331648 & this.fg) == 50331648
  6579. }
  6580. isBgRGB() {
  6581. return (50331648 & this.bg) == 50331648
  6582. }
  6583. isFgPalette() {
  6584. return (50331648 & this.fg) == 16777216 || (50331648 & this.fg) == 33554432
  6585. }
  6586. isBgPalette() {
  6587. return (50331648 & this.bg) == 16777216 || (50331648 & this.bg) == 33554432
  6588. }
  6589. isFgDefault() {
  6590. return (50331648 & this.fg) == 0
  6591. }
  6592. isBgDefault() {
  6593. return (50331648 & this.bg) == 0
  6594. }
  6595. isAttributeDefault() {
  6596. return this.fg === 0 && this.bg === 0
  6597. }
  6598. getFgColor() {
  6599. switch (50331648 & this.fg) {
  6600. case 16777216:
  6601. case 33554432:
  6602. return 255 & this.fg;
  6603. case 50331648:
  6604. return 16777215 & this.fg;
  6605. default:
  6606. return -1
  6607. }
  6608. }
  6609. getBgColor() {
  6610. switch (50331648 & this.bg) {
  6611. case 16777216:
  6612. case 33554432:
  6613. return 255 & this.bg;
  6614. case 50331648:
  6615. return 16777215 & this.bg;
  6616. default:
  6617. return -1
  6618. }
  6619. }
  6620. hasExtendedAttrs() {
  6621. return 268435456 & this.bg
  6622. }
  6623. updateExtended() {
  6624. this.extended.isEmpty() ? this.bg &= -268435457 : this.bg |= 268435456
  6625. }
  6626. getUnderlineColor() {
  6627. if (268435456 & this.bg && ~this.extended.underlineColor)
  6628. switch (50331648 & this.extended.underlineColor) {
  6629. case 16777216:
  6630. case 33554432:
  6631. return 255 & this.extended.underlineColor;
  6632. case 50331648:
  6633. return 16777215 & this.extended.underlineColor;
  6634. default:
  6635. return this.getFgColor()
  6636. }
  6637. return this.getFgColor()
  6638. }
  6639. getUnderlineColorMode() {
  6640. return 268435456 & this.bg && ~this.extended.underlineColor ? 50331648 & this.extended.underlineColor : this.getFgColorMode()
  6641. }
  6642. isUnderlineColorRGB() {
  6643. return 268435456 & this.bg && ~this.extended.underlineColor ? (50331648 & this.extended.underlineColor) == 50331648 : this.isFgRGB()
  6644. }
  6645. isUnderlineColorPalette() {
  6646. return 268435456 & this.bg && ~this.extended.underlineColor ? (50331648 & this.extended.underlineColor) == 16777216 || (50331648 & this.extended.underlineColor) == 33554432 : this.isFgPalette()
  6647. }
  6648. isUnderlineColorDefault() {
  6649. return 268435456 & this.bg && ~this.extended.underlineColor ? (50331648 & this.extended.underlineColor) == 0 : this.isFgDefault()
  6650. }
  6651. getUnderlineStyle() {
  6652. return 268435456 & this.fg ? 268435456 & this.bg ? this.extended.underlineStyle : 1 : 0
  6653. }
  6654. }
  6655. r.AttributeData = a;
  6656. class n {
  6657. constructor(h = 0, f = 0) {
  6658. this._ext = 0,
  6659. this._urlId = 0,
  6660. this._ext = h,
  6661. this._urlId = f
  6662. }
  6663. get ext() {
  6664. return this._urlId ? -469762049 & this._ext | this.underlineStyle << 26 : this._ext
  6665. }
  6666. set ext(h) {
  6667. this._ext = h
  6668. }
  6669. get underlineStyle() {
  6670. return this._urlId ? 5 : (469762048 & this._ext) >> 26
  6671. }
  6672. set underlineStyle(h) {
  6673. this._ext &= -469762049,
  6674. this._ext |= h << 26 & 469762048
  6675. }
  6676. get underlineColor() {
  6677. return 67108863 & this._ext
  6678. }
  6679. set underlineColor(h) {
  6680. this._ext &= -67108864,
  6681. this._ext |= 67108863 & h
  6682. }
  6683. get urlId() {
  6684. return this._urlId
  6685. }
  6686. set urlId(h) {
  6687. this._urlId = h
  6688. }
  6689. clone() {
  6690. return new n(this._ext, this._urlId)
  6691. }
  6692. isEmpty() {
  6693. return this.underlineStyle === 0 && this._urlId === 0
  6694. }
  6695. }
  6696. r.ExtendedAttrs = n
  6697. }
  6698. ,
  6699. 9092: (x, r, a) => {
  6700. Object.defineProperty(r, "__esModule", {
  6701. value: !0
  6702. }),
  6703. r.BufferStringIterator = r.Buffer = r.MAX_BUFFER_SIZE = void 0;
  6704. const n = a(6349)
  6705. , _ = a(8437)
  6706. , h = a(511)
  6707. , f = a(643)
  6708. , d = a(4634)
  6709. , l = a(4863)
  6710. , o = a(7116)
  6711. , t = a(3734);
  6712. r.MAX_BUFFER_SIZE = 4294967295,
  6713. r.Buffer = class {
  6714. constructor(e, i, c) {
  6715. this._hasScrollback = e,
  6716. this._optionsService = i,
  6717. this._bufferService = c,
  6718. this.ydisp = 0,
  6719. this.ybase = 0,
  6720. this.y = 0,
  6721. this.x = 0,
  6722. this.savedY = 0,
  6723. this.savedX = 0,
  6724. this.savedCurAttrData = _.DEFAULT_ATTR_DATA.clone(),
  6725. this.savedCharset = o.DEFAULT_CHARSET,
  6726. this.markers = [],
  6727. this._nullCell = h.CellData.fromCharData([0, f.NULL_CELL_CHAR, f.NULL_CELL_WIDTH, f.NULL_CELL_CODE]),
  6728. this._whitespaceCell = h.CellData.fromCharData([0, f.WHITESPACE_CELL_CHAR, f.WHITESPACE_CELL_WIDTH, f.WHITESPACE_CELL_CODE]),
  6729. this._isClearing = !1,
  6730. this._cols = this._bufferService.cols,
  6731. this._rows = this._bufferService.rows,
  6732. this.lines = new n.CircularList(this._getCorrectBufferLength(this._rows)),
  6733. this.scrollTop = 0,
  6734. this.scrollBottom = this._rows - 1,
  6735. this.setupTabStops()
  6736. }
  6737. getNullCell(e) {
  6738. return e ? (this._nullCell.fg = e.fg,
  6739. this._nullCell.bg = e.bg,
  6740. this._nullCell.extended = e.extended) : (this._nullCell.fg = 0,
  6741. this._nullCell.bg = 0,
  6742. this._nullCell.extended = new t.ExtendedAttrs),
  6743. this._nullCell
  6744. }
  6745. getWhitespaceCell(e) {
  6746. return e ? (this._whitespaceCell.fg = e.fg,
  6747. this._whitespaceCell.bg = e.bg,
  6748. this._whitespaceCell.extended = e.extended) : (this._whitespaceCell.fg = 0,
  6749. this._whitespaceCell.bg = 0,
  6750. this._whitespaceCell.extended = new t.ExtendedAttrs),
  6751. this._whitespaceCell
  6752. }
  6753. getBlankLine(e, i) {
  6754. return new _.BufferLine(this._bufferService.cols, this.getNullCell(e), i)
  6755. }
  6756. get hasScrollback() {
  6757. return this._hasScrollback && this.lines.maxLength > this._rows
  6758. }
  6759. get isCursorInViewport() {
  6760. const e = this.ybase + this.y - this.ydisp;
  6761. return e >= 0 && e < this._rows
  6762. }
  6763. _getCorrectBufferLength(e) {
  6764. if (!this._hasScrollback)
  6765. return e;
  6766. const i = e + this._optionsService.rawOptions.scrollback;
  6767. return i > r.MAX_BUFFER_SIZE ? r.MAX_BUFFER_SIZE : i
  6768. }
  6769. fillViewportRows(e) {
  6770. if (this.lines.length === 0) {
  6771. e === void 0 && (e = _.DEFAULT_ATTR_DATA);
  6772. let i = this._rows;
  6773. for (; i--;)
  6774. this.lines.push(this.getBlankLine(e))
  6775. }
  6776. }
  6777. clear() {
  6778. this.ydisp = 0,
  6779. this.ybase = 0,
  6780. this.y = 0,
  6781. this.x = 0,
  6782. this.lines = new n.CircularList(this._getCorrectBufferLength(this._rows)),
  6783. this.scrollTop = 0,
  6784. this.scrollBottom = this._rows - 1,
  6785. this.setupTabStops()
  6786. }
  6787. resize(e, i) {
  6788. const c = this.getNullCell(_.DEFAULT_ATTR_DATA)
  6789. , g = this._getCorrectBufferLength(i);
  6790. if (g > this.lines.maxLength && (this.lines.maxLength = g),
  6791. this.lines.length > 0) {
  6792. if (this._cols < e)
  6793. for (let S = 0; S < this.lines.length; S++)
  6794. this.lines.get(S).resize(e, c);
  6795. let v = 0;
  6796. if (this._rows < i)
  6797. for (let S = this._rows; S < i; S++)
  6798. this.lines.length < i + this.ybase && (this._optionsService.rawOptions.windowsMode ? this.lines.push(new _.BufferLine(e, c)) : this.ybase > 0 && this.lines.length <= this.ybase + this.y + v + 1 ? (this.ybase--,
  6799. v++,
  6800. this.ydisp > 0 && this.ydisp--) : this.lines.push(new _.BufferLine(e, c)));
  6801. else
  6802. for (let S = this._rows; S > i; S--)
  6803. this.lines.length > i + this.ybase && (this.lines.length > this.ybase + this.y + 1 ? this.lines.pop() : (this.ybase++,
  6804. this.ydisp++));
  6805. if (g < this.lines.maxLength) {
  6806. const S = this.lines.length - g;
  6807. S > 0 && (this.lines.trimStart(S),
  6808. this.ybase = Math.max(this.ybase - S, 0),
  6809. this.ydisp = Math.max(this.ydisp - S, 0),
  6810. this.savedY = Math.max(this.savedY - S, 0)),
  6811. this.lines.maxLength = g
  6812. }
  6813. this.x = Math.min(this.x, e - 1),
  6814. this.y = Math.min(this.y, i - 1),
  6815. v && (this.y += v),
  6816. this.savedX = Math.min(this.savedX, e - 1),
  6817. this.scrollTop = 0
  6818. }
  6819. if (this.scrollBottom = i - 1,
  6820. this._isReflowEnabled && (this._reflow(e, i),
  6821. this._cols > e))
  6822. for (let v = 0; v < this.lines.length; v++)
  6823. this.lines.get(v).resize(e, c);
  6824. this._cols = e,
  6825. this._rows = i
  6826. }
  6827. get _isReflowEnabled() {
  6828. return this._hasScrollback && !this._optionsService.rawOptions.windowsMode
  6829. }
  6830. _reflow(e, i) {
  6831. this._cols !== e && (e > this._cols ? this._reflowLarger(e, i) : this._reflowSmaller(e, i))
  6832. }
  6833. _reflowLarger(e, i) {
  6834. const c = (0,
  6835. d.reflowLargerGetLinesToRemove)(this.lines, this._cols, e, this.ybase + this.y, this.getNullCell(_.DEFAULT_ATTR_DATA));
  6836. if (c.length > 0) {
  6837. const g = (0,
  6838. d.reflowLargerCreateNewLayout)(this.lines, c);
  6839. (0,
  6840. d.reflowLargerApplyNewLayout)(this.lines, g.layout),
  6841. this._reflowLargerAdjustViewport(e, i, g.countRemoved)
  6842. }
  6843. }
  6844. _reflowLargerAdjustViewport(e, i, c) {
  6845. const g = this.getNullCell(_.DEFAULT_ATTR_DATA);
  6846. let v = c;
  6847. for (; v-- > 0;)
  6848. this.ybase === 0 ? (this.y > 0 && this.y--,
  6849. this.lines.length < i && this.lines.push(new _.BufferLine(e, g))) : (this.ydisp === this.ybase && this.ydisp--,
  6850. this.ybase--);
  6851. this.savedY = Math.max(this.savedY - c, 0)
  6852. }
  6853. _reflowSmaller(e, i) {
  6854. const c = this.getNullCell(_.DEFAULT_ATTR_DATA)
  6855. , g = [];
  6856. let v = 0;
  6857. for (let S = this.lines.length - 1; S >= 0; S--) {
  6858. let u = this.lines.get(S);
  6859. if (!u || !u.isWrapped && u.getTrimmedLength() <= e)
  6860. continue;
  6861. const m = [u];
  6862. for (; u.isWrapped && S > 0;)
  6863. u = this.lines.get(--S),
  6864. m.unshift(u);
  6865. const w = this.ybase + this.y;
  6866. if (w >= S && w < S + m.length)
  6867. continue;
  6868. const R = m[m.length - 1].getTrimmedLength()
  6869. , L = (0,
  6870. d.reflowSmallerGetNewLineLengths)(m, this._cols, e)
  6871. , p = L.length - m.length;
  6872. let C;
  6873. C = this.ybase === 0 && this.y !== this.lines.length - 1 ? Math.max(0, this.y - this.lines.maxLength + p) : Math.max(0, this.lines.length - this.lines.maxLength + p);
  6874. const b = [];
  6875. for (let P = 0; P < p; P++) {
  6876. const N = this.getBlankLine(_.DEFAULT_ATTR_DATA, !0);
  6877. b.push(N)
  6878. }
  6879. b.length > 0 && (g.push({
  6880. start: S + m.length + v,
  6881. newLines: b
  6882. }),
  6883. v += b.length),
  6884. m.push(...b);
  6885. let E = L.length - 1
  6886. , A = L[E];
  6887. A === 0 && (E--,
  6888. A = L[E]);
  6889. let H = m.length - p - 1
  6890. , j = R;
  6891. for (; H >= 0;) {
  6892. const P = Math.min(j, A);
  6893. if (m[E] === void 0)
  6894. break;
  6895. if (m[E].copyCellsFrom(m[H], j - P, A - P, P, !0),
  6896. A -= P,
  6897. A === 0 && (E--,
  6898. A = L[E]),
  6899. j -= P,
  6900. j === 0) {
  6901. H--;
  6902. const N = Math.max(H, 0);
  6903. j = (0,
  6904. d.getWrappedLineTrimmedLength)(m, N, this._cols)
  6905. }
  6906. }
  6907. for (let P = 0; P < m.length; P++)
  6908. L[P] < e && m[P].setCell(L[P], c);
  6909. let$ = p - C;
  6910. for (; $-- > 0;)
  6911. this.ybase === 0 ? this.y < i - 1 ? (this.y++,
  6912. this.lines.pop()) : (this.ybase++,
  6913. this.ydisp++) : this.ybase < Math.min(this.lines.maxLength, this.lines.length + v) - i && (this.ybase === this.ydisp && this.ydisp++,
  6914. this.ybase++);
  6915. this.savedY = Math.min(this.savedY + p, this.ybase + i - 1)
  6916. }
  6917. if (g.length > 0) {
  6918. const S = []
  6919. , u = [];
  6920. for (let E = 0; E < this.lines.length; E++)
  6921. u.push(this.lines.get(E));
  6922. const m = this.lines.length;
  6923. let w = m - 1
  6924. , R = 0
  6925. , L = g[R];
  6926. this.lines.length = Math.min(this.lines.maxLength, this.lines.length + v);
  6927. let p = 0;
  6928. for (let E = Math.min(this.lines.maxLength - 1, m + v - 1); E >= 0; E--)
  6929. if (L && L.start > w + p) {
  6930. for (let A = L.newLines.length - 1; A >= 0; A--)
  6931. this.lines.set(E--, L.newLines[A]);
  6932. E++,
  6933. S.push({
  6934. index: w + 1,
  6935. amount: L.newLines.length
  6936. }),
  6937. p += L.newLines.length,
  6938. L = g[++R]
  6939. } else
  6940. this.lines.set(E, u[w--]);
  6941. let C = 0;
  6942. for (let E = S.length - 1; E >= 0; E--)
  6943. S[E].index += C,
  6944. this.lines.onInsertEmitter.fire(S[E]),
  6945. C += S[E].amount;
  6946. const b = Math.max(0, m + v - this.lines.maxLength);
  6947. b > 0 && this.lines.onTrimEmitter.fire(b)
  6948. }
  6949. }
  6950. stringIndexToBufferIndex(e, i, c = !1) {
  6951. for (; i;) {
  6952. const g = this.lines.get(e);
  6953. if (!g)
  6954. return [-1, -1];
  6955. const v = c ? g.getTrimmedLength() : g.length;
  6956. for (let S = 0; S < v; ++S)
  6957. if (g.get(S)[f.CHAR_DATA_WIDTH_INDEX] && (i -= g.get(S)[f.CHAR_DATA_CHAR_INDEX].length || 1),
  6958. i < 0)
  6959. return [e, S];
  6960. e++
  6961. }
  6962. return [e, 0]
  6963. }
  6964. translateBufferLineToString(e, i, c = 0, g) {
  6965. const v = this.lines.get(e);
  6966. return v ? v.translateToString(i, c, g) : ""
  6967. }
  6968. getWrappedRangeForLine(e) {
  6969. let i = e
  6970. , c = e;
  6971. for (; i > 0 && this.lines.get(i).isWrapped;)
  6972. i--;
  6973. for (; c + 1 < this.lines.length && this.lines.get(c + 1).isWrapped;)
  6974. c++;
  6975. return {
  6976. first: i,
  6977. last: c
  6978. }
  6979. }
  6980. setupTabStops(e) {
  6981. for (e != null ? this.tabs[e] || (e = this.prevStop(e)) : (this.tabs = {},
  6982. e = 0); e < this._cols; e += this._optionsService.rawOptions.tabStopWidth)
  6983. this.tabs[e] = !0
  6984. }
  6985. prevStop(e) {
  6986. for (e == null && (e = this.x); !this.tabs[--e] && e > 0;)
  6987. ;
  6988. return e >= this._cols ? this._cols - 1 : e < 0 ? 0 : e
  6989. }
  6990. nextStop(e) {
  6991. for (e == null && (e = this.x); !this.tabs[++e] && e < this._cols;)
  6992. ;
  6993. return e >= this._cols ? this._cols - 1 : e < 0 ? 0 : e
  6994. }
  6995. clearMarkers(e) {
  6996. this._isClearing = !0;
  6997. for (let i = 0; i < this.markers.length; i++)
  6998. this.markers[i].line === e && (this.markers[i].dispose(),
  6999. this.markers.splice(i--, 1));
  7000. this._isClearing = !1
  7001. }
  7002. clearAllMarkers() {
  7003. this._isClearing = !0;
  7004. for (let e = 0; e < this.markers.length; e++)
  7005. this.markers[e].dispose(),
  7006. this.markers.splice(e--, 1);
  7007. this._isClearing = !1
  7008. }
  7009. addMarker(e) {
  7010. const i = new l.Marker(e);
  7011. return this.markers.push(i),
  7012. i.register(this.lines.onTrim(c => {
  7013. i.line -= c,
  7014. i.line < 0 && i.dispose()
  7015. }
  7016. )),
  7017. i.register(this.lines.onInsert(c => {
  7018. i.line >= c.index && (i.line += c.amount)
  7019. }
  7020. )),
  7021. i.register(this.lines.onDelete(c => {
  7022. i.line >= c.index && i.line < c.index + c.amount && i.dispose(),
  7023. i.line > c.index && (i.line -= c.amount)
  7024. }
  7025. )),
  7026. i.register(i.onDispose(() => this._removeMarker(i))),
  7027. i
  7028. }
  7029. _removeMarker(e) {
  7030. this._isClearing || this.markers.splice(this.markers.indexOf(e), 1)
  7031. }
  7032. iterator(e, i, c, g, v) {
  7033. return new s(this, e, i, c, g, v)
  7034. }
  7035. }
  7036. ;
  7037. class s {
  7038. constructor(i, c, g = 0, v = i.lines.length, S = 0, u = 0) {
  7039. this._buffer = i,
  7040. this._trimRight = c,
  7041. this._startIndex = g,
  7042. this._endIndex = v,
  7043. this._startOverscan = S,
  7044. this._endOverscan = u,
  7045. this._startIndex < 0 && (this._startIndex = 0),
  7046. this._endIndex > this._buffer.lines.length && (this._endIndex = this._buffer.lines.length),
  7047. this._current = this._startIndex
  7048. }
  7049. hasNext() {
  7050. return this._current < this._endIndex
  7051. }
  7052. next() {
  7053. const i = this._buffer.getWrappedRangeForLine(this._current);
  7054. i.first < this._startIndex - this._startOverscan && (i.first = this._startIndex - this._startOverscan),
  7055. i.last > this._endIndex + this._endOverscan && (i.last = this._endIndex + this._endOverscan),
  7056. i.first = Math.max(i.first, 0),
  7057. i.last = Math.min(i.last, this._buffer.lines.length);
  7058. let c = "";
  7059. for (let g = i.first; g <= i.last; ++g)
  7060. c += this._buffer.translateBufferLineToString(g, this._trimRight);
  7061. return this._current = i.last + 1,
  7062. {
  7063. range: i,
  7064. content: c
  7065. }
  7066. }
  7067. }
  7068. r.BufferStringIterator = s
  7069. }
  7070. ,
  7071. 8437: (x, r, a) => {
  7072. Object.defineProperty(r, "__esModule", {
  7073. value: !0
  7074. }),
  7075. r.BufferLine = r.DEFAULT_ATTR_DATA = void 0;
  7076. const n = a(482)
  7077. , _ = a(643)
  7078. , h = a(511)
  7079. , f = a(3734);
  7080. r.DEFAULT_ATTR_DATA = Object.freeze(new f.AttributeData);
  7081. const d = {
  7082. startIndex: 0
  7083. };
  7084. class l {
  7085. constructor(t, s, e = !1) {
  7086. this.isWrapped = e,
  7087. this._combined = {},
  7088. this._extendedAttrs = {},
  7089. this._data = new Uint32Array(3 * t);
  7090. const i = s || h.CellData.fromCharData([0, _.NULL_CELL_CHAR, _.NULL_CELL_WIDTH, _.NULL_CELL_CODE]);
  7091. for (let c = 0; c < t; ++c)
  7092. this.setCell(c, i);
  7093. this.length = t
  7094. }
  7095. get(t) {
  7096. const s = this._data[3 * t + 0]
  7097. , e = 2097151 & s;
  7098. return [this._data[3 * t + 1], 2097152 & s ? this._combined[t] : e ? (0,
  7099. n.stringFromCodePoint)(e) : "", s >> 22, 2097152 & s ? this._combined[t].charCodeAt(this._combined[t].length - 1) : e]
  7100. }
  7101. set(t, s) {
  7102. this._data[3 * t + 1] = s[_.CHAR_DATA_ATTR_INDEX],
  7103. s[_.CHAR_DATA_CHAR_INDEX].length > 1 ? (this._combined[t] = s[1],
  7104. this._data[3 * t + 0] = 2097152 | t | s[_.CHAR_DATA_WIDTH_INDEX] << 22) : this._data[3 * t + 0] = s[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | s[_.CHAR_DATA_WIDTH_INDEX] << 22
  7105. }
  7106. getWidth(t) {
  7107. return this._data[3 * t + 0] >> 22
  7108. }
  7109. hasWidth(t) {
  7110. return 12582912 & this._data[3 * t + 0]
  7111. }
  7112. getFg(t) {
  7113. return this._data[3 * t + 1]
  7114. }
  7115. getBg(t) {
  7116. return this._data[3 * t + 2]
  7117. }
  7118. hasContent(t) {
  7119. return 4194303 & this._data[3 * t + 0]
  7120. }
  7121. getCodePoint(t) {
  7122. const s = this._data[3 * t + 0];
  7123. return 2097152 & s ? this._combined[t].charCodeAt(this._combined[t].length - 1) : 2097151 & s
  7124. }
  7125. isCombined(t) {
  7126. return 2097152 & this._data[3 * t + 0]
  7127. }
  7128. getString(t) {
  7129. const s = this._data[3 * t + 0];
  7130. return 2097152 & s ? this._combined[t] : 2097151 & s ? (0,
  7131. n.stringFromCodePoint)(2097151 & s) : ""
  7132. }
  7133. isProtected(t) {
  7134. return 536870912 & this._data[3 * t + 2]
  7135. }
  7136. loadCell(t, s) {
  7137. return d.startIndex = 3 * t,
  7138. s.content = this._data[d.startIndex + 0],
  7139. s.fg = this._data[d.startIndex + 1],
  7140. s.bg = this._data[d.startIndex + 2],
  7141. 2097152 & s.content && (s.combinedData = this._combined[t]),
  7142. 268435456 & s.bg && (s.extended = this._extendedAttrs[t]),
  7143. s
  7144. }
  7145. setCell(t, s) {
  7146. 2097152 & s.content && (this._combined[t] = s.combinedData),
  7147. 268435456 & s.bg && (this._extendedAttrs[t] = s.extended),
  7148. this._data[3 * t + 0] = s.content,
  7149. this._data[3 * t + 1] = s.fg,
  7150. this._data[3 * t + 2] = s.bg
  7151. }
  7152. setCellFromCodePoint(t, s, e, i, c, g) {
  7153. 268435456 & c && (this._extendedAttrs[t] = g),
  7154. this._data[3 * t + 0] = s | e << 22,
  7155. this._data[3 * t + 1] = i,
  7156. this._data[3 * t + 2] = c
  7157. }
  7158. addCodepointToCell(t, s) {
  7159. let e = this._data[3 * t + 0];
  7160. 2097152 & e ? this._combined[t] += (0,
  7161. n.stringFromCodePoint)(s) : (2097151 & e ? (this._combined[t] = (0,
  7162. n.stringFromCodePoint)(2097151 & e) + (0,
  7163. n.stringFromCodePoint)(s),
  7164. e &= -2097152,
  7165. e |= 2097152) : e = s | 4194304,
  7166. this._data[3 * t + 0] = e)
  7167. }
  7168. insertCells(t, s, e, i) {
  7169. if ((t %= this.length) && this.getWidth(t - 1) === 2 && this.setCellFromCodePoint(t - 1, 0, 1, (i == null ? void 0 : i.fg) || 0, (i == null ? void 0 : i.bg) || 0, (i == null ? void 0 : i.extended) || new f.ExtendedAttrs),
  7170. s < this.length - t) {
  7171. const c = new h.CellData;
  7172. for (let g = this.length - t - s - 1; g >= 0; --g)
  7173. this.setCell(t + s + g, this.loadCell(t + g, c));
  7174. for (let g = 0; g < s; ++g)
  7175. this.setCell(t + g, e)
  7176. } else
  7177. for (let c = t; c < this.length; ++c)
  7178. this.setCell(c, e);
  7179. this.getWidth(this.length - 1) === 2 && this.setCellFromCodePoint(this.length - 1, 0, 1, (i == null ? void 0 : i.fg) || 0, (i == null ? void 0 : i.bg) || 0, (i == null ? void 0 : i.extended) || new f.ExtendedAttrs)
  7180. }
  7181. deleteCells(t, s, e, i) {
  7182. if (t %= this.length,
  7183. s < this.length - t) {
  7184. const c = new h.CellData;
  7185. for (let g = 0; g < this.length - t - s; ++g)
  7186. this.setCell(t + g, this.loadCell(t + s + g, c));
  7187. for (let g = this.length - s; g < this.length; ++g)
  7188. this.setCell(g, e)
  7189. } else
  7190. for (let c = t; c < this.length; ++c)
  7191. this.setCell(c, e);
  7192. t && this.getWidth(t - 1) === 2 && this.setCellFromCodePoint(t - 1, 0, 1, (i == null ? void 0 : i.fg) || 0, (i == null ? void 0 : i.bg) || 0, (i == null ? void 0 : i.extended) || new f.ExtendedAttrs),
  7193. this.getWidth(t) !== 0 || this.hasContent(t) || this.setCellFromCodePoint(t, 0, 1, (i == null ? void 0 : i.fg) || 0, (i == null ? void 0 : i.bg) || 0, (i == null ? void 0 : i.extended) || new f.ExtendedAttrs)
  7194. }
  7195. replaceCells(t, s, e, i, c = !1) {
  7196. if (c)
  7197. for (t && this.getWidth(t - 1) === 2 && !this.isProtected(t - 1) && this.setCellFromCodePoint(t - 1, 0, 1, (i == null ? void 0 : i.fg) || 0, (i == null ? void 0 : i.bg) || 0, (i == null ? void 0 : i.extended) || new f.ExtendedAttrs),
  7198. s < this.length && this.getWidth(s - 1) === 2 && !this.isProtected(s) && this.setCellFromCodePoint(s, 0, 1, (i == null ? void 0 : i.fg) || 0, (i == null ? void 0 : i.bg) || 0, (i == null ? void 0 : i.extended) || new f.ExtendedAttrs); t < s && t < this.length;)
  7199. this.isProtected(t) || this.setCell(t, e),
  7200. t++;
  7201. else
  7202. for (t && this.getWidth(t - 1) === 2 && this.setCellFromCodePoint(t - 1, 0, 1, (i == null ? void 0 : i.fg) || 0, (i == null ? void 0 : i.bg) || 0, (i == null ? void 0 : i.extended) || new f.ExtendedAttrs),
  7203. s < this.length && this.getWidth(s - 1) === 2 && this.setCellFromCodePoint(s, 0, 1, (i == null ? void 0 : i.fg) || 0, (i == null ? void 0 : i.bg) || 0, (i == null ? void 0 : i.extended) || new f.ExtendedAttrs); t < s && t < this.length;)
  7204. this.setCell(t++, e)
  7205. }
  7206. resize(t, s) {
  7207. if (t !== this.length) {
  7208. if (t > this.length) {
  7209. const e = new Uint32Array(3 * t);
  7210. this.length && (3 * t < this._data.length ? e.set(this._data.subarray(0, 3 * t)) : e.set(this._data)),
  7211. this._data = e;
  7212. for (let i = this.length; i < t; ++i)
  7213. this.setCell(i, s)
  7214. } else if (t) {
  7215. const e = new Uint32Array(3 * t);
  7216. e.set(this._data.subarray(0, 3 * t)),
  7217. this._data = e;
  7218. const i = Object.keys(this._combined);
  7219. for (let c = 0; c < i.length; c++) {
  7220. const g = parseInt(i[c], 10);
  7221. g >= t && delete this._combined[g]
  7222. }
  7223. } else
  7224. this._data = new Uint32Array(0),
  7225. this._combined = {};
  7226. this.length = t
  7227. }
  7228. }
  7229. fill(t, s = !1) {
  7230. if (s)
  7231. for (let e = 0; e < this.length; ++e)
  7232. this.isProtected(e) || this.setCell(e, t);
  7233. else {
  7234. this._combined = {},
  7235. this._extendedAttrs = {};
  7236. for (let e = 0; e < this.length; ++e)
  7237. this.setCell(e, t)
  7238. }
  7239. }
  7240. copyFrom(t) {
  7241. this.length !== t.length ? this._data = new Uint32Array(t._data) : this._data.set(t._data),
  7242. this.length = t.length,
  7243. this._combined = {};
  7244. for (const s in t._combined)
  7245. this._combined[s] = t._combined[s];
  7246. this._extendedAttrs = {};
  7247. for (const s in t._extendedAttrs)
  7248. this._extendedAttrs[s] = t._extendedAttrs[s];
  7249. this.isWrapped = t.isWrapped
  7250. }
  7251. clone() {
  7252. const t = new l(0);
  7253. t._data = new Uint32Array(this._data),
  7254. t.length = this.length;
  7255. for (const s in this._combined)
  7256. t._combined[s] = this._combined[s];
  7257. for (const s in this._extendedAttrs)
  7258. t._extendedAttrs[s] = this._extendedAttrs[s];
  7259. return t.isWrapped = this.isWrapped,
  7260. t
  7261. }
  7262. getTrimmedLength() {
  7263. for (let t = this.length - 1; t >= 0; --t)
  7264. if (4194303 & this._data[3 * t + 0])
  7265. return t + (this._data[3 * t + 0] >> 22);
  7266. return 0
  7267. }
  7268. copyCellsFrom(t, s, e, i, c) {
  7269. const g = t._data;
  7270. if (c)
  7271. for (let S = i - 1; S >= 0; S--) {
  7272. for (let u = 0; u < 3; u++)
  7273. this._data[3 * (e + S) + u] = g[3 * (s + S) + u];
  7274. 268435456 & g[3 * (s + S) + 2] && (this._extendedAttrs[e + S] = t._extendedAttrs[s + S])
  7275. }
  7276. else
  7277. for (let S = 0; S < i; S++) {
  7278. for (let u = 0; u < 3; u++)
  7279. this._data[3 * (e + S) + u] = g[3 * (s + S) + u];
  7280. 268435456 & g[3 * (s + S) + 2] && (this._extendedAttrs[e + S] = t._extendedAttrs[s + S])
  7281. }
  7282. const v = Object.keys(t._combined);
  7283. for (let S = 0; S < v.length; S++) {
  7284. const u = parseInt(v[S], 10);
  7285. u >= s && (this._combined[u - s + e] = t._combined[u])
  7286. }
  7287. }
  7288. translateToString(t = !1, s = 0, e = this.length) {
  7289. t && (e = Math.min(e, this.getTrimmedLength()));
  7290. let i = "";
  7291. for (; s < e;) {
  7292. const c = this._data[3 * s + 0]
  7293. , g = 2097151 & c;
  7294. i += 2097152 & c ? this._combined[s] : g ? (0,
  7295. n.stringFromCodePoint)(g) : _.WHITESPACE_CELL_CHAR,
  7296. s += c >> 22 || 1
  7297. }
  7298. return i
  7299. }
  7300. }
  7301. r.BufferLine = l
  7302. }
  7303. ,
  7304. 4841: (x, r) => {
  7305. Object.defineProperty(r, "__esModule", {
  7306. value: !0
  7307. }),
  7308. r.getRangeLength = void 0,
  7309. r.getRangeLength = function (a, n) {
  7310. if (a.start.y > a.end.y)
  7311. throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);
  7312. return n * (a.end.y - a.start.y) + (a.end.x - a.start.x + 1)
  7313. }
  7314. }
  7315. ,
  7316. 4634: (x, r) => {
  7317. function a(n, _, h) {
  7318. if (_ === n.length - 1)
  7319. return n[_].getTrimmedLength();
  7320. const f = !n[_].hasContent(h - 1) && n[_].getWidth(h - 1) === 1
  7321. , d = n[_ + 1].getWidth(0) === 2;
  7322. return f && d ? h - 1 : h
  7323. }
  7324. Object.defineProperty(r, "__esModule", {
  7325. value: !0
  7326. }),
  7327. r.getWrappedLineTrimmedLength = r.reflowSmallerGetNewLineLengths = r.reflowLargerApplyNewLayout = r.reflowLargerCreateNewLayout = r.reflowLargerGetLinesToRemove = void 0,
  7328. r.reflowLargerGetLinesToRemove = function (n, _, h, f, d) {
  7329. const l = [];
  7330. for (let o = 0; o < n.length - 1; o++) {
  7331. let t = o
  7332. , s = n.get(++t);
  7333. if (!s.isWrapped)
  7334. continue;
  7335. const e = [n.get(o)];
  7336. for (; t < n.length && s.isWrapped;)
  7337. e.push(s),
  7338. s = n.get(++t);
  7339. if (f >= o && f < t) {
  7340. o += e.length - 1;
  7341. continue
  7342. }
  7343. let i = 0
  7344. , c = a(e, i, _)
  7345. , g = 1
  7346. , v = 0;
  7347. for (; g < e.length;) {
  7348. const u = a(e, g, _)
  7349. , m = u - v
  7350. , w = h - c
  7351. , R = Math.min(m, w);
  7352. e[i].copyCellsFrom(e[g], v, c, R, !1),
  7353. c += R,
  7354. c === h && (i++,
  7355. c = 0),
  7356. v += R,
  7357. v === u && (g++,
  7358. v = 0),
  7359. c === 0 && i !== 0 && e[i - 1].getWidth(h - 1) === 2 && (e[i].copyCellsFrom(e[i - 1], h - 1, c++, 1, !1),
  7360. e[i - 1].setCell(h - 1, d))
  7361. }
  7362. e[i].replaceCells(c, h, d);
  7363. let S = 0;
  7364. for (let u = e.length - 1; u > 0 && (u > i || e[u].getTrimmedLength() === 0); u--)
  7365. S++;
  7366. S > 0 && (l.push(o + e.length - S),
  7367. l.push(S)),
  7368. o += e.length - 1
  7369. }
  7370. return l
  7371. }
  7372. ,
  7373. r.reflowLargerCreateNewLayout = function (n, _) {
  7374. const h = [];
  7375. let f = 0
  7376. , d = _[f]
  7377. , l = 0;
  7378. for (let o = 0; o < n.length; o++)
  7379. if (d === o) {
  7380. const t = _[++f];
  7381. n.onDeleteEmitter.fire({
  7382. index: o - l,
  7383. amount: t
  7384. }),
  7385. o += t - 1,
  7386. l += t,
  7387. d = _[++f]
  7388. } else
  7389. h.push(o);
  7390. return {
  7391. layout: h,
  7392. countRemoved: l
  7393. }
  7394. }
  7395. ,
  7396. r.reflowLargerApplyNewLayout = function (n, _) {
  7397. const h = [];
  7398. for (let f = 0; f < _.length; f++)
  7399. h.push(n.get(_[f]));
  7400. for (let f = 0; f < h.length; f++)
  7401. n.set(f, h[f]);
  7402. n.length = _.length
  7403. }
  7404. ,
  7405. r.reflowSmallerGetNewLineLengths = function (n, _, h) {
  7406. const f = []
  7407. , d = n.map((s, e) => a(n, e, _)).reduce((s, e) => s + e);
  7408. let l = 0
  7409. , o = 0
  7410. , t = 0;
  7411. for (; t < d;) {
  7412. if (d - t < h) {
  7413. f.push(d - t);
  7414. break
  7415. }
  7416. l += h;
  7417. const s = a(n, o, _);
  7418. l > s && (l -= s,
  7419. o++);
  7420. const e = n[o].getWidth(l - 1) === 2;
  7421. e && l--;
  7422. const i = e ? h - 1 : h;
  7423. f.push(i),
  7424. t += i
  7425. }
  7426. return f
  7427. }
  7428. ,
  7429. r.getWrappedLineTrimmedLength = a
  7430. }
  7431. ,
  7432. 5295: (x, r, a) => {
  7433. Object.defineProperty(r, "__esModule", {
  7434. value: !0
  7435. }),
  7436. r.BufferSet = void 0;
  7437. const n = a(9092)
  7438. , _ = a(8460)
  7439. , h = a(844);
  7440. class f extends h.Disposable {
  7441. constructor(l, o) {
  7442. super(),
  7443. this._optionsService = l,
  7444. this._bufferService = o,
  7445. this._onBufferActivate = this.register(new _.EventEmitter),
  7446. this.reset()
  7447. }
  7448. get onBufferActivate() {
  7449. return this._onBufferActivate.event
  7450. }
  7451. reset() {
  7452. this._normal = new n.Buffer(!0, this._optionsService, this._bufferService),
  7453. this._normal.fillViewportRows(),
  7454. this._alt = new n.Buffer(!1, this._optionsService, this._bufferService),
  7455. this._activeBuffer = this._normal,
  7456. this._onBufferActivate.fire({
  7457. activeBuffer: this._normal,
  7458. inactiveBuffer: this._alt
  7459. }),
  7460. this.setupTabStops()
  7461. }
  7462. get alt() {
  7463. return this._alt
  7464. }
  7465. get active() {
  7466. return this._activeBuffer
  7467. }
  7468. get normal() {
  7469. return this._normal
  7470. }
  7471. activateNormalBuffer() {
  7472. this._activeBuffer !== this._normal && (this._normal.x = this._alt.x,
  7473. this._normal.y = this._alt.y,
  7474. this._alt.clearAllMarkers(),
  7475. this._alt.clear(),
  7476. this._activeBuffer = this._normal,
  7477. this._onBufferActivate.fire({
  7478. activeBuffer: this._normal,
  7479. inactiveBuffer: this._alt
  7480. }))
  7481. }
  7482. activateAltBuffer(l) {
  7483. this._activeBuffer !== this._alt && (this._alt.fillViewportRows(l),
  7484. this._alt.x = this._normal.x,
  7485. this._alt.y = this._normal.y,
  7486. this._activeBuffer = this._alt,
  7487. this._onBufferActivate.fire({
  7488. activeBuffer: this._alt,
  7489. inactiveBuffer: this._normal
  7490. }))
  7491. }
  7492. resize(l, o) {
  7493. this._normal.resize(l, o),
  7494. this._alt.resize(l, o)
  7495. }
  7496. setupTabStops(l) {
  7497. this._normal.setupTabStops(l),
  7498. this._alt.setupTabStops(l)
  7499. }
  7500. }
  7501. r.BufferSet = f
  7502. }
  7503. ,
  7504. 511: (x, r, a) => {
  7505. Object.defineProperty(r, "__esModule", {
  7506. value: !0
  7507. }),
  7508. r.CellData = void 0;
  7509. const n = a(482)
  7510. , _ = a(643)
  7511. , h = a(3734);
  7512. class f extends h.AttributeData {
  7513. constructor() {
  7514. super(...arguments),
  7515. this.content = 0,
  7516. this.fg = 0,
  7517. this.bg = 0,
  7518. this.extended = new h.ExtendedAttrs,
  7519. this.combinedData = ""
  7520. }
  7521. static fromCharData(l) {
  7522. const o = new f;
  7523. return o.setFromCharData(l),
  7524. o
  7525. }
  7526. isCombined() {
  7527. return 2097152 & this.content
  7528. }
  7529. getWidth() {
  7530. return this.content >> 22
  7531. }
  7532. getChars() {
  7533. return 2097152 & this.content ? this.combinedData : 2097151 & this.content ? (0,
  7534. n.stringFromCodePoint)(2097151 & this.content) : ""
  7535. }
  7536. getCode() {
  7537. return this.isCombined() ? this.combinedData.charCodeAt(this.combinedData.length - 1) : 2097151 & this.content
  7538. }
  7539. setFromCharData(l) {
  7540. this.fg = l[_.CHAR_DATA_ATTR_INDEX],
  7541. this.bg = 0;
  7542. let o = !1;
  7543. if (l[_.CHAR_DATA_CHAR_INDEX].length > 2)
  7544. o = !0;
  7545. else if (l[_.CHAR_DATA_CHAR_INDEX].length === 2) {
  7546. const t = l[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);
  7547. if (55296 <= t && t <= 56319) {
  7548. const s = l[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);
  7549. 56320 <= s && s <= 57343 ? this.content = 1024 * (t - 55296) + s - 56320 + 65536 | l[_.CHAR_DATA_WIDTH_INDEX] << 22 : o = !0
  7550. } else
  7551. o = !0
  7552. } else
  7553. this.content = l[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | l[_.CHAR_DATA_WIDTH_INDEX] << 22;
  7554. o && (this.combinedData = l[_.CHAR_DATA_CHAR_INDEX],
  7555. this.content = 2097152 | l[_.CHAR_DATA_WIDTH_INDEX] << 22)
  7556. }
  7557. getAsCharData() {
  7558. return [this.fg, this.getChars(), this.getWidth(), this.getCode()]
  7559. }
  7560. }
  7561. r.CellData = f
  7562. }
  7563. ,
  7564. 643: (x, r) => {
  7565. Object.defineProperty(r, "__esModule", {
  7566. value: !0
  7567. }),
  7568. r.WHITESPACE_CELL_CODE = r.WHITESPACE_CELL_WIDTH = r.WHITESPACE_CELL_CHAR = r.NULL_CELL_CODE = r.NULL_CELL_WIDTH = r.NULL_CELL_CHAR = r.CHAR_DATA_CODE_INDEX = r.CHAR_DATA_WIDTH_INDEX = r.CHAR_DATA_CHAR_INDEX = r.CHAR_DATA_ATTR_INDEX = r.DEFAULT_EXT = r.DEFAULT_ATTR = r.DEFAULT_COLOR = void 0,
  7569. r.DEFAULT_COLOR = 256,
  7570. r.DEFAULT_ATTR = 256 | r.DEFAULT_COLOR << 9,
  7571. r.DEFAULT_EXT = 0,
  7572. r.CHAR_DATA_ATTR_INDEX = 0,
  7573. r.CHAR_DATA_CHAR_INDEX = 1,
  7574. r.CHAR_DATA_WIDTH_INDEX = 2,
  7575. r.CHAR_DATA_CODE_INDEX = 3,
  7576. r.NULL_CELL_CHAR = "",
  7577. r.NULL_CELL_WIDTH = 1,
  7578. r.NULL_CELL_CODE = 0,
  7579. r.WHITESPACE_CELL_CHAR = " ",
  7580. r.WHITESPACE_CELL_WIDTH = 1,
  7581. r.WHITESPACE_CELL_CODE = 32
  7582. }
  7583. ,
  7584. 4863: (x, r, a) => {
  7585. Object.defineProperty(r, "__esModule", {
  7586. value: !0
  7587. }),
  7588. r.Marker = void 0;
  7589. const n = a(8460)
  7590. , _ = a(844);
  7591. class h extends _.Disposable {
  7592. constructor(d) {
  7593. super(),
  7594. this.line = d,
  7595. this._id = h._nextId++,
  7596. this.isDisposed = !1,
  7597. this._onDispose = new n.EventEmitter
  7598. }
  7599. get id() {
  7600. return this._id
  7601. }
  7602. get onDispose() {
  7603. return this._onDispose.event
  7604. }
  7605. dispose() {
  7606. this.isDisposed || (this.isDisposed = !0,
  7607. this.line = -1,
  7608. this._onDispose.fire(),
  7609. super.dispose())
  7610. }
  7611. }
  7612. r.Marker = h,
  7613. h._nextId = 1
  7614. }
  7615. ,
  7616. 7116: (x, r) => {
  7617. Object.defineProperty(r, "__esModule", {
  7618. value: !0
  7619. }),
  7620. r.DEFAULT_CHARSET = r.CHARSETS = void 0,
  7621. r.CHARSETS = {},
  7622. r.DEFAULT_CHARSET = r.CHARSETS.B,
  7623. r.CHARSETS[0] = {
  7624. "`": "\u25C6",
  7625. a: "\u2592",
  7626. b: "\u2409",
  7627. c: "\u240C",
  7628. d: "\u240D",
  7629. e: "\u240A",
  7630. f: "\xB0",
  7631. g: "\xB1",
  7632. h: "\u2424",
  7633. i: "\u240B",
  7634. j: "\u2518",
  7635. k: "\u2510",
  7636. l: "\u250C",
  7637. m: "\u2514",
  7638. n: "\u253C",
  7639. o: "\u23BA",
  7640. p: "\u23BB",
  7641. q: "\u2500",
  7642. r: "\u23BC",
  7643. s: "\u23BD",
  7644. t: "\u251C",
  7645. u: "\u2524",
  7646. v: "\u2534",
  7647. w: "\u252C",
  7648. x: "\u2502",
  7649. y: "\u2264",
  7650. z: "\u2265",
  7651. "{": "\u03C0",
  7652. "|": "\u2260",
  7653. "}": "\xA3",
  7654. "~": "\xB7"
  7655. },
  7656. r.CHARSETS.A = {
  7657. "#": "\xA3"
  7658. },
  7659. r.CHARSETS.B = void 0,
  7660. r.CHARSETS[4] = {
  7661. "#": "\xA3",
  7662. "@": "\xBE",
  7663. "[": "ij",
  7664. "\\": "\xBD",
  7665. "]": "|",
  7666. "{": "\xA8",
  7667. "|": "f",
  7668. "}": "\xBC",
  7669. "~": "\xB4"
  7670. },
  7671. r.CHARSETS.C = r.CHARSETS[5] = {
  7672. "[": "\xC4",
  7673. "\\": "\xD6",
  7674. "]": "\xC5",
  7675. "^": "\xDC",
  7676. "`": "\xE9",
  7677. "{": "\xE4",
  7678. "|": "\xF6",
  7679. "}": "\xE5",
  7680. "~": "\xFC"
  7681. },
  7682. r.CHARSETS.R = {
  7683. "#": "\xA3",
  7684. "@": "\xE0",
  7685. "[": "\xB0",
  7686. "\\": "\xE7",
  7687. "]": "\xA7",
  7688. "{": "\xE9",
  7689. "|": "\xF9",
  7690. "}": "\xE8",
  7691. "~": "\xA8"
  7692. },
  7693. r.CHARSETS.Q = {
  7694. "@": "\xE0",
  7695. "[": "\xE2",
  7696. "\\": "\xE7",
  7697. "]": "\xEA",
  7698. "^": "\xEE",
  7699. "`": "\xF4",
  7700. "{": "\xE9",
  7701. "|": "\xF9",
  7702. "}": "\xE8",
  7703. "~": "\xFB"
  7704. },
  7705. r.CHARSETS.K = {
  7706. "@": "\xA7",
  7707. "[": "\xC4",
  7708. "\\": "\xD6",
  7709. "]": "\xDC",
  7710. "{": "\xE4",
  7711. "|": "\xF6",
  7712. "}": "\xFC",
  7713. "~": "\xDF"
  7714. },
  7715. r.CHARSETS.Y = {
  7716. "#": "\xA3",
  7717. "@": "\xA7",
  7718. "[": "\xB0",
  7719. "\\": "\xE7",
  7720. "]": "\xE9",
  7721. "`": "\xF9",
  7722. "{": "\xE0",
  7723. "|": "\xF2",
  7724. "}": "\xE8",
  7725. "~": "\xEC"
  7726. },
  7727. r.CHARSETS.E = r.CHARSETS[6] = {
  7728. "@": "\xC4",
  7729. "[": "\xC6",
  7730. "\\": "\xD8",
  7731. "]": "\xC5",
  7732. "^": "\xDC",
  7733. "`": "\xE4",
  7734. "{": "\xE6",
  7735. "|": "\xF8",
  7736. "}": "\xE5",
  7737. "~": "\xFC"
  7738. },
  7739. r.CHARSETS.Z = {
  7740. "#": "\xA3",
  7741. "@": "\xA7",
  7742. "[": "\xA1",
  7743. "\\": "\xD1",
  7744. "]": "\xBF",
  7745. "{": "\xB0",
  7746. "|": "\xF1",
  7747. "}": "\xE7"
  7748. },
  7749. r.CHARSETS.H = r.CHARSETS[7] = {
  7750. "@": "\xC9",
  7751. "[": "\xC4",
  7752. "\\": "\xD6",
  7753. "]": "\xC5",
  7754. "^": "\xDC",
  7755. "`": "\xE9",
  7756. "{": "\xE4",
  7757. "|": "\xF6",
  7758. "}": "\xE5",
  7759. "~": "\xFC"
  7760. },
  7761. r.CHARSETS["="] = {
  7762. "#": "\xF9",
  7763. "@": "\xE0",
  7764. "[": "\xE9",
  7765. "\\": "\xE7",
  7766. "]": "\xEA",
  7767. "^": "\xEE",
  7768. _: "\xE8",
  7769. "`": "\xF4",
  7770. "{": "\xE4",
  7771. "|": "\xF6",
  7772. "}": "\xFC",
  7773. "~": "\xFB"
  7774. }
  7775. }
  7776. ,
  7777. 2584: (x, r) => {
  7778. var a, n;
  7779. Object.defineProperty(r, "__esModule", {
  7780. value: !0
  7781. }),
  7782. r.C1_ESCAPED = r.C1 = r.C0 = void 0,
  7783. function (_) {
  7784. _.NUL = "\0",
  7785. _.SOH = "",
  7786. _.STX = "",
  7787. _.ETX = "",
  7788. _.EOT = "",
  7789. _.ENQ = "",
  7790. _.ACK = "",
  7791. _.BEL = "\x07",
  7792. _.BS = "\b",
  7793. _.HT = " ",
  7794. _.LF = `
  7795. `,
  7796. _.VT = "\v",
  7797. _.FF = "\f",
  7798. _.CR = "\r",
  7799. _.SO = "",
  7800. _.SI = "",
  7801. _.DLE = "",
  7802. _.DC1 = "",
  7803. _.DC2 = "",
  7804. _.DC3 = "",
  7805. _.DC4 = "",
  7806. _.NAK = "",
  7807. _.SYN = "",
  7808. _.ETB = "",
  7809. _.CAN = "",
  7810. _.EM = "",
  7811. _.SUB = "",
  7812. _.ESC = "\x1B",
  7813. _.FS = "",
  7814. _.GS = "",
  7815. _.RS = "",
  7816. _.US = "",
  7817. _.SP = " ",
  7818. _.DEL = "\x7F"
  7819. }(a = r.C0 || (r.C0 = {})),
  7820. (n = r.C1 || (r.C1 = {})).PAD = "\x80",
  7821. n.HOP = "\x81",
  7822. n.BPH = "\x82",
  7823. n.NBH = "\x83",
  7824. n.IND = "\x84",
  7825. n.NEL = "\x85",
  7826. n.SSA = "\x86",
  7827. n.ESA = "\x87",
  7828. n.HTS = "\x88",
  7829. n.HTJ = "\x89",
  7830. n.VTS = "\x8A",
  7831. n.PLD = "\x8B",
  7832. n.PLU = "\x8C",
  7833. n.RI = "\x8D",
  7834. n.SS2 = "\x8E",
  7835. n.SS3 = "\x8F",
  7836. n.DCS = "\x90",
  7837. n.PU1 = "\x91",
  7838. n.PU2 = "\x92",
  7839. n.STS = "\x93",
  7840. n.CCH = "\x94",
  7841. n.MW = "\x95",
  7842. n.SPA = "\x96",
  7843. n.EPA = "\x97",
  7844. n.SOS = "\x98",
  7845. n.SGCI = "\x99",
  7846. n.SCI = "\x9A",
  7847. n.CSI = "\x9B",
  7848. n.ST = "\x9C",
  7849. n.OSC = "\x9D",
  7850. n.PM = "\x9E",
  7851. n.APC = "\x9F",
  7852. (r.C1_ESCAPED || (r.C1_ESCAPED = {})).ST = `${a.ESC}\\`
  7853. }
  7854. ,
  7855. 7399: (x, r, a) => {
  7856. Object.defineProperty(r, "__esModule", {
  7857. value: !0
  7858. }),
  7859. r.evaluateKeyboardEvent = void 0;
  7860. const n = a(2584)
  7861. , _ = {
  7862. 48: ["0", ")"],
  7863. 49: ["1", "!"],
  7864. 50: ["2", "@"],
  7865. 51: ["3", "#"],
  7866. 52: ["4", "$"],
  7867. 53: ["5", "%"],
  7868. 54: ["6", "^"],
  7869. 55: ["7", "&"],
  7870. 56: ["8", "*"],
  7871. 57: ["9", "("],
  7872. 186: [";", ":"],
  7873. 187: ["=", "+"],
  7874. 188: [",", "<"],
  7875. 189: ["-", "_"],
  7876. 190: [".", ">"],
  7877. 191: ["/", "?"],
  7878. 192: ["`", "~"],
  7879. 219: ["[", "{"],
  7880. 220: ["\\", "|"],
  7881. 221: ["]", "}"],
  7882. 222: ["'", '"']
  7883. };
  7884. r.evaluateKeyboardEvent = function (h, f, d, l) {
  7885. const o = {
  7886. type: 0,
  7887. cancel: !1,
  7888. key: void 0
  7889. }
  7890. , t = (h.shiftKey ? 1 : 0) | (h.altKey ? 2 : 0) | (h.ctrlKey ? 4 : 0) | (h.metaKey ? 8 : 0);
  7891. switch (h.keyCode) {
  7892. case 0:
  7893. h.key === "UIKeyInputUpArrow" ? o.key = f ? n.C0.ESC + "OA" : n.C0.ESC + "[A" : h.key === "UIKeyInputLeftArrow" ? o.key = f ? n.C0.ESC + "OD" : n.C0.ESC + "[D" : h.key === "UIKeyInputRightArrow" ? o.key = f ? n.C0.ESC + "OC" : n.C0.ESC + "[C" : h.key === "UIKeyInputDownArrow" && (o.key = f ? n.C0.ESC + "OB" : n.C0.ESC + "[B");
  7894. break;
  7895. case 8:
  7896. if (h.altKey) {
  7897. o.key = n.C0.ESC + n.C0.DEL;
  7898. break
  7899. }
  7900. o.key = n.C0.DEL;
  7901. break;
  7902. case 9:
  7903. if (h.shiftKey) {
  7904. o.key = n.C0.ESC + "[Z";
  7905. break
  7906. }
  7907. o.key = n.C0.HT,
  7908. o.cancel = !0;
  7909. break;
  7910. case 13:
  7911. o.key = h.altKey ? n.C0.ESC + n.C0.CR : n.C0.CR,
  7912. o.cancel = !0;
  7913. break;
  7914. case 27:
  7915. o.key = n.C0.ESC,
  7916. h.altKey && (o.key = n.C0.ESC + n.C0.ESC),
  7917. o.cancel = !0;
  7918. break;
  7919. case 37:
  7920. if (h.metaKey)
  7921. break;
  7922. t ? (o.key = n.C0.ESC + "[1;" + (t + 1) + "D",
  7923. o.key === n.C0.ESC + "[1;3D" && (o.key = n.C0.ESC + (d ? "b" : "[1;5D"))) : o.key = f ? n.C0.ESC + "OD" : n.C0.ESC + "[D";
  7924. break;
  7925. case 39:
  7926. if (h.metaKey)
  7927. break;
  7928. t ? (o.key = n.C0.ESC + "[1;" + (t + 1) + "C",
  7929. o.key === n.C0.ESC + "[1;3C" && (o.key = n.C0.ESC + (d ? "f" : "[1;5C"))) : o.key = f ? n.C0.ESC + "OC" : n.C0.ESC + "[C";
  7930. break;
  7931. case 38:
  7932. if (h.metaKey)
  7933. break;
  7934. t ? (o.key = n.C0.ESC + "[1;" + (t + 1) + "A",
  7935. d || o.key !== n.C0.ESC + "[1;3A" || (o.key = n.C0.ESC + "[1;5A")) : o.key = f ? n.C0.ESC + "OA" : n.C0.ESC + "[A";
  7936. break;
  7937. case 40:
  7938. if (h.metaKey)
  7939. break;
  7940. t ? (o.key = n.C0.ESC + "[1;" + (t + 1) + "B",
  7941. d || o.key !== n.C0.ESC + "[1;3B" || (o.key = n.C0.ESC + "[1;5B")) : o.key = f ? n.C0.ESC + "OB" : n.C0.ESC + "[B";
  7942. break;
  7943. case 45:
  7944. h.shiftKey || h.ctrlKey || (o.key = n.C0.ESC + "[2~");
  7945. break;
  7946. case 46:
  7947. o.key = t ? n.C0.ESC + "[3;" + (t + 1) + "~" : n.C0.ESC + "[3~";
  7948. break;
  7949. case 36:
  7950. o.key = t ? n.C0.ESC + "[1;" + (t + 1) + "H" : f ? n.C0.ESC + "OH" : n.C0.ESC + "[H";
  7951. break;
  7952. case 35:
  7953. o.key = t ? n.C0.ESC + "[1;" + (t + 1) + "F" : f ? n.C0.ESC + "OF" : n.C0.ESC + "[F";
  7954. break;
  7955. case 33:
  7956. h.shiftKey ? o.type = 2 : h.ctrlKey ? o.key = n.C0.ESC + "[5;" + (t + 1) + "~" : o.key = n.C0.ESC + "[5~";
  7957. break;
  7958. case 34:
  7959. h.shiftKey ? o.type = 3 : h.ctrlKey ? o.key = n.C0.ESC + "[6;" + (t + 1) + "~" : o.key = n.C0.ESC + "[6~";
  7960. break;
  7961. case 112:
  7962. o.key = t ? n.C0.ESC + "[1;" + (t + 1) + "P" : n.C0.ESC + "OP";
  7963. break;
  7964. case 113:
  7965. o.key = t ? n.C0.ESC + "[1;" + (t + 1) + "Q" : n.C0.ESC + "OQ";
  7966. break;
  7967. case 114:
  7968. o.key = t ? n.C0.ESC + "[1;" + (t + 1) + "R" : n.C0.ESC + "OR";
  7969. break;
  7970. case 115:
  7971. o.key = t ? n.C0.ESC + "[1;" + (t + 1) + "S" : n.C0.ESC + "OS";
  7972. break;
  7973. case 116:
  7974. o.key = t ? n.C0.ESC + "[15;" + (t + 1) + "~" : n.C0.ESC + "[15~";
  7975. break;
  7976. case 117:
  7977. o.key = t ? n.C0.ESC + "[17;" + (t + 1) + "~" : n.C0.ESC + "[17~";
  7978. break;
  7979. case 118:
  7980. o.key = t ? n.C0.ESC + "[18;" + (t + 1) + "~" : n.C0.ESC + "[18~";
  7981. break;
  7982. case 119:
  7983. o.key = t ? n.C0.ESC + "[19;" + (t + 1) + "~" : n.C0.ESC + "[19~";
  7984. break;
  7985. case 120:
  7986. o.key = t ? n.C0.ESC + "[20;" + (t + 1) + "~" : n.C0.ESC + "[20~";
  7987. break;
  7988. case 121:
  7989. o.key = t ? n.C0.ESC + "[21;" + (t + 1) + "~" : n.C0.ESC + "[21~";
  7990. break;
  7991. case 122:
  7992. o.key = t ? n.C0.ESC + "[23;" + (t + 1) + "~" : n.C0.ESC + "[23~";
  7993. break;
  7994. case 123:
  7995. o.key = t ? n.C0.ESC + "[24;" + (t + 1) + "~" : n.C0.ESC + "[24~";
  7996. break;
  7997. default:
  7998. if (!h.ctrlKey || h.shiftKey || h.altKey || h.metaKey)
  7999. if (d && !l || !h.altKey || h.metaKey)
  8000. !d || h.altKey || h.ctrlKey || h.shiftKey || !h.metaKey ? h.key && !h.ctrlKey && !h.altKey && !h.metaKey && h.keyCode >= 48 && h.key.length === 1 ? o.key = h.key : h.key && h.ctrlKey && (h.key === "_" && (o.key = n.C0.US),
  8001. h.key === "@" && (o.key = n.C0.NUL)) : h.keyCode === 65 && (o.type = 1);
  8002. else {
  8003. const s = _[h.keyCode]
  8004. , e = s == null ? void 0 : s[h.shiftKey ? 1 : 0];
  8005. if (e)
  8006. o.key = n.C0.ESC + e;
  8007. else if (h.keyCode >= 65 && h.keyCode <= 90) {
  8008. const i = h.ctrlKey ? h.keyCode - 64 : h.keyCode + 32;
  8009. let c = String.fromCharCode(i);
  8010. h.shiftKey && (c = c.toUpperCase()),
  8011. o.key = n.C0.ESC + c
  8012. } else if (h.key === "Dead" && h.code.startsWith("Key")) {
  8013. let i = h.code.slice(3, 4);
  8014. h.shiftKey || (i = i.toLowerCase()),
  8015. o.key = n.C0.ESC + i,
  8016. o.cancel = !0
  8017. }
  8018. }
  8019. else
  8020. h.keyCode >= 65 && h.keyCode <= 90 ? o.key = String.fromCharCode(h.keyCode - 64) : h.keyCode === 32 ? o.key = n.C0.NUL : h.keyCode >= 51 && h.keyCode <= 55 ? o.key = String.fromCharCode(h.keyCode - 51 + 27) : h.keyCode === 56 ? o.key = n.C0.DEL : h.keyCode === 219 ? o.key = n.C0.ESC : h.keyCode === 220 ? o.key = n.C0.FS : h.keyCode === 221 && (o.key = n.C0.GS)
  8021. }
  8022. return o
  8023. }
  8024. }
  8025. ,
  8026. 482: (x, r) => {
  8027. Object.defineProperty(r, "__esModule", {
  8028. value: !0
  8029. }),
  8030. r.Utf8ToUtf32 = r.StringToUtf32 = r.utf32ToString = r.stringFromCodePoint = void 0,
  8031. r.stringFromCodePoint = function (a) {
  8032. return a > 65535 ? (a -= 65536,
  8033. String.fromCharCode(55296 + (a >> 10)) + String.fromCharCode(a % 1024 + 56320)) : String.fromCharCode(a)
  8034. }
  8035. ,
  8036. r.utf32ToString = function (a, n = 0, _ = a.length) {
  8037. let h = "";
  8038. for (let f = n; f < _; ++f) {
  8039. let d = a[f];
  8040. d > 65535 ? (d -= 65536,
  8041. h += String.fromCharCode(55296 + (d >> 10)) + String.fromCharCode(d % 1024 + 56320)) : h += String.fromCharCode(d)
  8042. }
  8043. return h
  8044. }
  8045. ,
  8046. r.StringToUtf32 = class {
  8047. constructor() {
  8048. this._interim = 0
  8049. }
  8050. clear() {
  8051. this._interim = 0
  8052. }
  8053. decode(a, n) {
  8054. const _ = a.length;
  8055. if (!_)
  8056. return 0;
  8057. let h = 0
  8058. , f = 0;
  8059. if (this._interim) {
  8060. const d = a.charCodeAt(f++);
  8061. 56320 <= d && d <= 57343 ? n[h++] = 1024 * (this._interim - 55296) + d - 56320 + 65536 : (n[h++] = this._interim,
  8062. n[h++] = d),
  8063. this._interim = 0
  8064. }
  8065. for (let d = f; d < _; ++d) {
  8066. const l = a.charCodeAt(d);
  8067. if (55296 <= l && l <= 56319) {
  8068. if (++d >= _)
  8069. return this._interim = l,
  8070. h;
  8071. const o = a.charCodeAt(d);
  8072. 56320 <= o && o <= 57343 ? n[h++] = 1024 * (l - 55296) + o - 56320 + 65536 : (n[h++] = l,
  8073. n[h++] = o)
  8074. } else
  8075. l !== 65279 && (n[h++] = l)
  8076. }
  8077. return h
  8078. }
  8079. }
  8080. ,
  8081. r.Utf8ToUtf32 = class {
  8082. constructor() {
  8083. this.interim = new Uint8Array(3)
  8084. }
  8085. clear() {
  8086. this.interim.fill(0)
  8087. }
  8088. decode(a, n) {
  8089. const _ = a.length;
  8090. if (!_)
  8091. return 0;
  8092. let h, f, d, l, o = 0, t = 0, s = 0;
  8093. if (this.interim[0]) {
  8094. let c = !1
  8095. , g = this.interim[0];
  8096. g &= (224 & g) == 192 ? 31 : (240 & g) == 224 ? 15 : 7;
  8097. let v, S = 0;
  8098. for (; (v = 63 & this.interim[++S]) && S < 4;)
  8099. g <<= 6,
  8100. g |= v;
  8101. const u = (224 & this.interim[0]) == 192 ? 2 : (240 & this.interim[0]) == 224 ? 3 : 4
  8102. , m = u - S;
  8103. for (; s < m;) {
  8104. if (s >= _)
  8105. return 0;
  8106. if (v = a[s++],
  8107. (192 & v) != 128) {
  8108. s--,
  8109. c = !0;
  8110. break
  8111. }
  8112. this.interim[S++] = v,
  8113. g <<= 6,
  8114. g |= 63 & v
  8115. }
  8116. c || (u === 2 ? g < 128 ? s-- : n[o++] = g : u === 3 ? g < 2048 || g >= 55296 && g <= 57343 || g === 65279 || (n[o++] = g) : g < 65536 || g > 1114111 || (n[o++] = g)),
  8117. this.interim.fill(0)
  8118. }
  8119. const e = _ - 4;
  8120. let i = s;
  8121. for (; i < _;) {
  8122. for (; !(!(i < e) || 128 & (h = a[i]) || 128 & (f = a[i + 1]) || 128 & (d = a[i + 2]) || 128 & (l = a[i + 3]));)
  8123. n[o++] = h,
  8124. n[o++] = f,
  8125. n[o++] = d,
  8126. n[o++] = l,
  8127. i += 4;
  8128. if (h = a[i++],
  8129. h < 128)
  8130. n[o++] = h;
  8131. else if ((224 & h) == 192) {
  8132. if (i >= _)
  8133. return this.interim[0] = h,
  8134. o;
  8135. if (f = a[i++],
  8136. (192 & f) != 128) {
  8137. i--;
  8138. continue
  8139. }
  8140. if (t = (31 & h) << 6 | 63 & f,
  8141. t < 128) {
  8142. i--;
  8143. continue
  8144. }
  8145. n[o++] = t
  8146. } else if ((240 & h) == 224) {
  8147. if (i >= _)
  8148. return this.interim[0] = h,
  8149. o;
  8150. if (f = a[i++],
  8151. (192 & f) != 128) {
  8152. i--;
  8153. continue
  8154. }
  8155. if (i >= _)
  8156. return this.interim[0] = h,
  8157. this.interim[1] = f,
  8158. o;
  8159. if (d = a[i++],
  8160. (192 & d) != 128) {
  8161. i--;
  8162. continue
  8163. }
  8164. if (t = (15 & h) << 12 | (63 & f) << 6 | 63 & d,
  8165. t < 2048 || t >= 55296 && t <= 57343 || t === 65279)
  8166. continue;
  8167. n[o++] = t
  8168. } else if ((248 & h) == 240) {
  8169. if (i >= _)
  8170. return this.interim[0] = h,
  8171. o;
  8172. if (f = a[i++],
  8173. (192 & f) != 128) {
  8174. i--;
  8175. continue
  8176. }
  8177. if (i >= _)
  8178. return this.interim[0] = h,
  8179. this.interim[1] = f,
  8180. o;
  8181. if (d = a[i++],
  8182. (192 & d) != 128) {
  8183. i--;
  8184. continue
  8185. }
  8186. if (i >= _)
  8187. return this.interim[0] = h,
  8188. this.interim[1] = f,
  8189. this.interim[2] = d,
  8190. o;
  8191. if (l = a[i++],
  8192. (192 & l) != 128) {
  8193. i--;
  8194. continue
  8195. }
  8196. if (t = (7 & h) << 18 | (63 & f) << 12 | (63 & d) << 6 | 63 & l,
  8197. t < 65536 || t > 1114111)
  8198. continue;
  8199. n[o++] = t
  8200. }
  8201. }
  8202. return o
  8203. }
  8204. }
  8205. }
  8206. ,
  8207. 225: (x, r, a) => {
  8208. Object.defineProperty(r, "__esModule", {
  8209. value: !0
  8210. }),
  8211. r.UnicodeV6 = void 0;
  8212. const n = a(8273)
  8213. , _ = [[768, 879], [1155, 1158], [1160, 1161], [1425, 1469], [1471, 1471], [1473, 1474], [1476, 1477], [1479, 1479], [1536, 1539], [1552, 1557], [1611, 1630], [1648, 1648], [1750, 1764], [1767, 1768], [1770, 1773], [1807, 1807], [1809, 1809], [1840, 1866], [1958, 1968], [2027, 2035], [2305, 2306], [2364, 2364], [2369, 2376], [2381, 2381], [2385, 2388], [2402, 2403], [2433, 2433], [2492, 2492], [2497, 2500], [2509, 2509], [2530, 2531], [2561, 2562], [2620, 2620], [2625, 2626], [2631, 2632], [2635, 2637], [2672, 2673], [2689, 2690], [2748, 2748], [2753, 2757], [2759, 2760], [2765, 2765], [2786, 2787], [2817, 2817], [2876, 2876], [2879, 2879], [2881, 2883], [2893, 2893], [2902, 2902], [2946, 2946], [3008, 3008], [3021, 3021], [3134, 3136], [3142, 3144], [3146, 3149], [3157, 3158], [3260, 3260], [3263, 3263], [3270, 3270], [3276, 3277], [3298, 3299], [3393, 3395], [3405, 3405], [3530, 3530], [3538, 3540], [3542, 3542], [3633, 3633], [3636, 3642], [3655, 3662], [3761, 3761], [3764, 3769], [3771, 3772], [3784, 3789], [3864, 3865], [3893, 3893], [3895, 3895], [3897, 3897], [3953, 3966], [3968, 3972], [3974, 3975], [3984, 3991], [3993, 4028], [4038, 4038], [4141, 4144], [4146, 4146], [4150, 4151], [4153, 4153], [4184, 4185], [4448, 4607], [4959, 4959], [5906, 5908], [5938, 5940], [5970, 5971], [6002, 6003], [6068, 6069], [6071, 6077], [6086, 6086], [6089, 6099], [6109, 6109], [6155, 6157], [6313, 6313], [6432, 6434], [6439, 6440], [6450, 6450], [6457, 6459], [6679, 6680], [6912, 6915], [6964, 6964], [6966, 6970], [6972, 6972], [6978, 6978], [7019, 7027], [7616, 7626], [7678, 7679], [8203, 8207], [8234, 8238], [8288, 8291], [8298, 8303], [8400, 8431], [12330, 12335], [12441, 12442], [43014, 43014], [43019, 43019], [43045, 43046], [64286, 64286], [65024, 65039], [65056, 65059], [65279, 65279], [65529, 65531]]
  8214. , h = [[68097, 68099], [68101, 68102], [68108, 68111], [68152, 68154], [68159, 68159], [119143, 119145], [119155, 119170], [119173, 119179], [119210, 119213], [119362, 119364], [917505, 917505], [917536, 917631], [917760, 917999]];
  8215. let f;
  8216. r.UnicodeV6 = class {
  8217. constructor() {
  8218. if (this.version = "6",
  8219. !f) {
  8220. f = new Uint8Array(65536),
  8221. (0,
  8222. n.fill)(f, 1),
  8223. f[0] = 0,
  8224. (0,
  8225. n.fill)(f, 0, 1, 32),
  8226. (0,
  8227. n.fill)(f, 0, 127, 160),
  8228. (0,
  8229. n.fill)(f, 2, 4352, 4448),
  8230. f[9001] = 2,
  8231. f[9002] = 2,
  8232. (0,
  8233. n.fill)(f, 2, 11904, 42192),
  8234. f[12351] = 1,
  8235. (0,
  8236. n.fill)(f, 2, 44032, 55204),
  8237. (0,
  8238. n.fill)(f, 2, 63744, 64256),
  8239. (0,
  8240. n.fill)(f, 2, 65040, 65050),
  8241. (0,
  8242. n.fill)(f, 2, 65072, 65136),
  8243. (0,
  8244. n.fill)(f, 2, 65280, 65377),
  8245. (0,
  8246. n.fill)(f, 2, 65504, 65511);
  8247. for (let d = 0; d < _.length; ++d)
  8248. (0,
  8249. n.fill)(f, 0, _[d][0], _[d][1] + 1)
  8250. }
  8251. }
  8252. wcwidth(d) {
  8253. return d < 32 ? 0 : d < 127 ? 1 : d < 65536 ? f[d] : function (l, o) {
  8254. let t, s = 0, e = o.length - 1;
  8255. if (l < o[0][0] || l > o[e][1])
  8256. return !1;
  8257. for (; e >= s;)
  8258. if (t = s + e >> 1,
  8259. l > o[t][1])
  8260. s = t + 1;
  8261. else {
  8262. if (!(l < o[t][0]))
  8263. return !0;
  8264. e = t - 1
  8265. }
  8266. return !1
  8267. }(d, h) ? 0 : d >= 131072 && d <= 196605 || d >= 196608 && d <= 262141 ? 2 : 1
  8268. }
  8269. }
  8270. }
  8271. ,
  8272. 5981: (x, r, a) => {
  8273. Object.defineProperty(r, "__esModule", {
  8274. value: !0
  8275. }),
  8276. r.WriteBuffer = void 0;
  8277. const n = a(8460)
  8278. , _ = typeof queueMicrotask > "u" ? h => {
  8279. Promise.resolve().then(h)
  8280. }
  8281. : queueMicrotask;
  8282. r.WriteBuffer = class {
  8283. constructor(h) {
  8284. this._action = h,
  8285. this._writeBuffer = [],
  8286. this._callbacks = [],
  8287. this._pendingData = 0,
  8288. this._bufferOffset = 0,
  8289. this._isSyncWriting = !1,
  8290. this._syncCalls = 0,
  8291. this._onWriteParsed = new n.EventEmitter
  8292. }
  8293. get onWriteParsed() {
  8294. return this._onWriteParsed.event
  8295. }
  8296. writeSync(h, f) {
  8297. if (f !== void 0 && this._syncCalls > f)
  8298. return void (this._syncCalls = 0);
  8299. if (this._pendingData += h.length,
  8300. this._writeBuffer.push(h),
  8301. this._callbacks.push(void 0),
  8302. this._syncCalls++,
  8303. this._isSyncWriting)
  8304. return;
  8305. let d;
  8306. for (this._isSyncWriting = !0; d = this._writeBuffer.shift();) {
  8307. this._action(d);
  8308. const l = this._callbacks.shift();
  8309. l && l()
  8310. }
  8311. this._pendingData = 0,
  8312. this._bufferOffset = 2147483647,
  8313. this._isSyncWriting = !1,
  8314. this._syncCalls = 0
  8315. }
  8316. write(h, f) {
  8317. if (this._pendingData > 5e7)
  8318. throw new Error("write data discarded, use flow control to avoid losing data");
  8319. this._writeBuffer.length || (this._bufferOffset = 0,
  8320. setTimeout(() => this._innerWrite())),
  8321. this._pendingData += h.length,
  8322. this._writeBuffer.push(h),
  8323. this._callbacks.push(f)
  8324. }
  8325. _innerWrite(h = 0, f = !0) {
  8326. const d = h || Date.now();
  8327. for (; this._writeBuffer.length > this._bufferOffset;) {
  8328. const l = this._writeBuffer[this._bufferOffset]
  8329. , o = this._action(l, f);
  8330. if (o) {
  8331. const s = e => Date.now() - d >= 12 ? setTimeout(() => this._innerWrite(0, e)) : this._innerWrite(d, e);
  8332. return void o.catch(e => (_(() => {
  8333. throw e
  8334. }
  8335. ),
  8336. Promise.resolve(!1))).then(s)
  8337. }
  8338. const t = this._callbacks[this._bufferOffset];
  8339. if (t && t(),
  8340. this._bufferOffset++,
  8341. this._pendingData -= l.length,
  8342. Date.now() - d >= 12)
  8343. break
  8344. }
  8345. this._writeBuffer.length > this._bufferOffset ? (this._bufferOffset > 50 && (this._writeBuffer = this._writeBuffer.slice(this._bufferOffset),
  8346. this._callbacks = this._callbacks.slice(this._bufferOffset),
  8347. this._bufferOffset = 0),
  8348. setTimeout(() => this._innerWrite())) : (this._writeBuffer.length = 0,
  8349. this._callbacks.length = 0,
  8350. this._pendingData = 0,
  8351. this._bufferOffset = 0),
  8352. this._onWriteParsed.fire()
  8353. }
  8354. }
  8355. }
  8356. ,
  8357. 5941: (x, r) => {
  8358. Object.defineProperty(r, "__esModule", {
  8359. value: !0
  8360. }),
  8361. r.toRgbString = r.parseColor = void 0;
  8362. const a = /^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/
  8363. , n = /^[\da-f]+$/;
  8364. function _(h, f) {
  8365. const d = h.toString(16)
  8366. , l = d.length < 2 ? "0" + d : d;
  8367. switch (f) {
  8368. case 4:
  8369. return d[0];
  8370. case 8:
  8371. return l;
  8372. case 12:
  8373. return (l + l).slice(0, 3);
  8374. default:
  8375. return l + l
  8376. }
  8377. }
  8378. r.parseColor = function (h) {
  8379. if (!h)
  8380. return;
  8381. let f = h.toLowerCase();
  8382. if (f.indexOf("rgb:") === 0) {
  8383. f = f.slice(4);
  8384. const d = a.exec(f);
  8385. if (d) {
  8386. const l = d[1] ? 15 : d[4] ? 255 : d[7] ? 4095 : 65535;
  8387. return [Math.round(parseInt(d[1] || d[4] || d[7] || d[10], 16) / l * 255), Math.round(parseInt(d[2] || d[5] || d[8] || d[11], 16) / l * 255), Math.round(parseInt(d[3] || d[6] || d[9] || d[12], 16) / l * 255)]
  8388. }
  8389. } else if (f.indexOf("#") === 0 && (f = f.slice(1),
  8390. n.exec(f) && [3, 6, 9, 12].includes(f.length))) {
  8391. const d = f.length / 3
  8392. , l = [0, 0, 0];
  8393. for (let o = 0; o < 3; ++o) {
  8394. const t = parseInt(f.slice(d * o, d * o + d), 16);
  8395. l[o] = d === 1 ? t << 4 : d === 2 ? t : d === 3 ? t >> 4 : t >> 8
  8396. }
  8397. return l
  8398. }
  8399. }
  8400. ,
  8401. r.toRgbString = function (h, f = 16) {
  8402. const [d, l, o] = h;
  8403. return `rgb:${_(d, f)}/${_(l, f)}/${_(o, f)}`
  8404. }
  8405. }
  8406. ,
  8407. 5770: (x, r) => {
  8408. Object.defineProperty(r, "__esModule", {
  8409. value: !0
  8410. }),
  8411. r.PAYLOAD_LIMIT = void 0,
  8412. r.PAYLOAD_LIMIT = 1e7
  8413. }
  8414. ,
  8415. 6351: (x, r, a) => {
  8416. Object.defineProperty(r, "__esModule", {
  8417. value: !0
  8418. }),
  8419. r.DcsHandler = r.DcsParser = void 0;
  8420. const n = a(482)
  8421. , _ = a(8742)
  8422. , h = a(5770)
  8423. , f = [];
  8424. r.DcsParser = class {
  8425. constructor() {
  8426. this._handlers = Object.create(null),
  8427. this._active = f,
  8428. this._ident = 0,
  8429. this._handlerFb = () => { }
  8430. ,
  8431. this._stack = {
  8432. paused: !1,
  8433. loopPosition: 0,
  8434. fallThrough: !1
  8435. }
  8436. }
  8437. dispose() {
  8438. this._handlers = Object.create(null),
  8439. this._handlerFb = () => { }
  8440. ,
  8441. this._active = f
  8442. }
  8443. registerHandler(l, o) {
  8444. this._handlers[l] === void 0 && (this._handlers[l] = []);
  8445. const t = this._handlers[l];
  8446. return t.push(o),
  8447. {
  8448. dispose: () => {
  8449. const s = t.indexOf(o);
  8450. s !== -1 && t.splice(s, 1)
  8451. }
  8452. }
  8453. }
  8454. clearHandler(l) {
  8455. this._handlers[l] && delete this._handlers[l]
  8456. }
  8457. setHandlerFallback(l) {
  8458. this._handlerFb = l
  8459. }
  8460. reset() {
  8461. if (this._active.length)
  8462. for (let l = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; l >= 0; --l)
  8463. this._active[l].unhook(!1);
  8464. this._stack.paused = !1,
  8465. this._active = f,
  8466. this._ident = 0
  8467. }
  8468. hook(l, o) {
  8469. if (this.reset(),
  8470. this._ident = l,
  8471. this._active = this._handlers[l] || f,
  8472. this._active.length)
  8473. for (let t = this._active.length - 1; t >= 0; t--)
  8474. this._active[t].hook(o);
  8475. else
  8476. this._handlerFb(this._ident, "HOOK", o)
  8477. }
  8478. put(l, o, t) {
  8479. if (this._active.length)
  8480. for (let s = this._active.length - 1; s >= 0; s--)
  8481. this._active[s].put(l, o, t);
  8482. else
  8483. this._handlerFb(this._ident, "PUT", (0,
  8484. n.utf32ToString)(l, o, t))
  8485. }
  8486. unhook(l, o = !0) {
  8487. if (this._active.length) {
  8488. let t = !1
  8489. , s = this._active.length - 1
  8490. , e = !1;
  8491. if (this._stack.paused && (s = this._stack.loopPosition - 1,
  8492. t = o,
  8493. e = this._stack.fallThrough,
  8494. this._stack.paused = !1),
  8495. !e && t === !1) {
  8496. for (; s >= 0 && (t = this._active[s].unhook(l),
  8497. t !== !0); s--)
  8498. if (t instanceof Promise)
  8499. return this._stack.paused = !0,
  8500. this._stack.loopPosition = s,
  8501. this._stack.fallThrough = !1,
  8502. t;
  8503. s--
  8504. }
  8505. for (; s >= 0; s--)
  8506. if (t = this._active[s].unhook(!1),
  8507. t instanceof Promise)
  8508. return this._stack.paused = !0,
  8509. this._stack.loopPosition = s,
  8510. this._stack.fallThrough = !0,
  8511. t
  8512. } else
  8513. this._handlerFb(this._ident, "UNHOOK", l);
  8514. this._active = f,
  8515. this._ident = 0
  8516. }
  8517. }
  8518. ;
  8519. const d = new _.Params;
  8520. d.addParam(0),
  8521. r.DcsHandler = class {
  8522. constructor(l) {
  8523. this._handler = l,
  8524. this._data = "",
  8525. this._params = d,
  8526. this._hitLimit = !1
  8527. }
  8528. hook(l) {
  8529. this._params = l.length > 1 || l.params[0] ? l.clone() : d,
  8530. this._data = "",
  8531. this._hitLimit = !1
  8532. }
  8533. put(l, o, t) {
  8534. this._hitLimit || (this._data += (0,
  8535. n.utf32ToString)(l, o, t),
  8536. this._data.length > h.PAYLOAD_LIMIT && (this._data = "",
  8537. this._hitLimit = !0))
  8538. }
  8539. unhook(l) {
  8540. let o = !1;
  8541. if (this._hitLimit)
  8542. o = !1;
  8543. else if (l && (o = this._handler(this._data, this._params),
  8544. o instanceof Promise))
  8545. return o.then(t => (this._params = d,
  8546. this._data = "",
  8547. this._hitLimit = !1,
  8548. t));
  8549. return this._params = d,
  8550. this._data = "",
  8551. this._hitLimit = !1,
  8552. o
  8553. }
  8554. }
  8555. }
  8556. ,
  8557. 2015: (x, r, a) => {
  8558. Object.defineProperty(r, "__esModule", {
  8559. value: !0
  8560. }),
  8561. r.EscapeSequenceParser = r.VT500_TRANSITION_TABLE = r.TransitionTable = void 0;
  8562. const n = a(844)
  8563. , _ = a(8273)
  8564. , h = a(8742)
  8565. , f = a(6242)
  8566. , d = a(6351);
  8567. class l {
  8568. constructor(e) {
  8569. this.table = new Uint8Array(e)
  8570. }
  8571. setDefault(e, i) {
  8572. (0,
  8573. _.fill)(this.table, e << 4 | i)
  8574. }
  8575. add(e, i, c, g) {
  8576. this.table[i << 8 | e] = c << 4 | g
  8577. }
  8578. addMany(e, i, c, g) {
  8579. for (let v = 0; v < e.length; v++)
  8580. this.table[i << 8 | e[v]] = c << 4 | g
  8581. }
  8582. }
  8583. r.TransitionTable = l;
  8584. const o = 160;
  8585. r.VT500_TRANSITION_TABLE = function () {
  8586. const s = new l(4095)
  8587. , e = Array.apply(null, Array(256)).map((u, m) => m)
  8588. , i = (u, m) => e.slice(u, m)
  8589. , c = i(32, 127)
  8590. , g = i(0, 24);
  8591. g.push(25),
  8592. g.push.apply(g, i(28, 32));
  8593. const v = i(0, 14);
  8594. let S;
  8595. for (S in s.setDefault(1, 0),
  8596. s.addMany(c, 0, 2, 0),
  8597. v)
  8598. s.addMany([24, 26, 153, 154], S, 3, 0),
  8599. s.addMany(i(128, 144), S, 3, 0),
  8600. s.addMany(i(144, 152), S, 3, 0),
  8601. s.add(156, S, 0, 0),
  8602. s.add(27, S, 11, 1),
  8603. s.add(157, S, 4, 8),
  8604. s.addMany([152, 158, 159], S, 0, 7),
  8605. s.add(155, S, 11, 3),
  8606. s.add(144, S, 11, 9);
  8607. return s.addMany(g, 0, 3, 0),
  8608. s.addMany(g, 1, 3, 1),
  8609. s.add(127, 1, 0, 1),
  8610. s.addMany(g, 8, 0, 8),
  8611. s.addMany(g, 3, 3, 3),
  8612. s.add(127, 3, 0, 3),
  8613. s.addMany(g, 4, 3, 4),
  8614. s.add(127, 4, 0, 4),
  8615. s.addMany(g, 6, 3, 6),
  8616. s.addMany(g, 5, 3, 5),
  8617. s.add(127, 5, 0, 5),
  8618. s.addMany(g, 2, 3, 2),
  8619. s.add(127, 2, 0, 2),
  8620. s.add(93, 1, 4, 8),
  8621. s.addMany(c, 8, 5, 8),
  8622. s.add(127, 8, 5, 8),
  8623. s.addMany([156, 27, 24, 26, 7], 8, 6, 0),
  8624. s.addMany(i(28, 32), 8, 0, 8),
  8625. s.addMany([88, 94, 95], 1, 0, 7),
  8626. s.addMany(c, 7, 0, 7),
  8627. s.addMany(g, 7, 0, 7),
  8628. s.add(156, 7, 0, 0),
  8629. s.add(127, 7, 0, 7),
  8630. s.add(91, 1, 11, 3),
  8631. s.addMany(i(64, 127), 3, 7, 0),
  8632. s.addMany(i(48, 60), 3, 8, 4),
  8633. s.addMany([60, 61, 62, 63], 3, 9, 4),
  8634. s.addMany(i(48, 60), 4, 8, 4),
  8635. s.addMany(i(64, 127), 4, 7, 0),
  8636. s.addMany([60, 61, 62, 63], 4, 0, 6),
  8637. s.addMany(i(32, 64), 6, 0, 6),
  8638. s.add(127, 6, 0, 6),
  8639. s.addMany(i(64, 127), 6, 0, 0),
  8640. s.addMany(i(32, 48), 3, 9, 5),
  8641. s.addMany(i(32, 48), 5, 9, 5),
  8642. s.addMany(i(48, 64), 5, 0, 6),
  8643. s.addMany(i(64, 127), 5, 7, 0),
  8644. s.addMany(i(32, 48), 4, 9, 5),
  8645. s.addMany(i(32, 48), 1, 9, 2),
  8646. s.addMany(i(32, 48), 2, 9, 2),
  8647. s.addMany(i(48, 127), 2, 10, 0),
  8648. s.addMany(i(48, 80), 1, 10, 0),
  8649. s.addMany(i(81, 88), 1, 10, 0),
  8650. s.addMany([89, 90, 92], 1, 10, 0),
  8651. s.addMany(i(96, 127), 1, 10, 0),
  8652. s.add(80, 1, 11, 9),
  8653. s.addMany(g, 9, 0, 9),
  8654. s.add(127, 9, 0, 9),
  8655. s.addMany(i(28, 32), 9, 0, 9),
  8656. s.addMany(i(32, 48), 9, 9, 12),
  8657. s.addMany(i(48, 60), 9, 8, 10),
  8658. s.addMany([60, 61, 62, 63], 9, 9, 10),
  8659. s.addMany(g, 11, 0, 11),
  8660. s.addMany(i(32, 128), 11, 0, 11),
  8661. s.addMany(i(28, 32), 11, 0, 11),
  8662. s.addMany(g, 10, 0, 10),
  8663. s.add(127, 10, 0, 10),
  8664. s.addMany(i(28, 32), 10, 0, 10),
  8665. s.addMany(i(48, 60), 10, 8, 10),
  8666. s.addMany([60, 61, 62, 63], 10, 0, 11),
  8667. s.addMany(i(32, 48), 10, 9, 12),
  8668. s.addMany(g, 12, 0, 12),
  8669. s.add(127, 12, 0, 12),
  8670. s.addMany(i(28, 32), 12, 0, 12),
  8671. s.addMany(i(32, 48), 12, 9, 12),
  8672. s.addMany(i(48, 64), 12, 0, 11),
  8673. s.addMany(i(64, 127), 12, 12, 13),
  8674. s.addMany(i(64, 127), 10, 12, 13),
  8675. s.addMany(i(64, 127), 9, 12, 13),
  8676. s.addMany(g, 13, 13, 13),
  8677. s.addMany(c, 13, 13, 13),
  8678. s.add(127, 13, 0, 13),
  8679. s.addMany([27, 156, 24, 26], 13, 14, 0),
  8680. s.add(o, 0, 2, 0),
  8681. s.add(o, 8, 5, 8),
  8682. s.add(o, 6, 0, 6),
  8683. s.add(o, 11, 0, 11),
  8684. s.add(o, 13, 13, 13),
  8685. s
  8686. }();
  8687. class t extends n.Disposable {
  8688. constructor(e = r.VT500_TRANSITION_TABLE) {
  8689. super(),
  8690. this._transitions = e,
  8691. this._parseStack = {
  8692. state: 0,
  8693. handlers: [],
  8694. handlerPos: 0,
  8695. transition: 0,
  8696. chunkPos: 0
  8697. },
  8698. this.initialState = 0,
  8699. this.currentState = this.initialState,
  8700. this._params = new h.Params,
  8701. this._params.addParam(0),
  8702. this._collect = 0,
  8703. this.precedingCodepoint = 0,
  8704. this._printHandlerFb = (i, c, g) => { }
  8705. ,
  8706. this._executeHandlerFb = i => { }
  8707. ,
  8708. this._csiHandlerFb = (i, c) => { }
  8709. ,
  8710. this._escHandlerFb = i => { }
  8711. ,
  8712. this._errorHandlerFb = i => i,
  8713. this._printHandler = this._printHandlerFb,
  8714. this._executeHandlers = Object.create(null),
  8715. this._csiHandlers = Object.create(null),
  8716. this._escHandlers = Object.create(null),
  8717. this._oscParser = new f.OscParser,
  8718. this._dcsParser = new d.DcsParser,
  8719. this._errorHandler = this._errorHandlerFb,
  8720. this.registerEscHandler({
  8721. final: "\\"
  8722. }, () => !0)
  8723. }
  8724. _identifier(e, i = [64, 126]) {
  8725. let c = 0;
  8726. if (e.prefix) {
  8727. if (e.prefix.length > 1)
  8728. throw new Error("only one byte as prefix supported");
  8729. if (c = e.prefix.charCodeAt(0),
  8730. c && 60 > c || c > 63)
  8731. throw new Error("prefix must be in range 0x3c .. 0x3f")
  8732. }
  8733. if (e.intermediates) {
  8734. if (e.intermediates.length > 2)
  8735. throw new Error("only two bytes as intermediates are supported");
  8736. for (let v = 0; v < e.intermediates.length; ++v) {
  8737. const S = e.intermediates.charCodeAt(v);
  8738. if (32 > S || S > 47)
  8739. throw new Error("intermediate must be in range 0x20 .. 0x2f");
  8740. c <<= 8,
  8741. c |= S
  8742. }
  8743. }
  8744. if (e.final.length !== 1)
  8745. throw new Error("final must be a single byte");
  8746. const g = e.final.charCodeAt(0);
  8747. if (i[0] > g || g > i[1])
  8748. throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);
  8749. return c <<= 8,
  8750. c |= g,
  8751. c
  8752. }
  8753. identToString(e) {
  8754. const i = [];
  8755. for (; e;)
  8756. i.push(String.fromCharCode(255 & e)),
  8757. e >>= 8;
  8758. return i.reverse().join("")
  8759. }
  8760. dispose() {
  8761. this._csiHandlers = Object.create(null),
  8762. this._executeHandlers = Object.create(null),
  8763. this._escHandlers = Object.create(null),
  8764. this._oscParser.dispose(),
  8765. this._dcsParser.dispose()
  8766. }
  8767. setPrintHandler(e) {
  8768. this._printHandler = e
  8769. }
  8770. clearPrintHandler() {
  8771. this._printHandler = this._printHandlerFb
  8772. }
  8773. registerEscHandler(e, i) {
  8774. const c = this._identifier(e, [48, 126]);
  8775. this._escHandlers[c] === void 0 && (this._escHandlers[c] = []);
  8776. const g = this._escHandlers[c];
  8777. return g.push(i),
  8778. {
  8779. dispose: () => {
  8780. const v = g.indexOf(i);
  8781. v !== -1 && g.splice(v, 1)
  8782. }
  8783. }
  8784. }
  8785. clearEscHandler(e) {
  8786. this._escHandlers[this._identifier(e, [48, 126])] && delete this._escHandlers[this._identifier(e, [48, 126])]
  8787. }
  8788. setEscHandlerFallback(e) {
  8789. this._escHandlerFb = e
  8790. }
  8791. setExecuteHandler(e, i) {
  8792. this._executeHandlers[e.charCodeAt(0)] = i
  8793. }
  8794. clearExecuteHandler(e) {
  8795. this._executeHandlers[e.charCodeAt(0)] && delete this._executeHandlers[e.charCodeAt(0)]
  8796. }
  8797. setExecuteHandlerFallback(e) {
  8798. this._executeHandlerFb = e
  8799. }
  8800. registerCsiHandler(e, i) {
  8801. const c = this._identifier(e);
  8802. this._csiHandlers[c] === void 0 && (this._csiHandlers[c] = []);
  8803. const g = this._csiHandlers[c];
  8804. return g.push(i),
  8805. {
  8806. dispose: () => {
  8807. const v = g.indexOf(i);
  8808. v !== -1 && g.splice(v, 1)
  8809. }
  8810. }
  8811. }
  8812. clearCsiHandler(e) {
  8813. this._csiHandlers[this._identifier(e)] && delete this._csiHandlers[this._identifier(e)]
  8814. }
  8815. setCsiHandlerFallback(e) {
  8816. this._csiHandlerFb = e
  8817. }
  8818. registerDcsHandler(e, i) {
  8819. return this._dcsParser.registerHandler(this._identifier(e), i)
  8820. }
  8821. clearDcsHandler(e) {
  8822. this._dcsParser.clearHandler(this._identifier(e))
  8823. }
  8824. setDcsHandlerFallback(e) {
  8825. this._dcsParser.setHandlerFallback(e)
  8826. }
  8827. registerOscHandler(e, i) {
  8828. return this._oscParser.registerHandler(e, i)
  8829. }
  8830. clearOscHandler(e) {
  8831. this._oscParser.clearHandler(e)
  8832. }
  8833. setOscHandlerFallback(e) {
  8834. this._oscParser.setHandlerFallback(e)
  8835. }
  8836. setErrorHandler(e) {
  8837. this._errorHandler = e
  8838. }
  8839. clearErrorHandler() {
  8840. this._errorHandler = this._errorHandlerFb
  8841. }
  8842. reset() {
  8843. this.currentState = this.initialState,
  8844. this._oscParser.reset(),
  8845. this._dcsParser.reset(),
  8846. this._params.reset(),
  8847. this._params.addParam(0),
  8848. this._collect = 0,
  8849. this.precedingCodepoint = 0,
  8850. this._parseStack.state !== 0 && (this._parseStack.state = 2,
  8851. this._parseStack.handlers = [])
  8852. }
  8853. _preserveStack(e, i, c, g, v) {
  8854. this._parseStack.state = e,
  8855. this._parseStack.handlers = i,
  8856. this._parseStack.handlerPos = c,
  8857. this._parseStack.transition = g,
  8858. this._parseStack.chunkPos = v
  8859. }
  8860. parse(e, i, c) {
  8861. let g, v = 0, S = 0, u = 0;
  8862. if (this._parseStack.state)
  8863. if (this._parseStack.state === 2)
  8864. this._parseStack.state = 0,
  8865. u = this._parseStack.chunkPos + 1;
  8866. else {
  8867. if (c === void 0 || this._parseStack.state === 1)
  8868. throw this._parseStack.state = 1,
  8869. new Error("improper continuation due to previous async handler, giving up parsing");
  8870. const m = this._parseStack.handlers;
  8871. let w = this._parseStack.handlerPos - 1;
  8872. switch (this._parseStack.state) {
  8873. case 3:
  8874. if (c === !1 && w > -1) {
  8875. for (; w >= 0 && (g = m[w](this._params),
  8876. g !== !0); w--)
  8877. if (g instanceof Promise)
  8878. return this._parseStack.handlerPos = w,
  8879. g
  8880. }
  8881. this._parseStack.handlers = [];
  8882. break;
  8883. case 4:
  8884. if (c === !1 && w > -1) {
  8885. for (; w >= 0 && (g = m[w](),
  8886. g !== !0); w--)
  8887. if (g instanceof Promise)
  8888. return this._parseStack.handlerPos = w,
  8889. g
  8890. }
  8891. this._parseStack.handlers = [];
  8892. break;
  8893. case 6:
  8894. if (v = e[this._parseStack.chunkPos],
  8895. g = this._dcsParser.unhook(v !== 24 && v !== 26, c),
  8896. g)
  8897. return g;
  8898. v === 27 && (this._parseStack.transition |= 1),
  8899. this._params.reset(),
  8900. this._params.addParam(0),
  8901. this._collect = 0;
  8902. break;
  8903. case 5:
  8904. if (v = e[this._parseStack.chunkPos],
  8905. g = this._oscParser.end(v !== 24 && v !== 26, c),
  8906. g)
  8907. return g;
  8908. v === 27 && (this._parseStack.transition |= 1),
  8909. this._params.reset(),
  8910. this._params.addParam(0),
  8911. this._collect = 0
  8912. }
  8913. this._parseStack.state = 0,
  8914. u = this._parseStack.chunkPos + 1,
  8915. this.precedingCodepoint = 0,
  8916. this.currentState = 15 & this._parseStack.transition
  8917. }
  8918. for (let m = u; m < i; ++m) {
  8919. switch (v = e[m],
  8920. S = this._transitions.table[this.currentState << 8 | (v < 160 ? v : o)],
  8921. S >> 4) {
  8922. case 2:
  8923. for (let C = m + 1; ; ++C) {
  8924. if (C >= i || (v = e[C]) < 32 || v > 126 && v < o) {
  8925. this._printHandler(e, m, C),
  8926. m = C - 1;
  8927. break
  8928. }
  8929. if (++C >= i || (v = e[C]) < 32 || v > 126 && v < o) {
  8930. this._printHandler(e, m, C),
  8931. m = C - 1;
  8932. break
  8933. }
  8934. if (++C >= i || (v = e[C]) < 32 || v > 126 && v < o) {
  8935. this._printHandler(e, m, C),
  8936. m = C - 1;
  8937. break
  8938. }
  8939. if (++C >= i || (v = e[C]) < 32 || v > 126 && v < o) {
  8940. this._printHandler(e, m, C),
  8941. m = C - 1;
  8942. break
  8943. }
  8944. }
  8945. break;
  8946. case 3:
  8947. this._executeHandlers[v] ? this._executeHandlers[v]() : this._executeHandlerFb(v),
  8948. this.precedingCodepoint = 0;
  8949. break;
  8950. case 0:
  8951. break;
  8952. case 1:
  8953. if (this._errorHandler({
  8954. position: m,
  8955. code: v,
  8956. currentState: this.currentState,
  8957. collect: this._collect,
  8958. params: this._params,
  8959. abort: !1
  8960. }).abort)
  8961. return;
  8962. break;
  8963. case 7:
  8964. const w = this._csiHandlers[this._collect << 8 | v];
  8965. let R = w ? w.length - 1 : -1;
  8966. for (; R >= 0 && (g = w[R](this._params),
  8967. g !== !0); R--)
  8968. if (g instanceof Promise)
  8969. return this._preserveStack(3, w, R, S, m),
  8970. g;
  8971. R < 0 && this._csiHandlerFb(this._collect << 8 | v, this._params),
  8972. this.precedingCodepoint = 0;
  8973. break;
  8974. case 8:
  8975. do
  8976. switch (v) {
  8977. case 59:
  8978. this._params.addParam(0);
  8979. break;
  8980. case 58:
  8981. this._params.addSubParam(-1);
  8982. break;
  8983. default:
  8984. this._params.addDigit(v - 48)
  8985. }
  8986. while (++m < i && (v = e[m]) > 47 && v < 60);
  8987. m--;
  8988. break;
  8989. case 9:
  8990. this._collect <<= 8,
  8991. this._collect |= v;
  8992. break;
  8993. case 10:
  8994. const L = this._escHandlers[this._collect << 8 | v];
  8995. let p = L ? L.length - 1 : -1;
  8996. for (; p >= 0 && (g = L[p](),
  8997. g !== !0); p--)
  8998. if (g instanceof Promise)
  8999. return this._preserveStack(4, L, p, S, m),
  9000. g;
  9001. p < 0 && this._escHandlerFb(this._collect << 8 | v),
  9002. this.precedingCodepoint = 0;
  9003. break;
  9004. case 11:
  9005. this._params.reset(),
  9006. this._params.addParam(0),
  9007. this._collect = 0;
  9008. break;
  9009. case 12:
  9010. this._dcsParser.hook(this._collect << 8 | v, this._params);
  9011. break;
  9012. case 13:
  9013. for (let C = m + 1; ; ++C)
  9014. if (C >= i || (v = e[C]) === 24 || v === 26 || v === 27 || v > 127 && v < o) {
  9015. this._dcsParser.put(e, m, C),
  9016. m = C - 1;
  9017. break
  9018. }
  9019. break;
  9020. case 14:
  9021. if (g = this._dcsParser.unhook(v !== 24 && v !== 26),
  9022. g)
  9023. return this._preserveStack(6, [], 0, S, m),
  9024. g;
  9025. v === 27 && (S |= 1),
  9026. this._params.reset(),
  9027. this._params.addParam(0),
  9028. this._collect = 0,
  9029. this.precedingCodepoint = 0;
  9030. break;
  9031. case 4:
  9032. this._oscParser.start();
  9033. break;
  9034. case 5:
  9035. for (let C = m + 1; ; C++)
  9036. if (C >= i || (v = e[C]) < 32 || v > 127 && v < o) {
  9037. this._oscParser.put(e, m, C),
  9038. m = C - 1;
  9039. break
  9040. }
  9041. break;
  9042. case 6:
  9043. if (g = this._oscParser.end(v !== 24 && v !== 26),
  9044. g)
  9045. return this._preserveStack(5, [], 0, S, m),
  9046. g;
  9047. v === 27 && (S |= 1),
  9048. this._params.reset(),
  9049. this._params.addParam(0),
  9050. this._collect = 0,
  9051. this.precedingCodepoint = 0
  9052. }
  9053. this.currentState = 15 & S
  9054. }
  9055. }
  9056. }
  9057. r.EscapeSequenceParser = t
  9058. }
  9059. ,
  9060. 6242: (x, r, a) => {
  9061. Object.defineProperty(r, "__esModule", {
  9062. value: !0
  9063. }),
  9064. r.OscHandler = r.OscParser = void 0;
  9065. const n = a(5770)
  9066. , _ = a(482)
  9067. , h = [];
  9068. r.OscParser = class {
  9069. constructor() {
  9070. this._state = 0,
  9071. this._active = h,
  9072. this._id = -1,
  9073. this._handlers = Object.create(null),
  9074. this._handlerFb = () => { }
  9075. ,
  9076. this._stack = {
  9077. paused: !1,
  9078. loopPosition: 0,
  9079. fallThrough: !1
  9080. }
  9081. }
  9082. registerHandler(f, d) {
  9083. this._handlers[f] === void 0 && (this._handlers[f] = []);
  9084. const l = this._handlers[f];
  9085. return l.push(d),
  9086. {
  9087. dispose: () => {
  9088. const o = l.indexOf(d);
  9089. o !== -1 && l.splice(o, 1)
  9090. }
  9091. }
  9092. }
  9093. clearHandler(f) {
  9094. this._handlers[f] && delete this._handlers[f]
  9095. }
  9096. setHandlerFallback(f) {
  9097. this._handlerFb = f
  9098. }
  9099. dispose() {
  9100. this._handlers = Object.create(null),
  9101. this._handlerFb = () => { }
  9102. ,
  9103. this._active = h
  9104. }
  9105. reset() {
  9106. if (this._state === 2)
  9107. for (let f = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; f >= 0; --f)
  9108. this._active[f].end(!1);
  9109. this._stack.paused = !1,
  9110. this._active = h,
  9111. this._id = -1,
  9112. this._state = 0
  9113. }
  9114. _start() {
  9115. if (this._active = this._handlers[this._id] || h,
  9116. this._active.length)
  9117. for (let f = this._active.length - 1; f >= 0; f--)
  9118. this._active[f].start();
  9119. else
  9120. this._handlerFb(this._id, "START")
  9121. }
  9122. _put(f, d, l) {
  9123. if (this._active.length)
  9124. for (let o = this._active.length - 1; o >= 0; o--)
  9125. this._active[o].put(f, d, l);
  9126. else
  9127. this._handlerFb(this._id, "PUT", (0,
  9128. _.utf32ToString)(f, d, l))
  9129. }
  9130. start() {
  9131. this.reset(),
  9132. this._state = 1
  9133. }
  9134. put(f, d, l) {
  9135. if (this._state !== 3) {
  9136. if (this._state === 1)
  9137. for (; d < l;) {
  9138. const o = f[d++];
  9139. if (o === 59) {
  9140. this._state = 2,
  9141. this._start();
  9142. break
  9143. }
  9144. if (o < 48 || 57 < o)
  9145. return void (this._state = 3);
  9146. this._id === -1 && (this._id = 0),
  9147. this._id = 10 * this._id + o - 48
  9148. }
  9149. this._state === 2 && l - d > 0 && this._put(f, d, l)
  9150. }
  9151. }
  9152. end(f, d = !0) {
  9153. if (this._state !== 0) {
  9154. if (this._state !== 3)
  9155. if (this._state === 1 && this._start(),
  9156. this._active.length) {
  9157. let l = !1
  9158. , o = this._active.length - 1
  9159. , t = !1;
  9160. if (this._stack.paused && (o = this._stack.loopPosition - 1,
  9161. l = d,
  9162. t = this._stack.fallThrough,
  9163. this._stack.paused = !1),
  9164. !t && l === !1) {
  9165. for (; o >= 0 && (l = this._active[o].end(f),
  9166. l !== !0); o--)
  9167. if (l instanceof Promise)
  9168. return this._stack.paused = !0,
  9169. this._stack.loopPosition = o,
  9170. this._stack.fallThrough = !1,
  9171. l;
  9172. o--
  9173. }
  9174. for (; o >= 0; o--)
  9175. if (l = this._active[o].end(!1),
  9176. l instanceof Promise)
  9177. return this._stack.paused = !0,
  9178. this._stack.loopPosition = o,
  9179. this._stack.fallThrough = !0,
  9180. l
  9181. } else
  9182. this._handlerFb(this._id, "END", f);
  9183. this._active = h,
  9184. this._id = -1,
  9185. this._state = 0
  9186. }
  9187. }
  9188. }
  9189. ,
  9190. r.OscHandler = class {
  9191. constructor(f) {
  9192. this._handler = f,
  9193. this._data = "",
  9194. this._hitLimit = !1
  9195. }
  9196. start() {
  9197. this._data = "",
  9198. this._hitLimit = !1
  9199. }
  9200. put(f, d, l) {
  9201. this._hitLimit || (this._data += (0,
  9202. _.utf32ToString)(f, d, l),
  9203. this._data.length > n.PAYLOAD_LIMIT && (this._data = "",
  9204. this._hitLimit = !0))
  9205. }
  9206. end(f) {
  9207. let d = !1;
  9208. if (this._hitLimit)
  9209. d = !1;
  9210. else if (f && (d = this._handler(this._data),
  9211. d instanceof Promise))
  9212. return d.then(l => (this._data = "",
  9213. this._hitLimit = !1,
  9214. l));
  9215. return this._data = "",
  9216. this._hitLimit = !1,
  9217. d
  9218. }
  9219. }
  9220. }
  9221. ,
  9222. 8742: (x, r) => {
  9223. Object.defineProperty(r, "__esModule", {
  9224. value: !0
  9225. }),
  9226. r.Params = void 0;
  9227. const a = 2147483647;
  9228. class n {
  9229. constructor(h = 32, f = 32) {
  9230. if (this.maxLength = h,
  9231. this.maxSubParamsLength = f,
  9232. f > 256)
  9233. throw new Error("maxSubParamsLength must not be greater than 256");
  9234. this.params = new Int32Array(h),
  9235. this.length = 0,
  9236. this._subParams = new Int32Array(f),
  9237. this._subParamsLength = 0,
  9238. this._subParamsIdx = new Uint16Array(h),
  9239. this._rejectDigits = !1,
  9240. this._rejectSubDigits = !1,
  9241. this._digitIsSub = !1
  9242. }
  9243. static fromArray(h) {
  9244. const f = new n;
  9245. if (!h.length)
  9246. return f;
  9247. for (let d = Array.isArray(h[0]) ? 1 : 0; d < h.length; ++d) {
  9248. const l = h[d];
  9249. if (Array.isArray(l))
  9250. for (let o = 0; o < l.length; ++o)
  9251. f.addSubParam(l[o]);
  9252. else
  9253. f.addParam(l)
  9254. }
  9255. return f
  9256. }
  9257. clone() {
  9258. const h = new n(this.maxLength, this.maxSubParamsLength);
  9259. return h.params.set(this.params),
  9260. h.length = this.length,
  9261. h._subParams.set(this._subParams),
  9262. h._subParamsLength = this._subParamsLength,
  9263. h._subParamsIdx.set(this._subParamsIdx),
  9264. h._rejectDigits = this._rejectDigits,
  9265. h._rejectSubDigits = this._rejectSubDigits,
  9266. h._digitIsSub = this._digitIsSub,
  9267. h
  9268. }
  9269. toArray() {
  9270. const h = [];
  9271. for (let f = 0; f < this.length; ++f) {
  9272. h.push(this.params[f]);
  9273. const d = this._subParamsIdx[f] >> 8
  9274. , l = 255 & this._subParamsIdx[f];
  9275. l - d > 0 && h.push(Array.prototype.slice.call(this._subParams, d, l))
  9276. }
  9277. return h
  9278. }
  9279. reset() {
  9280. this.length = 0,
  9281. this._subParamsLength = 0,
  9282. this._rejectDigits = !1,
  9283. this._rejectSubDigits = !1,
  9284. this._digitIsSub = !1
  9285. }
  9286. addParam(h) {
  9287. if (this._digitIsSub = !1,
  9288. this.length >= this.maxLength)
  9289. this._rejectDigits = !0;
  9290. else {
  9291. if (h < -1)
  9292. throw new Error("values lesser than -1 are not allowed");
  9293. this._subParamsIdx[this.length] = this._subParamsLength << 8 | this._subParamsLength,
  9294. this.params[this.length++] = h > a ? a : h
  9295. }
  9296. }
  9297. addSubParam(h) {
  9298. if (this._digitIsSub = !0,
  9299. this.length)
  9300. if (this._rejectDigits || this._subParamsLength >= this.maxSubParamsLength)
  9301. this._rejectSubDigits = !0;
  9302. else {
  9303. if (h < -1)
  9304. throw new Error("values lesser than -1 are not allowed");
  9305. this._subParams[this._subParamsLength++] = h > a ? a : h,
  9306. this._subParamsIdx[this.length - 1]++
  9307. }
  9308. }
  9309. hasSubParams(h) {
  9310. return (255 & this._subParamsIdx[h]) - (this._subParamsIdx[h] >> 8) > 0
  9311. }
  9312. getSubParams(h) {
  9313. const f = this._subParamsIdx[h] >> 8
  9314. , d = 255 & this._subParamsIdx[h];
  9315. return d - f > 0 ? this._subParams.subarray(f, d) : null
  9316. }
  9317. getSubParamsAll() {
  9318. const h = {};
  9319. for (let f = 0; f < this.length; ++f) {
  9320. const d = this._subParamsIdx[f] >> 8
  9321. , l = 255 & this._subParamsIdx[f];
  9322. l - d > 0 && (h[f] = this._subParams.slice(d, l))
  9323. }
  9324. return h
  9325. }
  9326. addDigit(h) {
  9327. let f;
  9328. if (this._rejectDigits || !(f = this._digitIsSub ? this._subParamsLength : this.length) || this._digitIsSub && this._rejectSubDigits)
  9329. return;
  9330. const d = this._digitIsSub ? this._subParams : this.params
  9331. , l = d[f - 1];
  9332. d[f - 1] = ~l ? Math.min(10 * l + h, a) : h
  9333. }
  9334. }
  9335. r.Params = n
  9336. }
  9337. ,
  9338. 5741: (x, r) => {
  9339. Object.defineProperty(r, "__esModule", {
  9340. value: !0
  9341. }),
  9342. r.AddonManager = void 0,
  9343. r.AddonManager = class {
  9344. constructor() {
  9345. this._addons = []
  9346. }
  9347. dispose() {
  9348. for (let a = this._addons.length - 1; a >= 0; a--)
  9349. this._addons[a].instance.dispose()
  9350. }
  9351. loadAddon(a, n) {
  9352. const _ = {
  9353. instance: n,
  9354. dispose: n.dispose,
  9355. isDisposed: !1
  9356. };
  9357. this._addons.push(_),
  9358. n.dispose = () => this._wrappedAddonDispose(_),
  9359. n.activate(a)
  9360. }
  9361. _wrappedAddonDispose(a) {
  9362. if (a.isDisposed)
  9363. return;
  9364. let n = -1;
  9365. for (let _ = 0; _ < this._addons.length; _++)
  9366. if (this._addons[_] === a) {
  9367. n = _;
  9368. break
  9369. }
  9370. if (n === -1)
  9371. throw new Error("Could not dispose an addon that has not been loaded");
  9372. a.isDisposed = !0,
  9373. a.dispose.apply(a.instance),
  9374. this._addons.splice(n, 1)
  9375. }
  9376. }
  9377. }
  9378. ,
  9379. 8771: (x, r, a) => {
  9380. Object.defineProperty(r, "__esModule", {
  9381. value: !0
  9382. }),
  9383. r.BufferApiView = void 0;
  9384. const n = a(3785)
  9385. , _ = a(511);
  9386. r.BufferApiView = class {
  9387. constructor(h, f) {
  9388. this._buffer = h,
  9389. this.type = f
  9390. }
  9391. init(h) {
  9392. return this._buffer = h,
  9393. this
  9394. }
  9395. get cursorY() {
  9396. return this._buffer.y
  9397. }
  9398. get cursorX() {
  9399. return this._buffer.x
  9400. }
  9401. get viewportY() {
  9402. return this._buffer.ydisp
  9403. }
  9404. get baseY() {
  9405. return this._buffer.ybase
  9406. }
  9407. get length() {
  9408. return this._buffer.lines.length
  9409. }
  9410. getLine(h) {
  9411. const f = this._buffer.lines.get(h);
  9412. if (f)
  9413. return new n.BufferLineApiView(f)
  9414. }
  9415. getNullCell() {
  9416. return new _.CellData
  9417. }
  9418. }
  9419. }
  9420. ,
  9421. 3785: (x, r, a) => {
  9422. Object.defineProperty(r, "__esModule", {
  9423. value: !0
  9424. }),
  9425. r.BufferLineApiView = void 0;
  9426. const n = a(511);
  9427. r.BufferLineApiView = class {
  9428. constructor(_) {
  9429. this._line = _
  9430. }
  9431. get isWrapped() {
  9432. return this._line.isWrapped
  9433. }
  9434. get length() {
  9435. return this._line.length
  9436. }
  9437. getCell(_, h) {
  9438. if (!(_ < 0 || _ >= this._line.length))
  9439. return h ? (this._line.loadCell(_, h),
  9440. h) : this._line.loadCell(_, new n.CellData)
  9441. }
  9442. translateToString(_, h, f) {
  9443. return this._line.translateToString(_, h, f)
  9444. }
  9445. }
  9446. }
  9447. ,
  9448. 8285: (x, r, a) => {
  9449. Object.defineProperty(r, "__esModule", {
  9450. value: !0
  9451. }),
  9452. r.BufferNamespaceApi = void 0;
  9453. const n = a(8771)
  9454. , _ = a(8460);
  9455. r.BufferNamespaceApi = class {
  9456. constructor(h) {
  9457. this._core = h,
  9458. this._onBufferChange = new _.EventEmitter,
  9459. this._normal = new n.BufferApiView(this._core.buffers.normal, "normal"),
  9460. this._alternate = new n.BufferApiView(this._core.buffers.alt, "alternate"),
  9461. this._core.buffers.onBufferActivate(() => this._onBufferChange.fire(this.active))
  9462. }
  9463. get onBufferChange() {
  9464. return this._onBufferChange.event
  9465. }
  9466. get active() {
  9467. if (this._core.buffers.active === this._core.buffers.normal)
  9468. return this.normal;
  9469. if (this._core.buffers.active === this._core.buffers.alt)
  9470. return this.alternate;
  9471. throw new Error("Active buffer is neither normal nor alternate")
  9472. }
  9473. get normal() {
  9474. return this._normal.init(this._core.buffers.normal)
  9475. }
  9476. get alternate() {
  9477. return this._alternate.init(this._core.buffers.alt)
  9478. }
  9479. }
  9480. }
  9481. ,
  9482. 7975: (x, r) => {
  9483. Object.defineProperty(r, "__esModule", {
  9484. value: !0
  9485. }),
  9486. r.ParserApi = void 0,
  9487. r.ParserApi = class {
  9488. constructor(a) {
  9489. this._core = a
  9490. }
  9491. registerCsiHandler(a, n) {
  9492. return this._core.registerCsiHandler(a, _ => n(_.toArray()))
  9493. }
  9494. addCsiHandler(a, n) {
  9495. return this.registerCsiHandler(a, n)
  9496. }
  9497. registerDcsHandler(a, n) {
  9498. return this._core.registerDcsHandler(a, (_, h) => n(_, h.toArray()))
  9499. }
  9500. addDcsHandler(a, n) {
  9501. return this.registerDcsHandler(a, n)
  9502. }
  9503. registerEscHandler(a, n) {
  9504. return this._core.registerEscHandler(a, n)
  9505. }
  9506. addEscHandler(a, n) {
  9507. return this.registerEscHandler(a, n)
  9508. }
  9509. registerOscHandler(a, n) {
  9510. return this._core.registerOscHandler(a, n)
  9511. }
  9512. addOscHandler(a, n) {
  9513. return this.registerOscHandler(a, n)
  9514. }
  9515. }
  9516. }
  9517. ,
  9518. 7090: (x, r) => {
  9519. Object.defineProperty(r, "__esModule", {
  9520. value: !0
  9521. }),
  9522. r.UnicodeApi = void 0,
  9523. r.UnicodeApi = class {
  9524. constructor(a) {
  9525. this._core = a
  9526. }
  9527. register(a) {
  9528. this._core.unicodeService.register(a)
  9529. }
  9530. get versions() {
  9531. return this._core.unicodeService.versions
  9532. }
  9533. get activeVersion() {
  9534. return this._core.unicodeService.activeVersion
  9535. }
  9536. set activeVersion(a) {
  9537. this._core.unicodeService.activeVersion = a
  9538. }
  9539. }
  9540. }
  9541. ,
  9542. 744: function (x, r, a) {
  9543. var n = this && this.__decorate || function (t, s, e, i) {
  9544. var c, g = arguments.length, v = g < 3 ? s : i === null ? i = Object.getOwnPropertyDescriptor(s, e) : i;
  9545. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  9546. v = Reflect.decorate(t, s, e, i);
  9547. else
  9548. for (var S = t.length - 1; S >= 0; S--)
  9549. (c = t[S]) && (v = (g < 3 ? c(v) : g > 3 ? c(s, e, v) : c(s, e)) || v);
  9550. return g > 3 && v && Object.defineProperty(s, e, v),
  9551. v
  9552. }
  9553. , _ = this && this.__param || function (t, s) {
  9554. return function (e, i) {
  9555. s(e, i, t)
  9556. }
  9557. }
  9558. ;
  9559. Object.defineProperty(r, "__esModule", {
  9560. value: !0
  9561. }),
  9562. r.BufferService = r.MINIMUM_ROWS = r.MINIMUM_COLS = void 0;
  9563. const h = a(2585)
  9564. , f = a(5295)
  9565. , d = a(8460)
  9566. , l = a(844);
  9567. r.MINIMUM_COLS = 2,
  9568. r.MINIMUM_ROWS = 1;
  9569. let o = class extends l.Disposable {
  9570. constructor(t) {
  9571. super(),
  9572. this.isUserScrolling = !1,
  9573. this._onResize = new d.EventEmitter,
  9574. this._onScroll = new d.EventEmitter,
  9575. this.cols = Math.max(t.rawOptions.cols || 0, r.MINIMUM_COLS),
  9576. this.rows = Math.max(t.rawOptions.rows || 0, r.MINIMUM_ROWS),
  9577. this.buffers = new f.BufferSet(t, this)
  9578. }
  9579. get onResize() {
  9580. return this._onResize.event
  9581. }
  9582. get onScroll() {
  9583. return this._onScroll.event
  9584. }
  9585. get buffer() {
  9586. return this.buffers.active
  9587. }
  9588. dispose() {
  9589. super.dispose(),
  9590. this.buffers.dispose()
  9591. }
  9592. resize(t, s) {
  9593. this.cols = t,
  9594. this.rows = s,
  9595. this.buffers.resize(t, s),
  9596. this.buffers.setupTabStops(this.cols),
  9597. this._onResize.fire({
  9598. cols: t,
  9599. rows: s
  9600. })
  9601. }
  9602. reset() {
  9603. this.buffers.reset(),
  9604. this.isUserScrolling = !1
  9605. }
  9606. scroll(t, s = !1) {
  9607. const e = this.buffer;
  9608. let i;
  9609. i = this._cachedBlankLine,
  9610. i && i.length === this.cols && i.getFg(0) === t.fg && i.getBg(0) === t.bg || (i = e.getBlankLine(t, s),
  9611. this._cachedBlankLine = i),
  9612. i.isWrapped = s;
  9613. const c = e.ybase + e.scrollTop
  9614. , g = e.ybase + e.scrollBottom;
  9615. if (e.scrollTop === 0) {
  9616. const v = e.lines.isFull;
  9617. g === e.lines.length - 1 ? v ? e.lines.recycle().copyFrom(i) : e.lines.push(i.clone()) : e.lines.splice(g + 1, 0, i.clone()),
  9618. v ? this.isUserScrolling && (e.ydisp = Math.max(e.ydisp - 1, 0)) : (e.ybase++,
  9619. this.isUserScrolling || e.ydisp++)
  9620. } else {
  9621. const v = g - c + 1;
  9622. e.lines.shiftElements(c + 1, v - 1, -1),
  9623. e.lines.set(g, i.clone())
  9624. }
  9625. this.isUserScrolling || (e.ydisp = e.ybase),
  9626. this._onScroll.fire(e.ydisp)
  9627. }
  9628. scrollLines(t, s, e) {
  9629. const i = this.buffer;
  9630. if (t < 0) {
  9631. if (i.ydisp === 0)
  9632. return;
  9633. this.isUserScrolling = !0
  9634. } else
  9635. t + i.ydisp >= i.ybase && (this.isUserScrolling = !1);
  9636. const c = i.ydisp;
  9637. i.ydisp = Math.max(Math.min(i.ydisp + t, i.ybase), 0),
  9638. c !== i.ydisp && (s || this._onScroll.fire(i.ydisp))
  9639. }
  9640. scrollPages(t) {
  9641. this.scrollLines(t * (this.rows - 1))
  9642. }
  9643. scrollToTop() {
  9644. this.scrollLines(-this.buffer.ydisp)
  9645. }
  9646. scrollToBottom() {
  9647. this.scrollLines(this.buffer.ybase - this.buffer.ydisp)
  9648. }
  9649. scrollToLine(t) {
  9650. const s = t - this.buffer.ydisp;
  9651. s !== 0 && this.scrollLines(s)
  9652. }
  9653. }
  9654. ;
  9655. o = n([_(0, h.IOptionsService)], o),
  9656. r.BufferService = o
  9657. },
  9658. 7994: (x, r) => {
  9659. Object.defineProperty(r, "__esModule", {
  9660. value: !0
  9661. }),
  9662. r.CharsetService = void 0,
  9663. r.CharsetService = class {
  9664. constructor() {
  9665. this.glevel = 0,
  9666. this._charsets = []
  9667. }
  9668. reset() {
  9669. this.charset = void 0,
  9670. this._charsets = [],
  9671. this.glevel = 0
  9672. }
  9673. setgLevel(a) {
  9674. this.glevel = a,
  9675. this.charset = this._charsets[a]
  9676. }
  9677. setgCharset(a, n) {
  9678. this._charsets[a] = n,
  9679. this.glevel === a && (this.charset = n)
  9680. }
  9681. }
  9682. }
  9683. ,
  9684. 1753: function (x, r, a) {
  9685. var n = this && this.__decorate || function (e, i, c, g) {
  9686. var v, S = arguments.length, u = S < 3 ? i : g === null ? g = Object.getOwnPropertyDescriptor(i, c) : g;
  9687. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  9688. u = Reflect.decorate(e, i, c, g);
  9689. else
  9690. for (var m = e.length - 1; m >= 0; m--)
  9691. (v = e[m]) && (u = (S < 3 ? v(u) : S > 3 ? v(i, c, u) : v(i, c)) || u);
  9692. return S > 3 && u && Object.defineProperty(i, c, u),
  9693. u
  9694. }
  9695. , _ = this && this.__param || function (e, i) {
  9696. return function (c, g) {
  9697. i(c, g, e)
  9698. }
  9699. }
  9700. ;
  9701. Object.defineProperty(r, "__esModule", {
  9702. value: !0
  9703. }),
  9704. r.CoreMouseService = void 0;
  9705. const h = a(2585)
  9706. , f = a(8460)
  9707. , d = {
  9708. NONE: {
  9709. events: 0,
  9710. restrict: () => !1
  9711. },
  9712. X10: {
  9713. events: 1,
  9714. restrict: e => e.button !== 4 && e.action === 1 && (e.ctrl = !1,
  9715. e.alt = !1,
  9716. e.shift = !1,
  9717. !0)
  9718. },
  9719. VT200: {
  9720. events: 19,
  9721. restrict: e => e.action !== 32
  9722. },
  9723. DRAG: {
  9724. events: 23,
  9725. restrict: e => e.action !== 32 || e.button !== 3
  9726. },
  9727. ANY: {
  9728. events: 31,
  9729. restrict: e => !0
  9730. }
  9731. };
  9732. function l(e, i) {
  9733. let c = (e.ctrl ? 16 : 0) | (e.shift ? 4 : 0) | (e.alt ? 8 : 0);
  9734. return e.button === 4 ? (c |= 64,
  9735. c |= e.action) : (c |= 3 & e.button,
  9736. 4 & e.button && (c |= 64),
  9737. 8 & e.button && (c |= 128),
  9738. e.action === 32 ? c |= 32 : e.action !== 0 || i || (c |= 3)),
  9739. c
  9740. }
  9741. const o = String.fromCharCode
  9742. , t = {
  9743. DEFAULT: e => {
  9744. const i = [l(e, !1) + 32, e.col + 32, e.row + 32];
  9745. return i[0] > 255 || i[1] > 255 || i[2] > 255 ? "" : `\x1B[M${o(i[0])}${o(i[1])}${o(i[2])}`
  9746. }
  9747. ,
  9748. SGR: e => {
  9749. const i = e.action === 0 && e.button !== 4 ? "m" : "M";
  9750. return `\x1B[<${l(e, !0)};${e.col};${e.row}${i}`
  9751. }
  9752. ,
  9753. SGR_PIXELS: e => {
  9754. const i = e.action === 0 && e.button !== 4 ? "m" : "M";
  9755. return `\x1B[<${l(e, !0)};${e.x};${e.y}${i}`
  9756. }
  9757. };
  9758. let s = class {
  9759. constructor(e, i) {
  9760. this._bufferService = e,
  9761. this._coreService = i,
  9762. this._protocols = {},
  9763. this._encodings = {},
  9764. this._activeProtocol = "",
  9765. this._activeEncoding = "",
  9766. this._onProtocolChange = new f.EventEmitter,
  9767. this._lastEvent = null;
  9768. for (const c of Object.keys(d))
  9769. this.addProtocol(c, d[c]);
  9770. for (const c of Object.keys(t))
  9771. this.addEncoding(c, t[c]);
  9772. this.reset()
  9773. }
  9774. addProtocol(e, i) {
  9775. this._protocols[e] = i
  9776. }
  9777. addEncoding(e, i) {
  9778. this._encodings[e] = i
  9779. }
  9780. get activeProtocol() {
  9781. return this._activeProtocol
  9782. }
  9783. get areMouseEventsActive() {
  9784. return this._protocols[this._activeProtocol].events !== 0
  9785. }
  9786. set activeProtocol(e) {
  9787. if (!this._protocols[e])
  9788. throw new Error(`unknown protocol "${e}"`);
  9789. this._activeProtocol = e,
  9790. this._onProtocolChange.fire(this._protocols[e].events)
  9791. }
  9792. get activeEncoding() {
  9793. return this._activeEncoding
  9794. }
  9795. set activeEncoding(e) {
  9796. if (!this._encodings[e])
  9797. throw new Error(`unknown encoding "${e}"`);
  9798. this._activeEncoding = e
  9799. }
  9800. reset() {
  9801. this.activeProtocol = "NONE",
  9802. this.activeEncoding = "DEFAULT",
  9803. this._lastEvent = null
  9804. }
  9805. get onProtocolChange() {
  9806. return this._onProtocolChange.event
  9807. }
  9808. triggerMouseEvent(e) {
  9809. if (e.col < 0 || e.col >= this._bufferService.cols || e.row < 0 || e.row >= this._bufferService.rows || e.button === 4 && e.action === 32 || e.button === 3 && e.action !== 32 || e.button !== 4 && (e.action === 2 || e.action === 3) || (e.col++,
  9810. e.row++,
  9811. e.action === 32 && this._lastEvent && this._equalEvents(this._lastEvent, e, this._activeEncoding === "SGR_PIXELS")) || !this._protocols[this._activeProtocol].restrict(e))
  9812. return !1;
  9813. const i = this._encodings[this._activeEncoding](e);
  9814. return i && (this._activeEncoding === "DEFAULT" ? this._coreService.triggerBinaryEvent(i) : this._coreService.triggerDataEvent(i, !0)),
  9815. this._lastEvent = e,
  9816. !0
  9817. }
  9818. explainEvents(e) {
  9819. return {
  9820. down: !!(1 & e),
  9821. up: !!(2 & e),
  9822. drag: !!(4 & e),
  9823. move: !!(8 & e),
  9824. wheel: !!(16 & e)
  9825. }
  9826. }
  9827. _equalEvents(e, i, c) {
  9828. if (c) {
  9829. if (e.x !== i.x || e.y !== i.y)
  9830. return !1
  9831. } else if (e.col !== i.col || e.row !== i.row)
  9832. return !1;
  9833. return e.button === i.button && e.action === i.action && e.ctrl === i.ctrl && e.alt === i.alt && e.shift === i.shift
  9834. }
  9835. }
  9836. ;
  9837. s = n([_(0, h.IBufferService), _(1, h.ICoreService)], s),
  9838. r.CoreMouseService = s
  9839. },
  9840. 6975: function (x, r, a) {
  9841. var n = this && this.__decorate || function (e, i, c, g) {
  9842. var v, S = arguments.length, u = S < 3 ? i : g === null ? g = Object.getOwnPropertyDescriptor(i, c) : g;
  9843. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  9844. u = Reflect.decorate(e, i, c, g);
  9845. else
  9846. for (var m = e.length - 1; m >= 0; m--)
  9847. (v = e[m]) && (u = (S < 3 ? v(u) : S > 3 ? v(i, c, u) : v(i, c)) || u);
  9848. return S > 3 && u && Object.defineProperty(i, c, u),
  9849. u
  9850. }
  9851. , _ = this && this.__param || function (e, i) {
  9852. return function (c, g) {
  9853. i(c, g, e)
  9854. }
  9855. }
  9856. ;
  9857. Object.defineProperty(r, "__esModule", {
  9858. value: !0
  9859. }),
  9860. r.CoreService = void 0;
  9861. const h = a(2585)
  9862. , f = a(8460)
  9863. , d = a(1439)
  9864. , l = a(844)
  9865. , o = Object.freeze({
  9866. insertMode: !1
  9867. })
  9868. , t = Object.freeze({
  9869. applicationCursorKeys: !1,
  9870. applicationKeypad: !1,
  9871. bracketedPasteMode: !1,
  9872. origin: !1,
  9873. reverseWraparound: !1,
  9874. sendFocus: !1,
  9875. wraparound: !0
  9876. });
  9877. let s = class extends l.Disposable {
  9878. constructor(e, i, c, g) {
  9879. super(),
  9880. this._bufferService = i,
  9881. this._logService = c,
  9882. this._optionsService = g,
  9883. this.isCursorInitialized = !1,
  9884. this.isCursorHidden = !1,
  9885. this._onData = this.register(new f.EventEmitter),
  9886. this._onUserInput = this.register(new f.EventEmitter),
  9887. this._onBinary = this.register(new f.EventEmitter),
  9888. this._scrollToBottom = e,
  9889. this.register({
  9890. dispose: () => this._scrollToBottom = void 0
  9891. }),
  9892. this.modes = (0,
  9893. d.clone)(o),
  9894. this.decPrivateModes = (0,
  9895. d.clone)(t)
  9896. }
  9897. get onData() {
  9898. return this._onData.event
  9899. }
  9900. get onUserInput() {
  9901. return this._onUserInput.event
  9902. }
  9903. get onBinary() {
  9904. return this._onBinary.event
  9905. }
  9906. reset() {
  9907. this.modes = (0,
  9908. d.clone)(o),
  9909. this.decPrivateModes = (0,
  9910. d.clone)(t)
  9911. }
  9912. triggerDataEvent(e, i = !1) {
  9913. if (this._optionsService.rawOptions.disableStdin)
  9914. return;
  9915. const c = this._bufferService.buffer;
  9916. c.ybase !== c.ydisp && this._scrollToBottom(),
  9917. i && this._onUserInput.fire(),
  9918. this._logService.debug(`sending data "${e}"`, () => e.split("").map(g => g.charCodeAt(0))),
  9919. this._onData.fire(e)
  9920. }
  9921. triggerBinaryEvent(e) {
  9922. this._optionsService.rawOptions.disableStdin || (this._logService.debug(`sending binary "${e}"`, () => e.split("").map(i => i.charCodeAt(0))),
  9923. this._onBinary.fire(e))
  9924. }
  9925. }
  9926. ;
  9927. s = n([_(1, h.IBufferService), _(2, h.ILogService), _(3, h.IOptionsService)], s),
  9928. r.CoreService = s
  9929. },
  9930. 9074: (x, r, a) => {
  9931. Object.defineProperty(r, "__esModule", {
  9932. value: !0
  9933. }),
  9934. r.DecorationService = void 0;
  9935. const n = a(8055)
  9936. , _ = a(8460)
  9937. , h = a(844)
  9938. , f = a(6106)
  9939. , d = {
  9940. xmin: 0,
  9941. xmax: 0
  9942. };
  9943. class l extends h.Disposable {
  9944. constructor() {
  9945. super(...arguments),
  9946. this._decorations = new f.SortedList(s => s == null ? void 0 : s.marker.line),
  9947. this._onDecorationRegistered = this.register(new _.EventEmitter),
  9948. this._onDecorationRemoved = this.register(new _.EventEmitter)
  9949. }
  9950. get onDecorationRegistered() {
  9951. return this._onDecorationRegistered.event
  9952. }
  9953. get onDecorationRemoved() {
  9954. return this._onDecorationRemoved.event
  9955. }
  9956. get decorations() {
  9957. return this._decorations.values()
  9958. }
  9959. registerDecoration(s) {
  9960. if (s.marker.isDisposed)
  9961. return;
  9962. const e = new o(s);
  9963. if (e) {
  9964. const i = e.marker.onDispose(() => e.dispose());
  9965. e.onDispose(() => {
  9966. e && (this._decorations.delete(e) && this._onDecorationRemoved.fire(e),
  9967. i.dispose())
  9968. }
  9969. ),
  9970. this._decorations.insert(e),
  9971. this._onDecorationRegistered.fire(e)
  9972. }
  9973. return e
  9974. }
  9975. reset() {
  9976. for (const s of this._decorations.values())
  9977. s.dispose();
  9978. this._decorations.clear()
  9979. }
  9980. *getDecorationsAtCell(s, e, i) {
  9981. var c, g, v;
  9982. let S = 0
  9983. , u = 0;
  9984. for (const m of this._decorations.getKeyIterator(e))
  9985. S = (c = m.options.x) !== null && c !== void 0 ? c : 0,
  9986. u = S + ((g = m.options.width) !== null && g !== void 0 ? g : 1),
  9987. s >= S && s < u && (!i || ((v = m.options.layer) !== null && v !== void 0 ? v : "bottom") === i) && (yield m)
  9988. }
  9989. forEachDecorationAtCell(s, e, i, c) {
  9990. this._decorations.forEachByKey(e, g => {
  9991. var v, S, u;
  9992. d.xmin = (v = g.options.x) !== null && v !== void 0 ? v : 0,
  9993. d.xmax = d.xmin + ((S = g.options.width) !== null && S !== void 0 ? S : 1),
  9994. s >= d.xmin && s < d.xmax && (!i || ((u = g.options.layer) !== null && u !== void 0 ? u : "bottom") === i) && c(g)
  9995. }
  9996. )
  9997. }
  9998. dispose() {
  9999. for (const s of this._decorations.values())
  10000. this._onDecorationRemoved.fire(s);
  10001. this.reset()
  10002. }
  10003. }
  10004. r.DecorationService = l;
  10005. class o extends h.Disposable {
  10006. constructor(s) {
  10007. super(),
  10008. this.options = s,
  10009. this.isDisposed = !1,
  10010. this.onRenderEmitter = this.register(new _.EventEmitter),
  10011. this.onRender = this.onRenderEmitter.event,
  10012. this._onDispose = this.register(new _.EventEmitter),
  10013. this.onDispose = this._onDispose.event,
  10014. this._cachedBg = null,
  10015. this._cachedFg = null,
  10016. this.marker = s.marker,
  10017. this.options.overviewRulerOptions && !this.options.overviewRulerOptions.position && (this.options.overviewRulerOptions.position = "full")
  10018. }
  10019. get backgroundColorRGB() {
  10020. return this._cachedBg === null && (this.options.backgroundColor ? this._cachedBg = n.css.toColor(this.options.backgroundColor) : this._cachedBg = void 0),
  10021. this._cachedBg
  10022. }
  10023. get foregroundColorRGB() {
  10024. return this._cachedFg === null && (this.options.foregroundColor ? this._cachedFg = n.css.toColor(this.options.foregroundColor) : this._cachedFg = void 0),
  10025. this._cachedFg
  10026. }
  10027. dispose() {
  10028. this._isDisposed || (this._isDisposed = !0,
  10029. this._onDispose.fire(),
  10030. super.dispose())
  10031. }
  10032. }
  10033. }
  10034. ,
  10035. 3730: function (x, r, a) {
  10036. var n = this && this.__decorate || function (d, l, o, t) {
  10037. var s, e = arguments.length, i = e < 3 ? l : t === null ? t = Object.getOwnPropertyDescriptor(l, o) : t;
  10038. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  10039. i = Reflect.decorate(d, l, o, t);
  10040. else
  10041. for (var c = d.length - 1; c >= 0; c--)
  10042. (s = d[c]) && (i = (e < 3 ? s(i) : e > 3 ? s(l, o, i) : s(l, o)) || i);
  10043. return e > 3 && i && Object.defineProperty(l, o, i),
  10044. i
  10045. }
  10046. , _ = this && this.__param || function (d, l) {
  10047. return function (o, t) {
  10048. l(o, t, d)
  10049. }
  10050. }
  10051. ;
  10052. Object.defineProperty(r, "__esModule", {
  10053. value: !0
  10054. }),
  10055. r.DirtyRowService = void 0;
  10056. const h = a(2585);
  10057. let f = class {
  10058. constructor(d) {
  10059. this._bufferService = d,
  10060. this.clearRange()
  10061. }
  10062. get start() {
  10063. return this._start
  10064. }
  10065. get end() {
  10066. return this._end
  10067. }
  10068. clearRange() {
  10069. this._start = this._bufferService.buffer.y,
  10070. this._end = this._bufferService.buffer.y
  10071. }
  10072. markDirty(d) {
  10073. d < this._start ? this._start = d : d > this._end && (this._end = d)
  10074. }
  10075. markRangeDirty(d, l) {
  10076. if (d > l) {
  10077. const o = d;
  10078. d = l,
  10079. l = o
  10080. }
  10081. d < this._start && (this._start = d),
  10082. l > this._end && (this._end = l)
  10083. }
  10084. markAllDirty() {
  10085. this.markRangeDirty(0, this._bufferService.rows - 1)
  10086. }
  10087. }
  10088. ;
  10089. f = n([_(0, h.IBufferService)], f),
  10090. r.DirtyRowService = f
  10091. },
  10092. 4348: (x, r, a) => {
  10093. Object.defineProperty(r, "__esModule", {
  10094. value: !0
  10095. }),
  10096. r.InstantiationService = r.ServiceCollection = void 0;
  10097. const n = a(2585)
  10098. , _ = a(8343);
  10099. class h {
  10100. constructor(...d) {
  10101. this._entries = new Map;
  10102. for (const [l, o] of d)
  10103. this.set(l, o)
  10104. }
  10105. set(d, l) {
  10106. const o = this._entries.get(d);
  10107. return this._entries.set(d, l),
  10108. o
  10109. }
  10110. forEach(d) {
  10111. this._entries.forEach((l, o) => d(o, l))
  10112. }
  10113. has(d) {
  10114. return this._entries.has(d)
  10115. }
  10116. get(d) {
  10117. return this._entries.get(d)
  10118. }
  10119. }
  10120. r.ServiceCollection = h,
  10121. r.InstantiationService = class {
  10122. constructor() {
  10123. this._services = new h,
  10124. this._services.set(n.IInstantiationService, this)
  10125. }
  10126. setService(f, d) {
  10127. this._services.set(f, d)
  10128. }
  10129. getService(f) {
  10130. return this._services.get(f)
  10131. }
  10132. createInstance(f, ...d) {
  10133. const l = (0,
  10134. _.getServiceDependencies)(f).sort((s, e) => s.index - e.index)
  10135. , o = [];
  10136. for (const s of l) {
  10137. const e = this._services.get(s.id);
  10138. if (!e)
  10139. throw new Error(`[createInstance] ${f.name} depends on UNKNOWN service ${s.id}.`);
  10140. o.push(e)
  10141. }
  10142. const t = l.length > 0 ? l[0].index : d.length;
  10143. if (d.length !== t)
  10144. throw new Error(`[createInstance] First service dependency of ${f.name} at position ${t + 1} conflicts with ${d.length} static arguments`);
  10145. return new f(...d, ...o)
  10146. }
  10147. }
  10148. }
  10149. ,
  10150. 7866: function (x, r, a) {
  10151. var n = this && this.__decorate || function (l, o, t, s) {
  10152. var e, i = arguments.length, c = i < 3 ? o : s === null ? s = Object.getOwnPropertyDescriptor(o, t) : s;
  10153. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  10154. c = Reflect.decorate(l, o, t, s);
  10155. else
  10156. for (var g = l.length - 1; g >= 0; g--)
  10157. (e = l[g]) && (c = (i < 3 ? e(c) : i > 3 ? e(o, t, c) : e(o, t)) || c);
  10158. return i > 3 && c && Object.defineProperty(o, t, c),
  10159. c
  10160. }
  10161. , _ = this && this.__param || function (l, o) {
  10162. return function (t, s) {
  10163. o(t, s, l)
  10164. }
  10165. }
  10166. ;
  10167. Object.defineProperty(r, "__esModule", {
  10168. value: !0
  10169. }),
  10170. r.LogService = void 0;
  10171. const h = a(2585)
  10172. , f = {
  10173. debug: h.LogLevelEnum.DEBUG,
  10174. info: h.LogLevelEnum.INFO,
  10175. warn: h.LogLevelEnum.WARN,
  10176. error: h.LogLevelEnum.ERROR,
  10177. off: h.LogLevelEnum.OFF
  10178. };
  10179. let d = class {
  10180. constructor(l) {
  10181. this._optionsService = l,
  10182. this.logLevel = h.LogLevelEnum.OFF,
  10183. this._updateLogLevel(),
  10184. this._optionsService.onOptionChange(o => {
  10185. o === "logLevel" && this._updateLogLevel()
  10186. }
  10187. )
  10188. }
  10189. _updateLogLevel() {
  10190. this.logLevel = f[this._optionsService.rawOptions.logLevel]
  10191. }
  10192. _evalLazyOptionalParams(l) {
  10193. for (let o = 0; o < l.length; o++)
  10194. typeof l[o] == "function" && (l[o] = l[o]())
  10195. }
  10196. _log(l, o, t) {
  10197. this._evalLazyOptionalParams(t),
  10198. l.call(console, "xterm.js: " + o, ...t)
  10199. }
  10200. debug(l, ...o) {
  10201. this.logLevel <= h.LogLevelEnum.DEBUG && this._log(console.log, l, o)
  10202. }
  10203. info(l, ...o) {
  10204. this.logLevel <= h.LogLevelEnum.INFO && this._log(console.info, l, o)
  10205. }
  10206. warn(l, ...o) {
  10207. this.logLevel <= h.LogLevelEnum.WARN && this._log(console.warn, l, o)
  10208. }
  10209. error(l, ...o) {
  10210. this.logLevel <= h.LogLevelEnum.ERROR && this._log(console.error, l, o)
  10211. }
  10212. }
  10213. ;
  10214. d = n([_(0, h.IOptionsService)], d),
  10215. r.LogService = d
  10216. },
  10217. 7302: (x, r, a) => {
  10218. Object.defineProperty(r, "__esModule", {
  10219. value: !0
  10220. }),
  10221. r.OptionsService = r.DEFAULT_OPTIONS = void 0;
  10222. const n = a(8460)
  10223. , _ = a(6114);
  10224. r.DEFAULT_OPTIONS = {
  10225. cols: 80,
  10226. rows: 24,
  10227. cursorBlink: !1,
  10228. cursorStyle: "block",
  10229. cursorWidth: 1,
  10230. customGlyphs: !0,
  10231. drawBoldTextInBrightColors: !0,
  10232. fastScrollModifier: "alt",
  10233. fastScrollSensitivity: 5,
  10234. fontFamily: "courier-new, courier, monospace",
  10235. fontSize: 15,
  10236. fontWeight: "normal",
  10237. fontWeightBold: "bold",
  10238. lineHeight: 1,
  10239. letterSpacing: 0,
  10240. linkHandler: null,
  10241. logLevel: "info",
  10242. scrollback: 1e3,
  10243. scrollSensitivity: 1,
  10244. screenReaderMode: !1,
  10245. smoothScrollDuration: 0,
  10246. macOptionIsMeta: !1,
  10247. macOptionClickForcesSelection: !1,
  10248. minimumContrastRatio: 1,
  10249. disableStdin: !1,
  10250. allowProposedApi: !1,
  10251. allowTransparency: !1,
  10252. tabStopWidth: 8,
  10253. theme: {},
  10254. rightClickSelectsWord: _.isMac,
  10255. windowOptions: {},
  10256. windowsMode: !1,
  10257. wordSeparator: " ()[]{}',\"`",
  10258. altClickMovesCursor: !0,
  10259. convertEol: !1,
  10260. termName: "xterm",
  10261. cancelEvents: !1,
  10262. overviewRulerWidth: 0
  10263. };
  10264. const h = ["normal", "bold", "100", "200", "300", "400", "500", "600", "700", "800", "900"];
  10265. r.OptionsService = class {
  10266. constructor(f) {
  10267. this._onOptionChange = new n.EventEmitter;
  10268. const d = Object.assign({}, r.DEFAULT_OPTIONS);
  10269. for (const l in f)
  10270. if (l in d)
  10271. try {
  10272. const o = f[l];
  10273. d[l] = this._sanitizeAndValidateOption(l, o)
  10274. } catch (o) {
  10275. console.error(o)
  10276. }
  10277. this.rawOptions = d,
  10278. this.options = Object.assign({}, d),
  10279. this._setupOptions()
  10280. }
  10281. get onOptionChange() {
  10282. return this._onOptionChange.event
  10283. }
  10284. _setupOptions() {
  10285. const f = l => {
  10286. if (!(l in r.DEFAULT_OPTIONS))
  10287. throw new Error(`No option with key "${l}"`);
  10288. return this.rawOptions[l]
  10289. }
  10290. , d = (l, o) => {
  10291. if (!(l in r.DEFAULT_OPTIONS))
  10292. throw new Error(`No option with key "${l}"`);
  10293. o = this._sanitizeAndValidateOption(l, o),
  10294. this.rawOptions[l] !== o && (this.rawOptions[l] = o,
  10295. this._onOptionChange.fire(l))
  10296. }
  10297. ;
  10298. for (const l in this.rawOptions) {
  10299. const o = {
  10300. get: f.bind(this, l),
  10301. set: d.bind(this, l)
  10302. };
  10303. Object.defineProperty(this.options, l, o)
  10304. }
  10305. }
  10306. _sanitizeAndValidateOption(f, d) {
  10307. switch (f) {
  10308. case "cursorStyle":
  10309. if (d || (d = r.DEFAULT_OPTIONS[f]),
  10310. !function (l) {
  10311. return l === "block" || l === "underline" || l === "bar"
  10312. }(d))
  10313. throw new Error(`"${d}" is not a valid value for ${f}`);
  10314. break;
  10315. case "wordSeparator":
  10316. d || (d = r.DEFAULT_OPTIONS[f]);
  10317. break;
  10318. case "fontWeight":
  10319. case "fontWeightBold":
  10320. if (typeof d == "number" && 1 <= d && d <= 1e3)
  10321. break;
  10322. d = h.includes(d) ? d : r.DEFAULT_OPTIONS[f];
  10323. break;
  10324. case "cursorWidth":
  10325. d = Math.floor(d);
  10326. case "lineHeight":
  10327. case "tabStopWidth":
  10328. if (d < 1)
  10329. throw new Error(`${f} cannot be less than 1, value: ${d}`);
  10330. break;
  10331. case "minimumContrastRatio":
  10332. d = Math.max(1, Math.min(21, Math.round(10 * d) / 10));
  10333. break;
  10334. case "scrollback":
  10335. if ((d = Math.min(d, 4294967295)) < 0)
  10336. throw new Error(`${f} cannot be less than 0, value: ${d}`);
  10337. break;
  10338. case "fastScrollSensitivity":
  10339. case "scrollSensitivity":
  10340. if (d <= 0)
  10341. throw new Error(`${f} cannot be less than or equal to 0, value: ${d}`);
  10342. case "rows":
  10343. case "cols":
  10344. if (!d && d !== 0)
  10345. throw new Error(`${f} must be numeric, value: ${d}`)
  10346. }
  10347. return d
  10348. }
  10349. }
  10350. }
  10351. ,
  10352. 2660: function (x, r, a) {
  10353. var n = this && this.__decorate || function (d, l, o, t) {
  10354. var s, e = arguments.length, i = e < 3 ? l : t === null ? t = Object.getOwnPropertyDescriptor(l, o) : t;
  10355. if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
  10356. i = Reflect.decorate(d, l, o, t);
  10357. else
  10358. for (var c = d.length - 1; c >= 0; c--)
  10359. (s = d[c]) && (i = (e < 3 ? s(i) : e > 3 ? s(l, o, i) : s(l, o)) || i);
  10360. return e > 3 && i && Object.defineProperty(l, o, i),
  10361. i
  10362. }
  10363. , _ = this && this.__param || function (d, l) {
  10364. return function (o, t) {
  10365. l(o, t, d)
  10366. }
  10367. }
  10368. ;
  10369. Object.defineProperty(r, "__esModule", {
  10370. value: !0
  10371. }),
  10372. r.OscLinkService = void 0;
  10373. const h = a(2585);
  10374. let f = class {
  10375. constructor(d) {
  10376. this._bufferService = d,
  10377. this._nextId = 1,
  10378. this._entriesWithId = new Map,
  10379. this._dataByLinkId = new Map
  10380. }
  10381. registerLink(d) {
  10382. const l = this._bufferService.buffer;
  10383. if (d.id === void 0) {
  10384. const c = l.addMarker(l.ybase + l.y)
  10385. , g = {
  10386. data: d,
  10387. id: this._nextId++,
  10388. lines: [c]
  10389. };
  10390. return c.onDispose(() => this._removeMarkerFromLink(g, c)),
  10391. this._dataByLinkId.set(g.id, g),
  10392. g.id
  10393. }
  10394. const o = d
  10395. , t = this._getEntryIdKey(o)
  10396. , s = this._entriesWithId.get(t);
  10397. if (s)
  10398. return this.addLineToLink(s.id, l.ybase + l.y),
  10399. s.id;
  10400. const e = l.addMarker(l.ybase + l.y)
  10401. , i = {
  10402. id: this._nextId++,
  10403. key: this._getEntryIdKey(o),
  10404. data: o,
  10405. lines: [e]
  10406. };
  10407. return e.onDispose(() => this._removeMarkerFromLink(i, e)),
  10408. this._entriesWithId.set(i.key, i),
  10409. this._dataByLinkId.set(i.id, i),
  10410. i.id
  10411. }
  10412. addLineToLink(d, l) {
  10413. const o = this._dataByLinkId.get(d);
  10414. if (o && o.lines.every(t => t.line !== l)) {
  10415. const t = this._bufferService.buffer.addMarker(l);
  10416. o.lines.push(t),
  10417. t.onDispose(() => this._removeMarkerFromLink(o, t))
  10418. }
  10419. }
  10420. getLinkData(d) {
  10421. var l;
  10422. return (l = this._dataByLinkId.get(d)) === null || l === void 0 ? void 0 : l.data
  10423. }
  10424. _getEntryIdKey(d) {
  10425. return `${d.id};;${d.uri}`
  10426. }
  10427. _removeMarkerFromLink(d, l) {
  10428. const o = d.lines.indexOf(l);
  10429. o !== -1 && (d.lines.splice(o, 1),
  10430. d.lines.length === 0 && (d.data.id !== void 0 && this._entriesWithId.delete(d.key),
  10431. this._dataByLinkId.delete(d.id)))
  10432. }
  10433. }
  10434. ;
  10435. f = n([_(0, h.IBufferService)], f),
  10436. r.OscLinkService = f
  10437. },
  10438. 8343: (x, r) => {
  10439. function a(n, _, h) {
  10440. _.di$target === _ ? _.di$dependencies.push({
  10441. id: n,
  10442. index: h
  10443. }) : (_.di$dependencies = [{
  10444. id: n,
  10445. index: h
  10446. }],
  10447. _.di$target = _)
  10448. }
  10449. Object.defineProperty(r, "__esModule", {
  10450. value: !0
  10451. }),
  10452. r.createDecorator = r.getServiceDependencies = r.serviceRegistry = void 0,
  10453. r.serviceRegistry = new Map,
  10454. r.getServiceDependencies = function (n) {
  10455. return n.di$dependencies || []
  10456. }
  10457. ,
  10458. r.createDecorator = function (n) {
  10459. if (r.serviceRegistry.has(n))
  10460. return r.serviceRegistry.get(n);
  10461. const _ = function (h, f, d) {
  10462. if (arguments.length !== 3)
  10463. throw new Error("@IServiceName-decorator can only be used to decorate a parameter");
  10464. a(_, h, d)
  10465. };
  10466. return _.toString = () => n,
  10467. r.serviceRegistry.set(n, _),
  10468. _
  10469. }
  10470. }
  10471. ,
  10472. 2585: (x, r, a) => {
  10473. Object.defineProperty(r, "__esModule", {
  10474. value: !0
  10475. }),
  10476. r.IDecorationService = r.IUnicodeService = r.IOscLinkService = r.IOptionsService = r.ILogService = r.LogLevelEnum = r.IInstantiationService = r.IDirtyRowService = r.ICharsetService = r.ICoreService = r.ICoreMouseService = r.IBufferService = void 0;
  10477. const n = a(8343);
  10478. var _;
  10479. r.IBufferService = (0,
  10480. n.createDecorator)("BufferService"),
  10481. r.ICoreMouseService = (0,
  10482. n.createDecorator)("CoreMouseService"),
  10483. r.ICoreService = (0,
  10484. n.createDecorator)("CoreService"),
  10485. r.ICharsetService = (0,
  10486. n.createDecorator)("CharsetService"),
  10487. r.IDirtyRowService = (0,
  10488. n.createDecorator)("DirtyRowService"),
  10489. r.IInstantiationService = (0,
  10490. n.createDecorator)("InstantiationService"),
  10491. (_ = r.LogLevelEnum || (r.LogLevelEnum = {}))[_.DEBUG = 0] = "DEBUG",
  10492. _[_.INFO = 1] = "INFO",
  10493. _[_.WARN = 2] = "WARN",
  10494. _[_.ERROR = 3] = "ERROR",
  10495. _[_.OFF = 4] = "OFF",
  10496. r.ILogService = (0,
  10497. n.createDecorator)("LogService"),
  10498. r.IOptionsService = (0,
  10499. n.createDecorator)("OptionsService"),
  10500. r.IOscLinkService = (0,
  10501. n.createDecorator)("OscLinkService"),
  10502. r.IUnicodeService = (0,
  10503. n.createDecorator)("UnicodeService"),
  10504. r.IDecorationService = (0,
  10505. n.createDecorator)("DecorationService")
  10506. }
  10507. ,
  10508. 1480: (x, r, a) => {
  10509. Object.defineProperty(r, "__esModule", {
  10510. value: !0
  10511. }),
  10512. r.UnicodeService = void 0;
  10513. const n = a(8460)
  10514. , _ = a(225);
  10515. r.UnicodeService = class {
  10516. constructor() {
  10517. this._providers = Object.create(null),
  10518. this._active = "",
  10519. this._onChange = new n.EventEmitter;
  10520. const h = new _.UnicodeV6;
  10521. this.register(h),
  10522. this._active = h.version,
  10523. this._activeProvider = h
  10524. }
  10525. get onChange() {
  10526. return this._onChange.event
  10527. }
  10528. get versions() {
  10529. return Object.keys(this._providers)
  10530. }
  10531. get activeVersion() {
  10532. return this._active
  10533. }
  10534. set activeVersion(h) {
  10535. if (!this._providers[h])
  10536. throw new Error(`unknown Unicode version "${h}"`);
  10537. this._active = h,
  10538. this._activeProvider = this._providers[h],
  10539. this._onChange.fire(h)
  10540. }
  10541. register(h) {
  10542. this._providers[h.version] = h
  10543. }
  10544. wcwidth(h) {
  10545. return this._activeProvider.wcwidth(h)
  10546. }
  10547. getStringCellWidth(h) {
  10548. let f = 0;
  10549. const d = h.length;
  10550. for (let l = 0; l < d; ++l) {
  10551. let o = h.charCodeAt(l);
  10552. if (55296 <= o && o <= 56319) {
  10553. if (++l >= d)
  10554. return f + this.wcwidth(o);
  10555. const t = h.charCodeAt(l);
  10556. 56320 <= t && t <= 57343 ? o = 1024 * (o - 55296) + t - 56320 + 65536 : f += this.wcwidth(t)
  10557. }
  10558. f += this.wcwidth(o)
  10559. }
  10560. return f
  10561. }
  10562. }
  10563. }
  10564. }
  10565. , G = {};
  10566. function U(x) {
  10567. var r = G[x];
  10568. if (r !== void 0)
  10569. return r.exports;
  10570. var a = G[x] = {
  10571. exports: {}
  10572. };
  10573. return V[x].call(a.exports, a, a.exports, U),
  10574. a.exports
  10575. }
  10576. var q = {};
  10577. return (() => {
  10578. var x = q;
  10579. Object.defineProperty(x, "__esModule", {
  10580. value: !0
  10581. }),
  10582. x.Terminal = void 0;
  10583. const r = U(3236)
  10584. , a = U(9042)
  10585. , n = U(7975)
  10586. , _ = U(7090)
  10587. , h = U(5741)
  10588. , f = U(8285)
  10589. , d = ["cols", "rows"];
  10590. x.Terminal = class {
  10591. constructor(l) {
  10592. this._core = new r.Terminal(l),
  10593. this._addonManager = new h.AddonManager,
  10594. this._publicOptions = Object.assign({}, this._core.options);
  10595. const o = s => this._core.options[s]
  10596. , t = (s, e) => {
  10597. this._checkReadonlyOptions(s),
  10598. this._core.options[s] = e
  10599. }
  10600. ;
  10601. for (const s in this._core.options) {
  10602. const e = {
  10603. get: o.bind(this, s),
  10604. set: t.bind(this, s)
  10605. };
  10606. Object.defineProperty(this._publicOptions, s, e)
  10607. }
  10608. }
  10609. _checkReadonlyOptions(l) {
  10610. if (d.includes(l))
  10611. throw new Error(`Option "${l}" can only be set in the constructor`)
  10612. }
  10613. _checkProposedApi() {
  10614. if (!this._core.optionsService.rawOptions.allowProposedApi)
  10615. throw new Error("You must set the allowProposedApi option to true to use proposed API")
  10616. }
  10617. get onBell() {
  10618. return this._core.onBell
  10619. }
  10620. get onBinary() {
  10621. return this._core.onBinary
  10622. }
  10623. get onCursorMove() {
  10624. return this._core.onCursorMove
  10625. }
  10626. get onData() {
  10627. return this._core.onData
  10628. }
  10629. get onKey() {
  10630. return this._core.onKey
  10631. }
  10632. get onLineFeed() {
  10633. return this._core.onLineFeed
  10634. }
  10635. get onRender() {
  10636. return this._core.onRender
  10637. }
  10638. get onResize() {
  10639. return this._core.onResize
  10640. }
  10641. get onScroll() {
  10642. return this._core.onScroll
  10643. }
  10644. get onSelectionChange() {
  10645. return this._core.onSelectionChange
  10646. }
  10647. get onTitleChange() {
  10648. return this._core.onTitleChange
  10649. }
  10650. get onWriteParsed() {
  10651. return this._core.onWriteParsed
  10652. }
  10653. get element() {
  10654. return this._core.element
  10655. }
  10656. get parser() {
  10657. return this._checkProposedApi(),
  10658. this._parser || (this._parser = new n.ParserApi(this._core)),
  10659. this._parser
  10660. }
  10661. get unicode() {
  10662. return this._checkProposedApi(),
  10663. new _.UnicodeApi(this._core)
  10664. }
  10665. get textarea() {
  10666. return this._core.textarea
  10667. }
  10668. get rows() {
  10669. return this._core.rows
  10670. }
  10671. get cols() {
  10672. return this._core.cols
  10673. }
  10674. get buffer() {
  10675. return this._checkProposedApi(),
  10676. this._buffer || (this._buffer = new f.BufferNamespaceApi(this._core)),
  10677. this._buffer
  10678. }
  10679. get markers() {
  10680. return this._checkProposedApi(),
  10681. this._core.markers
  10682. }
  10683. get modes() {
  10684. const l = this._core.coreService.decPrivateModes;
  10685. let o = "none";
  10686. switch (this._core.coreMouseService.activeProtocol) {
  10687. case "X10":
  10688. o = "x10";
  10689. break;
  10690. case "VT200":
  10691. o = "vt200";
  10692. break;
  10693. case "DRAG":
  10694. o = "drag";
  10695. break;
  10696. case "ANY":
  10697. o = "any"
  10698. }
  10699. return {
  10700. applicationCursorKeysMode: l.applicationCursorKeys,
  10701. applicationKeypadMode: l.applicationKeypad,
  10702. bracketedPasteMode: l.bracketedPasteMode,
  10703. insertMode: this._core.coreService.modes.insertMode,
  10704. mouseTrackingMode: o,
  10705. originMode: l.origin,
  10706. reverseWraparoundMode: l.reverseWraparound,
  10707. sendFocusMode: l.sendFocus,
  10708. wraparoundMode: l.wraparound
  10709. }
  10710. }
  10711. get options() {
  10712. return this._publicOptions
  10713. }
  10714. set options(l) {
  10715. for (const o in l)
  10716. this._publicOptions[o] = l[o]
  10717. }
  10718. blur() {
  10719. this._core.blur()
  10720. }
  10721. focus() {
  10722. this._core.focus()
  10723. }
  10724. resize(l, o) {
  10725. this._verifyIntegers(l, o),
  10726. this._core.resize(l, o)
  10727. }
  10728. open(l) {
  10729. this._core.open(l)
  10730. }
  10731. attachCustomKeyEventHandler(l) {
  10732. this._core.attachCustomKeyEventHandler(l)
  10733. }
  10734. registerLinkProvider(l) {
  10735. return this._checkProposedApi(),
  10736. this._core.registerLinkProvider(l)
  10737. }
  10738. registerCharacterJoiner(l) {
  10739. return this._checkProposedApi(),
  10740. this._core.registerCharacterJoiner(l)
  10741. }
  10742. deregisterCharacterJoiner(l) {
  10743. this._checkProposedApi(),
  10744. this._core.deregisterCharacterJoiner(l)
  10745. }
  10746. registerMarker(l = 0) {
  10747. return this._verifyIntegers(l),
  10748. this._core.addMarker(l)
  10749. }
  10750. registerDecoration(l) {
  10751. var o, t, s;
  10752. return this._checkProposedApi(),
  10753. this._verifyPositiveIntegers((o = l.x) !== null && o !== void 0 ? o : 0, (t = l.width) !== null && t !== void 0 ? t : 0, (s = l.height) !== null && s !== void 0 ? s : 0),
  10754. this._core.registerDecoration(l)
  10755. }
  10756. hasSelection() {
  10757. return this._core.hasSelection()
  10758. }
  10759. select(l, o, t) {
  10760. this._verifyIntegers(l, o, t),
  10761. this._core.select(l, o, t)
  10762. }
  10763. getSelection() {
  10764. return this._core.getSelection()
  10765. }
  10766. getSelectionPosition() {
  10767. return this._core.getSelectionPosition()
  10768. }
  10769. clearSelection() {
  10770. this._core.clearSelection()
  10771. }
  10772. selectAll() {
  10773. this._core.selectAll()
  10774. }
  10775. selectLines(l, o) {
  10776. this._verifyIntegers(l, o),
  10777. this._core.selectLines(l, o)
  10778. }
  10779. dispose() {
  10780. this._addonManager.dispose(),
  10781. this._core.dispose()
  10782. }
  10783. scrollLines(l) {
  10784. this._verifyIntegers(l),
  10785. this._core.scrollLines(l)
  10786. }
  10787. scrollPages(l) {
  10788. this._verifyIntegers(l),
  10789. this._core.scrollPages(l)
  10790. }
  10791. scrollToTop() {
  10792. this._core.scrollToTop()
  10793. }
  10794. scrollToBottom() {
  10795. this._core.scrollToBottom()
  10796. }
  10797. scrollToLine(l) {
  10798. this._verifyIntegers(l),
  10799. this._core.scrollToLine(l)
  10800. }
  10801. clear() {
  10802. this._core.clear()
  10803. }
  10804. write(l, o) {
  10805. this._core.write(l, o)
  10806. }
  10807. writeln(l, o) {
  10808. this._core.write(l),
  10809. this._core.write(`\r
  10810. `, o)
  10811. }
  10812. paste(l) {
  10813. this._core.paste(l)
  10814. }
  10815. refresh(l, o) {
  10816. this._verifyIntegers(l, o),
  10817. this._core.refresh(l, o)
  10818. }
  10819. reset() {
  10820. this._core.reset()
  10821. }
  10822. clearTextureAtlas() {
  10823. this._core.clearTextureAtlas()
  10824. }
  10825. loadAddon(l) {
  10826. return this._addonManager.loadAddon(this, l)
  10827. }
  10828. static get strings() {
  10829. return a
  10830. }
  10831. _verifyIntegers(...l) {
  10832. for (const o of l)
  10833. if (o === 1 / 0 || isNaN(o) || o % 1 != 0)
  10834. throw new Error("This API only accepts integers")
  10835. }
  10836. _verifyPositiveIntegers(...l) {
  10837. for (const o of l)
  10838. if (o && (o === 1 / 0 || isNaN(o) || o % 1 != 0 || o < 0))
  10839. throw new Error("This API only accepts positive integers")
  10840. }
  10841. }
  10842. }
  10843. )(),
  10844. q
  10845. }
  10846. )()
  10847. })
  10848. }
  10849. )(Ce);
  10850. var ye = {
  10851. exports: {}
  10852. };
  10853. (function (z, W) {
  10854. (function (V, G) {
  10855. z.exports = G()
  10856. }
  10857. )(self, function () {
  10858. return (() => {
  10859. var V = {};
  10860. return (() => {
  10861. var G = V;
  10862. Object.defineProperty(G, "__esModule", {
  10863. value: !0
  10864. }),
  10865. G.FitAddon = void 0,
  10866. G.FitAddon = class {
  10867. constructor() { }
  10868. activate(U) {
  10869. this._terminal = U
  10870. }
  10871. dispose() { }
  10872. fit() {
  10873. const U = this.proposeDimensions();
  10874. if (!U || !this._terminal || isNaN(U.cols) || isNaN(U.rows))
  10875. return;
  10876. const q = this._terminal._core;
  10877. this._terminal.rows === U.rows && this._terminal.cols === U.cols || (q._renderService.clear(),
  10878. this._terminal.resize(U.cols, U.rows))
  10879. }
  10880. proposeDimensions() {
  10881. if (!this._terminal || !this._terminal.element || !this._terminal.element.parentElement)
  10882. return;
  10883. const U = this._terminal._core;
  10884. if (U._renderService.dimensions.actualCellWidth === 0 || U._renderService.dimensions.actualCellHeight === 0)
  10885. return;
  10886. const q = this._terminal.options.scrollback === 0 ? 0 : U.viewport.scrollBarWidth
  10887. , x = window.getComputedStyle(this._terminal.element.parentElement)
  10888. , r = parseInt(x.getPropertyValue("height"))
  10889. , a = Math.max(0, parseInt(x.getPropertyValue("width")))
  10890. , n = window.getComputedStyle(this._terminal.element)
  10891. , _ = r - (parseInt(n.getPropertyValue("padding-top")) + parseInt(n.getPropertyValue("padding-bottom")))
  10892. , h = a - (parseInt(n.getPropertyValue("padding-right")) + parseInt(n.getPropertyValue("padding-left"))) - q;
  10893. return {
  10894. cols: Math.max(2, Math.floor(h / U._renderService.dimensions.actualCellWidth)),
  10895. rows: Math.max(1, Math.floor(_ / U._renderService.dimensions.actualCellHeight))
  10896. }
  10897. }
  10898. }
  10899. }
  10900. )(),
  10901. V
  10902. }
  10903. )()
  10904. })
  10905. }
  10906. )(ye);
  10907. var fe = {};
  10908. (function (z) {
  10909. Object.defineProperty(z, "__esModule", {
  10910. value: !0
  10911. }),
  10912. z.serial = z.SerialPort = z.SerialPolyfillProtocol = void 0;
  10913. var W;
  10914. (function (g) {
  10915. g[g.UsbCdcAcm = 0] = "UsbCdcAcm"
  10916. }
  10917. )(W = z.SerialPolyfillProtocol || (z.SerialPolyfillProtocol = {}));
  10918. const V = 32
  10919. , G = 34
  10920. , U = 35
  10921. , q = 255
  10922. , x = 8
  10923. , r = "none"
  10924. , a = 1
  10925. , n = [16, 8, 7, 6, 5]
  10926. , _ = [1, 2]
  10927. , h = ["none", "even", "odd"]
  10928. , f = ["none", "odd", "even"]
  10929. , d = [1, 1.5, 2]
  10930. , l = {
  10931. protocol: W.UsbCdcAcm,
  10932. usbControlInterfaceClass: 2,
  10933. usbTransferInterfaceClass: 10
  10934. };
  10935. function o(g, v) {
  10936. const S = g.configurations[0];
  10937. for (const u of S.interfaces)
  10938. if (u.alternates[0].interfaceClass === v)
  10939. return u;
  10940. throw new TypeError(`Unable to find interface with class ${v}.`)
  10941. }
  10942. function t(g, v) {
  10943. const S = g.alternates[0];
  10944. for (const u of S.endpoints)
  10945. if (u.direction == v)
  10946. return u;
  10947. throw new TypeError(`Interface ${g.interfaceNumber} does not have an ${v} endpoint.`)
  10948. }
  10949. class s {
  10950. constructor(v, S, u) {
  10951. this.type = "bytes",
  10952. this.device_ = v,
  10953. this.endpoint_ = S,
  10954. this.onError_ = u
  10955. }
  10956. pull(v) {
  10957. (async () => {
  10958. var S;
  10959. let u;
  10960. if (v.desiredSize) {
  10961. const m = v.desiredSize / this.endpoint_.packetSize;
  10962. u = Math.ceil(m) * this.endpoint_.packetSize
  10963. } else
  10964. u = this.endpoint_.packetSize;
  10965. try {
  10966. const m = await this.device_.transferIn(this.endpoint_.endpointNumber, u);
  10967. if (m.status != "ok" && (v.error(`USB error: ${m.status}`),
  10968. this.onError_()),
  10969. !((S = m.data) === null || S === void 0) && S.buffer) {
  10970. const w = new Uint8Array(m.data.buffer, m.data.byteOffset, m.data.byteLength);
  10971. v.enqueue(w)
  10972. }
  10973. } catch (m) {
  10974. v.error(m.toString()),
  10975. this.onError_()
  10976. }
  10977. }
  10978. )()
  10979. }
  10980. }
  10981. class e {
  10982. constructor(v, S, u) {
  10983. this.device_ = v,
  10984. this.endpoint_ = S,
  10985. this.onError_ = u
  10986. }
  10987. async write(v, S) {
  10988. try {
  10989. const u = await this.device_.transferOut(this.endpoint_.endpointNumber, v);
  10990. u.status != "ok" && (S.error(u.status),
  10991. this.onError_())
  10992. } catch (u) {
  10993. S.error(u.toString()),
  10994. this.onError_()
  10995. }
  10996. }
  10997. }
  10998. class i {
  10999. constructor(v, S) {
  11000. this.polyfillOptions_ = Object.assign(Object.assign({}, l), S),
  11001. this.outputSignals_ = {
  11002. dataTerminalReady: !1,
  11003. requestToSend: !1,
  11004. break: !1
  11005. },
  11006. this.device_ = v,
  11007. this.controlInterface_ = o(this.device_, this.polyfillOptions_.usbControlInterfaceClass),
  11008. this.transferInterface_ = o(this.device_, this.polyfillOptions_.usbTransferInterfaceClass),
  11009. this.inEndpoint_ = t(this.transferInterface_, "in"),
  11010. this.outEndpoint_ = t(this.transferInterface_, "out")
  11011. }
  11012. get readable() {
  11013. var v;
  11014. return !this.readable_ && this.device_.opened && (this.readable_ = new ReadableStream(new s(this.device_, this.inEndpoint_, () => {
  11015. this.readable_ = null
  11016. }
  11017. ), {
  11018. highWaterMark: (v = this.serialOptions_.bufferSize) !== null && v !== void 0 ? v : q
  11019. })),
  11020. this.readable_
  11021. }
  11022. get writable() {
  11023. var v;
  11024. return !this.writable_ && this.device_.opened && (this.writable_ = new WritableStream(new e(this.device_, this.outEndpoint_, () => {
  11025. this.writable_ = null
  11026. }
  11027. ), new ByteLengthQueuingStrategy({
  11028. highWaterMark: (v = this.serialOptions_.bufferSize) !== null && v !== void 0 ? v : q
  11029. }))),
  11030. this.writable_
  11031. }
  11032. async open(v) {
  11033. this.serialOptions_ = v,
  11034. this.validateOptions();
  11035. try {
  11036. await this.device_.open(),
  11037. this.device_.configuration === null && await this.device_.selectConfiguration(1),
  11038. await this.device_.claimInterface(this.controlInterface_.interfaceNumber),
  11039. this.controlInterface_ !== this.transferInterface_ && await this.device_.claimInterface(this.transferInterface_.interfaceNumber),
  11040. await this.setLineCoding(),
  11041. await this.setSignals({
  11042. dataTerminalReady: !0
  11043. })
  11044. } catch (S) {
  11045. throw this.device_.opened && await this.device_.close(),
  11046. new Error("Error setting up device: " + S.toString())
  11047. }
  11048. }
  11049. async close() {
  11050. const v = [];
  11051. this.readable_ && v.push(this.readable_.cancel()),
  11052. this.writable_ && v.push(this.writable_.abort()),
  11053. await Promise.all(v),
  11054. this.readable_ = null,
  11055. this.writable_ = null,
  11056. this.device_.opened && (await this.setSignals({
  11057. dataTerminalReady: !1,
  11058. requestToSend: !1
  11059. }),
  11060. await this.device_.close())
  11061. }
  11062. async forget() {
  11063. return this.device_.forget()
  11064. }
  11065. getInfo() {
  11066. return {
  11067. usbVendorId: this.device_.vendorId,
  11068. usbProductId: this.device_.productId
  11069. }
  11070. }
  11071. reconfigure(v) {
  11072. return this.serialOptions_ = Object.assign(Object.assign({}, this.serialOptions_), v),
  11073. this.validateOptions(),
  11074. this.setLineCoding()
  11075. }
  11076. async setSignals(v) {
  11077. if (this.outputSignals_ = Object.assign(Object.assign({}, this.outputSignals_), v),
  11078. v.dataTerminalReady !== void 0 || v.requestToSend !== void 0) {
  11079. const S = (this.outputSignals_.dataTerminalReady ? 1 : 0) | (this.outputSignals_.requestToSend ? 2 : 0);
  11080. await this.device_.controlTransferOut({
  11081. requestType: "class",
  11082. recipient: "interface",
  11083. request: G,
  11084. value: S,
  11085. index: this.controlInterface_.interfaceNumber
  11086. })
  11087. }
  11088. if (v.break !== void 0) {
  11089. const S = this.outputSignals_.break ? 65535 : 0;
  11090. await this.device_.controlTransferOut({
  11091. requestType: "class",
  11092. recipient: "interface",
  11093. request: U,
  11094. value: S,
  11095. index: this.controlInterface_.interfaceNumber
  11096. })
  11097. }
  11098. }
  11099. validateOptions() {
  11100. if (!this.isValidBaudRate(this.serialOptions_.baudRate))
  11101. throw new RangeError("invalid Baud Rate " + this.serialOptions_.baudRate);
  11102. if (!this.isValidDataBits(this.serialOptions_.dataBits))
  11103. throw new RangeError("invalid dataBits " + this.serialOptions_.dataBits);
  11104. if (!this.isValidStopBits(this.serialOptions_.stopBits))
  11105. throw new RangeError("invalid stopBits " + this.serialOptions_.stopBits);
  11106. if (!this.isValidParity(this.serialOptions_.parity))
  11107. throw new RangeError("invalid parity " + this.serialOptions_.parity)
  11108. }
  11109. isValidBaudRate(v) {
  11110. return v % 1 === 0
  11111. }
  11112. isValidDataBits(v) {
  11113. return typeof v > "u" ? !0 : n.includes(v)
  11114. }
  11115. isValidStopBits(v) {
  11116. return typeof v > "u" ? !0 : _.includes(v)
  11117. }
  11118. isValidParity(v) {
  11119. return typeof v > "u" ? !0 : h.includes(v)
  11120. }
  11121. async setLineCoding() {
  11122. var v, S, u;
  11123. const m = new ArrayBuffer(7)
  11124. , w = new DataView(m);
  11125. if (w.setUint32(0, this.serialOptions_.baudRate, !0),
  11126. w.setUint8(4, d.indexOf((v = this.serialOptions_.stopBits) !== null && v !== void 0 ? v : a)),
  11127. w.setUint8(5, f.indexOf((S = this.serialOptions_.parity) !== null && S !== void 0 ? S : r)),
  11128. w.setUint8(6, (u = this.serialOptions_.dataBits) !== null && u !== void 0 ? u : x),
  11129. (await this.device_.controlTransferOut({
  11130. requestType: "class",
  11131. recipient: "interface",
  11132. request: V,
  11133. value: 0,
  11134. index: this.controlInterface_.interfaceNumber
  11135. }, m)).status != "ok")
  11136. throw new DOMException("NetworkError", "Failed to set line coding.")
  11137. }
  11138. }
  11139. z.SerialPort = i;
  11140. class c {
  11141. async requestPort(v, S) {
  11142. S = Object.assign(Object.assign({}, l), S);
  11143. const u = [];
  11144. if (v && v.filters)
  11145. for (const R of v.filters) {
  11146. const L = {
  11147. classCode: S.usbControlInterfaceClass
  11148. };
  11149. R.usbVendorId !== void 0 && (L.vendorId = R.usbVendorId),
  11150. R.usbProductId !== void 0 && (L.productId = R.usbProductId),
  11151. u.push(L)
  11152. }
  11153. u.length === 0 && u.push({
  11154. classCode: S.usbControlInterfaceClass
  11155. });
  11156. const m = await navigator.usb.requestDevice({
  11157. filters: u
  11158. });
  11159. return new i(m, S)
  11160. }
  11161. async getPorts(v) {
  11162. v = Object.assign(Object.assign({}, l), v);
  11163. const S = await navigator.usb.getDevices()
  11164. , u = [];
  11165. return S.forEach(m => {
  11166. try {
  11167. const w = new i(m, v);
  11168. u.push(w)
  11169. } catch { }
  11170. }
  11171. ),
  11172. u
  11173. }
  11174. }
  11175. z.serial = new c
  11176. }
  11177. )(fe);
  11178. let te, ee, ie, se, re, ae, ne, oe, we, Ee, ge, ke = 1, J, Q;
  11179. const Re = new URLSearchParams(window.location.search)
  11180. , le = Re.has("polyfill")
  11181. , he = 8 * 1024
  11182. , Y = new Ce.exports.Terminal({
  11183. scrollback: 1e4
  11184. })
  11185. , de = new ye.exports.FitAddon;
  11186. Y.loadAddon(de);
  11187. const pe = new TextEncoder;
  11188. let ce = "";
  11189. Y.onData(z => {
  11190. if (we.checked && Y.write(z),
  11191. (J == null ? void 0 : J.writable) == null) {
  11192. console.warn("unable to find writable port");
  11193. return
  11194. }
  11195. const W = J.writable.getWriter();
  11196. Ee.checked ? (ce += z,
  11197. z === "\r" && (W.write(pe.encode(ce)),
  11198. W.releaseLock(),
  11199. ce = "")) : W.write(pe.encode(z)),
  11200. W.releaseLock()
  11201. }
  11202. );
  11203. function Le(z) {
  11204. for (let W = 0; W < te.options.length; ++W) {
  11205. const V = te.options[W];
  11206. if (V.value === "prompt")
  11207. continue;
  11208. const G = V;
  11209. if (G.port === z)
  11210. return G
  11211. }
  11212. return null
  11213. }
  11214. function _e(z) {
  11215. const W = document.createElement("option");
  11216. return W.textContent = `Port ${ke++}`,
  11217. W.port = z,
  11218. te.appendChild(W),
  11219. W
  11220. }
  11221. function De(z) {
  11222. const W = Le(z);
  11223. return W || _e(z)
  11224. }
  11225. function Ae() {
  11226. if (!Y)
  11227. throw new Error("no terminal instance found");
  11228. if (Y.rows === 0) {
  11229. console.log("No output yet");
  11230. return
  11231. }
  11232. Y.selectAll();
  11233. const z = Y.getSelection();
  11234. Y.clearSelection();
  11235. const W = URL.createObjectURL(new Blob([new TextEncoder().encode(z).buffer], {
  11236. type: "text/plain"
  11237. }))
  11238. , V = document.createElement("a");
  11239. V.download = `terminal_content_${new Date().getTime()}.txt`,
  11240. V.href = W,
  11241. V.click()
  11242. }
  11243. function xe() {
  11244. if (!Y)
  11245. throw new Error("no terminal instance found");
  11246. if (Y.rows === 0) {
  11247. console.log("No output yet");
  11248. return
  11249. }
  11250. Y.clear()
  11251. }
  11252. async function Be() {
  11253. if (te.value == "prompt") {
  11254. try {
  11255. J = await (le ? fe.serial : navigator.serial).requestPort({})
  11256. } catch {
  11257. return
  11258. }
  11259. const z = De(J);
  11260. z.selected = !0
  11261. } else
  11262. J = te.selectedOptions[0].port
  11263. }
  11264. function Se() {
  11265. return ie.value == "custom" ? Number.parseInt(se.value) : Number.parseInt(ie.value)
  11266. }
  11267. function ue() {
  11268. Y.writeln("<DISCONNECTED>"),
  11269. te.disabled = !1,
  11270. ee.textContent = "Connect",
  11271. ee.disabled = !1,
  11272. ie.disabled = !1,
  11273. se.disabled = !1,
  11274. re.disabled = !1,
  11275. ae.disabled = !1,
  11276. ne.disabled = !1,
  11277. oe.disabled = !1,
  11278. J = void 0
  11279. }
  11280. async function me() {
  11281. if (await Be(),
  11282. !J)
  11283. return;
  11284. const z = {
  11285. baudRate: Se(),
  11286. dataBits: Number.parseInt(re.value),
  11287. parity: ae.value,
  11288. stopBits: Number.parseInt(ne.value),
  11289. flowControl: oe.checked ? "hardware" : "none",
  11290. bufferSize: he,
  11291. baudrate: Se(),
  11292. databits: Number.parseInt(re.value),
  11293. stopbits: Number.parseInt(ne.value),
  11294. rtscts: oe.checked
  11295. };
  11296. console.log(z),
  11297. te.disabled = !0,
  11298. ee.textContent = "Connecting...",
  11299. ee.disabled = !0,
  11300. ie.disabled = !0,
  11301. se.disabled = !0,
  11302. re.disabled = !0,
  11303. ae.disabled = !0,
  11304. ne.disabled = !0,
  11305. oe.disabled = !0;
  11306. try {
  11307. await J.open(z),
  11308. Y.writeln("<CONNECTED>"),
  11309. ee.textContent = "Disconnect",
  11310. ee.disabled = !1
  11311. } catch (W) {
  11312. console.error(W),
  11313. W instanceof Error && Y.writeln(`<ERROR: ${W.message}>`),
  11314. ue();
  11315. return
  11316. }
  11317. for (; J && J.readable;)
  11318. try {
  11319. try {
  11320. Q = J.readable.getReader({
  11321. mode: "byob"
  11322. })
  11323. } catch {
  11324. Q = J.readable.getReader()
  11325. }
  11326. let W = null;
  11327. for (; ;) {
  11328. const { value: V, done: G } = await (async () => {
  11329. if (Q instanceof ReadableStreamBYOBReader) {
  11330. W || (W = new ArrayBuffer(he));
  11331. const { value: U, done: q } = await Q.read(new Uint8Array(W, 0, he));
  11332. return W = U == null ? void 0 : U.buffer,
  11333. {
  11334. value: U,
  11335. done: q
  11336. }
  11337. } else
  11338. return await Q.read()
  11339. }
  11340. )();
  11341. if (V && await new Promise(U => {
  11342. Y.write(V, U)
  11343. }
  11344. ),
  11345. G)
  11346. break
  11347. }
  11348. } catch (W) {
  11349. console.error(W),
  11350. await new Promise(V => {
  11351. W instanceof Error && Y.writeln(`<ERROR: ${W.message}>`, V)
  11352. }
  11353. )
  11354. } finally {
  11355. Q && (Q.releaseLock(),
  11356. Q = void 0)
  11357. }
  11358. if (J) {
  11359. try {
  11360. await J.close()
  11361. } catch (W) {
  11362. console.error(W),
  11363. W instanceof Error && Y.writeln(`<ERROR: ${W.message}>`)
  11364. }
  11365. ue()
  11366. }
  11367. }
  11368. async function Te() {
  11369. const z = J;
  11370. if (J = void 0,
  11371. Q && await Q.cancel(),
  11372. z)
  11373. try {
  11374. await z.close()
  11375. } catch (W) {
  11376. console.error(W),
  11377. W instanceof Error && Y.writeln(`<ERROR: ${W.message}>`)
  11378. }
  11379. ue()
  11380. }
  11381. document.addEventListener("DOMContentLoaded", async () => {
  11382. const z = document.getElementById("terminal");
  11383. z && (Y.open(z),
  11384. de.fit(),
  11385. window.addEventListener("resize", () => {
  11386. de.fit()
  11387. }
  11388. )),
  11389. document.getElementById("download").addEventListener("click", Ae),
  11390. document.getElementById("clear").addEventListener("click", xe),
  11391. te = document.getElementById("ports"),
  11392. ee = document.getElementById("connect"),
  11393. ee.addEventListener("click", () => {
  11394. J ? Te() : me()
  11395. }
  11396. ),
  11397. ie = document.getElementById("baudrate"),
  11398. ie.addEventListener("input", () => {
  11399. ie.value == "custom" ? se.hidden = !1 : se.hidden = !0
  11400. }
  11401. ),
  11402. se = document.getElementById("custom_baudrate"),
  11403. re = document.getElementById("databits"),
  11404. ae = document.getElementById("parity"),
  11405. ne = document.getElementById("stopbits"),
  11406. oe = document.getElementById("rtscts"),
  11407. we = document.getElementById("echo"),
  11408. Ee = document.getElementById("enter_flush"),
  11409. ge = document.getElementById("autoconnect");
  11410. const G = document.getElementById("convert_eol")
  11411. , U = () => {
  11412. Y.options.convertEol = G.checked
  11413. }
  11414. ;
  11415. G.addEventListener("change", U),
  11416. U(),
  11417. (await (le ? fe.serial : navigator.serial).getPorts()).forEach(r => _e(r)),
  11418. le || (navigator.serial.addEventListener("connect", r => {
  11419. const a = _e(r.target);
  11420. ge.checked && (a.selected = !0,
  11421. me())
  11422. }
  11423. ),
  11424. navigator.serial.addEventListener("disconnect", r => {
  11425. const a = Le(r.target);
  11426. a && a.remove()
  11427. }
  11428. ))
  11429. }
  11430. );