chunk-23V3HWTR.js 740 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259
  1. import {
  2. require_react
  3. } from "./chunk-GNR2UJZM.js";
  4. import {
  5. __toESM
  6. } from "./chunk-2LSFTFF7.js";
  7. // node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
  8. var extendStatics = function(d, b) {
  9. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  10. d2.__proto__ = b2;
  11. } || function(d2, b2) {
  12. for (var p in b2)
  13. if (Object.prototype.hasOwnProperty.call(b2, p))
  14. d2[p] = b2[p];
  15. };
  16. return extendStatics(d, b);
  17. };
  18. function __extends(d, b) {
  19. if (typeof b !== "function" && b !== null)
  20. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  21. extendStatics(d, b);
  22. function __2() {
  23. this.constructor = d;
  24. }
  25. d.prototype = b === null ? Object.create(b) : (__2.prototype = b.prototype, new __2());
  26. }
  27. function __awaiter(thisArg, _arguments, P, generator) {
  28. function adopt(value) {
  29. return value instanceof P ? value : new P(function(resolve) {
  30. resolve(value);
  31. });
  32. }
  33. return new (P || (P = Promise))(function(resolve, reject) {
  34. function fulfilled(value) {
  35. try {
  36. step(generator.next(value));
  37. } catch (e) {
  38. reject(e);
  39. }
  40. }
  41. function rejected(value) {
  42. try {
  43. step(generator["throw"](value));
  44. } catch (e) {
  45. reject(e);
  46. }
  47. }
  48. function step(result) {
  49. result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
  50. }
  51. step((generator = generator.apply(thisArg, _arguments || [])).next());
  52. });
  53. }
  54. function __generator(thisArg, body) {
  55. var _ = { label: 0, sent: function() {
  56. if (t[0] & 1)
  57. throw t[1];
  58. return t[1];
  59. }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
  60. return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
  61. return this;
  62. }), g;
  63. function verb(n) {
  64. return function(v) {
  65. return step([n, v]);
  66. };
  67. }
  68. function step(op2) {
  69. if (f)
  70. throw new TypeError("Generator is already executing.");
  71. while (g && (g = 0, op2[0] && (_ = 0)), _)
  72. try {
  73. if (f = 1, y && (t = op2[0] & 2 ? y["return"] : op2[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op2[1])).done)
  74. return t;
  75. if (y = 0, t)
  76. op2 = [op2[0] & 2, t.value];
  77. switch (op2[0]) {
  78. case 0:
  79. case 1:
  80. t = op2;
  81. break;
  82. case 4:
  83. _.label++;
  84. return { value: op2[1], done: false };
  85. case 5:
  86. _.label++;
  87. y = op2[1];
  88. op2 = [0];
  89. continue;
  90. case 7:
  91. op2 = _.ops.pop();
  92. _.trys.pop();
  93. continue;
  94. default:
  95. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op2[0] === 6 || op2[0] === 2)) {
  96. _ = 0;
  97. continue;
  98. }
  99. if (op2[0] === 3 && (!t || op2[1] > t[0] && op2[1] < t[3])) {
  100. _.label = op2[1];
  101. break;
  102. }
  103. if (op2[0] === 6 && _.label < t[1]) {
  104. _.label = t[1];
  105. t = op2;
  106. break;
  107. }
  108. if (t && _.label < t[2]) {
  109. _.label = t[2];
  110. _.ops.push(op2);
  111. break;
  112. }
  113. if (t[2])
  114. _.ops.pop();
  115. _.trys.pop();
  116. continue;
  117. }
  118. op2 = body.call(thisArg, _);
  119. } catch (e) {
  120. op2 = [6, e];
  121. y = 0;
  122. } finally {
  123. f = t = 0;
  124. }
  125. if (op2[0] & 5)
  126. throw op2[1];
  127. return { value: op2[0] ? op2[1] : void 0, done: true };
  128. }
  129. }
  130. function __values(o) {
  131. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  132. if (m)
  133. return m.call(o);
  134. if (o && typeof o.length === "number")
  135. return {
  136. next: function() {
  137. if (o && i >= o.length)
  138. o = void 0;
  139. return { value: o && o[i++], done: !o };
  140. }
  141. };
  142. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  143. }
  144. function __read(o, n) {
  145. var m = typeof Symbol === "function" && o[Symbol.iterator];
  146. if (!m)
  147. return o;
  148. var i = m.call(o), r, ar2 = [], e;
  149. try {
  150. while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
  151. ar2.push(r.value);
  152. } catch (error) {
  153. e = { error };
  154. } finally {
  155. try {
  156. if (r && !r.done && (m = i["return"]))
  157. m.call(i);
  158. } finally {
  159. if (e)
  160. throw e.error;
  161. }
  162. }
  163. return ar2;
  164. }
  165. function __spreadArray(to2, from2, pack) {
  166. if (pack || arguments.length === 2)
  167. for (var i = 0, l = from2.length, ar2; i < l; i++) {
  168. if (ar2 || !(i in from2)) {
  169. if (!ar2)
  170. ar2 = Array.prototype.slice.call(from2, 0, i);
  171. ar2[i] = from2[i];
  172. }
  173. }
  174. return to2.concat(ar2 || Array.prototype.slice.call(from2));
  175. }
  176. function __await(v) {
  177. return this instanceof __await ? (this.v = v, this) : new __await(v);
  178. }
  179. function __asyncGenerator(thisArg, _arguments, generator) {
  180. if (!Symbol.asyncIterator)
  181. throw new TypeError("Symbol.asyncIterator is not defined.");
  182. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  183. return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
  184. return this;
  185. }, i;
  186. function awaitReturn(f) {
  187. return function(v) {
  188. return Promise.resolve(v).then(f, reject);
  189. };
  190. }
  191. function verb(n, f) {
  192. if (g[n]) {
  193. i[n] = function(v) {
  194. return new Promise(function(a, b) {
  195. q.push([n, v, a, b]) > 1 || resume(n, v);
  196. });
  197. };
  198. if (f)
  199. i[n] = f(i[n]);
  200. }
  201. }
  202. function resume(n, v) {
  203. try {
  204. step(g[n](v));
  205. } catch (e) {
  206. settle(q[0][3], e);
  207. }
  208. }
  209. function step(r) {
  210. r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
  211. }
  212. function fulfill(value) {
  213. resume("next", value);
  214. }
  215. function reject(value) {
  216. resume("throw", value);
  217. }
  218. function settle(f, v) {
  219. if (f(v), q.shift(), q.length)
  220. resume(q[0][0], q[0][1]);
  221. }
  222. }
  223. function __asyncValues(o) {
  224. if (!Symbol.asyncIterator)
  225. throw new TypeError("Symbol.asyncIterator is not defined.");
  226. var m = o[Symbol.asyncIterator], i;
  227. return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
  228. return this;
  229. }, i);
  230. function verb(n) {
  231. i[n] = o[n] && function(v) {
  232. return new Promise(function(resolve, reject) {
  233. v = o[n](v), settle(resolve, reject, v.done, v.value);
  234. });
  235. };
  236. }
  237. function settle(resolve, reject, d, v) {
  238. Promise.resolve(v).then(function(v2) {
  239. resolve({ value: v2, done: d });
  240. }, reject);
  241. }
  242. }
  243. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isFunction.js
  244. function isFunction(value) {
  245. return typeof value === "function";
  246. }
  247. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js
  248. function createErrorClass(createImpl) {
  249. var _super = function(instance) {
  250. Error.call(instance);
  251. instance.stack = new Error().stack;
  252. };
  253. var ctorFunc = createImpl(_super);
  254. ctorFunc.prototype = Object.create(Error.prototype);
  255. ctorFunc.prototype.constructor = ctorFunc;
  256. return ctorFunc;
  257. }
  258. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js
  259. var UnsubscriptionError = createErrorClass(function(_super) {
  260. return function UnsubscriptionErrorImpl(errors) {
  261. _super(this);
  262. this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(err, i) {
  263. return i + 1 + ") " + err.toString();
  264. }).join("\n ") : "";
  265. this.name = "UnsubscriptionError";
  266. this.errors = errors;
  267. };
  268. });
  269. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js
  270. function arrRemove(arr, item) {
  271. if (arr) {
  272. var index = arr.indexOf(item);
  273. 0 <= index && arr.splice(index, 1);
  274. }
  275. }
  276. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Subscription.js
  277. var Subscription = function() {
  278. function Subscription2(initialTeardown) {
  279. this.initialTeardown = initialTeardown;
  280. this.closed = false;
  281. this._parentage = null;
  282. this._finalizers = null;
  283. }
  284. Subscription2.prototype.unsubscribe = function() {
  285. var e_1, _a2, e_2, _b;
  286. var errors;
  287. if (!this.closed) {
  288. this.closed = true;
  289. var _parentage = this._parentage;
  290. if (_parentage) {
  291. this._parentage = null;
  292. if (Array.isArray(_parentage)) {
  293. try {
  294. for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
  295. var parent_1 = _parentage_1_1.value;
  296. parent_1.remove(this);
  297. }
  298. } catch (e_1_1) {
  299. e_1 = { error: e_1_1 };
  300. } finally {
  301. try {
  302. if (_parentage_1_1 && !_parentage_1_1.done && (_a2 = _parentage_1.return))
  303. _a2.call(_parentage_1);
  304. } finally {
  305. if (e_1)
  306. throw e_1.error;
  307. }
  308. }
  309. } else {
  310. _parentage.remove(this);
  311. }
  312. }
  313. var initialFinalizer = this.initialTeardown;
  314. if (isFunction(initialFinalizer)) {
  315. try {
  316. initialFinalizer();
  317. } catch (e) {
  318. errors = e instanceof UnsubscriptionError ? e.errors : [e];
  319. }
  320. }
  321. var _finalizers = this._finalizers;
  322. if (_finalizers) {
  323. this._finalizers = null;
  324. try {
  325. for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
  326. var finalizer = _finalizers_1_1.value;
  327. try {
  328. execFinalizer(finalizer);
  329. } catch (err) {
  330. errors = errors !== null && errors !== void 0 ? errors : [];
  331. if (err instanceof UnsubscriptionError) {
  332. errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
  333. } else {
  334. errors.push(err);
  335. }
  336. }
  337. }
  338. } catch (e_2_1) {
  339. e_2 = { error: e_2_1 };
  340. } finally {
  341. try {
  342. if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return))
  343. _b.call(_finalizers_1);
  344. } finally {
  345. if (e_2)
  346. throw e_2.error;
  347. }
  348. }
  349. }
  350. if (errors) {
  351. throw new UnsubscriptionError(errors);
  352. }
  353. }
  354. };
  355. Subscription2.prototype.add = function(teardown) {
  356. var _a2;
  357. if (teardown && teardown !== this) {
  358. if (this.closed) {
  359. execFinalizer(teardown);
  360. } else {
  361. if (teardown instanceof Subscription2) {
  362. if (teardown.closed || teardown._hasParent(this)) {
  363. return;
  364. }
  365. teardown._addParent(this);
  366. }
  367. (this._finalizers = (_a2 = this._finalizers) !== null && _a2 !== void 0 ? _a2 : []).push(teardown);
  368. }
  369. }
  370. };
  371. Subscription2.prototype._hasParent = function(parent) {
  372. var _parentage = this._parentage;
  373. return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent);
  374. };
  375. Subscription2.prototype._addParent = function(parent) {
  376. var _parentage = this._parentage;
  377. this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
  378. };
  379. Subscription2.prototype._removeParent = function(parent) {
  380. var _parentage = this._parentage;
  381. if (_parentage === parent) {
  382. this._parentage = null;
  383. } else if (Array.isArray(_parentage)) {
  384. arrRemove(_parentage, parent);
  385. }
  386. };
  387. Subscription2.prototype.remove = function(teardown) {
  388. var _finalizers = this._finalizers;
  389. _finalizers && arrRemove(_finalizers, teardown);
  390. if (teardown instanceof Subscription2) {
  391. teardown._removeParent(this);
  392. }
  393. };
  394. Subscription2.EMPTY = function() {
  395. var empty2 = new Subscription2();
  396. empty2.closed = true;
  397. return empty2;
  398. }();
  399. return Subscription2;
  400. }();
  401. var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
  402. function isSubscription(value) {
  403. return value instanceof Subscription || value && "closed" in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe);
  404. }
  405. function execFinalizer(finalizer) {
  406. if (isFunction(finalizer)) {
  407. finalizer();
  408. } else {
  409. finalizer.unsubscribe();
  410. }
  411. }
  412. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/config.js
  413. var config = {
  414. onUnhandledError: null,
  415. onStoppedNotification: null,
  416. Promise: void 0,
  417. useDeprecatedSynchronousErrorHandling: false,
  418. useDeprecatedNextContext: false
  419. };
  420. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js
  421. var timeoutProvider = {
  422. setTimeout: function(handler, timeout2) {
  423. var args = [];
  424. for (var _i2 = 2; _i2 < arguments.length; _i2++) {
  425. args[_i2 - 2] = arguments[_i2];
  426. }
  427. var delegate = timeoutProvider.delegate;
  428. if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
  429. return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout2], __read(args)));
  430. }
  431. return setTimeout.apply(void 0, __spreadArray([handler, timeout2], __read(args)));
  432. },
  433. clearTimeout: function(handle) {
  434. var delegate = timeoutProvider.delegate;
  435. return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
  436. },
  437. delegate: void 0
  438. };
  439. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js
  440. function reportUnhandledError(err) {
  441. timeoutProvider.setTimeout(function() {
  442. var onUnhandledError = config.onUnhandledError;
  443. if (onUnhandledError) {
  444. onUnhandledError(err);
  445. } else {
  446. throw err;
  447. }
  448. });
  449. }
  450. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/noop.js
  451. function noop() {
  452. }
  453. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js
  454. var COMPLETE_NOTIFICATION = function() {
  455. return createNotification("C", void 0, void 0);
  456. }();
  457. function errorNotification(error) {
  458. return createNotification("E", void 0, error);
  459. }
  460. function nextNotification(value) {
  461. return createNotification("N", value, void 0);
  462. }
  463. function createNotification(kind, value, error) {
  464. return {
  465. kind,
  466. value,
  467. error
  468. };
  469. }
  470. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/errorContext.js
  471. var context = null;
  472. function errorContext(cb) {
  473. if (config.useDeprecatedSynchronousErrorHandling) {
  474. var isRoot = !context;
  475. if (isRoot) {
  476. context = { errorThrown: false, error: null };
  477. }
  478. cb();
  479. if (isRoot) {
  480. var _a2 = context, errorThrown = _a2.errorThrown, error = _a2.error;
  481. context = null;
  482. if (errorThrown) {
  483. throw error;
  484. }
  485. }
  486. } else {
  487. cb();
  488. }
  489. }
  490. function captureError(err) {
  491. if (config.useDeprecatedSynchronousErrorHandling && context) {
  492. context.errorThrown = true;
  493. context.error = err;
  494. }
  495. }
  496. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Subscriber.js
  497. var Subscriber = function(_super) {
  498. __extends(Subscriber2, _super);
  499. function Subscriber2(destination) {
  500. var _this = _super.call(this) || this;
  501. _this.isStopped = false;
  502. if (destination) {
  503. _this.destination = destination;
  504. if (isSubscription(destination)) {
  505. destination.add(_this);
  506. }
  507. } else {
  508. _this.destination = EMPTY_OBSERVER;
  509. }
  510. return _this;
  511. }
  512. Subscriber2.create = function(next, error, complete) {
  513. return new SafeSubscriber(next, error, complete);
  514. };
  515. Subscriber2.prototype.next = function(value) {
  516. if (this.isStopped) {
  517. handleStoppedNotification(nextNotification(value), this);
  518. } else {
  519. this._next(value);
  520. }
  521. };
  522. Subscriber2.prototype.error = function(err) {
  523. if (this.isStopped) {
  524. handleStoppedNotification(errorNotification(err), this);
  525. } else {
  526. this.isStopped = true;
  527. this._error(err);
  528. }
  529. };
  530. Subscriber2.prototype.complete = function() {
  531. if (this.isStopped) {
  532. handleStoppedNotification(COMPLETE_NOTIFICATION, this);
  533. } else {
  534. this.isStopped = true;
  535. this._complete();
  536. }
  537. };
  538. Subscriber2.prototype.unsubscribe = function() {
  539. if (!this.closed) {
  540. this.isStopped = true;
  541. _super.prototype.unsubscribe.call(this);
  542. this.destination = null;
  543. }
  544. };
  545. Subscriber2.prototype._next = function(value) {
  546. this.destination.next(value);
  547. };
  548. Subscriber2.prototype._error = function(err) {
  549. try {
  550. this.destination.error(err);
  551. } finally {
  552. this.unsubscribe();
  553. }
  554. };
  555. Subscriber2.prototype._complete = function() {
  556. try {
  557. this.destination.complete();
  558. } finally {
  559. this.unsubscribe();
  560. }
  561. };
  562. return Subscriber2;
  563. }(Subscription);
  564. var _bind = Function.prototype.bind;
  565. function bind(fn2, thisArg) {
  566. return _bind.call(fn2, thisArg);
  567. }
  568. var ConsumerObserver = function() {
  569. function ConsumerObserver2(partialObserver) {
  570. this.partialObserver = partialObserver;
  571. }
  572. ConsumerObserver2.prototype.next = function(value) {
  573. var partialObserver = this.partialObserver;
  574. if (partialObserver.next) {
  575. try {
  576. partialObserver.next(value);
  577. } catch (error) {
  578. handleUnhandledError(error);
  579. }
  580. }
  581. };
  582. ConsumerObserver2.prototype.error = function(err) {
  583. var partialObserver = this.partialObserver;
  584. if (partialObserver.error) {
  585. try {
  586. partialObserver.error(err);
  587. } catch (error) {
  588. handleUnhandledError(error);
  589. }
  590. } else {
  591. handleUnhandledError(err);
  592. }
  593. };
  594. ConsumerObserver2.prototype.complete = function() {
  595. var partialObserver = this.partialObserver;
  596. if (partialObserver.complete) {
  597. try {
  598. partialObserver.complete();
  599. } catch (error) {
  600. handleUnhandledError(error);
  601. }
  602. }
  603. };
  604. return ConsumerObserver2;
  605. }();
  606. var SafeSubscriber = function(_super) {
  607. __extends(SafeSubscriber2, _super);
  608. function SafeSubscriber2(observerOrNext, error, complete) {
  609. var _this = _super.call(this) || this;
  610. var partialObserver;
  611. if (isFunction(observerOrNext) || !observerOrNext) {
  612. partialObserver = {
  613. next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0,
  614. error: error !== null && error !== void 0 ? error : void 0,
  615. complete: complete !== null && complete !== void 0 ? complete : void 0
  616. };
  617. } else {
  618. var context_1;
  619. if (_this && config.useDeprecatedNextContext) {
  620. context_1 = Object.create(observerOrNext);
  621. context_1.unsubscribe = function() {
  622. return _this.unsubscribe();
  623. };
  624. partialObserver = {
  625. next: observerOrNext.next && bind(observerOrNext.next, context_1),
  626. error: observerOrNext.error && bind(observerOrNext.error, context_1),
  627. complete: observerOrNext.complete && bind(observerOrNext.complete, context_1)
  628. };
  629. } else {
  630. partialObserver = observerOrNext;
  631. }
  632. }
  633. _this.destination = new ConsumerObserver(partialObserver);
  634. return _this;
  635. }
  636. return SafeSubscriber2;
  637. }(Subscriber);
  638. function handleUnhandledError(error) {
  639. if (config.useDeprecatedSynchronousErrorHandling) {
  640. captureError(error);
  641. } else {
  642. reportUnhandledError(error);
  643. }
  644. }
  645. function defaultErrorHandler(err) {
  646. throw err;
  647. }
  648. function handleStoppedNotification(notification, subscriber) {
  649. var onStoppedNotification = config.onStoppedNotification;
  650. onStoppedNotification && timeoutProvider.setTimeout(function() {
  651. return onStoppedNotification(notification, subscriber);
  652. });
  653. }
  654. var EMPTY_OBSERVER = {
  655. closed: true,
  656. next: noop,
  657. error: defaultErrorHandler,
  658. complete: noop
  659. };
  660. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/symbol/observable.js
  661. var observable = function() {
  662. return typeof Symbol === "function" && Symbol.observable || "@@observable";
  663. }();
  664. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/identity.js
  665. function identity(x) {
  666. return x;
  667. }
  668. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/pipe.js
  669. function pipe() {
  670. var fns = [];
  671. for (var _i2 = 0; _i2 < arguments.length; _i2++) {
  672. fns[_i2] = arguments[_i2];
  673. }
  674. return pipeFromArray(fns);
  675. }
  676. function pipeFromArray(fns) {
  677. if (fns.length === 0) {
  678. return identity;
  679. }
  680. if (fns.length === 1) {
  681. return fns[0];
  682. }
  683. return function piped(input) {
  684. return fns.reduce(function(prev, fn2) {
  685. return fn2(prev);
  686. }, input);
  687. };
  688. }
  689. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Observable.js
  690. var Observable = function() {
  691. function Observable2(subscribe) {
  692. if (subscribe) {
  693. this._subscribe = subscribe;
  694. }
  695. }
  696. Observable2.prototype.lift = function(operator) {
  697. var observable2 = new Observable2();
  698. observable2.source = this;
  699. observable2.operator = operator;
  700. return observable2;
  701. };
  702. Observable2.prototype.subscribe = function(observerOrNext, error, complete) {
  703. var _this = this;
  704. var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
  705. errorContext(function() {
  706. var _a2 = _this, operator = _a2.operator, source = _a2.source;
  707. subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber));
  708. });
  709. return subscriber;
  710. };
  711. Observable2.prototype._trySubscribe = function(sink) {
  712. try {
  713. return this._subscribe(sink);
  714. } catch (err) {
  715. sink.error(err);
  716. }
  717. };
  718. Observable2.prototype.forEach = function(next, promiseCtor) {
  719. var _this = this;
  720. promiseCtor = getPromiseCtor(promiseCtor);
  721. return new promiseCtor(function(resolve, reject) {
  722. var subscriber = new SafeSubscriber({
  723. next: function(value) {
  724. try {
  725. next(value);
  726. } catch (err) {
  727. reject(err);
  728. subscriber.unsubscribe();
  729. }
  730. },
  731. error: reject,
  732. complete: resolve
  733. });
  734. _this.subscribe(subscriber);
  735. });
  736. };
  737. Observable2.prototype._subscribe = function(subscriber) {
  738. var _a2;
  739. return (_a2 = this.source) === null || _a2 === void 0 ? void 0 : _a2.subscribe(subscriber);
  740. };
  741. Observable2.prototype[observable] = function() {
  742. return this;
  743. };
  744. Observable2.prototype.pipe = function() {
  745. var operations = [];
  746. for (var _i2 = 0; _i2 < arguments.length; _i2++) {
  747. operations[_i2] = arguments[_i2];
  748. }
  749. return pipeFromArray(operations)(this);
  750. };
  751. Observable2.prototype.toPromise = function(promiseCtor) {
  752. var _this = this;
  753. promiseCtor = getPromiseCtor(promiseCtor);
  754. return new promiseCtor(function(resolve, reject) {
  755. var value;
  756. _this.subscribe(function(x) {
  757. return value = x;
  758. }, function(err) {
  759. return reject(err);
  760. }, function() {
  761. return resolve(value);
  762. });
  763. });
  764. };
  765. Observable2.create = function(subscribe) {
  766. return new Observable2(subscribe);
  767. };
  768. return Observable2;
  769. }();
  770. function getPromiseCtor(promiseCtor) {
  771. var _a2;
  772. return (_a2 = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a2 !== void 0 ? _a2 : Promise;
  773. }
  774. function isObserver(value) {
  775. return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
  776. }
  777. function isSubscriber(value) {
  778. return value && value instanceof Subscriber || isObserver(value) && isSubscription(value);
  779. }
  780. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/lift.js
  781. function hasLift(source) {
  782. return isFunction(source === null || source === void 0 ? void 0 : source.lift);
  783. }
  784. function operate(init) {
  785. return function(source) {
  786. if (hasLift(source)) {
  787. return source.lift(function(liftedSource) {
  788. try {
  789. return init(liftedSource, this);
  790. } catch (err) {
  791. this.error(err);
  792. }
  793. });
  794. }
  795. throw new TypeError("Unable to lift unknown Observable type");
  796. };
  797. }
  798. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js
  799. function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
  800. return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
  801. }
  802. var OperatorSubscriber = function(_super) {
  803. __extends(OperatorSubscriber2, _super);
  804. function OperatorSubscriber2(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
  805. var _this = _super.call(this, destination) || this;
  806. _this.onFinalize = onFinalize;
  807. _this.shouldUnsubscribe = shouldUnsubscribe;
  808. _this._next = onNext ? function(value) {
  809. try {
  810. onNext(value);
  811. } catch (err) {
  812. destination.error(err);
  813. }
  814. } : _super.prototype._next;
  815. _this._error = onError ? function(err) {
  816. try {
  817. onError(err);
  818. } catch (err2) {
  819. destination.error(err2);
  820. } finally {
  821. this.unsubscribe();
  822. }
  823. } : _super.prototype._error;
  824. _this._complete = onComplete ? function() {
  825. try {
  826. onComplete();
  827. } catch (err) {
  828. destination.error(err);
  829. } finally {
  830. this.unsubscribe();
  831. }
  832. } : _super.prototype._complete;
  833. return _this;
  834. }
  835. OperatorSubscriber2.prototype.unsubscribe = function() {
  836. var _a2;
  837. if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
  838. var closed_1 = this.closed;
  839. _super.prototype.unsubscribe.call(this);
  840. !closed_1 && ((_a2 = this.onFinalize) === null || _a2 === void 0 ? void 0 : _a2.call(this));
  841. }
  842. };
  843. return OperatorSubscriber2;
  844. }(Subscriber);
  845. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/refCount.js
  846. function refCount() {
  847. return operate(function(source, subscriber) {
  848. var connection = null;
  849. source._refCount++;
  850. var refCounter = createOperatorSubscriber(subscriber, void 0, void 0, void 0, function() {
  851. if (!source || source._refCount <= 0 || 0 < --source._refCount) {
  852. connection = null;
  853. return;
  854. }
  855. var sharedConnection = source._connection;
  856. var conn = connection;
  857. connection = null;
  858. if (sharedConnection && (!conn || sharedConnection === conn)) {
  859. sharedConnection.unsubscribe();
  860. }
  861. subscriber.unsubscribe();
  862. });
  863. source.subscribe(refCounter);
  864. if (!refCounter.closed) {
  865. connection = source.connect();
  866. }
  867. });
  868. }
  869. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/ConnectableObservable.js
  870. var ConnectableObservable = function(_super) {
  871. __extends(ConnectableObservable2, _super);
  872. function ConnectableObservable2(source, subjectFactory) {
  873. var _this = _super.call(this) || this;
  874. _this.source = source;
  875. _this.subjectFactory = subjectFactory;
  876. _this._subject = null;
  877. _this._refCount = 0;
  878. _this._connection = null;
  879. if (hasLift(source)) {
  880. _this.lift = source.lift;
  881. }
  882. return _this;
  883. }
  884. ConnectableObservable2.prototype._subscribe = function(subscriber) {
  885. return this.getSubject().subscribe(subscriber);
  886. };
  887. ConnectableObservable2.prototype.getSubject = function() {
  888. var subject = this._subject;
  889. if (!subject || subject.isStopped) {
  890. this._subject = this.subjectFactory();
  891. }
  892. return this._subject;
  893. };
  894. ConnectableObservable2.prototype._teardown = function() {
  895. this._refCount = 0;
  896. var _connection = this._connection;
  897. this._subject = this._connection = null;
  898. _connection === null || _connection === void 0 ? void 0 : _connection.unsubscribe();
  899. };
  900. ConnectableObservable2.prototype.connect = function() {
  901. var _this = this;
  902. var connection = this._connection;
  903. if (!connection) {
  904. connection = this._connection = new Subscription();
  905. var subject_1 = this.getSubject();
  906. connection.add(this.source.subscribe(createOperatorSubscriber(subject_1, void 0, function() {
  907. _this._teardown();
  908. subject_1.complete();
  909. }, function(err) {
  910. _this._teardown();
  911. subject_1.error(err);
  912. }, function() {
  913. return _this._teardown();
  914. })));
  915. if (connection.closed) {
  916. this._connection = null;
  917. connection = Subscription.EMPTY;
  918. }
  919. }
  920. return connection;
  921. };
  922. ConnectableObservable2.prototype.refCount = function() {
  923. return refCount()(this);
  924. };
  925. return ConnectableObservable2;
  926. }(Observable);
  927. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/performanceTimestampProvider.js
  928. var performanceTimestampProvider = {
  929. now: function() {
  930. return (performanceTimestampProvider.delegate || performance).now();
  931. },
  932. delegate: void 0
  933. };
  934. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/animationFrameProvider.js
  935. var animationFrameProvider = {
  936. schedule: function(callback) {
  937. var request = requestAnimationFrame;
  938. var cancel = cancelAnimationFrame;
  939. var delegate = animationFrameProvider.delegate;
  940. if (delegate) {
  941. request = delegate.requestAnimationFrame;
  942. cancel = delegate.cancelAnimationFrame;
  943. }
  944. var handle = request(function(timestamp2) {
  945. cancel = void 0;
  946. callback(timestamp2);
  947. });
  948. return new Subscription(function() {
  949. return cancel === null || cancel === void 0 ? void 0 : cancel(handle);
  950. });
  951. },
  952. requestAnimationFrame: function() {
  953. var args = [];
  954. for (var _i2 = 0; _i2 < arguments.length; _i2++) {
  955. args[_i2] = arguments[_i2];
  956. }
  957. var delegate = animationFrameProvider.delegate;
  958. return ((delegate === null || delegate === void 0 ? void 0 : delegate.requestAnimationFrame) || requestAnimationFrame).apply(void 0, __spreadArray([], __read(args)));
  959. },
  960. cancelAnimationFrame: function() {
  961. var args = [];
  962. for (var _i2 = 0; _i2 < arguments.length; _i2++) {
  963. args[_i2] = arguments[_i2];
  964. }
  965. var delegate = animationFrameProvider.delegate;
  966. return ((delegate === null || delegate === void 0 ? void 0 : delegate.cancelAnimationFrame) || cancelAnimationFrame).apply(void 0, __spreadArray([], __read(args)));
  967. },
  968. delegate: void 0
  969. };
  970. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/dom/animationFrames.js
  971. function animationFramesFactory(timestampProvider) {
  972. return new Observable(function(subscriber) {
  973. var provider = timestampProvider || performanceTimestampProvider;
  974. var start = provider.now();
  975. var id2 = 0;
  976. var run = function() {
  977. if (!subscriber.closed) {
  978. id2 = animationFrameProvider.requestAnimationFrame(function(timestamp2) {
  979. id2 = 0;
  980. var now = provider.now();
  981. subscriber.next({
  982. timestamp: timestampProvider ? now : timestamp2,
  983. elapsed: now - start
  984. });
  985. run();
  986. });
  987. }
  988. };
  989. run();
  990. return function() {
  991. if (id2) {
  992. animationFrameProvider.cancelAnimationFrame(id2);
  993. }
  994. };
  995. });
  996. }
  997. var DEFAULT_ANIMATION_FRAMES = animationFramesFactory();
  998. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/ObjectUnsubscribedError.js
  999. var ObjectUnsubscribedError = createErrorClass(function(_super) {
  1000. return function ObjectUnsubscribedErrorImpl() {
  1001. _super(this);
  1002. this.name = "ObjectUnsubscribedError";
  1003. this.message = "object unsubscribed";
  1004. };
  1005. });
  1006. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Subject.js
  1007. var Subject = function(_super) {
  1008. __extends(Subject2, _super);
  1009. function Subject2() {
  1010. var _this = _super.call(this) || this;
  1011. _this.closed = false;
  1012. _this.currentObservers = null;
  1013. _this.observers = [];
  1014. _this.isStopped = false;
  1015. _this.hasError = false;
  1016. _this.thrownError = null;
  1017. return _this;
  1018. }
  1019. Subject2.prototype.lift = function(operator) {
  1020. var subject = new AnonymousSubject(this, this);
  1021. subject.operator = operator;
  1022. return subject;
  1023. };
  1024. Subject2.prototype._throwIfClosed = function() {
  1025. if (this.closed) {
  1026. throw new ObjectUnsubscribedError();
  1027. }
  1028. };
  1029. Subject2.prototype.next = function(value) {
  1030. var _this = this;
  1031. errorContext(function() {
  1032. var e_1, _a2;
  1033. _this._throwIfClosed();
  1034. if (!_this.isStopped) {
  1035. if (!_this.currentObservers) {
  1036. _this.currentObservers = Array.from(_this.observers);
  1037. }
  1038. try {
  1039. for (var _b = __values(_this.currentObservers), _c2 = _b.next(); !_c2.done; _c2 = _b.next()) {
  1040. var observer = _c2.value;
  1041. observer.next(value);
  1042. }
  1043. } catch (e_1_1) {
  1044. e_1 = { error: e_1_1 };
  1045. } finally {
  1046. try {
  1047. if (_c2 && !_c2.done && (_a2 = _b.return))
  1048. _a2.call(_b);
  1049. } finally {
  1050. if (e_1)
  1051. throw e_1.error;
  1052. }
  1053. }
  1054. }
  1055. });
  1056. };
  1057. Subject2.prototype.error = function(err) {
  1058. var _this = this;
  1059. errorContext(function() {
  1060. _this._throwIfClosed();
  1061. if (!_this.isStopped) {
  1062. _this.hasError = _this.isStopped = true;
  1063. _this.thrownError = err;
  1064. var observers = _this.observers;
  1065. while (observers.length) {
  1066. observers.shift().error(err);
  1067. }
  1068. }
  1069. });
  1070. };
  1071. Subject2.prototype.complete = function() {
  1072. var _this = this;
  1073. errorContext(function() {
  1074. _this._throwIfClosed();
  1075. if (!_this.isStopped) {
  1076. _this.isStopped = true;
  1077. var observers = _this.observers;
  1078. while (observers.length) {
  1079. observers.shift().complete();
  1080. }
  1081. }
  1082. });
  1083. };
  1084. Subject2.prototype.unsubscribe = function() {
  1085. this.isStopped = this.closed = true;
  1086. this.observers = this.currentObservers = null;
  1087. };
  1088. Object.defineProperty(Subject2.prototype, "observed", {
  1089. get: function() {
  1090. var _a2;
  1091. return ((_a2 = this.observers) === null || _a2 === void 0 ? void 0 : _a2.length) > 0;
  1092. },
  1093. enumerable: false,
  1094. configurable: true
  1095. });
  1096. Subject2.prototype._trySubscribe = function(subscriber) {
  1097. this._throwIfClosed();
  1098. return _super.prototype._trySubscribe.call(this, subscriber);
  1099. };
  1100. Subject2.prototype._subscribe = function(subscriber) {
  1101. this._throwIfClosed();
  1102. this._checkFinalizedStatuses(subscriber);
  1103. return this._innerSubscribe(subscriber);
  1104. };
  1105. Subject2.prototype._innerSubscribe = function(subscriber) {
  1106. var _this = this;
  1107. var _a2 = this, hasError = _a2.hasError, isStopped = _a2.isStopped, observers = _a2.observers;
  1108. if (hasError || isStopped) {
  1109. return EMPTY_SUBSCRIPTION;
  1110. }
  1111. this.currentObservers = null;
  1112. observers.push(subscriber);
  1113. return new Subscription(function() {
  1114. _this.currentObservers = null;
  1115. arrRemove(observers, subscriber);
  1116. });
  1117. };
  1118. Subject2.prototype._checkFinalizedStatuses = function(subscriber) {
  1119. var _a2 = this, hasError = _a2.hasError, thrownError = _a2.thrownError, isStopped = _a2.isStopped;
  1120. if (hasError) {
  1121. subscriber.error(thrownError);
  1122. } else if (isStopped) {
  1123. subscriber.complete();
  1124. }
  1125. };
  1126. Subject2.prototype.asObservable = function() {
  1127. var observable2 = new Observable();
  1128. observable2.source = this;
  1129. return observable2;
  1130. };
  1131. Subject2.create = function(destination, source) {
  1132. return new AnonymousSubject(destination, source);
  1133. };
  1134. return Subject2;
  1135. }(Observable);
  1136. var AnonymousSubject = function(_super) {
  1137. __extends(AnonymousSubject2, _super);
  1138. function AnonymousSubject2(destination, source) {
  1139. var _this = _super.call(this) || this;
  1140. _this.destination = destination;
  1141. _this.source = source;
  1142. return _this;
  1143. }
  1144. AnonymousSubject2.prototype.next = function(value) {
  1145. var _a2, _b;
  1146. (_b = (_a2 = this.destination) === null || _a2 === void 0 ? void 0 : _a2.next) === null || _b === void 0 ? void 0 : _b.call(_a2, value);
  1147. };
  1148. AnonymousSubject2.prototype.error = function(err) {
  1149. var _a2, _b;
  1150. (_b = (_a2 = this.destination) === null || _a2 === void 0 ? void 0 : _a2.error) === null || _b === void 0 ? void 0 : _b.call(_a2, err);
  1151. };
  1152. AnonymousSubject2.prototype.complete = function() {
  1153. var _a2, _b;
  1154. (_b = (_a2 = this.destination) === null || _a2 === void 0 ? void 0 : _a2.complete) === null || _b === void 0 ? void 0 : _b.call(_a2);
  1155. };
  1156. AnonymousSubject2.prototype._subscribe = function(subscriber) {
  1157. var _a2, _b;
  1158. return (_b = (_a2 = this.source) === null || _a2 === void 0 ? void 0 : _a2.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
  1159. };
  1160. return AnonymousSubject2;
  1161. }(Subject);
  1162. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/BehaviorSubject.js
  1163. var BehaviorSubject = function(_super) {
  1164. __extends(BehaviorSubject2, _super);
  1165. function BehaviorSubject2(_value) {
  1166. var _this = _super.call(this) || this;
  1167. _this._value = _value;
  1168. return _this;
  1169. }
  1170. Object.defineProperty(BehaviorSubject2.prototype, "value", {
  1171. get: function() {
  1172. return this.getValue();
  1173. },
  1174. enumerable: false,
  1175. configurable: true
  1176. });
  1177. BehaviorSubject2.prototype._subscribe = function(subscriber) {
  1178. var subscription = _super.prototype._subscribe.call(this, subscriber);
  1179. !subscription.closed && subscriber.next(this._value);
  1180. return subscription;
  1181. };
  1182. BehaviorSubject2.prototype.getValue = function() {
  1183. var _a2 = this, hasError = _a2.hasError, thrownError = _a2.thrownError, _value = _a2._value;
  1184. if (hasError) {
  1185. throw thrownError;
  1186. }
  1187. this._throwIfClosed();
  1188. return _value;
  1189. };
  1190. BehaviorSubject2.prototype.next = function(value) {
  1191. _super.prototype.next.call(this, this._value = value);
  1192. };
  1193. return BehaviorSubject2;
  1194. }(Subject);
  1195. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/dateTimestampProvider.js
  1196. var dateTimestampProvider = {
  1197. now: function() {
  1198. return (dateTimestampProvider.delegate || Date).now();
  1199. },
  1200. delegate: void 0
  1201. };
  1202. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/ReplaySubject.js
  1203. var ReplaySubject = function(_super) {
  1204. __extends(ReplaySubject2, _super);
  1205. function ReplaySubject2(_bufferSize, _windowTime, _timestampProvider) {
  1206. if (_bufferSize === void 0) {
  1207. _bufferSize = Infinity;
  1208. }
  1209. if (_windowTime === void 0) {
  1210. _windowTime = Infinity;
  1211. }
  1212. if (_timestampProvider === void 0) {
  1213. _timestampProvider = dateTimestampProvider;
  1214. }
  1215. var _this = _super.call(this) || this;
  1216. _this._bufferSize = _bufferSize;
  1217. _this._windowTime = _windowTime;
  1218. _this._timestampProvider = _timestampProvider;
  1219. _this._buffer = [];
  1220. _this._infiniteTimeWindow = true;
  1221. _this._infiniteTimeWindow = _windowTime === Infinity;
  1222. _this._bufferSize = Math.max(1, _bufferSize);
  1223. _this._windowTime = Math.max(1, _windowTime);
  1224. return _this;
  1225. }
  1226. ReplaySubject2.prototype.next = function(value) {
  1227. var _a2 = this, isStopped = _a2.isStopped, _buffer = _a2._buffer, _infiniteTimeWindow = _a2._infiniteTimeWindow, _timestampProvider = _a2._timestampProvider, _windowTime = _a2._windowTime;
  1228. if (!isStopped) {
  1229. _buffer.push(value);
  1230. !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);
  1231. }
  1232. this._trimBuffer();
  1233. _super.prototype.next.call(this, value);
  1234. };
  1235. ReplaySubject2.prototype._subscribe = function(subscriber) {
  1236. this._throwIfClosed();
  1237. this._trimBuffer();
  1238. var subscription = this._innerSubscribe(subscriber);
  1239. var _a2 = this, _infiniteTimeWindow = _a2._infiniteTimeWindow, _buffer = _a2._buffer;
  1240. var copy = _buffer.slice();
  1241. for (var i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {
  1242. subscriber.next(copy[i]);
  1243. }
  1244. this._checkFinalizedStatuses(subscriber);
  1245. return subscription;
  1246. };
  1247. ReplaySubject2.prototype._trimBuffer = function() {
  1248. var _a2 = this, _bufferSize = _a2._bufferSize, _timestampProvider = _a2._timestampProvider, _buffer = _a2._buffer, _infiniteTimeWindow = _a2._infiniteTimeWindow;
  1249. var adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;
  1250. _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);
  1251. if (!_infiniteTimeWindow) {
  1252. var now = _timestampProvider.now();
  1253. var last3 = 0;
  1254. for (var i = 1; i < _buffer.length && _buffer[i] <= now; i += 2) {
  1255. last3 = i;
  1256. }
  1257. last3 && _buffer.splice(0, last3 + 1);
  1258. }
  1259. };
  1260. return ReplaySubject2;
  1261. }(Subject);
  1262. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/AsyncSubject.js
  1263. var AsyncSubject = function(_super) {
  1264. __extends(AsyncSubject2, _super);
  1265. function AsyncSubject2() {
  1266. var _this = _super !== null && _super.apply(this, arguments) || this;
  1267. _this._value = null;
  1268. _this._hasValue = false;
  1269. _this._isComplete = false;
  1270. return _this;
  1271. }
  1272. AsyncSubject2.prototype._checkFinalizedStatuses = function(subscriber) {
  1273. var _a2 = this, hasError = _a2.hasError, _hasValue = _a2._hasValue, _value = _a2._value, thrownError = _a2.thrownError, isStopped = _a2.isStopped, _isComplete = _a2._isComplete;
  1274. if (hasError) {
  1275. subscriber.error(thrownError);
  1276. } else if (isStopped || _isComplete) {
  1277. _hasValue && subscriber.next(_value);
  1278. subscriber.complete();
  1279. }
  1280. };
  1281. AsyncSubject2.prototype.next = function(value) {
  1282. if (!this.isStopped) {
  1283. this._value = value;
  1284. this._hasValue = true;
  1285. }
  1286. };
  1287. AsyncSubject2.prototype.complete = function() {
  1288. var _a2 = this, _hasValue = _a2._hasValue, _value = _a2._value, _isComplete = _a2._isComplete;
  1289. if (!_isComplete) {
  1290. this._isComplete = true;
  1291. _hasValue && _super.prototype.next.call(this, _value);
  1292. _super.prototype.complete.call(this);
  1293. }
  1294. };
  1295. return AsyncSubject2;
  1296. }(Subject);
  1297. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/Action.js
  1298. var Action = function(_super) {
  1299. __extends(Action2, _super);
  1300. function Action2(scheduler, work) {
  1301. return _super.call(this) || this;
  1302. }
  1303. Action2.prototype.schedule = function(state, delay2) {
  1304. if (delay2 === void 0) {
  1305. delay2 = 0;
  1306. }
  1307. return this;
  1308. };
  1309. return Action2;
  1310. }(Subscription);
  1311. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/intervalProvider.js
  1312. var intervalProvider = {
  1313. setInterval: function(handler, timeout2) {
  1314. var args = [];
  1315. for (var _i2 = 2; _i2 < arguments.length; _i2++) {
  1316. args[_i2 - 2] = arguments[_i2];
  1317. }
  1318. var delegate = intervalProvider.delegate;
  1319. if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
  1320. return delegate.setInterval.apply(delegate, __spreadArray([handler, timeout2], __read(args)));
  1321. }
  1322. return setInterval.apply(void 0, __spreadArray([handler, timeout2], __read(args)));
  1323. },
  1324. clearInterval: function(handle) {
  1325. var delegate = intervalProvider.delegate;
  1326. return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearInterval) || clearInterval)(handle);
  1327. },
  1328. delegate: void 0
  1329. };
  1330. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/AsyncAction.js
  1331. var AsyncAction = function(_super) {
  1332. __extends(AsyncAction2, _super);
  1333. function AsyncAction2(scheduler, work) {
  1334. var _this = _super.call(this, scheduler, work) || this;
  1335. _this.scheduler = scheduler;
  1336. _this.work = work;
  1337. _this.pending = false;
  1338. return _this;
  1339. }
  1340. AsyncAction2.prototype.schedule = function(state, delay2) {
  1341. var _a2;
  1342. if (delay2 === void 0) {
  1343. delay2 = 0;
  1344. }
  1345. if (this.closed) {
  1346. return this;
  1347. }
  1348. this.state = state;
  1349. var id2 = this.id;
  1350. var scheduler = this.scheduler;
  1351. if (id2 != null) {
  1352. this.id = this.recycleAsyncId(scheduler, id2, delay2);
  1353. }
  1354. this.pending = true;
  1355. this.delay = delay2;
  1356. this.id = (_a2 = this.id) !== null && _a2 !== void 0 ? _a2 : this.requestAsyncId(scheduler, this.id, delay2);
  1357. return this;
  1358. };
  1359. AsyncAction2.prototype.requestAsyncId = function(scheduler, _id, delay2) {
  1360. if (delay2 === void 0) {
  1361. delay2 = 0;
  1362. }
  1363. return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay2);
  1364. };
  1365. AsyncAction2.prototype.recycleAsyncId = function(_scheduler, id2, delay2) {
  1366. if (delay2 === void 0) {
  1367. delay2 = 0;
  1368. }
  1369. if (delay2 != null && this.delay === delay2 && this.pending === false) {
  1370. return id2;
  1371. }
  1372. if (id2 != null) {
  1373. intervalProvider.clearInterval(id2);
  1374. }
  1375. return void 0;
  1376. };
  1377. AsyncAction2.prototype.execute = function(state, delay2) {
  1378. if (this.closed) {
  1379. return new Error("executing a cancelled action");
  1380. }
  1381. this.pending = false;
  1382. var error = this._execute(state, delay2);
  1383. if (error) {
  1384. return error;
  1385. } else if (this.pending === false && this.id != null) {
  1386. this.id = this.recycleAsyncId(this.scheduler, this.id, null);
  1387. }
  1388. };
  1389. AsyncAction2.prototype._execute = function(state, _delay) {
  1390. var errored = false;
  1391. var errorValue;
  1392. try {
  1393. this.work(state);
  1394. } catch (e) {
  1395. errored = true;
  1396. errorValue = e ? e : new Error("Scheduled action threw falsy error");
  1397. }
  1398. if (errored) {
  1399. this.unsubscribe();
  1400. return errorValue;
  1401. }
  1402. };
  1403. AsyncAction2.prototype.unsubscribe = function() {
  1404. if (!this.closed) {
  1405. var _a2 = this, id2 = _a2.id, scheduler = _a2.scheduler;
  1406. var actions = scheduler.actions;
  1407. this.work = this.state = this.scheduler = null;
  1408. this.pending = false;
  1409. arrRemove(actions, this);
  1410. if (id2 != null) {
  1411. this.id = this.recycleAsyncId(scheduler, id2, null);
  1412. }
  1413. this.delay = null;
  1414. _super.prototype.unsubscribe.call(this);
  1415. }
  1416. };
  1417. return AsyncAction2;
  1418. }(Action);
  1419. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/Immediate.js
  1420. var nextHandle = 1;
  1421. var resolved;
  1422. var activeHandles = {};
  1423. function findAndClearHandle(handle) {
  1424. if (handle in activeHandles) {
  1425. delete activeHandles[handle];
  1426. return true;
  1427. }
  1428. return false;
  1429. }
  1430. var Immediate = {
  1431. setImmediate: function(cb) {
  1432. var handle = nextHandle++;
  1433. activeHandles[handle] = true;
  1434. if (!resolved) {
  1435. resolved = Promise.resolve();
  1436. }
  1437. resolved.then(function() {
  1438. return findAndClearHandle(handle) && cb();
  1439. });
  1440. return handle;
  1441. },
  1442. clearImmediate: function(handle) {
  1443. findAndClearHandle(handle);
  1444. }
  1445. };
  1446. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/immediateProvider.js
  1447. var setImmediate = Immediate.setImmediate;
  1448. var clearImmediate = Immediate.clearImmediate;
  1449. var immediateProvider = {
  1450. setImmediate: function() {
  1451. var args = [];
  1452. for (var _i2 = 0; _i2 < arguments.length; _i2++) {
  1453. args[_i2] = arguments[_i2];
  1454. }
  1455. var delegate = immediateProvider.delegate;
  1456. return ((delegate === null || delegate === void 0 ? void 0 : delegate.setImmediate) || setImmediate).apply(void 0, __spreadArray([], __read(args)));
  1457. },
  1458. clearImmediate: function(handle) {
  1459. var delegate = immediateProvider.delegate;
  1460. return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearImmediate) || clearImmediate)(handle);
  1461. },
  1462. delegate: void 0
  1463. };
  1464. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/AsapAction.js
  1465. var AsapAction = function(_super) {
  1466. __extends(AsapAction2, _super);
  1467. function AsapAction2(scheduler, work) {
  1468. var _this = _super.call(this, scheduler, work) || this;
  1469. _this.scheduler = scheduler;
  1470. _this.work = work;
  1471. return _this;
  1472. }
  1473. AsapAction2.prototype.requestAsyncId = function(scheduler, id2, delay2) {
  1474. if (delay2 === void 0) {
  1475. delay2 = 0;
  1476. }
  1477. if (delay2 !== null && delay2 > 0) {
  1478. return _super.prototype.requestAsyncId.call(this, scheduler, id2, delay2);
  1479. }
  1480. scheduler.actions.push(this);
  1481. return scheduler._scheduled || (scheduler._scheduled = immediateProvider.setImmediate(scheduler.flush.bind(scheduler, void 0)));
  1482. };
  1483. AsapAction2.prototype.recycleAsyncId = function(scheduler, id2, delay2) {
  1484. var _a2;
  1485. if (delay2 === void 0) {
  1486. delay2 = 0;
  1487. }
  1488. if (delay2 != null ? delay2 > 0 : this.delay > 0) {
  1489. return _super.prototype.recycleAsyncId.call(this, scheduler, id2, delay2);
  1490. }
  1491. var actions = scheduler.actions;
  1492. if (id2 != null && ((_a2 = actions[actions.length - 1]) === null || _a2 === void 0 ? void 0 : _a2.id) !== id2) {
  1493. immediateProvider.clearImmediate(id2);
  1494. if (scheduler._scheduled === id2) {
  1495. scheduler._scheduled = void 0;
  1496. }
  1497. }
  1498. return void 0;
  1499. };
  1500. return AsapAction2;
  1501. }(AsyncAction);
  1502. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Scheduler.js
  1503. var Scheduler = function() {
  1504. function Scheduler2(schedulerActionCtor, now) {
  1505. if (now === void 0) {
  1506. now = Scheduler2.now;
  1507. }
  1508. this.schedulerActionCtor = schedulerActionCtor;
  1509. this.now = now;
  1510. }
  1511. Scheduler2.prototype.schedule = function(work, delay2, state) {
  1512. if (delay2 === void 0) {
  1513. delay2 = 0;
  1514. }
  1515. return new this.schedulerActionCtor(this, work).schedule(state, delay2);
  1516. };
  1517. Scheduler2.now = dateTimestampProvider.now;
  1518. return Scheduler2;
  1519. }();
  1520. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/AsyncScheduler.js
  1521. var AsyncScheduler = function(_super) {
  1522. __extends(AsyncScheduler2, _super);
  1523. function AsyncScheduler2(SchedulerAction, now) {
  1524. if (now === void 0) {
  1525. now = Scheduler.now;
  1526. }
  1527. var _this = _super.call(this, SchedulerAction, now) || this;
  1528. _this.actions = [];
  1529. _this._active = false;
  1530. return _this;
  1531. }
  1532. AsyncScheduler2.prototype.flush = function(action) {
  1533. var actions = this.actions;
  1534. if (this._active) {
  1535. actions.push(action);
  1536. return;
  1537. }
  1538. var error;
  1539. this._active = true;
  1540. do {
  1541. if (error = action.execute(action.state, action.delay)) {
  1542. break;
  1543. }
  1544. } while (action = actions.shift());
  1545. this._active = false;
  1546. if (error) {
  1547. while (action = actions.shift()) {
  1548. action.unsubscribe();
  1549. }
  1550. throw error;
  1551. }
  1552. };
  1553. return AsyncScheduler2;
  1554. }(Scheduler);
  1555. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/AsapScheduler.js
  1556. var AsapScheduler = function(_super) {
  1557. __extends(AsapScheduler2, _super);
  1558. function AsapScheduler2() {
  1559. return _super !== null && _super.apply(this, arguments) || this;
  1560. }
  1561. AsapScheduler2.prototype.flush = function(action) {
  1562. this._active = true;
  1563. var flushId = this._scheduled;
  1564. this._scheduled = void 0;
  1565. var actions = this.actions;
  1566. var error;
  1567. action = action || actions.shift();
  1568. do {
  1569. if (error = action.execute(action.state, action.delay)) {
  1570. break;
  1571. }
  1572. } while ((action = actions[0]) && action.id === flushId && actions.shift());
  1573. this._active = false;
  1574. if (error) {
  1575. while ((action = actions[0]) && action.id === flushId && actions.shift()) {
  1576. action.unsubscribe();
  1577. }
  1578. throw error;
  1579. }
  1580. };
  1581. return AsapScheduler2;
  1582. }(AsyncScheduler);
  1583. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/asap.js
  1584. var asapScheduler = new AsapScheduler(AsapAction);
  1585. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/async.js
  1586. var asyncScheduler = new AsyncScheduler(AsyncAction);
  1587. var async = asyncScheduler;
  1588. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/QueueAction.js
  1589. var QueueAction = function(_super) {
  1590. __extends(QueueAction2, _super);
  1591. function QueueAction2(scheduler, work) {
  1592. var _this = _super.call(this, scheduler, work) || this;
  1593. _this.scheduler = scheduler;
  1594. _this.work = work;
  1595. return _this;
  1596. }
  1597. QueueAction2.prototype.schedule = function(state, delay2) {
  1598. if (delay2 === void 0) {
  1599. delay2 = 0;
  1600. }
  1601. if (delay2 > 0) {
  1602. return _super.prototype.schedule.call(this, state, delay2);
  1603. }
  1604. this.delay = delay2;
  1605. this.state = state;
  1606. this.scheduler.flush(this);
  1607. return this;
  1608. };
  1609. QueueAction2.prototype.execute = function(state, delay2) {
  1610. return delay2 > 0 || this.closed ? _super.prototype.execute.call(this, state, delay2) : this._execute(state, delay2);
  1611. };
  1612. QueueAction2.prototype.requestAsyncId = function(scheduler, id2, delay2) {
  1613. if (delay2 === void 0) {
  1614. delay2 = 0;
  1615. }
  1616. if (delay2 != null && delay2 > 0 || delay2 == null && this.delay > 0) {
  1617. return _super.prototype.requestAsyncId.call(this, scheduler, id2, delay2);
  1618. }
  1619. scheduler.flush(this);
  1620. return 0;
  1621. };
  1622. return QueueAction2;
  1623. }(AsyncAction);
  1624. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/QueueScheduler.js
  1625. var QueueScheduler = function(_super) {
  1626. __extends(QueueScheduler2, _super);
  1627. function QueueScheduler2() {
  1628. return _super !== null && _super.apply(this, arguments) || this;
  1629. }
  1630. return QueueScheduler2;
  1631. }(AsyncScheduler);
  1632. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/queue.js
  1633. var queueScheduler = new QueueScheduler(QueueAction);
  1634. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/AnimationFrameAction.js
  1635. var AnimationFrameAction = function(_super) {
  1636. __extends(AnimationFrameAction2, _super);
  1637. function AnimationFrameAction2(scheduler, work) {
  1638. var _this = _super.call(this, scheduler, work) || this;
  1639. _this.scheduler = scheduler;
  1640. _this.work = work;
  1641. return _this;
  1642. }
  1643. AnimationFrameAction2.prototype.requestAsyncId = function(scheduler, id2, delay2) {
  1644. if (delay2 === void 0) {
  1645. delay2 = 0;
  1646. }
  1647. if (delay2 !== null && delay2 > 0) {
  1648. return _super.prototype.requestAsyncId.call(this, scheduler, id2, delay2);
  1649. }
  1650. scheduler.actions.push(this);
  1651. return scheduler._scheduled || (scheduler._scheduled = animationFrameProvider.requestAnimationFrame(function() {
  1652. return scheduler.flush(void 0);
  1653. }));
  1654. };
  1655. AnimationFrameAction2.prototype.recycleAsyncId = function(scheduler, id2, delay2) {
  1656. var _a2;
  1657. if (delay2 === void 0) {
  1658. delay2 = 0;
  1659. }
  1660. if (delay2 != null ? delay2 > 0 : this.delay > 0) {
  1661. return _super.prototype.recycleAsyncId.call(this, scheduler, id2, delay2);
  1662. }
  1663. var actions = scheduler.actions;
  1664. if (id2 != null && ((_a2 = actions[actions.length - 1]) === null || _a2 === void 0 ? void 0 : _a2.id) !== id2) {
  1665. animationFrameProvider.cancelAnimationFrame(id2);
  1666. scheduler._scheduled = void 0;
  1667. }
  1668. return void 0;
  1669. };
  1670. return AnimationFrameAction2;
  1671. }(AsyncAction);
  1672. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/AnimationFrameScheduler.js
  1673. var AnimationFrameScheduler = function(_super) {
  1674. __extends(AnimationFrameScheduler2, _super);
  1675. function AnimationFrameScheduler2() {
  1676. return _super !== null && _super.apply(this, arguments) || this;
  1677. }
  1678. AnimationFrameScheduler2.prototype.flush = function(action) {
  1679. this._active = true;
  1680. var flushId = this._scheduled;
  1681. this._scheduled = void 0;
  1682. var actions = this.actions;
  1683. var error;
  1684. action = action || actions.shift();
  1685. do {
  1686. if (error = action.execute(action.state, action.delay)) {
  1687. break;
  1688. }
  1689. } while ((action = actions[0]) && action.id === flushId && actions.shift());
  1690. this._active = false;
  1691. if (error) {
  1692. while ((action = actions[0]) && action.id === flushId && actions.shift()) {
  1693. action.unsubscribe();
  1694. }
  1695. throw error;
  1696. }
  1697. };
  1698. return AnimationFrameScheduler2;
  1699. }(AsyncScheduler);
  1700. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/animationFrame.js
  1701. var animationFrameScheduler = new AnimationFrameScheduler(AnimationFrameAction);
  1702. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/VirtualTimeScheduler.js
  1703. var VirtualTimeScheduler = function(_super) {
  1704. __extends(VirtualTimeScheduler2, _super);
  1705. function VirtualTimeScheduler2(schedulerActionCtor, maxFrames) {
  1706. if (schedulerActionCtor === void 0) {
  1707. schedulerActionCtor = VirtualAction;
  1708. }
  1709. if (maxFrames === void 0) {
  1710. maxFrames = Infinity;
  1711. }
  1712. var _this = _super.call(this, schedulerActionCtor, function() {
  1713. return _this.frame;
  1714. }) || this;
  1715. _this.maxFrames = maxFrames;
  1716. _this.frame = 0;
  1717. _this.index = -1;
  1718. return _this;
  1719. }
  1720. VirtualTimeScheduler2.prototype.flush = function() {
  1721. var _a2 = this, actions = _a2.actions, maxFrames = _a2.maxFrames;
  1722. var error;
  1723. var action;
  1724. while ((action = actions[0]) && action.delay <= maxFrames) {
  1725. actions.shift();
  1726. this.frame = action.delay;
  1727. if (error = action.execute(action.state, action.delay)) {
  1728. break;
  1729. }
  1730. }
  1731. if (error) {
  1732. while (action = actions.shift()) {
  1733. action.unsubscribe();
  1734. }
  1735. throw error;
  1736. }
  1737. };
  1738. VirtualTimeScheduler2.frameTimeFactor = 10;
  1739. return VirtualTimeScheduler2;
  1740. }(AsyncScheduler);
  1741. var VirtualAction = function(_super) {
  1742. __extends(VirtualAction2, _super);
  1743. function VirtualAction2(scheduler, work, index) {
  1744. if (index === void 0) {
  1745. index = scheduler.index += 1;
  1746. }
  1747. var _this = _super.call(this, scheduler, work) || this;
  1748. _this.scheduler = scheduler;
  1749. _this.work = work;
  1750. _this.index = index;
  1751. _this.active = true;
  1752. _this.index = scheduler.index = index;
  1753. return _this;
  1754. }
  1755. VirtualAction2.prototype.schedule = function(state, delay2) {
  1756. if (delay2 === void 0) {
  1757. delay2 = 0;
  1758. }
  1759. if (Number.isFinite(delay2)) {
  1760. if (!this.id) {
  1761. return _super.prototype.schedule.call(this, state, delay2);
  1762. }
  1763. this.active = false;
  1764. var action = new VirtualAction2(this.scheduler, this.work);
  1765. this.add(action);
  1766. return action.schedule(state, delay2);
  1767. } else {
  1768. return Subscription.EMPTY;
  1769. }
  1770. };
  1771. VirtualAction2.prototype.requestAsyncId = function(scheduler, id2, delay2) {
  1772. if (delay2 === void 0) {
  1773. delay2 = 0;
  1774. }
  1775. this.delay = scheduler.frame + delay2;
  1776. var actions = scheduler.actions;
  1777. actions.push(this);
  1778. actions.sort(VirtualAction2.sortActions);
  1779. return 1;
  1780. };
  1781. VirtualAction2.prototype.recycleAsyncId = function(scheduler, id2, delay2) {
  1782. if (delay2 === void 0) {
  1783. delay2 = 0;
  1784. }
  1785. return void 0;
  1786. };
  1787. VirtualAction2.prototype._execute = function(state, delay2) {
  1788. if (this.active === true) {
  1789. return _super.prototype._execute.call(this, state, delay2);
  1790. }
  1791. };
  1792. VirtualAction2.sortActions = function(a, b) {
  1793. if (a.delay === b.delay) {
  1794. if (a.index === b.index) {
  1795. return 0;
  1796. } else if (a.index > b.index) {
  1797. return 1;
  1798. } else {
  1799. return -1;
  1800. }
  1801. } else if (a.delay > b.delay) {
  1802. return 1;
  1803. } else {
  1804. return -1;
  1805. }
  1806. };
  1807. return VirtualAction2;
  1808. }(AsyncAction);
  1809. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/empty.js
  1810. var EMPTY = new Observable(function(subscriber) {
  1811. return subscriber.complete();
  1812. });
  1813. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isScheduler.js
  1814. function isScheduler(value) {
  1815. return value && isFunction(value.schedule);
  1816. }
  1817. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/args.js
  1818. function last(arr) {
  1819. return arr[arr.length - 1];
  1820. }
  1821. function popResultSelector(args) {
  1822. return isFunction(last(args)) ? args.pop() : void 0;
  1823. }
  1824. function popScheduler(args) {
  1825. return isScheduler(last(args)) ? args.pop() : void 0;
  1826. }
  1827. function popNumber(args, defaultValue) {
  1828. return typeof last(args) === "number" ? args.pop() : defaultValue;
  1829. }
  1830. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isArrayLike.js
  1831. var isArrayLike = function(x) {
  1832. return x && typeof x.length === "number" && typeof x !== "function";
  1833. };
  1834. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isPromise.js
  1835. function isPromise(value) {
  1836. return isFunction(value === null || value === void 0 ? void 0 : value.then);
  1837. }
  1838. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isInteropObservable.js
  1839. function isInteropObservable(input) {
  1840. return isFunction(input[observable]);
  1841. }
  1842. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isAsyncIterable.js
  1843. function isAsyncIterable(obj) {
  1844. return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
  1845. }
  1846. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/throwUnobservableError.js
  1847. function createInvalidObservableTypeError(input) {
  1848. return new TypeError("You provided " + (input !== null && typeof input === "object" ? "an invalid object" : "'" + input + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
  1849. }
  1850. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/symbol/iterator.js
  1851. function getSymbolIterator() {
  1852. if (typeof Symbol !== "function" || !Symbol.iterator) {
  1853. return "@@iterator";
  1854. }
  1855. return Symbol.iterator;
  1856. }
  1857. var iterator = getSymbolIterator();
  1858. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isIterable.js
  1859. function isIterable(input) {
  1860. return isFunction(input === null || input === void 0 ? void 0 : input[iterator]);
  1861. }
  1862. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isReadableStreamLike.js
  1863. function readableStreamLikeToAsyncGenerator(readableStream) {
  1864. return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
  1865. var reader, _a2, value, done;
  1866. return __generator(this, function(_b) {
  1867. switch (_b.label) {
  1868. case 0:
  1869. reader = readableStream.getReader();
  1870. _b.label = 1;
  1871. case 1:
  1872. _b.trys.push([1, , 9, 10]);
  1873. _b.label = 2;
  1874. case 2:
  1875. if (false)
  1876. return [3, 8];
  1877. return [4, __await(reader.read())];
  1878. case 3:
  1879. _a2 = _b.sent(), value = _a2.value, done = _a2.done;
  1880. if (!done)
  1881. return [3, 5];
  1882. return [4, __await(void 0)];
  1883. case 4:
  1884. return [2, _b.sent()];
  1885. case 5:
  1886. return [4, __await(value)];
  1887. case 6:
  1888. return [4, _b.sent()];
  1889. case 7:
  1890. _b.sent();
  1891. return [3, 2];
  1892. case 8:
  1893. return [3, 10];
  1894. case 9:
  1895. reader.releaseLock();
  1896. return [7];
  1897. case 10:
  1898. return [2];
  1899. }
  1900. });
  1901. });
  1902. }
  1903. function isReadableStreamLike(obj) {
  1904. return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
  1905. }
  1906. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/innerFrom.js
  1907. function innerFrom(input) {
  1908. if (input instanceof Observable) {
  1909. return input;
  1910. }
  1911. if (input != null) {
  1912. if (isInteropObservable(input)) {
  1913. return fromInteropObservable(input);
  1914. }
  1915. if (isArrayLike(input)) {
  1916. return fromArrayLike(input);
  1917. }
  1918. if (isPromise(input)) {
  1919. return fromPromise(input);
  1920. }
  1921. if (isAsyncIterable(input)) {
  1922. return fromAsyncIterable(input);
  1923. }
  1924. if (isIterable(input)) {
  1925. return fromIterable(input);
  1926. }
  1927. if (isReadableStreamLike(input)) {
  1928. return fromReadableStreamLike(input);
  1929. }
  1930. }
  1931. throw createInvalidObservableTypeError(input);
  1932. }
  1933. function fromInteropObservable(obj) {
  1934. return new Observable(function(subscriber) {
  1935. var obs = obj[observable]();
  1936. if (isFunction(obs.subscribe)) {
  1937. return obs.subscribe(subscriber);
  1938. }
  1939. throw new TypeError("Provided object does not correctly implement Symbol.observable");
  1940. });
  1941. }
  1942. function fromArrayLike(array) {
  1943. return new Observable(function(subscriber) {
  1944. for (var i = 0; i < array.length && !subscriber.closed; i++) {
  1945. subscriber.next(array[i]);
  1946. }
  1947. subscriber.complete();
  1948. });
  1949. }
  1950. function fromPromise(promise) {
  1951. return new Observable(function(subscriber) {
  1952. promise.then(function(value) {
  1953. if (!subscriber.closed) {
  1954. subscriber.next(value);
  1955. subscriber.complete();
  1956. }
  1957. }, function(err) {
  1958. return subscriber.error(err);
  1959. }).then(null, reportUnhandledError);
  1960. });
  1961. }
  1962. function fromIterable(iterable) {
  1963. return new Observable(function(subscriber) {
  1964. var e_1, _a2;
  1965. try {
  1966. for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
  1967. var value = iterable_1_1.value;
  1968. subscriber.next(value);
  1969. if (subscriber.closed) {
  1970. return;
  1971. }
  1972. }
  1973. } catch (e_1_1) {
  1974. e_1 = { error: e_1_1 };
  1975. } finally {
  1976. try {
  1977. if (iterable_1_1 && !iterable_1_1.done && (_a2 = iterable_1.return))
  1978. _a2.call(iterable_1);
  1979. } finally {
  1980. if (e_1)
  1981. throw e_1.error;
  1982. }
  1983. }
  1984. subscriber.complete();
  1985. });
  1986. }
  1987. function fromAsyncIterable(asyncIterable) {
  1988. return new Observable(function(subscriber) {
  1989. process2(asyncIterable, subscriber).catch(function(err) {
  1990. return subscriber.error(err);
  1991. });
  1992. });
  1993. }
  1994. function fromReadableStreamLike(readableStream) {
  1995. return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
  1996. }
  1997. function process2(asyncIterable, subscriber) {
  1998. var asyncIterable_1, asyncIterable_1_1;
  1999. var e_2, _a2;
  2000. return __awaiter(this, void 0, void 0, function() {
  2001. var value, e_2_1;
  2002. return __generator(this, function(_b) {
  2003. switch (_b.label) {
  2004. case 0:
  2005. _b.trys.push([0, 5, 6, 11]);
  2006. asyncIterable_1 = __asyncValues(asyncIterable);
  2007. _b.label = 1;
  2008. case 1:
  2009. return [4, asyncIterable_1.next()];
  2010. case 2:
  2011. if (!(asyncIterable_1_1 = _b.sent(), !asyncIterable_1_1.done))
  2012. return [3, 4];
  2013. value = asyncIterable_1_1.value;
  2014. subscriber.next(value);
  2015. if (subscriber.closed) {
  2016. return [2];
  2017. }
  2018. _b.label = 3;
  2019. case 3:
  2020. return [3, 1];
  2021. case 4:
  2022. return [3, 11];
  2023. case 5:
  2024. e_2_1 = _b.sent();
  2025. e_2 = { error: e_2_1 };
  2026. return [3, 11];
  2027. case 6:
  2028. _b.trys.push([6, , 9, 10]);
  2029. if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a2 = asyncIterable_1.return)))
  2030. return [3, 8];
  2031. return [4, _a2.call(asyncIterable_1)];
  2032. case 7:
  2033. _b.sent();
  2034. _b.label = 8;
  2035. case 8:
  2036. return [3, 10];
  2037. case 9:
  2038. if (e_2)
  2039. throw e_2.error;
  2040. return [7];
  2041. case 10:
  2042. return [7];
  2043. case 11:
  2044. subscriber.complete();
  2045. return [2];
  2046. }
  2047. });
  2048. });
  2049. }
  2050. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/executeSchedule.js
  2051. function executeSchedule(parentSubscription, scheduler, work, delay2, repeat2) {
  2052. if (delay2 === void 0) {
  2053. delay2 = 0;
  2054. }
  2055. if (repeat2 === void 0) {
  2056. repeat2 = false;
  2057. }
  2058. var scheduleSubscription = scheduler.schedule(function() {
  2059. work();
  2060. if (repeat2) {
  2061. parentSubscription.add(this.schedule(null, delay2));
  2062. } else {
  2063. this.unsubscribe();
  2064. }
  2065. }, delay2);
  2066. parentSubscription.add(scheduleSubscription);
  2067. if (!repeat2) {
  2068. return scheduleSubscription;
  2069. }
  2070. }
  2071. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/observeOn.js
  2072. function observeOn(scheduler, delay2) {
  2073. if (delay2 === void 0) {
  2074. delay2 = 0;
  2075. }
  2076. return operate(function(source, subscriber) {
  2077. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  2078. return executeSchedule(subscriber, scheduler, function() {
  2079. return subscriber.next(value);
  2080. }, delay2);
  2081. }, function() {
  2082. return executeSchedule(subscriber, scheduler, function() {
  2083. return subscriber.complete();
  2084. }, delay2);
  2085. }, function(err) {
  2086. return executeSchedule(subscriber, scheduler, function() {
  2087. return subscriber.error(err);
  2088. }, delay2);
  2089. }));
  2090. });
  2091. }
  2092. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/subscribeOn.js
  2093. function subscribeOn(scheduler, delay2) {
  2094. if (delay2 === void 0) {
  2095. delay2 = 0;
  2096. }
  2097. return operate(function(source, subscriber) {
  2098. subscriber.add(scheduler.schedule(function() {
  2099. return source.subscribe(subscriber);
  2100. }, delay2));
  2101. });
  2102. }
  2103. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduled/scheduleObservable.js
  2104. function scheduleObservable(input, scheduler) {
  2105. return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
  2106. }
  2107. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduled/schedulePromise.js
  2108. function schedulePromise(input, scheduler) {
  2109. return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
  2110. }
  2111. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduled/scheduleArray.js
  2112. function scheduleArray(input, scheduler) {
  2113. return new Observable(function(subscriber) {
  2114. var i = 0;
  2115. return scheduler.schedule(function() {
  2116. if (i === input.length) {
  2117. subscriber.complete();
  2118. } else {
  2119. subscriber.next(input[i++]);
  2120. if (!subscriber.closed) {
  2121. this.schedule();
  2122. }
  2123. }
  2124. });
  2125. });
  2126. }
  2127. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduled/scheduleIterable.js
  2128. function scheduleIterable(input, scheduler) {
  2129. return new Observable(function(subscriber) {
  2130. var iterator2;
  2131. executeSchedule(subscriber, scheduler, function() {
  2132. iterator2 = input[iterator]();
  2133. executeSchedule(subscriber, scheduler, function() {
  2134. var _a2;
  2135. var value;
  2136. var done;
  2137. try {
  2138. _a2 = iterator2.next(), value = _a2.value, done = _a2.done;
  2139. } catch (err) {
  2140. subscriber.error(err);
  2141. return;
  2142. }
  2143. if (done) {
  2144. subscriber.complete();
  2145. } else {
  2146. subscriber.next(value);
  2147. }
  2148. }, 0, true);
  2149. });
  2150. return function() {
  2151. return isFunction(iterator2 === null || iterator2 === void 0 ? void 0 : iterator2.return) && iterator2.return();
  2152. };
  2153. });
  2154. }
  2155. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduled/scheduleAsyncIterable.js
  2156. function scheduleAsyncIterable(input, scheduler) {
  2157. if (!input) {
  2158. throw new Error("Iterable cannot be null");
  2159. }
  2160. return new Observable(function(subscriber) {
  2161. executeSchedule(subscriber, scheduler, function() {
  2162. var iterator2 = input[Symbol.asyncIterator]();
  2163. executeSchedule(subscriber, scheduler, function() {
  2164. iterator2.next().then(function(result) {
  2165. if (result.done) {
  2166. subscriber.complete();
  2167. } else {
  2168. subscriber.next(result.value);
  2169. }
  2170. });
  2171. }, 0, true);
  2172. });
  2173. });
  2174. }
  2175. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduled/scheduleReadableStreamLike.js
  2176. function scheduleReadableStreamLike(input, scheduler) {
  2177. return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);
  2178. }
  2179. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduled/scheduled.js
  2180. function scheduled(input, scheduler) {
  2181. if (input != null) {
  2182. if (isInteropObservable(input)) {
  2183. return scheduleObservable(input, scheduler);
  2184. }
  2185. if (isArrayLike(input)) {
  2186. return scheduleArray(input, scheduler);
  2187. }
  2188. if (isPromise(input)) {
  2189. return schedulePromise(input, scheduler);
  2190. }
  2191. if (isAsyncIterable(input)) {
  2192. return scheduleAsyncIterable(input, scheduler);
  2193. }
  2194. if (isIterable(input)) {
  2195. return scheduleIterable(input, scheduler);
  2196. }
  2197. if (isReadableStreamLike(input)) {
  2198. return scheduleReadableStreamLike(input, scheduler);
  2199. }
  2200. }
  2201. throw createInvalidObservableTypeError(input);
  2202. }
  2203. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/from.js
  2204. function from(input, scheduler) {
  2205. return scheduler ? scheduled(input, scheduler) : innerFrom(input);
  2206. }
  2207. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/of.js
  2208. function of() {
  2209. var args = [];
  2210. for (var _i2 = 0; _i2 < arguments.length; _i2++) {
  2211. args[_i2] = arguments[_i2];
  2212. }
  2213. var scheduler = popScheduler(args);
  2214. return from(args, scheduler);
  2215. }
  2216. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/throwError.js
  2217. function throwError(errorOrErrorFactory, scheduler) {
  2218. var errorFactory = isFunction(errorOrErrorFactory) ? errorOrErrorFactory : function() {
  2219. return errorOrErrorFactory;
  2220. };
  2221. var init = function(subscriber) {
  2222. return subscriber.error(errorFactory());
  2223. };
  2224. return new Observable(scheduler ? function(subscriber) {
  2225. return scheduler.schedule(init, 0, subscriber);
  2226. } : init);
  2227. }
  2228. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Notification.js
  2229. var NotificationKind;
  2230. (function(NotificationKind2) {
  2231. NotificationKind2["NEXT"] = "N";
  2232. NotificationKind2["ERROR"] = "E";
  2233. NotificationKind2["COMPLETE"] = "C";
  2234. })(NotificationKind || (NotificationKind = {}));
  2235. var Notification = function() {
  2236. function Notification2(kind, value, error) {
  2237. this.kind = kind;
  2238. this.value = value;
  2239. this.error = error;
  2240. this.hasValue = kind === "N";
  2241. }
  2242. Notification2.prototype.observe = function(observer) {
  2243. return observeNotification(this, observer);
  2244. };
  2245. Notification2.prototype.do = function(nextHandler, errorHandler, completeHandler) {
  2246. var _a2 = this, kind = _a2.kind, value = _a2.value, error = _a2.error;
  2247. return kind === "N" ? nextHandler === null || nextHandler === void 0 ? void 0 : nextHandler(value) : kind === "E" ? errorHandler === null || errorHandler === void 0 ? void 0 : errorHandler(error) : completeHandler === null || completeHandler === void 0 ? void 0 : completeHandler();
  2248. };
  2249. Notification2.prototype.accept = function(nextOrObserver, error, complete) {
  2250. var _a2;
  2251. return isFunction((_a2 = nextOrObserver) === null || _a2 === void 0 ? void 0 : _a2.next) ? this.observe(nextOrObserver) : this.do(nextOrObserver, error, complete);
  2252. };
  2253. Notification2.prototype.toObservable = function() {
  2254. var _a2 = this, kind = _a2.kind, value = _a2.value, error = _a2.error;
  2255. var result = kind === "N" ? of(value) : kind === "E" ? throwError(function() {
  2256. return error;
  2257. }) : kind === "C" ? EMPTY : 0;
  2258. if (!result) {
  2259. throw new TypeError("Unexpected notification kind " + kind);
  2260. }
  2261. return result;
  2262. };
  2263. Notification2.createNext = function(value) {
  2264. return new Notification2("N", value);
  2265. };
  2266. Notification2.createError = function(err) {
  2267. return new Notification2("E", void 0, err);
  2268. };
  2269. Notification2.createComplete = function() {
  2270. return Notification2.completeNotification;
  2271. };
  2272. Notification2.completeNotification = new Notification2("C");
  2273. return Notification2;
  2274. }();
  2275. function observeNotification(notification, observer) {
  2276. var _a2, _b, _c2;
  2277. var _d2 = notification, kind = _d2.kind, value = _d2.value, error = _d2.error;
  2278. if (typeof kind !== "string") {
  2279. throw new TypeError('Invalid notification, missing "kind"');
  2280. }
  2281. kind === "N" ? (_a2 = observer.next) === null || _a2 === void 0 ? void 0 : _a2.call(observer, value) : kind === "E" ? (_b = observer.error) === null || _b === void 0 ? void 0 : _b.call(observer, error) : (_c2 = observer.complete) === null || _c2 === void 0 ? void 0 : _c2.call(observer);
  2282. }
  2283. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isObservable.js
  2284. function isObservable(obj) {
  2285. return !!obj && (obj instanceof Observable || isFunction(obj.lift) && isFunction(obj.subscribe));
  2286. }
  2287. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/EmptyError.js
  2288. var EmptyError = createErrorClass(function(_super) {
  2289. return function EmptyErrorImpl() {
  2290. _super(this);
  2291. this.name = "EmptyError";
  2292. this.message = "no elements in sequence";
  2293. };
  2294. });
  2295. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/firstValueFrom.js
  2296. function firstValueFrom(source, config2) {
  2297. var hasConfig = typeof config2 === "object";
  2298. return new Promise(function(resolve, reject) {
  2299. var subscriber = new SafeSubscriber({
  2300. next: function(value) {
  2301. resolve(value);
  2302. subscriber.unsubscribe();
  2303. },
  2304. error: reject,
  2305. complete: function() {
  2306. if (hasConfig) {
  2307. resolve(config2.defaultValue);
  2308. } else {
  2309. reject(new EmptyError());
  2310. }
  2311. }
  2312. });
  2313. source.subscribe(subscriber);
  2314. });
  2315. }
  2316. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/ArgumentOutOfRangeError.js
  2317. var ArgumentOutOfRangeError = createErrorClass(function(_super) {
  2318. return function ArgumentOutOfRangeErrorImpl() {
  2319. _super(this);
  2320. this.name = "ArgumentOutOfRangeError";
  2321. this.message = "argument out of range";
  2322. };
  2323. });
  2324. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/NotFoundError.js
  2325. var NotFoundError = createErrorClass(function(_super) {
  2326. return function NotFoundErrorImpl(message) {
  2327. _super(this);
  2328. this.name = "NotFoundError";
  2329. this.message = message;
  2330. };
  2331. });
  2332. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/SequenceError.js
  2333. var SequenceError = createErrorClass(function(_super) {
  2334. return function SequenceErrorImpl(message) {
  2335. _super(this);
  2336. this.name = "SequenceError";
  2337. this.message = message;
  2338. };
  2339. });
  2340. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isDate.js
  2341. function isValidDate(value) {
  2342. return value instanceof Date && !isNaN(value);
  2343. }
  2344. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/timeout.js
  2345. var TimeoutError = createErrorClass(function(_super) {
  2346. return function TimeoutErrorImpl(info) {
  2347. if (info === void 0) {
  2348. info = null;
  2349. }
  2350. _super(this);
  2351. this.message = "Timeout has occurred";
  2352. this.name = "TimeoutError";
  2353. this.info = info;
  2354. };
  2355. });
  2356. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/map.js
  2357. function map(project, thisArg) {
  2358. return operate(function(source, subscriber) {
  2359. var index = 0;
  2360. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  2361. subscriber.next(project.call(thisArg, value, index++));
  2362. }));
  2363. });
  2364. }
  2365. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/mapOneOrManyArgs.js
  2366. var isArray = Array.isArray;
  2367. function callOrApply(fn2, args) {
  2368. return isArray(args) ? fn2.apply(void 0, __spreadArray([], __read(args))) : fn2(args);
  2369. }
  2370. function mapOneOrManyArgs(fn2) {
  2371. return map(function(args) {
  2372. return callOrApply(fn2, args);
  2373. });
  2374. }
  2375. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/argsArgArrayOrObject.js
  2376. var isArray2 = Array.isArray;
  2377. var getPrototypeOf = Object.getPrototypeOf;
  2378. var objectProto = Object.prototype;
  2379. var getKeys = Object.keys;
  2380. function argsArgArrayOrObject(args) {
  2381. if (args.length === 1) {
  2382. var first_1 = args[0];
  2383. if (isArray2(first_1)) {
  2384. return { args: first_1, keys: null };
  2385. }
  2386. if (isPOJO(first_1)) {
  2387. var keys = getKeys(first_1);
  2388. return {
  2389. args: keys.map(function(key) {
  2390. return first_1[key];
  2391. }),
  2392. keys
  2393. };
  2394. }
  2395. }
  2396. return { args, keys: null };
  2397. }
  2398. function isPOJO(obj) {
  2399. return obj && typeof obj === "object" && getPrototypeOf(obj) === objectProto;
  2400. }
  2401. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/createObject.js
  2402. function createObject(keys, values) {
  2403. return keys.reduce(function(result, key, i) {
  2404. return result[key] = values[i], result;
  2405. }, {});
  2406. }
  2407. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/combineLatest.js
  2408. function combineLatest() {
  2409. var args = [];
  2410. for (var _i2 = 0; _i2 < arguments.length; _i2++) {
  2411. args[_i2] = arguments[_i2];
  2412. }
  2413. var scheduler = popScheduler(args);
  2414. var resultSelector = popResultSelector(args);
  2415. var _a2 = argsArgArrayOrObject(args), observables = _a2.args, keys = _a2.keys;
  2416. if (observables.length === 0) {
  2417. return from([], scheduler);
  2418. }
  2419. var result = new Observable(combineLatestInit(observables, scheduler, keys ? function(values) {
  2420. return createObject(keys, values);
  2421. } : identity));
  2422. return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result;
  2423. }
  2424. function combineLatestInit(observables, scheduler, valueTransform) {
  2425. if (valueTransform === void 0) {
  2426. valueTransform = identity;
  2427. }
  2428. return function(subscriber) {
  2429. maybeSchedule(scheduler, function() {
  2430. var length = observables.length;
  2431. var values = new Array(length);
  2432. var active = length;
  2433. var remainingFirstValues = length;
  2434. var _loop_1 = function(i2) {
  2435. maybeSchedule(scheduler, function() {
  2436. var source = from(observables[i2], scheduler);
  2437. var hasFirstValue = false;
  2438. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  2439. values[i2] = value;
  2440. if (!hasFirstValue) {
  2441. hasFirstValue = true;
  2442. remainingFirstValues--;
  2443. }
  2444. if (!remainingFirstValues) {
  2445. subscriber.next(valueTransform(values.slice()));
  2446. }
  2447. }, function() {
  2448. if (!--active) {
  2449. subscriber.complete();
  2450. }
  2451. }));
  2452. }, subscriber);
  2453. };
  2454. for (var i = 0; i < length; i++) {
  2455. _loop_1(i);
  2456. }
  2457. }, subscriber);
  2458. };
  2459. }
  2460. function maybeSchedule(scheduler, execute, subscription) {
  2461. if (scheduler) {
  2462. executeSchedule(subscription, scheduler, execute);
  2463. } else {
  2464. execute();
  2465. }
  2466. }
  2467. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/mergeInternals.js
  2468. function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand2, innerSubScheduler, additionalFinalizer) {
  2469. var buffer2 = [];
  2470. var active = 0;
  2471. var index = 0;
  2472. var isComplete = false;
  2473. var checkComplete = function() {
  2474. if (isComplete && !buffer2.length && !active) {
  2475. subscriber.complete();
  2476. }
  2477. };
  2478. var outerNext = function(value) {
  2479. return active < concurrent ? doInnerSub(value) : buffer2.push(value);
  2480. };
  2481. var doInnerSub = function(value) {
  2482. expand2 && subscriber.next(value);
  2483. active++;
  2484. var innerComplete = false;
  2485. innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, function(innerValue) {
  2486. onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);
  2487. if (expand2) {
  2488. outerNext(innerValue);
  2489. } else {
  2490. subscriber.next(innerValue);
  2491. }
  2492. }, function() {
  2493. innerComplete = true;
  2494. }, void 0, function() {
  2495. if (innerComplete) {
  2496. try {
  2497. active--;
  2498. var _loop_1 = function() {
  2499. var bufferedValue = buffer2.shift();
  2500. if (innerSubScheduler) {
  2501. executeSchedule(subscriber, innerSubScheduler, function() {
  2502. return doInnerSub(bufferedValue);
  2503. });
  2504. } else {
  2505. doInnerSub(bufferedValue);
  2506. }
  2507. };
  2508. while (buffer2.length && active < concurrent) {
  2509. _loop_1();
  2510. }
  2511. checkComplete();
  2512. } catch (err) {
  2513. subscriber.error(err);
  2514. }
  2515. }
  2516. }));
  2517. };
  2518. source.subscribe(createOperatorSubscriber(subscriber, outerNext, function() {
  2519. isComplete = true;
  2520. checkComplete();
  2521. }));
  2522. return function() {
  2523. additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
  2524. };
  2525. }
  2526. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/mergeMap.js
  2527. function mergeMap(project, resultSelector, concurrent) {
  2528. if (concurrent === void 0) {
  2529. concurrent = Infinity;
  2530. }
  2531. if (isFunction(resultSelector)) {
  2532. return mergeMap(function(a, i) {
  2533. return map(function(b, ii2) {
  2534. return resultSelector(a, b, i, ii2);
  2535. })(innerFrom(project(a, i)));
  2536. }, concurrent);
  2537. } else if (typeof resultSelector === "number") {
  2538. concurrent = resultSelector;
  2539. }
  2540. return operate(function(source, subscriber) {
  2541. return mergeInternals(source, subscriber, project, concurrent);
  2542. });
  2543. }
  2544. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/mergeAll.js
  2545. function mergeAll(concurrent) {
  2546. if (concurrent === void 0) {
  2547. concurrent = Infinity;
  2548. }
  2549. return mergeMap(identity, concurrent);
  2550. }
  2551. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/concatAll.js
  2552. function concatAll() {
  2553. return mergeAll(1);
  2554. }
  2555. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/concat.js
  2556. function concat() {
  2557. var args = [];
  2558. for (var _i2 = 0; _i2 < arguments.length; _i2++) {
  2559. args[_i2] = arguments[_i2];
  2560. }
  2561. return concatAll()(from(args, popScheduler(args)));
  2562. }
  2563. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/fromEvent.js
  2564. var nodeEventEmitterMethods = ["addListener", "removeListener"];
  2565. var eventTargetMethods = ["addEventListener", "removeEventListener"];
  2566. var jqueryMethods = ["on", "off"];
  2567. function fromEvent(target, eventName, options, resultSelector) {
  2568. if (isFunction(options)) {
  2569. resultSelector = options;
  2570. options = void 0;
  2571. }
  2572. if (resultSelector) {
  2573. return fromEvent(target, eventName, options).pipe(mapOneOrManyArgs(resultSelector));
  2574. }
  2575. var _a2 = __read(isEventTarget(target) ? eventTargetMethods.map(function(methodName) {
  2576. return function(handler) {
  2577. return target[methodName](eventName, handler, options);
  2578. };
  2579. }) : isNodeStyleEventEmitter(target) ? nodeEventEmitterMethods.map(toCommonHandlerRegistry(target, eventName)) : isJQueryStyleEventEmitter(target) ? jqueryMethods.map(toCommonHandlerRegistry(target, eventName)) : [], 2), add = _a2[0], remove = _a2[1];
  2580. if (!add) {
  2581. if (isArrayLike(target)) {
  2582. return mergeMap(function(subTarget) {
  2583. return fromEvent(subTarget, eventName, options);
  2584. })(innerFrom(target));
  2585. }
  2586. }
  2587. if (!add) {
  2588. throw new TypeError("Invalid event target");
  2589. }
  2590. return new Observable(function(subscriber) {
  2591. var handler = function() {
  2592. var args = [];
  2593. for (var _i2 = 0; _i2 < arguments.length; _i2++) {
  2594. args[_i2] = arguments[_i2];
  2595. }
  2596. return subscriber.next(1 < args.length ? args : args[0]);
  2597. };
  2598. add(handler);
  2599. return function() {
  2600. return remove(handler);
  2601. };
  2602. });
  2603. }
  2604. function toCommonHandlerRegistry(target, eventName) {
  2605. return function(methodName) {
  2606. return function(handler) {
  2607. return target[methodName](eventName, handler);
  2608. };
  2609. };
  2610. }
  2611. function isNodeStyleEventEmitter(target) {
  2612. return isFunction(target.addListener) && isFunction(target.removeListener);
  2613. }
  2614. function isJQueryStyleEventEmitter(target) {
  2615. return isFunction(target.on) && isFunction(target.off);
  2616. }
  2617. function isEventTarget(target) {
  2618. return isFunction(target.addEventListener) && isFunction(target.removeEventListener);
  2619. }
  2620. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/timer.js
  2621. function timer(dueTime, intervalOrScheduler, scheduler) {
  2622. if (dueTime === void 0) {
  2623. dueTime = 0;
  2624. }
  2625. if (scheduler === void 0) {
  2626. scheduler = async;
  2627. }
  2628. var intervalDuration = -1;
  2629. if (intervalOrScheduler != null) {
  2630. if (isScheduler(intervalOrScheduler)) {
  2631. scheduler = intervalOrScheduler;
  2632. } else {
  2633. intervalDuration = intervalOrScheduler;
  2634. }
  2635. }
  2636. return new Observable(function(subscriber) {
  2637. var due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;
  2638. if (due < 0) {
  2639. due = 0;
  2640. }
  2641. var n = 0;
  2642. return scheduler.schedule(function() {
  2643. if (!subscriber.closed) {
  2644. subscriber.next(n++);
  2645. if (0 <= intervalDuration) {
  2646. this.schedule(void 0, intervalDuration);
  2647. } else {
  2648. subscriber.complete();
  2649. }
  2650. }
  2651. }, due);
  2652. });
  2653. }
  2654. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/merge.js
  2655. function merge() {
  2656. var args = [];
  2657. for (var _i2 = 0; _i2 < arguments.length; _i2++) {
  2658. args[_i2] = arguments[_i2];
  2659. }
  2660. var scheduler = popScheduler(args);
  2661. var concurrent = popNumber(args, Infinity);
  2662. var sources = args;
  2663. return !sources.length ? EMPTY : sources.length === 1 ? innerFrom(sources[0]) : mergeAll(concurrent)(from(sources, scheduler));
  2664. }
  2665. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/never.js
  2666. var NEVER = new Observable(noop);
  2667. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/argsOrArgArray.js
  2668. var isArray3 = Array.isArray;
  2669. function argsOrArgArray(args) {
  2670. return args.length === 1 && isArray3(args[0]) ? args[0] : args;
  2671. }
  2672. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/filter.js
  2673. function filter(predicate, thisArg) {
  2674. return operate(function(source, subscriber) {
  2675. var index = 0;
  2676. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  2677. return predicate.call(thisArg, value, index++) && subscriber.next(value);
  2678. }));
  2679. });
  2680. }
  2681. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/bufferTime.js
  2682. function bufferTime(bufferTimeSpan) {
  2683. var _a2, _b;
  2684. var otherArgs = [];
  2685. for (var _i2 = 1; _i2 < arguments.length; _i2++) {
  2686. otherArgs[_i2 - 1] = arguments[_i2];
  2687. }
  2688. var scheduler = (_a2 = popScheduler(otherArgs)) !== null && _a2 !== void 0 ? _a2 : asyncScheduler;
  2689. var bufferCreationInterval = (_b = otherArgs[0]) !== null && _b !== void 0 ? _b : null;
  2690. var maxBufferSize = otherArgs[1] || Infinity;
  2691. return operate(function(source, subscriber) {
  2692. var bufferRecords = [];
  2693. var restartOnEmit = false;
  2694. var emit = function(record) {
  2695. var buffer2 = record.buffer, subs = record.subs;
  2696. subs.unsubscribe();
  2697. arrRemove(bufferRecords, record);
  2698. subscriber.next(buffer2);
  2699. restartOnEmit && startBuffer();
  2700. };
  2701. var startBuffer = function() {
  2702. if (bufferRecords) {
  2703. var subs = new Subscription();
  2704. subscriber.add(subs);
  2705. var buffer2 = [];
  2706. var record_1 = {
  2707. buffer: buffer2,
  2708. subs
  2709. };
  2710. bufferRecords.push(record_1);
  2711. executeSchedule(subs, scheduler, function() {
  2712. return emit(record_1);
  2713. }, bufferTimeSpan);
  2714. }
  2715. };
  2716. if (bufferCreationInterval !== null && bufferCreationInterval >= 0) {
  2717. executeSchedule(subscriber, scheduler, startBuffer, bufferCreationInterval, true);
  2718. } else {
  2719. restartOnEmit = true;
  2720. }
  2721. startBuffer();
  2722. var bufferTimeSubscriber = createOperatorSubscriber(subscriber, function(value) {
  2723. var e_1, _a3;
  2724. var recordsCopy = bufferRecords.slice();
  2725. try {
  2726. for (var recordsCopy_1 = __values(recordsCopy), recordsCopy_1_1 = recordsCopy_1.next(); !recordsCopy_1_1.done; recordsCopy_1_1 = recordsCopy_1.next()) {
  2727. var record = recordsCopy_1_1.value;
  2728. var buffer2 = record.buffer;
  2729. buffer2.push(value);
  2730. maxBufferSize <= buffer2.length && emit(record);
  2731. }
  2732. } catch (e_1_1) {
  2733. e_1 = { error: e_1_1 };
  2734. } finally {
  2735. try {
  2736. if (recordsCopy_1_1 && !recordsCopy_1_1.done && (_a3 = recordsCopy_1.return))
  2737. _a3.call(recordsCopy_1);
  2738. } finally {
  2739. if (e_1)
  2740. throw e_1.error;
  2741. }
  2742. }
  2743. }, function() {
  2744. while (bufferRecords === null || bufferRecords === void 0 ? void 0 : bufferRecords.length) {
  2745. subscriber.next(bufferRecords.shift().buffer);
  2746. }
  2747. bufferTimeSubscriber === null || bufferTimeSubscriber === void 0 ? void 0 : bufferTimeSubscriber.unsubscribe();
  2748. subscriber.complete();
  2749. subscriber.unsubscribe();
  2750. }, void 0, function() {
  2751. return bufferRecords = null;
  2752. });
  2753. source.subscribe(bufferTimeSubscriber);
  2754. });
  2755. }
  2756. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/bufferWhen.js
  2757. function bufferWhen(closingSelector) {
  2758. return operate(function(source, subscriber) {
  2759. var buffer2 = null;
  2760. var closingSubscriber = null;
  2761. var openBuffer = function() {
  2762. closingSubscriber === null || closingSubscriber === void 0 ? void 0 : closingSubscriber.unsubscribe();
  2763. var b = buffer2;
  2764. buffer2 = [];
  2765. b && subscriber.next(b);
  2766. innerFrom(closingSelector()).subscribe(closingSubscriber = createOperatorSubscriber(subscriber, openBuffer, noop));
  2767. };
  2768. openBuffer();
  2769. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  2770. return buffer2 === null || buffer2 === void 0 ? void 0 : buffer2.push(value);
  2771. }, function() {
  2772. buffer2 && subscriber.next(buffer2);
  2773. subscriber.complete();
  2774. }, void 0, function() {
  2775. return buffer2 = closingSubscriber = null;
  2776. }));
  2777. });
  2778. }
  2779. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/combineLatest.js
  2780. function combineLatest2() {
  2781. var args = [];
  2782. for (var _i2 = 0; _i2 < arguments.length; _i2++) {
  2783. args[_i2] = arguments[_i2];
  2784. }
  2785. var resultSelector = popResultSelector(args);
  2786. return resultSelector ? pipe(combineLatest2.apply(void 0, __spreadArray([], __read(args))), mapOneOrManyArgs(resultSelector)) : operate(function(source, subscriber) {
  2787. combineLatestInit(__spreadArray([source], __read(argsOrArgArray(args))))(subscriber);
  2788. });
  2789. }
  2790. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/combineLatestWith.js
  2791. function combineLatestWith() {
  2792. var otherSources = [];
  2793. for (var _i2 = 0; _i2 < arguments.length; _i2++) {
  2794. otherSources[_i2] = arguments[_i2];
  2795. }
  2796. return combineLatest2.apply(void 0, __spreadArray([], __read(otherSources)));
  2797. }
  2798. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/debounceTime.js
  2799. function debounceTime(dueTime, scheduler) {
  2800. if (scheduler === void 0) {
  2801. scheduler = asyncScheduler;
  2802. }
  2803. return operate(function(source, subscriber) {
  2804. var activeTask = null;
  2805. var lastValue = null;
  2806. var lastTime = null;
  2807. var emit = function() {
  2808. if (activeTask) {
  2809. activeTask.unsubscribe();
  2810. activeTask = null;
  2811. var value = lastValue;
  2812. lastValue = null;
  2813. subscriber.next(value);
  2814. }
  2815. };
  2816. function emitWhenIdle() {
  2817. var targetTime = lastTime + dueTime;
  2818. var now = scheduler.now();
  2819. if (now < targetTime) {
  2820. activeTask = this.schedule(void 0, targetTime - now);
  2821. subscriber.add(activeTask);
  2822. return;
  2823. }
  2824. emit();
  2825. }
  2826. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  2827. lastValue = value;
  2828. lastTime = scheduler.now();
  2829. if (!activeTask) {
  2830. activeTask = scheduler.schedule(emitWhenIdle, dueTime);
  2831. subscriber.add(activeTask);
  2832. }
  2833. }, function() {
  2834. emit();
  2835. subscriber.complete();
  2836. }, void 0, function() {
  2837. lastValue = activeTask = null;
  2838. }));
  2839. });
  2840. }
  2841. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/defaultIfEmpty.js
  2842. function defaultIfEmpty(defaultValue) {
  2843. return operate(function(source, subscriber) {
  2844. var hasValue = false;
  2845. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  2846. hasValue = true;
  2847. subscriber.next(value);
  2848. }, function() {
  2849. if (!hasValue) {
  2850. subscriber.next(defaultValue);
  2851. }
  2852. subscriber.complete();
  2853. }));
  2854. });
  2855. }
  2856. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/take.js
  2857. function take(count2) {
  2858. return count2 <= 0 ? function() {
  2859. return EMPTY;
  2860. } : operate(function(source, subscriber) {
  2861. var seen = 0;
  2862. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  2863. if (++seen <= count2) {
  2864. subscriber.next(value);
  2865. if (count2 <= seen) {
  2866. subscriber.complete();
  2867. }
  2868. }
  2869. }));
  2870. });
  2871. }
  2872. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/distinctUntilChanged.js
  2873. function distinctUntilChanged(comparator, keySelector) {
  2874. if (keySelector === void 0) {
  2875. keySelector = identity;
  2876. }
  2877. comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;
  2878. return operate(function(source, subscriber) {
  2879. var previousKey;
  2880. var first2 = true;
  2881. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  2882. var currentKey = keySelector(value);
  2883. if (first2 || !comparator(previousKey, currentKey)) {
  2884. first2 = false;
  2885. previousKey = currentKey;
  2886. subscriber.next(value);
  2887. }
  2888. }));
  2889. });
  2890. }
  2891. function defaultCompare(a, b) {
  2892. return a === b;
  2893. }
  2894. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/throwIfEmpty.js
  2895. function throwIfEmpty(errorFactory) {
  2896. if (errorFactory === void 0) {
  2897. errorFactory = defaultErrorFactory;
  2898. }
  2899. return operate(function(source, subscriber) {
  2900. var hasValue = false;
  2901. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  2902. hasValue = true;
  2903. subscriber.next(value);
  2904. }, function() {
  2905. return hasValue ? subscriber.complete() : subscriber.error(errorFactory());
  2906. }));
  2907. });
  2908. }
  2909. function defaultErrorFactory() {
  2910. return new EmptyError();
  2911. }
  2912. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/first.js
  2913. function first(predicate, defaultValue) {
  2914. var hasDefaultValue = arguments.length >= 2;
  2915. return function(source) {
  2916. return source.pipe(predicate ? filter(function(v, i) {
  2917. return predicate(v, i, source);
  2918. }) : identity, take(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(function() {
  2919. return new EmptyError();
  2920. }));
  2921. };
  2922. }
  2923. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/share.js
  2924. function share(options) {
  2925. if (options === void 0) {
  2926. options = {};
  2927. }
  2928. var _a2 = options.connector, connector = _a2 === void 0 ? function() {
  2929. return new Subject();
  2930. } : _a2, _b = options.resetOnError, resetOnError = _b === void 0 ? true : _b, _c2 = options.resetOnComplete, resetOnComplete = _c2 === void 0 ? true : _c2, _d2 = options.resetOnRefCountZero, resetOnRefCountZero = _d2 === void 0 ? true : _d2;
  2931. return function(wrapperSource) {
  2932. var connection;
  2933. var resetConnection;
  2934. var subject;
  2935. var refCount2 = 0;
  2936. var hasCompleted = false;
  2937. var hasErrored = false;
  2938. var cancelReset = function() {
  2939. resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe();
  2940. resetConnection = void 0;
  2941. };
  2942. var reset = function() {
  2943. cancelReset();
  2944. connection = subject = void 0;
  2945. hasCompleted = hasErrored = false;
  2946. };
  2947. var resetAndUnsubscribe = function() {
  2948. var conn = connection;
  2949. reset();
  2950. conn === null || conn === void 0 ? void 0 : conn.unsubscribe();
  2951. };
  2952. return operate(function(source, subscriber) {
  2953. refCount2++;
  2954. if (!hasErrored && !hasCompleted) {
  2955. cancelReset();
  2956. }
  2957. var dest = subject = subject !== null && subject !== void 0 ? subject : connector();
  2958. subscriber.add(function() {
  2959. refCount2--;
  2960. if (refCount2 === 0 && !hasErrored && !hasCompleted) {
  2961. resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero);
  2962. }
  2963. });
  2964. dest.subscribe(subscriber);
  2965. if (!connection && refCount2 > 0) {
  2966. connection = new SafeSubscriber({
  2967. next: function(value) {
  2968. return dest.next(value);
  2969. },
  2970. error: function(err) {
  2971. hasErrored = true;
  2972. cancelReset();
  2973. resetConnection = handleReset(reset, resetOnError, err);
  2974. dest.error(err);
  2975. },
  2976. complete: function() {
  2977. hasCompleted = true;
  2978. cancelReset();
  2979. resetConnection = handleReset(reset, resetOnComplete);
  2980. dest.complete();
  2981. }
  2982. });
  2983. innerFrom(source).subscribe(connection);
  2984. }
  2985. })(wrapperSource);
  2986. };
  2987. }
  2988. function handleReset(reset, on2) {
  2989. var args = [];
  2990. for (var _i2 = 2; _i2 < arguments.length; _i2++) {
  2991. args[_i2 - 2] = arguments[_i2];
  2992. }
  2993. if (on2 === true) {
  2994. reset();
  2995. return;
  2996. }
  2997. if (on2 === false) {
  2998. return;
  2999. }
  3000. var onSubscriber = new SafeSubscriber({
  3001. next: function() {
  3002. onSubscriber.unsubscribe();
  3003. reset();
  3004. }
  3005. });
  3006. return innerFrom(on2.apply(void 0, __spreadArray([], __read(args)))).subscribe(onSubscriber);
  3007. }
  3008. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/shareReplay.js
  3009. function shareReplay(configOrBufferSize, windowTime2, scheduler) {
  3010. var _a2, _b, _c2;
  3011. var bufferSize;
  3012. var refCount2 = false;
  3013. if (configOrBufferSize && typeof configOrBufferSize === "object") {
  3014. _a2 = configOrBufferSize.bufferSize, bufferSize = _a2 === void 0 ? Infinity : _a2, _b = configOrBufferSize.windowTime, windowTime2 = _b === void 0 ? Infinity : _b, _c2 = configOrBufferSize.refCount, refCount2 = _c2 === void 0 ? false : _c2, scheduler = configOrBufferSize.scheduler;
  3015. } else {
  3016. bufferSize = configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity;
  3017. }
  3018. return share({
  3019. connector: function() {
  3020. return new ReplaySubject(bufferSize, windowTime2, scheduler);
  3021. },
  3022. resetOnError: true,
  3023. resetOnComplete: false,
  3024. resetOnRefCountZero: refCount2
  3025. });
  3026. }
  3027. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/skip.js
  3028. function skip(count2) {
  3029. return filter(function(_, index) {
  3030. return count2 <= index;
  3031. });
  3032. }
  3033. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/startWith.js
  3034. function startWith() {
  3035. var values = [];
  3036. for (var _i2 = 0; _i2 < arguments.length; _i2++) {
  3037. values[_i2] = arguments[_i2];
  3038. }
  3039. var scheduler = popScheduler(values);
  3040. return operate(function(source, subscriber) {
  3041. (scheduler ? concat(values, source, scheduler) : concat(values, source)).subscribe(subscriber);
  3042. });
  3043. }
  3044. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/switchMap.js
  3045. function switchMap(project, resultSelector) {
  3046. return operate(function(source, subscriber) {
  3047. var innerSubscriber = null;
  3048. var index = 0;
  3049. var isComplete = false;
  3050. var checkComplete = function() {
  3051. return isComplete && !innerSubscriber && subscriber.complete();
  3052. };
  3053. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  3054. innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();
  3055. var innerIndex = 0;
  3056. var outerIndex = index++;
  3057. innerFrom(project(value, outerIndex)).subscribe(innerSubscriber = createOperatorSubscriber(subscriber, function(innerValue) {
  3058. return subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue);
  3059. }, function() {
  3060. innerSubscriber = null;
  3061. checkComplete();
  3062. }));
  3063. }, function() {
  3064. isComplete = true;
  3065. checkComplete();
  3066. }));
  3067. });
  3068. }
  3069. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/takeUntil.js
  3070. function takeUntil(notifier) {
  3071. return operate(function(source, subscriber) {
  3072. innerFrom(notifier).subscribe(createOperatorSubscriber(subscriber, function() {
  3073. return subscriber.complete();
  3074. }, noop));
  3075. !subscriber.closed && source.subscribe(subscriber);
  3076. });
  3077. }
  3078. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/tap.js
  3079. function tap(observerOrNext, error, complete) {
  3080. var tapObserver = isFunction(observerOrNext) || error || complete ? { next: observerOrNext, error, complete } : observerOrNext;
  3081. return tapObserver ? operate(function(source, subscriber) {
  3082. var _a2;
  3083. (_a2 = tapObserver.subscribe) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver);
  3084. var isUnsub = true;
  3085. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  3086. var _a3;
  3087. (_a3 = tapObserver.next) === null || _a3 === void 0 ? void 0 : _a3.call(tapObserver, value);
  3088. subscriber.next(value);
  3089. }, function() {
  3090. var _a3;
  3091. isUnsub = false;
  3092. (_a3 = tapObserver.complete) === null || _a3 === void 0 ? void 0 : _a3.call(tapObserver);
  3093. subscriber.complete();
  3094. }, function(err) {
  3095. var _a3;
  3096. isUnsub = false;
  3097. (_a3 = tapObserver.error) === null || _a3 === void 0 ? void 0 : _a3.call(tapObserver, err);
  3098. subscriber.error(err);
  3099. }, function() {
  3100. var _a3, _b;
  3101. if (isUnsub) {
  3102. (_a3 = tapObserver.unsubscribe) === null || _a3 === void 0 ? void 0 : _a3.call(tapObserver);
  3103. }
  3104. (_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);
  3105. }));
  3106. }) : identity;
  3107. }
  3108. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/throttle.js
  3109. function throttle(durationSelector, config2) {
  3110. return operate(function(source, subscriber) {
  3111. var _a2 = config2 !== null && config2 !== void 0 ? config2 : {}, _b = _a2.leading, leading = _b === void 0 ? true : _b, _c2 = _a2.trailing, trailing = _c2 === void 0 ? false : _c2;
  3112. var hasValue = false;
  3113. var sendValue = null;
  3114. var throttled = null;
  3115. var isComplete = false;
  3116. var endThrottling = function() {
  3117. throttled === null || throttled === void 0 ? void 0 : throttled.unsubscribe();
  3118. throttled = null;
  3119. if (trailing) {
  3120. send();
  3121. isComplete && subscriber.complete();
  3122. }
  3123. };
  3124. var cleanupThrottling = function() {
  3125. throttled = null;
  3126. isComplete && subscriber.complete();
  3127. };
  3128. var startThrottle = function(value) {
  3129. return throttled = innerFrom(durationSelector(value)).subscribe(createOperatorSubscriber(subscriber, endThrottling, cleanupThrottling));
  3130. };
  3131. var send = function() {
  3132. if (hasValue) {
  3133. hasValue = false;
  3134. var value = sendValue;
  3135. sendValue = null;
  3136. subscriber.next(value);
  3137. !isComplete && startThrottle(value);
  3138. }
  3139. };
  3140. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  3141. hasValue = true;
  3142. sendValue = value;
  3143. !(throttled && !throttled.closed) && (leading ? send() : startThrottle(value));
  3144. }, function() {
  3145. isComplete = true;
  3146. !(trailing && hasValue && throttled && !throttled.closed) && subscriber.complete();
  3147. }));
  3148. });
  3149. }
  3150. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/throttleTime.js
  3151. function throttleTime(duration, scheduler, config2) {
  3152. if (scheduler === void 0) {
  3153. scheduler = asyncScheduler;
  3154. }
  3155. var duration$ = timer(duration, scheduler);
  3156. return throttle(function() {
  3157. return duration$;
  3158. }, config2);
  3159. }
  3160. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/timeInterval.js
  3161. var TimeInterval = function() {
  3162. function TimeInterval2(value, interval2) {
  3163. this.value = value;
  3164. this.interval = interval2;
  3165. }
  3166. return TimeInterval2;
  3167. }();
  3168. // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/withLatestFrom.js
  3169. function withLatestFrom() {
  3170. var inputs = [];
  3171. for (var _i2 = 0; _i2 < arguments.length; _i2++) {
  3172. inputs[_i2] = arguments[_i2];
  3173. }
  3174. var project = popResultSelector(inputs);
  3175. return operate(function(source, subscriber) {
  3176. var len = inputs.length;
  3177. var otherValues = new Array(len);
  3178. var hasValue = inputs.map(function() {
  3179. return false;
  3180. });
  3181. var ready = false;
  3182. var _loop_1 = function(i2) {
  3183. innerFrom(inputs[i2]).subscribe(createOperatorSubscriber(subscriber, function(value) {
  3184. otherValues[i2] = value;
  3185. if (!ready && !hasValue[i2]) {
  3186. hasValue[i2] = true;
  3187. (ready = hasValue.every(identity)) && (hasValue = null);
  3188. }
  3189. }, noop));
  3190. };
  3191. for (var i = 0; i < len; i++) {
  3192. _loop_1(i);
  3193. }
  3194. source.subscribe(createOperatorSubscriber(subscriber, function(value) {
  3195. if (ready) {
  3196. var values = __spreadArray([value], __read(otherValues));
  3197. subscriber.next(project ? project.apply(void 0, __spreadArray([], __read(values))) : values);
  3198. }
  3199. }));
  3200. });
  3201. }
  3202. // node_modules/.pnpm/@univerjs+core@0.5.5_@grpc+grpc-js@1.13.4_react@18.3.1_rxjs@7.8.1/node_modules/@univerjs/core/lib/es/index.js
  3203. var St = __toESM(require_react());
  3204. var import_react = __toESM(require_react());
  3205. var Ol = Object.defineProperty;
  3206. var bl = (t, e, n) => e in t ? Ol(t, e, { enumerable: true, configurable: true, writable: true, value: n }) : t[e] = n;
  3207. var C = (t, e, n) => bl(t, typeof e != "symbol" ? e + "" : e, n);
  3208. function jl(t, e) {
  3209. for (var n = 0; n < e.length; n++) {
  3210. const r = e[n];
  3211. if (typeof r != "string" && !Array.isArray(r)) {
  3212. for (const s in r)
  3213. if (s !== "default" && !(s in t)) {
  3214. const i = Object.getOwnPropertyDescriptor(r, s);
  3215. i && Object.defineProperty(t, s, i.get ? i : {
  3216. enumerable: true,
  3217. get: () => r[s]
  3218. });
  3219. }
  3220. }
  3221. }
  3222. return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }));
  3223. }
  3224. function Hl() {
  3225. Wl();
  3226. }
  3227. var gr = typeof global < "u" ? global : typeof self < "u" ? self : window;
  3228. function Wl() {
  3229. typeof gr.requestIdleCallback != "function" && (gr.requestIdleCallback = function(n) {
  3230. const r = Date.now();
  3231. return setTimeout(function() {
  3232. const i = Math.max(0, 50 - (Date.now() - r));
  3233. n({
  3234. didTimeout: i === 0,
  3235. timeRemaining() {
  3236. return i;
  3237. }
  3238. });
  3239. }, 1);
  3240. }), typeof gr.cancelIdleCallback != "function" && (gr.cancelIdleCallback = function(n) {
  3241. clearTimeout(n);
  3242. });
  3243. }
  3244. var Pa = typeof global == "object" && global && global.Object === Object && global;
  3245. var zl = typeof self == "object" && self && self.Object === Object && self;
  3246. var En = Pa || zl || Function("return this")();
  3247. var Mn = En.Symbol;
  3248. var ka = Object.prototype;
  3249. var Yl = ka.hasOwnProperty;
  3250. var Vl = ka.toString;
  3251. var Fn = Mn ? Mn.toStringTag : void 0;
  3252. function Gl(t) {
  3253. var e = Yl.call(t, Fn), n = t[Fn];
  3254. try {
  3255. t[Fn] = void 0;
  3256. var r = true;
  3257. } catch {
  3258. }
  3259. var s = Vl.call(t);
  3260. return r && (e ? t[Fn] = n : delete t[Fn]), s;
  3261. }
  3262. var Kl = Object.prototype;
  3263. var Xl = Kl.toString;
  3264. function Jl(t) {
  3265. return Xl.call(t);
  3266. }
  3267. var Zl = "[object Null]";
  3268. var Ql = "[object Undefined]";
  3269. var zi = Mn ? Mn.toStringTag : void 0;
  3270. function ir(t) {
  3271. return t == null ? t === void 0 ? Ql : Zl : zi && zi in Object(t) ? Gl(t) : Jl(t);
  3272. }
  3273. function Un(t) {
  3274. return t != null && typeof t == "object";
  3275. }
  3276. var ql = "[object Symbol]";
  3277. function os(t) {
  3278. return typeof t == "symbol" || Un(t) && ir(t) == ql;
  3279. }
  3280. function ec(t, e) {
  3281. for (var n = -1, r = t == null ? 0 : t.length, s = Array(r); ++n < r; )
  3282. s[n] = e(t[n], n, t);
  3283. return s;
  3284. }
  3285. var Dn = Array.isArray;
  3286. var Yi = Mn ? Mn.prototype : void 0;
  3287. var Vi = Yi ? Yi.toString : void 0;
  3288. function Fa(t) {
  3289. if (typeof t == "string")
  3290. return t;
  3291. if (Dn(t))
  3292. return ec(t, Fa) + "";
  3293. if (os(t))
  3294. return Vi ? Vi.call(t) : "";
  3295. var e = t + "";
  3296. return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
  3297. }
  3298. var tc = /\s/;
  3299. function nc(t) {
  3300. for (var e = t.length; e-- && tc.test(t.charAt(e)); )
  3301. ;
  3302. return e;
  3303. }
  3304. var rc = /^\s+/;
  3305. function sc(t) {
  3306. return t && t.slice(0, nc(t) + 1).replace(rc, "");
  3307. }
  3308. function yt(t) {
  3309. var e = typeof t;
  3310. return t != null && (e == "object" || e == "function");
  3311. }
  3312. var Gi = NaN;
  3313. var ic = /^[-+]0x[0-9a-f]+$/i;
  3314. var oc = /^0b[01]+$/i;
  3315. var ac = /^0o[0-7]+$/i;
  3316. var uc = parseInt;
  3317. function Ki(t) {
  3318. if (typeof t == "number")
  3319. return t;
  3320. if (os(t))
  3321. return Gi;
  3322. if (yt(t)) {
  3323. var e = typeof t.valueOf == "function" ? t.valueOf() : t;
  3324. t = yt(e) ? e + "" : e;
  3325. }
  3326. if (typeof t != "string")
  3327. return t === 0 ? t : +t;
  3328. t = sc(t);
  3329. var n = oc.test(t);
  3330. return n || ac.test(t) ? uc(t.slice(2), n ? 2 : 8) : ic.test(t) ? Gi : +t;
  3331. }
  3332. function $a(t) {
  3333. return t;
  3334. }
  3335. var lc = "[object AsyncFunction]";
  3336. var cc = "[object Function]";
  3337. var hc = "[object GeneratorFunction]";
  3338. var dc = "[object Proxy]";
  3339. function Ci(t) {
  3340. if (!yt(t))
  3341. return false;
  3342. var e = ir(t);
  3343. return e == cc || e == hc || e == lc || e == dc;
  3344. }
  3345. var Cs = En["__core-js_shared__"];
  3346. var Xi = function() {
  3347. var t = /[^.]+$/.exec(Cs && Cs.keys && Cs.keys.IE_PROTO || "");
  3348. return t ? "Symbol(src)_1." + t : "";
  3349. }();
  3350. function fc(t) {
  3351. return !!Xi && Xi in t;
  3352. }
  3353. var gc = Function.prototype;
  3354. var pc = gc.toString;
  3355. function mc(t) {
  3356. if (t != null) {
  3357. try {
  3358. return pc.call(t);
  3359. } catch {
  3360. }
  3361. try {
  3362. return t + "";
  3363. } catch {
  3364. }
  3365. }
  3366. return "";
  3367. }
  3368. var _c = /[\\^$.*+?()[\]{}|]/g;
  3369. var Ec = /^\[object .+?Constructor\]$/;
  3370. var Cc = Function.prototype;
  3371. var Rc = Object.prototype;
  3372. var Ic = Cc.toString;
  3373. var vc = Rc.hasOwnProperty;
  3374. var yc = RegExp(
  3375. "^" + Ic.call(vc).replace(_c, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
  3376. );
  3377. function wc(t) {
  3378. if (!yt(t) || fc(t))
  3379. return false;
  3380. var e = Ci(t) ? yc : Ec;
  3381. return e.test(mc(t));
  3382. }
  3383. function Oc(t, e) {
  3384. return t == null ? void 0 : t[e];
  3385. }
  3386. function Ri(t, e) {
  3387. var n = Oc(t, e);
  3388. return wc(n) ? n : void 0;
  3389. }
  3390. var Ji = Object.create;
  3391. var bc = function() {
  3392. function t() {
  3393. }
  3394. return function(e) {
  3395. if (!yt(e))
  3396. return {};
  3397. if (Ji)
  3398. return Ji(e);
  3399. t.prototype = e;
  3400. var n = new t();
  3401. return t.prototype = void 0, n;
  3402. };
  3403. }();
  3404. function Sc(t, e, n) {
  3405. switch (n.length) {
  3406. case 0:
  3407. return t.call(e);
  3408. case 1:
  3409. return t.call(e, n[0]);
  3410. case 2:
  3411. return t.call(e, n[0], n[1]);
  3412. case 3:
  3413. return t.call(e, n[0], n[1], n[2]);
  3414. }
  3415. return t.apply(e, n);
  3416. }
  3417. function Ac(t, e) {
  3418. var n = -1, r = t.length;
  3419. for (e || (e = Array(r)); ++n < r; )
  3420. e[n] = t[n];
  3421. return e;
  3422. }
  3423. var Nc = 800;
  3424. var Tc = 16;
  3425. var Mc = Date.now;
  3426. function Dc(t) {
  3427. var e = 0, n = 0;
  3428. return function() {
  3429. var r = Mc(), s = Tc - (r - n);
  3430. if (n = r, s > 0) {
  3431. if (++e >= Nc)
  3432. return arguments[0];
  3433. } else
  3434. e = 0;
  3435. return t.apply(void 0, arguments);
  3436. };
  3437. }
  3438. function xc(t) {
  3439. return function() {
  3440. return t;
  3441. };
  3442. }
  3443. var Kr = function() {
  3444. try {
  3445. var t = Ri(Object, "defineProperty");
  3446. return t({}, "", {}), t;
  3447. } catch {
  3448. }
  3449. }();
  3450. var Lc = Kr ? function(t, e) {
  3451. return Kr(t, "toString", {
  3452. configurable: true,
  3453. enumerable: false,
  3454. value: xc(e),
  3455. writable: true
  3456. });
  3457. } : $a;
  3458. var Uc = Dc(Lc);
  3459. var Pc = 9007199254740991;
  3460. var kc = /^(?:0|[1-9]\d*)$/;
  3461. function Ii(t, e) {
  3462. var n = typeof t;
  3463. return e = e == null ? Pc : e, !!e && (n == "number" || n != "symbol" && kc.test(t)) && t > -1 && t % 1 == 0 && t < e;
  3464. }
  3465. function vi(t, e, n) {
  3466. e == "__proto__" && Kr ? Kr(t, e, {
  3467. configurable: true,
  3468. enumerable: true,
  3469. value: n,
  3470. writable: true
  3471. }) : t[e] = n;
  3472. }
  3473. function as(t, e) {
  3474. return t === e || t !== t && e !== e;
  3475. }
  3476. var Fc = Object.prototype;
  3477. var $c = Fc.hasOwnProperty;
  3478. function Ba(t, e, n) {
  3479. var r = t[e];
  3480. (!($c.call(t, e) && as(r, n)) || n === void 0 && !(e in t)) && vi(t, e, n);
  3481. }
  3482. function Bc(t, e, n, r) {
  3483. var s = !n;
  3484. n || (n = {});
  3485. for (var i = -1, o = e.length; ++i < o; ) {
  3486. var a = e[i], u = void 0;
  3487. u === void 0 && (u = t[a]), s ? vi(n, a, u) : Ba(n, a, u);
  3488. }
  3489. return n;
  3490. }
  3491. var Zi = Math.max;
  3492. function jc(t, e, n) {
  3493. return e = Zi(e === void 0 ? t.length - 1 : e, 0), function() {
  3494. for (var r = arguments, s = -1, i = Zi(r.length - e, 0), o = Array(i); ++s < i; )
  3495. o[s] = r[e + s];
  3496. s = -1;
  3497. for (var a = Array(e + 1); ++s < e; )
  3498. a[s] = r[s];
  3499. return a[e] = n(o), Sc(t, this, a);
  3500. };
  3501. }
  3502. function Hc(t, e) {
  3503. return Uc(jc(t, e, $a), t + "");
  3504. }
  3505. var Wc = 9007199254740991;
  3506. function ja(t) {
  3507. return typeof t == "number" && t > -1 && t % 1 == 0 && t <= Wc;
  3508. }
  3509. function yi(t) {
  3510. return t != null && ja(t.length) && !Ci(t);
  3511. }
  3512. function zc(t, e, n) {
  3513. if (!yt(n))
  3514. return false;
  3515. var r = typeof e;
  3516. return (r == "number" ? yi(n) && Ii(e, n.length) : r == "string" && e in n) ? as(n[e], t) : false;
  3517. }
  3518. function Ha(t) {
  3519. return Hc(function(e, n) {
  3520. var r = -1, s = n.length, i = s > 1 ? n[s - 1] : void 0, o = s > 2 ? n[2] : void 0;
  3521. for (i = t.length > 3 && typeof i == "function" ? (s--, i) : void 0, o && zc(n[0], n[1], o) && (i = s < 3 ? void 0 : i, s = 1), e = Object(e); ++r < s; ) {
  3522. var a = n[r];
  3523. a && t(e, a, r, i);
  3524. }
  3525. return e;
  3526. });
  3527. }
  3528. var Yc = Object.prototype;
  3529. function Wa(t) {
  3530. var e = t && t.constructor, n = typeof e == "function" && e.prototype || Yc;
  3531. return t === n;
  3532. }
  3533. function Vc(t, e) {
  3534. for (var n = -1, r = Array(t); ++n < t; )
  3535. r[n] = e(n);
  3536. return r;
  3537. }
  3538. var Gc = "[object Arguments]";
  3539. function Qi(t) {
  3540. return Un(t) && ir(t) == Gc;
  3541. }
  3542. var za = Object.prototype;
  3543. var Kc = za.hasOwnProperty;
  3544. var Xc = za.propertyIsEnumerable;
  3545. var Fs = Qi(function() {
  3546. return arguments;
  3547. }()) ? Qi : function(t) {
  3548. return Un(t) && Kc.call(t, "callee") && !Xc.call(t, "callee");
  3549. };
  3550. function Jc() {
  3551. return false;
  3552. }
  3553. var Ya = typeof exports == "object" && exports && !exports.nodeType && exports;
  3554. var qi = Ya && typeof module == "object" && module && !module.nodeType && module;
  3555. var Zc = qi && qi.exports === Ya;
  3556. var eo = Zc ? En.Buffer : void 0;
  3557. var Qc = eo ? eo.isBuffer : void 0;
  3558. var Va = Qc || Jc;
  3559. var qc = "[object Arguments]";
  3560. var eh = "[object Array]";
  3561. var th = "[object Boolean]";
  3562. var nh = "[object Date]";
  3563. var rh = "[object Error]";
  3564. var sh = "[object Function]";
  3565. var ih = "[object Map]";
  3566. var oh = "[object Number]";
  3567. var ah = "[object Object]";
  3568. var uh = "[object RegExp]";
  3569. var lh = "[object Set]";
  3570. var ch = "[object String]";
  3571. var hh = "[object WeakMap]";
  3572. var dh = "[object ArrayBuffer]";
  3573. var fh = "[object DataView]";
  3574. var gh = "[object Float32Array]";
  3575. var ph = "[object Float64Array]";
  3576. var mh = "[object Int8Array]";
  3577. var _h = "[object Int16Array]";
  3578. var Eh = "[object Int32Array]";
  3579. var Ch = "[object Uint8Array]";
  3580. var Rh = "[object Uint8ClampedArray]";
  3581. var Ih = "[object Uint16Array]";
  3582. var vh = "[object Uint32Array]";
  3583. var Qe = {};
  3584. Qe[gh] = Qe[ph] = Qe[mh] = Qe[_h] = Qe[Eh] = Qe[Ch] = Qe[Rh] = Qe[Ih] = Qe[vh] = true;
  3585. Qe[qc] = Qe[eh] = Qe[dh] = Qe[th] = Qe[fh] = Qe[nh] = Qe[rh] = Qe[sh] = Qe[ih] = Qe[oh] = Qe[ah] = Qe[uh] = Qe[lh] = Qe[ch] = Qe[hh] = false;
  3586. function yh(t) {
  3587. return Un(t) && ja(t.length) && !!Qe[ir(t)];
  3588. }
  3589. function wh(t) {
  3590. return function(e) {
  3591. return t(e);
  3592. };
  3593. }
  3594. var Ga = typeof exports == "object" && exports && !exports.nodeType && exports;
  3595. var Jn = Ga && typeof module == "object" && module && !module.nodeType && module;
  3596. var Oh = Jn && Jn.exports === Ga;
  3597. var Rs = Oh && Pa.process;
  3598. var to = function() {
  3599. try {
  3600. var t = Jn && Jn.require && Jn.require("util").types;
  3601. return t || Rs && Rs.binding && Rs.binding("util");
  3602. } catch {
  3603. }
  3604. }();
  3605. var no = to && to.isTypedArray;
  3606. var Ka = no ? wh(no) : yh;
  3607. function bh(t, e) {
  3608. var n = Dn(t), r = !n && Fs(t), s = !n && !r && Va(t), i = !n && !r && !s && Ka(t), o = n || r || s || i, a = o ? Vc(t.length, String) : [], u = a.length;
  3609. for (var c in t)
  3610. o && // Safari 9 has enumerable `arguments.length` in strict mode.
  3611. (c == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
  3612. s && (c == "offset" || c == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
  3613. i && (c == "buffer" || c == "byteLength" || c == "byteOffset") || // Skip index properties.
  3614. Ii(c, u)) || a.push(c);
  3615. return a;
  3616. }
  3617. function Sh(t, e) {
  3618. return function(n) {
  3619. return t(e(n));
  3620. };
  3621. }
  3622. function Ah(t) {
  3623. var e = [];
  3624. if (t != null)
  3625. for (var n in Object(t))
  3626. e.push(n);
  3627. return e;
  3628. }
  3629. var Nh = Object.prototype;
  3630. var Th = Nh.hasOwnProperty;
  3631. function Mh(t) {
  3632. if (!yt(t))
  3633. return Ah(t);
  3634. var e = Wa(t), n = [];
  3635. for (var r in t)
  3636. r == "constructor" && (e || !Th.call(t, r)) || n.push(r);
  3637. return n;
  3638. }
  3639. function Xa(t) {
  3640. return yi(t) ? bh(t) : Mh(t);
  3641. }
  3642. var Dh = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
  3643. var xh = /^\w*$/;
  3644. function Lh(t, e) {
  3645. if (Dn(t))
  3646. return false;
  3647. var n = typeof t;
  3648. return n == "number" || n == "symbol" || n == "boolean" || t == null || os(t) ? true : xh.test(t) || !Dh.test(t) || e != null && t in Object(e);
  3649. }
  3650. var qn = Ri(Object, "create");
  3651. function Uh() {
  3652. this.__data__ = qn ? qn(null) : {}, this.size = 0;
  3653. }
  3654. function Ph(t) {
  3655. var e = this.has(t) && delete this.__data__[t];
  3656. return this.size -= e ? 1 : 0, e;
  3657. }
  3658. var kh = "__lodash_hash_undefined__";
  3659. var Fh = Object.prototype;
  3660. var $h = Fh.hasOwnProperty;
  3661. function Bh(t) {
  3662. var e = this.__data__;
  3663. if (qn) {
  3664. var n = e[t];
  3665. return n === kh ? void 0 : n;
  3666. }
  3667. return $h.call(e, t) ? e[t] : void 0;
  3668. }
  3669. var jh = Object.prototype;
  3670. var Hh = jh.hasOwnProperty;
  3671. function Wh(t) {
  3672. var e = this.__data__;
  3673. return qn ? e[t] !== void 0 : Hh.call(e, t);
  3674. }
  3675. var zh = "__lodash_hash_undefined__";
  3676. function Yh(t, e) {
  3677. var n = this.__data__;
  3678. return this.size += this.has(t) ? 0 : 1, n[t] = qn && e === void 0 ? zh : e, this;
  3679. }
  3680. function pn(t) {
  3681. var e = -1, n = t == null ? 0 : t.length;
  3682. for (this.clear(); ++e < n; ) {
  3683. var r = t[e];
  3684. this.set(r[0], r[1]);
  3685. }
  3686. }
  3687. pn.prototype.clear = Uh;
  3688. pn.prototype.delete = Ph;
  3689. pn.prototype.get = Bh;
  3690. pn.prototype.has = Wh;
  3691. pn.prototype.set = Yh;
  3692. function Vh() {
  3693. this.__data__ = [], this.size = 0;
  3694. }
  3695. function us(t, e) {
  3696. for (var n = t.length; n--; )
  3697. if (as(t[n][0], e))
  3698. return n;
  3699. return -1;
  3700. }
  3701. var Gh = Array.prototype;
  3702. var Kh = Gh.splice;
  3703. function Xh(t) {
  3704. var e = this.__data__, n = us(e, t);
  3705. if (n < 0)
  3706. return false;
  3707. var r = e.length - 1;
  3708. return n == r ? e.pop() : Kh.call(e, n, 1), --this.size, true;
  3709. }
  3710. function Jh(t) {
  3711. var e = this.__data__, n = us(e, t);
  3712. return n < 0 ? void 0 : e[n][1];
  3713. }
  3714. function Zh(t) {
  3715. return us(this.__data__, t) > -1;
  3716. }
  3717. function Qh(t, e) {
  3718. var n = this.__data__, r = us(n, t);
  3719. return r < 0 ? (++this.size, n.push([t, e])) : n[r][1] = e, this;
  3720. }
  3721. function Wt(t) {
  3722. var e = -1, n = t == null ? 0 : t.length;
  3723. for (this.clear(); ++e < n; ) {
  3724. var r = t[e];
  3725. this.set(r[0], r[1]);
  3726. }
  3727. }
  3728. Wt.prototype.clear = Vh;
  3729. Wt.prototype.delete = Xh;
  3730. Wt.prototype.get = Jh;
  3731. Wt.prototype.has = Zh;
  3732. Wt.prototype.set = Qh;
  3733. var Ja = Ri(En, "Map");
  3734. function qh() {
  3735. this.size = 0, this.__data__ = {
  3736. hash: new pn(),
  3737. map: new (Ja || Wt)(),
  3738. string: new pn()
  3739. };
  3740. }
  3741. function ed(t) {
  3742. var e = typeof t;
  3743. return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
  3744. }
  3745. function ls(t, e) {
  3746. var n = t.__data__;
  3747. return ed(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
  3748. }
  3749. function td(t) {
  3750. var e = ls(this, t).delete(t);
  3751. return this.size -= e ? 1 : 0, e;
  3752. }
  3753. function nd(t) {
  3754. return ls(this, t).get(t);
  3755. }
  3756. function rd(t) {
  3757. return ls(this, t).has(t);
  3758. }
  3759. function sd(t, e) {
  3760. var n = ls(this, t), r = n.size;
  3761. return n.set(t, e), this.size += n.size == r ? 0 : 1, this;
  3762. }
  3763. function nn(t) {
  3764. var e = -1, n = t == null ? 0 : t.length;
  3765. for (this.clear(); ++e < n; ) {
  3766. var r = t[e];
  3767. this.set(r[0], r[1]);
  3768. }
  3769. }
  3770. nn.prototype.clear = qh;
  3771. nn.prototype.delete = td;
  3772. nn.prototype.get = nd;
  3773. nn.prototype.has = rd;
  3774. nn.prototype.set = sd;
  3775. var id = "Expected a function";
  3776. function wi(t, e) {
  3777. if (typeof t != "function" || e != null && typeof e != "function")
  3778. throw new TypeError(id);
  3779. var n = function() {
  3780. var r = arguments, s = e ? e.apply(this, r) : r[0], i = n.cache;
  3781. if (i.has(s))
  3782. return i.get(s);
  3783. var o = t.apply(this, r);
  3784. return n.cache = i.set(s, o) || i, o;
  3785. };
  3786. return n.cache = new (wi.Cache || nn)(), n;
  3787. }
  3788. wi.Cache = nn;
  3789. var od = 500;
  3790. function ad(t) {
  3791. var e = wi(t, function(r) {
  3792. return n.size === od && n.clear(), r;
  3793. }), n = e.cache;
  3794. return e;
  3795. }
  3796. var ud = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  3797. var ld = /\\(\\)?/g;
  3798. var cd = ad(function(t) {
  3799. var e = [];
  3800. return t.charCodeAt(0) === 46 && e.push(""), t.replace(ud, function(n, r, s, i) {
  3801. e.push(s ? i.replace(ld, "$1") : r || n);
  3802. }), e;
  3803. });
  3804. function hd(t) {
  3805. return t == null ? "" : Fa(t);
  3806. }
  3807. function Za(t, e) {
  3808. return Dn(t) ? t : Lh(t, e) ? [t] : cd(hd(t));
  3809. }
  3810. function Qa(t) {
  3811. if (typeof t == "string" || os(t))
  3812. return t;
  3813. var e = t + "";
  3814. return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
  3815. }
  3816. function dd(t, e) {
  3817. e = Za(e, t);
  3818. for (var n = 0, r = e.length; t != null && n < r; )
  3819. t = t[Qa(e[n++])];
  3820. return n && n == r ? t : void 0;
  3821. }
  3822. function b0(t, e, n) {
  3823. var r = t == null ? void 0 : dd(t, e);
  3824. return r === void 0 ? n : r;
  3825. }
  3826. var qa = Sh(Object.getPrototypeOf, Object);
  3827. var fd = "[object Object]";
  3828. var gd = Function.prototype;
  3829. var pd = Object.prototype;
  3830. var eu = gd.toString;
  3831. var md = pd.hasOwnProperty;
  3832. var _d = eu.call(Object);
  3833. function Ed(t) {
  3834. if (!Un(t) || ir(t) != fd)
  3835. return false;
  3836. var e = qa(t);
  3837. if (e === null)
  3838. return true;
  3839. var n = md.call(e, "constructor") && e.constructor;
  3840. return typeof n == "function" && n instanceof n && eu.call(n) == _d;
  3841. }
  3842. function Cd() {
  3843. this.__data__ = new Wt(), this.size = 0;
  3844. }
  3845. function Rd(t) {
  3846. var e = this.__data__, n = e.delete(t);
  3847. return this.size = e.size, n;
  3848. }
  3849. function Id(t) {
  3850. return this.__data__.get(t);
  3851. }
  3852. function vd(t) {
  3853. return this.__data__.has(t);
  3854. }
  3855. var yd = 200;
  3856. function wd(t, e) {
  3857. var n = this.__data__;
  3858. if (n instanceof Wt) {
  3859. var r = n.__data__;
  3860. if (!Ja || r.length < yd - 1)
  3861. return r.push([t, e]), this.size = ++n.size, this;
  3862. n = this.__data__ = new nn(r);
  3863. }
  3864. return n.set(t, e), this.size = n.size, this;
  3865. }
  3866. function Pn(t) {
  3867. var e = this.__data__ = new Wt(t);
  3868. this.size = e.size;
  3869. }
  3870. Pn.prototype.clear = Cd;
  3871. Pn.prototype.delete = Rd;
  3872. Pn.prototype.get = Id;
  3873. Pn.prototype.has = vd;
  3874. Pn.prototype.set = wd;
  3875. var tu = typeof exports == "object" && exports && !exports.nodeType && exports;
  3876. var ro = tu && typeof module == "object" && module && !module.nodeType && module;
  3877. var Od = ro && ro.exports === tu;
  3878. var so = Od ? En.Buffer : void 0;
  3879. so && so.allocUnsafe;
  3880. function bd(t, e) {
  3881. return t.slice();
  3882. }
  3883. var io = En.Uint8Array;
  3884. function Sd(t) {
  3885. var e = new t.constructor(t.byteLength);
  3886. return new io(e).set(new io(t)), e;
  3887. }
  3888. function Ad(t, e) {
  3889. var n = Sd(t.buffer);
  3890. return new t.constructor(n, t.byteOffset, t.length);
  3891. }
  3892. function Nd(t) {
  3893. return typeof t.constructor == "function" && !Wa(t) ? bc(qa(t)) : {};
  3894. }
  3895. function Td(t) {
  3896. return function(e, n, r) {
  3897. for (var s = -1, i = Object(e), o = r(e), a = o.length; a--; ) {
  3898. var u = o[++s];
  3899. if (n(i[u], u, i) === false)
  3900. break;
  3901. }
  3902. return e;
  3903. };
  3904. }
  3905. var Md = Td();
  3906. var Is = function() {
  3907. return En.Date.now();
  3908. };
  3909. var Dd = "Expected a function";
  3910. var xd = Math.max;
  3911. var Ld = Math.min;
  3912. function S0(t, e, n) {
  3913. var r, s, i, o, a, u, c = 0, l = false, h = false, d = true;
  3914. if (typeof t != "function")
  3915. throw new TypeError(Dd);
  3916. e = Ki(e) || 0, yt(n) && (l = !!n.leading, h = "maxWait" in n, i = h ? xd(Ki(n.maxWait) || 0, e) : i, d = "trailing" in n ? !!n.trailing : d);
  3917. function f(A) {
  3918. var H = r, Z = s;
  3919. return r = s = void 0, c = A, o = t.apply(Z, H), o;
  3920. }
  3921. function E(A) {
  3922. return c = A, a = setTimeout(U, e), l ? f(A) : o;
  3923. }
  3924. function R(A) {
  3925. var H = A - u, Z = A - c, fe = e - H;
  3926. return h ? Ld(fe, i - Z) : fe;
  3927. }
  3928. function O(A) {
  3929. var H = A - u, Z = A - c;
  3930. return u === void 0 || H >= e || H < 0 || h && Z >= i;
  3931. }
  3932. function U() {
  3933. var A = Is();
  3934. if (O(A))
  3935. return ne(A);
  3936. a = setTimeout(U, R(A));
  3937. }
  3938. function ne(A) {
  3939. return a = void 0, d && r ? f(A) : (r = s = void 0, o);
  3940. }
  3941. function X() {
  3942. a !== void 0 && clearTimeout(a), c = 0, r = u = s = a = void 0;
  3943. }
  3944. function de() {
  3945. return a === void 0 ? o : ne(Is());
  3946. }
  3947. function T() {
  3948. var A = Is(), H = O(A);
  3949. if (r = arguments, s = this, u = A, H) {
  3950. if (a === void 0)
  3951. return E(u);
  3952. if (h)
  3953. return clearTimeout(a), a = setTimeout(U, e), f(u);
  3954. }
  3955. return a === void 0 && (a = setTimeout(U, e)), o;
  3956. }
  3957. return T.cancel = X, T.flush = de, T;
  3958. }
  3959. function $s(t, e, n) {
  3960. (n !== void 0 && !as(t[e], n) || n === void 0 && !(e in t)) && vi(t, e, n);
  3961. }
  3962. function Ud(t) {
  3963. return Un(t) && yi(t);
  3964. }
  3965. function Bs(t, e) {
  3966. if (!(e === "constructor" && typeof t[e] == "function") && e != "__proto__")
  3967. return t[e];
  3968. }
  3969. function Pd(t) {
  3970. return Bc(t, Xa(t));
  3971. }
  3972. function kd(t, e, n, r, s, i, o) {
  3973. var a = Bs(t, n), u = Bs(e, n), c = o.get(u);
  3974. if (c) {
  3975. $s(t, n, c);
  3976. return;
  3977. }
  3978. var l = i ? i(a, u, n + "", t, e, o) : void 0, h = l === void 0;
  3979. if (h) {
  3980. var d = Dn(u), f = !d && Va(u), E = !d && !f && Ka(u);
  3981. l = u, d || f || E ? Dn(a) ? l = a : Ud(a) ? l = Ac(a) : f ? (h = false, l = bd(u)) : E ? (h = false, l = Ad(u)) : l = [] : Ed(u) || Fs(u) ? (l = a, Fs(a) ? l = Pd(a) : (!yt(a) || Ci(a)) && (l = Nd(u))) : h = false;
  3982. }
  3983. h && (o.set(u, l), s(l, u, r, i, o), o.delete(u)), $s(t, n, l);
  3984. }
  3985. function Oi(t, e, n, r, s) {
  3986. t !== e && Md(e, function(i, o) {
  3987. if (s || (s = new Pn()), yt(i))
  3988. kd(t, e, o, n, Oi, r, s);
  3989. else {
  3990. var a = r ? r(Bs(t, o), i, o + "", t, e, s) : void 0;
  3991. a === void 0 && (a = i), $s(t, o, a);
  3992. }
  3993. }, Xa);
  3994. }
  3995. var A0 = Ha(function(t, e, n, r) {
  3996. Oi(t, e, n, r);
  3997. });
  3998. var nu = Ha(function(t, e, n) {
  3999. Oi(t, e, n);
  4000. });
  4001. function Fd(t, e, n, r) {
  4002. if (!yt(t))
  4003. return t;
  4004. e = Za(e, t);
  4005. for (var s = -1, i = e.length, o = i - 1, a = t; a != null && ++s < i; ) {
  4006. var u = Qa(e[s]), c = n;
  4007. if (u === "__proto__" || u === "constructor" || u === "prototype")
  4008. return t;
  4009. if (s != o) {
  4010. var l = a[u];
  4011. c = void 0, c === void 0 && (c = yt(l) ? l : Ii(e[s + 1]) ? [] : {});
  4012. }
  4013. Ba(a, u, c), a = a[u];
  4014. }
  4015. return t;
  4016. }
  4017. function N0(t, e, n) {
  4018. return t == null ? t : Fd(t, e, n);
  4019. }
  4020. function wt(t) {
  4021. return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
  4022. }
  4023. var vs;
  4024. var oo;
  4025. function $d() {
  4026. if (oo)
  4027. return vs;
  4028. oo = 1;
  4029. var t = -1, e = 1, n = 0;
  4030. function r(m, j, y, M, b) {
  4031. if (m === j)
  4032. return m ? [[n, m]] : [];
  4033. if (y != null) {
  4034. var w = fe(m, j, y);
  4035. if (w)
  4036. return w;
  4037. }
  4038. var k = a(m, j), $ = m.substring(0, k);
  4039. m = m.substring(k), j = j.substring(k), k = c(m, j);
  4040. var Y = m.substring(m.length - k);
  4041. m = m.substring(0, m.length - k), j = j.substring(0, j.length - k);
  4042. var se = s(m, j);
  4043. return $ && se.unshift([n, $]), Y && se.push([n, Y]), ne(se, b), M && h(se), se;
  4044. }
  4045. function s(m, j) {
  4046. var y;
  4047. if (!m)
  4048. return [[e, j]];
  4049. if (!j)
  4050. return [[t, m]];
  4051. var M = m.length > j.length ? m : j, b = m.length > j.length ? j : m, w = M.indexOf(b);
  4052. if (w !== -1)
  4053. return y = [
  4054. [e, M.substring(0, w)],
  4055. [n, b],
  4056. [e, M.substring(w + b.length)]
  4057. ], m.length > j.length && (y[0][0] = y[2][0] = t), y;
  4058. if (b.length === 1)
  4059. return [
  4060. [t, m],
  4061. [e, j]
  4062. ];
  4063. var k = l(m, j);
  4064. if (k) {
  4065. var $ = k[0], Y = k[1], se = k[2], he = k[3], ge = k[4], Ae = r($, se), be = r(Y, he);
  4066. return Ae.concat([[n, ge]], be);
  4067. }
  4068. return i(m, j);
  4069. }
  4070. function i(m, j) {
  4071. for (var y = m.length, M = j.length, b = Math.ceil((y + M) / 2), w = b, k = 2 * b, $ = new Array(k), Y = new Array(k), se = 0; se < k; se++)
  4072. $[se] = -1, Y[se] = -1;
  4073. $[w + 1] = 0, Y[w + 1] = 0;
  4074. for (var he = y - M, ge = he % 2 !== 0, Ae = 0, be = 0, v = 0, F = 0, V = 0; V < b; V++) {
  4075. for (var K = -V + Ae; K <= V - be; K += 2) {
  4076. var z = w + K, W;
  4077. K === -V || K !== V && $[z - 1] < $[z + 1] ? W = $[z + 1] : W = $[z - 1] + 1;
  4078. for (var ue = W - K; W < y && ue < M && m.charAt(W) === j.charAt(ue); )
  4079. W++, ue++;
  4080. if ($[z] = W, W > y)
  4081. be += 2;
  4082. else if (ue > M)
  4083. Ae += 2;
  4084. else if (ge) {
  4085. var oe = w + he - K;
  4086. if (oe >= 0 && oe < k && Y[oe] !== -1) {
  4087. var B = y - Y[oe];
  4088. if (W >= B)
  4089. return o(m, j, W, ue);
  4090. }
  4091. }
  4092. }
  4093. for (var ee = -V + v; ee <= V - F; ee += 2) {
  4094. var oe = w + ee, B;
  4095. ee === -V || ee !== V && Y[oe - 1] < Y[oe + 1] ? B = Y[oe + 1] : B = Y[oe - 1] + 1;
  4096. for (var ie = B - ee; B < y && ie < M && m.charAt(y - B - 1) === j.charAt(M - ie - 1); )
  4097. B++, ie++;
  4098. if (Y[oe] = B, B > y)
  4099. F += 2;
  4100. else if (ie > M)
  4101. v += 2;
  4102. else if (!ge) {
  4103. var z = w + he - ee;
  4104. if (z >= 0 && z < k && $[z] !== -1) {
  4105. var W = $[z], ue = w + W - z;
  4106. if (B = y - B, W >= B)
  4107. return o(m, j, W, ue);
  4108. }
  4109. }
  4110. }
  4111. }
  4112. return [
  4113. [t, m],
  4114. [e, j]
  4115. ];
  4116. }
  4117. function o(m, j, y, M) {
  4118. var b = m.substring(0, y), w = j.substring(0, M), k = m.substring(y), $ = j.substring(M), Y = r(b, w), se = r(k, $);
  4119. return Y.concat(se);
  4120. }
  4121. function a(m, j) {
  4122. if (!m || !j || m.charAt(0) !== j.charAt(0))
  4123. return 0;
  4124. for (var y = 0, M = Math.min(m.length, j.length), b = M, w = 0; y < b; )
  4125. m.substring(w, b) == j.substring(w, b) ? (y = b, w = y) : M = b, b = Math.floor((M - y) / 2 + y);
  4126. return X(m.charCodeAt(b - 1)) && b--, b;
  4127. }
  4128. function u(m, j) {
  4129. var y = m.length, M = j.length;
  4130. if (y == 0 || M == 0)
  4131. return 0;
  4132. y > M ? m = m.substring(y - M) : y < M && (j = j.substring(0, y));
  4133. var b = Math.min(y, M);
  4134. if (m == j)
  4135. return b;
  4136. for (var w = 0, k = 1; ; ) {
  4137. var $ = m.substring(b - k), Y = j.indexOf($);
  4138. if (Y == -1)
  4139. return w;
  4140. k += Y, (Y == 0 || m.substring(b - k) == j.substring(0, k)) && (w = k, k++);
  4141. }
  4142. }
  4143. function c(m, j) {
  4144. if (!m || !j || m.slice(-1) !== j.slice(-1))
  4145. return 0;
  4146. for (var y = 0, M = Math.min(m.length, j.length), b = M, w = 0; y < b; )
  4147. m.substring(m.length - b, m.length - w) == j.substring(j.length - b, j.length - w) ? (y = b, w = y) : M = b, b = Math.floor((M - y) / 2 + y);
  4148. return de(m.charCodeAt(m.length - b)) && b--, b;
  4149. }
  4150. function l(m, j) {
  4151. var y = m.length > j.length ? m : j, M = m.length > j.length ? j : m;
  4152. if (y.length < 4 || M.length * 2 < y.length)
  4153. return null;
  4154. function b(be, v, F) {
  4155. for (var V = be.substring(F, F + Math.floor(be.length / 4)), K = -1, z = "", W, ue, oe, B; (K = v.indexOf(V, K + 1)) !== -1; ) {
  4156. var ee = a(
  4157. be.substring(F),
  4158. v.substring(K)
  4159. ), ie = c(
  4160. be.substring(0, F),
  4161. v.substring(0, K)
  4162. );
  4163. z.length < ie + ee && (z = v.substring(K - ie, K) + v.substring(K, K + ee), W = be.substring(0, F - ie), ue = be.substring(F + ee), oe = v.substring(0, K - ie), B = v.substring(K + ee));
  4164. }
  4165. return z.length * 2 >= be.length ? [
  4166. W,
  4167. ue,
  4168. oe,
  4169. B,
  4170. z
  4171. ] : null;
  4172. }
  4173. var w = b(
  4174. y,
  4175. M,
  4176. Math.ceil(y.length / 4)
  4177. ), k = b(
  4178. y,
  4179. M,
  4180. Math.ceil(y.length / 2)
  4181. ), $;
  4182. if (!w && !k)
  4183. return null;
  4184. k ? w ? $ = w[4].length > k[4].length ? w : k : $ = k : $ = w;
  4185. var Y, se, he, ge;
  4186. m.length > j.length ? (Y = $[0], se = $[1], he = $[2], ge = $[3]) : (he = $[0], ge = $[1], Y = $[2], se = $[3]);
  4187. var Ae = $[4];
  4188. return [Y, se, he, ge, Ae];
  4189. }
  4190. function h(m) {
  4191. for (var j = false, y = [], M = 0, b = null, w = 0, k = 0, $ = 0, Y = 0, se = 0; w < m.length; )
  4192. m[w][0] == n ? (y[M++] = w, k = Y, $ = se, Y = 0, se = 0, b = m[w][1]) : (m[w][0] == e ? Y += m[w][1].length : se += m[w][1].length, b && b.length <= Math.max(k, $) && b.length <= Math.max(Y, se) && (m.splice(y[M - 1], 0, [
  4193. t,
  4194. b
  4195. ]), m[y[M - 1] + 1][0] = e, M--, M--, w = M > 0 ? y[M - 1] : -1, k = 0, $ = 0, Y = 0, se = 0, b = null, j = true)), w++;
  4196. for (j && ne(m), U(m), w = 1; w < m.length; ) {
  4197. if (m[w - 1][0] == t && m[w][0] == e) {
  4198. var he = m[w - 1][1], ge = m[w][1], Ae = u(he, ge), be = u(ge, he);
  4199. Ae >= be ? (Ae >= he.length / 2 || Ae >= ge.length / 2) && (m.splice(w, 0, [
  4200. n,
  4201. ge.substring(0, Ae)
  4202. ]), m[w - 1][1] = he.substring(
  4203. 0,
  4204. he.length - Ae
  4205. ), m[w + 1][1] = ge.substring(Ae), w++) : (be >= he.length / 2 || be >= ge.length / 2) && (m.splice(w, 0, [
  4206. n,
  4207. he.substring(0, be)
  4208. ]), m[w - 1][0] = e, m[w - 1][1] = ge.substring(
  4209. 0,
  4210. ge.length - be
  4211. ), m[w + 1][0] = t, m[w + 1][1] = he.substring(be), w++), w++;
  4212. }
  4213. w++;
  4214. }
  4215. }
  4216. var d = /[^a-zA-Z0-9]/, f = /\s/, E = /[\r\n]/, R = /\n\r?\n$/, O = /^\r?\n\r?\n/;
  4217. function U(m) {
  4218. function j(be, v) {
  4219. if (!be || !v)
  4220. return 6;
  4221. var F = be.charAt(be.length - 1), V = v.charAt(0), K = F.match(d), z = V.match(d), W = K && F.match(f), ue = z && V.match(f), oe = W && F.match(E), B = ue && V.match(E), ee = oe && be.match(R), ie = B && v.match(O);
  4222. return ee || ie ? 5 : oe || B ? 4 : K && !W && ue ? 3 : W || ue ? 2 : K || z ? 1 : 0;
  4223. }
  4224. for (var y = 1; y < m.length - 1; ) {
  4225. if (m[y - 1][0] == n && m[y + 1][0] == n) {
  4226. var M = m[y - 1][1], b = m[y][1], w = m[y + 1][1], k = c(M, b);
  4227. if (k) {
  4228. var $ = b.substring(b.length - k);
  4229. M = M.substring(0, M.length - k), b = $ + b.substring(0, b.length - k), w = $ + w;
  4230. }
  4231. for (var Y = M, se = b, he = w, ge = j(M, b) + j(b, w); b.charAt(0) === w.charAt(0); ) {
  4232. M += b.charAt(0), b = b.substring(1) + w.charAt(0), w = w.substring(1);
  4233. var Ae = j(M, b) + j(b, w);
  4234. Ae >= ge && (ge = Ae, Y = M, se = b, he = w);
  4235. }
  4236. m[y - 1][1] != Y && (Y ? m[y - 1][1] = Y : (m.splice(y - 1, 1), y--), m[y][1] = se, he ? m[y + 1][1] = he : (m.splice(y + 1, 1), y--));
  4237. }
  4238. y++;
  4239. }
  4240. }
  4241. function ne(m, j) {
  4242. m.push([n, ""]);
  4243. for (var y = 0, M = 0, b = 0, w = "", k = "", $; y < m.length; ) {
  4244. if (y < m.length - 1 && !m[y][1]) {
  4245. m.splice(y, 1);
  4246. continue;
  4247. }
  4248. switch (m[y][0]) {
  4249. case e:
  4250. b++, k += m[y][1], y++;
  4251. break;
  4252. case t:
  4253. M++, w += m[y][1], y++;
  4254. break;
  4255. case n:
  4256. var Y = y - b - M - 1;
  4257. if (j) {
  4258. if (Y >= 0 && A(m[Y][1])) {
  4259. var se = m[Y][1].slice(-1);
  4260. if (m[Y][1] = m[Y][1].slice(
  4261. 0,
  4262. -1
  4263. ), w = se + w, k = se + k, !m[Y][1]) {
  4264. m.splice(Y, 1), y--;
  4265. var he = Y - 1;
  4266. m[he] && m[he][0] === e && (b++, k = m[he][1] + k, he--), m[he] && m[he][0] === t && (M++, w = m[he][1] + w, he--), Y = he;
  4267. }
  4268. }
  4269. if (T(m[y][1])) {
  4270. var se = m[y][1].charAt(0);
  4271. m[y][1] = m[y][1].slice(1), w += se, k += se;
  4272. }
  4273. }
  4274. if (y < m.length - 1 && !m[y][1]) {
  4275. m.splice(y, 1);
  4276. break;
  4277. }
  4278. if (w.length > 0 || k.length > 0) {
  4279. w.length > 0 && k.length > 0 && ($ = a(k, w), $ !== 0 && (Y >= 0 ? m[Y][1] += k.substring(
  4280. 0,
  4281. $
  4282. ) : (m.splice(0, 0, [
  4283. n,
  4284. k.substring(0, $)
  4285. ]), y++), k = k.substring($), w = w.substring($)), $ = c(k, w), $ !== 0 && (m[y][1] = k.substring(k.length - $) + m[y][1], k = k.substring(
  4286. 0,
  4287. k.length - $
  4288. ), w = w.substring(
  4289. 0,
  4290. w.length - $
  4291. )));
  4292. var ge = b + M;
  4293. w.length === 0 && k.length === 0 ? (m.splice(y - ge, ge), y = y - ge) : w.length === 0 ? (m.splice(y - ge, ge, [e, k]), y = y - ge + 1) : k.length === 0 ? (m.splice(y - ge, ge, [t, w]), y = y - ge + 1) : (m.splice(
  4294. y - ge,
  4295. ge,
  4296. [t, w],
  4297. [e, k]
  4298. ), y = y - ge + 2);
  4299. }
  4300. y !== 0 && m[y - 1][0] === n ? (m[y - 1][1] += m[y][1], m.splice(y, 1)) : y++, b = 0, M = 0, w = "", k = "";
  4301. break;
  4302. }
  4303. }
  4304. m[m.length - 1][1] === "" && m.pop();
  4305. var Ae = false;
  4306. for (y = 1; y < m.length - 1; )
  4307. m[y - 1][0] === n && m[y + 1][0] === n && (m[y][1].substring(
  4308. m[y][1].length - m[y - 1][1].length
  4309. ) === m[y - 1][1] ? (m[y][1] = m[y - 1][1] + m[y][1].substring(
  4310. 0,
  4311. m[y][1].length - m[y - 1][1].length
  4312. ), m[y + 1][1] = m[y - 1][1] + m[y + 1][1], m.splice(y - 1, 1), Ae = true) : m[y][1].substring(0, m[y + 1][1].length) == m[y + 1][1] && (m[y - 1][1] += m[y + 1][1], m[y][1] = m[y][1].substring(m[y + 1][1].length) + m[y + 1][1], m.splice(y + 1, 1), Ae = true)), y++;
  4313. Ae && ne(m, j);
  4314. }
  4315. function X(m) {
  4316. return m >= 55296 && m <= 56319;
  4317. }
  4318. function de(m) {
  4319. return m >= 56320 && m <= 57343;
  4320. }
  4321. function T(m) {
  4322. return de(m.charCodeAt(0));
  4323. }
  4324. function A(m) {
  4325. return X(m.charCodeAt(m.length - 1));
  4326. }
  4327. function H(m) {
  4328. for (var j = [], y = 0; y < m.length; y++)
  4329. m[y][1].length > 0 && j.push(m[y]);
  4330. return j;
  4331. }
  4332. function Z(m, j, y, M) {
  4333. return A(m) || T(M) ? null : H([
  4334. [n, m],
  4335. [t, j],
  4336. [e, y],
  4337. [n, M]
  4338. ]);
  4339. }
  4340. function fe(m, j, y) {
  4341. var M = typeof y == "number" ? { index: y, length: 0 } : y.oldRange, b = typeof y == "number" ? null : y.newRange, w = m.length, k = j.length;
  4342. if (M.length === 0 && (b === null || b.length === 0)) {
  4343. var $ = M.index, Y = m.slice(0, $), se = m.slice($), he = b ? b.index : null;
  4344. e: {
  4345. var ge = $ + k - w;
  4346. if (he !== null && he !== ge || ge < 0 || ge > k)
  4347. break e;
  4348. var Ae = j.slice(0, ge), be = j.slice(ge);
  4349. if (be !== se)
  4350. break e;
  4351. var v = Math.min($, ge), F = Y.slice(0, v), V = Ae.slice(0, v);
  4352. if (F !== V)
  4353. break e;
  4354. var K = Y.slice(v), z = Ae.slice(v);
  4355. return Z(F, K, z, se);
  4356. }
  4357. e: {
  4358. if (he !== null && he !== $)
  4359. break e;
  4360. var W = $, Ae = j.slice(0, W), be = j.slice(W);
  4361. if (Ae !== Y)
  4362. break e;
  4363. var ue = Math.min(w - W, k - W), oe = se.slice(se.length - ue), B = be.slice(be.length - ue);
  4364. if (oe !== B)
  4365. break e;
  4366. var K = se.slice(0, se.length - ue), z = be.slice(0, be.length - ue);
  4367. return Z(Y, K, z, oe);
  4368. }
  4369. }
  4370. if (M.length > 0 && b && b.length === 0)
  4371. e: {
  4372. var F = m.slice(0, M.index), oe = m.slice(M.index + M.length), v = F.length, ue = oe.length;
  4373. if (k < v + ue)
  4374. break e;
  4375. var V = j.slice(0, v), B = j.slice(k - ue);
  4376. if (F !== V || oe !== B)
  4377. break e;
  4378. var K = m.slice(v, w - ue), z = j.slice(v, k - ue);
  4379. return Z(F, K, z, oe);
  4380. }
  4381. return null;
  4382. }
  4383. function ae(m, j, y, M) {
  4384. return r(m, j, y, M, true);
  4385. }
  4386. return ae.INSERT = e, ae.DELETE = t, ae.EQUAL = n, vs = ae, vs;
  4387. }
  4388. var Bd = $d();
  4389. var ru = wt(Bd);
  4390. function cs(t, e) {
  4391. const n = t.indexOf(e);
  4392. return n > -1 ? (t.splice(n, 1), true) : false;
  4393. }
  4394. function T0(t) {
  4395. const e = /* @__PURE__ */ new Set(), n = [];
  4396. for (const r of t)
  4397. e.has(r) || (e.add(r), n.push(r));
  4398. return n;
  4399. }
  4400. function jd(t, e) {
  4401. for (let n = t.length - 1; n > -1; n--) {
  4402. const r = t[n];
  4403. if (e(r, n))
  4404. return r;
  4405. }
  4406. return null;
  4407. }
  4408. function M0(t, e) {
  4409. if (t.length === 0)
  4410. return t;
  4411. const n = e % t.length;
  4412. return t.slice(n).concat(t.slice(0, n));
  4413. }
  4414. function D0(t, e) {
  4415. const n = /* @__PURE__ */ new Map();
  4416. return t.forEach((r) => {
  4417. const s = e(r);
  4418. let i = n.get(s);
  4419. n.has(s) || (i = [], n.set(s, i)), i.push(r);
  4420. }), n;
  4421. }
  4422. function x0(t) {
  4423. return Array.isArray(t) ? t : [t];
  4424. }
  4425. function L0(t) {
  4426. return ["true", "false"].includes(t.toLowerCase());
  4427. }
  4428. var or = "__INTERNAL_EDITOR__";
  4429. var su = `${or}DOCS_NORMAL`;
  4430. var iu = `${or}DOCS_FORMULA_BAR`;
  4431. var Hd = `${or}ZEN_EDITOR`;
  4432. var Wd = `\r
  4433. `;
  4434. var U0 = "isRowStylePrecedeColumnStyle";
  4435. var P0 = Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");
  4436. function k0(t) {
  4437. return `${or}${t}`;
  4438. }
  4439. function zd(t) {
  4440. return t.startsWith(or);
  4441. }
  4442. var bi = Symbol("$$IDENTIFIER_DECORATOR");
  4443. function Yd(t) {
  4444. return t && t[bi] === true;
  4445. }
  4446. function ou(t) {
  4447. return typeof t == "function";
  4448. }
  4449. function ao(t) {
  4450. return !!(t && typeof t.useClass < "u");
  4451. }
  4452. function uo(t) {
  4453. return !!(t && typeof t.useFactory < "u");
  4454. }
  4455. function lo(t) {
  4456. return !!(t && typeof t.useValue < "u");
  4457. }
  4458. function Vd(t) {
  4459. return !!(t && typeof t.useExisting < "u");
  4460. }
  4461. function co(t) {
  4462. return !!(t && typeof t.useAsync < "u");
  4463. }
  4464. var au = Symbol("AsyncHook");
  4465. function ys(t) {
  4466. return !!(t && t.__symbol === au);
  4467. }
  4468. function Et(t) {
  4469. return typeof t > "u" ? "undefined" : ou(t) && !t[bi] ? t.name : t.toString();
  4470. }
  4471. var Gd = function() {
  4472. var t = function(e, n) {
  4473. return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
  4474. r.__proto__ = s;
  4475. } || function(r, s) {
  4476. for (var i in s)
  4477. Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
  4478. }, t(e, n);
  4479. };
  4480. return function(e, n) {
  4481. if (typeof n != "function" && n !== null)
  4482. throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
  4483. t(e, n);
  4484. function r() {
  4485. this.constructor = e;
  4486. }
  4487. e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
  4488. };
  4489. }();
  4490. var at = (
  4491. /** @class */
  4492. function(t) {
  4493. Gd(e, t);
  4494. function e(n) {
  4495. return t.call(this, "[redi]: ".concat(n)) || this;
  4496. }
  4497. return e;
  4498. }(Error)
  4499. );
  4500. var Ge;
  4501. (function(t) {
  4502. t.MANY = "many", t.OPTIONAL = "optional", t.REQUIRED = "required";
  4503. })(Ge || (Ge = {}));
  4504. var $t;
  4505. (function(t) {
  4506. t.SELF = "self", t.SKIP_SELF = "skipSelf";
  4507. })($t || ($t = {}));
  4508. var uu = function() {
  4509. var t = function(e, n) {
  4510. return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
  4511. r.__proto__ = s;
  4512. } || function(r, s) {
  4513. for (var i in s)
  4514. Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
  4515. }, t(e, n);
  4516. };
  4517. return function(e, n) {
  4518. if (typeof n != "function" && n !== null)
  4519. throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
  4520. t(e, n);
  4521. function r() {
  4522. this.constructor = e;
  4523. }
  4524. e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
  4525. };
  4526. }();
  4527. var ho = Symbol("$$TARGET");
  4528. var js = Symbol("$$DEPENDENCIES");
  4529. var Kd = (
  4530. /** @class */
  4531. function(t) {
  4532. uu(e, t);
  4533. function e(n, r) {
  4534. var s = "Could not find dependency registered on the ".concat(n, ' (indexed) parameter of the constructor of "').concat(Et(r), '".');
  4535. return t.call(this, s) || this;
  4536. }
  4537. return e;
  4538. }(at)
  4539. );
  4540. var lu = (
  4541. /** @class */
  4542. function(t) {
  4543. uu(e, t);
  4544. function e(n, r) {
  4545. var s = 'It seems that you register "undefined" as dependency on the '.concat(r + 1, ' parameter of "').concat(Et(n), '". Please make sure that there is not cyclic dependency among your TypeScript files, or consider using "forwardRef". For more info please visit our website https://redi.wendell.fun/docs/debug#could-not-find-dependency-registered-on');
  4546. return t.call(this, s) || this;
  4547. }
  4548. return e;
  4549. }(at)
  4550. );
  4551. function cu(t) {
  4552. var e = t;
  4553. return e[js] || [];
  4554. }
  4555. function Si(t, e) {
  4556. var n = cu(t), r = n.find(function(s) {
  4557. return s.paramIndex === e;
  4558. });
  4559. if (!r)
  4560. throw new Kd(e, t);
  4561. return r;
  4562. }
  4563. function Ai(t, e, n, r, s) {
  4564. r === void 0 && (r = Ge.REQUIRED);
  4565. var i = {
  4566. paramIndex: n,
  4567. identifier: e,
  4568. quantity: r,
  4569. lookUp: s,
  4570. withNew: false
  4571. };
  4572. if (typeof e > "u")
  4573. throw new lu(t, n);
  4574. var o = t;
  4575. o[ho] === o ? o[js].push(i) : (o[js] = [i], o[ho] = o);
  4576. }
  4577. var fo = /* @__PURE__ */ new Set();
  4578. function Ct(t) {
  4579. if (fo.has(t))
  4580. throw new at('Identifier "'.concat(t, '" already exists.'));
  4581. fo.add(t);
  4582. var e = function(n, r, s) {
  4583. Ai(n, e, s);
  4584. };
  4585. return e.toString = function() {
  4586. return t;
  4587. }, e[bi] = true, e;
  4588. }
  4589. function Xd(t, e, n) {
  4590. var r = Si(t, e);
  4591. r.lookUp = n;
  4592. }
  4593. function hu(t) {
  4594. return function e() {
  4595. return this instanceof e ? this : function(n, r, s) {
  4596. Xd(n, s, t);
  4597. };
  4598. };
  4599. }
  4600. var Jd = hu($t.SKIP_SELF);
  4601. var Zd = hu($t.SELF);
  4602. var Qd = function() {
  4603. var t = function(e, n) {
  4604. return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
  4605. r.__proto__ = s;
  4606. } || function(r, s) {
  4607. for (var i in s)
  4608. Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
  4609. }, t(e, n);
  4610. };
  4611. return function(e, n) {
  4612. if (typeof n != "function" && n !== null)
  4613. throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
  4614. t(e, n);
  4615. function r() {
  4616. this.constructor = e;
  4617. }
  4618. e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
  4619. };
  4620. }();
  4621. var Hs = (
  4622. /** @class */
  4623. function(t) {
  4624. Qd(e, t);
  4625. function e(n, r, s) {
  4626. var i = this, o = 'Expect "'.concat(r, '" dependency items for id "').concat(Et(n), '" but get ').concat(s, ".");
  4627. return s === 0 && (o += " Did you forget to register it?"), s > 1 && (o += " You register it more than once."), i = t.call(this, o) || this, i.quantity = r, i.actual = s, i;
  4628. }
  4629. return e;
  4630. }(at)
  4631. );
  4632. function Ni(t, e, n) {
  4633. if (e === Ge.OPTIONAL && n > 1 || e === Ge.REQUIRED && n !== 1)
  4634. throw new Hs(t, e, n);
  4635. }
  4636. function qd(t, e) {
  4637. return t === Ge.MANY ? e : e[0];
  4638. }
  4639. function ef(t, e, n) {
  4640. var r = Si(t, e);
  4641. r.quantity = n;
  4642. }
  4643. function Ti(t) {
  4644. return function e(n) {
  4645. return this instanceof e ? this : function(r, s, i) {
  4646. if (n)
  4647. Ai(r, n, i, t);
  4648. else {
  4649. if (t === Ge.REQUIRED)
  4650. throw new lu(r, i);
  4651. ef(r, i, t);
  4652. }
  4653. };
  4654. };
  4655. }
  4656. var tf = Ti(Ge.MANY);
  4657. var nf = Ti(Ge.OPTIONAL);
  4658. var ot = Ti(Ge.REQUIRED);
  4659. function rf(t, e, n) {
  4660. var r = Si(t, e);
  4661. r.withNew = n;
  4662. }
  4663. function sf(t) {
  4664. return function e() {
  4665. return this instanceof e ? this : function(n, r, s) {
  4666. rf(n, s, t);
  4667. };
  4668. };
  4669. }
  4670. var of2 = sf(true);
  4671. function du(t, e) {
  4672. return e === void 0 && (e = 0), t ? t.map(function(n, r) {
  4673. if (r += e, !Array.isArray(n))
  4674. return {
  4675. paramIndex: r,
  4676. identifier: n,
  4677. quantity: Ge.REQUIRED,
  4678. withNew: false
  4679. };
  4680. var s = n.slice(0, n.length - 1), i = n[n.length - 1], o, a = Ge.REQUIRED, u = false;
  4681. return s.forEach(function(c) {
  4682. if (c instanceof Zd)
  4683. o = $t.SELF;
  4684. else if (c instanceof Jd)
  4685. o = $t.SKIP_SELF;
  4686. else if (c instanceof nf)
  4687. a = Ge.OPTIONAL;
  4688. else if (c instanceof tf)
  4689. a = Ge.MANY;
  4690. else if (c instanceof of2)
  4691. u = true;
  4692. else
  4693. throw new at("unknown dep modifier ".concat(c, "."));
  4694. }), {
  4695. paramIndex: r,
  4696. identifier: i,
  4697. quantity: a,
  4698. lookUp: o,
  4699. withNew: u
  4700. };
  4701. }) : [];
  4702. }
  4703. function F0(t, e, n) {
  4704. n === void 0 && (n = 0);
  4705. var r = du(e, n);
  4706. r.forEach(function(s) {
  4707. Ai(t, s.identifier, s.paramIndex, s.quantity, s.lookUp);
  4708. });
  4709. }
  4710. function $0(t) {
  4711. return {
  4712. unwrap: t
  4713. };
  4714. }
  4715. function af(t) {
  4716. return !!t && typeof t.unwrap == "function";
  4717. }
  4718. function uf(t) {
  4719. return af(t) ? t.unwrap() : t;
  4720. }
  4721. function go(t) {
  4722. return !!t && typeof t.dispose == "function";
  4723. }
  4724. var fu = function() {
  4725. var t = function(e, n) {
  4726. return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
  4727. r.__proto__ = s;
  4728. } || function(r, s) {
  4729. for (var i in s)
  4730. Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
  4731. }, t(e, n);
  4732. };
  4733. return function(e, n) {
  4734. if (typeof n != "function" && n !== null)
  4735. throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
  4736. t(e, n);
  4737. function r() {
  4738. this.constructor = e;
  4739. }
  4740. e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
  4741. };
  4742. }();
  4743. function lf(t) {
  4744. return t.length === 1;
  4745. }
  4746. var hs = [];
  4747. function po(t) {
  4748. hs.push(t);
  4749. }
  4750. function mo() {
  4751. hs.pop();
  4752. }
  4753. function cf() {
  4754. hs.length = 0;
  4755. }
  4756. var _o = (
  4757. /** @class */
  4758. function(t) {
  4759. fu(e, t);
  4760. function e(n, r, s) {
  4761. var i = 'Cannot find "'.concat(Et(r), '" registered by any injector. It is the ').concat(s, 'th param of "').concat(Yd(n) ? Et(n) : n.name, '".');
  4762. return t.call(this, i) || this;
  4763. }
  4764. return e;
  4765. }(at)
  4766. );
  4767. var Ur = (
  4768. /** @class */
  4769. function(t) {
  4770. fu(e, t);
  4771. function e(n) {
  4772. var r = this, s = 'Cannot find "'.concat(Et(n), '" registered by any injector. The stack of dependencies is: "').concat(hs.map(function(i) {
  4773. return Et(i);
  4774. }).join(" -> "), '".');
  4775. return r = t.call(this, s) || this, cf(), r;
  4776. }
  4777. return e;
  4778. }(at)
  4779. );
  4780. var hf = (
  4781. /** @class */
  4782. function() {
  4783. function t(e) {
  4784. var n = this;
  4785. this.dependencyMap = /* @__PURE__ */ new Map(), this.normalizeDependencies(e).map(function(r) {
  4786. return n.add(r[0], r[1]);
  4787. });
  4788. }
  4789. return t.prototype.add = function(e, n) {
  4790. typeof n > "u" && (n = { useClass: e, lazy: false });
  4791. var r = this.dependencyMap.get(e);
  4792. typeof r > "u" && (r = [], this.dependencyMap.set(e, r)), r.push(n);
  4793. }, t.prototype.delete = function(e) {
  4794. this.dependencyMap.delete(e);
  4795. }, t.prototype.get = function(e, n) {
  4796. n === void 0 && (n = Ge.REQUIRED);
  4797. var r = this.dependencyMap.get(e);
  4798. return Ni(e, n, r.length), qd(n, r);
  4799. }, t.prototype.has = function(e) {
  4800. return this.dependencyMap.has(e);
  4801. }, t.prototype.append = function(e) {
  4802. var n = this;
  4803. this.normalizeDependencies(e).forEach(function(r) {
  4804. return n.add(r[0], r[1]);
  4805. });
  4806. }, t.prototype.dispose = function() {
  4807. this.dependencyMap.clear();
  4808. }, t.prototype.normalizeDependencies = function(e) {
  4809. return e.map(function(n) {
  4810. var r = n[0], s;
  4811. return lf(n) ? s = {
  4812. useClass: n[0],
  4813. lazy: false
  4814. } : s = n[1], [r, s];
  4815. });
  4816. }, t;
  4817. }()
  4818. );
  4819. var df = (
  4820. /** @class */
  4821. function() {
  4822. function t() {
  4823. this.resolvedDependencies = /* @__PURE__ */ new Map();
  4824. }
  4825. return t.prototype.add = function(e, n) {
  4826. var r = this.resolvedDependencies.get(e);
  4827. typeof r > "u" && (r = [], this.resolvedDependencies.set(e, r)), r.push(n);
  4828. }, t.prototype.has = function(e) {
  4829. return this.resolvedDependencies.has(e);
  4830. }, t.prototype.delete = function(e) {
  4831. if (this.resolvedDependencies.has(e)) {
  4832. var n = this.resolvedDependencies.get(e);
  4833. n.forEach(function(r) {
  4834. return go(r) ? r.dispose() : void 0;
  4835. }), this.resolvedDependencies.delete(e);
  4836. }
  4837. }, t.prototype.get = function(e, n) {
  4838. n === void 0 && (n = Ge.REQUIRED);
  4839. var r = this.resolvedDependencies.get(e);
  4840. if (!r)
  4841. throw new Ur(e);
  4842. return Ni(e, n, r.length), n === Ge.MANY ? r : r[0];
  4843. }, t.prototype.dispose = function() {
  4844. Array.from(this.resolvedDependencies.values()).forEach(function(e) {
  4845. e.forEach(function(n) {
  4846. return go(n) ? n.dispose() : void 0;
  4847. });
  4848. }), this.resolvedDependencies.clear();
  4849. }, t;
  4850. }()
  4851. );
  4852. var Ws;
  4853. (function() {
  4854. if (typeof requestIdleCallback < "u" && typeof cancelIdleCallback < "u")
  4855. Ws = function(e, n) {
  4856. var r = requestIdleCallback(e, typeof n == "number" ? { timeout: n } : void 0), s = false;
  4857. return function() {
  4858. s || (s = true, cancelIdleCallback(r));
  4859. };
  4860. };
  4861. else {
  4862. var t = Object.freeze({
  4863. didTimeout: true,
  4864. timeRemaining: function() {
  4865. return 15;
  4866. }
  4867. });
  4868. Ws = function(e) {
  4869. var n = setTimeout(function() {
  4870. return e(t);
  4871. }), r = false;
  4872. return function() {
  4873. r || (r = true, clearTimeout(n));
  4874. };
  4875. };
  4876. }
  4877. })();
  4878. var ff = (
  4879. /** @class */
  4880. function() {
  4881. function t(e) {
  4882. var n = this;
  4883. this.didRun = false, this.selfExecutor = function() {
  4884. try {
  4885. n.value = e();
  4886. } catch (r) {
  4887. n.error = r;
  4888. } finally {
  4889. n.didRun = true;
  4890. }
  4891. }, this.disposeCallback = Ws(function() {
  4892. return n.selfExecutor();
  4893. });
  4894. }
  4895. return t.prototype.hasRun = function() {
  4896. return this.didRun;
  4897. }, t.prototype.dispose = function() {
  4898. this.disposeCallback();
  4899. }, t.prototype.getValue = function() {
  4900. if (this.didRun || (this.dispose(), this.selfExecutor()), this.error)
  4901. throw this.error;
  4902. return this.value;
  4903. }, t;
  4904. }()
  4905. );
  4906. var kn = function() {
  4907. var t = function(e, n) {
  4908. return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
  4909. r.__proto__ = s;
  4910. } || function(r, s) {
  4911. for (var i in s)
  4912. Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
  4913. }, t(e, n);
  4914. };
  4915. return function(e, n) {
  4916. if (typeof n != "function" && n !== null)
  4917. throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
  4918. t(e, n);
  4919. function r() {
  4920. this.constructor = e;
  4921. }
  4922. e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
  4923. };
  4924. }();
  4925. var Xr = function() {
  4926. return Xr = Object.assign || function(t) {
  4927. for (var e, n = 1, r = arguments.length; n < r; n++) {
  4928. e = arguments[n];
  4929. for (var s in e)
  4930. Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
  4931. }
  4932. return t;
  4933. }, Xr.apply(this, arguments);
  4934. };
  4935. var on = function(t, e, n) {
  4936. if (n || arguments.length === 2)
  4937. for (var r = 0, s = e.length, i; r < s; r++)
  4938. (i || !(r in e)) && (i || (i = Array.prototype.slice.call(e, 0, r)), i[r] = e[r]);
  4939. return t.concat(i || Array.prototype.slice.call(e));
  4940. };
  4941. var gf = 300;
  4942. var pr = Symbol("$$NOT_INSTANTIATED_SYMBOL");
  4943. var pf = (
  4944. /** @class */
  4945. function(t) {
  4946. kn(e, t);
  4947. function e(n) {
  4948. return t.call(this, 'Detecting cyclic dependency. The last identifier is "'.concat(Et(n), '".')) || this;
  4949. }
  4950. return e;
  4951. }(at)
  4952. );
  4953. var mf = (
  4954. /** @class */
  4955. function(t) {
  4956. kn(e, t);
  4957. function e() {
  4958. return t.call(this, "Injector cannot be accessed after it was disposed.") || this;
  4959. }
  4960. return e;
  4961. }(at)
  4962. );
  4963. var _f = (
  4964. /** @class */
  4965. function(t) {
  4966. kn(e, t);
  4967. function e(n) {
  4968. return t.call(this, 'Async item "'.concat(Et(n), '" returns another async item.')) || this;
  4969. }
  4970. return e;
  4971. }(at)
  4972. );
  4973. var Ef = (
  4974. /** @class */
  4975. function(t) {
  4976. kn(e, t);
  4977. function e(n) {
  4978. return t.call(this, 'Cannot get async item "'.concat(Et(n), '" from sync api.')) || this;
  4979. }
  4980. return e;
  4981. }(at)
  4982. );
  4983. var Eo = (
  4984. /** @class */
  4985. function(t) {
  4986. kn(e, t);
  4987. function e(n) {
  4988. return t.call(this, 'Cannot add dependency "'.concat(Et(n), '" after it is already resolved.')) || this;
  4989. }
  4990. return e;
  4991. }(at)
  4992. );
  4993. var Cf = (
  4994. /** @class */
  4995. function(t) {
  4996. kn(e, t);
  4997. function e(n) {
  4998. return t.call(this, 'Cannot dependency dependency "'.concat(Et(n), '" after it is already resolved.')) || this;
  4999. }
  5000. return e;
  5001. }(at)
  5002. );
  5003. var Ot = (
  5004. /** @class */
  5005. function() {
  5006. function t(e, n) {
  5007. n === void 0 && (n = null), this.parent = n, this.children = [], this.resolutionOngoing = 0, this.disposingCallbacks = /* @__PURE__ */ new Set(), this.disposed = false, this.dependencyCollection = new hf(e || []), this.resolvedDependencyCollection = new df(), n && n.children.push(this);
  5008. }
  5009. return t.prototype.onDispose = function(e) {
  5010. var n = this;
  5011. return this.disposingCallbacks.add(e), { dispose: function() {
  5012. return n.disposingCallbacks.delete(e);
  5013. } };
  5014. }, t.prototype.createChild = function(e) {
  5015. return this._ensureInjectorNotDisposed(), new t(e, this);
  5016. }, t.prototype.dispose = function() {
  5017. this.children.forEach(function(e) {
  5018. return e.dispose();
  5019. }), this.children.length = 0, this.dependencyCollection.dispose(), this.resolvedDependencyCollection.dispose(), this.deleteSelfFromParent(), this.disposed = true, this.disposingCallbacks.forEach(function(e) {
  5020. return e();
  5021. }), this.disposingCallbacks.clear();
  5022. }, t.prototype.deleteSelfFromParent = function() {
  5023. if (this.parent) {
  5024. var e = this.parent.children.indexOf(this);
  5025. e > -1 && this.parent.children.splice(e, 1);
  5026. }
  5027. }, t.prototype.add = function(e) {
  5028. this._ensureInjectorNotDisposed();
  5029. var n = e[0], r = e[1];
  5030. if (this.resolvedDependencyCollection.has(n))
  5031. throw new Eo(n);
  5032. typeof r > "u" ? this.dependencyCollection.add(n) : co(r) || ao(r) || lo(r) || uo(r) ? this.dependencyCollection.add(n, r) : this.resolvedDependencyCollection.add(n, r);
  5033. }, t.prototype.replace = function(e) {
  5034. this._ensureInjectorNotDisposed();
  5035. var n = e[0];
  5036. if (this.resolvedDependencyCollection.has(n))
  5037. throw new Eo(n);
  5038. this.dependencyCollection.delete(n), e.length === 1 ? this.dependencyCollection.add(n) : this.dependencyCollection.add(n, e[1]);
  5039. }, t.prototype.delete = function(e) {
  5040. if (this._ensureInjectorNotDisposed(), this.resolvedDependencyCollection.has(e))
  5041. throw new Cf(e);
  5042. this.dependencyCollection.delete(e);
  5043. }, t.prototype.invoke = function(e) {
  5044. for (var n = this, r = [], s = 1; s < arguments.length; s++)
  5045. r[s - 1] = arguments[s];
  5046. this._ensureInjectorNotDisposed();
  5047. var i = {
  5048. get: function(o, a, u) {
  5049. return n._get(o, a, u);
  5050. },
  5051. has: function(o) {
  5052. return n.has(o);
  5053. }
  5054. };
  5055. return e.apply(void 0, on([i], r, false));
  5056. }, t.prototype.has = function(e) {
  5057. var n;
  5058. return this.dependencyCollection.has(e) || ((n = this.parent) === null || n === void 0 ? void 0 : n.has(e)) || false;
  5059. }, t.prototype.get = function(e, n, r) {
  5060. this._ensureInjectorNotDisposed();
  5061. var s = this._get(e, n, r);
  5062. if (Array.isArray(s) && s.some(function(i) {
  5063. return ys(i);
  5064. }) || ys(s))
  5065. throw new Ef(e);
  5066. return s;
  5067. }, t.prototype._get = function(e, n, r, s) {
  5068. var i = Ge.REQUIRED;
  5069. if (n === Ge.REQUIRED || n === Ge.OPTIONAL || n === Ge.MANY ? i = n : r = n, !s) {
  5070. var o = this.getValue(e, i, r);
  5071. if (o !== pr)
  5072. return o;
  5073. }
  5074. return this.createDependency(e, i, r, !s);
  5075. }, t.prototype.getAsync = function(e) {
  5076. this._ensureInjectorNotDisposed();
  5077. var n = this.getValue(e, Ge.REQUIRED);
  5078. if (n !== pr)
  5079. return Promise.resolve(n);
  5080. var r = this.createDependency(e, Ge.REQUIRED);
  5081. return ys(r) ? r.whenReady() : Promise.resolve(r);
  5082. }, t.prototype.createInstance = function(e) {
  5083. for (var n = [], r = 1; r < arguments.length; r++)
  5084. n[r - 1] = arguments[r];
  5085. return this._ensureInjectorNotDisposed(), this._resolveClassImpl.apply(this, on([{
  5086. useClass: e
  5087. }], n, false));
  5088. }, t.prototype._resolveDependency = function(e, n, r) {
  5089. r === void 0 && (r = true);
  5090. var s;
  5091. po(e);
  5092. try {
  5093. lo(n) ? s = this._resolveValueDependency(e, n) : uo(n) ? s = this._resolveFactory(e, n, r) : ao(n) ? s = this._resolveClass(e, n, r) : Vd(n) ? s = this._resolveExisting(e, n) : s = this._resolveAsync(e, n), mo();
  5094. } catch (i) {
  5095. throw mo(), i;
  5096. }
  5097. return s;
  5098. }, t.prototype._resolveExisting = function(e, n) {
  5099. var r = this.get(n.useExisting);
  5100. return this.resolvedDependencyCollection.add(e, r), r;
  5101. }, t.prototype._resolveValueDependency = function(e, n) {
  5102. var r = n.useValue;
  5103. return this.resolvedDependencyCollection.add(e, r), r;
  5104. }, t.prototype._resolveClass = function(e, n, r) {
  5105. var s = this;
  5106. r === void 0 && (r = true);
  5107. var i;
  5108. if (n.lazy) {
  5109. var o = new ff(function() {
  5110. return s._ensureInjectorNotDisposed(), s._resolveClassImpl(n);
  5111. });
  5112. i = new Proxy(/* @__PURE__ */ Object.create(null), {
  5113. get: function(a, u) {
  5114. if (u in a)
  5115. return a[u];
  5116. if (u !== "whenReady") {
  5117. var c = o.getValue(), l = c[u];
  5118. return typeof l != "function" || (l = l.bind(c), a[u] = l), l;
  5119. }
  5120. },
  5121. set: function(a, u, c) {
  5122. return o.getValue()[u] = c, true;
  5123. }
  5124. });
  5125. } else
  5126. i = this._resolveClassImpl(n);
  5127. return e && r && this.resolvedDependencyCollection.add(e, i), i;
  5128. }, t.prototype._resolveClassImpl = function(e) {
  5129. for (var n, r = [], s = 1; s < arguments.length; s++)
  5130. r[s - 1] = arguments[s];
  5131. var i = e.useClass;
  5132. this.markNewResolution(i);
  5133. for (var o = cu(i).sort(function(O, U) {
  5134. return O.paramIndex - U.paramIndex;
  5135. }).map(function(O) {
  5136. return Xr(Xr({}, O), { identifier: uf(O.identifier) });
  5137. }), a = [], u = 0, c = o; u < c.length; u++) {
  5138. var l = c[u];
  5139. try {
  5140. var h = this._get(l.identifier, l.quantity, l.lookUp, l.withNew);
  5141. a.push(h);
  5142. } catch (O) {
  5143. throw O instanceof Ur || O instanceof Hs && O.actual === 0 ? new _o(i, l.identifier, l.paramIndex) : O;
  5144. }
  5145. }
  5146. var d = on([], r, true), f = o.length > 0 ? o[0].paramIndex : d.length;
  5147. if (d.length !== f) {
  5148. console.warn("[redi]: Expect ".concat(f, " custom parameter(s) of ").concat(Et(i), " but get ").concat(d.length, "."));
  5149. var E = f - d.length;
  5150. E > 0 ? d = on(on([], d, true), Array.from({ length: E }).fill(void 0), true) : d = d.slice(0, f);
  5151. }
  5152. var R = new (i.bind.apply(i, on(on([void 0], d, false), a, false)))();
  5153. return (n = e == null ? void 0 : e.onInstantiation) === null || n === void 0 || n.call(e, R), this.markResolutionCompleted(), R;
  5154. }, t.prototype._resolveFactory = function(e, n, r) {
  5155. var s;
  5156. this.markNewResolution(e);
  5157. for (var i = du(n.deps), o = [], a = 0, u = i; a < u.length; a++) {
  5158. var c = u[a];
  5159. try {
  5160. var l = this._get(c.identifier, c.quantity, c.lookUp, c.withNew);
  5161. o.push(l);
  5162. } catch (d) {
  5163. throw d instanceof Ur || d instanceof Hs && d.actual === 0 ? new _o(e, c.identifier, c.paramIndex) : d;
  5164. }
  5165. }
  5166. var h = n.useFactory.apply(null, o);
  5167. return r && this.resolvedDependencyCollection.add(e, h), this.markResolutionCompleted(), (s = n == null ? void 0 : n.onInstantiation) === null || s === void 0 || s.call(n, h), h;
  5168. }, t.prototype._resolveAsync = function(e, n) {
  5169. var r = this, s = {
  5170. __symbol: au,
  5171. whenReady: function() {
  5172. return r._resolveAsyncImpl(e, n);
  5173. }
  5174. };
  5175. return s;
  5176. }, t.prototype._resolveAsyncImpl = function(e, n) {
  5177. var r = this;
  5178. return n.useAsync().then(function(s) {
  5179. var i = r.getValue(e);
  5180. if (i !== pr)
  5181. return i;
  5182. var o;
  5183. if (Array.isArray(s)) {
  5184. var a = s[1];
  5185. if (co(a))
  5186. throw new _f(e);
  5187. o = r._resolveDependency(e, a);
  5188. } else
  5189. ou(s) ? o = r._resolveClassImpl({
  5190. useClass: s,
  5191. onInstantiation: n.onInstantiation
  5192. }) : o = s;
  5193. return r.resolvedDependencyCollection.add(e, o), o;
  5194. });
  5195. }, t.prototype.getValue = function(e, n, r) {
  5196. var s = this;
  5197. n === void 0 && (n = Ge.REQUIRED);
  5198. var i = function() {
  5199. return s.dependencyCollection.has(e) && !s.resolvedDependencyCollection.has(e) ? pr : s.resolvedDependencyCollection.get(e, n);
  5200. }, o = function() {
  5201. return s.parent ? s.parent.getValue(e, n) : (Ni(e, n, 0), n === Ge.MANY ? [] : null);
  5202. };
  5203. return r === $t.SKIP_SELF ? o() : e === t ? this : r === $t.SELF || this.resolvedDependencyCollection.has(e) || this.dependencyCollection.has(e) ? i() : o();
  5204. }, t.prototype.createDependency = function(e, n, r, s) {
  5205. var i = this;
  5206. n === void 0 && (n = Ge.REQUIRED), s === void 0 && (s = true);
  5207. var o = function() {
  5208. var u = i.dependencyCollection.get(e, n), c = null;
  5209. return Array.isArray(u) ? c = u.map(function(l) {
  5210. return i._resolveDependency(e, l, s);
  5211. }) : u && (c = i._resolveDependency(e, u, s)), c;
  5212. }, a = function() {
  5213. if (i.parent)
  5214. return i.parent.createDependency(e, n, void 0, s);
  5215. if (n === Ge.OPTIONAL)
  5216. return null;
  5217. throw po(e), new Ur(e);
  5218. };
  5219. return r === $t.SKIP_SELF ? a() : this.dependencyCollection.has(e) ? o() : a();
  5220. }, t.prototype.markNewResolution = function(e) {
  5221. if (this.resolutionOngoing += 1, this.resolutionOngoing >= gf)
  5222. throw new pf(e);
  5223. }, t.prototype.markResolutionCompleted = function() {
  5224. this.resolutionOngoing -= 1;
  5225. }, t.prototype._ensureInjectorNotDisposed = function() {
  5226. if (this.disposed)
  5227. throw new mf();
  5228. }, t;
  5229. }()
  5230. );
  5231. var Co = typeof globalThis < "u" && globalThis || typeof window < "u" && window || typeof global < "u" && global;
  5232. var Ro = "REDI_GLOBAL_LOCK";
  5233. var Rf = typeof process < "u" && process.versions != null && process.versions.node != null;
  5234. Co[Ro] ? Rf || console.error(`[redi]: You are loading scripts of redi more than once! This may cause undesired behavior in your application.
  5235. Maybe your dependencies added redi as its dependency and bundled redi to its dist files. Or you import different versions of redi.
  5236. For more info please visit our website: https://redi.wendell.fun/en-US/docs/debug#import-scripts-of-redi-more-than-once`) : Co[Ro] = true;
  5237. var Io = "REDI_CONTEXT_LOCK";
  5238. var If = typeof process < "u" && process.versions != null && process.versions.node != null;
  5239. var vo = typeof globalThis < "u" && globalThis || typeof window < "u" && window || typeof global < "u" && global;
  5240. vo[Io] ? If || console.error(`[redi]: "RediContext" is already created. You may import "RediContext" from different paths. Use "import { RediContext } from '@wendellhu/redi/react-bindings'; instead."`) : vo[Io] = true;
  5241. var ds = St.createContext({
  5242. injector: null
  5243. });
  5244. ds.displayName = "RediContext";
  5245. var gu = ds.Provider;
  5246. var vf = ds.Consumer;
  5247. var Jr = function() {
  5248. return Jr = Object.assign || function(t) {
  5249. for (var e, n = 1, r = arguments.length; n < r; n++) {
  5250. e = arguments[n];
  5251. for (var s in e)
  5252. Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
  5253. }
  5254. return t;
  5255. }, Jr.apply(this, arguments);
  5256. };
  5257. function yf(t) {
  5258. var e = t.children, n = t.dependencies, r = St.useRef(null);
  5259. return St.useEffect(function() {
  5260. return function() {
  5261. var s;
  5262. return (s = r.current) === null || s === void 0 ? void 0 : s.dispose();
  5263. };
  5264. }, []), St.createElement(vf, null, function(s) {
  5265. var i;
  5266. return r.current ? i = r.current : (i = s.injector ? s.injector.createChild(n) : new Ot(n), r.current = i), St.createElement(gu, { value: { injector: i } }, e);
  5267. });
  5268. }
  5269. function B0(t, e) {
  5270. return function(r) {
  5271. return St.createElement(
  5272. gu,
  5273. { value: { injector: e } },
  5274. St.createElement(t, Jr({}, r))
  5275. );
  5276. };
  5277. }
  5278. function j0(t, e) {
  5279. return function(r) {
  5280. return St.createElement(
  5281. yf,
  5282. { dependencies: e },
  5283. St.createElement(t, Jr({}, r))
  5284. );
  5285. };
  5286. }
  5287. var wf = function() {
  5288. var t = function(e, n) {
  5289. return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
  5290. r.__proto__ = s;
  5291. } || function(r, s) {
  5292. for (var i in s)
  5293. Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
  5294. }, t(e, n);
  5295. };
  5296. return function(e, n) {
  5297. if (typeof n != "function" && n !== null)
  5298. throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
  5299. t(e, n);
  5300. function r() {
  5301. this.constructor = e;
  5302. }
  5303. e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
  5304. };
  5305. }();
  5306. var Of = (
  5307. /** @class */
  5308. function(t) {
  5309. wf(e, t);
  5310. function e(n) {
  5311. return t.call(this, 'You should make "RediContext" as '.concat(n.constructor.name, "'s default context type. ") + "If you want to use multiple context, please check this on React doc site. https://reactjs.org/docs/context.html#classcontexttype") || this;
  5312. }
  5313. return e;
  5314. }(at)
  5315. );
  5316. function H0(t, e, n) {
  5317. return function() {
  5318. return {
  5319. get: function() {
  5320. var r = this, s = r.context;
  5321. if (!s || !s.injector)
  5322. throw new Of(r);
  5323. var i = s.injector, o = i.get(t, e || Ge.REQUIRED, n);
  5324. return o;
  5325. }
  5326. };
  5327. };
  5328. }
  5329. var bf = function() {
  5330. var t = function(e, n) {
  5331. return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
  5332. r.__proto__ = s;
  5333. } || function(r, s) {
  5334. for (var i in s)
  5335. Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
  5336. }, t(e, n);
  5337. };
  5338. return function(e, n) {
  5339. if (typeof n != "function" && n !== null)
  5340. throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
  5341. t(e, n);
  5342. function r() {
  5343. this.constructor = e;
  5344. }
  5345. e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
  5346. };
  5347. }();
  5348. var Sf = (
  5349. /** @class */
  5350. function(t) {
  5351. bf(e, t);
  5352. function e() {
  5353. return t.call(this, "Using dependency injection outside of a RediContext.") || this;
  5354. }
  5355. return e;
  5356. }(at)
  5357. );
  5358. function Af() {
  5359. var t = St.useContext(ds);
  5360. if (!t.injector)
  5361. throw new Sf();
  5362. return t.injector;
  5363. }
  5364. function W0(t, e, n) {
  5365. var r = Af();
  5366. return St.useMemo(function() {
  5367. return r.get(t, e, n);
  5368. }, [t, e, n]);
  5369. }
  5370. var Nf = function(t, e, n) {
  5371. if (n || arguments.length === 2)
  5372. for (var r = 0, s = e.length, i; r < s; r++)
  5373. (i || !(r in e)) && (i || (i = Array.prototype.slice.call(e, 0, r)), i[r] = e[r]);
  5374. return t.concat(i || Array.prototype.slice.call(e));
  5375. };
  5376. function Tf(t, e) {
  5377. var n = t instanceof BehaviorSubject && typeof e > "u" ? t.getValue() : e, r = (0, import_react.useState)(n), s = r[0], i = r[1];
  5378. return (0, import_react.useEffect)(function() {
  5379. var o = t.subscribe(function(a) {
  5380. return i(a);
  5381. });
  5382. return function() {
  5383. return o.unsubscribe();
  5384. };
  5385. }, [t]), s;
  5386. }
  5387. function yo(t) {
  5388. return typeof t == "function" ? t() : t;
  5389. }
  5390. function z0(t, e, n, r) {
  5391. if (typeof t == "function" && !r)
  5392. throw new at("Expected deps to be provided when observable is a function!");
  5393. var s = (0, import_react.useRef)(null), i = (0, import_react.useRef)(false), o = (0, import_react.useMemo)(function() {
  5394. return t;
  5395. }, Nf([], typeof r < "u" ? r : [t], true)), a = (0, import_react.useState)(0);
  5396. a[0];
  5397. var u = a[1], c = (0, import_react.useRef)(function() {
  5398. var l;
  5399. if (o) {
  5400. var h = yo(o).subscribe(function(d) {
  5401. i.current = true, l = d;
  5402. });
  5403. h.unsubscribe();
  5404. }
  5405. return l != null ? l : e;
  5406. }());
  5407. if ((0, import_react.useEffect)(function() {
  5408. var l = null;
  5409. return o && (s.current = yo(o), l = s.current.subscribe(function(h) {
  5410. c.current = h, u(function(d) {
  5411. return d + 1;
  5412. });
  5413. })), function() {
  5414. return l == null ? void 0 : l.unsubscribe();
  5415. };
  5416. }, [o]), n && !i.current)
  5417. throw new Error("Expect `shouldHaveSyncValue` but not getting a sync value!");
  5418. return c.current;
  5419. }
  5420. function Y0(t) {
  5421. var e = (0, import_react.useState)(0), n = e[1];
  5422. (0, import_react.useEffect)(function() {
  5423. var r = t.subscribe(function() {
  5424. return n(function(s) {
  5425. return s + 1;
  5426. });
  5427. });
  5428. return function() {
  5429. return r.unsubscribe();
  5430. };
  5431. }, []);
  5432. }
  5433. var zs = /* @__PURE__ */ new WeakMap();
  5434. function V0(t, e) {
  5435. var n = (0, import_react.useRef)(void 0), r = Tf(t, e), s = (0, import_react.useMemo)(function() {
  5436. return (0, import_react.createContext)(r);
  5437. }, [t]), i = (0, import_react.useCallback)(function(o) {
  5438. return import_react.default.createElement(s.Provider, { value: r }, o.children);
  5439. }, [t, r]);
  5440. return n.current !== t && (n.current && zs.delete(n.current), n.current = t, zs.set(t, s)), {
  5441. Provider: i,
  5442. value: r
  5443. };
  5444. }
  5445. function G0(t) {
  5446. var e = zs.get(t);
  5447. if (!e)
  5448. throw new at("try to read context value but no ancestor component subscribed it.");
  5449. return (0, import_react.useContext)(e);
  5450. }
  5451. function K0(t, e) {
  5452. e.forEach((n) => t.add(n));
  5453. }
  5454. function Mf(t, e) {
  5455. e.forEach(([n]) => {
  5456. t.has(n) && t.get(n);
  5457. });
  5458. }
  5459. function Df(t, e) {
  5460. if (Object.is(t, e))
  5461. return true;
  5462. if (typeof t != "object" || !t || typeof e != "object" || !e)
  5463. return false;
  5464. const n = Object.keys(t), r = Object.keys(e);
  5465. if (n.length !== r.length)
  5466. return false;
  5467. const s = Object.prototype.hasOwnProperty.bind(e);
  5468. for (let i = 0; i < n.length; i++) {
  5469. const o = n[i];
  5470. if (!s(o))
  5471. return false;
  5472. const a = t[o], u = e[o];
  5473. if (a !== u)
  5474. return false;
  5475. }
  5476. return true;
  5477. }
  5478. var wo = class extends Error {
  5479. constructor(e) {
  5480. super(e), this.name = "CustomCommandExecutionError";
  5481. }
  5482. };
  5483. var xf = class extends Error {
  5484. constructor() {
  5485. super("Canceled by facade"), this.name = "CanceledError";
  5486. }
  5487. };
  5488. async function Lf(t) {
  5489. for (const [e, n] of t.entries())
  5490. try {
  5491. if (!await n())
  5492. return {
  5493. index: e,
  5494. result: false
  5495. };
  5496. } catch (r) {
  5497. return {
  5498. index: e,
  5499. result: false,
  5500. error: r
  5501. };
  5502. }
  5503. return {
  5504. result: true,
  5505. index: -1
  5506. };
  5507. }
  5508. function Uf(t) {
  5509. for (const [e, n] of t.entries())
  5510. try {
  5511. if (!n())
  5512. return {
  5513. index: e,
  5514. result: false
  5515. };
  5516. } catch (r) {
  5517. return {
  5518. index: e,
  5519. result: false,
  5520. error: r
  5521. };
  5522. }
  5523. return {
  5524. result: true,
  5525. index: -1
  5526. };
  5527. }
  5528. function Oo(t) {
  5529. var e = typeof Symbol == "function" && Symbol.iterator, n = e && t[e], r = 0;
  5530. if (n)
  5531. return n.call(t);
  5532. if (t && typeof t.length == "number")
  5533. return {
  5534. next: function() {
  5535. return t && r >= t.length && (t = void 0), { value: t && t[r++], done: !t };
  5536. }
  5537. };
  5538. throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
  5539. }
  5540. function bo(t, e) {
  5541. var n = typeof Symbol == "function" && t[Symbol.iterator];
  5542. if (!n)
  5543. return t;
  5544. var r = n.call(t), s, i = [], o;
  5545. try {
  5546. for (; (e === void 0 || e-- > 0) && !(s = r.next()).done; )
  5547. i.push(s.value);
  5548. } catch (a) {
  5549. o = { error: a };
  5550. } finally {
  5551. try {
  5552. s && !s.done && (n = r.return) && n.call(r);
  5553. } finally {
  5554. if (o)
  5555. throw o.error;
  5556. }
  5557. }
  5558. return i;
  5559. }
  5560. function So(t, e, n) {
  5561. if (n || arguments.length === 2)
  5562. for (var r = 0, s = e.length, i; r < s; r++)
  5563. (i || !(r in e)) && (i || (i = Array.prototype.slice.call(e, 0, r)), i[r] = e[r]);
  5564. return t.concat(i || Array.prototype.slice.call(e));
  5565. }
  5566. function Zn(t) {
  5567. return typeof t == "function";
  5568. }
  5569. function Pf(t) {
  5570. var e = function(r) {
  5571. Error.call(r), r.stack = new Error().stack;
  5572. }, n = t(e);
  5573. return n.prototype = Object.create(Error.prototype), n.prototype.constructor = n, n;
  5574. }
  5575. var ws = Pf(function(t) {
  5576. return function(n) {
  5577. t(this), this.message = n ? n.length + ` errors occurred during unsubscription:
  5578. ` + n.map(function(r, s) {
  5579. return s + 1 + ") " + r.toString();
  5580. }).join(`
  5581. `) : "", this.name = "UnsubscriptionError", this.errors = n;
  5582. };
  5583. });
  5584. function Ao(t, e) {
  5585. if (t) {
  5586. var n = t.indexOf(e);
  5587. 0 <= n && t.splice(n, 1);
  5588. }
  5589. }
  5590. var pu = function() {
  5591. function t(e) {
  5592. this.initialTeardown = e, this.closed = false, this._parentage = null, this._finalizers = null;
  5593. }
  5594. return t.prototype.unsubscribe = function() {
  5595. var e, n, r, s, i;
  5596. if (!this.closed) {
  5597. this.closed = true;
  5598. var o = this._parentage;
  5599. if (o)
  5600. if (this._parentage = null, Array.isArray(o))
  5601. try {
  5602. for (var a = Oo(o), u = a.next(); !u.done; u = a.next()) {
  5603. var c = u.value;
  5604. c.remove(this);
  5605. }
  5606. } catch (R) {
  5607. e = { error: R };
  5608. } finally {
  5609. try {
  5610. u && !u.done && (n = a.return) && n.call(a);
  5611. } finally {
  5612. if (e)
  5613. throw e.error;
  5614. }
  5615. }
  5616. else
  5617. o.remove(this);
  5618. var l = this.initialTeardown;
  5619. if (Zn(l))
  5620. try {
  5621. l();
  5622. } catch (R) {
  5623. i = R instanceof ws ? R.errors : [R];
  5624. }
  5625. var h = this._finalizers;
  5626. if (h) {
  5627. this._finalizers = null;
  5628. try {
  5629. for (var d = Oo(h), f = d.next(); !f.done; f = d.next()) {
  5630. var E = f.value;
  5631. try {
  5632. No(E);
  5633. } catch (R) {
  5634. i = i != null ? i : [], R instanceof ws ? i = So(So([], bo(i)), bo(R.errors)) : i.push(R);
  5635. }
  5636. }
  5637. } catch (R) {
  5638. r = { error: R };
  5639. } finally {
  5640. try {
  5641. f && !f.done && (s = d.return) && s.call(d);
  5642. } finally {
  5643. if (r)
  5644. throw r.error;
  5645. }
  5646. }
  5647. }
  5648. if (i)
  5649. throw new ws(i);
  5650. }
  5651. }, t.prototype.add = function(e) {
  5652. var n;
  5653. if (e && e !== this)
  5654. if (this.closed)
  5655. No(e);
  5656. else {
  5657. if (e instanceof t) {
  5658. if (e.closed || e._hasParent(this))
  5659. return;
  5660. e._addParent(this);
  5661. }
  5662. (this._finalizers = (n = this._finalizers) !== null && n !== void 0 ? n : []).push(e);
  5663. }
  5664. }, t.prototype._hasParent = function(e) {
  5665. var n = this._parentage;
  5666. return n === e || Array.isArray(n) && n.includes(e);
  5667. }, t.prototype._addParent = function(e) {
  5668. var n = this._parentage;
  5669. this._parentage = Array.isArray(n) ? (n.push(e), n) : n ? [n, e] : e;
  5670. }, t.prototype._removeParent = function(e) {
  5671. var n = this._parentage;
  5672. n === e ? this._parentage = null : Array.isArray(n) && Ao(n, e);
  5673. }, t.prototype.remove = function(e) {
  5674. var n = this._finalizers;
  5675. n && Ao(n, e), e instanceof t && e._removeParent(this);
  5676. }, t.EMPTY = function() {
  5677. var e = new t();
  5678. return e.closed = true, e;
  5679. }(), t;
  5680. }();
  5681. pu.EMPTY;
  5682. function kf(t) {
  5683. return t instanceof pu || t && "closed" in t && Zn(t.remove) && Zn(t.add) && Zn(t.unsubscribe);
  5684. }
  5685. function No(t) {
  5686. Zn(t) ? t() : t.unsubscribe();
  5687. }
  5688. function Ze(t) {
  5689. let e = false;
  5690. return t ? kf(t) ? {
  5691. dispose: () => t.unsubscribe()
  5692. } : typeof t == "function" ? {
  5693. dispose: () => {
  5694. e || (e = true, t());
  5695. }
  5696. } : t : Ze(() => {
  5697. });
  5698. }
  5699. function X0(t) {
  5700. return Ze(() => {
  5701. t.unsubscribe();
  5702. });
  5703. }
  5704. var Mi = class {
  5705. constructor() {
  5706. C(this, "_disposables", /* @__PURE__ */ new Set());
  5707. }
  5708. add(e) {
  5709. const n = Ze(e);
  5710. return this._disposables.add(n), {
  5711. dispose: (r = false) => {
  5712. r || n.dispose(), this._disposables.delete(n);
  5713. }
  5714. };
  5715. }
  5716. dispose() {
  5717. this._disposables.forEach((e) => {
  5718. e.dispose();
  5719. }), this._disposables.clear();
  5720. }
  5721. };
  5722. var nt = class {
  5723. constructor() {
  5724. C(this, "_disposed", false);
  5725. C(this, "_collection", new Mi());
  5726. }
  5727. disposeWithMe(e) {
  5728. return this._collection.add(e);
  5729. }
  5730. ensureNotDisposed() {
  5731. if (this._disposed)
  5732. throw new Error("[Disposable]: object is disposed!");
  5733. }
  5734. dispose() {
  5735. this._disposed || (this._disposed = true, this._collection.dispose());
  5736. }
  5737. };
  5738. var J0 = class extends nt {
  5739. constructor() {
  5740. super(...arguments);
  5741. C(this, "dispose$", new Subject());
  5742. }
  5743. dispose() {
  5744. super.dispose(), this.dispose$.next(), this.dispose$.complete();
  5745. }
  5746. };
  5747. var Z0 = class extends nt {
  5748. constructor(n) {
  5749. super();
  5750. C(this, "_ref", 0);
  5751. this._rootDisposable = n;
  5752. }
  5753. inc() {
  5754. if (this._disposed)
  5755. throw new Error("[RCDisposable]: should not ref to a disposed.");
  5756. this._ref += 1;
  5757. }
  5758. dec() {
  5759. this._ref -= 1, this._ref === 0 && (this._rootDisposable.dispose(), this.dispose());
  5760. }
  5761. };
  5762. var fs = Ct("univer.context-service");
  5763. var Ff = class extends nt {
  5764. constructor() {
  5765. super(...arguments);
  5766. C(this, "_contextChanged$", new Subject());
  5767. C(this, "contextChanged$", this._contextChanged$.asObservable());
  5768. C(this, "_contextMap", /* @__PURE__ */ new Map());
  5769. }
  5770. dispose() {
  5771. super.dispose(), this._contextChanged$.complete();
  5772. }
  5773. getContextValue(n) {
  5774. var r;
  5775. return (r = this._contextMap.get(n)) != null ? r : false;
  5776. }
  5777. setContextValue(n, r) {
  5778. this._contextMap.set(n, r), this._contextChanged$.next({ [n]: r });
  5779. }
  5780. subscribeContextValue$(n) {
  5781. return new Observable((r) => {
  5782. const s = this._contextChanged$.pipe(filter((i) => typeof i[n] < "u")).subscribe((i) => r.next(i[n]));
  5783. return this._contextMap.has(n) && r.next(this._contextMap.get(n)), () => s.unsubscribe();
  5784. });
  5785. }
  5786. };
  5787. var $f = ((t) => (t[t.SILENT = 0] = "SILENT", t[t.ERROR = 1] = "ERROR", t[t.WARN = 2] = "WARN", t[t.INFO = 3] = "INFO", t[t.VERBOSE = 4] = "VERBOSE", t))($f || {});
  5788. var Mt = Ct("univer.log");
  5789. var Bf = class extends nt {
  5790. constructor() {
  5791. super(...arguments);
  5792. C(this, "_logLevel", 3);
  5793. }
  5794. debug(...n) {
  5795. this._logLevel >= 4 && this._log(console.debug, ...n);
  5796. }
  5797. log(...n) {
  5798. this._logLevel >= 3 && this._log(console.log, ...n);
  5799. }
  5800. warn(...n) {
  5801. this._logLevel >= 2 && this._log(console.warn, ...n);
  5802. }
  5803. error(...n) {
  5804. this._logLevel >= 1 && this._log(console.error, ...n);
  5805. }
  5806. setLogLevel(n) {
  5807. this._logLevel = n;
  5808. }
  5809. _log(n, ...r) {
  5810. const s = r[0];
  5811. /^\[(.*?)\]/g.test(s) ? n(`\x1B[97;104m${s}\x1B[0m`, ...r.slice(1)) : n(...r);
  5812. }
  5813. };
  5814. var jf = Object.defineProperty;
  5815. var Hf = Object.getOwnPropertyDescriptor;
  5816. var Wf = (t, e, n, r) => {
  5817. for (var s = r > 1 ? void 0 : r ? Hf(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  5818. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  5819. return r && s && jf(e, n, s), s;
  5820. };
  5821. var To = (t, e) => (n, r) => e(n, r, t);
  5822. var ar = ((t) => (t[t.COMMAND = 0] = "COMMAND", t[t.OPERATION = 1] = "OPERATION", t[t.MUTATION = 2] = "MUTATION", t))(ar || {});
  5823. var Pt = Ct("anywhere.command-service");
  5824. var zf = class {
  5825. constructor() {
  5826. C(this, "_commands", /* @__PURE__ */ new Map());
  5827. C(this, "_commandTypes", /* @__PURE__ */ new Map());
  5828. }
  5829. registerCommand(e) {
  5830. if (this._commands.has(e.id))
  5831. throw new Error(`[CommandRegistry]: command "${e.id}" has been registered before.`);
  5832. return this._commands.set(e.id, e), this._commandTypes.set(e.id, e.type), Ze(() => {
  5833. this._commands.delete(e.id), this._commandTypes.delete(e.id);
  5834. });
  5835. }
  5836. hasCommand(e) {
  5837. return this._commands.has(e);
  5838. }
  5839. getCommand(e) {
  5840. return this._commands.has(e) ? [this._commands.get(e)] : null;
  5841. }
  5842. getCommandType(e) {
  5843. return this._commandTypes.get(e);
  5844. }
  5845. };
  5846. var Yf = {
  5847. id: "nil",
  5848. type: 0,
  5849. handler: () => true
  5850. };
  5851. var Ys = class extends nt {
  5852. constructor(e, n) {
  5853. super();
  5854. C(this, "_commandRegistry");
  5855. C(this, "_beforeCommandExecutionListeners", []);
  5856. C(this, "_commandExecutedListeners", []);
  5857. C(this, "_multiCommandDisposables", /* @__PURE__ */ new Map());
  5858. C(this, "_commandExecutingLevel", 0);
  5859. C(this, "_commandExecutionStack", []);
  5860. this._injector = e, this._logService = n, this._commandRegistry = new zf(), this._registerCommand(Yf);
  5861. }
  5862. dispose() {
  5863. super.dispose(), this._commandExecutedListeners.length = 0, this._beforeCommandExecutionListeners.length = 0;
  5864. }
  5865. hasCommand(e) {
  5866. return this._commandRegistry.hasCommand(e);
  5867. }
  5868. registerCommand(e) {
  5869. return this._registerCommand(e);
  5870. }
  5871. registerMultipleCommand(e) {
  5872. return this._registerMultiCommand(e);
  5873. }
  5874. beforeCommandExecuted(e) {
  5875. if (this._beforeCommandExecutionListeners.indexOf(e) === -1)
  5876. return this._beforeCommandExecutionListeners.push(e), Ze(() => {
  5877. const n = this._beforeCommandExecutionListeners.indexOf(e);
  5878. this._beforeCommandExecutionListeners.splice(n, 1);
  5879. });
  5880. throw new Error("[CommandService]: could not add a listener twice.");
  5881. }
  5882. onCommandExecuted(e) {
  5883. if (this._commandExecutedListeners.indexOf(e) === -1)
  5884. return this._commandExecutedListeners.push(e), Ze(() => {
  5885. const n = this._commandExecutedListeners.indexOf(e);
  5886. this._commandExecutedListeners.splice(n, 1);
  5887. });
  5888. throw new Error("[CommandService]: could not add a listener twice.");
  5889. }
  5890. async executeCommand(e, n, r) {
  5891. try {
  5892. const s = this._commandRegistry.getCommand(e);
  5893. if (s) {
  5894. const [i] = s, o = {
  5895. id: i.id,
  5896. type: i.type,
  5897. params: n
  5898. }, a = this._pushCommandExecutionStack(o);
  5899. this._beforeCommandExecutionListeners.forEach((c) => c(o, r));
  5900. const u = await this._execute(i, n, r);
  5901. return this._commandExecutedListeners.forEach((c) => c(o, r)), a.dispose(), u;
  5902. }
  5903. throw new Error(`[CommandService]: command "${e}" is not registered.`);
  5904. } catch (s) {
  5905. if (s instanceof wo)
  5906. return false;
  5907. throw s;
  5908. }
  5909. }
  5910. syncExecuteCommand(e, n, r) {
  5911. var s;
  5912. try {
  5913. const i = this._commandRegistry.getCommand(e);
  5914. if (i) {
  5915. const [o] = i, a = {
  5916. id: o.id,
  5917. type: o.type,
  5918. params: n
  5919. };
  5920. if (o.type === 2) {
  5921. const l = jd(
  5922. this._commandExecutionStack,
  5923. (h) => h.type === 0
  5924. /* COMMAND */
  5925. );
  5926. l && (a.params = (s = a.params) != null ? s : {}, a.params.trigger = l.id);
  5927. }
  5928. const u = this._pushCommandExecutionStack(a);
  5929. this._beforeCommandExecutionListeners.forEach((l) => l(a, r));
  5930. const c = this._syncExecute(o, n, r);
  5931. return this._commandExecutedListeners.forEach((l) => l(a, r)), u.dispose(), c;
  5932. }
  5933. throw new Error(`[CommandService]: command "${e}" is not registered.`);
  5934. } catch (i) {
  5935. if (i instanceof wo)
  5936. return false;
  5937. throw i;
  5938. }
  5939. }
  5940. _pushCommandExecutionStack(e) {
  5941. return this._commandExecutionStack.push(e), Ze(() => cs(this._commandExecutionStack, e));
  5942. }
  5943. _registerCommand(e) {
  5944. return this._commandRegistry.registerCommand(e);
  5945. }
  5946. _registerMultiCommand(e) {
  5947. const n = this._commandRegistry.getCommand(e.id);
  5948. let r;
  5949. if (n) {
  5950. if (n[0].multi !== true)
  5951. throw new Error("Command has registered as a single command.");
  5952. r = n[0];
  5953. } else {
  5954. const i = new Mi();
  5955. r = new Vf(e.id), i.add(this._commandRegistry.registerCommand(r)), i.add(
  5956. Ze(() => {
  5957. this._multiCommandDisposables.delete(e.id);
  5958. })
  5959. ), this._multiCommandDisposables.set(e.id, i);
  5960. }
  5961. const s = r.registerImplementation(e);
  5962. return Ze(() => {
  5963. var i;
  5964. s.dispose(), r.hasImplementations() || (i = this._multiCommandDisposables.get(e.id)) == null || i.dispose();
  5965. });
  5966. }
  5967. async _execute(e, n, r) {
  5968. this._logService.debug(
  5969. "[CommandService]",
  5970. `${"|-".repeat(Math.max(this._commandExecutingLevel, 0))}executing command "${e.id}"`
  5971. ), this._commandExecutingLevel++;
  5972. let s;
  5973. try {
  5974. s = await this._injector.invoke(e.handler, n, r), this._commandExecutingLevel--;
  5975. } catch (i) {
  5976. throw s = false, this._commandExecutingLevel = 0, i;
  5977. }
  5978. return s;
  5979. }
  5980. _syncExecute(e, n, r) {
  5981. this._logService.debug(
  5982. "[CommandService]",
  5983. `${"|-".repeat(Math.max(0, this._commandExecutingLevel))}executing command "${e.id}".`
  5984. ), this._commandExecutingLevel++;
  5985. let s;
  5986. try {
  5987. if (s = this._injector.invoke(e.handler, n, r), s instanceof Promise)
  5988. throw new TypeError("[CommandService]: Command handler should not return a promise.");
  5989. this._commandExecutingLevel--;
  5990. } catch (i) {
  5991. throw s = false, this._commandExecutingLevel = 0, i;
  5992. }
  5993. return s;
  5994. }
  5995. };
  5996. Ys = Wf([
  5997. To(0, ot(Ot)),
  5998. To(1, Mt)
  5999. ], Ys);
  6000. var Vf = class {
  6001. constructor(e) {
  6002. C(this, "name");
  6003. C(this, "multi", true);
  6004. C(this, "type", 0);
  6005. C(this, "priority", 0);
  6006. C(this, "_implementations", []);
  6007. C(this, "handler", async (e2, n) => {
  6008. if (!this._implementations.length)
  6009. return false;
  6010. const r = e2.get(Mt), s = e2.get(fs), i = e2.get(Ot);
  6011. for (const o of this._implementations) {
  6012. const a = o.command.preconditions;
  6013. if ((!a || a && a(s)) && (r.debug("[MultiCommand]", `executing implementation "${o.command.name}".`), await i.invoke(o.command.handler, n)))
  6014. return true;
  6015. }
  6016. return false;
  6017. });
  6018. this.id = e, this.name = e;
  6019. }
  6020. registerImplementation(e) {
  6021. const n = { command: e };
  6022. return this._implementations.push(n), this._implementations.sort((r, s) => s.command.priority - r.command.priority), Ze(() => {
  6023. const r = this._implementations.indexOf(n);
  6024. this._implementations.splice(r, 1);
  6025. });
  6026. }
  6027. hasImplementations() {
  6028. return this._implementations.length > 0;
  6029. }
  6030. };
  6031. function mu(t, e, n) {
  6032. const r = t.map((s) => () => e.syncExecuteCommand(s.id, s.params, n));
  6033. return Uf(r);
  6034. }
  6035. function Q0(t, e, n) {
  6036. const r = t.map((s) => () => e.executeCommand(s.id, s.params, n));
  6037. return Lf(r);
  6038. }
  6039. function Gf(t) {
  6040. return new Observable((e) => {
  6041. const n = t((...r) => e.next(r));
  6042. return () => n == null ? void 0 : n.dispose();
  6043. });
  6044. }
  6045. function Kf(t) {
  6046. return function(n) {
  6047. return new Observable((r) => (n.subscribe({
  6048. next: (s) => {
  6049. r.next(s), t(s) && r.complete();
  6050. },
  6051. complete: () => r.complete(),
  6052. error: (s) => r.error(s)
  6053. }), () => r.unsubscribe()));
  6054. };
  6055. }
  6056. function q0(t = 0) {
  6057. return (e) => {
  6058. let n = [];
  6059. return e.pipe(
  6060. tap((r) => n.push(r)),
  6061. debounceTime(t),
  6062. map(() => n),
  6063. tap(() => n = [])
  6064. );
  6065. };
  6066. }
  6067. function eC(t) {
  6068. const e = new ReplaySubject(1);
  6069. return setTimeout(() => e.next(), t), e.pipe(take(1));
  6070. }
  6071. var tC = (t) => new Promise((e) => {
  6072. merge(
  6073. Gf(t.onCommandExecuted.bind(t)).pipe(filter(([n]) => n.type === ar.MUTATION)),
  6074. timer(300)
  6075. ).pipe(debounceTime(16), first()).subscribe(() => {
  6076. e();
  6077. });
  6078. });
  6079. function Xf(t, e) {
  6080. let n = 0, r = t.length - 1;
  6081. if (e < t[0])
  6082. return 0;
  6083. if (e >= t[t.length - 1])
  6084. return t.length - 1;
  6085. for (; n <= r; ) {
  6086. if (t[n] === e) {
  6087. for (; n < t.length && t[n] === e; )
  6088. n++;
  6089. return n;
  6090. }
  6091. if (e > t[n] && e < t[n + 1])
  6092. return n + 1;
  6093. if (t[r] === e) {
  6094. for (; r < t.length && t[r] === e; )
  6095. r++;
  6096. return r;
  6097. }
  6098. if (e > t[r - 1] && e < t[r])
  6099. return r;
  6100. n++, r--;
  6101. }
  6102. return -1;
  6103. }
  6104. function nC(t, e) {
  6105. let n = 0, r = t.length - 1;
  6106. for (; n <= r; ) {
  6107. const s = Math.floor((r + n) / 2);
  6108. if (e < t[s] && (s === 0 || e >= t[s - 1]))
  6109. return s;
  6110. if (e >= t[s])
  6111. n = s + 1;
  6112. else if (e < t[s])
  6113. r = s - 1;
  6114. else
  6115. return -1;
  6116. }
  6117. return -1;
  6118. }
  6119. function Jf(t, e) {
  6120. let n = 0, r = t.length;
  6121. for (; n < r; ) {
  6122. const s = Math.floor((n + r) / 2);
  6123. t[s] <= e ? n = s + 1 : r = s;
  6124. }
  6125. return n < t.length ? n : t.length - 1;
  6126. }
  6127. function rC(t, e, n = false) {
  6128. let r = t.length - 1;
  6129. if (e < 0 || e < t[0])
  6130. return 0;
  6131. if (t.length < 40 || e <= t[20] || e >= t[r - 20] ? r = Xf(t, e) : r = Jf(t, e), n) {
  6132. const s = t[r];
  6133. return t.indexOf(s);
  6134. }
  6135. return r;
  6136. }
  6137. function sC(t) {
  6138. const e = new Blob([t], { type: "text/javascript" });
  6139. return window.URL.createObjectURL(e);
  6140. }
  6141. var mr = 2;
  6142. var Zf = 1;
  6143. function iC(t, e) {
  6144. if (e == null || t == null)
  6145. return true;
  6146. const { left: n = 0, top: r = 0, height: s = 0, width: i = 0, angle: o = 0 } = e, { left: a = 0, top: u = 0, height: c = 0, width: l = 0, angle: h = 0 } = t, d = l, f = c, E = i, R = s;
  6147. return Math.abs(a - n) > mr || Math.abs(u - r) > mr || Math.abs(d - E) > mr || Math.abs(f - R) > mr || Math.abs(h - o) > Zf;
  6148. }
  6149. var _u = ((t) => (t[t.DEFAULT_SERIES = 0] = "DEFAULT_SERIES", t[t.ALTERNATE_SERIES = 1] = "ALTERNATE_SERIES", t))(_u || {});
  6150. var Xe = ((t) => (t[t.NONE = 0] = "NONE", t[t.THIN = 1] = "THIN", t[t.HAIR = 2] = "HAIR", t[t.DOTTED = 3] = "DOTTED", t[t.DASHED = 4] = "DASHED", t[t.DASH_DOT = 5] = "DASH_DOT", t[t.DASH_DOT_DOT = 6] = "DASH_DOT_DOT", t[t.DOUBLE = 7] = "DOUBLE", t[t.MEDIUM = 8] = "MEDIUM", t[t.MEDIUM_DASHED = 9] = "MEDIUM_DASHED", t[t.MEDIUM_DASH_DOT = 10] = "MEDIUM_DASH_DOT", t[t.MEDIUM_DASH_DOT_DOT = 11] = "MEDIUM_DASH_DOT_DOT", t[t.SLANT_DASH_DOT = 12] = "SLANT_DASH_DOT", t[t.THICK = 13] = "THICK", t))(Xe || {});
  6151. var Eu = ((t) => (t.TOP = "top", t.BOTTOM = "bottom", t.LEFT = "left", t.RIGHT = "right", t.NONE = "none", t.ALL = "all", t.OUTSIDE = "outside", t.INSIDE = "inside", t.HORIZONTAL = "horizontal", t.VERTICAL = "vertical", t.TLBR = "tlbr", t.TLBC_TLMR = "tlbc_tlmr", t.TLBR_TLBC_TLMR = "tlbr_tlbc_tlmr", t.BLTR = "bl_tr", t.MLTR_BCTR = "mltr_bctr", t))(Eu || {});
  6152. var vt = ((t) => (t[t.UNSUPPORTED = 0] = "UNSUPPORTED", t[t.RGB = 1] = "RGB", t[t.HEX = 2] = "HEX", t[t.THEME = 3] = "THEME", t))(vt || {});
  6153. var Cu = ((t) => (t[t.ON = 0] = "ON", t[t.OFF = 1] = "OFF", t))(Cu || {});
  6154. var Ru = ((t) => (t[t.PASTE_NORMAL = 0] = "PASTE_NORMAL", t[t.PASTE_NO_BORDERS = 1] = "PASTE_NO_BORDERS", t[t.PASTE_FORMAT = 2] = "PASTE_FORMAT", t[t.PASTE_FORMULA = 3] = "PASTE_FORMULA", t[t.PASTE_DATA_VALIDATION = 4] = "PASTE_DATA_VALIDATION", t[t.PASTE_VALUES = 5] = "PASTE_VALUES", t[t.PASTE_CONDITIONAL_FORMATTING = 6] = "PASTE_CONDITIONAL_FORMATTING", t[t.PASTE_COLUMN_WIDTHS = 7] = "PASTE_COLUMN_WIDTHS", t))(Ru || {});
  6155. var Iu = ((t) => (t[t.LEFT = 0] = "LEFT", t[t.RIGHT = 1] = "RIGHT", t))(Iu || {});
  6156. var vu = ((t) => (t[t.DOCUMENT = 0] = "DOCUMENT", t[t.PROJECT = 1] = "PROJECT", t))(vu || {});
  6157. var yu = ((t) => (t[t.COLUMNS = 0] = "COLUMNS", t[t.ROWS = 1] = "ROWS", t))(yu || {});
  6158. var wu = ((t) => (t[t.UP = 0] = "UP", t[t.RIGHT = 1] = "RIGHT", t[t.DOWN = 2] = "DOWN", t[t.LEFT = 3] = "LEFT", t))(wu || {});
  6159. function oC(t) {
  6160. switch (t) {
  6161. case 3:
  6162. return 1;
  6163. case 1:
  6164. return 3;
  6165. case 0:
  6166. return 2;
  6167. case 2:
  6168. return 0;
  6169. }
  6170. }
  6171. var Ou = ((t) => (t[t.INTERPOLATION_POINT_TYPE_UNSPECIFIED = 0] = "INTERPOLATION_POINT_TYPE_UNSPECIFIED", t[t.MIN = 1] = "MIN", t[t.MAX = 2] = "MAX", t[t.NUMBER = 3] = "NUMBER", t[t.PERCENT = 4] = "PERCENT", t[t.PERCENTILE = 5] = "PERCENTILE", t))(Ou || {});
  6172. var ur = ((t) => (t.EN_US = "enUS", t.FR_FR = "frFR", t.ZH_CN = "zhCN", t.RU_RU = "ruRU", t.ZH_TW = "zhTW", t.VI_VN = "viVN", t.FA_IR = "faIR", t))(ur || {});
  6173. var Zr = ((t) => (t[t.PERSON = 0] = "PERSON", t[t.FILE = 1] = "FILE", t[t.DATE = 2] = "DATE", t[t.LOCATION = 3] = "LOCATION", t[t.EVENT = 4] = "EVENT", t))(Zr || {});
  6174. var bu = ((t) => (t[t.RANGE = 0] = "RANGE", t[t.SHEET = 1] = "SHEET", t))(bu || {});
  6175. var Qf = ((t) => (t.Line = "line", t.LineInv = "lineInv", t.Triangle = "triangle", t.RtTriangle = "rtTriangle", t.Rect = "rect", t.Diamond = "diamond", t.Parallelogram = "parallelogram", t.Trapezoid = "trapezoid", t.NonIsocelesTrapezoid = "nonIsocelesTrapezoid", t.Pentagon = "pentagon", t.Hexagon = "hexagon", t.Heptagon = "heptagon", t.Octagon = "octagon", t.Decagon = "decagon", t.Dodecagon = "dodecagon", t.Star4 = "star4", t.Star5 = "star5", t.Star6 = "star6", t.Star7 = "star7", t.Star8 = "star8", t.Star10 = "star10", t.Star12 = "star12", t.Star16 = "star16", t.Star24 = "star24", t.Star32 = "star32", t.RoundRect = "roundRect", t.Round1Rect = "round1Rect", t.Round2SameRect = "round2SameRect", t.Round2DiagRect = "round2DiagRect", t.Ellipse = "ellipse", t))(Qf || {});
  6176. var qf = ((t) => (t.RightArrow = "rightArrow", t.LeftArrow = "leftArrow", t.UpArrow = "upArrow", t.DownArrow = "downArrow", t.LeftRightArrow = "leftRightArrow", t.UpDownArrow = "upDownArrow", t.QuadArrow = "quadArrow", t.LeftRightUpArrow = "leftRightUpArrow", t.BentArrow = "bentArrow", t.UturnArrow = "uturnArrow", t.CircularArrow = "circularArrow", t.NotchedRightArrow = "notchedRightArrow", t.HomePlate = "homePlate", t.Chevron = "chevron", t.LeftCircularArrow = "leftCircularArrow", t.LeftRightCircularArrow = "leftRightCircularArrow", t))(qf || {});
  6177. var eg = ((t) => (t.Plaque = "plaque", t.Can = "can", t.Cube = "cube", t.Bevel = "bevel", t.Donut = "donut", t.NoSmoking = "noSmoking", t.BlockArc = "blockArc", t.FoldedCorner = "foldedCorner", t))(eg || {});
  6178. var tg = ((t) => (t.SmileyFace = "smileyFace", t.Heart = "heart", t.LightningBolt = "lightningBolt", t.Sun = "sun", t.Moon = "moon", t.Cloud = "cloud", t.Arc = "arc", t.Backpack = "backpack", t.Frame = "frame", t.HalfFrame = "halfFrame", t.Corner = "corner", t.Chord = "chord", t.Pie = "pie", t.Teardrop = "teardrop", t.WedgeRectCallout = "wedgeRectCallout", t.WedgeRRectCallout = "wedgeRRectCallout", t.WedgeEllipseCallout = "wedgeEllipseCallout", t.CloudCallout = "cloudCallout", t.BorderCallout1 = "borderCallout1", t.BorderCallout2 = "borderCallout2", t.BorderCallout3 = "borderCallout3", t.AccentCallout1 = "accentCallout1", t.AccentCallout2 = "accentCallout2", t.AccentCallout3 = "accentCallout3", t.Callout1 = "callout1", t.Callout2 = "callout2", t.Callout3 = "callout3", t.ActionButtonBackPrevious = "actionButtonBackPrevious", t.ActionButtonEnd = "actionButtonEnd", t.ActionButtonForwardNext = "actionButtonForwardNext", t.ActionButtonHelp = "actionButtonHelp", t.ActionButtonHome = "actionButtonHome", t.ActionButtonInformation = "actionButtonInformation", t.ActionButtonMovie = "actionButtonMovie", t.ActionButtonReturn = "actionButtonReturn", t.ActionButtonSound = "actionButtonSound", t))(tg || {});
  6179. var Su = ((t) => (t[t.RELATIVE_DATE_UNSPECIFIED = 0] = "RELATIVE_DATE_UNSPECIFIED", t[t.PAST_YEAR = 1] = "PAST_YEAR", t[t.PAST_MONTH = 2] = "PAST_MONTH", t[t.PAST_WEEK = 3] = "PAST_WEEK", t[t.YESTERDAY = 4] = "YESTERDAY", t[t.TODAY = 5] = "TODAY", t[t.TOMORROW = 6] = "TOMORROW", t))(Su || {});
  6180. var Au = ((t) => (t[t.GRID = 0] = "GRID", t[t.KANBAN = 1] = "KANBAN", t[t.GANTT = 2] = "GANTT", t))(Au || {});
  6181. var er = ((t) => (t[t.UNSPECIFIED = 0] = "UNSPECIFIED", t[t.LEFT_TO_RIGHT = 1] = "LEFT_TO_RIGHT", t[t.RIGHT_TO_LEFT = 2] = "RIGHT_TO_LEFT", t))(er || {});
  6182. var Nu = ((t) => (t[t.DASH = 0] = "DASH", t[t.DASH_DOT_DOT_HEAVY = 1] = "DASH_DOT_DOT_HEAVY", t[t.DASH_DOT_HEAVY = 2] = "DASH_DOT_HEAVY", t[t.DASHED_HEAVY = 3] = "DASHED_HEAVY", t[t.DASH_LONG = 4] = "DASH_LONG", t[t.DASH_LONG_HEAVY = 5] = "DASH_LONG_HEAVY", t[t.DOT_DASH = 6] = "DOT_DASH", t[t.DOT_DOT_DASH = 7] = "DOT_DOT_DASH", t[t.DOTTED = 8] = "DOTTED", t[t.DOTTED_HEAVY = 9] = "DOTTED_HEAVY", t[t.DOUBLE = 10] = "DOUBLE", t[t.NONE = 11] = "NONE", t[t.SINGLE = 12] = "SINGLE", t[t.THICK = 13] = "THICK", t[t.WAVE = 14] = "WAVE", t[t.WAVY_DOUBLE = 15] = "WAVY_DOUBLE", t[t.WAVY_HEAVY = 16] = "WAVY_HEAVY", t[t.WORDS = 17] = "WORDS", t))(Nu || {});
  6183. var Xt = ((t) => (t[t.UNSPECIFIED = 0] = "UNSPECIFIED", t[t.LEFT = 1] = "LEFT", t[t.CENTER = 2] = "CENTER", t[t.RIGHT = 3] = "RIGHT", t[t.JUSTIFIED = 4] = "JUSTIFIED", t[t.BOTH = 5] = "BOTH", t[t.DISTRIBUTED = 6] = "DISTRIBUTED", t))(Xt || {});
  6184. var hn = ((t) => (t[t.UNSPECIFIED = 0] = "UNSPECIFIED", t[t.TOP = 1] = "TOP", t[t.MIDDLE = 2] = "MIDDLE", t[t.BOTTOM = 3] = "BOTTOM", t))(hn || {});
  6185. var xn = ((t) => (t[t.UNSPECIFIED = 0] = "UNSPECIFIED", t[t.OVERFLOW = 1] = "OVERFLOW", t[t.CLIP = 2] = "CLIP", t[t.WRAP = 3] = "WRAP", t))(xn || {});
  6186. var Vs = ((t) => (t[t.NORMAL = 0] = "NORMAL", t[t.ITALIC = 1] = "ITALIC", t))(Vs || {});
  6187. var Gs = ((t) => (t[t.NORMAL = 0] = "NORMAL", t[t.BOLD = 1] = "BOLD", t))(Gs || {});
  6188. var Bt = ((t) => (t[t.NORMAL = 1] = "NORMAL", t[t.SUBSCRIPT = 2] = "SUBSCRIPT", t[t.SUPERSCRIPT = 3] = "SUPERSCRIPT", t))(Bt || {});
  6189. var we = ((t) => (t[t.FALSE = 0] = "FALSE", t[t.TRUE = 1] = "TRUE", t))(we || {});
  6190. var dn = ((t) => (t[t.STRING = 1] = "STRING", t[t.NUMBER = 2] = "NUMBER", t[t.BOOLEAN = 3] = "BOOLEAN", t[t.FORCE_STRING = 4] = "FORCE_STRING", t))(dn || {});
  6191. var ft = ((t) => (t[t.DARK1 = 0] = "DARK1", t[t.LIGHT1 = 1] = "LIGHT1", t[t.DARK2 = 2] = "DARK2", t[t.LIGHT2 = 3] = "LIGHT2", t[t.ACCENT1 = 4] = "ACCENT1", t[t.ACCENT2 = 5] = "ACCENT2", t[t.ACCENT3 = 6] = "ACCENT3", t[t.ACCENT4 = 7] = "ACCENT4", t[t.ACCENT5 = 8] = "ACCENT5", t[t.ACCENT6 = 9] = "ACCENT6", t[t.HYPERLINK = 10] = "HYPERLINK", t[t.FOLLOWED_HYPERLINK = 11] = "FOLLOWED_HYPERLINK", t))(ft || {});
  6192. var Di = ((t) => (t.OFFICE = "Office", t.OFFICE_2007_2010 = "Office 2007-2010", t.GRAYSCALE = "Grayscale", t.BLUE_WARM = "Blue Warm", t.BLUE = "Blue", t.BLUE_II = "Blue II", t.BLUE_GREEN = "Blue Green", t.GREEN = "Green", t.GREEN_YELLOW = "Green Yellow", t.YELLOW = "Yellow", t.YELLOW_ORANGE = "Yellow Orange", t.ORANGE = "Orange", t.ORANGE_RED = "Orange Red", t.RED_ORANGE = "Red Orange", t.RED = "Red", t.RED_VIOLET = "Red Violet", t.VIOLET = "Violet", t.VIOLET_II = "Violet II", t.MEDIAN = "Median", t.PAPER = "Paper", t.MARQUEE = "Marquee", t.SLIPSTREAM = "Slipstream", t.Aspect = "Aspect", t))(Di || {});
  6193. var ng = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
  6194. var rg = (t) => crypto.getRandomValues(new Uint8Array(t));
  6195. var sg = (t, e, n) => {
  6196. let r = (2 << Math.log2(t.length - 1)) - 1, s = -~(1.6 * r * e / t.length);
  6197. return (i = e) => {
  6198. let o = "";
  6199. for (; ; ) {
  6200. let a = n(s), u = s | 0;
  6201. for (; u--; )
  6202. if (o += t[a[u] & r] || "", o.length >= i)
  6203. return o;
  6204. }
  6205. };
  6206. };
  6207. var ig = (t, e = 21) => sg(t, e | 0, rg);
  6208. var og = (t = 21) => {
  6209. let e = "", n = crypto.getRandomValues(new Uint8Array(t |= 0));
  6210. for (; t--; )
  6211. e += ng[n[t] & 63];
  6212. return e;
  6213. };
  6214. var Tu = /* @__PURE__ */ new Set([
  6215. "ac",
  6216. "ad",
  6217. "ae",
  6218. "aero",
  6219. "af",
  6220. "ag",
  6221. "ai",
  6222. "al",
  6223. "am",
  6224. "ao",
  6225. "aq",
  6226. "ar",
  6227. "arpa",
  6228. "as",
  6229. "asia",
  6230. "at",
  6231. "au",
  6232. "aw",
  6233. "ax",
  6234. "az",
  6235. "ba",
  6236. "bb",
  6237. "bd",
  6238. "be",
  6239. "bf",
  6240. "bg",
  6241. "bh",
  6242. "bi",
  6243. "biz",
  6244. "bj",
  6245. "bm",
  6246. "bn",
  6247. "bo",
  6248. "br",
  6249. "bs",
  6250. "bt",
  6251. "bv",
  6252. "bw",
  6253. "by",
  6254. "bz",
  6255. "ca",
  6256. "cat",
  6257. "cc",
  6258. "cd",
  6259. "cf",
  6260. "cg",
  6261. "ch",
  6262. "ci",
  6263. "ck",
  6264. "cl",
  6265. "cm",
  6266. "cn",
  6267. "co",
  6268. "com",
  6269. "coop",
  6270. "cr",
  6271. "cu",
  6272. "cv",
  6273. "cw",
  6274. "cx",
  6275. "cy",
  6276. "cz",
  6277. "de",
  6278. "dj",
  6279. "dk",
  6280. "dm",
  6281. "do",
  6282. "dz",
  6283. "ec",
  6284. "edu",
  6285. "ee",
  6286. "eg",
  6287. "er",
  6288. "es",
  6289. "et",
  6290. "eu",
  6291. "fi",
  6292. "fj",
  6293. "fk",
  6294. "fm",
  6295. "fo",
  6296. "fr",
  6297. "ga",
  6298. "gb",
  6299. "gd",
  6300. "ge",
  6301. "gf",
  6302. "gg",
  6303. "gh",
  6304. "gi",
  6305. "gl",
  6306. "gm",
  6307. "gn",
  6308. "gov",
  6309. "gp",
  6310. "gq",
  6311. "gr",
  6312. "gs",
  6313. "gt",
  6314. "gu",
  6315. "gw",
  6316. "gy",
  6317. "hk",
  6318. "hm",
  6319. "hn",
  6320. "hr",
  6321. "ht",
  6322. "hu",
  6323. "id",
  6324. "ie",
  6325. "il",
  6326. "im",
  6327. "in",
  6328. "info",
  6329. "int",
  6330. "io",
  6331. "iq",
  6332. "ir",
  6333. "is",
  6334. "it",
  6335. "je",
  6336. "jm",
  6337. "jo",
  6338. "jobs",
  6339. "jp",
  6340. "ke",
  6341. "kg",
  6342. "kh",
  6343. "ki",
  6344. "km",
  6345. "kn",
  6346. "kp",
  6347. "kr",
  6348. "kw",
  6349. "ky",
  6350. "kz",
  6351. "la",
  6352. "lb",
  6353. "lc",
  6354. "li",
  6355. "lk",
  6356. "lr",
  6357. "ls",
  6358. "lt",
  6359. "lu",
  6360. "lv",
  6361. "ly",
  6362. "ma",
  6363. "mc",
  6364. "md",
  6365. "me",
  6366. "mg",
  6367. "mh",
  6368. "mil",
  6369. "mk",
  6370. "ml",
  6371. "mm",
  6372. "mn",
  6373. "mo",
  6374. "mobi",
  6375. "mp",
  6376. "mq",
  6377. "mr",
  6378. "ms",
  6379. "mt",
  6380. "mu",
  6381. "museum",
  6382. "mv",
  6383. "mw",
  6384. "mx",
  6385. "my",
  6386. "mz",
  6387. "na",
  6388. "name",
  6389. "nc",
  6390. "ne",
  6391. "net",
  6392. "nf",
  6393. "ng",
  6394. "ni",
  6395. "nl",
  6396. "no",
  6397. "np",
  6398. "nr",
  6399. "nu",
  6400. "nz",
  6401. "om",
  6402. "onion",
  6403. "org",
  6404. "pa",
  6405. "pe",
  6406. "pf",
  6407. "pg",
  6408. "ph",
  6409. "pk",
  6410. "pl",
  6411. "pm",
  6412. "pn",
  6413. "post",
  6414. "pr",
  6415. "pro",
  6416. "ps",
  6417. "pt",
  6418. "pw",
  6419. "py",
  6420. "qa",
  6421. "re",
  6422. "ro",
  6423. "rs",
  6424. "ru",
  6425. "rw",
  6426. "sa",
  6427. "sb",
  6428. "sc",
  6429. "sd",
  6430. "se",
  6431. "sg",
  6432. "sh",
  6433. "si",
  6434. "sj",
  6435. "sk",
  6436. "sl",
  6437. "sm",
  6438. "sn",
  6439. "so",
  6440. "sr",
  6441. "ss",
  6442. "st",
  6443. "su",
  6444. "sv",
  6445. "sx",
  6446. "sy",
  6447. "sz",
  6448. "tc",
  6449. "td",
  6450. "tel",
  6451. "tf",
  6452. "tg",
  6453. "th",
  6454. "tj",
  6455. "tk",
  6456. "tl",
  6457. "tm",
  6458. "tn",
  6459. "to",
  6460. "tr",
  6461. "tt",
  6462. "tv",
  6463. "tw",
  6464. "tz",
  6465. "ua",
  6466. "ug",
  6467. "uk",
  6468. "us",
  6469. "uy",
  6470. "uz",
  6471. "va",
  6472. "vc",
  6473. "ve",
  6474. "vg",
  6475. "vi",
  6476. "vn",
  6477. "vu",
  6478. "wf",
  6479. "ws",
  6480. "yt",
  6481. "za",
  6482. "zm",
  6483. "zw"
  6484. ]);
  6485. var ag = new RegExp(
  6486. "^(?:(?:(?:https?|ftp):)?\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$",
  6487. "i"
  6488. );
  6489. function ug(t) {
  6490. if (!Number.isNaN(+t))
  6491. return false;
  6492. if (t.startsWith("http://localhost:3002") || t.startsWith("localhost:3002"))
  6493. return true;
  6494. if (ag.test(t)) {
  6495. if (Mu(t))
  6496. return true;
  6497. try {
  6498. const r = new URL(Du(t)).hostname.split(".").pop();
  6499. if (r && Tu.has(r))
  6500. return true;
  6501. } catch {
  6502. return false;
  6503. }
  6504. }
  6505. return false;
  6506. }
  6507. function Mu(t) {
  6508. return /^[a-zA-Z]+:\/\//.test(t);
  6509. }
  6510. function lg(t) {
  6511. return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(t);
  6512. }
  6513. function Du(t) {
  6514. return Mu(t) ? t : lg(t) ? `mailto://${t}` : `https://${t}`;
  6515. }
  6516. var cg = /^-ms-/;
  6517. var hg = /-([a-z])/g;
  6518. var Vt = [
  6519. "A",
  6520. "B",
  6521. "C",
  6522. "D",
  6523. "E",
  6524. "F",
  6525. "G",
  6526. "H",
  6527. "I",
  6528. "J",
  6529. "K",
  6530. "L",
  6531. "M",
  6532. "N",
  6533. "O",
  6534. "P",
  6535. "Q",
  6536. "R",
  6537. "S",
  6538. "T",
  6539. "U",
  6540. "V",
  6541. "W",
  6542. "X",
  6543. "Y",
  6544. "Z"
  6545. ];
  6546. function xi(t, e) {
  6547. const n = re.getValueType(t), r = re.getValueType(e);
  6548. return n !== r ? false : re.isArray(t) ? dg(t, e) : re.isObject(t) ? fg(t, e) : re.isDate(t) ? t.getTime() === e.getTime() : re.isRegExp(t) ? t.toString() === e.toString() : t === e;
  6549. }
  6550. function dg(t, e) {
  6551. if (t.length !== e.length)
  6552. return false;
  6553. for (let n = 0, r = t.length; n < r; n++) {
  6554. const s = t[n], i = e[n];
  6555. if (!xi(s, i))
  6556. return false;
  6557. }
  6558. return true;
  6559. }
  6560. function fg(t, e) {
  6561. const n = Object.keys(t), r = Object.keys(e);
  6562. if (n.length !== r.length)
  6563. return false;
  6564. for (const s of n) {
  6565. if (!r.includes(s))
  6566. return false;
  6567. const i = t[s], o = e[s];
  6568. if (!xi(i, o))
  6569. return false;
  6570. }
  6571. return true;
  6572. }
  6573. var re = class _re {
  6574. static stringAt(e) {
  6575. let n = "", r = e;
  6576. for (; r >= Vt.length; )
  6577. r /= Vt.length, r -= 1, n += Vt[r % Vt.length];
  6578. const s = e % Vt.length;
  6579. return n += Vt[s], n;
  6580. }
  6581. static indexAt(e) {
  6582. let n = 0;
  6583. for (let r = 0; r < e.length - 1; r += 1) {
  6584. const s = e.charCodeAt(r) - 65, i = e.length - 1 - r;
  6585. n += Vt.length ** i + Vt.length * s;
  6586. }
  6587. return n += e.charCodeAt(e.length - 1) - 65, n;
  6588. }
  6589. static deleteBlank(e) {
  6590. return _re.isString(e) ? e.replace(/\s/g, "") : e;
  6591. }
  6592. // eslint-disable-next-line complexity
  6593. static getSystemType() {
  6594. const e = navigator.userAgent, n = navigator.platform === "Win32" || navigator.platform === "Windows", r = navigator.platform === "Mac68K" || navigator.platform === "MacPPC" || navigator.platform === "Macintosh" || navigator.platform === "MacIntel";
  6595. if (r)
  6596. return "Mac";
  6597. if (navigator.platform === "X11" && !n && !r)
  6598. return "Unix";
  6599. if (String(navigator.platform).indexOf("Linux") > -1)
  6600. return "Linux";
  6601. if (n) {
  6602. if (e.indexOf("Windows NT 5.0") > -1 || e.indexOf("Windows 2000") > -1)
  6603. return "Windows 2000";
  6604. if (e.indexOf("Windows NT 5.1") > -1 || e.indexOf("Windows XP") > -1)
  6605. return "Windows XP";
  6606. if (e.indexOf("Windows NT 5.2") > -1 || e.indexOf("Windows 2003") > -1)
  6607. return "Windows 2003";
  6608. if (e.indexOf("Windows NT 6.0") > -1 || e.indexOf("Windows Vista") > -1)
  6609. return "Windows Vista";
  6610. if (e.indexOf("Windows NT 6.1") > -1 || e.indexOf("Windows 7") > -1)
  6611. return "Windows 7";
  6612. if (e.indexOf("Windows NT 10") > -1 || e.indexOf("Windows 10") > -1)
  6613. return "Windows 10";
  6614. if (e.indexOf("Windows NT 11") > -1 || e.indexOf("Windows 11") > -1)
  6615. return "Windows 11";
  6616. }
  6617. return "Unknown system";
  6618. }
  6619. static getBrowserType() {
  6620. const e = navigator.userAgent, n = e.indexOf("Opera") > -1, r = e.indexOf("compatible") > -1 && e.indexOf("MSIE") > -1 && !n, s = e.indexOf("Trident") > -1 && e.indexOf("rv:11.0") > -1, i = e.indexOf("Edge") > -1, o = e.indexOf("Firefox") > -1, a = e.indexOf("Safari") > -1 && e.indexOf("Chrome") === -1, u = e.indexOf("Chrome") > -1 && e.indexOf("Safari") > -1;
  6621. if (r) {
  6622. new RegExp("MSIE (\\d+\\.\\d+);").test(e);
  6623. const l = Number.parseFloat(RegExp.$1);
  6624. return l === 7 ? "IE7" : l === 8 ? "IE8" : l === 9 ? "IE9" : l === 10 ? "IE10" : "0";
  6625. }
  6626. return o ? "FF" : n ? "Opera" : a ? "Safari" : u ? "Chrome" : i ? "Edge" : s ? "IE11" : "Unknown browser";
  6627. }
  6628. /**
  6629. * Use this method without `Tools`.
  6630. *
  6631. * @deprecated
  6632. */
  6633. static generateRandomId(e = 21, n) {
  6634. return qt(e, n);
  6635. }
  6636. static getClassName(e) {
  6637. return e.constructor.name;
  6638. }
  6639. /** @deprecated This method is deprecated, please use `import { merge } from '@univerjs/core` instead */
  6640. static deepMerge(e, ...n) {
  6641. n.forEach((o) => o && i(o));
  6642. function r(o, a) {
  6643. o.forEach((u, c) => {
  6644. var l, h;
  6645. if (_re.isArray(u)) {
  6646. const d = (l = a[c]) != null ? l : [];
  6647. a[c] = d, r(u, d);
  6648. return;
  6649. }
  6650. if (_re.isObject(u)) {
  6651. const d = (h = a[c]) != null ? h : {};
  6652. a[c] = d, s(u, d);
  6653. return;
  6654. }
  6655. a[c] = u;
  6656. });
  6657. }
  6658. function s(o, a) {
  6659. Object.keys(o).forEach((u) => {
  6660. var l, h;
  6661. const c = o[u];
  6662. if (_re.isObject(c)) {
  6663. const d = (l = a[u]) != null ? l : {};
  6664. a[u] = d, s(c, d);
  6665. return;
  6666. }
  6667. if (_re.isArray(c)) {
  6668. const d = (h = a[u]) != null ? h : [];
  6669. a[u] = d, r(c, d);
  6670. return;
  6671. }
  6672. a[u] = c;
  6673. });
  6674. }
  6675. function i(o) {
  6676. Object.keys(o).forEach((a) => {
  6677. var c, l;
  6678. const u = o[a];
  6679. if (_re.isArray(u)) {
  6680. const h = (c = e[a]) != null ? c : [];
  6681. e[a] = h, r(u, h);
  6682. return;
  6683. }
  6684. if (_re.isObject(u)) {
  6685. const h = (l = e[a]) != null ? l : {};
  6686. e[a] = h, s(u, h);
  6687. return;
  6688. }
  6689. e[a] = u;
  6690. });
  6691. }
  6692. return e;
  6693. }
  6694. static numberFixed(e, n) {
  6695. return Number(Number(e).toFixed(n));
  6696. }
  6697. static diffValue(e, n) {
  6698. return xi(e, n);
  6699. }
  6700. static deepClone(e) {
  6701. if (!this.isDefine(e))
  6702. return e;
  6703. if (this.isRegExp(e))
  6704. return new RegExp(e);
  6705. if (this.isDate(e))
  6706. return new Date(e);
  6707. if (this.isArray(e)) {
  6708. const n = [];
  6709. return e.forEach((r, s) => {
  6710. n[s] = _re.deepClone(r);
  6711. }), n;
  6712. }
  6713. if (this.isObject(e)) {
  6714. const n = {};
  6715. return Object.keys(e).forEach((r) => {
  6716. const s = e[r];
  6717. n[r] = _re.deepClone(s);
  6718. }), Object.setPrototypeOf(n, Object.getPrototypeOf(e)), n;
  6719. }
  6720. return e;
  6721. }
  6722. static getLanguage() {
  6723. const e = "en-US";
  6724. return globalThis.navigator && (navigator.languages && navigator.languages[0] || navigator.language) || e;
  6725. }
  6726. static getValueType(e) {
  6727. return Object.prototype.toString.apply(e);
  6728. }
  6729. static isDefine(e) {
  6730. return e != null;
  6731. }
  6732. static isBlank(e) {
  6733. return this.isDefine(e) ? this.isString(e) ? e.trim() === "" : false : true;
  6734. }
  6735. static isBoolean(e) {
  6736. return this.getValueType(e) === "[object Boolean]";
  6737. }
  6738. static isPlainObject(e) {
  6739. return this.isDefine(e) ? Object.getPrototypeOf(e) === Object.getPrototypeOf({}) : false;
  6740. }
  6741. static isFunction(e) {
  6742. return this.getValueType(e) === "[object Function]";
  6743. }
  6744. static isDate(e) {
  6745. return this.getValueType(e) === "[object Date]";
  6746. }
  6747. static isRegExp(e) {
  6748. return this.getValueType(e) === "[object RegExp]";
  6749. }
  6750. static isArray(e) {
  6751. return this.getValueType(e) === "[object Array]";
  6752. }
  6753. static isString(e) {
  6754. return this.getValueType(e) === "[object String]";
  6755. }
  6756. static isNumber(e) {
  6757. return this.getValueType(e) === "[object Number]";
  6758. }
  6759. static isStringNumber(e) {
  6760. return !isNaN(Number.parseFloat(e)) && isFinite(e);
  6761. }
  6762. static isObject(e) {
  6763. return this.getValueType(e) === "[object Object]";
  6764. }
  6765. static isEmptyObject(e) {
  6766. for (const n in e)
  6767. return false;
  6768. return true;
  6769. }
  6770. static isMobile() {
  6771. let e = 0, n = 0;
  6772. return document.body.clientWidth && (e = document.body.clientWidth), document.body.clientHeight && (n = document.body.clientHeight), this.isAndroid() || this.isIPhone() || this.isTablet() || e < 350 && n < 500;
  6773. }
  6774. static isTablet() {
  6775. return /ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase());
  6776. }
  6777. static isWeChat() {
  6778. const e = navigator.userAgent.toLowerCase();
  6779. return String(e.match(/MicroMessenger/i)) === "micromessenger";
  6780. }
  6781. static isAndroid() {
  6782. const e = navigator.userAgent;
  6783. return e.indexOf("Android") > -1 || e.indexOf("Linux") > -1;
  6784. }
  6785. static isIPhone() {
  6786. return /iPhone/i.test(navigator.userAgent);
  6787. }
  6788. static isLegalUrl(e) {
  6789. return ug(e);
  6790. }
  6791. static normalizeUrl(e) {
  6792. return Du(e);
  6793. }
  6794. static topLevelDomainCombiningString() {
  6795. return [...Tu].join("|");
  6796. }
  6797. static itCount(e) {
  6798. return (n) => {
  6799. for (let r = 0; r < e; r++)
  6800. n && n();
  6801. };
  6802. }
  6803. static hasLength(e, n) {
  6804. return _re.isDefine(e) ? _re.isDefine(n) ? e.length === n : e.length > 0 : false;
  6805. }
  6806. static capitalize(e) {
  6807. return e.charAt(0).toUpperCase() + e.slice(1);
  6808. }
  6809. // Used by camelCase as callback to replace()
  6810. static fCamelCase(e, n) {
  6811. return n.toUpperCase();
  6812. }
  6813. // Convert dashed to camelCase; used by the css and data modules
  6814. // Support: IE <=9 - 11, Edge 12 - 15
  6815. // Microsoft forgot to hump their vendor prefix (#9572)
  6816. static camelCase(e) {
  6817. return e.replace(cg, "ms-").replace(hg, this.fCamelCase);
  6818. }
  6819. /**
  6820. * remove all null from object
  6821. * @param obj
  6822. * @returns
  6823. */
  6824. static removeNull(e) {
  6825. return this.isObject(e) && Object.keys(e).forEach((n) => {
  6826. const r = e[n];
  6827. r == null ? delete e[n] : _re.removeNull(r);
  6828. }), e;
  6829. }
  6830. /**
  6831. * Generate a two-dimensional array with the specified number of rows and columns, and fill in the values
  6832. * @param rows row length
  6833. * @param columns column length
  6834. * @param value value to be set
  6835. * @returns
  6836. */
  6837. static fillTwoDimensionalArray(e, n, r) {
  6838. return new Array(e).fill(r).map((s) => new Array(n).fill(r));
  6839. }
  6840. /**
  6841. * Generate a two-dimensional array with the specified number of rows and columns, and fill in the values
  6842. * @param rows row length
  6843. * @param columns column length
  6844. * @param value value to be set
  6845. * @returns
  6846. */
  6847. // static fillObjectMatrix<T>(rows: number, columns: number, value: T): IObjectMatrixPrimitiveType<T> {
  6848. // const matrix = new ObjectMatrix<T>();
  6849. // for (let r = 0; r < rows; r++) {
  6850. // for (let c = 0; c < columns; c++) {
  6851. // matrix.setValue(r, c, value);
  6852. // }
  6853. // }
  6854. // return matrix.getData();
  6855. // }
  6856. static numToWord(e) {
  6857. let n = "";
  6858. for (; e > 0; ) {
  6859. let r = e % 26;
  6860. r = r === 0 ? r = 26 : r, n = String.fromCharCode(96 + r) + n, e = (e - r) / 26;
  6861. }
  6862. return n.toLocaleUpperCase();
  6863. }
  6864. /**
  6865. *
  6866. * Column subscript letter to number
  6867. *
  6868. * @privateRemarks
  6869. * zh: 列下标 字母转数字
  6870. *
  6871. * @param a - Column subscript letter,e.g.,"A1"
  6872. * @returns Column subscript number,e.g.,0
  6873. *
  6874. */
  6875. static ABCatNum(e) {
  6876. if (e == null || e.length === 0)
  6877. return Number.NaN;
  6878. const n = e.toLowerCase().split(""), r = n.length;
  6879. let s = 0, i = 0;
  6880. for (let o = 0; o < r; o++)
  6881. i = n[o].charCodeAt(0) - 96, s += i * 26 ** (r - o - 1);
  6882. return s === 0 ? Number.NaN : s - 1;
  6883. }
  6884. /**
  6885. * en: Column subscript number to letter
  6886. *
  6887. * zh: 列下标 数字转字母
  6888. *
  6889. * @param n Column subscript number,e.g.,0
  6890. * @returns Column subscript letter,e.g.,"A1"
  6891. */
  6892. static chatAtABC(e) {
  6893. let i = "";
  6894. for (; e >= 0; )
  6895. i = String.fromCharCode(e % 26 + 97) + i, e = Math.floor(e / 26) - 1;
  6896. return i.toUpperCase();
  6897. }
  6898. static randSort(e) {
  6899. for (let n = 0, r = e.length; n < r; n++) {
  6900. const s = Number.parseInt((Math.random() * r).toString()), i = e[s];
  6901. e[s] = e[n], e[n] = i;
  6902. }
  6903. return e;
  6904. }
  6905. /**
  6906. * extend two objects
  6907. * @param originJson
  6908. * @param extendJson
  6909. * @returns
  6910. */
  6911. static commonExtend(e, n) {
  6912. const r = {};
  6913. for (const s in e)
  6914. r[s] = e[s];
  6915. for (const s in n)
  6916. n[s] != null && (r[s] = n[s]);
  6917. return r;
  6918. }
  6919. static commonExtend1(e, n) {
  6920. for (const r in e)
  6921. n[r] == null && (n[r] = e[r]);
  6922. return n;
  6923. }
  6924. static arrayToObject(e) {
  6925. const n = {};
  6926. return e.forEach((r, s) => {
  6927. n[s] = {}, r.forEach((i, o) => {
  6928. n[s][o] = i;
  6929. });
  6930. }), n;
  6931. }
  6932. static hasIntersectionBetweenTwoRanges(e, n, r, s) {
  6933. return n >= r && s >= e;
  6934. }
  6935. static isStartValidPosition(e) {
  6936. return /^[A-Za-z_]/.test(e);
  6937. }
  6938. static isValidParameter(e) {
  6939. const n = /[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(e), r = e.length <= 255;
  6940. return !n && r;
  6941. }
  6942. static clamp(e, n, r) {
  6943. return Math.max(n, Math.min(r, e));
  6944. }
  6945. static now() {
  6946. return performance && performance.now ? performance.now() : Date.now();
  6947. }
  6948. };
  6949. function qt(t = 21, e) {
  6950. return e ? ig(e, t)() : og(t);
  6951. }
  6952. function Mo(...t) {
  6953. const e = {}, n = t.length;
  6954. for (let r = n - 1; r >= 0; r--) {
  6955. const s = t[r];
  6956. if (s) {
  6957. const i = Object.keys(s);
  6958. for (const o of i)
  6959. e[o] === void 0 && (e[o] = s[o]);
  6960. }
  6961. }
  6962. return e;
  6963. }
  6964. var aC = () => typeof process < "u" && process.versions != null && process.versions.node != null;
  6965. function Os(t, e, n) {
  6966. const { dataStream: r, textRuns: s = [] } = t;
  6967. let i = e;
  6968. const o = [];
  6969. for (const a of s) {
  6970. const { st: u, ed: c } = a;
  6971. re.hasIntersectionBetweenTwoRanges(e, n, u, c) && (u > i ? (o.push(r.slice(i, u)), o.push(Do(r, {
  6972. ...a,
  6973. ed: Math.min(c, n)
  6974. }))) : o.push(Do(r, {
  6975. ...a,
  6976. st: i,
  6977. ed: Math.min(c, n)
  6978. }))), i = Math.max(e, Math.min(c, n));
  6979. }
  6980. return i !== n && o.push(r.slice(i, n)), o.join("");
  6981. }
  6982. function uC(t, e = true) {
  6983. var n;
  6984. if (e && ((n = t.paragraphs) != null && n.length)) {
  6985. const { dataStream: r, paragraphs: s = [] } = t;
  6986. let i = "", o = -1;
  6987. for (const a of s) {
  6988. const { startIndex: u, paragraphStyle: c = {} } = a, { spaceAbove: l, spaceBelow: h, lineSpacing: d } = c, f = [];
  6989. l != null && (typeof l == "number" ? f.push(`margin-top: ${l}px`) : f.push(`margin-top: ${l.v}px`)), h != null && (typeof h == "number" ? f.push(`margin-bottom: ${h}px`) : f.push(`margin-bottom: ${h.v}px`)), d != null && f.push(`line-height: ${d}`), u > o + 1 ? i += `<p class="UniverNormal" ${f.length ? `style="${f.join("; ")};"` : ""}>${Os(t, o + 1, u)}</p>` : i += `<p class="UniverNormal" ${f.length ? `style="${f.join("; ")};"` : ""}></p>`, o = u;
  6990. }
  6991. return o !== r.length && (i += Os(t, o, r.length)), i;
  6992. } else
  6993. return Os(t, 0, t.dataStream.length);
  6994. }
  6995. function Do(t, e) {
  6996. const { st: n, ed: r, ts: s = {} } = e, { ff: i, fs: o, it: a, bl: u, ul: c, st: l, ol: h, bg: d, cl: f, va: E } = s;
  6997. let R = t.slice(n, r);
  6998. const O = [];
  6999. return a === we.TRUE && (R = `<i>${R}</i>`), E === Bt.SUPERSCRIPT ? R = `<sup>${R}</sup>` : E === Bt.SUBSCRIPT && (R = `<sub>${R}</sub>`), (c == null ? void 0 : c.s) === we.TRUE && (R = `<u>${R}</u>`), (l == null ? void 0 : l.s) === we.TRUE && (R = `<s>${R}</s>`), u === we.TRUE && (R = `<strong>${R}</strong>`), i && O.push(`font-family: ${i}`), f && O.push(`color: ${f.rgb}`), o && O.push(`font-size: ${o}pt`), h && O.push("text-decoration: overline"), d && O.push(`background: ${d.rgb}`), O.length ? `<span style="${O.join("; ")};">${R}</span>` : R;
  7000. }
  7001. var gg = {
  7002. [Di.OFFICE]: {
  7003. [ft.ACCENT1]: "#4472C4",
  7004. [ft.ACCENT2]: "#ED7D31",
  7005. [ft.ACCENT3]: "#A5A5A5",
  7006. [ft.ACCENT4]: "#70AD47",
  7007. [ft.ACCENT5]: "#5B9BD5",
  7008. [ft.ACCENT6]: "#70AD47",
  7009. [ft.DARK1]: "#000000",
  7010. [ft.DARK2]: "#44546A",
  7011. [ft.LIGHT1]: "#FFFFFF",
  7012. [ft.LIGHT2]: "#E7E6E6",
  7013. [ft.HYPERLINK]: "#0563C1",
  7014. [ft.FOLLOWED_HYPERLINK]: "#954F72"
  7015. }
  7016. };
  7017. var gs = class {
  7018. constructor() {
  7019. C(this, "_themeValue", ft.LIGHT1);
  7020. C(this, "_themeColors");
  7021. C(this, "_themeTint");
  7022. C(this, "_rgbValue", "");
  7023. C(this, "_colorType");
  7024. this._colorType = vt.UNSUPPORTED, this._themeColors = Di.OFFICE, this._themeTint = 0;
  7025. }
  7026. asRgbColor() {
  7027. return new Ks(this._rgbValue, this);
  7028. }
  7029. asThemeColor() {
  7030. return new Xs(this._themeValue, this._themeTint, this._themeColors, this);
  7031. }
  7032. build() {
  7033. switch (this._colorType) {
  7034. case vt.THEME:
  7035. return this.asThemeColor();
  7036. case vt.RGB:
  7037. return this.asRgbColor();
  7038. case vt.UNSUPPORTED:
  7039. throw new Error("unsupported color type");
  7040. }
  7041. }
  7042. setRgbColor(e) {
  7043. return this._colorType = vt.RGB, this._rgbValue = e, this;
  7044. }
  7045. setThemeColors(e) {
  7046. this._colorType = vt.THEME, this._themeColors = e;
  7047. }
  7048. setThemeTint(e) {
  7049. this._colorType = vt.THEME, this._themeTint = e;
  7050. }
  7051. setThemeColor(e) {
  7052. return this._colorType = vt.THEME, this._themeValue = e, this;
  7053. }
  7054. getColorType() {
  7055. return this._colorType;
  7056. }
  7057. };
  7058. var Ln = class _Ln {
  7059. constructor(e) {
  7060. C(this, "_builder");
  7061. this._builder = e;
  7062. }
  7063. static rgbColorToHexValue(e) {
  7064. return `#${((1 << 24) + (e.getRed() << 16) + (e.getGreen() << 8) + e.getBlue()).toString(16).slice(1)}`;
  7065. }
  7066. static hexValueToRgbColor(e) {
  7067. e ? e.indexOf("#") > -1 && (e = e.substring(1)) : e = "#000000";
  7068. const n = +`0x${e[0]}${e[1]}`, r = +`0x${e[2]}${e[3]}`, s = +`0x${e[4]}${e[5]}`;
  7069. return new gs().setRgbColor(`rgb(${n},${r},${s})`).asRgbColor();
  7070. }
  7071. static hexToRgbString(e) {
  7072. const n = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
  7073. e = e.replace(n, (i, o, a, u) => o + o + a + a + u + u);
  7074. const r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
  7075. let s = null;
  7076. if (r) {
  7077. const i = Number.parseInt(r[1], 16), o = Number.parseInt(r[2], 16), a = Number.parseInt(r[3], 16);
  7078. s = `rgba(${i},${o},${a})`;
  7079. }
  7080. return s;
  7081. }
  7082. asRgbColor() {
  7083. return this._builder.asRgbColor();
  7084. }
  7085. asThemeColor() {
  7086. return this._builder.asThemeColor();
  7087. }
  7088. getColorType() {
  7089. return this._builder.getColorType();
  7090. }
  7091. clone() {
  7092. return new _Ln(this._builder);
  7093. }
  7094. equals(e) {
  7095. return false;
  7096. }
  7097. };
  7098. var pg = class {
  7099. constructor(e) {
  7100. C(this, "_saturation", 0);
  7101. C(this, "_hue", 0);
  7102. C(this, "_lightness", 0);
  7103. C(this, "_alpha", 0);
  7104. const n = e.getRed() / 255, r = e.getGreen() / 255, s = e.getBlue() / 255, i = e.getAlpha() / 255, o = Math.min(n, Math.min(r, s)), a = Math.max(n, Math.max(r, s)), u = a - o;
  7105. if (a === o) {
  7106. this._hue = 0, this._saturation = 0, this._lightness = a;
  7107. return;
  7108. }
  7109. this._lightness = (o + a) / 2, this._lightness < 0.5 ? this._saturation = u / (a + o) : this._saturation = u / (2 - a - o), n === a && (this._hue = (r - s) / u), r === a && (this._hue = 2 + (s - n) / u), s === a && (this._hue = 4 + (n - r) / u), this._hue *= 60, this._hue < 0 && (this._hue += 360), this._alpha = i;
  7110. }
  7111. asRgbColor() {
  7112. const e = new gs();
  7113. if (this._saturation === 0)
  7114. return e.setRgbColor(
  7115. `rgba(${this._lightness * 255},${this._lightness * 255},${this._lightness * 255},${this._alpha * 255})`
  7116. ), e.asRgbColor();
  7117. let n;
  7118. this._lightness < 0.5 ? n = this._lightness * (1 + this._saturation) : n = this._lightness + this._saturation - this._lightness * this._saturation;
  7119. const r = 2 * this._lightness - n, s = this._hue / 360, i = s + 1 / 3, o = this.setColor(n, r, i), a = this.setColor(n, r, s), u = s - 1 / 3, c = this.setColor(n, r, u);
  7120. return e.setRgbColor(
  7121. `rgba(${Math.round(o * 255)},${Math.round(a * 255)},${Math.round(c * 255)},${this._alpha * 255})`
  7122. ), e.asRgbColor();
  7123. }
  7124. getLightness() {
  7125. return this._lightness;
  7126. }
  7127. getHue() {
  7128. return this._hue;
  7129. }
  7130. getSaturation() {
  7131. return this._saturation;
  7132. }
  7133. getAlpha() {
  7134. return this._alpha;
  7135. }
  7136. setColor(e, n, r) {
  7137. r < 0 && (r += 1), r > 1 && (r -= 1);
  7138. let s;
  7139. return 6 * r < 1 ? s = n + (e - n) * 6 * r : 2 * r < 1 ? s = e : 3 * r < 2 ? s = n + (e - n) * (2 / 3 - r) * 6 : s = n, s;
  7140. }
  7141. setLightness(e) {
  7142. this._lightness = e;
  7143. }
  7144. };
  7145. var It = class It2 extends Ln {
  7146. constructor(n, r) {
  7147. super(r);
  7148. C(this, "_cssString");
  7149. C(this, "_red");
  7150. C(this, "_green");
  7151. C(this, "_blue");
  7152. C(this, "_alpha");
  7153. let s = n.match(It2.RGBA_EXTRACT);
  7154. if (s) {
  7155. const i = +s[1], o = +s[2], a = +s[3], u = +s[4];
  7156. this._cssString = n, this._red = i, this._green = o, this._blue = a, this._alpha = u;
  7157. return;
  7158. }
  7159. if (s = n.match(It2.RGB_EXTRACT), s) {
  7160. const i = +s[1], o = +s[2], a = +s[3];
  7161. this._cssString = n, this._red = i, this._green = o, this._blue = a, this._alpha = 1;
  7162. return;
  7163. }
  7164. throw new Error("Invalid rgba or rgb color");
  7165. }
  7166. asHexString() {
  7167. return Ln.rgbColorToHexValue(this);
  7168. }
  7169. getRed() {
  7170. let n = this._red + It2.RGB_COLOR_AMT;
  7171. return n > 255 ? n = 255 : n < 0 && (n = 0), n;
  7172. }
  7173. getGreen() {
  7174. let n = this._green + It2.RGB_COLOR_AMT;
  7175. return n > 255 ? n = 255 : n < 0 && (n = 0), n;
  7176. }
  7177. getBlue() {
  7178. let n = this._blue + It2.RGB_COLOR_AMT;
  7179. return n > 255 ? n = 255 : n < 0 && (n = 0), n;
  7180. }
  7181. getAlpha() {
  7182. return this._alpha;
  7183. }
  7184. getColorType() {
  7185. return vt.RGB;
  7186. }
  7187. clone() {
  7188. return new It2(this._cssString, this._builder);
  7189. }
  7190. asThemeColor() {
  7191. throw new Error("rgb color not support to themeColor");
  7192. }
  7193. equals(n) {
  7194. return n instanceof It2 ? n._red === this._red && n._blue === this._blue && n._green === this._green && n._alpha === this._alpha : false;
  7195. }
  7196. getCssString() {
  7197. return this._cssString;
  7198. }
  7199. };
  7200. C(It, "RGB_COLOR_AMT", 0), C(It, "RGBA_EXTRACT", new RegExp(
  7201. "\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*"
  7202. )), C(It, "RGB_EXTRACT", new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));
  7203. var Ks = It;
  7204. var Gt = class Gt2 extends Ln {
  7205. constructor(n, r, s, i) {
  7206. super(i);
  7207. C(this, "_themeColorType");
  7208. C(this, "_themeTint");
  7209. C(this, "_themeColors");
  7210. this._themeColorType = n, this._themeTint = r, this._themeColors = s;
  7211. }
  7212. lumValue(n, r) {
  7213. if (n == null)
  7214. return r;
  7215. let s;
  7216. return n < 0 ? s = r * (1 + n) : s = r * (1 - n) + (255 - 255 * (1 - n)), s;
  7217. }
  7218. asRgbColor() {
  7219. const n = gg[this._themeColors];
  7220. if (n == null)
  7221. throw new Error("not find themeColors type");
  7222. const r = n[this._themeColorType];
  7223. if (r == null)
  7224. throw new Error("not find themeColors value");
  7225. let s;
  7226. if (Gt2._cacheThemeColor.has(this._themeColors)) {
  7227. if (s = Gt2._cacheThemeColor.get(this._themeColors), s.has(this._themeColorType))
  7228. return s.get(this._themeColorType);
  7229. } else
  7230. s = /* @__PURE__ */ new Map(), Gt2._cacheThemeColor.set(this._themeColors, s);
  7231. const i = new pg(Ln.hexValueToRgbColor(r));
  7232. i.setLightness(this.lumValue(this._themeTint, i.getLightness() * 255) / 255);
  7233. const o = i.asRgbColor();
  7234. return s.set(this._themeColorType, o), o;
  7235. }
  7236. clone() {
  7237. return new Gt2(this._themeColorType, this._themeTint, this._themeColors, this._builder);
  7238. }
  7239. equals(n) {
  7240. return n instanceof Gt2 ? n._themeColorType === this._themeColorType : false;
  7241. }
  7242. getColorType() {
  7243. return vt.THEME;
  7244. }
  7245. getThemeColorType() {
  7246. return this._themeColorType;
  7247. }
  7248. };
  7249. C(Gt, "_cacheThemeColor", /* @__PURE__ */ new Map());
  7250. var Xs = Gt;
  7251. var lC = "rgb(";
  7252. var cC = "rgba(";
  7253. var xo = {
  7254. aliceBlue: [240, 248, 255],
  7255. antiqueWhite: [250, 235, 215],
  7256. aqua: [0, 255, 255],
  7257. aquamarine: [127, 255, 212],
  7258. azure: [240, 255, 255],
  7259. beige: [245, 245, 220],
  7260. bisque: [255, 228, 196],
  7261. black: [0, 0, 0],
  7262. blancheAlmond: [255, 235, 205],
  7263. blue: [0, 0, 255],
  7264. blueViolet: [138, 43, 226],
  7265. brown: [165, 42, 42],
  7266. burlyWood: [222, 184, 135],
  7267. cadetBlue: [95, 158, 160],
  7268. chartreuse: [127, 255, 0],
  7269. chocolate: [210, 105, 30],
  7270. coral: [255, 127, 80],
  7271. cornFlowerBlue: [100, 149, 237],
  7272. cornSilk: [255, 248, 220],
  7273. crimson: [220, 20, 60],
  7274. cyan: [0, 255, 255],
  7275. darkblue: [0, 0, 139],
  7276. darkCyan: [0, 139, 139],
  7277. darkGoldenrod: [184, 132, 11],
  7278. darkGray: [169, 169, 169],
  7279. darkGreen: [0, 100, 0],
  7280. darkGrey: [169, 169, 169],
  7281. darkKhaki: [189, 183, 107],
  7282. darkMagenta: [139, 0, 139],
  7283. darkOliveGreen: [85, 107, 47],
  7284. darkOrange: [255, 140, 0],
  7285. darkOrchid: [153, 50, 204],
  7286. darkRed: [139, 0, 0],
  7287. darkSalmon: [233, 150, 122],
  7288. darkSeaGreen: [143, 188, 143],
  7289. darkSlateBlue: [72, 61, 139],
  7290. darkSlateGray: [47, 79, 79],
  7291. darkSlateGrey: [47, 79, 79],
  7292. darkTurquoise: [0, 206, 209],
  7293. darkViolet: [148, 0, 211],
  7294. deepPink: [255, 20, 147],
  7295. deepSkyBlue: [0, 191, 255],
  7296. dimGray: [105, 105, 105],
  7297. dimGrey: [105, 105, 105],
  7298. dodgerBlue: [30, 144, 255],
  7299. firebrick: [178, 34, 34],
  7300. floralWhite: [255, 255, 240],
  7301. forestGreen: [34, 139, 34],
  7302. fuchsia: [255, 0, 255],
  7303. gainsboro: [220, 220, 220],
  7304. ghostWhite: [248, 248, 255],
  7305. gold: [255, 215, 0],
  7306. goldenrod: [218, 165, 32],
  7307. gray: [128, 128, 128],
  7308. green: [0, 128, 0],
  7309. greenYellow: [173, 255, 47],
  7310. grey: [128, 128, 128],
  7311. honeydew: [240, 255, 240],
  7312. hotPink: [255, 105, 180],
  7313. indianRed: [205, 92, 92],
  7314. indigo: [75, 0, 130],
  7315. ivory: [255, 255, 240],
  7316. khaki: [240, 230, 140],
  7317. lavender: [230, 230, 250],
  7318. lavenderBlush: [255, 240, 245],
  7319. lawnGreen: [124, 252, 0],
  7320. lemonChiffon: [255, 250, 205],
  7321. lightblue: [173, 216, 230],
  7322. lightCoral: [240, 128, 128],
  7323. lightCyan: [224, 255, 255],
  7324. lightGoldenrodYellow: [250, 250, 210],
  7325. lightGray: [211, 211, 211],
  7326. lightGreen: [144, 238, 144],
  7327. lightGrey: [211, 211, 211],
  7328. lightPink: [255, 182, 193],
  7329. lightSalmon: [255, 160, 122],
  7330. lightSeaGreen: [32, 178, 170],
  7331. lightSkyBlue: [135, 206, 250],
  7332. lightSlateGray: [119, 136, 153],
  7333. lightSlateGrey: [119, 136, 153],
  7334. lightSteelBlue: [176, 196, 222],
  7335. lightYellow: [255, 255, 224],
  7336. lime: [0, 255, 0],
  7337. limeGreen: [50, 205, 50],
  7338. linen: [250, 240, 230],
  7339. magenta: [255, 0, 255],
  7340. maroon: [128, 0, 0],
  7341. mediumAquamarine: [102, 205, 170],
  7342. mediumBlue: [0, 0, 205],
  7343. mediumOrchid: [186, 85, 211],
  7344. mediumPurple: [147, 112, 219],
  7345. mediumSeaGreen: [60, 179, 113],
  7346. mediumSlateBlue: [123, 104, 238],
  7347. mediumSpringGreen: [0, 250, 154],
  7348. mediumTurquoise: [72, 209, 204],
  7349. mediumVioletRed: [199, 21, 133],
  7350. midBightBlue: [25, 25, 112],
  7351. mintCream: [245, 255, 250],
  7352. mistyRose: [255, 228, 225],
  7353. moccasin: [255, 228, 181],
  7354. navajoWhite: [255, 222, 173],
  7355. navy: [0, 0, 128],
  7356. oldLace: [253, 245, 230],
  7357. olive: [128, 128, 0],
  7358. oliveDrab: [107, 142, 35],
  7359. orange: [255, 165, 0],
  7360. orangeRed: [255, 69, 0],
  7361. orchid: [218, 112, 214],
  7362. paleGoldenrod: [238, 232, 170],
  7363. paleGreen: [152, 251, 152],
  7364. paleTurquoise: [175, 238, 238],
  7365. paleVioletRed: [219, 112, 147],
  7366. papayaWhip: [255, 239, 213],
  7367. peachPuff: [255, 218, 185],
  7368. peru: [205, 133, 63],
  7369. pink: [255, 192, 203],
  7370. plum: [221, 160, 203],
  7371. powderBlue: [176, 224, 230],
  7372. purple: [128, 0, 128],
  7373. rebeccaPurple: [102, 51, 153],
  7374. red: [255, 0, 0],
  7375. rosyBrown: [188, 143, 143],
  7376. royalBlue: [65, 105, 225],
  7377. saddleBrown: [139, 69, 19],
  7378. salmon: [250, 128, 114],
  7379. sandyBrown: [244, 164, 96],
  7380. seaGreen: [46, 139, 87],
  7381. seashell: [255, 245, 238],
  7382. sienna: [160, 82, 45],
  7383. silver: [192, 192, 192],
  7384. skyBlue: [135, 206, 235],
  7385. slateBlue: [106, 90, 205],
  7386. slateGray: [119, 128, 144],
  7387. slateGrey: [119, 128, 144],
  7388. snow: [255, 255, 250],
  7389. springGreen: [0, 255, 127],
  7390. steelBlue: [70, 130, 180],
  7391. tan: [210, 180, 140],
  7392. teal: [0, 128, 128],
  7393. thistle: [216, 191, 216],
  7394. transparent: [255, 255, 255, 0],
  7395. tomato: [255, 99, 71],
  7396. turquoise: [64, 224, 208],
  7397. violet: [238, 130, 238],
  7398. wheat: [245, 222, 179],
  7399. white: [255, 255, 255],
  7400. whiteSmoke: [245, 245, 245],
  7401. yellow: [255, 255, 0],
  7402. yellowGreen: [154, 205, 5]
  7403. };
  7404. var Nt = class _Nt {
  7405. constructor(e) {
  7406. C(this, "_color");
  7407. C(this, "_rgbColor");
  7408. C(this, "_isValid", false);
  7409. if (e == null) {
  7410. this._setNullColor();
  7411. return;
  7412. }
  7413. if (e instanceof _Nt) {
  7414. this._color = { ...e._color }, this._rgbColor = { ...e._rgbColor };
  7415. return;
  7416. }
  7417. const n = xu(e);
  7418. if (n == null) {
  7419. this._setNullColor();
  7420. return;
  7421. }
  7422. this._color = n;
  7423. const r = Rg(this._color);
  7424. if (r == null) {
  7425. this._setNullColor();
  7426. return;
  7427. }
  7428. this._rgbColor = r, this._isValid = true;
  7429. }
  7430. static mix(e, n, r) {
  7431. var c, l;
  7432. r = Math.min(1, Math.max(0, r));
  7433. const s = new _Nt(e).toRgb(), i = new _Nt(n).toRgb(), o = (c = s.a) != null ? c : 1, a = (l = i.a) != null ? l : 1, u = {
  7434. r: (i.r - s.r) * r + s.r,
  7435. g: (i.g - s.g) * r + s.g,
  7436. b: (i.b - s.b) * r + s.b,
  7437. a: (a - o) * r + o
  7438. };
  7439. return new _Nt(u);
  7440. }
  7441. static getContrastRatio(e, n) {
  7442. const r = new _Nt(e).getLuminance(), s = new _Nt(n).getLuminance();
  7443. return (Math.max(r, s) + 0.05) / (Math.min(r, s) + 0.05);
  7444. }
  7445. get isValid() {
  7446. return this._isValid;
  7447. }
  7448. toRgb() {
  7449. return this._rgbColor;
  7450. }
  7451. toRgbString() {
  7452. const { r: e, g: n, b: r, a: s = 1 } = this.toRgb(), i = s < 1;
  7453. return `rgb${i ? "a" : ""}(${e},${n},${r}${i ? `,${s}` : ""})`;
  7454. }
  7455. toString() {
  7456. return this.toRgbString();
  7457. }
  7458. toHexString(e) {
  7459. const { r: n, g: r, b: s, a: i = 1 } = this.toRgb(), o = i < 1, a = [
  7460. _r(Math.round(n).toString(16)),
  7461. _r(Math.round(r).toString(16)),
  7462. _r(Math.round(s).toString(16)),
  7463. _r(Math.round(i * 255).toString(16))
  7464. ];
  7465. return e && a[0][0] === a[0][1] && a[1][0] === a[1][1] && a[2][0] === a[2][1] && a[3][0] === a[3][1] ? o ? `#${a[0][0]}${a[1][0]}${a[2][0]}${a[3][0]}` : `#${a[0][0]}${a[1][0]}${a[2][0]}` : o ? `#${a[0]}${a[1]}${a[2]}${a[3]}` : `#${a[0]}${a[1]}${a[2]}`;
  7466. }
  7467. toHsv() {
  7468. return wg(this.toRgb());
  7469. }
  7470. toHsl() {
  7471. return yg(this.toRgb());
  7472. }
  7473. lighten(e = 10) {
  7474. const n = this.toHsl();
  7475. return n.l += e, n.l = Math.min(Math.max(n.l, 0), 100), new _Nt(n);
  7476. }
  7477. darken(e = 10) {
  7478. const n = this.toHsl();
  7479. return n.l -= e, n.l = Math.min(Math.max(n.l, 0), 100), new _Nt(n);
  7480. }
  7481. setAlpha(e) {
  7482. return new _Nt({ ...this._rgbColor, a: e });
  7483. }
  7484. getLuminance() {
  7485. let { r: e, g: n, b: r } = this.toRgb();
  7486. return e = bs(e), n = bs(n), r = bs(r), Number((0.2126 * e + 0.7152 * n + 0.0722 * r).toFixed(3));
  7487. }
  7488. getBrightness() {
  7489. const { r: e, g: n, b: r } = this.toRgb();
  7490. return (e * 299 + n * 587 + r * 114) / 1e3;
  7491. }
  7492. getAlpha() {
  7493. var e;
  7494. return (e = this._color.a) != null ? e : 1;
  7495. }
  7496. isDark() {
  7497. return this.getBrightness() < 128;
  7498. }
  7499. isLight() {
  7500. return !this.isDark();
  7501. }
  7502. _setNullColor() {
  7503. this._isValid = false, this._color = {
  7504. r: 0,
  7505. g: 0,
  7506. b: 0,
  7507. a: 0
  7508. }, this._rgbColor = {
  7509. r: 0,
  7510. g: 0,
  7511. b: 0,
  7512. a: 0
  7513. };
  7514. }
  7515. };
  7516. var _r = (t) => t.length === 1 ? `0${t}` : t;
  7517. var bs = (t) => (t /= 255, t <= 0.03928 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4);
  7518. var xu = (t) => {
  7519. if (bg(t)) {
  7520. if ("r" in t) {
  7521. const r = {
  7522. r: Math.round(t.r),
  7523. g: Math.round(t.g),
  7524. b: Math.round(t.b)
  7525. };
  7526. return t.a !== void 0 && (r.a = t.a), r;
  7527. }
  7528. if ("l" in t) {
  7529. const r = {
  7530. h: Math.round(t.h),
  7531. s: t.s,
  7532. l: t.l
  7533. };
  7534. return t.a !== void 0 && (r.a = t.a), r;
  7535. }
  7536. const n = {
  7537. h: Math.round(t.h),
  7538. s: t.s,
  7539. v: t.v
  7540. };
  7541. return t.a !== void 0 && (n.a = t.a), n;
  7542. }
  7543. const e = t.trim();
  7544. if (xo[e]) {
  7545. const n = xo[e], r = {
  7546. r: Math.round(n[0]),
  7547. g: Math.round(n[1]),
  7548. b: Math.round(n[2])
  7549. };
  7550. return r.a = n[3] || 1, r;
  7551. }
  7552. if (e.startsWith("#"))
  7553. return mg(e);
  7554. if (e.startsWith("rgb"))
  7555. return _g(e);
  7556. if (e.startsWith("hsl"))
  7557. return Eg(e);
  7558. if (e.startsWith("hsv"))
  7559. return Cg(e);
  7560. };
  7561. var mg = (t) => {
  7562. const e = t.substring(1), n = new RegExp(`.{1,${e.length >= 6 ? 2 : 1}}`, "g");
  7563. let r = e.match(n);
  7564. if (!r || r.length < 3)
  7565. throw new Error(`The color '${t}' is illegal hex color`);
  7566. r[0].length === 1 && (r = r.map((i) => i + i));
  7567. const s = {
  7568. r: Number.parseInt(r[0], 16),
  7569. g: Number.parseInt(r[1], 16),
  7570. b: Number.parseInt(r[2], 16)
  7571. };
  7572. return r.length > 3 && (s.a = Number.parseInt(r[3], 16) / 255), s;
  7573. };
  7574. var _g = (t) => {
  7575. const e = t.indexOf("(");
  7576. if (e === -1)
  7577. throw new Error(`The color '${t}' is illegal rgb color`);
  7578. const n = t.substring(e + 1, t.length - 1).split(",");
  7579. if (n.length < 3)
  7580. throw new Error(`The color '${t}' is illegal rgb color`);
  7581. const r = {
  7582. r: Number.parseInt(n[0], 10),
  7583. g: Number.parseInt(n[1], 10),
  7584. b: Number.parseInt(n[2], 10)
  7585. };
  7586. return n.length > 3 && (r.a = Number.parseFloat(n[3])), r;
  7587. };
  7588. var Eg = (t) => {
  7589. const e = t.indexOf("(");
  7590. if (e === -1)
  7591. throw new Error(`The color '${t}' is illegal hsl color`);
  7592. const n = t.substring(e + 1, t.length - 1).split(",");
  7593. if (n.length < 3)
  7594. throw new Error(`The color '${t}' is illegal hsl color`);
  7595. const r = {
  7596. h: Number.parseInt(n[0], 10),
  7597. s: Number.parseFloat(n[1]),
  7598. l: Number.parseFloat(n[2])
  7599. };
  7600. return n.length > 3 && (r.a = Number.parseFloat(n[3])), r;
  7601. };
  7602. var Cg = (t) => {
  7603. const e = t.indexOf("(");
  7604. if (e === -1)
  7605. throw new Error(`The color '${t}' is illegal hsv color`);
  7606. const n = t.substring(e + 1, t.length - 1).split(",");
  7607. if (n.length < 3)
  7608. throw new Error(`The color '${t}' is illegal hsv color`);
  7609. const r = {
  7610. h: Number.parseInt(n[0], 10),
  7611. s: Number.parseFloat(n[1]),
  7612. v: Number.parseFloat(n[2])
  7613. };
  7614. return n.length > 3 && (r.a = Number.parseFloat(n[3])), r;
  7615. };
  7616. var Rg = (t) => {
  7617. const e = xu(t);
  7618. if (e != null)
  7619. return "r" in e ? e : "l" in e ? Ig(e) : vg(e);
  7620. };
  7621. var Ss = (t, e, n) => (n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t);
  7622. var Ig = (t) => {
  7623. let { h: e, s: n, l: r } = t;
  7624. e /= 360, n /= 100, r /= 100;
  7625. let s = 0, i = 0, o = 0;
  7626. if (n === 0)
  7627. s = i = o = r;
  7628. else {
  7629. const u = r < 0.5 ? r * (1 + n) : r + n - r * n, c = 2 * r - u;
  7630. s = Ss(c, u, e + 1 / 3), i = Ss(c, u, e), o = Ss(c, u, e - 1 / 3);
  7631. }
  7632. const a = {
  7633. r: Math.round(s * 255),
  7634. g: Math.round(i * 255),
  7635. b: Math.round(o * 255)
  7636. };
  7637. return t.a !== void 0 && (a.a = t.a), a;
  7638. };
  7639. var vg = (t) => {
  7640. let { h: e, s: n, v: r } = t;
  7641. e = e / 360 * 6, n /= 100, r /= 100;
  7642. const s = Math.floor(e), i = e - s, o = r * (1 - n), a = r * (1 - i * n), u = r * (1 - (1 - i) * n), c = s % 6, l = [r, a, o, o, u, r][c], h = [u, r, r, a, o, o][c], d = [o, o, u, r, r, a][c], f = {
  7643. r: l * 255,
  7644. g: h * 255,
  7645. b: d * 255
  7646. };
  7647. return t.a !== void 0 && (f.a = t.a), f;
  7648. };
  7649. var yg = (t) => {
  7650. let { r: e, g: n, b: r } = t;
  7651. e /= 255, n /= 255, r /= 255;
  7652. const s = Math.max(e, n, r), i = Math.min(e, n, r), o = (s + i) / 2;
  7653. let a, u;
  7654. if (s === i)
  7655. a = u = 0;
  7656. else {
  7657. const l = s - i;
  7658. switch (u = o > 0.5 ? l / (2 - s - i) : l / (s + i), s) {
  7659. case e:
  7660. a = (n - r) / l + (n < r ? 6 : 0);
  7661. break;
  7662. case n:
  7663. a = (r - e) / l + 2;
  7664. break;
  7665. default:
  7666. a = (e - n) / l + 4;
  7667. break;
  7668. }
  7669. a /= 6;
  7670. }
  7671. const c = {
  7672. h: Math.round(a * 360),
  7673. s: Math.round(u * 100),
  7674. l: Math.round(o * 100)
  7675. };
  7676. return t.a !== void 0 && (c.a = t.a), c;
  7677. };
  7678. var wg = (t) => {
  7679. let { r: e, g: n, b: r } = t;
  7680. e /= 255, n /= 255, r /= 255;
  7681. const s = Math.max(e, n, r), i = Math.min(e, n, r);
  7682. let o;
  7683. const a = s, u = s - i, c = s === 0 ? 0 : u / s;
  7684. if (s === i)
  7685. o = 0;
  7686. else {
  7687. switch (s) {
  7688. case e:
  7689. o = (n - r) / u + (n < r ? 6 : 0);
  7690. break;
  7691. case n:
  7692. o = (r - e) / u + 2;
  7693. break;
  7694. default:
  7695. o = (e - n) / u + 4;
  7696. break;
  7697. }
  7698. o /= 6;
  7699. }
  7700. const l = {
  7701. h: Math.round(o * 360),
  7702. s: Math.round(c * 100),
  7703. v: Math.round(a * 100)
  7704. };
  7705. return t.a !== void 0 && (l.a = t.a), l;
  7706. };
  7707. var Og = (t) => t == null;
  7708. var bg = (t) => !Og(t) && typeof t == "object";
  7709. function hC(t) {
  7710. const e = /^#(?:[0]{3}|[0]{6})\b/, n = /^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/, r = /^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/, s = /^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/, i = /^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;
  7711. return !!(e.test(t) || n.test(t) || r.test(t) || s.test(t) || i.test(t));
  7712. }
  7713. function dC(t) {
  7714. const e = /^#(?:[Ff]{3}|[Ff]{6})\b/, n = /^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/, r = /^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/, s = /^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/, i = /^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;
  7715. return !!(e.test(t) || n.test(t) || r.test(t) || s.test(t) || i.test(t));
  7716. }
  7717. var Pe = ((t) => (t[t.COVER = 0] = "COVER", t[t.REPLACE = 1] = "REPLACE", t))(Pe || {});
  7718. function fC(t) {
  7719. return t && (t.s !== void 0 || t.p !== void 0 || t.v !== void 0 || t.t !== void 0 || t.f !== void 0 || t.si !== void 0 || t.custom !== void 0);
  7720. }
  7721. function gC(t) {
  7722. if (t.t !== void 0)
  7723. return t.t;
  7724. if (typeof t.v == "string")
  7725. return dn.STRING;
  7726. if (typeof t.v == "number")
  7727. return dn.NUMBER;
  7728. if (typeof t.v == "boolean")
  7729. return dn.BOOLEAN;
  7730. }
  7731. function pC(t) {
  7732. if (t == null)
  7733. return true;
  7734. const { v: e, f: n, si: r, p: s, custom: i } = t;
  7735. return !(!(e == null || typeof e == "string" && e.length === 0) || n != null && n.length > 0 || r != null && r.length > 0 || s != null || i != null);
  7736. }
  7737. function mC(t) {
  7738. return t != null && (typeof t == "string" || typeof t == "number" || typeof t == "boolean");
  7739. }
  7740. var De = ((t) => (t[t.NORMAL = 0] = "NORMAL", t[t.ROW = 1] = "ROW", t[t.COLUMN = 2] = "COLUMN", t[t.ALL = 3] = "ALL", t))(De || {});
  7741. var tt = ((t) => (t[t.NONE = 0] = "NONE", t[t.ROW = 1] = "ROW", t[t.COLUMN = 2] = "COLUMN", t[t.ALL = 3] = "ALL", t))(tt || {});
  7742. function _C(t) {
  7743. return [t.startRow, t.startColumn, t.endRow, t.endColumn];
  7744. }
  7745. var Sg = ((t) => (t.NONE = "none", t.BACKWARD = "backward", t.FORWARD = "forward", t))(Sg || {});
  7746. var Ag = ((t) => (t.RECT = "RECT", t.TEXT = "TEXT", t))(Ag || {});
  7747. function EC(t, e, n) {
  7748. let r = false, s = false, i = t, o = e, a = t, u = e;
  7749. if (n == null)
  7750. return {
  7751. actualRow: t,
  7752. actualColumn: e,
  7753. isMergedMainCell: s,
  7754. isMerged: r,
  7755. endRow: i,
  7756. endColumn: o,
  7757. startRow: a,
  7758. startColumn: u
  7759. };
  7760. for (let c = 0; c < n.length; c++) {
  7761. const {
  7762. startRow: l,
  7763. endRow: h,
  7764. startColumn: d,
  7765. endColumn: f
  7766. } = n[c];
  7767. if (t === l && e === d) {
  7768. i = h, o = f, a = l, u = d, s = true;
  7769. break;
  7770. }
  7771. if (t >= l && t <= h && e >= d && e <= f) {
  7772. i = h, o = f, a = l, u = d, r = true;
  7773. break;
  7774. }
  7775. }
  7776. return {
  7777. actualRow: t,
  7778. actualColumn: e,
  7779. isMergedMainCell: s,
  7780. isMerged: r,
  7781. endRow: i,
  7782. endColumn: o,
  7783. startRow: a,
  7784. startColumn: u
  7785. };
  7786. }
  7787. var zn = ((t) => (t.Raw = "raw", t.Intercepted = "intercepted", t.Both = "both", t))(zn || {});
  7788. function Ng(t) {
  7789. const { actualRow: e, actualColumn: n, isMerged: r, isMergedMainCell: s, mergeInfo: i } = t;
  7790. let { startY: o, endY: a, startX: u, endX: c } = t, l = e, h = n, d = e, f = n;
  7791. if (r && i) {
  7792. const {
  7793. startRow: E,
  7794. startColumn: R,
  7795. endRow: O,
  7796. endColumn: U,
  7797. startY: ne,
  7798. endY: X,
  7799. startX: de,
  7800. endX: T
  7801. } = i;
  7802. l = E, h = R, d = O, f = U, o = ne, a = X, u = de, c = T;
  7803. }
  7804. return s && (o = i.startY, a = i.endY, u = i.startX, c = i.endX, d = i.endRow, f = i.endColumn), {
  7805. startRow: l,
  7806. startColumn: h,
  7807. endRow: d,
  7808. endColumn: f,
  7809. startY: o,
  7810. endY: a,
  7811. startX: u,
  7812. endX: c
  7813. };
  7814. }
  7815. var CC = Ng;
  7816. function RC(t) {
  7817. if (!t)
  7818. return;
  7819. const {
  7820. actualRow: e,
  7821. actualColumn: n,
  7822. isMerged: r,
  7823. isMergedMainCell: s,
  7824. startRow: i,
  7825. startColumn: o,
  7826. endRow: a,
  7827. endColumn: u
  7828. } = t;
  7829. let c = e, l = n, h = e, d = n;
  7830. return (r || s) && (c = i, l = o, h = a, d = u), {
  7831. startRow: c,
  7832. startColumn: l,
  7833. endRow: h,
  7834. endColumn: d
  7835. };
  7836. }
  7837. function Tg(t) {
  7838. var n;
  7839. return !t || (((n = t == null ? void 0 : t.v) == null ? void 0 : n.toString()) || "").length === 0 && !t.p;
  7840. }
  7841. function IC(t) {
  7842. return Tg(t) && (t == null ? void 0 : t.coverable) !== false;
  7843. }
  7844. function Lt(t) {
  7845. if (t) {
  7846. if (t.rgb)
  7847. return t.rgb;
  7848. if (t.th)
  7849. return new gs().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString();
  7850. }
  7851. return null;
  7852. }
  7853. function vC(t) {
  7854. return re.isString(t) && t.substring(0, 1) === "=" && t.length > 1;
  7855. }
  7856. function yC(t) {
  7857. return re.isString(t) && t.length > 0;
  7858. }
  7859. function wC(t, e = false) {
  7860. var i;
  7861. let n = "";
  7862. const r = /* @__PURE__ */ new Map([
  7863. [
  7864. "ff",
  7865. () => {
  7866. t.ff && (n += `font-family: ${t.ff}; `);
  7867. }
  7868. ],
  7869. [
  7870. "fs",
  7871. () => {
  7872. if (t.fs) {
  7873. let o = t.fs;
  7874. t.va && (o /= 2), n += `font-size: ${o}pt; `;
  7875. }
  7876. }
  7877. ],
  7878. [
  7879. "it",
  7880. () => {
  7881. t.it && (n += "font-style: italic; ");
  7882. }
  7883. ],
  7884. [
  7885. "bl",
  7886. () => {
  7887. t.bl && (n += "font-weight: bold; ");
  7888. }
  7889. ],
  7890. [
  7891. "ul",
  7892. () => {
  7893. var o;
  7894. (o = t.ul) != null && o.s && (n.indexOf("text-decoration-line") > -1 ? n = n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (a, u) => `${u} underline`) : n += "text-decoration: underline; ", t.ul.cl && n.indexOf("text-decoration-color") === -1 && (n += `text-decoration-color: ${Lt(t.ul.cl)}; `), t.ul.t && n.indexOf("text-decoration-style") === -1 && (n += `text-decoration-style: ${t.ul.t} `));
  7895. }
  7896. ],
  7897. [
  7898. "st",
  7899. () => {
  7900. var o;
  7901. (o = t.st) != null && o.s && (n.indexOf("text-decoration-line") > -1 ? n = n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (a, u) => `${u} line-through`) : n += "text-decoration-line: line-through; ", t.st.cl && n.indexOf("text-decoration-color") === -1 && (n += `text-decoration-color: ${Lt(t.st.cl)}; `), t.st.t && n.indexOf("text-decoration-style") === -1 && (n += `text-decoration-style: ${t.st.t} `));
  7902. }
  7903. ],
  7904. [
  7905. "ol",
  7906. () => {
  7907. var o;
  7908. (o = t.ol) != null && o.s && (n.indexOf("text-decoration-line") > -1 ? n = n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (a, u) => `${u} overline`) : n += "text-decoration-line: overline; ", t.ol.cl && n.indexOf("text-decoration-color") === -1 && (n += `text-decoration-color: ${Lt(t.ol.cl)}; `), t.ol.t && n.indexOf("text-decoration-style") === -1 && (n += `text-decoration-style: ${t.ol.t} `));
  7909. }
  7910. ],
  7911. [
  7912. "bg",
  7913. () => {
  7914. t.bg && (n += `background: ${Lt(t.bg)}; `);
  7915. }
  7916. ],
  7917. [
  7918. "bd",
  7919. () => {
  7920. var o, a, u, c, l, h, d, f, E, R, O, U;
  7921. (o = t.bd) != null && o.b && (n += `border-bottom: ${Er((a = t.bd) == null ? void 0 : a.b.s)} ${(u = Lt(t.bd.b.cl)) != null ? u : ""}; `), (c = t.bd) != null && c.t && (n += `border-top: ${Er((l = t.bd) == null ? void 0 : l.t.s)} ${(h = Lt(t.bd.t.cl)) != null ? h : ""}; `), (d = t.bd) != null && d.r && (n += `border-right: ${Er((f = t.bd) == null ? void 0 : f.r.s)} ${(E = Lt(t.bd.r.cl)) != null ? E : ""}; `), (R = t.bd) != null && R.l && (n += `border-left: ${Er((O = t.bd) == null ? void 0 : O.l.s)} ${(U = Lt(t.bd.l.cl)) != null ? U : ""}; `);
  7922. }
  7923. ],
  7924. [
  7925. "cl",
  7926. () => {
  7927. t.cl && (n += `color: ${Lt(t.cl)}; `);
  7928. }
  7929. ],
  7930. [
  7931. "va",
  7932. () => {
  7933. t.va === Bt.SUBSCRIPT ? n += "vertical-align: sub; " : t.va === Bt.SUPERSCRIPT && (n += "vertical-align: super; ");
  7934. }
  7935. ],
  7936. [
  7937. "td",
  7938. () => {
  7939. t.td === er.LEFT_TO_RIGHT ? n += "direction: ltr; " : t.td === er.RIGHT_TO_LEFT && (n += "direction: rtl; ");
  7940. }
  7941. ],
  7942. [
  7943. "tr",
  7944. () => {
  7945. var o, a, u;
  7946. t.tr && (n += `--data-rotate: (${(o = t.tr) == null ? void 0 : o.a}deg${(a = t.tr) != null && a.v ? ` ,${(u = t.tr) == null ? void 0 : u.v}` : ""});`);
  7947. }
  7948. ],
  7949. [
  7950. "ht",
  7951. () => {
  7952. t.ht === Xt.LEFT ? n += "text-align: left; " : t.ht === Xt.RIGHT ? n += "text-align: right; " : t.ht === Xt.CENTER ? n += "text-align: center; " : t.ht === Xt.JUSTIFIED && (n += "text-align: justify; ");
  7953. }
  7954. ],
  7955. [
  7956. "vt",
  7957. () => {
  7958. t.vt === hn.BOTTOM ? n += "vertical-align: bottom; " : t.vt === hn.TOP ? n += "vertical-align: top; " : t.vt === hn.MIDDLE && (n += "vertical-align: middle; ");
  7959. }
  7960. ],
  7961. [
  7962. "tb",
  7963. () => {
  7964. t.tb === xn.CLIP ? n += "white-space: nowrap; overflow-x: hidden; " : t.tb === xn.WRAP && (n += "white-space: normal;");
  7965. }
  7966. ],
  7967. [
  7968. "pd",
  7969. () => {
  7970. var l, h, d, f, E, R, O, U;
  7971. const o = `${(l = t.pd) == null ? void 0 : l.b}pt`, a = `${(h = t.pd) == null ? void 0 : h.t}pt`, u = `${(d = t.pd) == null ? void 0 : d.l}pt`, c = `${(f = t.pd) == null ? void 0 : f.r}pt`;
  7972. (E = t.pd) != null && E.b && (n += `padding-bottom: ${o}; `), (R = t.pd) != null && R.t && (n += `padding-top: ${a}; `), (O = t.pd) != null && O.l && (n += `padding-left: ${u}; `), (U = t.pd) != null && U.r && (n += `padding-right: ${c}; `);
  7973. }
  7974. ]
  7975. ]), s = ["bd", "tr", "tb"];
  7976. for (const o in t)
  7977. e && s.includes(o) || (i = r.get(o)) == null || i();
  7978. return n;
  7979. }
  7980. function Er(t) {
  7981. let e = "";
  7982. return t === Xe.NONE ? e = "none" : t === Xe.THIN ? e = "0.5pt solid" : t === Xe.HAIR ? e = "0.5pt double" : t === Xe.DOTTED ? e = "0.5pt dotted" : t === Xe.DASHED || t === Xe.DASH_DOT ? e = "0.5pt dashed" : t === Xe.DASH_DOT_DOT ? e = "0.5pt dotted" : t === Xe.DOUBLE ? e = "0.5pt double" : t === Xe.MEDIUM ? e = "1pt solid" : t === Xe.MEDIUM_DASHED || t === Xe.MEDIUM_DASH_DOT ? e = "1pt dashed" : t === Xe.MEDIUM_DASH_DOT_DOT ? e = "1pt dotted" : t === Xe.SLANT_DASH_DOT ? e = "0.5pt dashed" : t === Xe.THICK && (e = "1.5pt solid"), e;
  7983. }
  7984. function OC(t) {
  7985. let e = 0;
  7986. if (t = t.trim(), t === "none")
  7987. e = Xe.NONE;
  7988. else if (t === "0.5pt solid")
  7989. e = Xe.THIN;
  7990. else if (t === "0.5pt double")
  7991. e = Xe.HAIR;
  7992. else if (t === "0.5pt dotted")
  7993. e = Xe.DOTTED;
  7994. else if (t === "0.5pt dashed")
  7995. e = Xe.DASHED;
  7996. else if (t === "1pt solid")
  7997. e = Xe.MEDIUM;
  7998. else if (t === "1pt dashed")
  7999. e = Xe.MEDIUM_DASHED;
  8000. else if (t === "1pt dotted")
  8001. e = Xe.MEDIUM_DASH_DOT_DOT;
  8002. else if (t === "1.5pt solid")
  8003. e = Xe.THICK;
  8004. else if (!t.includes("none"))
  8005. e = Xe.THIN;
  8006. else
  8007. return Xe.NONE;
  8008. return e;
  8009. }
  8010. function bC(t, e) {
  8011. let n = t.body;
  8012. if (e) {
  8013. const { headers: r, footers: s } = t;
  8014. r != null && r[e] ? n = r[e].body : s != null && s[e] && (n = s[e].body);
  8015. }
  8016. return n;
  8017. }
  8018. function SC(t, e) {
  8019. const { startRow: n, endRow: r, startColumn: s, endColumn: i, rangeType: o } = t;
  8020. if (n < 0 || s < 0 || r < 0 || i < 0 || !(Number.isNaN(n) && Number.isNaN(r)) && o === De.COLUMN || !(Number.isNaN(s) && Number.isNaN(i)) && o === De.ROW || o !== De.ROW && o !== De.COLUMN && (Number.isNaN(s) || Number.isNaN(n) || Number.isNaN(i) || Number.isNaN(r)))
  8021. return false;
  8022. if (e) {
  8023. const a = e.getRowCount(), u = e.getColumnCount();
  8024. if (r >= a || i >= u)
  8025. return false;
  8026. }
  8027. return true;
  8028. }
  8029. function AC(t, e) {
  8030. return { startRow: t, endRow: t, startColumn: e, endColumn: e };
  8031. }
  8032. function Lu(t, e) {
  8033. return Object.prototype.toString.call(t) === Object.prototype.toString.call(e) ? Object.prototype.toString.call(t) === "[object Object]" || Object.prototype.toString.call(t) === "[object Array]" ? Object.keys(t).length !== Object.keys(e).length ? false : Object.keys(t).every((n) => Lu(t[n], e[n])) : t === e : false;
  8034. }
  8035. function Mg(t, e) {
  8036. const n = t.ts || {}, r = e.ts || {};
  8037. return t.sId !== e.sId ? false : Lu(n, r);
  8038. }
  8039. function NC(t, e) {
  8040. return e.some((n) => t.indexOf(n) > -1);
  8041. }
  8042. var Pr = { exports: {} };
  8043. var Dg = Pr.exports;
  8044. var Lo;
  8045. function xg() {
  8046. return Lo || (Lo = 1, function(t, e) {
  8047. (function(n, r) {
  8048. t.exports = r();
  8049. })(Dg, function() {
  8050. var n = 1e3, r = 6e4, s = 36e5, i = "millisecond", o = "second", a = "minute", u = "hour", c = "day", l = "week", h = "month", d = "quarter", f = "year", E = "date", R = "Invalid Date", O = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, U = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, ne = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(M) {
  8051. var b = ["th", "st", "nd", "rd"], w = M % 100;
  8052. return "[" + M + (b[(w - 20) % 10] || b[w] || b[0]) + "]";
  8053. } }, X = function(M, b, w) {
  8054. var k = String(M);
  8055. return !k || k.length >= b ? M : "" + Array(b + 1 - k.length).join(w) + M;
  8056. }, de = { s: X, z: function(M) {
  8057. var b = -M.utcOffset(), w = Math.abs(b), k = Math.floor(w / 60), $ = w % 60;
  8058. return (b <= 0 ? "+" : "-") + X(k, 2, "0") + ":" + X($, 2, "0");
  8059. }, m: function M(b, w) {
  8060. if (b.date() < w.date())
  8061. return -M(w, b);
  8062. var k = 12 * (w.year() - b.year()) + (w.month() - b.month()), $ = b.clone().add(k, h), Y = w - $ < 0, se = b.clone().add(k + (Y ? -1 : 1), h);
  8063. return +(-(k + (w - $) / (Y ? $ - se : se - $)) || 0);
  8064. }, a: function(M) {
  8065. return M < 0 ? Math.ceil(M) || 0 : Math.floor(M);
  8066. }, p: function(M) {
  8067. return { M: h, y: f, w: l, d: c, D: E, h: u, m: a, s: o, ms: i, Q: d }[M] || String(M || "").toLowerCase().replace(/s$/, "");
  8068. }, u: function(M) {
  8069. return M === void 0;
  8070. } }, T = "en", A = {};
  8071. A[T] = ne;
  8072. var H = "$isDayjsObject", Z = function(M) {
  8073. return M instanceof j || !(!M || !M[H]);
  8074. }, fe = function M(b, w, k) {
  8075. var $;
  8076. if (!b)
  8077. return T;
  8078. if (typeof b == "string") {
  8079. var Y = b.toLowerCase();
  8080. A[Y] && ($ = Y), w && (A[Y] = w, $ = Y);
  8081. var se = b.split("-");
  8082. if (!$ && se.length > 1)
  8083. return M(se[0]);
  8084. } else {
  8085. var he = b.name;
  8086. A[he] = b, $ = he;
  8087. }
  8088. return !k && $ && (T = $), $ || !k && T;
  8089. }, ae = function(M, b) {
  8090. if (Z(M))
  8091. return M.clone();
  8092. var w = typeof b == "object" ? b : {};
  8093. return w.date = M, w.args = arguments, new j(w);
  8094. }, m = de;
  8095. m.l = fe, m.i = Z, m.w = function(M, b) {
  8096. return ae(M, { locale: b.$L, utc: b.$u, x: b.$x, $offset: b.$offset });
  8097. };
  8098. var j = function() {
  8099. function M(w) {
  8100. this.$L = fe(w.locale, null, true), this.parse(w), this.$x = this.$x || w.x || {}, this[H] = true;
  8101. }
  8102. var b = M.prototype;
  8103. return b.parse = function(w) {
  8104. this.$d = function(k) {
  8105. var $ = k.date, Y = k.utc;
  8106. if ($ === null)
  8107. return /* @__PURE__ */ new Date(NaN);
  8108. if (m.u($))
  8109. return /* @__PURE__ */ new Date();
  8110. if ($ instanceof Date)
  8111. return new Date($);
  8112. if (typeof $ == "string" && !/Z$/i.test($)) {
  8113. var se = $.match(O);
  8114. if (se) {
  8115. var he = se[2] - 1 || 0, ge = (se[7] || "0").substring(0, 3);
  8116. return Y ? new Date(Date.UTC(se[1], he, se[3] || 1, se[4] || 0, se[5] || 0, se[6] || 0, ge)) : new Date(se[1], he, se[3] || 1, se[4] || 0, se[5] || 0, se[6] || 0, ge);
  8117. }
  8118. }
  8119. return new Date($);
  8120. }(w), this.init();
  8121. }, b.init = function() {
  8122. var w = this.$d;
  8123. this.$y = w.getFullYear(), this.$M = w.getMonth(), this.$D = w.getDate(), this.$W = w.getDay(), this.$H = w.getHours(), this.$m = w.getMinutes(), this.$s = w.getSeconds(), this.$ms = w.getMilliseconds();
  8124. }, b.$utils = function() {
  8125. return m;
  8126. }, b.isValid = function() {
  8127. return this.$d.toString() !== R;
  8128. }, b.isSame = function(w, k) {
  8129. var $ = ae(w);
  8130. return this.startOf(k) <= $ && $ <= this.endOf(k);
  8131. }, b.isAfter = function(w, k) {
  8132. return ae(w) < this.startOf(k);
  8133. }, b.isBefore = function(w, k) {
  8134. return this.endOf(k) < ae(w);
  8135. }, b.$g = function(w, k, $) {
  8136. return m.u(w) ? this[k] : this.set($, w);
  8137. }, b.unix = function() {
  8138. return Math.floor(this.valueOf() / 1e3);
  8139. }, b.valueOf = function() {
  8140. return this.$d.getTime();
  8141. }, b.startOf = function(w, k) {
  8142. var $ = this, Y = !!m.u(k) || k, se = m.p(w), he = function(z, W) {
  8143. var ue = m.w($.$u ? Date.UTC($.$y, W, z) : new Date($.$y, W, z), $);
  8144. return Y ? ue : ue.endOf(c);
  8145. }, ge = function(z, W) {
  8146. return m.w($.toDate()[z].apply($.toDate("s"), (Y ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(W)), $);
  8147. }, Ae = this.$W, be = this.$M, v = this.$D, F = "set" + (this.$u ? "UTC" : "");
  8148. switch (se) {
  8149. case f:
  8150. return Y ? he(1, 0) : he(31, 11);
  8151. case h:
  8152. return Y ? he(1, be) : he(0, be + 1);
  8153. case l:
  8154. var V = this.$locale().weekStart || 0, K = (Ae < V ? Ae + 7 : Ae) - V;
  8155. return he(Y ? v - K : v + (6 - K), be);
  8156. case c:
  8157. case E:
  8158. return ge(F + "Hours", 0);
  8159. case u:
  8160. return ge(F + "Minutes", 1);
  8161. case a:
  8162. return ge(F + "Seconds", 2);
  8163. case o:
  8164. return ge(F + "Milliseconds", 3);
  8165. default:
  8166. return this.clone();
  8167. }
  8168. }, b.endOf = function(w) {
  8169. return this.startOf(w, false);
  8170. }, b.$set = function(w, k) {
  8171. var $, Y = m.p(w), se = "set" + (this.$u ? "UTC" : ""), he = ($ = {}, $[c] = se + "Date", $[E] = se + "Date", $[h] = se + "Month", $[f] = se + "FullYear", $[u] = se + "Hours", $[a] = se + "Minutes", $[o] = se + "Seconds", $[i] = se + "Milliseconds", $)[Y], ge = Y === c ? this.$D + (k - this.$W) : k;
  8172. if (Y === h || Y === f) {
  8173. var Ae = this.clone().set(E, 1);
  8174. Ae.$d[he](ge), Ae.init(), this.$d = Ae.set(E, Math.min(this.$D, Ae.daysInMonth())).$d;
  8175. } else
  8176. he && this.$d[he](ge);
  8177. return this.init(), this;
  8178. }, b.set = function(w, k) {
  8179. return this.clone().$set(w, k);
  8180. }, b.get = function(w) {
  8181. return this[m.p(w)]();
  8182. }, b.add = function(w, k) {
  8183. var $, Y = this;
  8184. w = Number(w);
  8185. var se = m.p(k), he = function(be) {
  8186. var v = ae(Y);
  8187. return m.w(v.date(v.date() + Math.round(be * w)), Y);
  8188. };
  8189. if (se === h)
  8190. return this.set(h, this.$M + w);
  8191. if (se === f)
  8192. return this.set(f, this.$y + w);
  8193. if (se === c)
  8194. return he(1);
  8195. if (se === l)
  8196. return he(7);
  8197. var ge = ($ = {}, $[a] = r, $[u] = s, $[o] = n, $)[se] || 1, Ae = this.$d.getTime() + w * ge;
  8198. return m.w(Ae, this);
  8199. }, b.subtract = function(w, k) {
  8200. return this.add(-1 * w, k);
  8201. }, b.format = function(w) {
  8202. var k = this, $ = this.$locale();
  8203. if (!this.isValid())
  8204. return $.invalidDate || R;
  8205. var Y = w || "YYYY-MM-DDTHH:mm:ssZ", se = m.z(this), he = this.$H, ge = this.$m, Ae = this.$M, be = $.weekdays, v = $.months, F = $.meridiem, V = function(W, ue, oe, B) {
  8206. return W && (W[ue] || W(k, Y)) || oe[ue].slice(0, B);
  8207. }, K = function(W) {
  8208. return m.s(he % 12 || 12, W, "0");
  8209. }, z = F || function(W, ue, oe) {
  8210. var B = W < 12 ? "AM" : "PM";
  8211. return oe ? B.toLowerCase() : B;
  8212. };
  8213. return Y.replace(U, function(W, ue) {
  8214. return ue || function(oe) {
  8215. switch (oe) {
  8216. case "YY":
  8217. return String(k.$y).slice(-2);
  8218. case "YYYY":
  8219. return m.s(k.$y, 4, "0");
  8220. case "M":
  8221. return Ae + 1;
  8222. case "MM":
  8223. return m.s(Ae + 1, 2, "0");
  8224. case "MMM":
  8225. return V($.monthsShort, Ae, v, 3);
  8226. case "MMMM":
  8227. return V(v, Ae);
  8228. case "D":
  8229. return k.$D;
  8230. case "DD":
  8231. return m.s(k.$D, 2, "0");
  8232. case "d":
  8233. return String(k.$W);
  8234. case "dd":
  8235. return V($.weekdaysMin, k.$W, be, 2);
  8236. case "ddd":
  8237. return V($.weekdaysShort, k.$W, be, 3);
  8238. case "dddd":
  8239. return be[k.$W];
  8240. case "H":
  8241. return String(he);
  8242. case "HH":
  8243. return m.s(he, 2, "0");
  8244. case "h":
  8245. return K(1);
  8246. case "hh":
  8247. return K(2);
  8248. case "a":
  8249. return z(he, ge, true);
  8250. case "A":
  8251. return z(he, ge, false);
  8252. case "m":
  8253. return String(ge);
  8254. case "mm":
  8255. return m.s(ge, 2, "0");
  8256. case "s":
  8257. return String(k.$s);
  8258. case "ss":
  8259. return m.s(k.$s, 2, "0");
  8260. case "SSS":
  8261. return m.s(k.$ms, 3, "0");
  8262. case "Z":
  8263. return se;
  8264. }
  8265. return null;
  8266. }(W) || se.replace(":", "");
  8267. });
  8268. }, b.utcOffset = function() {
  8269. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  8270. }, b.diff = function(w, k, $) {
  8271. var Y, se = this, he = m.p(k), ge = ae(w), Ae = (ge.utcOffset() - this.utcOffset()) * r, be = this - ge, v = function() {
  8272. return m.m(se, ge);
  8273. };
  8274. switch (he) {
  8275. case f:
  8276. Y = v() / 12;
  8277. break;
  8278. case h:
  8279. Y = v();
  8280. break;
  8281. case d:
  8282. Y = v() / 3;
  8283. break;
  8284. case l:
  8285. Y = (be - Ae) / 6048e5;
  8286. break;
  8287. case c:
  8288. Y = (be - Ae) / 864e5;
  8289. break;
  8290. case u:
  8291. Y = be / s;
  8292. break;
  8293. case a:
  8294. Y = be / r;
  8295. break;
  8296. case o:
  8297. Y = be / n;
  8298. break;
  8299. default:
  8300. Y = be;
  8301. }
  8302. return $ ? Y : m.a(Y);
  8303. }, b.daysInMonth = function() {
  8304. return this.endOf(h).$D;
  8305. }, b.$locale = function() {
  8306. return A[this.$L];
  8307. }, b.locale = function(w, k) {
  8308. if (!w)
  8309. return this.$L;
  8310. var $ = this.clone(), Y = fe(w, k, true);
  8311. return Y && ($.$L = Y), $;
  8312. }, b.clone = function() {
  8313. return m.w(this.$d, this);
  8314. }, b.toDate = function() {
  8315. return new Date(this.valueOf());
  8316. }, b.toJSON = function() {
  8317. return this.isValid() ? this.toISOString() : null;
  8318. }, b.toISOString = function() {
  8319. return this.$d.toISOString();
  8320. }, b.toString = function() {
  8321. return this.$d.toUTCString();
  8322. }, M;
  8323. }(), y = j.prototype;
  8324. return ae.prototype = y, [["$ms", i], ["$s", o], ["$m", a], ["$H", u], ["$W", c], ["$M", h], ["$y", f], ["$D", E]].forEach(function(M) {
  8325. y[M[1]] = function(b) {
  8326. return this.$g(b, M[0], M[1]);
  8327. };
  8328. }), ae.extend = function(M, b) {
  8329. return M.$i || (M(b, j, ae), M.$i = true), ae;
  8330. }, ae.locale = fe, ae.isDayjs = Z, ae.unix = function(M) {
  8331. return ae(1e3 * M);
  8332. }, ae.en = A[T], ae.Ls = A, ae.p = {}, ae;
  8333. });
  8334. }(Pr)), Pr.exports;
  8335. }
  8336. var Lg = xg();
  8337. var rn = wt(Lg);
  8338. var kr = { exports: {} };
  8339. var Ug = kr.exports;
  8340. var Uo;
  8341. function Pg() {
  8342. return Uo || (Uo = 1, function(t, e) {
  8343. (function(n, r) {
  8344. t.exports = r();
  8345. })(Ug, function() {
  8346. return function(n, r) {
  8347. var s = r.prototype, i = s.format;
  8348. s.format = function(o) {
  8349. var a = this, u = this.$locale();
  8350. if (!this.isValid())
  8351. return i.bind(this)(o);
  8352. var c = this.$utils(), l = (o || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(h) {
  8353. switch (h) {
  8354. case "Q":
  8355. return Math.ceil((a.$M + 1) / 3);
  8356. case "Do":
  8357. return u.ordinal(a.$D);
  8358. case "gggg":
  8359. return a.weekYear();
  8360. case "GGGG":
  8361. return a.isoWeekYear();
  8362. case "wo":
  8363. return u.ordinal(a.week(), "W");
  8364. case "w":
  8365. case "ww":
  8366. return c.s(a.week(), h === "w" ? 1 : 2, "0");
  8367. case "W":
  8368. case "WW":
  8369. return c.s(a.isoWeek(), h === "W" ? 1 : 2, "0");
  8370. case "k":
  8371. case "kk":
  8372. return c.s(String(a.$H === 0 ? 24 : a.$H), h === "k" ? 1 : 2, "0");
  8373. case "X":
  8374. return Math.floor(a.$d.getTime() / 1e3);
  8375. case "x":
  8376. return a.$d.getTime();
  8377. case "z":
  8378. return "[" + a.offsetName() + "]";
  8379. case "zzz":
  8380. return "[" + a.offsetName("long") + "]";
  8381. default:
  8382. return h;
  8383. }
  8384. });
  8385. return i.bind(this)(l);
  8386. };
  8387. };
  8388. });
  8389. }(kr)), kr.exports;
  8390. }
  8391. var kg = Pg();
  8392. var Fg = wt(kg);
  8393. var Fr = { exports: {} };
  8394. var $g = Fr.exports;
  8395. var Po;
  8396. function Bg() {
  8397. return Po || (Po = 1, function(t, e) {
  8398. (function(n, r) {
  8399. t.exports = r();
  8400. })($g, function() {
  8401. var n = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, r = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, s = /\d/, i = /\d\d/, o = /\d\d?/, a = /\d*[^-_:/,()\s\d]+/, u = {}, c = function(O) {
  8402. return (O = +O) + (O > 68 ? 1900 : 2e3);
  8403. }, l = function(O) {
  8404. return function(U) {
  8405. this[O] = +U;
  8406. };
  8407. }, h = [/[+-]\d\d:?(\d\d)?|Z/, function(O) {
  8408. (this.zone || (this.zone = {})).offset = function(U) {
  8409. if (!U || U === "Z")
  8410. return 0;
  8411. var ne = U.match(/([+-]|\d\d)/g), X = 60 * ne[1] + (+ne[2] || 0);
  8412. return X === 0 ? 0 : ne[0] === "+" ? -X : X;
  8413. }(O);
  8414. }], d = function(O) {
  8415. var U = u[O];
  8416. return U && (U.indexOf ? U : U.s.concat(U.f));
  8417. }, f = function(O, U) {
  8418. var ne, X = u.meridiem;
  8419. if (X) {
  8420. for (var de = 1; de <= 24; de += 1)
  8421. if (O.indexOf(X(de, 0, U)) > -1) {
  8422. ne = de > 12;
  8423. break;
  8424. }
  8425. } else
  8426. ne = O === (U ? "pm" : "PM");
  8427. return ne;
  8428. }, E = { A: [a, function(O) {
  8429. this.afternoon = f(O, false);
  8430. }], a: [a, function(O) {
  8431. this.afternoon = f(O, true);
  8432. }], Q: [s, function(O) {
  8433. this.month = 3 * (O - 1) + 1;
  8434. }], S: [s, function(O) {
  8435. this.milliseconds = 100 * +O;
  8436. }], SS: [i, function(O) {
  8437. this.milliseconds = 10 * +O;
  8438. }], SSS: [/\d{3}/, function(O) {
  8439. this.milliseconds = +O;
  8440. }], s: [o, l("seconds")], ss: [o, l("seconds")], m: [o, l("minutes")], mm: [o, l("minutes")], H: [o, l("hours")], h: [o, l("hours")], HH: [o, l("hours")], hh: [o, l("hours")], D: [o, l("day")], DD: [i, l("day")], Do: [a, function(O) {
  8441. var U = u.ordinal, ne = O.match(/\d+/);
  8442. if (this.day = ne[0], U)
  8443. for (var X = 1; X <= 31; X += 1)
  8444. U(X).replace(/\[|\]/g, "") === O && (this.day = X);
  8445. }], w: [o, l("week")], ww: [i, l("week")], M: [o, l("month")], MM: [i, l("month")], MMM: [a, function(O) {
  8446. var U = d("months"), ne = (d("monthsShort") || U.map(function(X) {
  8447. return X.slice(0, 3);
  8448. })).indexOf(O) + 1;
  8449. if (ne < 1)
  8450. throw new Error();
  8451. this.month = ne % 12 || ne;
  8452. }], MMMM: [a, function(O) {
  8453. var U = d("months").indexOf(O) + 1;
  8454. if (U < 1)
  8455. throw new Error();
  8456. this.month = U % 12 || U;
  8457. }], Y: [/[+-]?\d+/, l("year")], YY: [i, function(O) {
  8458. this.year = c(O);
  8459. }], YYYY: [/\d{4}/, l("year")], Z: h, ZZ: h };
  8460. function R(O) {
  8461. var U, ne;
  8462. U = O, ne = u && u.formats;
  8463. for (var X = (O = U.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(ae, m, j) {
  8464. var y = j && j.toUpperCase();
  8465. return m || ne[j] || n[j] || ne[y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(M, b, w) {
  8466. return b || w.slice(1);
  8467. });
  8468. })).match(r), de = X.length, T = 0; T < de; T += 1) {
  8469. var A = X[T], H = E[A], Z = H && H[0], fe = H && H[1];
  8470. X[T] = fe ? { regex: Z, parser: fe } : A.replace(/^\[|\]$/g, "");
  8471. }
  8472. return function(ae) {
  8473. for (var m = {}, j = 0, y = 0; j < de; j += 1) {
  8474. var M = X[j];
  8475. if (typeof M == "string")
  8476. y += M.length;
  8477. else {
  8478. var b = M.regex, w = M.parser, k = ae.slice(y), $ = b.exec(k)[0];
  8479. w.call(m, $), ae = ae.replace($, "");
  8480. }
  8481. }
  8482. return function(Y) {
  8483. var se = Y.afternoon;
  8484. if (se !== void 0) {
  8485. var he = Y.hours;
  8486. se ? he < 12 && (Y.hours += 12) : he === 12 && (Y.hours = 0), delete Y.afternoon;
  8487. }
  8488. }(m), m;
  8489. };
  8490. }
  8491. return function(O, U, ne) {
  8492. ne.p.customParseFormat = true, O && O.parseTwoDigitYear && (c = O.parseTwoDigitYear);
  8493. var X = U.prototype, de = X.parse;
  8494. X.parse = function(T) {
  8495. var A = T.date, H = T.utc, Z = T.args;
  8496. this.$u = H;
  8497. var fe = Z[1];
  8498. if (typeof fe == "string") {
  8499. var ae = Z[2] === true, m = Z[3] === true, j = ae || m, y = Z[2];
  8500. m && (y = Z[2]), u = this.$locale(), !ae && y && (u = ne.Ls[y]), this.$d = function(k, $, Y, se) {
  8501. try {
  8502. if (["x", "X"].indexOf($) > -1)
  8503. return new Date(($ === "X" ? 1e3 : 1) * k);
  8504. var he = R($)(k), ge = he.year, Ae = he.month, be = he.day, v = he.hours, F = he.minutes, V = he.seconds, K = he.milliseconds, z = he.zone, W = he.week, ue = /* @__PURE__ */ new Date(), oe = be || (ge || Ae ? 1 : ue.getDate()), B = ge || ue.getFullYear(), ee = 0;
  8505. ge && !Ae || (ee = Ae > 0 ? Ae - 1 : ue.getMonth());
  8506. var ie, pe = v || 0, Oe = F || 0, Me = V || 0, G = K || 0;
  8507. return z ? new Date(Date.UTC(B, ee, oe, pe, Oe, Me, G + 60 * z.offset * 1e3)) : Y ? new Date(Date.UTC(B, ee, oe, pe, Oe, Me, G)) : (ie = new Date(B, ee, oe, pe, Oe, Me, G), W && (ie = se(ie).week(W).toDate()), ie);
  8508. } catch {
  8509. return /* @__PURE__ */ new Date("");
  8510. }
  8511. }(A, fe, H, ne), this.init(), y && y !== true && (this.$L = this.locale(y).$L), j && A != this.format(fe) && (this.$d = /* @__PURE__ */ new Date("")), u = {};
  8512. } else if (fe instanceof Array)
  8513. for (var M = fe.length, b = 1; b <= M; b += 1) {
  8514. Z[1] = fe[b - 1];
  8515. var w = ne.apply(this, Z);
  8516. if (w.isValid()) {
  8517. this.$d = w.$d, this.$L = w.$L, this.init();
  8518. break;
  8519. }
  8520. b === M && (this.$d = /* @__PURE__ */ new Date(""));
  8521. }
  8522. else
  8523. de.call(this, T);
  8524. };
  8525. };
  8526. });
  8527. }(Fr)), Fr.exports;
  8528. }
  8529. var jg = Bg();
  8530. var Hg = wt(jg);
  8531. var $r = { exports: {} };
  8532. var Wg = $r.exports;
  8533. var ko;
  8534. function zg() {
  8535. return ko || (ko = 1, function(t, e) {
  8536. (function(n, r) {
  8537. t.exports = r();
  8538. })(Wg, function() {
  8539. return function(n, r, s) {
  8540. var i = r.prototype, o = function(h) {
  8541. return h && (h.indexOf ? h : h.s);
  8542. }, a = function(h, d, f, E, R) {
  8543. var O = h.name ? h : h.$locale(), U = o(O[d]), ne = o(O[f]), X = U || ne.map(function(T) {
  8544. return T.slice(0, E);
  8545. });
  8546. if (!R)
  8547. return X;
  8548. var de = O.weekStart;
  8549. return X.map(function(T, A) {
  8550. return X[(A + (de || 0)) % 7];
  8551. });
  8552. }, u = function() {
  8553. return s.Ls[s.locale()];
  8554. }, c = function(h, d) {
  8555. return h.formats[d] || function(f) {
  8556. return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(E, R, O) {
  8557. return R || O.slice(1);
  8558. });
  8559. }(h.formats[d.toUpperCase()]);
  8560. }, l = function() {
  8561. var h = this;
  8562. return { months: function(d) {
  8563. return d ? d.format("MMMM") : a(h, "months");
  8564. }, monthsShort: function(d) {
  8565. return d ? d.format("MMM") : a(h, "monthsShort", "months", 3);
  8566. }, firstDayOfWeek: function() {
  8567. return h.$locale().weekStart || 0;
  8568. }, weekdays: function(d) {
  8569. return d ? d.format("dddd") : a(h, "weekdays");
  8570. }, weekdaysMin: function(d) {
  8571. return d ? d.format("dd") : a(h, "weekdaysMin", "weekdays", 2);
  8572. }, weekdaysShort: function(d) {
  8573. return d ? d.format("ddd") : a(h, "weekdaysShort", "weekdays", 3);
  8574. }, longDateFormat: function(d) {
  8575. return c(h.$locale(), d);
  8576. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  8577. };
  8578. i.localeData = function() {
  8579. return l.bind(this)();
  8580. }, s.localeData = function() {
  8581. var h = u();
  8582. return { firstDayOfWeek: function() {
  8583. return h.weekStart || 0;
  8584. }, weekdays: function() {
  8585. return s.weekdays();
  8586. }, weekdaysShort: function() {
  8587. return s.weekdaysShort();
  8588. }, weekdaysMin: function() {
  8589. return s.weekdaysMin();
  8590. }, months: function() {
  8591. return s.months();
  8592. }, monthsShort: function() {
  8593. return s.monthsShort();
  8594. }, longDateFormat: function(d) {
  8595. return c(h, d);
  8596. }, meridiem: h.meridiem, ordinal: h.ordinal };
  8597. }, s.months = function() {
  8598. return a(u(), "months");
  8599. }, s.monthsShort = function() {
  8600. return a(u(), "monthsShort", "months", 3);
  8601. }, s.weekdays = function(h) {
  8602. return a(u(), "weekdays", null, null, h);
  8603. }, s.weekdaysShort = function(h) {
  8604. return a(u(), "weekdaysShort", "weekdays", 3, h);
  8605. }, s.weekdaysMin = function(h) {
  8606. return a(u(), "weekdaysMin", "weekdays", 2, h);
  8607. };
  8608. };
  8609. });
  8610. }($r)), $r.exports;
  8611. }
  8612. var Yg = zg();
  8613. var Vg = wt(Yg);
  8614. var Br = { exports: {} };
  8615. var Gg = Br.exports;
  8616. var Fo;
  8617. function Kg() {
  8618. return Fo || (Fo = 1, function(t, e) {
  8619. (function(n, r) {
  8620. t.exports = r();
  8621. })(Gg, function() {
  8622. var n = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" };
  8623. return function(r, s, i) {
  8624. var o = s.prototype, a = o.format;
  8625. i.en.formats = n, o.format = function(u) {
  8626. u === void 0 && (u = "YYYY-MM-DDTHH:mm:ssZ");
  8627. var c = this.$locale().formats, l = function(h, d) {
  8628. return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(f, E, R) {
  8629. var O = R && R.toUpperCase();
  8630. return E || d[R] || n[R] || d[O].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(U, ne, X) {
  8631. return ne || X.slice(1);
  8632. });
  8633. });
  8634. }(u, c === void 0 ? {} : c);
  8635. return a.call(this, l);
  8636. };
  8637. };
  8638. });
  8639. }(Br)), Br.exports;
  8640. }
  8641. var Xg = Kg();
  8642. var Jg = wt(Xg);
  8643. var jr = { exports: {} };
  8644. var Zg = jr.exports;
  8645. var $o;
  8646. function Qg() {
  8647. return $o || ($o = 1, function(t, e) {
  8648. (function(n, r) {
  8649. t.exports = r();
  8650. })(Zg, function() {
  8651. var n = "minute", r = /[+-]\d\d(?::?\d\d)?/g, s = /([+-]|\d\d)/g;
  8652. return function(i, o, a) {
  8653. var u = o.prototype;
  8654. a.utc = function(R) {
  8655. var O = { date: R, utc: true, args: arguments };
  8656. return new o(O);
  8657. }, u.utc = function(R) {
  8658. var O = a(this.toDate(), { locale: this.$L, utc: true });
  8659. return R ? O.add(this.utcOffset(), n) : O;
  8660. }, u.local = function() {
  8661. return a(this.toDate(), { locale: this.$L, utc: false });
  8662. };
  8663. var c = u.parse;
  8664. u.parse = function(R) {
  8665. R.utc && (this.$u = true), this.$utils().u(R.$offset) || (this.$offset = R.$offset), c.call(this, R);
  8666. };
  8667. var l = u.init;
  8668. u.init = function() {
  8669. if (this.$u) {
  8670. var R = this.$d;
  8671. this.$y = R.getUTCFullYear(), this.$M = R.getUTCMonth(), this.$D = R.getUTCDate(), this.$W = R.getUTCDay(), this.$H = R.getUTCHours(), this.$m = R.getUTCMinutes(), this.$s = R.getUTCSeconds(), this.$ms = R.getUTCMilliseconds();
  8672. } else
  8673. l.call(this);
  8674. };
  8675. var h = u.utcOffset;
  8676. u.utcOffset = function(R, O) {
  8677. var U = this.$utils().u;
  8678. if (U(R))
  8679. return this.$u ? 0 : U(this.$offset) ? h.call(this) : this.$offset;
  8680. if (typeof R == "string" && (R = function(T) {
  8681. T === void 0 && (T = "");
  8682. var A = T.match(r);
  8683. if (!A)
  8684. return null;
  8685. var H = ("" + A[0]).match(s) || ["-", 0, 0], Z = H[0], fe = 60 * +H[1] + +H[2];
  8686. return fe === 0 ? 0 : Z === "+" ? fe : -fe;
  8687. }(R), R === null))
  8688. return this;
  8689. var ne = Math.abs(R) <= 16 ? 60 * R : R, X = this;
  8690. if (O)
  8691. return X.$offset = ne, X.$u = R === 0, X;
  8692. if (R !== 0) {
  8693. var de = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
  8694. (X = this.local().add(ne + de, n)).$offset = ne, X.$x.$localOffset = de;
  8695. } else
  8696. X = this.utc();
  8697. return X;
  8698. };
  8699. var d = u.format;
  8700. u.format = function(R) {
  8701. var O = R || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
  8702. return d.call(this, O);
  8703. }, u.valueOf = function() {
  8704. var R = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
  8705. return this.$d.valueOf() - 6e4 * R;
  8706. }, u.isUTC = function() {
  8707. return !!this.$u;
  8708. }, u.toISOString = function() {
  8709. return this.toDate().toISOString();
  8710. }, u.toString = function() {
  8711. return this.toDate().toUTCString();
  8712. };
  8713. var f = u.toDate;
  8714. u.toDate = function(R) {
  8715. return R === "s" && this.$offset ? a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : f.call(this);
  8716. };
  8717. var E = u.diff;
  8718. u.diff = function(R, O, U) {
  8719. if (R && this.$u === R.$u)
  8720. return E.call(this, R, O, U);
  8721. var ne = this.local(), X = a(R).local();
  8722. return E.call(ne, X, O, U);
  8723. };
  8724. };
  8725. });
  8726. }(jr)), jr.exports;
  8727. }
  8728. var qg = Qg();
  8729. var ep = wt(qg);
  8730. var Hr = { exports: {} };
  8731. var tp = Hr.exports;
  8732. var Bo;
  8733. function np() {
  8734. return Bo || (Bo = 1, function(t, e) {
  8735. (function(n, r) {
  8736. t.exports = r();
  8737. })(tp, function() {
  8738. return function(n, r) {
  8739. r.prototype.weekday = function(s) {
  8740. var i = this.$locale().weekStart || 0, o = this.$W, a = (o < i ? o + 7 : o) - i;
  8741. return this.$utils().u(s) ? a : this.subtract(a, "day").add(s, "day");
  8742. };
  8743. };
  8744. });
  8745. }(Hr)), Hr.exports;
  8746. }
  8747. var rp = np();
  8748. var sp = wt(rp);
  8749. var Wr = { exports: {} };
  8750. var ip = Wr.exports;
  8751. var jo;
  8752. function op() {
  8753. return jo || (jo = 1, function(t, e) {
  8754. (function(n, r) {
  8755. t.exports = r();
  8756. })(ip, function() {
  8757. var n = "week", r = "year";
  8758. return function(s, i, o) {
  8759. var a = i.prototype;
  8760. a.week = function(u) {
  8761. if (u === void 0 && (u = null), u !== null)
  8762. return this.add(7 * (u - this.week()), "day");
  8763. var c = this.$locale().yearStart || 1;
  8764. if (this.month() === 11 && this.date() > 25) {
  8765. var l = o(this).startOf(r).add(1, r).date(c), h = o(this).endOf(n);
  8766. if (l.isBefore(h))
  8767. return 1;
  8768. }
  8769. var d = o(this).startOf(r).date(c).startOf(n).subtract(1, "millisecond"), f = this.diff(d, n, true);
  8770. return f < 0 ? o(this).startOf("week").week() : Math.ceil(f);
  8771. }, a.weeks = function(u) {
  8772. return u === void 0 && (u = null), this.week(u);
  8773. };
  8774. };
  8775. });
  8776. }(Wr)), Wr.exports;
  8777. }
  8778. var ap = op();
  8779. var up = wt(ap);
  8780. var zr = { exports: {} };
  8781. var lp = zr.exports;
  8782. var Ho;
  8783. function cp() {
  8784. return Ho || (Ho = 1, function(t, e) {
  8785. (function(n, r) {
  8786. t.exports = r();
  8787. })(lp, function() {
  8788. return function(n, r) {
  8789. r.prototype.weekYear = function() {
  8790. var s = this.month(), i = this.week(), o = this.year();
  8791. return i === 1 && s === 11 ? o + 1 : s === 0 && i >= 52 ? o - 1 : o;
  8792. };
  8793. };
  8794. });
  8795. }(zr)), zr.exports;
  8796. }
  8797. var hp = cp();
  8798. var dp = wt(hp);
  8799. rn.extend(Hg);
  8800. rn.extend(Fg);
  8801. rn.extend(sp);
  8802. rn.extend(Vg);
  8803. rn.extend(up);
  8804. rn.extend(dp);
  8805. rn.extend(ep);
  8806. rn.extend(Jg);
  8807. function Li(t, e, n, r) {
  8808. if (t > e)
  8809. throw new Error("a1 should be less than a2");
  8810. if (n > r)
  8811. throw new Error("b1 should be less than b2");
  8812. if (e < n || r < t)
  8813. return [t, e];
  8814. if (n <= t && r >= e)
  8815. return [];
  8816. const s = r - n + 1;
  8817. return t < n && e > r ? [t, e - s] : n <= t && r < e ? [r + 1 - s, e - s] : n > t && r >= e ? [t, n - 1] : [t, e];
  8818. }
  8819. function TC(t) {
  8820. if (t == null)
  8821. return false;
  8822. const e = t.bullet;
  8823. return (e == null ? void 0 : e.listId) != null;
  8824. }
  8825. function MC(t) {
  8826. if (t == null)
  8827. return false;
  8828. const e = t.paragraphStyle;
  8829. return fp(e);
  8830. }
  8831. function fp(t) {
  8832. var e;
  8833. return !(t == null || (t.indentStart == null || t.indentStart.v === 0) && t.hanging == null || ((e = t.hanging) == null ? void 0 : e.v) === 0);
  8834. }
  8835. function gp(t, e, n) {
  8836. return t.slice(0, e) + n + t.slice(e);
  8837. }
  8838. function pp(t, e, n) {
  8839. return e > n ? t : t.slice(0, e) + t.slice(n);
  8840. }
  8841. var mp = /\s/g;
  8842. function DC(t) {
  8843. return t === null || t.toString().replace(mp, "") === "" || typeof t == "boolean" ? false : !isNaN(t);
  8844. }
  8845. function xC(t) {
  8846. let e = 0;
  8847. for (let n = 0; n < t.length; n++)
  8848. e = t.charCodeAt(n) + (e << 6) + (e << 16) - e;
  8849. return e >>> 0;
  8850. }
  8851. var Ye = Symbol("newer");
  8852. var rt = Symbol("older");
  8853. var _p = class {
  8854. constructor(e) {
  8855. C(this, "entry");
  8856. this.entry = e;
  8857. }
  8858. [Symbol.iterator]() {
  8859. return this;
  8860. }
  8861. next() {
  8862. const e = this.entry;
  8863. return e ? (this.entry = e[Ye], { done: false, value: e.key }) : { done: true, value: void 0 };
  8864. }
  8865. };
  8866. var Ep = class {
  8867. constructor(e) {
  8868. C(this, "entry");
  8869. this.entry = e;
  8870. }
  8871. [Symbol.iterator]() {
  8872. return this;
  8873. }
  8874. next() {
  8875. const e = this.entry;
  8876. return e ? (this.entry = e[Ye], { done: false, value: e.value }) : { done: true, value: void 0 };
  8877. }
  8878. };
  8879. var Cp = class {
  8880. constructor(e) {
  8881. C(this, "entry");
  8882. this.entry = e;
  8883. }
  8884. [Symbol.iterator]() {
  8885. return this;
  8886. }
  8887. next() {
  8888. const e = this.entry;
  8889. return e ? (this.entry = e[Ye], { done: false, value: [e.key, e.value] }) : { done: true, value: void 0 };
  8890. }
  8891. };
  8892. var Ta;
  8893. var Ma;
  8894. Ma = Ye, Ta = rt;
  8895. var Wo = class {
  8896. constructor(e, n) {
  8897. C(this, "key");
  8898. C(this, "value");
  8899. C(this, Ma);
  8900. C(this, Ta);
  8901. this.key = e, this.value = n, this[Ye] = void 0, this[rt] = void 0;
  8902. }
  8903. toJSON() {
  8904. return {
  8905. key: this.key,
  8906. value: this.value
  8907. };
  8908. }
  8909. };
  8910. var Qr = class {
  8911. constructor(...e) {
  8912. C(this, "_keymap");
  8913. C(this, "size", 0);
  8914. C(this, "limit");
  8915. C(this, "oldest");
  8916. C(this, "newest");
  8917. C(this, "_onShiftListeners", []);
  8918. if (Cr.hasLength(e, 1)) {
  8919. if (Cr.isNumber(e[0])) {
  8920. const n = e[0];
  8921. this._initialize(n, void 0);
  8922. return;
  8923. }
  8924. if (Cr.isIterable(e[0])) {
  8925. const n = e[0];
  8926. this._initialize(0, n);
  8927. return;
  8928. }
  8929. return;
  8930. }
  8931. if (Cr.hasLength(e, 2)) {
  8932. const n = e[0], r = e[1];
  8933. this._initialize(n, r);
  8934. }
  8935. }
  8936. onShift(e) {
  8937. if (this._onShiftListeners.indexOf(e) === -1)
  8938. return this._onShiftListeners.push(e), Ze(() => cs(this._onShiftListeners, e));
  8939. throw new Error("[LRUMap]: the listener has been registered!");
  8940. }
  8941. _initialize(e, n) {
  8942. this.oldest = void 0, this.newest = void 0, this.size = 0, this.limit = e, this._keymap = /* @__PURE__ */ new Map(), n && (this.assign(n), e < 1 && (this.limit = this.size));
  8943. }
  8944. _markEntryAsUsed(e) {
  8945. e !== this.newest && (e[Ye] && (e === this.oldest && (this.oldest = e[Ye]), e[Ye][rt] = e[rt]), e[rt] && (e[rt][Ye] = e[Ye]), e[Ye] = void 0, e[rt] = this.newest, this.newest && (this.newest[Ye] = e), this.newest = e);
  8946. }
  8947. assign(e) {
  8948. let n, r = this.limit || Number.MAX_VALUE;
  8949. this._keymap.clear();
  8950. const s = e[Symbol.iterator]();
  8951. for (let i = s.next(); !i.done; i = s.next()) {
  8952. const o = new Wo(i.value[0], i.value[1]);
  8953. if (this._keymap.set(o.key, o), n ? (n[Ye] = o, o[rt] = n) : this.oldest = o, n = o, r-- === 0)
  8954. throw new Error("overflow");
  8955. }
  8956. this.newest = n, this.size = this._keymap.size;
  8957. }
  8958. set(e, n) {
  8959. let r = this._keymap.get(e);
  8960. return r ? (r.value = n, this._markEntryAsUsed(r), this) : (this._keymap.set(e, r = new Wo(e, n)), this.newest ? (this.newest[Ye] = r, r[rt] = this.newest) : this.oldest = r, this.newest = r, ++this.size, this.size > this.limit && this.shift(), this);
  8961. }
  8962. shift() {
  8963. const e = this.oldest;
  8964. if (e)
  8965. return this.oldest && this.oldest[Ye] ? (this.oldest = this.oldest[Ye], this.oldest[rt] = void 0) : (this.oldest = void 0, this.newest = void 0), e[Ye] = e[rt] = void 0, this._keymap.delete(e.key), --this.size, this._onShiftListeners.forEach((n) => n(e)), [e.key, e.value];
  8966. }
  8967. get(e) {
  8968. const n = this._keymap.get(e);
  8969. if (n)
  8970. return this._markEntryAsUsed(n), n.value;
  8971. }
  8972. has(e) {
  8973. return this._keymap.has(e);
  8974. }
  8975. find(e) {
  8976. const n = this._keymap.get(e);
  8977. return n ? n.value : void 0;
  8978. }
  8979. delete(e) {
  8980. const n = this._keymap.get(e);
  8981. if (n)
  8982. return this._keymap.delete(n.key), n[Ye] && n[rt] ? (n[rt][Ye] = n[Ye], n[Ye][rt] = n[rt]) : n[Ye] ? (n[Ye][rt] = void 0, this.oldest = n[Ye]) : n[rt] ? (n[rt][Ye] = void 0, this.newest = n[rt]) : this.oldest = this.newest = void 0, this.size--, n.value;
  8983. }
  8984. clear() {
  8985. this.oldest = void 0, this.newest = void 0, this.size = 0, this._keymap.clear();
  8986. }
  8987. keys() {
  8988. return new _p(this.oldest);
  8989. }
  8990. values() {
  8991. return new Ep(this.oldest);
  8992. }
  8993. entries() {
  8994. return this[Symbol.iterator]();
  8995. }
  8996. [Symbol.iterator]() {
  8997. return new Cp(this.oldest);
  8998. }
  8999. forEach(e, n) {
  9000. typeof n != "object" && (n = this);
  9001. let r = this.oldest;
  9002. for (; r; )
  9003. e.call(n, r.value, r.key, this), r = r[Ye];
  9004. }
  9005. toJSON() {
  9006. const e = new Array(this.size);
  9007. let n = 0, r = this.oldest;
  9008. for (; r; )
  9009. e[n++] = { key: r.key, value: r.value }, r = r[Ye];
  9010. return e;
  9011. }
  9012. toString() {
  9013. let e = "", n = this.oldest;
  9014. for (; n; )
  9015. e += `${String(n.key)}:${n.value}`, n = n[Ye], n && (e += " < ");
  9016. return e;
  9017. }
  9018. };
  9019. var Cr = class {
  9020. static hasLength(e, n) {
  9021. return e.length === n;
  9022. }
  9023. static getValueType(e) {
  9024. return Object.prototype.toString.apply(e);
  9025. }
  9026. static isObject(e) {
  9027. return this.getValueType(e) === "[object Object]";
  9028. }
  9029. static isIterable(e) {
  9030. return e[Symbol.iterator] != null;
  9031. }
  9032. static isNumber(e) {
  9033. return this.getValueType(e) === "[object Number]";
  9034. }
  9035. };
  9036. var Yr = { exports: {} };
  9037. var Rp = Yr.exports;
  9038. var zo;
  9039. function Ip() {
  9040. return zo || (zo = 1, function(t, e) {
  9041. (function(n, r) {
  9042. t.exports = r();
  9043. })(typeof self < "u" ? self : Rp, function() {
  9044. return function() {
  9045. var n = { d: function(_, g) {
  9046. for (var p in g)
  9047. n.o(g, p) && !n.o(_, p) && Object.defineProperty(_, p, { enumerable: true, get: g[p] });
  9048. }, o: function(_, g) {
  9049. return Object.prototype.hasOwnProperty.call(_, g);
  9050. } }, r = {};
  9051. n.d(r, { default: function() {
  9052. return ht;
  9053. } });
  9054. var s = { 1078: "af", 1052: "sq", 1118: "am", 5121: "ar_DZ", 15361: "ar_BH", 3073: "ar_EG", 2049: "ar_IQ", 11265: "ar_JO", 13313: "ar_KW", 12289: "ar_LB", 4097: "ar_LY", 6145: "ar_MA", 8193: "ar_OM", 16385: "ar_QA", 1025: "ar_SA", 10241: "ar_SY", 7169: "ar_TN", 14337: "ar_AE", 9217: "ar_YE", 1067: "hy", 1101: "as", 2092: "az_AZ", 1068: "az_AZ", 1069: "eu", 1059: "be", 2117: "bn", 1093: "bn_IN", 5146: "bs", 1026: "bg", 1109: "my", 1027: "ca", 2052: "zh_CN", 3076: "zh_HK", 5124: "zh_MO", 4100: "zh_SG", 1028: "zh_TW", 1050: "hr", 1029: "cs", 1030: "da", 1125: "dv", 2067: "nl_BE", 1043: "nl_NL", 1126: "bin", 3081: "en_AU", 10249: "en_BZ", 4105: "en_CA", 9225: "en_CB", 2057: "en_GB", 16393: "en_IN", 6153: "en_IE", 8201: "en_JM", 5129: "en_NZ", 13321: "en_PH", 7177: "en_ZA", 11273: "en_TT", 1033: "en_US", 12297: "en_ZW", 1061: "et", 1071: "mk", 1080: "fo", 1065: "fa", 1124: "fil", 1035: "fi", 2060: "fr_BE", 11276: "fr_CM", 3084: "fr_CA", 9228: "fr_CG", 12300: "fr_CI", 1036: "fr_FR", 5132: "fr_LU", 13324: "fr_ML", 6156: "fr_MC", 14348: "fr_MA", 10252: "fr_SN", 4108: "fr_CH", 7180: "fr", 1122: "fy_NL", 2108: "gd_IE", 1084: "gd", 1110: "gl", 1079: "ka", 3079: "de_AT", 1031: "de_DE", 5127: "de_LI", 4103: "de_LU", 2055: "de_CH", 1032: "el", 1140: "gn", 1095: "gu", 1279: "en", 1037: "he", 1081: "hi", 1038: "hu", 1039: "is", 1136: "ig_NG", 1057: "id", 1040: "it_IT", 2064: "it_CH", 1041: "ja", 1099: "kn", 1120: "ks", 1087: "kk", 1107: "km", 1111: "kok", 1042: "ko", 1088: "ky", 1108: "lo", 1142: "la", 1062: "lv", 1063: "lt", 2110: "ms_BN", 1086: "ms_MY", 1100: "ml", 1082: "mt", 1112: "mni", 1153: "mi", 1102: "mr", 1104: "mn", 2128: "mn", 1121: "ne", 1044: "no_NO", 2068: "no_NO", 1096: "or", 1045: "pl", 1046: "pt_BR", 2070: "pt_PT", 1094: "pa", 1047: "rm", 2072: "ro_MO", 1048: "ro_RO", 1049: "ru", 2073: "ru_MO", 1083: "se", 1103: "sa", 3098: "sr_SP", 2074: "sr_SP", 1072: "st", 1074: "tn", 1113: "sd", 1115: "si", 1051: "sk", 1060: "sl", 1143: "so", 1070: "sb", 11274: "es_AR", 16394: "es_BO", 13322: "es_CL", 9226: "es_CO", 5130: "es_CR", 7178: "es_DO", 12298: "es_EC", 17418: "es_SV", 4106: "es_GT", 18442: "es_HN", 2058: "es_MX", 19466: "es_NI", 6154: "es_PA", 15370: "es_PY", 10250: "es_PE", 20490: "es_PR", 1034: "es_ES", 14346: "es_UY", 8202: "es_VE", 1089: "sw", 2077: "sv_FI", 1053: "sv_SE", 1114: "syc", 1064: "tg", 1097: "ta", 1092: "tt", 1098: "te", 1054: "th", 1105: "bo", 1073: "ts", 1055: "tr", 1090: "tk", 1058: "uk", 1056: "ur", 2115: "uz_UZ", 1091: "uz_UZ", 1075: "ve", 1066: "vi", 1106: "cy", 1076: "xh", 1085: "yi", 1077: "zu" };
  9055. const i = /^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i, o = {}, a = { group: " ", decimal: ".", positive: "+", negative: "-", percent: "%", exponent: "E", nan: "NaN", infinity: "∞", ampm: ["AM", "PM"], mmmm6: ["Muharram", "Safar", "Rabiʻ I", "Rabiʻ II", "Jumada I", "Jumada II", "Rajab", "Shaʻban", "Ramadan", "Shawwal", "Dhuʻl-Qiʻdah", "Dhuʻl-Hijjah"], mmm6: ["Muh.", "Saf.", "Rab. I", "Rab. II", "Jum. I", "Jum. II", "Raj.", "Sha.", "Ram.", "Shaw.", "Dhuʻl-Q.", "Dhuʻl-H."], mmmm: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], mmm: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], dddd: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], ddd: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] };
  9056. function u(_) {
  9057. const g = i.exec(_);
  9058. if (!g)
  9059. throw new SyntaxError("Malformed locale: ".concat(_));
  9060. return { lang: g[1] + (g[2] ? "_" + g[2] : ""), language: g[1], territory: g[2] || "", codeset: g[3] || "", modifier: g[4] || "" };
  9061. }
  9062. function c(_) {
  9063. if (typeof _ == "number")
  9064. return s[65535 & _] || null;
  9065. const g = parseInt(_, 16);
  9066. return isFinite(g) && s[65535 & g] ? s[65535 & g] || null : i.test(_) ? _ : null;
  9067. }
  9068. function l(_) {
  9069. const g = c(_);
  9070. let p = null;
  9071. if (g) {
  9072. const S = u(g);
  9073. p = o[S.lang] || o[S.language] || null;
  9074. }
  9075. return p;
  9076. }
  9077. function h(_) {
  9078. return Object.assign({}, a, _);
  9079. }
  9080. function d(_, g) {
  9081. const p = typeof g == "object" ? g : u(g);
  9082. return o[p.lang] = h(_), p.language === p.lang || o[p.language] || (o[p.language] = h(_)), o[p.lang];
  9083. }
  9084. const f = h({ group: "," });
  9085. function E(_, g) {
  9086. if (typeof _ != "number")
  9087. return _;
  9088. if (_ < 0)
  9089. return -E(-_, g);
  9090. if (g) {
  9091. const p = 10 ** (g || 0) || 1;
  9092. return E(_ * p, 0) / p;
  9093. }
  9094. return Math.round(_);
  9095. }
  9096. f.isDefault = true, d({ group: ",", ampm: ["上午", "下午"], mmmm: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], mmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], dddd: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], ddd: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"] }, "zh_CN"), d({ group: ",", nan: "非數值", ampm: ["上午", "下午"], mmmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], mmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], dddd: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], ddd: ["週日", "週一", "週二", "週三", "週四", "週五", "週六"] }, "zh_TW"), d({ group: ",", ampm: ["午前", "午後"], mmmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], mmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], dddd: ["日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日"], ddd: ["日", "月", "火", "水", "木", "金", "土"] }, "ja"), d({ group: ",", ampm: ["오전", "오후"], mmmm: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"], mmm: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"], dddd: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"], ddd: ["일", "월", "화", "수", "목", "금", "토"] }, "ko"), d({ group: ",", ampm: ["ก่อนเที่ยง", "หลังเที่ยง"], mmmm: ["มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"], mmm: ["ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค."], dddd: ["วันอาทิตย์", "วันจันทร์", "วันอังคาร", "วันพุธ", "วันพฤหัสบดี", "วันศุกร์", "วันเสาร์"], ddd: ["อา.", "จ.", "อ.", "พ.", "พฤ.", "ศ.", "ส."] }, "th"), d({ decimal: ",", ampm: ["dop.", "odp."], mmmm: ["ledna", "února", "března", "dubna", "května", "června", "července", "srpna", "září", "října", "listopadu", "prosince"], mmm: ["led", "úno", "bře", "dub", "kvě", "čvn", "čvc", "srp", "zář", "říj", "lis", "pro"], dddd: ["neděle", "pondělí", "úterý", "středa", "čtvrtek", "pátek", "sobota"], ddd: ["ne", "po", "út", "st", "čt", "pá", "so"] }, "cs"), d({ group: ".", decimal: ",", mmmm: ["januar", "februar", "marts", "april", "maj", "juni", "juli", "august", "september", "oktober", "november", "december"], mmm: ["jan.", "feb.", "mar.", "apr.", "maj", "jun.", "jul.", "aug.", "sep.", "okt.", "nov.", "dec."], dddd: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"], ddd: ["søn.", "man.", "tir.", "ons.", "tor.", "fre.", "lør."] }, "da"), d({ group: ".", decimal: ",", ampm: ["a.m.", "p.m."], mmmm: ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"], mmm: ["jan.", "feb.", "mrt.", "apr.", "mei", "jun.", "jul.", "aug.", "sep.", "okt.", "nov.", "dec."], dddd: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"], ddd: ["zo", "ma", "di", "wo", "do", "vr", "za"] }, "nl"), d({ group: "," }, "en"), d({ decimal: ",", nan: "epäluku", ampm: ["ap.", "ip."], mmmm: ["tammikuuta", "helmikuuta", "maaliskuuta", "huhtikuuta", "toukokuuta", "kesäkuuta", "heinäkuuta", "elokuuta", "syyskuuta", "lokakuuta", "marraskuuta", "joulukuuta"], mmm: ["tammik.", "helmik.", "maalisk.", "huhtik.", "toukok.", "kesäk.", "heinäk.", "elok.", "syysk.", "lokak.", "marrask.", "jouluk."], dddd: ["sunnuntaina", "maanantaina", "tiistaina", "keskiviikkona", "torstaina", "perjantaina", "lauantaina"], ddd: ["su", "ma", "ti", "ke", "to", "pe", "la"] }, "fi"), d({ group: " ", decimal: ",", mmmm: ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"], mmm: ["janv.", "févr.", "mars", "avr.", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc."], dddd: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"], ddd: ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."] }, "fr"), d({ group: ".", decimal: ",", mmmm: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], mmm: ["Jan.", "Feb.", "März", "Apr.", "Mai", "Juni", "Juli", "Aug.", "Sept.", "Okt.", "Nov.", "Dez."], dddd: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"], ddd: ["So.", "Mo.", "Di.", "Mi.", "Do.", "Fr.", "Sa."] }, "de"), d({ group: ".", decimal: ",", ampm: ["π.μ.", "μ.μ."], mmmm: ["Ιανουαρίου", "Φεβρουαρίου", "Μαρτίου", "Απριλίου", "Μαΐου", "Ιουνίου", "Ιουλίου", "Αυγούστου", "Σεπτεμβρίου", "Οκτωβρίου", "Νοεμβρίου", "Δεκεμβρίου"], mmm: ["Ιαν", "Φεβ", "Μαρ", "Απρ", "Μαΐ", "Ιουν", "Ιουλ", "Αυγ", "Σεπ", "Οκτ", "Νοε", "Δεκ"], dddd: ["Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"], ddd: ["Κυρ", "Δευ", "Τρί", "Τετ", "Πέμ", "Παρ", "Σάβ"] }, "el"), d({ decimal: ",", ampm: ["de.", "du."], mmmm: ["január", "február", "március", "április", "május", "június", "július", "augusztus", "szeptember", "október", "november", "december"], mmm: ["jan.", "febr.", "márc.", "ápr.", "máj.", "jún.", "júl.", "aug.", "szept.", "okt.", "nov.", "dec."], dddd: ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"], ddd: ["V", "H", "K", "Sze", "Cs", "P", "Szo"] }, "hu"), d({ group: ".", decimal: ",", ampm: ["f.h.", "e.h."], mmmm: ["janúar", "febrúar", "mars", "apríl", "maí", "júní", "júlí", "ágúst", "september", "október", "nóvember", "desember"], mmm: ["jan.", "feb.", "mar.", "apr.", "maí", "jún.", "júl.", "ágú.", "sep.", "okt.", "nóv.", "des."], dddd: ["sunnudagur", "mánudagur", "þriðjudagur", "miðvikudagur", "fimmtudagur", "föstudagur", "laugardagur"], ddd: ["sun.", "mán.", "þri.", "mið.", "fim.", "fös.", "lau."] }, "is"), d({ group: ".", decimal: ",", mmmm: ["Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"], mmm: ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agu", "Sep", "Okt", "Nov", "Des"], dddd: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"], ddd: ["Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"] }, "id"), d({ group: ".", decimal: ",", mmmm: ["gennaio", "febbraio", "marzo", "aprile", "maggio", "giugno", "luglio", "agosto", "settembre", "ottobre", "novembre", "dicembre"], mmm: ["gen", "feb", "mar", "apr", "mag", "giu", "lug", "ago", "set", "ott", "nov", "dic"], dddd: ["domenica", "lunedì", "martedì", "mercoledì", "giovedì", "venerdì", "sabato"], ddd: ["dom", "lun", "mar", "mer", "gio", "ven", "sab"] }, "it"), d({ decimal: ",", ampm: ["a.m.", "p.m."], mmmm: ["januar", "februar", "mars", "april", "mai", "juni", "juli", "august", "september", "oktober", "november", "desember"], mmm: ["jan.", "feb.", "mar.", "apr.", "mai", "jun.", "jul.", "aug.", "sep.", "okt.", "nov.", "des."], dddd: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"], ddd: ["søn.", "man.", "tir.", "ons.", "tor.", "fre.", "lør."] }, "nb"), d({ decimal: ",", mmmm: ["stycznia", "lutego", "marca", "kwietnia", "maja", "czerwca", "lipca", "sierpnia", "września", "października", "listopada", "grudnia"], mmm: ["sty", "lut", "mar", "kwi", "maj", "cze", "lip", "sie", "wrz", "paź", "lis", "gru"], dddd: ["niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"], ddd: ["niedz.", "pon.", "wt.", "śr.", "czw.", "pt.", "sob."] }, "pl"), d({ group: ".", decimal: ",", mmmm: ["janeiro", "fevereiro", "março", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro"], mmm: ["jan.", "fev.", "mar.", "abr.", "mai.", "jun.", "jul.", "ago.", "set.", "out.", "nov.", "dez."], dddd: ["domingo", "segunda-feira", "terça-feira", "quarta-feira", "quinta-feira", "sexta-feira", "sábado"], ddd: ["dom.", "seg.", "ter.", "qua.", "qui.", "sex.", "sáb."] }, "pt"), d({ decimal: ",", nan: "не число", mmmm: ["января", "февраля", "марта", "апреля", "мая", "июня", "июля", "августа", "сентября", "октября", "ноября", "декабря"], mmm: ["янв.", "февр.", "мар.", "апр.", "мая", "июн.", "июл.", "авг.", "сент.", "окт.", "нояб.", "дек."], dddd: ["воскресенье", "понедельник", "вторник", "среда", "четверг", "пятница", "суббота"], ddd: ["вс", "пн", "вт", "ср", "чт", "пт", "сб"] }, "ru"), d({ decimal: ",", mmmm: ["januára", "februára", "marca", "apríla", "mája", "júna", "júla", "augusta", "septembra", "októbra", "novembra", "decembra"], mmm: ["jan", "feb", "mar", "apr", "máj", "jún", "júl", "aug", "sep", "okt", "nov", "dec"], dddd: ["nedeľa", "pondelok", "utorok", "streda", "štvrtok", "piatok", "sobota"], ddd: ["ne", "po", "ut", "st", "št", "pi", "so"] }, "sk"), d({ group: ".", decimal: ",", ampm: ["a. m.", "p. m."], mmmm: ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"], mmm: ["ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "sept.", "oct.", "nov.", "dic."], dddd: ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"], ddd: ["dom.", "lun.", "mar.", "mié.", "jue.", "vie.", "sáb."] }, "es"), d({ decimal: ",", ampm: ["fm", "em"], mmmm: ["januari", "februari", "mars", "april", "maj", "juni", "juli", "augusti", "september", "oktober", "november", "december"], mmm: ["jan.", "feb.", "mars", "apr.", "maj", "juni", "juli", "aug.", "sep.", "okt.", "nov.", "dec."], dddd: ["söndag", "måndag", "tisdag", "onsdag", "torsdag", "fredag", "lördag"], ddd: ["sön", "mån", "tis", "ons", "tors", "fre", "lör"] }, "sv"), d({ group: ".", decimal: ",", ampm: ["ÖÖ", "ÖS"], mmmm: ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"], mmm: ["Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara"], dddd: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"], ddd: ["Paz", "Pzt", "Sal", "Çar", "Per", "Cum", "Cmt"] }, "tr");
  9097. function R(_, g, p) {
  9098. const S = _ < 0 ? -1 : 1, N = 10 ** (g || 2), L = 10 ** (p || 2);
  9099. let x, P, I = Math.abs(_), Q = 0, _e = 0, J = 0, me = 1;
  9100. if ((_ = I) % 1 == 0)
  9101. P = [_ * S, 1];
  9102. else if (_ < 1e-19)
  9103. P = [S, 1e19];
  9104. else if (_ > 1e19)
  9105. P = [1e19 * S, 1];
  9106. else {
  9107. do
  9108. if (I = 1 / (I - Math.floor(I)), x = me, me = me * Math.floor(I) + Q, Q = x, _e = J, J = Math.floor(_ * me + 0.5), J >= N || me >= L)
  9109. return [S * _e, Q];
  9110. while (Math.abs(_ - J / me) >= 1e-10 && I !== Math.floor(I));
  9111. P = [S * J, me];
  9112. }
  9113. return P;
  9114. }
  9115. const O = { overflow: "######", dateErrorThrows: false, dateErrorNumber: true, dateSpanLarge: true, leap1900: true, nbsp: true, throws: true, invalid: "######", locale: "", ignoreTimezone: false }, U = Object.assign({}, O);
  9116. function ne(_) {
  9117. if (_ === null && (_ = O), _) {
  9118. for (const g in _)
  9119. if (g in O) {
  9120. const p = _[g];
  9121. U[g] = p == null ? O[g] : p;
  9122. }
  9123. }
  9124. return { ...U };
  9125. }
  9126. const X = { "#": "", 0: "0", "?": " " }, de = { "@": "text", "-": "minus", "+": "plus" }, T = ["#000", "#FFF", "#F00", "#0F0", "#00F", "#FF0", "#F0F", "#0FF", "#000", "#FFF", "#F00", "#0F0", "#00F", "#FF0", "#F0F", "#0FF", "#800", "#080", "#008", "#880", "#808", "#088", "#CCC", "#888", "#99F", "#936", "#FFC", "#CFF", "#606", "#F88", "#06C", "#CCF", "#008", "#F0F", "#FF0", "#0FF", "#808", "#800", "#088", "#00F", "#0CF", "#CFF", "#CFC", "#FF9", "#9CF", "#F9C", "#C9F", "#FC9", "#36F", "#3CC", "#9C0", "#FC0"], A = ["¤", "$", "£", "¥", "֏", "؋", "৳", "฿", "៛", "₡", "₦", "₩", "₪", "₫", "€", "₭", "₮", "₱", "₲", "₴", "₸", "₹", "₺", "₼", "₽", "₾", "₿"], H = new RegExp("[" + A.join("") + "]");
  9127. function Z(_, g, p) {
  9128. return g[p + "_max"] = _.length, g[p + "_min"] = _.replace(/#/g, "").length, g;
  9129. }
  9130. const fe = {};
  9131. function ae(_) {
  9132. if (!(_ in fe)) {
  9133. const g = [], p = _.replace(/^[#,]+/, "").replace(/[1-9]\d*/g, (S) => "?".repeat(S.length));
  9134. for (let S = 0; S < p.length; S++) {
  9135. const N = p.charAt(S);
  9136. g[S] = N in X ? X[N] : N;
  9137. }
  9138. fe[_] = g.join("");
  9139. }
  9140. return fe[_];
  9141. }
  9142. function m(_, g) {
  9143. typeof _ == "string" && (_ = { type: "string", value: _ = _.replace(/ /g, X["?"]) }), g.push(_);
  9144. }
  9145. function j(_) {
  9146. const g = [], p = { scale: 1, percent: false, text: false, date: 0, date_eval: false, date_system: 1, sec_decimals: 0, general: false, clock: 24, int_pattern: [], frac_pattern: [], man_pattern: [], den_pattern: [], num_pattern: [], tokens: g };
  9147. let S = _ + "", N = "int", L = false, x = null;
  9148. const P = [];
  9149. let I, Q, _e = false;
  9150. for (; S && !L; ) {
  9151. if (I = /^General/i.exec(S))
  9152. p.general = true, m({ type: "general" }, g);
  9153. else if (N === "int" && (I = /^[#?0]+(?:,[#?0]+)*/.exec(S)) || N === "den" && (I = /^[#?\d]+/.exec(S)) || (I = /^[#?0]+/.exec(S)))
  9154. p[N + "_pattern"].push(I[0]), x = { type: N, num: I[0] }, m(x, g);
  9155. else if ((I = /^\//.exec(S)) && p[N + "_pattern"].length) {
  9156. if (!x)
  9157. throw new SyntaxError("Missing a numerator in pattern ".concat(_));
  9158. p.fractions = true, p.num_pattern.push(p[N + "_pattern"].pop()), x.type = "num", N = "den", m({ type: "div" }, g);
  9159. } else if (I = /^,+/.exec(S)) {
  9160. const D = S.charAt(1) in X;
  9161. Q.slice(-1) in X && (I[0].length > 1 || !D) ? p.scale = 1e-3 ** I[0].length : p.dec_fractions || m(I[0], g);
  9162. } else {
  9163. if (I = /^;/.exec(S)) {
  9164. L = true;
  9165. break;
  9166. }
  9167. if (I = /^[@+-]/.exec(S))
  9168. I[0] === "@" && (p.text = true), m({ type: de[I[0]] }, g);
  9169. else if (I = /^(?:\[(h+|m+|s+)\])/i.exec(S)) {
  9170. const D = I[1].toLowerCase(), q = D[0], Ce = { type: "", size: 0, date: 1, raw: I[0], pad: D.length };
  9171. q === "h" ? (Ce.size = 16, Ce.type = "hour-elap") : q === "m" ? (Ce.size = 32, Ce.type = "min-elap") : (Ce.size = 64, Ce.type = "sec-elap"), p.date = p.date | Ce.size, P.push(Ce), m(Ce, g);
  9172. } else if (I = /^(?:B2)/i.exec(S))
  9173. _e || (p.date_system = 6);
  9174. else if (I = /^(?:B1)/i.exec(S))
  9175. _e || (p.date_system = 1);
  9176. else if (I = /^(?:([hHmMsSyYbBdDegG])\1*)/.exec(S)) {
  9177. const D = { type: "", size: 0, date: 1, raw: I[0] }, q = I[0].toLowerCase(), Ce = q[0];
  9178. if (q === "y" || q === "yy")
  9179. D.size = 2, D.type = "year-short";
  9180. else if (Ce === "y" || Ce === "e")
  9181. D.size = 2, D.type = "year";
  9182. else if (q === "b" || q === "bb")
  9183. D.size = 2, D.type = "b-year-short";
  9184. else if (Ce === "b")
  9185. D.size = 2, D.type = "b-year";
  9186. else if (q === "d" || q === "dd")
  9187. D.size = 8, D.type = "day", D.pad = /dd/.test(q);
  9188. else if (q === "ddd")
  9189. D.size = 8, D.type = "weekday-short";
  9190. else if (Ce === "d")
  9191. D.size = 8, D.type = "weekday";
  9192. else if (Ce === "h")
  9193. D.size = 16, D.type = "hour", D.pad = /hh/i.test(q);
  9194. else if (Ce === "m") {
  9195. q.length === 3 ? (D.size = 4, D.type = "monthname-short") : q.length === 5 ? (D.size = 4, D.type = "monthname-single") : q.length >= 4 && (D.size = 4, D.type = "monthname");
  9196. const Se = P[P.length - 1];
  9197. !D.type && Se && !Se.used && 80 & Se.size && (Se.used = true, D.size = 32, D.type = "min", D.pad = /mm/.test(q)), D.type || (D.size = 4, D.type = "month", D.pad = /mm/.test(q), D.indeterminate = true);
  9198. } else if (Ce === "s") {
  9199. D.size = 64, D.type = "sec", D.pad = /ss/.test(q);
  9200. const Se = P[P.length - 1];
  9201. Se && 32 & Se.size ? D.used = true : Se && Se.indeterminate && (delete Se.indeterminate, Se.size = 32, Se.type = "min", D.used = true);
  9202. }
  9203. p.date = p.date | D.size, p.date_eval = true, P.push(D), m(D, g);
  9204. } else if (I = /^(?:AM\/PM|am\/pm|A\/P)/.exec(S))
  9205. p.clock = 12, p.date = 16 | p.date, p.date_eval = true, m({ type: "am", short: I[0] === "A/P" }, g);
  9206. else if (p.date && (I = /^\.0{1,3}/i.exec(S))) {
  9207. const D = I[0].length - 1, q = [64, 128, 256, 512][D];
  9208. p.date = p.date | q, p.date_eval = true, p.sec_decimals = Math.max(p.sec_decimals, D), m({ type: "subsec", size: q, decimals: D, date: 1, raw: I[0] }, g);
  9209. } else if ((I = /^\\(.)/.exec(S)) || (I = /^"([^"]*?)"/.exec(S)))
  9210. m(I[1], g);
  9211. else if (I = /^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/.exec(S))
  9212. p.condition = [I[1], parseFloat(I[2], 10)];
  9213. else if (I = /^\[\$([^\]]+)\]/.exec(S)) {
  9214. const D = I[1].split("-"), q = D.length < 2 ? "" : D[D.length - 1], Ce = D[0];
  9215. Ce && m(Ce, g);
  9216. const Se = c(q);
  9217. Se && (p.locale = Se);
  9218. const Le = parseInt(q, 16);
  9219. isFinite(Le) && 16711680 & Le && (Le >> 16 & 255) === 6 && (p.date_system = 6), _e = true;
  9220. } else if (I = /^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*(\d+))\]/i.exec(S))
  9221. p.color = I[2] ? T[parseInt(I[2], 10)] || "#000" : I[1].toLowerCase();
  9222. else if (!(I = /^\[(DBNum1|ENG|HIJ|JPN|TWN)\]/i.exec(S))) {
  9223. if (I = /^%/.exec(S))
  9224. p.scale = 100, p.percent = true, m("%", g);
  9225. else if (I = /^_(\\.|.)/.exec(S))
  9226. m(" ", g);
  9227. else if (I = /^\./.exec(S))
  9228. m({ type: "point", value: I[0] }, g), p.dec_fractions = true, N = "frac";
  9229. else if (I = /^[Ee]([+-]?|(?=[0#?]))/.exec(S))
  9230. p.exponential = true, p.exp_plus = I[1] === "+", N = "man", m({ type: "exp", plus: I[1] === "+" }, g);
  9231. else if (!(I = /^\*(\\.|.)/.exec(S))) {
  9232. if (I = /^[BENn[]/.exec(S))
  9233. throw new SyntaxError("Unexpected char ".concat(S.charAt(0), " in pattern ").concat(_));
  9234. S[0] === "(" && (p.parens = true), I = [S[0]], m(I[0], g);
  9235. }
  9236. }
  9237. }
  9238. Q = I[0], S = S.slice(I ? I[0].length : 1);
  9239. }
  9240. if (p.pattern = _.slice(0, _.length - S.length), /^((?:\[[^\]]+\])+)(;|$)/.test(p.pattern) && !/^\[(?:h+|m+|s+)\]/.test(p.pattern) && m({ type: "text" }, g), p.fractions && p.dec_fractions || p.fractions && p.exponential)
  9241. throw new SyntaxError("Invalid pattern: ".concat(p.pattern));
  9242. const J = p.int_pattern.join("");
  9243. if (p.grouping = J.indexOf(",") >= 0, p.grouping) {
  9244. const D = J.split(","), q = D.length;
  9245. q === 2 ? (p.group_pri = D[1].length, p.group_sec = p.group_pri) : q > 2 && (p.group_pri = D[q - 1].length, p.group_sec = D[q - 2].length);
  9246. } else
  9247. p.group_pri = 0, p.group_sec = 0;
  9248. Z(J.replace(/[,]/g, ""), p, "int"), Z(p.frac_pattern.join(""), p, "frac"), Z(p.man_pattern.join(""), p, "man");
  9249. let me = p.num_pattern.join(""), ye = p.den_pattern.join("");
  9250. const le = /\?/.test(ye) || /\?/.test(me);
  9251. return ye = ye.replace(/\d/g, le ? "?" : "#"), le && (ye = ye.replace(/#$/g, "?")), Z(me, p, "num"), Z(ye, p, "den"), le && (me = me.replace(/#$/g, "?")), p.int_padding = ae(p.int_pattern.join("")), p.man_padding = ae(p.man_pattern.join("")), p.num_padding = ae(me), p.den_padding = ae(ye), p.den_pattern.length && (p.denominator = parseInt(p.den_pattern.join("").replace(/\D/g, ""), 10)), p.integer = !!p.int_pattern.join("").length, p.fractions && g.forEach((D, q) => {
  9252. const Ce = g[q + 1];
  9253. D.type === "string" && Ce && (Ce.type === "num" ? D.rule = "num+int" : Ce.type === "div" ? D.rule = "num" : Ce.type === "den" && (D.rule = "den"));
  9254. }), p;
  9255. }
  9256. const y = (_) => {
  9257. const g = _.condition;
  9258. g && g[1] < 0 && (g[0] === "<" || g[0] === "<=" || g[0] === "=") || _.tokens.unshift({ type: "minus", volatile: true });
  9259. };
  9260. function M(_) {
  9261. const g = [];
  9262. let p, S = false, N = null, L = _, x = 0, P = false, I = 0, Q = 0;
  9263. do {
  9264. if (P = j(L), (P.date || P.general) && (P.int_pattern.length || P.frac_pattern.length || P.scale !== 1 || P.text))
  9265. throw new Error("Illegal format");
  9266. if (P.condition && (Q++, S = true), P.text) {
  9267. if (N)
  9268. throw new Error("Unexpected partition");
  9269. N = P;
  9270. }
  9271. P.locale && (p = c(P.locale)), g.push(P), x = L.charAt(P.pattern.length) === ";" ? 1 : 0, L = L.slice(P.pattern.length + x), I++;
  9272. } while (x && I < 4 && Q < 3);
  9273. if (x)
  9274. throw new Error("Unexpected partition");
  9275. if (Q > 2)
  9276. throw new Error("Unexpected condition");
  9277. const _e = g[3];
  9278. if (_e && (_e.int_pattern.length || _e.frac_pattern.length || _e.date))
  9279. throw new Error("Unexpected partition");
  9280. if (S) {
  9281. const J = g.length;
  9282. if (J === 1 && (g[1] = j("General"), g[1].generated = true), J < 3) {
  9283. const me = g[0], ye = g[1];
  9284. if (y(me), ye.condition)
  9285. y(ye);
  9286. else {
  9287. const le = me.condition;
  9288. (le[0] === "=" || le[1] >= 0 && (le[0] === ">" || le[0] === ">=")) && ye.tokens.unshift({ type: "minus", volatile: true });
  9289. }
  9290. } else
  9291. g.forEach(y);
  9292. } else {
  9293. if (g.length < 4 && N)
  9294. for (let J = 0, me = g.length; J < me; J++)
  9295. g[J] === N && g.splice(J, 1);
  9296. if (g.length < 1 && N && (g[0] = j("General"), g[0].generated = true), g.length < 2) {
  9297. const J = j(g[0].pattern);
  9298. J.tokens.unshift({ type: "minus", volatile: true }), J.generated = true, g.push(J);
  9299. }
  9300. if (g.length < 3) {
  9301. const J = j(g[0].pattern);
  9302. J.generated = true, g.push(J);
  9303. }
  9304. if (g.length < 4)
  9305. if (N)
  9306. g.push(N);
  9307. else {
  9308. const J = j("@");
  9309. J.generated = true, g.push(J);
  9310. }
  9311. g[0].condition = [">", 0], g[1].condition = ["<", 0], g[2].condition = null;
  9312. }
  9313. return { pattern: _, partitions: g, locale: p };
  9314. }
  9315. const b = Math.floor;
  9316. function w(_) {
  9317. if ((!(arguments.length > 1 && arguments[1] !== void 0) || arguments[1]) && _ >= 0) {
  9318. if (_ === 0)
  9319. return [1900, 1, 0];
  9320. if (_ === 60)
  9321. return [1900, 2, 29];
  9322. if (_ < 60)
  9323. return [1900, _ < 32 ? 1 : 2, (_ - 1) % 31 + 1];
  9324. }
  9325. let p = _ + 68569 + 2415019;
  9326. const S = b(4 * p / 146097);
  9327. p -= b((146097 * S + 3) / 4);
  9328. const N = b(4e3 * (p + 1) / 1461001);
  9329. p = p - b(1461 * N / 4) + 31;
  9330. const L = b(80 * p / 2447), x = p - b(2447 * L / 80);
  9331. p = b(L / 11);
  9332. const P = L + 2 - 12 * p;
  9333. return [0 | 100 * (S - 49) + N + p, 0 | P, 0 | x];
  9334. }
  9335. function k(_) {
  9336. return w(_ + 1462);
  9337. }
  9338. function $(_) {
  9339. if (_ === 60)
  9340. throw new Error("#VALUE!");
  9341. if (_ <= 1)
  9342. return [1317, 8, 29];
  9343. if (_ < 60)
  9344. return [1317, _ < 32 ? 9 : 10, 1 + (_ - 2) % 30];
  9345. const g = 10631 / 30, p = 0.1335;
  9346. let S = _ + 466935;
  9347. const N = b(S / 10631);
  9348. S -= 10631 * N;
  9349. const L = b((S - p) / g);
  9350. S -= b(L * g + p);
  9351. const x = b((S + 28.5001) / 29.5);
  9352. return x === 13 ? [30 * N + L, 12, 30] : [30 * N + L, x, S - b(29.5001 * x - 29)];
  9353. }
  9354. function Y(_) {
  9355. let g = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, p = !(arguments.length > 2 && arguments[2] !== void 0) || arguments[2];
  9356. const S = b(_);
  9357. return g === 6 ? $(S) : g === -1 ? k(S) : w(S, p);
  9358. }
  9359. const se = Math.floor, he = 86400;
  9360. function ge(_, g) {
  9361. let p = null;
  9362. if (Array.isArray(_)) {
  9363. const [S, N, L, x, P, I] = _;
  9364. p = Date.UTC(S, N == null ? 0 : N - 1, L != null ? L : 1, x || 0, P || 0, I || 0);
  9365. } else if (_ instanceof Date && (p = 1 * _, !g || !g.ignoreTimezone)) {
  9366. const S = /* @__PURE__ */ new Date();
  9367. S.setUTCFullYear(_.getFullYear(), _.getMonth(), _.getDate()), S.setUTCHours(_.getHours(), _.getMinutes(), _.getSeconds(), _.getMilliseconds()), p = 1 * S;
  9368. }
  9369. if (p != null && isFinite(p)) {
  9370. const S = p / 864e5;
  9371. return S - (S <= -25509 ? -25568 : -25569);
  9372. }
  9373. return _;
  9374. }
  9375. function Ae(_, g) {
  9376. let p = 0 | _;
  9377. const S = he * (_ - p);
  9378. let N = se(S);
  9379. S - N > 0.9999 && (N += 1, N === he && (N = 0, p += 1));
  9380. const L = N < 0 ? he + N : N, [x, P, I] = Y(_, 0, g && g.leap1900), Q = se(L / 60 / 60) % 60, _e = se(L / 60) % 60, J = se(L) % 60;
  9381. if (g && g.nativeDate) {
  9382. const me = /* @__PURE__ */ new Date(0);
  9383. return me.setUTCFullYear(x, P - 1, I), me.setUTCHours(Q, _e, J), me;
  9384. }
  9385. return [x, P, I, Q, _e, J];
  9386. }
  9387. function be(_) {
  9388. return !!(_[0] && _[0].percent || _[1] && _[1].percent || _[2] && _[2].percent || _[3] && _[3].percent);
  9389. }
  9390. function v(_) {
  9391. return !!(_[0] && _[0].date || _[1] && _[1].date || _[2] && _[2].date || _[3] && _[3].date);
  9392. }
  9393. function F(_) {
  9394. const [g, p, S, N] = _;
  9395. return !(g && !g.generated || p && !p.generated || S && !S.generated || !N || !N.text || N.generated);
  9396. }
  9397. const V = { text: 15, datetime: 10.8, date: 10.8, time: 10.8, percent: 10.6, currency: 10.4, grouped: 10.2, scientific: 6, number: 4, fraction: 2, general: 0, error: 0 }, K = [["DMY", 1], ["DM", 2], ["MY", 3], ["MDY", 4], ["MD", 5], ["hmsa", 6], ["hma", 7], ["hms", 8], ["hm", 9]], z = { total: 1, sign: 0, period: 0, int: 1, frac: 0 }, W = (_, g) => _.replace(/\./, g.decimal);
  9398. function ue(_, g, p, S) {
  9399. const N = 0 | p;
  9400. if (typeof p == "string")
  9401. _.push(p);
  9402. else if (p === N)
  9403. _.push(Math.abs(N));
  9404. else {
  9405. const L = Math.abs(p);
  9406. let x = L ? Math.floor(Math.log10(L)) : 0, P = x < 0 ? L * 10 ** -x : L / 10 ** x;
  9407. P === 10 && (P = 1, x++);
  9408. const I = function(_e) {
  9409. let J = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1];
  9410. const me = Math.abs(_e);
  9411. if (!me)
  9412. return z;
  9413. const ye = J && _e < 0 ? 1 : 0, le = Math.floor(me), D = Math.floor(Math.log10(me) + 1);
  9414. let q = 0, Ce = 0;
  9415. if (le !== me) {
  9416. q = 1;
  9417. const Se = String(E(D < 0 ? me * 10 ** -D : me / 10 ** D, 15));
  9418. let Le = Se.length, Ue = true, je = 0;
  9419. for (; je <= Se.length; ) {
  9420. if (Se[je] === ".") {
  9421. Le--;
  9422. break;
  9423. }
  9424. Se[je] === "0" && Ue ? Le-- : Ue = false, je++;
  9425. }
  9426. Ce = Le - D, Ce < 0 && (Ce = 0, q = 0);
  9427. }
  9428. return { total: ye + Math.max(D, 1) + q + Ce, digits: Math.max(D, 0) + Ce, sign: ye, period: q, int: Math.max(D, 1), frac: Ce };
  9429. }(L), Q = () => {
  9430. const _e = Math.abs(x);
  9431. let J;
  9432. J = P === 1 ? P : E(P, 5), _.push(W(J + "", S), S.exponent, x < 0 ? S.negative : S.positive, _e < 10 ? "0" : "", _e);
  9433. };
  9434. if (x >= -4 && x <= -1) {
  9435. const _e = L.toPrecision(10 + x).replace(/\.?0+$/, "");
  9436. _.push(W(_e, S));
  9437. } else if (x === 10) {
  9438. const _e = L.toFixed(10).slice(0, 12).replace(/\.$/, "");
  9439. _.push(W(_e, S));
  9440. } else if (Math.abs(x) <= 9)
  9441. if (I.total <= 11) {
  9442. const _e = E(L, 9).toFixed(I.frac);
  9443. _.push(W(_e, S));
  9444. } else
  9445. x === 9 ? _.push(Math.floor(L)) : x >= 0 && x < 9 ? _.push(E(L, 9 - x)) : Q();
  9446. else
  9447. I.total >= 12 ? Q() : Math.floor(L) === L ? _.push(Math.floor(L)) : _.push(W(E(L, 9).toFixed(I.frac), S));
  9448. }
  9449. return _;
  9450. }
  9451. const oe = 86400, B = { int: "integer", frac: "fraction", man: "mantissa", num: "numerator", den: "denominator" }, ee = function(_) {
  9452. let g = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
  9453. const p = Math.floor(Math.log10(_));
  9454. return g > 1 ? Math.floor(p / g) * g : p;
  9455. };
  9456. function ie(_, g, p, S) {
  9457. let N = "", L = "", x = "", P = "", I = "", Q = 0, _e = 0 | _, J = 0, me = 0, ye = 1, le = 0, D = 0, q = 0, Ce = 0, Se = 0, Le = 0;
  9458. const Ue = S || f;
  9459. if (!g.text && isFinite(g.scale) && g.scale !== 1 && (_ = function(Ie) {
  9460. if (Ie === 0)
  9461. return Ie;
  9462. const Ne = Math.ceil(Math.log10(Ie < 0 ? -Ie : Ie)), te = 10 ** (16 - Math.floor(Ne));
  9463. return Math.round(Ie * te) / te;
  9464. }(_ * g.scale)), g.exponential) {
  9465. let Ie = Math.abs(_);
  9466. if (Ie) {
  9467. const Ne = 10 ** -ee(Ie, g.int_max), te = E(Ie * Ne, g.frac_max) / Ne;
  9468. Q = ee(te, g.int_max);
  9469. }
  9470. Ie /= 10 ** Q, _ = _ < 0 ? -Ie : Ie, N += Math.abs(Q);
  9471. }
  9472. if (g.integer) {
  9473. const Ie = Math.abs(E(_, g.fractions ? 1 : g.frac_max));
  9474. I += Ie < 1 ? "" : Math.floor(Ie);
  9475. }
  9476. if (g.grouping) {
  9477. let Ie = "", Ne = I.length;
  9478. for (Ne > g.group_pri && (Ne -= g.group_pri, Ie = Ue.group + I.slice(Ne, Ne + g.group_pri) + Ie); Ne > g.group_sec; )
  9479. Ne -= g.group_sec, Ie = Ue.group + I.slice(Ne, Ne + g.group_sec) + Ie;
  9480. I = Ne ? I.slice(0, Ne) + Ie : Ie;
  9481. }
  9482. g.dec_fractions && (P = String(E(_, g.frac_max)).split(".")[1] || "");
  9483. let je = false;
  9484. if (g.fractions) {
  9485. const Ie = Math.abs(g.integer ? _ % 1 : _);
  9486. if (Ie)
  9487. if (je = true, isFinite(g.denominator))
  9488. x += g.denominator, L += E(Ie * g.denominator), L === "0" && (L = "", x = "", je = false, I || (I = "0"));
  9489. else {
  9490. const Ne = R(Ie, g.integer ? g.num_max : 1 / 0, g.den_max);
  9491. L += Ne[0], x += Ne[1], g.integer && L === "0" && (I || (I = "0"), L = "", x = "", je = false);
  9492. }
  9493. }
  9494. if (g.date) {
  9495. _e = Math.trunc(_);
  9496. const Ie = oe * (_ - _e);
  9497. if (J = Math.floor(Ie), Le = Ie - J, Math.abs(Le) < 1e-6 ? Le = 0 : Le > 0.9999 && (Le = 0, J += 1, J === oe && (J = 0, _e += 1)), Le) {
  9498. const Ne = 512 & g.date || 256 & g.date || 128 & g.date;
  9499. (Ne === 512 && Le > 0.9995 || Ne === 256 && Le > 0.995 || Ne === 128 && Le > 0.95 || !Ne && Le >= 0.5) && (J++, Le = 0);
  9500. }
  9501. if (_e || g.date_system) {
  9502. const Ne = Y(_, g.date_system, p.leap1900);
  9503. me = Ne[0], ye = Ne[1], le = Ne[2];
  9504. }
  9505. if (J) {
  9506. const Ne = J < 0 ? oe + J : J;
  9507. Se = Math.floor(Ne) % 60, Ce = Math.floor(Ne / 60) % 60, q = Math.floor(Ne / 60 / 60) % 60;
  9508. }
  9509. if (D = (6 + _e) % 7, g.date_eval && (dt = _, pt = _e + J / oe, p.dateSpanLarge ? dt < -694324 || pt >= 35830291 : dt < 0 || pt >= 2958466)) {
  9510. if (p.dateErrorThrows)
  9511. throw new Error("Date out of bounds");
  9512. return p.dateErrorNumber ? ue(_ < 0 ? [Ue.negative] : [], 0, _, Ue).join("") : p.overflow;
  9513. }
  9514. }
  9515. var dt, pt;
  9516. if (g.int_padding && (I = g.int_padding.length === 1 ? I || g.int_padding : g.int_padding.substring(0, g.int_padding.length - I.length) + I), g.num_padding && (L = g.num_padding.length === 1 ? L || g.num_padding : g.num_padding.substring(0, g.num_padding.length - L.length) + L), g.den_padding && (x = g.den_padding.length === 1 ? x || g.den_padding : x + g.den_padding.slice(x.length)), g.man_padding) {
  9517. const Ie = g.exp_plus ? "+" : "";
  9518. N = g.man_padding.length === 1 ? (Q < 0 ? "-" : Ie) + (N || g.man_padding) : (Q < 0 ? "-" : Ie) + g.man_padding.slice(0, g.man_padding.length - N.length) + N;
  9519. }
  9520. const Ee = [];
  9521. let qe = 0;
  9522. const ve = { int: 0, frac: 0, man: 0, num: 0, den: 0 };
  9523. for (let Ie = 0, Ne = g.tokens.length; Ie < Ne; Ie++) {
  9524. const te = g.tokens[Ie], ut = te.num ? te.num.length : 0;
  9525. if (te.type === "string")
  9526. te.rule ? te.rule === "num" ? je ? Ee.push(te.value) : (g.num_min > 0 || g.den_min > 0) && Ee.push(te.value.replace(/./g, X["?"])) : te.rule === "num+int" ? je && I ? Ee.push(te.value) : g.den_min > 0 && (I || g.num_min) && Ee.push(te.value.replace(/./g, X["?"])) : te.rule === "den" && (je ? Ee.push(te.value) : (g.den_min > 0 || g.den_min > 0) && Ee.push(te.value.replace(/./g, X["?"]))) : Ee.push(te.value);
  9527. else if (te.type === "error")
  9528. Ee.push(p.invalid);
  9529. else if (te.type === "point")
  9530. Ee.push(g.date ? te.value : Ue.decimal);
  9531. else if (te.type === "general")
  9532. ue(Ee, 0, _, Ue);
  9533. else if (te.type === "exp")
  9534. Ee.push(Ue.exponent);
  9535. else if (te.type === "minus")
  9536. te.volatile && g.date || te.volatile && (_ >= 0 || typeof _ != "number") || (te.volatile && !g.fractions && (g.integer || g.dec_fractions) ? (_ < 0 && I && I !== "0" || P) && Ee.push(Ue.negative) : Ee.push(Ue.negative));
  9537. else if (te.type === "plus")
  9538. Ee.push(Ue.positive);
  9539. else if (te.type === "text")
  9540. Ee.push(_);
  9541. else if (te.type === "div")
  9542. je ? Ee.push("/") : g.num_min > 0 || g.den_min > 0 ? Ee.push(X["?"]) : Ee.push(X["#"]);
  9543. else if (te.type === "int")
  9544. if (g.int_pattern.length === 1)
  9545. Ee.push(I);
  9546. else {
  9547. const $e = qe ? g.int_pattern.join("").length - ve.int : 1 / 0, At = qe === g.int_pattern.length - 1 ? 0 : g.int_pattern.join("").length - (ve.int + te.num.length);
  9548. Ee.push(I.substring(I.length - $e, I.length - At)), qe++, ve.int += te.num.length;
  9549. }
  9550. else if (te.type === "frac") {
  9551. const $e = ve.frac;
  9552. for (let At = 0; At < ut; At++)
  9553. Ee.push(P[At + $e] || X[te.num[At]]);
  9554. ve.frac += ut;
  9555. } else if (te.type in B)
  9556. g[te.type + "_pattern"].length === 1 ? (te.type === "int" && Ee.push(I), te.type === "frac" && Ee.push(P), te.type === "man" && Ee.push(N), te.type === "num" && Ee.push(L), te.type === "den" && Ee.push(x)) : (Ee.push(B[te.type].slice(ve[te.type], ve[te.type] + ut)), ve[te.type] += ut);
  9557. else if (te.type === "year")
  9558. me < 0 && Ee.push(Ue.negative), Ee.push(String(Math.abs(me)).padStart(4, "0"));
  9559. else if (te.type === "year-short") {
  9560. const $e = me % 100;
  9561. Ee.push($e < 10 ? "0" : "", $e);
  9562. } else if (te.type === "month")
  9563. Ee.push(te.pad && ye < 10 ? "0" : "", ye);
  9564. else if (te.type === "monthname-single")
  9565. g.date_system === 6 ? Ee.push(Ue.mmmm6[ye - 1].charAt(0)) : Ee.push(Ue.mmmm[ye - 1].charAt(0));
  9566. else if (te.type === "monthname-short")
  9567. g.date_system === 6 ? Ee.push(Ue.mmm6[ye - 1]) : Ee.push(Ue.mmm[ye - 1]);
  9568. else if (te.type === "monthname")
  9569. g.date_system === 6 ? Ee.push(Ue.mmmm6[ye - 1]) : Ee.push(Ue.mmmm[ye - 1]);
  9570. else if (te.type === "weekday-short")
  9571. Ee.push(Ue.ddd[D]);
  9572. else if (te.type === "weekday")
  9573. Ee.push(Ue.dddd[D]);
  9574. else if (te.type === "day")
  9575. Ee.push(te.pad && le < 10 ? "0" : "", le);
  9576. else if (te.type === "hour") {
  9577. const $e = q % g.clock || (g.clock < 24 ? g.clock : 0);
  9578. Ee.push(te.pad && $e < 10 ? "0" : "", $e);
  9579. } else if (te.type === "min")
  9580. Ee.push(te.pad && Ce < 10 ? "0" : "", Ce);
  9581. else if (te.type === "sec")
  9582. Ee.push(te.pad && Se < 10 ? "0" : "", Se);
  9583. else if (te.type === "subsec") {
  9584. Ee.push(Ue.decimal);
  9585. const $e = Le.toFixed(g.sec_decimals);
  9586. Ee.push($e.slice(2, 2 + te.decimals));
  9587. } else if (te.type === "am") {
  9588. const $e = q < 12 ? 0 : 1;
  9589. te.short && !S ? Ee.push("AP"[$e]) : Ee.push(Ue.ampm[$e]);
  9590. } else if (te.type === "hour-elap") {
  9591. _ < 0 && Ee.push(Ue.negative);
  9592. const $e = 24 * _e + Math.floor(Math.abs(J) / 3600);
  9593. Ee.push(String(Math.abs($e)).padStart(te.pad, "0"));
  9594. } else if (te.type === "min-elap") {
  9595. _ < 0 && Ee.push(Ue.negative);
  9596. const $e = 1440 * _e + Math.floor(Math.abs(J) / 60);
  9597. Ee.push(String(Math.abs($e)).padStart(te.pad, "0"));
  9598. } else if (te.type === "sec-elap") {
  9599. _ < 0 && Ee.push(Ue.negative);
  9600. const $e = _e * oe + Math.abs(J);
  9601. Ee.push(String(Math.abs($e)).padStart(te.pad, "0"));
  9602. } else if (te.type === "b-year")
  9603. Ee.push(me + 543);
  9604. else if (te.type === "b-year-short") {
  9605. const $e = (me + 543) % 100;
  9606. Ee.push($e < 10 ? "0" : "", $e);
  9607. }
  9608. }
  9609. return p.nbsp ? Ee.join("") : Ee.join("").replace(/\u00a0/g, " ");
  9610. }
  9611. function pe(_, g) {
  9612. for (let p = 0; p < 3; p++) {
  9613. const S = g[p];
  9614. if (S) {
  9615. let N;
  9616. if (S.condition) {
  9617. const L = S.condition[0], x = S.condition[1];
  9618. L === "=" ? N = _ === x : L === ">" ? N = _ > x : L === "<" ? N = _ < x : L === ">=" ? N = _ >= x : L === "<=" ? N = _ <= x : L === "<>" && (N = _ !== x);
  9619. } else
  9620. N = true;
  9621. if (N)
  9622. return S;
  9623. }
  9624. }
  9625. }
  9626. const Oe = j("@"), Me = "black", G = {};
  9627. function Re(_, g) {
  9628. if (_) {
  9629. const p = _[0];
  9630. g[p] = g[p] || {}, Re(_.slice(1), g[p]);
  9631. } else
  9632. g.$ = true;
  9633. }
  9634. ["d-F-y", "d-F-Y", "d-M-y", "d-M-Y", "F-d-y", "F-d-Y", "F-j-y", "F-j-Y", "j-F-y", "j-F-Y", "j-M-y", "j-M-Y", "M-d-y", "M-d-Y", "M-j-y", "M-j-Y", "m-d-y", "m-d-Y", "m-j-y", "m-j-Y", "n-d-y", "n-d-Y", "n-j-y", "n-j-Y", "y-F-d", "y-F-j", "y-M-d", "y-M-j", "Y-F-d", "Y-F-j", "Y-M-d", "Y-m-d", "Y-M-j", "Y-m-j", "Y-n-d", "Y-n-j", "j-F", "j-M", "d-F", "d-M", "n-d", "n-j", "n-Y", "m-d", "m-j", "m-Y", "M-Y", "M-y", "F-y", "F-Y", "Y-M", "Y-n", "Y-m", "Y-F", "Y-M"].forEach((_) => {
  9635. Re(_, G), Re(_ + " x", G), Re(_ + " l", G), Re(_ + " l x", G), Re("l " + _, G), Re("l " + _ + " x", G), Re(_ + " D", G), Re(_ + " D x", G), Re("D " + _, G), Re("D " + _ + " x", G);
  9636. });
  9637. const He = { jan: 1, feb: 2, mar: 3, apr: 4, may: 5, jun: 6, jul: 7, aug: 8, sep: 9, oct: 10, nov: 11, dec: 12 }, Be = { january: 1, february: 2, march: 3, april: 4, june: 6, july: 7, august: 8, september: 9, october: 10, november: 11, december: 12 }, xe = { sunday: "l", monday: "l", tuesday: "l", wednesday: "l", thursday: "l", friday: "l", saturday: "l", sun: "D", mon: "D", tue: "D", wed: "D", thu: "D", fri: "D", sat: "D" }, Je = (/* @__PURE__ */ new Date()).getUTCFullYear();
  9638. function Rt(_) {
  9639. const g = new RegExp("^([\\s+%" + A.join("") + "(-]*)(((?:(?:\\d[\\d,]*)(?:\\.\\d*)?|(?:\\.\\d+)))([eE][+-]?\\d+)?)([\\s%" + A.join("") + ")]*)$").exec(_);
  9640. if (g) {
  9641. const [, p, S, N, L, x] = g;
  9642. let P = 1, I = "", Q = false, _e = false, J = false, me = false, ye = false, le = null, D = false, q = parseFloat(S.replace(/,/g, ""));
  9643. if (!isFinite(q))
  9644. return null;
  9645. for (let Se = 0; Se < p.length; Se++) {
  9646. const Le = p[Se];
  9647. if (Le === "-") {
  9648. if (Q || _e)
  9649. return null;
  9650. Q = true, P = -1;
  9651. } else if (H.test(Le)) {
  9652. if (ye)
  9653. return null;
  9654. ye = true, le = Le;
  9655. } else if (Le === "(") {
  9656. if (_e || Q)
  9657. return null;
  9658. _e = true, P = -1;
  9659. } else if (Le === "%") {
  9660. if (me)
  9661. return null;
  9662. me = true;
  9663. }
  9664. }
  9665. for (let Se = 0; Se < x.length; Se++) {
  9666. const Le = x[Se];
  9667. if (H.test(Le)) {
  9668. if (ye)
  9669. return null;
  9670. ye = true, le = Le, D = true;
  9671. } else if (Le === ")") {
  9672. if (J || !_e)
  9673. return null;
  9674. J = true;
  9675. } else if (Le === "%") {
  9676. if (me)
  9677. return null;
  9678. me = true;
  9679. }
  9680. }
  9681. if (L) {
  9682. if (me || ye)
  9683. return null;
  9684. I = "0.00E+00";
  9685. } else if (me) {
  9686. if (ye)
  9687. return null;
  9688. I = N.includes(".") ? "0.00%" : "0%", q *= 0.01;
  9689. } else if (ye) {
  9690. const Se = N.includes(".") ? "#,##0.00" : "#,##0";
  9691. I = D ? Se + le : le + Se;
  9692. } else
  9693. N.includes(",") && (I = N.includes(".") ? "#,##0.00" : "#,##0");
  9694. const Ce = { v: q * P };
  9695. return I && (Ce.z = I), Ce;
  9696. }
  9697. }
  9698. const We = (_, g, p) => {
  9699. const S = p.path || "", N = Object.keys(g);
  9700. for (let L = 0; L < N.length; L++) {
  9701. let x;
  9702. const P = N[L];
  9703. if (g[P]) {
  9704. if (P === "$" || P === "€")
  9705. _ || (x = p);
  9706. else if (P === "-") {
  9707. const I = /^(\s*([./-]|,\s)\s*|\s+)/.exec(_);
  9708. if (I) {
  9709. const Q = I[1] === "-" || I[1] === "/" || I[1] === "." ? I[1] : " ";
  9710. if (!p.sep || p.sep === Q) {
  9711. const _e = I[0].replace(/\s+/g, " ");
  9712. x = We(_.slice(I[0].length), g[P], { ...p, sep: Q, path: S + _e });
  9713. }
  9714. }
  9715. } else if (P === " ") {
  9716. const I = /^[,.]?\s+/.exec(_);
  9717. if (I) {
  9718. const Q = I[0].replace(/\s+/g, " ");
  9719. x = We(_.slice(I[0].length), g[P], { ...p, path: S + Q });
  9720. }
  9721. } else if (P === "j" || P === "d") {
  9722. const I = /^(0?[1-9]|1\d|2\d|3[01])\b/.exec(_);
  9723. I && (x = We(_.slice(I[0].length), g[P], { ...p, day: I[0], path: S + P }));
  9724. } else if (P === "n" || P === "m") {
  9725. const I = /^(0?[1-9]|1[012])\b/.exec(_);
  9726. I && (x = We(_.slice(I[0].length), g[P], { ...p, month: +I[0], _mon: I[0], path: S + P }));
  9727. } else if (P === "F" || P === "M") {
  9728. const I = /^([a-z]{3,9})\b/i.exec(_), Q = I && (P === "F" ? Be : He)[I[0].toLowerCase()];
  9729. Q && (x = We(_.slice(I[0].length), g[P], { ...p, month: Q, _mon: I[0], path: S + P }));
  9730. } else if (P === "l" || P === "D") {
  9731. const I = /^([a-z]{3,9})\b/i.exec(_);
  9732. (I && xe[I[0].toLowerCase()]) === P && (x = We(_.slice(I[0].length), g[P], { ...p, path: S + P }));
  9733. } else if (P === "y") {
  9734. const I = /^\d\d\b/.exec(_);
  9735. if (I) {
  9736. const Q = +I[0] >= 30 ? +I[0] + 1900 : +I[0] + 2e3;
  9737. x = We(_.slice(I[0].length), g[P], { ...p, year: Q, path: S + P });
  9738. }
  9739. } else if (P === "Y") {
  9740. const I = /^\d\d\d\d\b/.exec(_);
  9741. I && (x = We(_.slice(I[0].length), g[P], { ...p, year: +I[0], path: S + P }));
  9742. } else {
  9743. if (P !== "x")
  9744. throw new Error('Unknown date token "'.concat(P, '"'));
  9745. {
  9746. const I = ze(_);
  9747. I && (x = We("", g[P], { ...p, time: I.v, tf: I.z, path: S + P }));
  9748. }
  9749. }
  9750. if (x)
  9751. return x;
  9752. }
  9753. }
  9754. };
  9755. function et(_, g) {
  9756. const p = We(_.trim(), G, { path: "" });
  9757. if (p) {
  9758. var S;
  9759. if (p.sep === "." && p.path.length === 3)
  9760. return null;
  9761. const N = +((S = p.year) !== null && S !== void 0 ? S : Je);
  9762. if (p.day || (p.day = 1), !function(P, I, Q) {
  9763. if (Q < 1 || I < 1 || I > 12)
  9764. return false;
  9765. if (I === 2) {
  9766. if (Q > (P % 4 == 0 && P % 100 != 0 || P % 400 == 0 || P === 1900 ? 29 : 28))
  9767. return false;
  9768. } else if ((I === 4 || I === 6 || I === 9 || I === 11) && Q > 30 || (I === 1 || I === 3 || I === 5 || I === 7 || I === 8 || I === 10 || I === 12) && Q > 31)
  9769. return false;
  9770. return true;
  9771. }(N, p.month, p.day))
  9772. return null;
  9773. let L = -1 / 0;
  9774. if (N < 1900)
  9775. return null;
  9776. N <= 1900 && p.month <= 2 ? L = 25568 : N < 1e4 && (L = 25569);
  9777. const x = Date.UTC(N, p.month - 1, p.day) / 864e5 + L + (p.time || 0);
  9778. if (x >= 0 && x <= 2958465) {
  9779. const P = p._mon[0] === "0" || p.day[0] === "0" || p._mon.length === 2 && p.day.length === 2, I = p.path.replace(/[jdlDnmMFyYx-]/g, (Q) => Q === "j" || Q === "d" ? P ? "dd" : "d" : Q === "D" ? "ddd" : Q === "l" ? "dddd" : Q === "n" || Q === "m" ? P ? "mm" : "m" : Q === "M" ? "mmm" : Q === "F" ? "mmmm" : Q === "y" ? "yy" : Q === "x" ? p.tf || "" : Q === "Y" ? "yyyy" : Q);
  9780. return g && g.nativeDate ? { v: Ae(x, g), z: I } : { v: x, z: I };
  9781. }
  9782. }
  9783. return null;
  9784. }
  9785. function ze(_) {
  9786. const g = /^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?:\s*([AP])M?)?\s*$/i.exec(_);
  9787. if (g) {
  9788. const [, p, S, N, L, x] = g;
  9789. if (L && !N || !x && !S && !N)
  9790. return null;
  9791. let P = 1 * (p || 0);
  9792. if (x) {
  9793. if (P >= 13)
  9794. return null;
  9795. x[0] !== "p" && x[0] !== "P" || (P += 12);
  9796. }
  9797. return { v: (60 * P * 60 + 60 * (1 * (S || 0)) + 1 * (N || 0) + 1 * (L || 0)) / 86400, z: (p.length === 2 ? "hh" : "h") + ":mm" + (N ? ":ss" : "") + (x ? " AM/PM" : "") };
  9798. }
  9799. return null;
  9800. }
  9801. function ct(_) {
  9802. return /^\s*true\s*$/i.test(_) ? { v: true } : /^\s*false\s*$/i.test(_) ? { v: false } : null;
  9803. }
  9804. const it = {};
  9805. function xt(_, g) {
  9806. const { pattern: p, partitions: S, locale: N } = _, L = (I) => {
  9807. const Q = Object.assign({}, ne(), g, I);
  9808. return N && (Q.locale = N), Q;
  9809. }, x = (I, Q) => {
  9810. const _e = L(Q);
  9811. return function(J, me, ye) {
  9812. const le = l(ye.locale), D = me[3] ? me[3] : Oe;
  9813. if (typeof J == "boolean" && (J = J ? "TRUE" : "FALSE"), J == null)
  9814. return "";
  9815. if (typeof J != "number")
  9816. return ie(J, D, ye, le);
  9817. if (!isFinite(J)) {
  9818. const Ce = le || f;
  9819. return isNaN(J) ? Ce.nan : (J < 0 ? Ce.negative : "") + Ce.infinity;
  9820. }
  9821. const q = pe(J, me);
  9822. return q ? ie(J, q, ye, le) : ye.overflow;
  9823. }(ge(I, _e), S, _e);
  9824. };
  9825. x.color = (I, Q) => function(_e, J) {
  9826. if (typeof _e != "number" || !isFinite(_e))
  9827. return (J[3] ? J[3].color : Oe.color) || Me;
  9828. const me = pe(_e, J);
  9829. return me && me.color || Me;
  9830. }(ge(I, L(Q)), S);
  9831. const P = function(I) {
  9832. var Q;
  9833. let _e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
  9834. const [J, me] = I, ye = J.frac_max, le = { type: "general", isDate: v(I), isText: F(I), isPercent: be(I), maxDecimals: J.general ? 9 : ye, scale: (Q = J.scale) !== null && Q !== void 0 ? Q : 1, color: 0, parentheses: 0, grouped: J.grouping ? 1 : 0, _partitions: I }, D = !le.isDate && !le.isText && !J.error && J.tokens.some((Ue) => Ue.type === "string" && (_e ? Ue.value === _e : H.test(Ue.value)));
  9835. let q = "G", Ce = ye >= 0 ? Math.min(15, ye) : "", Se = "", Le = "";
  9836. if (me && me.color && (Le = "-", le.color = 1), J.parens && (Se = "()", le.parentheses = 1), D)
  9837. q = "C", le.type = "currency";
  9838. else if (J.error)
  9839. le.type = "error", le.maxDecimals = 0;
  9840. else if (le.isDate) {
  9841. let Ue = 0, je = 0, dt = "";
  9842. J.tokens.forEach((Ee) => {
  9843. const qe = Ee.type;
  9844. /^(b-)?year/.test(qe) ? (dt += "Y", je++) : qe.startsWith("month") ? (dt += "M", je++) : /^(week)?day/.test(qe) ? (dt += "D", je++) : qe !== "hour" && qe !== "min" && qe !== "sec" && qe !== "am" || (dt += qe[0], Ue++);
  9845. }), le.type = "date", je && Ue ? le.type = "datetime" : !je && Ue && (le.type = "time");
  9846. const pt = K.find((Ee) => dt.startsWith(Ee[0]));
  9847. q = pt ? "D" : "G", Ce = pt ? pt[1] : "";
  9848. } else
  9849. le.isText ? (q = "G", le.type = "text", Ce = "", le.maxDecimals = 0) : J.general ? (q = "G", le.type = "general", Ce = "") : J.fractions ? (q = "G", le.type = "fraction", Ce = "") : J.exponential ? (q = "S", le.type = "scientific") : le.isPercent ? (q = "P", le.type = "percent") : J.grouping ? (q = ",", le.type = "grouped") : (J.int_max || ye) && (q = "F", le.type = "number");
  9850. return le.code = q + Ce + Le + Se, le.level = V[le.type], Object.freeze(le);
  9851. }(S, (g || {}).currency) || new SyntaxError();
  9852. return x.info = P, x.dateInfo = function(I) {
  9853. const [Q] = I;
  9854. return { year: !!(2 & Q.date), month: !!(4 & Q.date), day: !!(8 & Q.date), hours: !!(16 & Q.date), minutes: !!(32 & Q.date), seconds: !!(64 & Q.date), clockType: Q.clock === 12 ? 12 : 24 };
  9855. }(S), x.isPercent = () => !!P.isPercent, x.isDate = () => !!P.isDate, x.isText = () => !!P.isText, x.pattern = p, _.error && (x.error = _.error), x.options = L, x.locale = N || g && g.locale || "", Object.freeze(x);
  9856. }
  9857. function ke(_, g) {
  9858. _ || (_ = "General");
  9859. let p = null;
  9860. return it[_] ? p = it[_] : (p = Object.assign({}, ne(), g).throws ? M(_) : function(S) {
  9861. try {
  9862. return M(S);
  9863. } catch (N) {
  9864. const L = { tokens: [{ type: "error" }], error: N.message };
  9865. return { pattern: S, partitions: [L, L, L, L], error: N.message, locale: null };
  9866. }
  9867. }(_), p.error || (it[_] = p)), xt(p, g);
  9868. }
  9869. ke.isDate = (_) => ke(_, { throws: false }).isDate(), ke.isPercent = (_) => ke(_, { throws: false }).isPercent(), ke.isText = (_) => ke(_, { throws: false }).isText(), ke.getInfo = (_, g) => ke(_, { ...g, throws: false }).info, ke.getDateInfo = (_, g) => ke(_, { ...g, throws: false }).dateInfo, ke.dateToSerial = ge, ke.dateFromSerial = Ae, ke.options = ne, ke.dec2frac = R, ke.round = E, ke.codeToLocale = s, ke.parseLocale = u, ke.getLocale = l, ke.addLocale = (_, g) => {
  9870. const p = u(g);
  9871. return delete it[p.lang], delete it[p.language], d(_, p);
  9872. }, ke.format = function(_, g, p) {
  9873. let S = arguments.length > 3 && arguments[3] !== void 0 && arguments[3];
  9874. const N = p && typeof p == "object" ? p : { locale: p, throws: !S };
  9875. return ke(_, N)(ge(g, N), N);
  9876. }, ke.is_date = ke.isDate, ke.parseNumber = Rt, ke.parseDate = et, ke.parseTime = ze, ke.parseBool = ct, ke.parseValue = function(_, g) {
  9877. var p, S, N;
  9878. return (p = (S = (N = Rt(_)) !== null && N !== void 0 ? N : et(_, g)) !== null && S !== void 0 ? S : ze(_)) !== null && p !== void 0 ? p : ct(_);
  9879. };
  9880. var ht = ke;
  9881. return r = r.default;
  9882. }();
  9883. });
  9884. }(Yr)), Yr.exports;
  9885. }
  9886. var As;
  9887. var Yo;
  9888. function vp() {
  9889. return Yo || (Yo = 1, As = Ip()), As;
  9890. }
  9891. var yp = vp();
  9892. var wp = wt(yp);
  9893. var Op = wp;
  9894. function fn(t) {
  9895. let e = 0;
  9896. const n = Object.keys(t);
  9897. for (const r of n) {
  9898. const s = Number(r);
  9899. e = Math.max(e, s);
  9900. }
  9901. return e + 1;
  9902. }
  9903. function Vo(t, e, n) {
  9904. const r = fn(n), s = n;
  9905. for (let i = r - 1; i >= t; i--)
  9906. s[i + 1] = s[i];
  9907. s[t] = e;
  9908. }
  9909. function Go(t, e, n) {
  9910. const r = Object.keys(n).reduce((s, i) => Math.max(s, Number.parseInt(i)), 0) + 1;
  9911. for (let s = t; s < r; s++)
  9912. s < t + e ? delete n[s] : n[s] !== void 0 && (n[s - e] = n[s], delete n[s]);
  9913. }
  9914. function LC(t, e) {
  9915. const n = t, r = Object.keys(n), s = r.length, i = e, o = Object.keys(i), a = o.length, u = {};
  9916. let c = 0;
  9917. for (let l = 0; l < s; l++, c++) {
  9918. const h = r[l];
  9919. u[c] = n[h];
  9920. }
  9921. for (let l = 0; l < a; l++, c++) {
  9922. const h = o[l];
  9923. u[c] = i[h];
  9924. }
  9925. return u;
  9926. }
  9927. function UC(t, e, n) {
  9928. const r = n;
  9929. if (fn(n) > 0) {
  9930. const i = {};
  9931. let o = 0;
  9932. for (let a = t; a <= e; a++)
  9933. r[a] && (i[o] = r[a], o++);
  9934. return i;
  9935. }
  9936. return {};
  9937. }
  9938. function Ko(t, e, n, r) {
  9939. const s = t > n;
  9940. if (!s && t + e > n)
  9941. throw new Error("Invalid move operation");
  9942. s ? bp(t, e, n, r) : Sp(t, e, n, r);
  9943. }
  9944. function bp(t, e, n, r) {
  9945. const s = r, i = [];
  9946. for (let o = t; o < t + e; o++)
  9947. i.push(s[o]);
  9948. for (let o = t - 1; o >= n; o--) {
  9949. const a = s[o];
  9950. s[o + e] = a, a === void 0 && delete s[o + e];
  9951. }
  9952. i.forEach((o, a) => {
  9953. s[n + a] = o, o === void 0 && delete s[n + a];
  9954. });
  9955. }
  9956. function Sp(t, e, n, r) {
  9957. const s = r, i = [];
  9958. for (let o = t; o < t + e; o++)
  9959. i.push(s[o]);
  9960. for (let o = t + e; o < n; o++) {
  9961. const a = s[o];
  9962. s[o - e] = a, a === void 0 && delete s[o - e];
  9963. }
  9964. i.forEach((o, a) => {
  9965. s[n + a - e] = o, o === void 0 && delete s[n + a - e];
  9966. });
  9967. }
  9968. var kt = class _kt {
  9969. constructor(e = {}) {
  9970. C(this, "_matrix");
  9971. this._setOriginValue(e);
  9972. }
  9973. static MakeObjectMatrixSize(e) {
  9974. return new _kt({
  9975. [e - 1]: {}
  9976. });
  9977. }
  9978. getMatrix() {
  9979. return this._matrix;
  9980. }
  9981. forEach(e) {
  9982. const n = this._matrix, r = Object.keys(n);
  9983. for (const s of r) {
  9984. const i = Number(s), o = n[i];
  9985. if (e(i, o) === false)
  9986. return this;
  9987. }
  9988. return this;
  9989. }
  9990. forRow(e) {
  9991. const n = this._matrix, r = Object.keys(n);
  9992. for (const s of r) {
  9993. const i = Number(s), o = n[i];
  9994. if (e(
  9995. i,
  9996. Object.keys(o).map((u) => Number(u))
  9997. ) === false)
  9998. return this;
  9999. }
  10000. return this;
  10001. }
  10002. /**
  10003. * Iterate the object matrix with row priority, which means it scan the whole range row by row.
  10004. */
  10005. forValue(e) {
  10006. const n = this._matrix;
  10007. for (const r in n) {
  10008. const s = Number(r), i = n[s];
  10009. if (i)
  10010. for (const o in i) {
  10011. const a = Number(o), u = i[a];
  10012. if (e(s, a, u) === false)
  10013. return this;
  10014. }
  10015. }
  10016. return this;
  10017. }
  10018. swapRow(e, n) {
  10019. const r = this._matrix[e], s = this._matrix[n];
  10020. this._matrix[e] = s, this._matrix[n] = r;
  10021. }
  10022. getRow(e) {
  10023. return this._matrix[e];
  10024. }
  10025. getRowOrCreate(e) {
  10026. let n = this.getRow(e);
  10027. return n == null && (n = {}, this._matrix[e] = n), n;
  10028. }
  10029. reset() {
  10030. this._setOriginValue({});
  10031. }
  10032. hasValue() {
  10033. const e = this._matrix, n = Object.keys(e);
  10034. if (n.length === 0)
  10035. return false;
  10036. for (const r of n) {
  10037. const s = Number(r), i = e[s];
  10038. if (Object.keys(i).length > 0)
  10039. return true;
  10040. }
  10041. return false;
  10042. }
  10043. getValue(e, n) {
  10044. var r, s;
  10045. return (s = (r = this._matrix) == null ? void 0 : r[e]) == null ? void 0 : s[n];
  10046. }
  10047. setValue(e, n, r) {
  10048. const s = this.getRowOrCreate(e);
  10049. s[n] = r;
  10050. }
  10051. /**
  10052. * !!
  10053. * Please +1 ‘!’, who fell into this pit.
  10054. * @deprecated use `realDelete` or `splice`
  10055. */
  10056. deleteValue(e, n) {
  10057. var r, s;
  10058. (s = (r = this._matrix) == null ? void 0 : r[e]) == null || delete s[n];
  10059. }
  10060. realDeleteValue(e, n) {
  10061. var r, s, i;
  10062. if ((s = (r = this._matrix) == null ? void 0 : r[e]) == null || delete s[n], this.getRow(e)) {
  10063. const o = this.getRow(e);
  10064. if (o == null)
  10065. return;
  10066. Object.keys(o).length === 0 && ((i = this._matrix) == null || delete i[e]);
  10067. }
  10068. }
  10069. setRow(e, n) {
  10070. this._matrix[e] = n;
  10071. }
  10072. moveRows(e, n, r) {
  10073. Ko(e, n, r, this._matrix);
  10074. }
  10075. moveColumns(e, n, r) {
  10076. this.forEach((s, i) => {
  10077. Ko(e, n, r, i);
  10078. });
  10079. }
  10080. insertRows(e, n) {
  10081. for (let r = e; r < e + n; r++)
  10082. Vo(r, {}, this._matrix);
  10083. }
  10084. insertColumns(e, n) {
  10085. for (let r = e; r < e + n; r++)
  10086. this.forEach((s, i) => {
  10087. i && Vo(r, void 0, i);
  10088. });
  10089. }
  10090. removeRows(e, n) {
  10091. Go(e, n, this._matrix);
  10092. }
  10093. removeColumns(e, n) {
  10094. this.forEach((r, s) => {
  10095. s && Go(e, n, s);
  10096. });
  10097. }
  10098. /**
  10099. * Return a fragment of the original data matrix. Note that the returned matrix's row matrix would start from
  10100. * 0 not `startRow`. Neither does its column matrix. If you want to get the original matrix, use `getSlice`.
  10101. *
  10102. * @param startRow
  10103. * @param endRow
  10104. * @param startColumn
  10105. * @param endColumn
  10106. * @returns
  10107. */
  10108. getFragment(e, n, r, s) {
  10109. const i = new _kt();
  10110. let o = 0;
  10111. for (let a = e; a <= n; a++) {
  10112. const u = {};
  10113. let c = 0;
  10114. for (let l = r; l <= s; l++) {
  10115. const h = this.getValue(a, l);
  10116. u[c] = h, c++;
  10117. }
  10118. i.setRow(o, u), o++;
  10119. }
  10120. return i;
  10121. }
  10122. /**
  10123. * Return a slice of the original data matrix. Note that the returned matrix's row matrix would start from
  10124. * `startRow` not 0, and the same does its column index. You may be looking for `getFragment` if you want
  10125. * both of the indexes start from 0.
  10126. *
  10127. * @param startRow
  10128. * @param endRow
  10129. * @param startColumn
  10130. * @param endColumn
  10131. * @returns
  10132. */
  10133. getSlice(e, n, r, s) {
  10134. const i = new _kt();
  10135. for (let o = e; o <= n; o++)
  10136. for (let a = r; a <= s; a++) {
  10137. const u = this.getValue(o, a);
  10138. u && i.setValue(o, a, re.deepClone(u));
  10139. }
  10140. return i;
  10141. }
  10142. getSizeOf() {
  10143. return Object.keys(this._matrix).length;
  10144. }
  10145. getLength() {
  10146. return fn(this._matrix);
  10147. }
  10148. getRange() {
  10149. const r = this.getLength() - 1;
  10150. let s = 0;
  10151. const i = this.getLength();
  10152. for (let o = 0; o < i; o++) {
  10153. const a = this.getRow(o);
  10154. if (a) {
  10155. const u = fn(a) - 1;
  10156. s = u > s ? u : s;
  10157. }
  10158. }
  10159. return {
  10160. startRow: 0,
  10161. startColumn: 0,
  10162. endRow: r,
  10163. endColumn: s
  10164. };
  10165. }
  10166. toNativeArray() {
  10167. const e = new Array();
  10168. return this.forValue((n, r, s) => {
  10169. e.push(s);
  10170. }), e;
  10171. }
  10172. toArray() {
  10173. const e = [];
  10174. return this.forRow((n, r) => {
  10175. e[n] == null && (e[n] = []), r.forEach((s) => {
  10176. e[n][s] = this.getValue(n, s);
  10177. });
  10178. }), e;
  10179. }
  10180. toFullArray() {
  10181. const e = this.getRange(), { endColumn: n, endRow: r } = e, s = [];
  10182. for (let i = 0; i <= r; i++) {
  10183. const o = new Array(n + 1).fill(void 0);
  10184. s.push(o);
  10185. }
  10186. return this.forValue((i, o, a) => {
  10187. s[i][o] = a;
  10188. }), s;
  10189. }
  10190. /**
  10191. * @deprecated Use getMatrix as a substitute.
  10192. */
  10193. toJSON() {
  10194. return this._matrix;
  10195. }
  10196. clone() {
  10197. const e = JSON.stringify(this._matrix);
  10198. return JSON.parse(e);
  10199. }
  10200. /**
  10201. * @deprecated Use clone as a substitute.
  10202. */
  10203. getData() {
  10204. const e = JSON.stringify(this._matrix);
  10205. return JSON.parse(e);
  10206. }
  10207. getArrayData() {
  10208. let e = 0, n = 0, r = false, s = false;
  10209. const i = new _kt();
  10210. return this.forEach((o, a) => {
  10211. r || (r = true, e = o), Object.keys(a).forEach((u) => {
  10212. const c = Number(u);
  10213. s ? c < n && (n = c) : (s = true, n = c);
  10214. const l = this.getValue(o, c);
  10215. i.setValue(o - e, c - n, l);
  10216. });
  10217. }), i.getData();
  10218. }
  10219. /**
  10220. * the function can only be used in all the row and column are positive integer
  10221. * @description the positive integer in V8 Object is stored in a fast memory space and it is sorted when we get the keys
  10222. * @returns {IRange} the start and end scope of the matrix
  10223. */
  10224. getStartEndScope() {
  10225. let e = 1 / 0, n = -1 / 0, r = 1 / 0, s = -1 / 0;
  10226. const i = Object.keys(this._matrix);
  10227. i.length > 0 && (e = +i[0], n = +i[i.length - 1]);
  10228. for (const o of i) {
  10229. const a = Object.keys(this._matrix[o]);
  10230. a.length > 0 && (r = Math.min(r, +a[0]), s = Math.max(s, +a[a.length - 1]));
  10231. }
  10232. return { startRow: e, endRow: n, startColumn: r, endColumn: s };
  10233. }
  10234. getDataRange() {
  10235. let e = 0, n = 0, r = 0, s = -1, i = false, o = false;
  10236. return this.forEach((a, u) => {
  10237. if (i || (i = true, e = a), u == null)
  10238. return;
  10239. const c = fn(u) - 1;
  10240. c > r && (r = c), Object.keys(u).forEach((l) => {
  10241. const h = Number(l);
  10242. o ? h < n && (n = h) : (o = true, n = h);
  10243. }), a > s && (s = a);
  10244. }), {
  10245. startRow: e,
  10246. startColumn: n,
  10247. endRow: s,
  10248. endColumn: r
  10249. };
  10250. }
  10251. getDiscreteRanges() {
  10252. const e = [];
  10253. return this.forEach((n, r) => {
  10254. Object.keys(r).forEach((s) => {
  10255. const i = Number(s);
  10256. let o = false;
  10257. for (const a of e)
  10258. if (n >= a.startRow && n <= a.endRow + 1 && i >= a.startColumn && i <= a.endColumn + 1) {
  10259. a.endRow = Math.max(n, a.endRow), a.endColumn = Math.max(i, a.endColumn), o = true;
  10260. break;
  10261. }
  10262. o || e.push({
  10263. startRow: n,
  10264. endRow: n,
  10265. startColumn: i,
  10266. endColumn: i
  10267. });
  10268. });
  10269. }), e;
  10270. }
  10271. merge(e) {
  10272. this.forValue((n, r) => {
  10273. const s = e.getValue(n, r);
  10274. s != null && this.setValue(n, r, s);
  10275. });
  10276. }
  10277. _setOriginValue(e = {}) {
  10278. this._matrix = e;
  10279. }
  10280. };
  10281. var PC = {
  10282. sheetId: "",
  10283. range: {
  10284. startRow: -1,
  10285. endRow: -1,
  10286. startColumn: -1,
  10287. endColumn: -1
  10288. }
  10289. };
  10290. var kC = {
  10291. startRow: -1,
  10292. startColumn: -1,
  10293. endRow: -1,
  10294. endColumn: -1
  10295. };
  10296. var FC = {
  10297. startRow: 0,
  10298. startColumn: 0,
  10299. endRow: 0,
  10300. endColumn: 0
  10301. };
  10302. var $C = {
  10303. row: 0,
  10304. column: 0
  10305. };
  10306. var gt = {
  10307. /**
  10308. * fontFamily
  10309. */
  10310. ff: "Arial",
  10311. /**
  10312. * fontSize
  10313. */
  10314. fs: 11,
  10315. /**
  10316. * italic
  10317. * 0: false
  10318. * 1: true
  10319. */
  10320. it: we.FALSE,
  10321. /**
  10322. * bold
  10323. * 0: false
  10324. * 1: true
  10325. */
  10326. bl: we.FALSE,
  10327. /**
  10328. * underline
  10329. */
  10330. ul: {
  10331. s: we.FALSE
  10332. },
  10333. /**
  10334. * strikethrough
  10335. */
  10336. st: {
  10337. s: we.FALSE
  10338. },
  10339. /**
  10340. * overline
  10341. */
  10342. ol: {
  10343. s: we.FALSE
  10344. },
  10345. /**
  10346. * textRotation
  10347. */
  10348. tr: {
  10349. a: 0,
  10350. /**
  10351. * true : 1
  10352. * false : 0
  10353. */
  10354. v: we.FALSE
  10355. },
  10356. /**
  10357. * textDirection
  10358. */
  10359. td: er.UNSPECIFIED,
  10360. /**
  10361. * color
  10362. */
  10363. cl: {
  10364. rgb: "#000"
  10365. },
  10366. /**
  10367. * background
  10368. */
  10369. bg: {
  10370. rgb: "#fff"
  10371. },
  10372. /**
  10373. * horizontalAlignment
  10374. */
  10375. ht: Xt.UNSPECIFIED,
  10376. /**
  10377. * verticalAlignment
  10378. */
  10379. vt: hn.UNSPECIFIED,
  10380. /**
  10381. * wrapStrategy
  10382. */
  10383. tb: xn.UNSPECIFIED,
  10384. /**
  10385. * padding
  10386. */
  10387. pd: {
  10388. t: 0,
  10389. r: 0,
  10390. b: 0,
  10391. l: 0
  10392. },
  10393. n: null,
  10394. /**
  10395. * border
  10396. */
  10397. bd: {
  10398. b: null,
  10399. l: null,
  10400. r: null,
  10401. t: null
  10402. }
  10403. };
  10404. var Ap = {
  10405. id: "default_slide",
  10406. title: "defaultSlide",
  10407. pageSize: {
  10408. width: 300,
  10409. height: 300
  10410. }
  10411. };
  10412. var BC = [su, Hd, iu];
  10413. var Np = ((t) => (t.ARRAY_CONVERTOR = "ARRAY_CONVERTOR", t.MATRIX_CONVERTOR = "MATRIX_CONVERTOR", t))(Np || {});
  10414. function Rr(t, e) {
  10415. const { textRuns: n = [] } = e;
  10416. let r = 0;
  10417. for (const i of n) {
  10418. const { ts: o = {}, st: a, ed: u } = i;
  10419. if (o[t] == null)
  10420. return we.FALSE;
  10421. switch (t) {
  10422. case "bl":
  10423. case "it": {
  10424. if (o[t] === we.FALSE)
  10425. return we.FALSE;
  10426. break;
  10427. }
  10428. case "ul":
  10429. case "st": {
  10430. if (o[t].s === we.FALSE)
  10431. return we.FALSE;
  10432. break;
  10433. }
  10434. default:
  10435. throw new Error(`unknown style key: ${t} in IStyleBase`);
  10436. }
  10437. r += u - a;
  10438. }
  10439. return e.dataStream.indexOf(`\r
  10440. `) === r ? we.TRUE : we.FALSE;
  10441. }
  10442. var Qn = class Qn2 {
  10443. constructor(e, n, r) {
  10444. C(this, "_range");
  10445. C(this, "_worksheet");
  10446. this._deps = r, this._range = n, this._worksheet = e;
  10447. }
  10448. static foreach(e, n) {
  10449. const { startRow: r, startColumn: s, endRow: i, endColumn: o } = e;
  10450. for (let a = r; a <= i; a++)
  10451. for (let u = s; u <= o; u++)
  10452. n(a, u);
  10453. }
  10454. /**
  10455. * get current range data
  10456. *
  10457. * @returns current range
  10458. */
  10459. getRangeData() {
  10460. return this._range;
  10461. }
  10462. /**
  10463. * Returns the value of the top-left cell in the range. The value may be of type Number, Boolean, Date, or String
  10464. * depending on the value of the cell. Empty cells return an empty string.
  10465. * @returns The value in this cell
  10466. */
  10467. getValue() {
  10468. return this.getValues()[0][0];
  10469. }
  10470. /**
  10471. * Returns the rectangular grid of values for this range.
  10472. *
  10473. * Returns a two-dimensional array of values, indexed by row, then by column. The values may be of type Number,
  10474. * Boolean, Date, or String, depending on the value of the cell. Empty cells are represented by an empty string
  10475. * in the array. Remember that while a range index starts at 0, 0, same as the JavaScript array is indexed from [0][0].
  10476. *
  10477. * In web apps, a Date value isn't a legal parameter. getValues() fails to return data to a web app if the range
  10478. * contains a cell with a Date value. Instead, transform all the values retrieved from the sheet to a supported
  10479. * JavaScript primitive like a Number, Boolean, or String.
  10480. *
  10481. * @returns A two-dimensional array of values.
  10482. */
  10483. getValues() {
  10484. const { startRow: e, endRow: n, startColumn: r, endColumn: s } = this._range, i = [];
  10485. for (let o = e; o <= n; o++) {
  10486. const a = [];
  10487. for (let u = r; u <= s; u++)
  10488. a.push(this.getMatrix().getValue(o, u) || null);
  10489. i.push(a);
  10490. }
  10491. return i;
  10492. }
  10493. /**
  10494. * get range matrix
  10495. *
  10496. * @returns range matrix
  10497. */
  10498. getMatrix() {
  10499. const { startRow: e, endRow: n, startColumn: r, endColumn: s } = this._range, i = this._worksheet.getCellMatrix(), o = new kt();
  10500. for (let a = e; a <= n; a++)
  10501. for (let u = r; u <= s; u++)
  10502. o.setValue(a, u, i.getValue(a, u) || null);
  10503. return o;
  10504. }
  10505. /**
  10506. * get range matrix object
  10507. *
  10508. * @returns range matrix object
  10509. */
  10510. getMatrixObject() {
  10511. const { startRow: e, endRow: n, startColumn: r, endColumn: s } = this._range, i = this._worksheet.getCellMatrix(), o = new kt();
  10512. for (let a = e; a <= n; a++)
  10513. for (let u = r; u <= s; u++)
  10514. o.setValue(a - e, u - r, i.getValue(a, u) || {});
  10515. return o;
  10516. }
  10517. /**
  10518. * Returns a string description of the range, in A1 notation.
  10519. *
  10520. * @returns The string description of the range in A1 notation.
  10521. */
  10522. getA1Notation() {
  10523. const { startRow: e, endRow: n, startColumn: r, endColumn: s } = this._range;
  10524. let i, o;
  10525. return r < s ? (i = re.numToWord(r + 1) + (e + 1), o = re.numToWord(s + 1) + (n + 1)) : (i = re.numToWord(s + 1) + (n + 1), o = re.numToWord(r + 1) + (e + 1)), i === o ? `${i}` : `${i}:${o}`;
  10526. }
  10527. /**
  10528. * Returns the background color of the top-left cell in the range (for example, '#ffffff').
  10529. *
  10530. * @returns — The color code of the background.
  10531. */
  10532. getBackground() {
  10533. return this.getBackgrounds()[0][0];
  10534. }
  10535. /**
  10536. * Returns the background colors of the cells in the range (for example, '#ffffff').
  10537. *
  10538. * @returns — A two-dimensional array of color codes of the backgrounds.
  10539. */
  10540. getBackgrounds() {
  10541. const e = this._deps.getStyles();
  10542. return this.getValues().map(
  10543. (n) => n.map((r) => {
  10544. var i;
  10545. const s = e.getStyleByCell(r);
  10546. return ((i = s == null ? void 0 : s.bg) == null ? void 0 : i.rgb) || gt.bg.rgb;
  10547. })
  10548. );
  10549. }
  10550. /**
  10551. * Returns a given cell within a range.
  10552. *
  10553. * The row and column here are relative to the range
  10554. * e.g. "B2:D4", getCell(0,0) in this code returns the cell at B2
  10555. * @returns — A range containing a single cell at the specified coordinates.
  10556. */
  10557. getCell(e, n) {
  10558. const { startRow: r, startColumn: s } = this._range, i = {
  10559. startRow: r + e,
  10560. endRow: r + e,
  10561. startColumn: s + n,
  10562. endColumn: s + n
  10563. };
  10564. return new Qn2(this._worksheet, i, this._deps);
  10565. }
  10566. /**
  10567. * Returns the starting column position for this range
  10568. *
  10569. * @returns — The range's starting column position in the spreadsheet.
  10570. */
  10571. getColumn() {
  10572. return this._range.startColumn;
  10573. }
  10574. /**
  10575. * Returns the data of the object structure, and can set whether to bring styles
  10576. */
  10577. getObjectValue(e = {}) {
  10578. return this.getObjectValues(e)[0][0];
  10579. }
  10580. /**
  10581. * Returns the data of the object structure, and can set whether to bring styles
  10582. *
  10583. * @param options set whether to include style
  10584. * @returns Returns a value in object format
  10585. */
  10586. getObjectValues(e = {}) {
  10587. var a;
  10588. const { startRow: n, endRow: r, startColumn: s, endColumn: i } = this._range, o = this._worksheet.getCellMatrix().getFragment(n, r, s, i).getData();
  10589. if (e.isIncludeStyle) {
  10590. const u = this._deps.getStyles();
  10591. for (let c = 0; c <= r - n; c++)
  10592. for (let l = 0; l <= i - s; l++) {
  10593. if (o == null || ((a = o == null ? void 0 : o[c]) == null ? void 0 : a[l]) == null)
  10594. continue;
  10595. const h = o[c][l].s;
  10596. h && (o[c][l].s = u.get(h));
  10597. }
  10598. }
  10599. return o;
  10600. }
  10601. /**
  10602. * Returns the font color of the cell in the top-left corner of the range, in CSS notation
  10603. */
  10604. getFontColor() {
  10605. return this.getFontColors()[0][0];
  10606. }
  10607. /**
  10608. * Returns the font colors of the cells in the range in CSS notation (such as '#ffffff' or 'white').
  10609. */
  10610. getFontColors() {
  10611. const e = this._deps.getStyles();
  10612. return this.getValues().map(
  10613. (n) => n.map((r) => {
  10614. var i;
  10615. const s = e.getStyleByCell(r);
  10616. return ((i = s == null ? void 0 : s.cl) == null ? void 0 : i.rgb) || gt.cl.rgb;
  10617. })
  10618. );
  10619. }
  10620. /**
  10621. * Returns the font families of the cells in the range.
  10622. */
  10623. getFontFamilies() {
  10624. return this._getStyles("ff");
  10625. }
  10626. /**
  10627. * Returns the font family of the cell in the top-left corner of the range.
  10628. */
  10629. getFontFamily() {
  10630. return this.getFontFamilies()[0][0];
  10631. }
  10632. /**
  10633. * Returns the underlines of the cells in the range.
  10634. */
  10635. getUnderlines() {
  10636. return this._getStyles("ul");
  10637. }
  10638. /**
  10639. * Returns the underline of the cells in the range.
  10640. */
  10641. getUnderline() {
  10642. var n, r;
  10643. const { p: e } = (n = this.getValue()) != null ? n : {};
  10644. return e && Array.isArray((r = e.body) == null ? void 0 : r.textRuns) && e.body.textRuns.length > 0 ? Rr("ul", e.body) === we.TRUE ? {
  10645. s: we.TRUE
  10646. } : {
  10647. s: we.FALSE
  10648. } : this.getUnderlines()[0][0];
  10649. }
  10650. /**
  10651. * Returns the overlines of the cells in the range.
  10652. */
  10653. getOverlines() {
  10654. return this._getStyles("ol");
  10655. }
  10656. /**
  10657. * Returns the overline of the cells in the range.
  10658. */
  10659. getOverline() {
  10660. return this.getOverlines()[0][0];
  10661. }
  10662. /**
  10663. * Returns the strikeThrough of the cells in the range.
  10664. */
  10665. getStrikeThrough() {
  10666. var n, r;
  10667. const { p: e } = (n = this.getValue()) != null ? n : {};
  10668. return e && Array.isArray((r = e.body) == null ? void 0 : r.textRuns) && e.body.textRuns.length > 0 ? Rr("st", e.body) === we.TRUE ? {
  10669. s: we.TRUE
  10670. } : {
  10671. s: we.FALSE
  10672. } : this.getStrikeThroughs()[0][0];
  10673. }
  10674. /**
  10675. * Returns the strikeThroughs of the cells in the range.
  10676. */
  10677. getStrikeThroughs() {
  10678. return this._getStyles("st");
  10679. }
  10680. /**
  10681. * Returns the font size in point size of the cell in the top-left corner of the range.
  10682. */
  10683. getFontSize() {
  10684. var n, r;
  10685. const e = ((n = this.getValue()) == null ? void 0 : n.p) || {};
  10686. return Array.isArray((r = e.body) == null ? void 0 : r.textRuns) && e.body.textRuns.length > 0 ? e.body.textRuns.some((s) => {
  10687. var i;
  10688. return ((i = s == null ? void 0 : s.ts) == null ? void 0 : i.fs) != null;
  10689. }) ? Math.max(...e.body.textRuns.map((s) => {
  10690. var i;
  10691. return ((i = s == null ? void 0 : s.ts) == null ? void 0 : i.fs) || 0;
  10692. })) : this.getFontSizes()[0][0] : this.getFontSizes()[0][0];
  10693. }
  10694. /**
  10695. * Returns the font sizes of the cells in the range.
  10696. */
  10697. getFontSizes() {
  10698. return this._getStyles("fs");
  10699. }
  10700. /**
  10701. * Returns the border info of the cells in the range.
  10702. */
  10703. getBorder() {
  10704. return this.getBorders()[0][0];
  10705. }
  10706. getBorders() {
  10707. return this._getStyles("bd");
  10708. }
  10709. /**
  10710. * Returns the font style ('italic' or 'normal') of the cell in the top-left corner of the range.
  10711. */
  10712. getFontStyle() {
  10713. var n, r;
  10714. const { p: e } = (n = this.getValue()) != null ? n : {};
  10715. return e && Array.isArray((r = e.body) == null ? void 0 : r.textRuns) && e.body.textRuns.length > 0 ? Rr("it", e.body) === we.TRUE ? Vs.ITALIC : Vs.NORMAL : this._getFontStyles()[0][0];
  10716. }
  10717. /**
  10718. * Returns the font styles of the cells in the range.
  10719. */
  10720. _getFontStyles() {
  10721. return this._getStyles("it");
  10722. }
  10723. /**
  10724. * Returns the font weight (normal/bold) of the cell in the top-left corner of the range.
  10725. * If the cell has rich text, the return value according to the textRuns of the rich text,
  10726. * when all styles of textRuns are bold, it will return FontWeight.BOLD,
  10727. * otherwise return FontWeight.NORMAL.
  10728. */
  10729. getFontWeight() {
  10730. var n, r;
  10731. const { p: e } = (n = this.getValue()) != null ? n : {};
  10732. return e && Array.isArray((r = e.body) == null ? void 0 : r.textRuns) && e.body.textRuns.length > 0 ? Rr("bl", e.body) === we.TRUE ? Gs.BOLD : Gs.NORMAL : this._getFontWeights()[0][0];
  10733. }
  10734. /**
  10735. * Returns the font weights of the cells in the range.
  10736. */
  10737. _getFontWeights() {
  10738. return this._getStyles("bl");
  10739. }
  10740. /**
  10741. * Returns the grid ID of the range's parent sheet.
  10742. */
  10743. getGridId() {
  10744. return this._worksheet.getSheetId();
  10745. }
  10746. /**
  10747. * Returns the height of the range.
  10748. */
  10749. getHeight() {
  10750. const { _range: e, _worksheet: n } = this, { startRow: r, endRow: s } = e;
  10751. let i = 0;
  10752. for (let o = 0; o <= s - r; o++) {
  10753. const a = n.getRowHeight(o);
  10754. i += a;
  10755. }
  10756. return i;
  10757. }
  10758. /**
  10759. * Returns the horizontal alignment of the text (left/center/right) of the cell in the top-left corner of the range.
  10760. */
  10761. getHorizontalAlignment() {
  10762. return this.getHorizontalAlignments()[0][0];
  10763. }
  10764. /**
  10765. *Returns the horizontal alignments of the cells in the range.
  10766. */
  10767. getHorizontalAlignments() {
  10768. return this._getStyles("ht");
  10769. }
  10770. /**
  10771. * Returns the end column position.
  10772. */
  10773. getLastColumn() {
  10774. return this._range.endColumn;
  10775. }
  10776. /**
  10777. * Returns the end row position.
  10778. */
  10779. getLastRow() {
  10780. return this._range.endRow;
  10781. }
  10782. /**
  10783. * Returns the number of columns in this range.
  10784. */
  10785. getNumColumns() {
  10786. const { startColumn: e, endColumn: n } = this._range;
  10787. return n - e + 1;
  10788. }
  10789. /**
  10790. * Returns the number of rows in this range.
  10791. */
  10792. getNumRows() {
  10793. const { startRow: e, endRow: n } = this._range;
  10794. return n - e + 1;
  10795. }
  10796. /**
  10797. * Returns the Rich Text value for the top left cell of the range, or null if the cell value is not text.
  10798. */
  10799. getRichTextValue() {
  10800. return this.getRichTextValues()[0][0];
  10801. }
  10802. /**
  10803. * Returns the Rich Text values for the cells in the range.
  10804. */
  10805. getRichTextValues() {
  10806. return this.getValues().map((e) => e.map((n) => (n == null ? void 0 : n.p) || ""));
  10807. }
  10808. /**
  10809. * Returns the row position for this range.
  10810. */
  10811. getRowIndex() {
  10812. return this._range.startRow;
  10813. }
  10814. /**
  10815. * Returns the sheet this range belongs to.
  10816. */
  10817. getSheet() {
  10818. return this._worksheet;
  10819. }
  10820. /**
  10821. * Returns the text direction for the top left cell of the range.
  10822. */
  10823. getTextDirection() {
  10824. return this.getTextDirections()[0][0];
  10825. }
  10826. /**
  10827. * Returns the text directions for the cells in the range.
  10828. */
  10829. getTextDirections() {
  10830. return this._getStyles("td");
  10831. }
  10832. /**
  10833. * Returns the text rotation settings for the top left cell of the range.
  10834. */
  10835. // getTextRotation(): number {
  10836. getTextRotation() {
  10837. return this.getTextRotations()[0][0];
  10838. }
  10839. /**
  10840. * Returns the text rotation settings for the cells in the range.
  10841. */
  10842. // getTextRotations(): number[][] {
  10843. getTextRotations() {
  10844. return this._getStyles("tr");
  10845. }
  10846. /**
  10847. * Returns the text style for the top left cell of the range.
  10848. */
  10849. getTextStyle() {
  10850. return this.getTextStyles()[0][0];
  10851. }
  10852. /**
  10853. * Returns the text styles for the cells in the range.
  10854. */
  10855. getTextStyles() {
  10856. const e = this._deps.getStyles();
  10857. return this.getValues().map((n) => n.map((r) => e.getStyleByCell(r)));
  10858. }
  10859. /**
  10860. * Returns the vertical alignment (top/middle/bottom) of the cell in the top-left corner of the range.
  10861. */
  10862. getVerticalAlignment() {
  10863. return this.getVerticalAlignments()[0][0];
  10864. }
  10865. /**
  10866. * Returns the vertical alignments of the cells in the range.
  10867. */
  10868. getVerticalAlignments() {
  10869. return this._getStyles("vt");
  10870. }
  10871. /**
  10872. * Returns the width of the range in columns.
  10873. */
  10874. getWidth() {
  10875. const { _range: e, _worksheet: n } = this, { startColumn: r, endColumn: s } = e;
  10876. let i = 0;
  10877. for (let o = 0; o <= s - r; o++)
  10878. i += n.getColumnWidth(o);
  10879. return i;
  10880. }
  10881. /**
  10882. * Returns whether the text in the cell wraps.
  10883. */
  10884. getWrap() {
  10885. return this.getWrapStrategy() === xn.WRAP ? we.TRUE : we.FALSE;
  10886. }
  10887. /**
  10888. * Returns the text wrapping strategies for the cells in the range.
  10889. */
  10890. getWrapStrategies() {
  10891. return this._getStyles("tb");
  10892. }
  10893. /**
  10894. * Returns the text wrapping strategy for the top left cell of the range.
  10895. */
  10896. getWrapStrategy() {
  10897. return this.getWrapStrategies()[0][0];
  10898. }
  10899. forEach(e) {
  10900. Qn2.foreach(this._range, e);
  10901. }
  10902. /**
  10903. *
  10904. * @param arg Shorthand for the style that gets
  10905. * @returns style value
  10906. */
  10907. _getStyles(e) {
  10908. const n = this._deps.getStyles();
  10909. return this.getValues().map(
  10910. (r) => r.map((s) => {
  10911. const i = n && n.getStyleByCell(s);
  10912. return i && i[e] || gt[e];
  10913. })
  10914. );
  10915. }
  10916. };
  10917. C(Qn, "transformRange", (e, n) => {
  10918. const r = n.getMaxColumns() - 1, s = n.getMaxRows() - 1;
  10919. return e.rangeType === De.ALL ? {
  10920. startColumn: 0,
  10921. startRow: 0,
  10922. endColumn: r,
  10923. endRow: s
  10924. } : e.rangeType === De.COLUMN ? {
  10925. startRow: 0,
  10926. endRow: s,
  10927. startColumn: e.startColumn,
  10928. endColumn: e.endColumn
  10929. } : e.rangeType === De.ROW ? {
  10930. startColumn: 0,
  10931. endColumn: r,
  10932. startRow: e.startRow,
  10933. endRow: e.endRow
  10934. } : {
  10935. startColumn: e.startColumn,
  10936. endColumn: Math.min(e.endColumn, r),
  10937. startRow: e.startRow,
  10938. endRow: Math.min(e.endRow, s)
  10939. };
  10940. });
  10941. var tr = Qn;
  10942. function jC(t, e, n, r = false) {
  10943. if (e === 0 && n === 0)
  10944. return t;
  10945. let s = { ...t };
  10946. const i = s.startAbsoluteRefType || tt.NONE, o = s.endAbsoluteRefType || tt.NONE, a = s.rangeType || De.NORMAL;
  10947. if (!r && i === tt.ALL && o === tt.ALL)
  10948. return s;
  10949. const u = Xo(s.startRow, n, s.startColumn, e, a), c = Xo(s.endRow, n, s.endColumn, e, a);
  10950. return r || i === tt.NONE && o === tt.NONE ? s = {
  10951. ...s,
  10952. startRow: u.row,
  10953. startColumn: u.column,
  10954. endRow: c.row,
  10955. endColumn: c.column
  10956. } : (i === tt.NONE ? s = { ...s, startRow: u.row, startColumn: u.column } : i === tt.COLUMN ? s = { ...s, startRow: u.row } : i === tt.ROW && (s = { ...s, startColumn: u.column }), o === tt.NONE ? s = { ...s, endRow: c.row, endColumn: c.column } : o === tt.COLUMN ? s = { ...s, endRow: c.row } : o === tt.ROW && (s = { ...s, endColumn: c.column }), s);
  10957. }
  10958. function Xo(t, e, n, r, s) {
  10959. return s === De.NORMAL ? { row: t + e, column: n + r } : s === De.ROW ? { row: t + e, column: n } : s === De.COLUMN ? { row: t, column: n + r } : { row: t, column: n };
  10960. }
  10961. function Uu(t) {
  10962. const e = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
  10963. for (const o of t)
  10964. e.add(o.startColumn), e.add(o.endColumn + 1), n.add(o.startRow), n.add(o.endRow + 1);
  10965. const r = Array.from(e).sort((o, a) => o - a), s = Array.from(n).sort((o, a) => o - a);
  10966. t.sort((o, a) => o.startRow - a.startRow || o.startColumn - a.startColumn);
  10967. const i = [];
  10968. for (let o = 0; o < s.length - 1; o++)
  10969. for (let a = 0; a < r.length - 1; a++) {
  10970. const u = r[a], c = r[a + 1] - 1, l = s[o], h = s[o + 1] - 1;
  10971. for (const d of t) {
  10972. if (d.startRow > h)
  10973. break;
  10974. if (d.startRow <= l && d.endRow >= h && d.startColumn <= u && d.endColumn >= c) {
  10975. i.push({
  10976. startColumn: u,
  10977. endColumn: c,
  10978. startRow: l,
  10979. endRow: h
  10980. });
  10981. break;
  10982. }
  10983. }
  10984. }
  10985. return i;
  10986. }
  10987. function Tp(t) {
  10988. t.sort((r, s) => r.startRow - s.startRow || r.startColumn - s.startColumn);
  10989. const e = {};
  10990. for (const r of t)
  10991. e[r.startRow] || (e[r.startRow] = []), e[r.startRow].push(r);
  10992. const n = [];
  10993. for (const r in e) {
  10994. const s = e[+r];
  10995. s.sort((o, a) => o.startColumn - a.startColumn);
  10996. let i = s[0];
  10997. for (let o = 1; o < s.length; o++) {
  10998. const a = s[o];
  10999. a.startColumn <= i.endColumn + 1 && a.startRow === i.startRow && a.endRow === i.endRow ? i.endColumn = Math.max(i.endColumn, a.endColumn) : (n.push(i), i = a);
  11000. }
  11001. n.push(i);
  11002. }
  11003. return n;
  11004. }
  11005. function Mp(t) {
  11006. t.sort((r, s) => r.startColumn - s.startColumn || r.startRow - s.startRow);
  11007. const e = {};
  11008. for (const r of t)
  11009. e[r.startColumn] || (e[r.startColumn] = []), e[r.startColumn].push(r);
  11010. const n = [];
  11011. for (const r in e) {
  11012. const s = e[+r];
  11013. s.sort((o, a) => o.startRow - a.startRow);
  11014. let i = s[0];
  11015. for (let o = 1; o < s.length; o++) {
  11016. const a = s[o];
  11017. a.startRow <= i.endRow + 1 && a.startColumn === i.startColumn && a.endColumn === i.endColumn ? i.endRow = Math.max(i.endRow, a.endRow) : (n.push(i), i = a);
  11018. }
  11019. n.push(i);
  11020. }
  11021. return n;
  11022. }
  11023. function Dp(t) {
  11024. const e = Uu(t), n = Tp(e);
  11025. return Mp(n);
  11026. }
  11027. function xp(t, e) {
  11028. const n = [];
  11029. return t.forEach((r) => {
  11030. n.push(...en.subtract(r, e));
  11031. }), en.mergeRanges(n);
  11032. }
  11033. function HC(t, e) {
  11034. const n = Jo(
  11035. t.startRow,
  11036. t.endRow,
  11037. e.startRow,
  11038. e.endRow
  11039. ), r = Jo(
  11040. t.startColumn,
  11041. t.endColumn,
  11042. e.startColumn,
  11043. e.endColumn
  11044. );
  11045. if (!n || !r)
  11046. return null;
  11047. const [s, i] = n, [o, a] = r, u = Lp(
  11048. t.rangeType,
  11049. e.rangeType,
  11050. s,
  11051. i,
  11052. o,
  11053. a
  11054. );
  11055. return {
  11056. startRow: s,
  11057. endRow: i,
  11058. startColumn: o,
  11059. endColumn: a,
  11060. rangeType: u
  11061. };
  11062. }
  11063. function Jo(t, e, n, r) {
  11064. const s = isNaN(t) ? -1 / 0 : t, i = isNaN(e) ? 1 / 0 : e, o = isNaN(n) ? -1 / 0 : n, a = isNaN(r) ? 1 / 0 : r, u = Math.max(s, o), c = Math.min(i, a);
  11065. if (u <= c) {
  11066. const l = u === -1 / 0 ? Number.NaN : u, h = c === 1 / 0 ? Number.NaN : c;
  11067. return [l, h];
  11068. } else
  11069. return null;
  11070. }
  11071. function Lp(t, e, n, r, s, i) {
  11072. const o = t !== void 0 ? t : Zo(n, r, s, i), a = e !== void 0 ? e : Zo(n, r, s, i);
  11073. return o === De.ALL || a === De.ALL ? o === a ? o : o === De.ALL ? a : o : o === a ? o : (o === De.NORMAL || a === De.NORMAL, De.NORMAL);
  11074. }
  11075. function Zo(t, e, n, r) {
  11076. const s = !isNaN(t) && !isNaN(e), i = !isNaN(n) && !isNaN(r);
  11077. return s && i ? De.NORMAL : s ? De.ROW : i ? De.COLUMN : De.ALL;
  11078. }
  11079. var Ut = class Ut2 {
  11080. /**
  11081. * Creates a deep copy of an IRange object
  11082. * @param src
  11083. * @example
  11084. * ```typescript
  11085. * const original = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
  11086. * const copy = Rectangle.clone(original);
  11087. * // copy = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 }
  11088. * ```
  11089. */
  11090. static clone(e) {
  11091. return e.rangeType !== void 0 ? {
  11092. startRow: e.startRow,
  11093. startColumn: e.startColumn,
  11094. endRow: e.endRow,
  11095. endColumn: e.endColumn,
  11096. rangeType: e.rangeType
  11097. } : {
  11098. startRow: e.startRow,
  11099. startColumn: e.startColumn,
  11100. endRow: e.endRow,
  11101. endColumn: e.endColumn
  11102. };
  11103. }
  11104. /**
  11105. * Checks if two ranges are equal by comparing their properties
  11106. * @param src
  11107. * @param target
  11108. * @example
  11109. * ```typescript
  11110. * const range1 = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
  11111. * const range2 = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
  11112. * const areEqual = Rectangle.equals(range1, range2); // true
  11113. * ```
  11114. */
  11115. static equals(e, n) {
  11116. return e == null || n == null ? false : e.endRow === n.endRow && e.endColumn === n.endColumn && e.startRow === n.startRow && e.startColumn === n.startColumn && (e.rangeType === n.rangeType || e.rangeType === void 0 && n.rangeType === De.NORMAL || n.rangeType === void 0 && e.rangeType === De.NORMAL);
  11117. }
  11118. /**
  11119. * Quickly checks if two normal ranges intersect. For specialized range types,
  11120. * use the intersects() method instead.
  11121. * @param rangeA
  11122. * @param rangeB
  11123. * @example
  11124. * ```typescript
  11125. * const range1 = { startRow: 0, startColumn: 0, endRow: 2, endColumn: 2 };
  11126. * const range2 = { startRow: 1, startColumn: 1, endRow: 3, endColumn: 3 };
  11127. * const doIntersect = Rectangle.simpleRangesIntersect(range1, range2); // true
  11128. * ```
  11129. */
  11130. static simpleRangesIntersect(e, n) {
  11131. const { startRow: r, endRow: s, startColumn: i, endColumn: o } = e, { startRow: a, endRow: u, startColumn: c, endColumn: l } = n, h = r <= u && s >= a, d = i <= l && o >= c;
  11132. return h && d;
  11133. }
  11134. /**
  11135. * Checks if two ranges intersect, handling special range types (ROW, COLUMN)
  11136. * @param src
  11137. * @param target
  11138. * @example
  11139. * ```typescript
  11140. * const rowRange = {
  11141. * startRow: 0, endRow: 2,
  11142. * startColumn: NaN, endColumn: NaN,
  11143. * rangeType: RANGE_TYPE.ROW
  11144. * };
  11145. * const colRange = {
  11146. * startRow: NaN, endRow: NaN,
  11147. * startColumn: 0, endColumn: 2,
  11148. * rangeType: RANGE_TYPE.COLUMN
  11149. * };
  11150. * const doIntersect = Rectangle.intersects(rowRange, colRange); // true
  11151. * ```
  11152. */
  11153. static intersects(e, n) {
  11154. if (e.rangeType === De.ROW && n.rangeType === De.COLUMN || e.rangeType === De.COLUMN && n.rangeType === De.ROW)
  11155. return true;
  11156. if (e.rangeType === De.ROW && n.rangeType === De.ROW)
  11157. return e.startRow <= n.endRow && e.endRow >= n.startRow;
  11158. if (e.rangeType === De.COLUMN && n.rangeType === De.COLUMN)
  11159. return e.startColumn <= n.endColumn && e.endColumn >= n.startColumn;
  11160. const r = Math.floor(Number.MAX_SAFE_INTEGER / 10), s = Number.isNaN(e.startRow) ? 0 : e.startRow, i = Number.isNaN(e.endRow) ? r : e.endRow, o = Number.isNaN(e.startColumn) ? 0 : e.startColumn, a = Number.isNaN(e.endColumn) ? r : e.endColumn, u = Number.isNaN(n.startRow) ? 0 : n.startRow, c = Number.isNaN(n.endRow) ? r : n.endRow, l = Number.isNaN(n.startColumn) ? 0 : n.startColumn, h = Number.isNaN(n.endColumn) ? r : n.endColumn, d = Math.abs(o + a - l - h), f = Math.abs(o - a) + Math.abs(l - h), E = Math.abs(s + i - u - c), R = Math.abs(s - i) + Math.abs(u - c);
  11161. return d <= f && E <= R;
  11162. }
  11163. /**
  11164. * Gets the intersection range between two ranges
  11165. * @param src
  11166. * @param target
  11167. * @deprecated use `getIntersectRange` instead
  11168. * @example
  11169. * ```typescript
  11170. * const range1 = { startRow: 0, startColumn: 0, endRow: 2, endColumn: 2 };
  11171. * const range2 = { startRow: 1, startColumn: 1, endRow: 3, endColumn: 3 };
  11172. * const intersection = Rectangle.getIntersects(range1, range2);
  11173. * // intersection = { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
  11174. * ```
  11175. */
  11176. static getIntersects(e, n) {
  11177. const r = e.startRow, s = e.endRow, i = e.startColumn, o = e.endColumn, a = n.startRow, u = n.endRow, c = n.startColumn, l = n.endColumn;
  11178. let h, d, f, E;
  11179. if (a <= s)
  11180. a >= r ? d = a : d = r;
  11181. else
  11182. return null;
  11183. if (u >= r)
  11184. u >= s ? E = s : E = u;
  11185. else
  11186. return null;
  11187. if (c <= o)
  11188. c > i ? h = c : h = i;
  11189. else
  11190. return null;
  11191. if (l >= i)
  11192. l >= o ? f = o : f = l;
  11193. else
  11194. return null;
  11195. return {
  11196. startRow: d,
  11197. endRow: E,
  11198. startColumn: h,
  11199. endColumn: f,
  11200. rangeType: De.NORMAL
  11201. // TODO: this may not be accurate
  11202. };
  11203. }
  11204. /**
  11205. * Checks if one range completely contains another range
  11206. * @param src
  11207. * @param target
  11208. * @example
  11209. * ```typescript
  11210. * const outer = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
  11211. * const inner = { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 };
  11212. * const contains = Rectangle.contains(outer, inner); // true
  11213. * ```
  11214. */
  11215. static contains(e, n) {
  11216. return e.startRow <= n.startRow && e.endRow >= n.endRow && e.startColumn <= n.startColumn && e.endColumn >= n.endColumn;
  11217. }
  11218. /**
  11219. * Checks if one range strictly contains another range (not equal)
  11220. * @param src
  11221. * @param target
  11222. * @example
  11223. * ```typescript
  11224. * const outer = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
  11225. * const same = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
  11226. * const realContains = Rectangle.realContain(outer, same); // false
  11227. * ```
  11228. */
  11229. static realContain(e, n) {
  11230. return Ut2.contains(e, n) && (e.startRow < n.startRow || e.endRow > n.endRow || e.startColumn < n.startColumn || e.endColumn > n.endColumn);
  11231. }
  11232. /**
  11233. * Creates a union range that encompasses all input ranges
  11234. * @param {...any} ranges
  11235. * @example
  11236. * ```typescript
  11237. * const range1 = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
  11238. * const range2 = { startRow: 2, startColumn: 2, endRow: 3, endColumn: 3 };
  11239. * const union = Rectangle.union(range1, range2);
  11240. * // union = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 }
  11241. * ```
  11242. */
  11243. static union(...e) {
  11244. return e.reduce(
  11245. (n, r) => ({
  11246. startRow: Math.min(n.startRow, r.startRow),
  11247. startColumn: Math.min(n.startColumn, r.startColumn),
  11248. endRow: Math.max(n.endRow, r.endRow),
  11249. endColumn: Math.max(n.endColumn, r.endColumn),
  11250. rangeType: De.NORMAL
  11251. }),
  11252. e[0]
  11253. );
  11254. }
  11255. /**
  11256. * Creates a union range considering special range types (ROW, COLUMN)
  11257. * @param {...any} ranges
  11258. * @example
  11259. * ```typescript
  11260. * const rowRange = {
  11261. * startRow: 0, endRow: 2,
  11262. * rangeType: RANGE_TYPE.ROW
  11263. * };
  11264. * const normalRange = {
  11265. * startRow: 1, startColumn: 1,
  11266. * endRow: 3, endColumn: 3
  11267. * };
  11268. * const union = Rectangle.realUnion(rowRange, normalRange);
  11269. * // Result will have NaN for columns due to ROW type
  11270. * ```
  11271. */
  11272. static realUnion(...e) {
  11273. const n = e.some((i) => i.rangeType === De.COLUMN), r = e.some((i) => i.rangeType === De.ROW), s = Ut2.union(...e);
  11274. return {
  11275. startColumn: r ? Number.NaN : s.startColumn,
  11276. endColumn: r ? Number.NaN : s.endColumn,
  11277. startRow: n ? Number.NaN : s.startRow,
  11278. endRow: n ? Number.NaN : s.endRow,
  11279. rangeType: r ? De.ROW : n ? De.COLUMN : De.NORMAL
  11280. };
  11281. }
  11282. /**
  11283. * Subtracts one range from another, returning the remaining areas as separate ranges
  11284. * @param range1
  11285. * @param range2
  11286. * @example
  11287. * ```typescript
  11288. * const range1 = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
  11289. * const range2 = { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 };
  11290. * const result = Rectangle.subtract(range1, range2);
  11291. * // Results in up to 4 ranges representing the non-overlapping areas
  11292. * ```
  11293. */
  11294. static subtract(e, n) {
  11295. if (n.startRow > e.endRow || n.endRow < e.startRow || n.startColumn > e.endColumn || n.endColumn < e.startColumn)
  11296. return [e];
  11297. const r = [];
  11298. n.startRow >= e.startRow && r.push({
  11299. startRow: e.startRow,
  11300. startColumn: e.startColumn,
  11301. endRow: n.startRow - 1,
  11302. endColumn: e.endColumn
  11303. }), n.endRow <= e.endRow && r.push({
  11304. startRow: n.endRow + 1,
  11305. startColumn: e.startColumn,
  11306. endRow: e.endRow,
  11307. endColumn: e.endColumn
  11308. });
  11309. const s = Math.max(e.startRow, n.startRow), i = Math.min(e.endRow, n.endRow);
  11310. return n.startColumn >= e.startColumn && r.push({
  11311. startRow: s,
  11312. startColumn: e.startColumn,
  11313. endRow: i,
  11314. endColumn: n.startColumn - 1
  11315. }), n.endColumn <= e.endColumn && r.push({
  11316. startRow: s,
  11317. startColumn: n.endColumn + 1,
  11318. endRow: i,
  11319. endColumn: e.endColumn
  11320. }), r.filter((a) => a.startRow <= a.endRow && a.startColumn <= a.endColumn);
  11321. }
  11322. /**
  11323. * Merges overlapping or adjacent ranges into larger ranges
  11324. * @param ranges
  11325. * @example
  11326. * ```typescript
  11327. * const ranges = [
  11328. * { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 },
  11329. * { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
  11330. * ];
  11331. * const merged = Rectangle.mergeRanges(ranges);
  11332. * // Combines overlapping ranges into larger ones
  11333. * ```
  11334. */
  11335. static mergeRanges(e) {
  11336. return Dp(e);
  11337. }
  11338. /**
  11339. * Splits overlapping ranges into a grid of non-overlapping ranges
  11340. * @param ranges
  11341. * @example
  11342. * ```typescript
  11343. * const ranges = [
  11344. * { startRow: 0, startColumn: 0, endRow: 2, endColumn: 2 },
  11345. * { startRow: 1, startColumn: 1, endRow: 3, endColumn: 3 }
  11346. * ];
  11347. * const grid = Rectangle.splitIntoGrid(ranges);
  11348. * // Splits into non-overlapping grid sections
  11349. * ```
  11350. */
  11351. static splitIntoGrid(e) {
  11352. return Uu(e);
  11353. }
  11354. /**
  11355. * Subtracts multiple ranges from multiple ranges
  11356. * @param ranges1
  11357. * @param ranges2
  11358. * @example
  11359. * ```typescript
  11360. * const ranges1 = [{ startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 }];
  11361. * const ranges2 = [
  11362. * { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 },
  11363. * { startRow: 2, startColumn: 2, endRow: 3, endColumn: 3 }
  11364. * ];
  11365. * const result = Rectangle.subtractMulti(ranges1, ranges2);
  11366. * // Returns remaining non-overlapping areas
  11367. * ```
  11368. */
  11369. static subtractMulti(e, n) {
  11370. if (!n.length)
  11371. return e;
  11372. let r = e;
  11373. return n.forEach((s) => {
  11374. r = xp(r, s);
  11375. }), r;
  11376. }
  11377. /**
  11378. * Checks if two rectangles defined by left, top, right, bottom coordinates intersect
  11379. * @param rect1
  11380. * @param rect2
  11381. * @example
  11382. * ```typescript
  11383. * const rect1 = { left: 0, top: 0, right: 10, bottom: 10 };
  11384. * const rect2 = { left: 5, top: 5, right: 15, bottom: 15 };
  11385. * const intersects = Rectangle.hasIntersectionBetweenTwoRect(rect1, rect2); // true
  11386. * ```
  11387. */
  11388. static hasIntersectionBetweenTwoRect(e, n) {
  11389. return !(e.left > n.right || // rect1 在 rect2 右侧
  11390. e.right < n.left || // rect1 在 rect2 左侧
  11391. e.top > n.bottom || // rect1 在 rect2 下方
  11392. e.bottom < n.top);
  11393. }
  11394. /**
  11395. * Gets the intersection area between two rectangles defined by LTRB coordinates
  11396. * @param rect1
  11397. * @param rect2
  11398. * @example
  11399. * ```typescript
  11400. * const rect1 = { left: 0, top: 0, right: 10, bottom: 10 };
  11401. * const rect2 = { left: 5, top: 5, right: 15, bottom: 15 };
  11402. * const intersection = Rectangle.getIntersectionBetweenTwoRect(rect1, rect2);
  11403. * // Returns { left: 5, top: 5, right: 10, bottom: 10, width: 5, height: 5 }
  11404. * ```
  11405. */
  11406. static getIntersectionBetweenTwoRect(e, n) {
  11407. const r = Math.max(e.left, n.left), s = Math.min(e.right, n.right), i = Math.max(e.top, n.top), o = Math.min(e.bottom, n.bottom);
  11408. return s <= r || o <= i ? null : {
  11409. left: r,
  11410. right: s,
  11411. top: i,
  11412. bottom: o,
  11413. width: s - r,
  11414. height: o - i
  11415. };
  11416. }
  11417. /**
  11418. * Sorts an array of ranges by startRow, then by startColumn
  11419. * @param ranges
  11420. * @example
  11421. * ```typescript
  11422. * const ranges = [
  11423. * { startRow: 1, startColumn: 0, endRow: 2, endColumn: 1 },
  11424. * { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 }
  11425. * ];
  11426. * const sorted = Rectangle.sort(ranges);
  11427. * // Ranges will be sorted by startRow first, then startColumn
  11428. * ```
  11429. */
  11430. static sort(e) {
  11431. return e.sort((n, r) => n.startRow - r.startRow || n.startColumn - r.startColumn);
  11432. }
  11433. };
  11434. C(Ut, "getRelativeRange", (e, n) => ({
  11435. startRow: e.startRow - n.startRow,
  11436. endRow: e.endRow - e.startRow,
  11437. startColumn: e.startColumn - n.startColumn,
  11438. endColumn: e.endColumn - e.startColumn
  11439. })), /**
  11440. * Converts a relative range back to an absolute range based on origin
  11441. * @param relativeRange
  11442. * @param originRange
  11443. * @param absoluteRange
  11444. * @example
  11445. * ```typescript
  11446. * const relative = { startRow: 2, startColumn: 2, endRow: 2, endColumn: 2 };
  11447. * const origin = { startRow: 3, startColumn: 3, endRow: 8, endColumn: 8 };
  11448. * const absolute = Rectangle.getPositionRange(relative, origin);
  11449. * // absolute = { startRow: 5, startColumn: 5, endRow: 7, endColumn: 7 }
  11450. * ```
  11451. */
  11452. C(Ut, "getPositionRange", (e, n, r) => ({
  11453. ...r || {},
  11454. startRow: r && [tt.ROW, tt.ALL].includes(r.startAbsoluteRefType || 0) ? r.startRow : e.startRow + n.startRow,
  11455. endRow: r && [tt.ROW, tt.ALL].includes(r.endAbsoluteRefType || 0) ? r.endRow : e.endRow + e.startRow + n.startRow,
  11456. startColumn: r && [tt.COLUMN, tt.ALL].includes(r.startAbsoluteRefType || 0) ? r.startColumn : e.startColumn + n.startColumn,
  11457. endColumn: r && [tt.COLUMN, tt.ALL].includes(r.endAbsoluteRefType || 0) ? r.endColumn : e.endColumn + e.startColumn + n.startColumn
  11458. })), /**
  11459. * Moves a range horizontally by a specified step and optionally extends it
  11460. * @param range
  11461. * @param step
  11462. * @param length
  11463. * @example
  11464. * ```typescript
  11465. * const range = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
  11466. * const moved = Rectangle.moveHorizontal(range, 2, 1);
  11467. * // moved = { startRow: 0, startColumn: 2, endRow: 1, endColumn: 4 }
  11468. * ```
  11469. */
  11470. C(Ut, "moveHorizontal", (e, n = 0, r = 0) => ({
  11471. ...e,
  11472. startColumn: e.startColumn + n,
  11473. endColumn: e.endColumn + n + r
  11474. })), /**
  11475. * Moves a range vertically by a specified step and optionally extends it
  11476. * @param range
  11477. * @param step
  11478. * @param length
  11479. * @example
  11480. * ```typescript
  11481. * const range = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
  11482. * const moved = Rectangle.moveVertical(range, 2, 1);
  11483. * // moved = { startRow: 2, startColumn: 0, endRow: 4, endColumn: 1 }
  11484. * ```
  11485. */
  11486. C(Ut, "moveVertical", (e, n = 0, r = 0) => ({
  11487. ...e,
  11488. startRow: e.startRow + n,
  11489. endRow: e.endRow + n + r
  11490. })), /**
  11491. * Moves a range by specified offsets in both directions
  11492. * @param range
  11493. * @param offsetX
  11494. * @param offsetY
  11495. * @example
  11496. * ```typescript
  11497. * const range = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
  11498. * const moved = Rectangle.moveOffset(range, 2, 3);
  11499. * // moved = { startRow: 3, startColumn: 2, endRow: 4, endColumn: 3 }
  11500. * ```
  11501. */
  11502. C(Ut, "moveOffset", (e, n, r) => ({
  11503. ...e,
  11504. startRow: e.startRow + r,
  11505. endRow: e.endRow + r,
  11506. startColumn: e.startColumn + n,
  11507. endColumn: e.endColumn + n
  11508. }));
  11509. var en = Ut;
  11510. function Up(t, e) {
  11511. if (t.length === 0 || t[0].length === 0)
  11512. return null;
  11513. const n = new Array(t[0].length).fill(0);
  11514. let r = 0, s = null;
  11515. for (let i = 0; i < t.length; i++) {
  11516. for (let a = 0; a < t[0].length; a++)
  11517. n[a] = e(t[i][a]) ? n[a] + 1 : 0;
  11518. const o = Pp(n);
  11519. o.area > r && (r = o.area, s = {
  11520. startColumn: o.start,
  11521. startRow: i - o.height + 1,
  11522. endColumn: o.end,
  11523. endRow: i
  11524. });
  11525. }
  11526. return s;
  11527. }
  11528. function Pp(t) {
  11529. const e = [];
  11530. let n = 0, r = { area: 0, height: 0, start: 0, end: 0 }, s = 0;
  11531. for (; s < t.length; )
  11532. if (e.length === 0 || t[s] >= t[e[e.length - 1]])
  11533. e.push(s++);
  11534. else {
  11535. const i = t[e.pop()], o = e.length === 0 ? s : s - e[e.length - 1] - 1;
  11536. i * o > n && (n = i * o, r = { area: n, height: i, start: e.length === 0 ? 0 : e[e.length - 1] + 1, end: s - 1 });
  11537. }
  11538. for (; e.length > 0; ) {
  11539. const i = t[e.pop()], o = e.length === 0 ? s : s - e[e.length - 1] - 1;
  11540. i * o > n && (n = i * o, r = { area: n, height: i, start: e.length === 0 ? 0 : e[e.length - 1] + 1, end: s - 1 });
  11541. }
  11542. return r;
  11543. }
  11544. function kp(t, e) {
  11545. tr.foreach(e, (n, r) => {
  11546. t[n][r] = void 0;
  11547. });
  11548. }
  11549. function WC(t, e) {
  11550. const n = t.toFullArray(), r = [];
  11551. for (; ; ) {
  11552. const s = Up(n, e);
  11553. if (!s)
  11554. break;
  11555. r.push(s), kp(n, s);
  11556. }
  11557. return r;
  11558. }
  11559. var zC = class {
  11560. constructor(e, n) {
  11561. C(this, "_values", []);
  11562. C(this, "_keys", []);
  11563. C(this, "_keyMaps", /* @__PURE__ */ new Map());
  11564. this._values = e, this._keys = n, e.forEach((r) => {
  11565. this._initKeyMap(r);
  11566. });
  11567. }
  11568. _initKeyMap(e) {
  11569. this._keys.forEach((n) => {
  11570. const r = e[n], s = this._keyMaps.get(n) || /* @__PURE__ */ new Map();
  11571. s.set(r, e), this._keyMaps.set(n, s);
  11572. });
  11573. }
  11574. /**
  11575. * If a key group is specified, the order of values is determined by the key group, otherwise it depends on the keys at initialization
  11576. * @param {string} key
  11577. * @param {K[]} [keyGroup]
  11578. * @return {*}
  11579. * @memberof RefAlias
  11580. */
  11581. getValue(e, n) {
  11582. const r = n || this._keys;
  11583. for (let s = 0; s < r.length; s++) {
  11584. const i = this._keyMaps.get(r[s]);
  11585. if (i != null && i.has(e))
  11586. return i.get(e);
  11587. }
  11588. return null;
  11589. }
  11590. hasValue(e) {
  11591. for (let n = 0; n < this._keys.length; n++) {
  11592. const r = this._keyMaps.get(this._keys[n]);
  11593. if (r != null && r.has(e))
  11594. return true;
  11595. }
  11596. return false;
  11597. }
  11598. addValue(e) {
  11599. this._values.push(e), this._initKeyMap(e);
  11600. }
  11601. setValue(e, n, r) {
  11602. const s = this.getValue(e);
  11603. s && Object.keys(s).includes(n) && (s[n] = r);
  11604. }
  11605. deleteValue(e, n) {
  11606. const r = this.getValue(e, n);
  11607. if (r) {
  11608. this._keys.forEach((i) => {
  11609. const o = this._keyMaps.get(i), a = r[i];
  11610. o == null || o.delete(a);
  11611. });
  11612. const s = this._values.findIndex((i) => i === r);
  11613. this._values.splice(s, 1);
  11614. }
  11615. }
  11616. getValues() {
  11617. return this._values;
  11618. }
  11619. getKeyMap(e) {
  11620. var n;
  11621. return [...((n = this._keyMaps.get(e)) == null ? void 0 : n.keys()) || []];
  11622. }
  11623. clear() {
  11624. this._values = [], this._keys = [], this._keyMaps.clear();
  11625. }
  11626. };
  11627. function Qo(t, e, n, r) {
  11628. return {
  11629. forEach(s) {
  11630. for (let i = t; i <= e; i++)
  11631. for (let o = n; o <= r; o++)
  11632. s(i, o);
  11633. }
  11634. };
  11635. }
  11636. function YC(t) {
  11637. if (t == null || t.length === 0)
  11638. return Number.NaN;
  11639. const e = t.toLowerCase().split(""), n = e.length, r = (o) => o.charCodeAt(0) - 96;
  11640. let s = 0, i = 0;
  11641. for (let o = 0; o < n; o++)
  11642. i = r(e[o]), s += i * 26 ** (n - o - 1);
  11643. return s === 0 ? Number.NaN : s - 1;
  11644. }
  11645. var qr = 65;
  11646. var Pu = 90;
  11647. var Fp = 97;
  11648. function VC(t) {
  11649. const e = Pu - qr + 1;
  11650. let n = "";
  11651. for (; t >= 0; )
  11652. n = String.fromCharCode(t % e + qr) + n, t = Math.floor(t / e) - 1;
  11653. return n;
  11654. }
  11655. function $p(t, e) {
  11656. let n = "";
  11657. for (; e > 0; )
  11658. n += t, e--;
  11659. return n;
  11660. }
  11661. function GC(t, e = false) {
  11662. const n = Pu - qr + 1;
  11663. let r = Fp;
  11664. e && (r = qr);
  11665. const s = String.fromCharCode(t % n + r), i = Math.floor(t / n) + 1;
  11666. return $p(s, i);
  11667. }
  11668. function KC(t, e) {
  11669. return t.zIndex > e.zIndex ? 1 : t.zIndex === e.zIndex ? 0 : -1;
  11670. }
  11671. function XC(t, e) {
  11672. return t.zIndex > e.zIndex ? -1 : t.zIndex === e.zIndex ? 0 : 1;
  11673. }
  11674. function ps(t = "index", e = 1) {
  11675. return (n, r) => n[t] > r[t] ? e : n[t] === r[t] ? 0 : -e;
  11676. }
  11677. var Bp = ((t) => (t[t.character = 0] = "character", t[t.paragraph = 1] = "paragraph", t[t.table = 2] = "table", t[t.numbering = 3] = "numbering", t))(Bp || {});
  11678. var jp = ((t) => (t[t.TAB = 0] = "TAB", t[t.SPACE = 1] = "SPACE", t[t.NOTHING = 2] = "NOTHING", t))(jp || {});
  11679. var Te = ((t) => (t[t.BULLET = 0] = "BULLET", t[t.NONE = 1] = "NONE", t[t.DECIMAL = 2] = "DECIMAL", t[t.DECIMAL_ZERO = 3] = "DECIMAL_ZERO", t[t.UPPER_LETTER = 4] = "UPPER_LETTER", t[t.LOWER_LETTER = 5] = "LOWER_LETTER", t[t.UPPER_ROMAN = 6] = "UPPER_ROMAN", t[t.LOWER_ROMAN = 7] = "LOWER_ROMAN", t[t.ORDINAL = 8] = "ORDINAL", t[t.CARDINAL_TEXT = 9] = "CARDINAL_TEXT", t[t.ORDINAL_TEXT = 10] = "ORDINAL_TEXT", t[t.HEX = 11] = "HEX", t[t.CHICAGO = 12] = "CHICAGO", t[t.IDEOGRAPH_DIGITAL = 13] = "IDEOGRAPH_DIGITAL", t[t.JAPANESE_COUNTING = 14] = "JAPANESE_COUNTING", t[t.AIUEO = 15] = "AIUEO", t[t.IROHA = 16] = "IROHA", t[t.DECIMAL_FULL_WIDTH = 17] = "DECIMAL_FULL_WIDTH", t[t.DECIMAL_HALF_WIDTH = 18] = "DECIMAL_HALF_WIDTH", t[t.JAPANESE_LEGAL = 19] = "JAPANESE_LEGAL", t[t.JAPANESE_DIGITAL_TEN_THOUSAND = 20] = "JAPANESE_DIGITAL_TEN_THOUSAND", t[t.DECIMAL_ENCLOSED_CIRCLE = 21] = "DECIMAL_ENCLOSED_CIRCLE", t[t.DECIMAL_FULL_WIDTH2 = 22] = "DECIMAL_FULL_WIDTH2", t[t.AIUEO_FULL_WIDTH = 23] = "AIUEO_FULL_WIDTH", t[t.IROHA_FULL_WIDTH = 24] = "IROHA_FULL_WIDTH", t[t.GANADA = 25] = "GANADA", t[t.CHOSUNG = 26] = "CHOSUNG", t[t.DECIMAL_ENCLOSED_FULLSTOP = 27] = "DECIMAL_ENCLOSED_FULLSTOP", t[t.DECIMAL_ENCLOSED_PAREN = 28] = "DECIMAL_ENCLOSED_PAREN", t[t.DECIMAL_ENCLOSED_CIRCLE_CHINESE = 29] = "DECIMAL_ENCLOSED_CIRCLE_CHINESE", t[t.IDEOGRAPH_ENCLOSED_CIRCLE = 30] = "IDEOGRAPH_ENCLOSED_CIRCLE", t[t.IDEOGRAPH_TRADITIONAL = 31] = "IDEOGRAPH_TRADITIONAL", t[t.IDEOGRAPH_ZODIAC = 32] = "IDEOGRAPH_ZODIAC", t[t.IDEOGRAPH_ZODIAC_TRADITIONAL = 33] = "IDEOGRAPH_ZODIAC_TRADITIONAL", t[t.TAIWANESE_COUNTING = 34] = "TAIWANESE_COUNTING", t[t.IDEOGRAPH_LEGAL_TRADITIONAL = 35] = "IDEOGRAPH_LEGAL_TRADITIONAL", t[t.TAIWANESE_COUNTING_THOUSAND = 36] = "TAIWANESE_COUNTING_THOUSAND", t[t.TAIWANESE_DIGITAL = 37] = "TAIWANESE_DIGITAL", t[t.CHINESE_COUNTING = 38] = "CHINESE_COUNTING", t[t.CHINESE_LEGAL_SIMPLIFIED = 39] = "CHINESE_LEGAL_SIMPLIFIED", t[t.CHINESE_COUNTING_THOUSAND = 40] = "CHINESE_COUNTING_THOUSAND", t[t.KOREAN_DIGITAL = 41] = "KOREAN_DIGITAL", t[t.KOREAN_COUNTING = 42] = "KOREAN_COUNTING", t[t.KOREAN_LEGAL = 43] = "KOREAN_LEGAL", t[t.KOREAN_DIGITAL2 = 44] = "KOREAN_DIGITAL2", t[t.VIETNAMESE_COUNTING = 45] = "VIETNAMESE_COUNTING", t[t.RUSSIAN_LOWER = 46] = "RUSSIAN_LOWER", t[t.RUSSIAN_UPPER = 47] = "RUSSIAN_UPPER", t[t.NUMBER_IN_DASH = 48] = "NUMBER_IN_DASH", t[t.HEBREW1 = 49] = "HEBREW1", t[t.HEBREW2 = 50] = "HEBREW2", t[t.ARABIC_ALPHA = 51] = "ARABIC_ALPHA", t[t.ARABIC_ABJAD = 52] = "ARABIC_ABJAD", t[t.HINDI_VOWELS = 53] = "HINDI_VOWELS", t[t.HINDI_CONSONANTS = 54] = "HINDI_CONSONANTS", t[t.HINDI_NUMBERS = 55] = "HINDI_NUMBERS", t[t.HINDI_COUNTING = 56] = "HINDI_COUNTING", t[t.THAI_LETTERS = 57] = "THAI_LETTERS", t[t.THAI_NUMBERS = 58] = "THAI_NUMBERS", t[t.THAI_COUNTING = 59] = "THAI_COUNTING", t[t.CUSTOM = 60] = "CUSTOM", t))(Te || {});
  11680. var ms = ((t) => (t[t.BULLET_ALIGNMENT_UNSPECIFIED = 0] = "BULLET_ALIGNMENT_UNSPECIFIED", t[t.START = 1] = "START", t[t.CENTER = 2] = "CENTER", t[t.END = 3] = "END", t[t.BOTH = 4] = "BOTH", t))(ms || {});
  11681. var mn = ((t) => (t[t.HYPERLINK = 0] = "HYPERLINK", t[t.FIELD = 1] = "FIELD", t[t.SDT = 2] = "SDT", t[t.BOOKMARK = 3] = "BOOKMARK", t[t.COMMENT = 4] = "COMMENT", t[t.CUSTOM = 5] = "CUSTOM", t[t.MENTION = 6] = "MENTION", t[t.UNI_FORMULA = 7] = "UNI_FORMULA", t[t.DELTED = 9999] = "DELTED", t))(mn || {});
  11682. var An = ((t) => (t[t.COMMENT = 0] = "COMMENT", t[t.DELETED = 9999] = "DELETED", t))(An || {});
  11683. var Hp = ((t) => (t[t.DRAWING = 0] = "DRAWING", t[t.CUSTOM = 1] = "CUSTOM", t))(Hp || {});
  11684. var ku = ((t) => (t[t.UNSPECIFIED = 0] = "UNSPECIFIED", t[t.TRADITIONAL = 1] = "TRADITIONAL", t[t.MODERN = 2] = "MODERN", t))(ku || {});
  11685. var Wp = ((t) => (t[t.DEFAULT = 0] = "DEFAULT", t[t.LINES = 1] = "LINES", t[t.LINES_AND_CHARS = 2] = "LINES_AND_CHARS", t[t.SNAP_TO_CHARS = 3] = "SNAP_TO_CHARS", t))(Wp || {});
  11686. var zp = ((t) => (t[t.SECTION_TYPE_UNSPECIFIED = 0] = "SECTION_TYPE_UNSPECIFIED", t[t.CONTINUOUS = 1] = "CONTINUOUS", t[t.NEXT_PAGE = 2] = "NEXT_PAGE", t[t.EVEN_PAGE = 3] = "EVEN_PAGE", t[t.ODD_PAGE = 4] = "ODD_PAGE", t))(zp || {});
  11687. var Yp = ((t) => (t[t.COLUMN_SEPARATOR_STYLE_UNSPECIFIED = 0] = "COLUMN_SEPARATOR_STYLE_UNSPECIFIED", t[t.NONE = 1] = "NONE", t[t.BETWEEN_EACH_COLUMN = 2] = "BETWEEN_EACH_COLUMN", t))(Yp || {});
  11688. var Vp = ((t) => (t[t.NORMAL = 0] = "NORMAL", t[t.TBRL = 1] = "TBRL", t[t.LRTBV = 2] = "LRTBV", t))(Vp || {});
  11689. var Gp = ((t) => (t[t.TEXT_RUN = 0] = "TEXT_RUN", t[t.AUTO_TEXT = 1] = "AUTO_TEXT", t[t.PAGE_BREAK = 2] = "PAGE_BREAK", t[t.COLUMN_BREAK = 3] = "COLUMN_BREAK", t[t.FOOT_NOTE_REFERENCE = 4] = "FOOT_NOTE_REFERENCE", t[t.HORIZONTAL_RULE = 5] = "HORIZONTAL_RULE", t[t.EQUATION = 6] = "EQUATION", t[t.DRAWING = 7] = "DRAWING", t[t.PERSON = 8] = "PERSON", t[t.RICH_LINK = 9] = "RICH_LINK", t))(Gp || {});
  11690. var Kp = ((t) => (t[t.BOTH_SIDES = 0] = "BOTH_SIDES", t[t.LEFT = 1] = "LEFT", t[t.RIGHT = 2] = "RIGHT", t[t.LARGEST = 3] = "LARGEST", t))(Kp || {});
  11691. var Xp = ((t) => (t[t.INLINE = 0] = "INLINE", t[t.WRAP_NONE = 1] = "WRAP_NONE", t[t.WRAP_POLYGON = 2] = "WRAP_POLYGON", t[t.WRAP_SQUARE = 3] = "WRAP_SQUARE", t[t.WRAP_THROUGH = 4] = "WRAP_THROUGH", t[t.WRAP_TIGHT = 5] = "WRAP_TIGHT", t[t.WRAP_TOP_AND_BOTTOM = 6] = "WRAP_TOP_AND_BOTTOM", t))(Xp || {});
  11692. var Jp = ((t) => (t[t.NAMED_STYLE_TYPE_UNSPECIFIED = 0] = "NAMED_STYLE_TYPE_UNSPECIFIED", t[t.NORMAL_TEXT = 1] = "NORMAL_TEXT", t[t.TITLE = 2] = "TITLE", t[t.SUBTITLE = 3] = "SUBTITLE", t[t.HEADING_1 = 4] = "HEADING_1", t[t.HEADING_2 = 5] = "HEADING_2", t[t.HEADING_3 = 6] = "HEADING_3", t[t.HEADING_4 = 7] = "HEADING_4", t[t.HEADING_5 = 8] = "HEADING_5", t[t.HEADING_6 = 9] = "HEADING_6", t))(Jp || {});
  11693. var Zp = ((t) => (t[t.AUTO = 0] = "AUTO", t[t.AT_LEAST = 1] = "AT_LEAST", t[t.EXACT = 2] = "EXACT", t))(Zp || {});
  11694. var Qp = ((t) => (t[t.DASH_STYLE_UNSPECIFIED = 0] = "DASH_STYLE_UNSPECIFIED", t[t.SOLID = 1] = "SOLID", t[t.DOT = 2] = "DOT", t[t.DASH = 3] = "DASH", t))(Qp || {});
  11695. var qp = ((t) => (t[t.TAB_STOP_ALIGNMENT_UNSPECIFIED = 0] = "TAB_STOP_ALIGNMENT_UNSPECIFIED", t[t.START = 1] = "START", t[t.CENTER = 2] = "CENTER", t[t.END = 3] = "END", t))(qp || {});
  11696. var em = ((t) => (t[t.UNSPECIFIED = 0] = "UNSPECIFIED", t[t.SPECIFIED = 1] = "SPECIFIED", t))(em || {});
  11697. var tm = ((t) => (t[t.START = 0] = "START", t[t.CENTER = 1] = "CENTER", t[t.END = 2] = "END", t))(tm || {});
  11698. var nm = ((t) => (t[t.AUTO_FIT = 0] = "AUTO_FIT", t[t.FIXED = 1] = "FIXED", t))(nm || {});
  11699. var rm = ((t) => (t[t.NONE = 0] = "NONE", t[t.WRAP = 1] = "WRAP", t))(rm || {});
  11700. var sm = ((t) => (t[t.AUTO = 0] = "AUTO", t[t.AT_LEAST = 1] = "AT_LEAST", t[t.EXACT = 2] = "EXACT", t))(sm || {});
  11701. var im = ((t) => (t[t.CONTENT_ALIGNMENT_UNSPECIFIED = 0] = "CONTENT_ALIGNMENT_UNSPECIFIED", t[t.BOTH = 1] = "BOTH", t[t.TOP = 2] = "TOP", t[t.CENTER = 3] = "CENTER", t[t.BOTTOM = 4] = "BOTTOM", t))(im || {});
  11702. var Yn = ((t) => (t.NORMAL = "normal", t.BOLD = "bold", t.ITALIC = "italic", t))(Yn || {});
  11703. var om = ((t) => (t[t.PAGE = 0] = "PAGE", t[t.COLUMN = 1] = "COLUMN", t[t.CHARACTER = 2] = "CHARACTER", t[t.MARGIN = 3] = "MARGIN", t[t.INSIDE_MARGIN = 4] = "INSIDE_MARGIN", t[t.OUTSIDE_MARGIN = 5] = "OUTSIDE_MARGIN", t[t.LEFT_MARGIN = 6] = "LEFT_MARGIN", t[t.RIGHT_MARGIN = 7] = "RIGHT_MARGIN", t))(om || {});
  11704. var am = ((t) => (t[t.PAGE = 0] = "PAGE", t[t.PARAGRAPH = 1] = "PARAGRAPH", t[t.LINE = 2] = "LINE", t[t.MARGIN = 3] = "MARGIN", t[t.TOP_MARGIN = 4] = "TOP_MARGIN", t[t.BOTTOM_MARGIN = 5] = "BOTTOM_MARGIN", t[t.INSIDE_MARGIN = 6] = "INSIDE_MARGIN", t[t.OUTSIDE_MARGIN = 7] = "OUTSIDE_MARGIN", t))(am || {});
  11705. var um = ((t) => (t[t.POINT = 0] = "POINT", t[t.LINE = 1] = "LINE", t[t.CHARACTER = 2] = "CHARACTER", t[t.PIXEL = 3] = "PIXEL", t[t.PERCENT = 4] = "PERCENT", t))(um || {});
  11706. var lm = ((t) => (t[t.CENTER = 0] = "CENTER", t[t.INSIDE = 1] = "INSIDE", t[t.LEFT = 2] = "LEFT", t[t.OUTSIDE = 3] = "OUTSIDE", t[t.RIGHT = 4] = "RIGHT", t[t.BOTH = 5] = "BOTH", t[t.DISTRIBUTE = 6] = "DISTRIBUTE", t))(lm || {});
  11707. var cm = ((t) => (t[t.BOTTOM = 0] = "BOTTOM", t[t.CENTER = 1] = "CENTER", t[t.INSIDE = 2] = "INSIDE", t[t.OUTSIDE = 3] = "OUTSIDE", t[t.TOP = 4] = "TOP", t))(cm || {});
  11708. var hm = ((t) => (t[t.compressPunctuation = 0] = "compressPunctuation", t[t.compressPunctuationAndJapaneseKana = 1] = "compressPunctuationAndJapaneseKana", t[t.doNotCompress = 2] = "doNotCompress", t))(hm || {});
  11709. var dm = ((t) => (t[t.PORTRAIT = 0] = "PORTRAIT", t[t.LANDSCAPE = 1] = "LANDSCAPE", t))(dm || {});
  11710. var fm = ((t) => (t[t.forward = 0] = "forward", t[t.backward = 1] = "backward", t[t.front = 2] = "front", t[t.back = 3] = "back", t))(fm || {});
  11711. var gm = ((t) => (t[t.UNRECOGNIZED = -1] = "UNRECOGNIZED", t[t.DRAWING_IMAGE = 0] = "DRAWING_IMAGE", t[t.DRAWING_SHAPE = 1] = "DRAWING_SHAPE", t[t.DRAWING_CHART = 2] = "DRAWING_CHART", t[t.DRAWING_TABLE = 3] = "DRAWING_TABLE", t[t.DRAWING_SMART_ART = 4] = "DRAWING_SMART_ART", t[t.DRAWING_VIDEO = 5] = "DRAWING_VIDEO", t[t.DRAWING_GROUP = 6] = "DRAWING_GROUP", t[t.DRAWING_UNIT = 7] = "DRAWING_UNIT", t[t.DRAWING_DOM = 8] = "DRAWING_DOM", t))(gm || {});
  11712. var Fu = ((t) => (t[t.SLIDE = 0] = "SLIDE", t[t.MASTER = 1] = "MASTER", t[t.LAYOUT = 2] = "LAYOUT", t[t.HANDOUT_MASTER = 3] = "HANDOUT_MASTER", t[t.NOTES_MASTER = 4] = "NOTES_MASTER", t))(Fu || {});
  11713. var pm = ((t) => (t[t.SHAPE = 0] = "SHAPE", t[t.IMAGE = 1] = "IMAGE", t[t.TEXT = 2] = "TEXT", t[t.SPREADSHEET = 3] = "SPREADSHEET", t[t.DOCUMENT = 4] = "DOCUMENT", t[t.SLIDE = 5] = "SLIDE", t))(pm || {});
  11714. var mm = ((t) => (t[t.RELATIVE_SLIDE_LINK_UNSPECIFIED = 0] = "RELATIVE_SLIDE_LINK_UNSPECIFIED", t[t.NEXT_SLIDE = 1] = "NEXT_SLIDE", t[t.PREVIOUS_SLIDE = 2] = "PREVIOUS_SLIDE", t[t.FIRST_SLIDE = 3] = "FIRST_SLIDE", t[t.LAST_SLIDE = 4] = "LAST_SLIDE", t))(mm || {});
  11715. var Fe = ((t) => (t[t.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", t[t.UNIVER_DOC = 1] = "UNIVER_DOC", t[t.UNIVER_SHEET = 2] = "UNIVER_SHEET", t[t.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", t[t.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", t[t.UNRECOGNIZED = -1] = "UNRECOGNIZED", t))(Fe || {});
  11716. var Tt = ((t) => (t[t.Reader = 0] = "Reader", t[t.Editor = 1] = "Editor", t[t.Owner = 2] = "Owner", t[t.UNRECOGNIZED = -1] = "UNRECOGNIZED", t))(Tt || {});
  11717. var Js = ((t) => (t[t.SomeCollaborator = 0] = "SomeCollaborator", t[t.AllCollaborator = 1] = "AllCollaborator", t[t.OneSelf = 2] = "OneSelf", t[t.UNRECOGNIZED = -1] = "UNRECOGNIZED", t))(Js || {});
  11718. var Ui = class extends nt {
  11719. };
  11720. function _m(t = re.generateRandomId(6), e = ur.EN_US, n = "") {
  11721. return {
  11722. id: t,
  11723. locale: e,
  11724. title: n,
  11725. // title should get from request.
  11726. tableSource: {},
  11727. drawings: {},
  11728. drawingsOrder: [],
  11729. headers: {},
  11730. footers: {},
  11731. body: {
  11732. dataStream: `\r
  11733. `,
  11734. textRuns: [],
  11735. customBlocks: [],
  11736. tables: [],
  11737. paragraphs: [
  11738. {
  11739. startIndex: 0,
  11740. paragraphStyle: {
  11741. spaceAbove: { v: 5 },
  11742. lineSpacing: 1,
  11743. spaceBelow: { v: 0 }
  11744. }
  11745. }
  11746. ],
  11747. sectionBreaks: [
  11748. {
  11749. startIndex: 1
  11750. }
  11751. ]
  11752. },
  11753. documentStyle: {
  11754. pageSize: {
  11755. width: 793.3333333333334,
  11756. height: 1122.6666666666667
  11757. },
  11758. documentFlavor: ku.TRADITIONAL,
  11759. marginTop: 50,
  11760. marginBottom: 50,
  11761. marginRight: 50,
  11762. marginLeft: 50,
  11763. renderConfig: {
  11764. zeroWidthParagraphBreak: we.FALSE,
  11765. vertexAngle: 0,
  11766. centerAngle: 0,
  11767. background: {
  11768. rgb: "#ccc"
  11769. }
  11770. },
  11771. autoHyphenation: we.TRUE,
  11772. doNotHyphenateCaps: we.FALSE,
  11773. consecutiveHyphenLimit: 2,
  11774. defaultHeaderId: "",
  11775. defaultFooterId: "",
  11776. evenPageHeaderId: "",
  11777. evenPageFooterId: "",
  11778. firstPageHeaderId: "",
  11779. firstPageFooterId: "",
  11780. evenAndOddHeaders: we.FALSE,
  11781. useFirstPageHeaderFooter: we.FALSE,
  11782. marginHeader: 30,
  11783. marginFooter: 30
  11784. },
  11785. settings: {}
  11786. };
  11787. }
  11788. var $n = {};
  11789. var Ir = {};
  11790. var vr = {};
  11791. var qo;
  11792. function Em() {
  11793. if (qo)
  11794. return vr;
  11795. qo = 1, Object.defineProperty(vr, "__esModule", { value: true });
  11796. function t(r, s) {
  11797. if (Array.isArray(s))
  11798. return false;
  11799. for (let i in r)
  11800. if (!n(r[i], s[i]))
  11801. return false;
  11802. for (let i in s)
  11803. if (r[i] === void 0)
  11804. return false;
  11805. return true;
  11806. }
  11807. function e(r, s) {
  11808. if (!Array.isArray(s) || r.length !== s.length)
  11809. return false;
  11810. for (let i = 0; i < r.length; i++)
  11811. if (!n(r[i], s[i]))
  11812. return false;
  11813. return true;
  11814. }
  11815. function n(r, s) {
  11816. return r === s ? true : r === null || s === null || typeof r != "object" || typeof s != "object" ? false : Array.isArray(r) ? e(r, s) : t(r, s);
  11817. }
  11818. return vr.default = n, vr;
  11819. }
  11820. var yr = {};
  11821. var ea;
  11822. function Cm() {
  11823. if (ea)
  11824. return yr;
  11825. ea = 1, Object.defineProperty(yr, "__esModule", { value: true });
  11826. function t(e) {
  11827. if (e === null)
  11828. return null;
  11829. if (Array.isArray(e))
  11830. return e.map(t);
  11831. if (typeof e == "object") {
  11832. const n = {};
  11833. for (let r in e)
  11834. n[r] = t(e[r]);
  11835. return n;
  11836. } else
  11837. return e;
  11838. }
  11839. return yr.default = t, yr;
  11840. }
  11841. var Ns = {};
  11842. var ta;
  11843. function $u() {
  11844. return ta || (ta = 1, function(t) {
  11845. Object.defineProperty(t, "__esModule", { value: true }), t.eachChildOf = t.advancer = t.readCursor = t.writeCursor = t.WriteCursor = t.ReadCursor = t.isValidPathItem = void 0;
  11846. function e(l, h) {
  11847. if (!l)
  11848. throw new Error(h);
  11849. }
  11850. const n = (l) => l != null && typeof l == "object" && !Array.isArray(l), r = (l, h) => (
  11851. // All the numbers, then all the letters. Just as the gods of ascii intended.
  11852. typeof l == typeof h ? l > h : typeof l == "string" && typeof h == "number"
  11853. );
  11854. function s(l, h) {
  11855. for (let d in l) {
  11856. const f = d;
  11857. h.write(f, l[f]);
  11858. }
  11859. }
  11860. t.isValidPathItem = (l) => typeof l == "number" || typeof l == "string" && l !== "__proto__";
  11861. class i {
  11862. constructor(h = null) {
  11863. this.parents = [], this.indexes = [], this.lcIdx = -1, this.idx = -1, this.container = h;
  11864. }
  11865. ascend() {
  11866. e(this.parents.length === this.indexes.length / 2), this.idx === 0 ? this.parents.length ? (this.lcIdx = this.indexes.pop(), this.container = this.parents.pop(), this.idx = this.indexes.pop()) : (this.lcIdx = 0, this.idx = -1) : (e(this.idx > 0), this.idx--, n(this.container[this.idx]) && this.idx--);
  11867. }
  11868. getPath() {
  11869. const h = [];
  11870. let d = this.container, f = this.parents.length - 1, E = this.idx;
  11871. for (; E >= 0; )
  11872. h.unshift(d[E]), E === 0 ? (E = this.indexes[f * 2], d = this.parents[f--]) : E -= n(d[E - 1]) ? 2 : 1;
  11873. return h;
  11874. }
  11875. }
  11876. class o extends i {
  11877. get() {
  11878. return this.container ? this.container.slice(this.idx + 1) : null;
  11879. }
  11880. // Its only valid to call this after descending into a child.
  11881. getKey() {
  11882. return e(this.container != null, "Invalid call to getKey before cursor descended"), this.container[this.idx];
  11883. }
  11884. getComponent() {
  11885. let h;
  11886. return this.container && this.container.length > this.idx + 1 && n(h = this.container[this.idx + 1]) ? h : null;
  11887. }
  11888. descendFirst() {
  11889. let h = this.idx + 1;
  11890. if (!this.container || h >= this.container.length || n(this.container[h]) && h + 1 >= this.container.length)
  11891. return false;
  11892. n(this.container[h]) && h++;
  11893. const d = this.container[h];
  11894. return Array.isArray(d) ? (this.indexes.push(this.idx), this.parents.push(this.container), this.indexes.push(h), this.idx = 0, this.container = d) : this.idx = h, true;
  11895. }
  11896. nextSibling() {
  11897. if (e(this.parents.length === this.indexes.length / 2), this.idx > 0 || this.parents.length === 0)
  11898. return false;
  11899. const h = this.indexes[this.indexes.length - 1] + 1, d = this.parents[this.parents.length - 1];
  11900. return h >= d.length ? false : (e(!isNaN(h)), this.indexes[this.indexes.length - 1] = h, this.container = d[h], true);
  11901. }
  11902. _init(h, d, f, E) {
  11903. this.container = h, this.idx = d, this.parents = f.slice(), this.indexes = E.slice();
  11904. }
  11905. clone() {
  11906. const h = new o();
  11907. return h._init(this.container, this.idx, this.parents, this.indexes), h;
  11908. }
  11909. *[Symbol.iterator]() {
  11910. if (this.descendFirst()) {
  11911. do
  11912. yield this.getKey();
  11913. while (this.nextSibling());
  11914. this.ascend();
  11915. }
  11916. }
  11917. // TODO(cleanup): Consider moving these functions out of cursor, since
  11918. // they're really just helper methods.
  11919. // It'd be really nice to do this using generators.
  11920. traverse(h, d) {
  11921. const f = this.getComponent();
  11922. f && d(f, h);
  11923. for (const E of this)
  11924. h && h.descend(E), this.traverse(h, d), h && h.ascend();
  11925. }
  11926. eachPick(h, d) {
  11927. this.traverse(h, (f, E) => {
  11928. f.p != null && d(f.p, E);
  11929. });
  11930. }
  11931. eachDrop(h, d) {
  11932. this.traverse(h, (f, E) => {
  11933. f.d != null && d(f.d, E);
  11934. });
  11935. }
  11936. }
  11937. t.ReadCursor = o;
  11938. class a extends i {
  11939. constructor(h = null) {
  11940. super(h), this.pendingDescent = [], this._op = h;
  11941. }
  11942. flushDescent() {
  11943. e(this.parents.length === this.indexes.length / 2), this.container === null && (this._op = this.container = []);
  11944. for (let h = 0; h < this.pendingDescent.length; h++) {
  11945. const d = this.pendingDescent[h];
  11946. let f = this.idx + 1;
  11947. if (f < this.container.length && n(this.container[f]) && f++, e(f === this.container.length || !n(this.container[f])), f === this.container.length)
  11948. this.container.push(d), this.idx = f;
  11949. else if (this.container[f] === d)
  11950. this.idx = f;
  11951. else {
  11952. if (!Array.isArray(this.container[f])) {
  11953. const E = this.container.splice(f, this.container.length - f);
  11954. this.container.push(E), this.lcIdx > -1 && (this.lcIdx = f);
  11955. }
  11956. for (this.indexes.push(this.idx), this.parents.push(this.container), this.lcIdx !== -1 && (e(r(d, this.container[this.lcIdx][0])), f = this.lcIdx + 1, this.lcIdx = -1); f < this.container.length && r(d, this.container[f][0]); )
  11957. f++;
  11958. if (this.indexes.push(f), this.idx = 0, f < this.container.length && this.container[f][0] === d)
  11959. this.container = this.container[f];
  11960. else {
  11961. const E = [d];
  11962. this.container.splice(f, 0, E), this.container = E;
  11963. }
  11964. }
  11965. }
  11966. this.pendingDescent.length = 0;
  11967. }
  11968. reset() {
  11969. this.lcIdx = -1;
  11970. }
  11971. // Creates and returns a component, creating one if need be. You should
  11972. // probably write to it immediately - ops are not valid with empty
  11973. // components.
  11974. getComponent() {
  11975. this.flushDescent();
  11976. const h = this.idx + 1;
  11977. if (h < this.container.length && n(this.container[h]))
  11978. return this.container[h];
  11979. {
  11980. const d = {};
  11981. return this.container.splice(h, 0, d), d;
  11982. }
  11983. }
  11984. write(h, d) {
  11985. const f = this.getComponent();
  11986. e(f[h] == null || f[h] === d, "Internal consistency error: Overwritten component. File a bug"), f[h] = d;
  11987. }
  11988. get() {
  11989. return this._op;
  11990. }
  11991. descend(h) {
  11992. if (!t.isValidPathItem(h))
  11993. throw Error("Invalid JSON key");
  11994. this.pendingDescent.push(h);
  11995. }
  11996. descendPath(h) {
  11997. return this.pendingDescent.push(...h), this;
  11998. }
  11999. ascend() {
  12000. this.pendingDescent.length ? this.pendingDescent.pop() : super.ascend();
  12001. }
  12002. mergeTree(h, d = s) {
  12003. if (h === null)
  12004. return;
  12005. if (e(Array.isArray(h)), h === this._op)
  12006. throw Error("Cannot merge into my own tree");
  12007. const f = this.lcIdx, E = this.parents.length;
  12008. let R = 0;
  12009. for (let O = 0; O < h.length; O++) {
  12010. const U = h[O];
  12011. typeof U == "string" || typeof U == "number" ? (R++, this.descend(U)) : Array.isArray(U) ? this.mergeTree(U, d) : typeof U == "object" && d(U, this);
  12012. }
  12013. for (; R--; )
  12014. this.ascend();
  12015. this.lcIdx = this.parents.length === E ? f : -1;
  12016. }
  12017. at(h, d) {
  12018. this.descendPath(h), d(this);
  12019. for (let f = 0; f < h.length; f++)
  12020. this.ascend();
  12021. return this;
  12022. }
  12023. // This is used by helpers, so the strict ordering guarantees are
  12024. // relaxed.
  12025. writeAtPath(h, d, f) {
  12026. return this.at(h, () => this.write(d, f)), this.reset(), this;
  12027. }
  12028. writeMove(h, d, f = 0) {
  12029. return this.writeAtPath(h, "p", f).writeAtPath(d, "d", f);
  12030. }
  12031. getPath() {
  12032. const h = super.getPath();
  12033. return h.push(...this.pendingDescent), h;
  12034. }
  12035. }
  12036. t.WriteCursor = a, t.writeCursor = () => new a(), t.readCursor = (l) => new o(l);
  12037. function u(l, h, d) {
  12038. let f, E;
  12039. E = f = l ? l.descendFirst() : false;
  12040. function R(O) {
  12041. let U;
  12042. for (; E; ) {
  12043. const ne = U = l.getKey();
  12044. if (O != null) {
  12045. let X = false;
  12046. if (h && typeof ne == "number" && (U = h(ne, l.getComponent()), U < 0 && (U = ~U, X = true)), r(U, O))
  12047. return null;
  12048. if (U === O && !X)
  12049. return l;
  12050. }
  12051. d && typeof U == "number" && d(U, l.getComponent()), E = l.nextSibling();
  12052. }
  12053. return null;
  12054. }
  12055. return R.end = () => {
  12056. f && l.ascend();
  12057. }, R;
  12058. }
  12059. t.advancer = u;
  12060. function c(l, h, d) {
  12061. let f, E, R, O;
  12062. for (f = E = l && l.descendFirst(), R = O = h && h.descendFirst(); f || R; ) {
  12063. let U = f ? l.getKey() : null, ne = R ? h.getKey() : null;
  12064. U !== null && ne !== null && (r(ne, U) ? ne = null : U !== ne && (U = null)), d(U == null ? ne : U, U != null ? l : null, ne != null ? h : null), U != null && f && (f = l.nextSibling()), ne != null && R && (R = h.nextSibling());
  12065. }
  12066. E && l.ascend(), O && h.ascend();
  12067. }
  12068. t.eachChildOf = c;
  12069. }(Ns)), Ns;
  12070. }
  12071. var Ts = {};
  12072. var na;
  12073. function Bu() {
  12074. return na || (na = 1, function(t) {
  12075. Object.defineProperty(t, "__esModule", { value: true }), t.ConflictType = void 0, function(e) {
  12076. e[e.RM_UNEXPECTED_CONTENT = 1] = "RM_UNEXPECTED_CONTENT", e[e.DROP_COLLISION = 2] = "DROP_COLLISION", e[e.BLACKHOLE = 3] = "BLACKHOLE";
  12077. }(t.ConflictType || (t.ConflictType = {}));
  12078. }(Ts)), Ts;
  12079. }
  12080. var an = {};
  12081. var un = {};
  12082. var ra;
  12083. function Pi() {
  12084. return ra || (ra = 1, Object.defineProperty(un, "__esModule", { value: true }), un.uniToStrPos = un.strPosToUni = void 0, un.strPosToUni = (t, e = t.length) => {
  12085. let n = 0, r = 0;
  12086. for (; r < e; r++) {
  12087. const s = t.charCodeAt(r);
  12088. s >= 55296 && s <= 57343 && (n++, r++);
  12089. }
  12090. if (r !== e)
  12091. throw Error("Invalid offset - splits unicode bytes");
  12092. return r - n;
  12093. }, un.uniToStrPos = (t, e) => {
  12094. let n = 0;
  12095. for (; e > 0; e--) {
  12096. const r = t.charCodeAt(n);
  12097. n += r >= 55296 && r <= 57343 ? 2 : 1;
  12098. }
  12099. return n;
  12100. }), un;
  12101. }
  12102. var Ms = {};
  12103. var sa;
  12104. function Zs() {
  12105. return sa || (sa = 1, function(t) {
  12106. Object.defineProperty(t, "__esModule", { value: true }), t.uniSlice = t.dlen = t.eachOp = void 0;
  12107. const e = Pi(), n = (T) => {
  12108. if (!Array.isArray(T))
  12109. throw Error("Op must be an array of components");
  12110. let A = null;
  12111. for (let H = 0; H < T.length; H++) {
  12112. const Z = T[H];
  12113. switch (typeof Z) {
  12114. case "object":
  12115. if (typeof Z.d != "number" && typeof Z.d != "string")
  12116. throw Error("Delete must be number or string");
  12117. if (t.dlen(Z.d) <= 0)
  12118. throw Error("Deletes must not be empty");
  12119. break;
  12120. case "string":
  12121. if (!(Z.length > 0))
  12122. throw Error("Inserts cannot be empty");
  12123. break;
  12124. case "number":
  12125. if (!(Z > 0))
  12126. throw Error("Skip components must be >0");
  12127. if (typeof A == "number")
  12128. throw Error("Adjacent skip components should be combined");
  12129. break;
  12130. }
  12131. A = Z;
  12132. }
  12133. if (typeof A == "number")
  12134. throw Error("Op has a trailing skip");
  12135. };
  12136. function r(T, A) {
  12137. let H = 0, Z = 0;
  12138. for (let fe = 0; fe < T.length; fe++) {
  12139. const ae = T[fe];
  12140. switch (A(ae, H, Z), typeof ae) {
  12141. case "object":
  12142. H += t.dlen(ae.d);
  12143. break;
  12144. case "string":
  12145. Z += e.strPosToUni(ae);
  12146. break;
  12147. case "number":
  12148. H += ae, Z += ae;
  12149. break;
  12150. }
  12151. }
  12152. }
  12153. t.eachOp = r;
  12154. function s(T, A) {
  12155. const H = [], Z = a(H);
  12156. return r(T, (fe, ae, m) => {
  12157. Z(A(fe, ae, m));
  12158. }), h(H);
  12159. }
  12160. const i = (T) => T, o = (T) => s(T, i);
  12161. t.dlen = (T) => typeof T == "number" ? T : e.strPosToUni(T);
  12162. const a = (T) => (A) => {
  12163. if (!(!A || A.d === 0 || A.d === ""))
  12164. if (T.length === 0)
  12165. T.push(A);
  12166. else if (typeof A == typeof T[T.length - 1])
  12167. if (typeof A == "object") {
  12168. const H = T[T.length - 1];
  12169. H.d = typeof H.d == "string" && typeof A.d == "string" ? H.d + A.d : t.dlen(H.d) + t.dlen(A.d);
  12170. } else
  12171. T[T.length - 1] += A;
  12172. else
  12173. T.push(A);
  12174. }, u = (T) => typeof T == "number" ? T : typeof T == "string" ? e.strPosToUni(T) : typeof T.d == "number" ? T.d : e.strPosToUni(T.d);
  12175. t.uniSlice = (T, A, H) => {
  12176. const Z = e.uniToStrPos(T, A), fe = H == null ? 1 / 0 : e.uniToStrPos(T, H);
  12177. return T.slice(Z, fe);
  12178. };
  12179. const c = (T, A, H) => typeof T == "number" ? H == null ? T - A : Math.min(T, H) - A : t.uniSlice(T, A, H), l = (T) => {
  12180. let A = 0, H = 0;
  12181. return { take: (ae, m) => {
  12182. if (A === T.length)
  12183. return ae === -1 ? null : ae;
  12184. const j = T[A];
  12185. let y;
  12186. if (typeof j == "number")
  12187. return ae === -1 || j - H <= ae ? (y = j - H, ++A, H = 0, y) : (H += ae, ae);
  12188. if (typeof j == "string") {
  12189. if (ae === -1 || m === "i" || e.strPosToUni(j.slice(H)) <= ae)
  12190. return y = j.slice(H), ++A, H = 0, y;
  12191. {
  12192. const M = H + e.uniToStrPos(j.slice(H), ae);
  12193. return y = j.slice(H, M), H = M, y;
  12194. }
  12195. } else {
  12196. if (ae === -1 || m === "d" || t.dlen(j.d) - H <= ae)
  12197. return y = { d: c(j.d, H) }, ++A, H = 0, y;
  12198. {
  12199. let M = c(j.d, H, H + ae);
  12200. return H += ae, { d: M };
  12201. }
  12202. }
  12203. }, peek: () => T[A] };
  12204. }, h = (T) => (T.length > 0 && typeof T[T.length - 1] == "number" && T.pop(), T);
  12205. function d(T, A, H) {
  12206. if (H !== "left" && H !== "right")
  12207. throw Error("side (" + H + ") must be 'left' or 'right'");
  12208. n(T), n(A);
  12209. const Z = [], fe = a(Z), { take: ae, peek: m } = l(T);
  12210. for (let y = 0; y < A.length; y++) {
  12211. const M = A[y];
  12212. let b, w;
  12213. switch (typeof M) {
  12214. case "number":
  12215. for (b = M; b > 0; )
  12216. w = ae(b, "i"), fe(w), typeof w != "string" && (b -= u(w));
  12217. break;
  12218. case "string":
  12219. H === "left" && typeof m() == "string" && fe(ae(-1)), fe(e.strPosToUni(M));
  12220. break;
  12221. case "object":
  12222. for (b = t.dlen(M.d); b > 0; )
  12223. switch (w = ae(b, "i"), typeof w) {
  12224. case "number":
  12225. b -= w;
  12226. break;
  12227. case "string":
  12228. fe(w);
  12229. break;
  12230. case "object":
  12231. b -= t.dlen(w.d);
  12232. }
  12233. break;
  12234. }
  12235. }
  12236. let j;
  12237. for (; j = ae(-1); )
  12238. fe(j);
  12239. return h(Z);
  12240. }
  12241. function f(T, A) {
  12242. n(T), n(A);
  12243. const H = [], Z = a(H), { take: fe } = l(T);
  12244. for (let m = 0; m < A.length; m++) {
  12245. const j = A[m];
  12246. let y, M;
  12247. switch (typeof j) {
  12248. case "number":
  12249. for (y = j; y > 0; )
  12250. M = fe(y, "d"), Z(M), typeof M != "object" && (y -= u(M));
  12251. break;
  12252. case "string":
  12253. Z(j);
  12254. break;
  12255. case "object":
  12256. y = t.dlen(j.d);
  12257. let b = 0;
  12258. for (; b < y; )
  12259. switch (M = fe(y - b, "d"), typeof M) {
  12260. case "number":
  12261. Z({ d: c(j.d, b, b + M) }), b += M;
  12262. break;
  12263. case "string":
  12264. b += e.strPosToUni(M);
  12265. break;
  12266. case "object":
  12267. Z(M);
  12268. }
  12269. break;
  12270. }
  12271. }
  12272. let ae;
  12273. for (; ae = fe(-1); )
  12274. Z(ae);
  12275. return h(H);
  12276. }
  12277. const E = (T, A) => {
  12278. let H = 0;
  12279. for (let Z = 0; Z < A.length && T > H; Z++) {
  12280. const fe = A[Z];
  12281. switch (typeof fe) {
  12282. case "number": {
  12283. H += fe;
  12284. break;
  12285. }
  12286. case "string":
  12287. const ae = e.strPosToUni(fe);
  12288. H += ae, T += ae;
  12289. break;
  12290. case "object":
  12291. T -= Math.min(t.dlen(fe.d), T - H);
  12292. break;
  12293. }
  12294. }
  12295. return T;
  12296. }, R = (T, A) => typeof T == "number" ? E(T, A) : T.map((H) => E(H, A));
  12297. function O(T, A, H) {
  12298. return s(T, (Z, fe) => typeof Z == "object" && typeof Z.d == "number" ? { d: H.slice(A, fe, fe + Z.d) } : Z);
  12299. }
  12300. function U(T) {
  12301. return s(T, (A) => {
  12302. switch (typeof A) {
  12303. case "object":
  12304. if (typeof A.d == "number")
  12305. throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");
  12306. return A.d;
  12307. case "string":
  12308. return { d: A };
  12309. case "number":
  12310. return A;
  12311. }
  12312. });
  12313. }
  12314. function ne(T) {
  12315. return s(T, (A) => typeof A == "object" && typeof A.d == "string" ? { d: e.strPosToUni(A.d) } : A);
  12316. }
  12317. function X(T) {
  12318. let A = true;
  12319. return r(T, (H) => {
  12320. typeof H == "object" && typeof H.d == "number" && (A = false);
  12321. }), A;
  12322. }
  12323. function de(T) {
  12324. return {
  12325. name: "text-unicode",
  12326. uri: "http://sharejs.org/types/text-unicode",
  12327. trim: h,
  12328. normalize: o,
  12329. checkOp: n,
  12330. /** Create a new text snapshot.
  12331. *
  12332. * @param {string} initial - initial snapshot data. Optional. Defaults to ''.
  12333. * @returns {Snap} Initial document snapshot object
  12334. */
  12335. create(A = "") {
  12336. if (typeof A != "string")
  12337. throw Error("Initial data must be a string");
  12338. return T.create(A);
  12339. },
  12340. /** Apply an operation to a document snapshot
  12341. */
  12342. apply(A, H) {
  12343. n(H);
  12344. const Z = T.builder(A);
  12345. for (let fe = 0; fe < H.length; fe++) {
  12346. const ae = H[fe];
  12347. switch (typeof ae) {
  12348. case "number":
  12349. Z.skip(ae);
  12350. break;
  12351. case "string":
  12352. Z.append(ae);
  12353. break;
  12354. case "object":
  12355. Z.del(t.dlen(ae.d));
  12356. break;
  12357. }
  12358. }
  12359. return Z.build();
  12360. },
  12361. transform: d,
  12362. compose: f,
  12363. transformPosition: E,
  12364. transformSelection: R,
  12365. isInvertible: X,
  12366. makeInvertible(A, H) {
  12367. return O(A, H, T);
  12368. },
  12369. stripInvertible: ne,
  12370. invert: U,
  12371. invertWithDoc(A, H) {
  12372. return U(O(A, H, T));
  12373. },
  12374. isNoop: (A) => A.length === 0
  12375. };
  12376. }
  12377. t.default = de;
  12378. }(Ms)), Ms;
  12379. }
  12380. var wr = {};
  12381. var ia;
  12382. function Rm() {
  12383. if (ia)
  12384. return wr;
  12385. ia = 1, Object.defineProperty(wr, "__esModule", { value: true });
  12386. const t = Zs(), e = Pi();
  12387. function n(r, s) {
  12388. return {
  12389. // Returns the text content of the document
  12390. get: r,
  12391. // Returns the number of characters in the string
  12392. getLength() {
  12393. return r().length;
  12394. },
  12395. // Insert the specified text at the given position in the document
  12396. insert(i, o, a) {
  12397. const u = e.strPosToUni(r(), i);
  12398. return s([u, o], a);
  12399. },
  12400. remove(i, o, a) {
  12401. const u = e.strPosToUni(r(), i);
  12402. return s([u, { d: o }], a);
  12403. },
  12404. // When you use this API, you should implement these two methods
  12405. // in your editing context.
  12406. //onInsert: function(pos, text) {},
  12407. //onRemove: function(pos, removedLength) {},
  12408. _onOp(i) {
  12409. t.eachOp(i, (o, a, u) => {
  12410. switch (typeof o) {
  12411. case "string":
  12412. this.onInsert && this.onInsert(u, o);
  12413. break;
  12414. case "object":
  12415. const c = t.dlen(o.d);
  12416. this.onRemove && this.onRemove(u, c);
  12417. }
  12418. });
  12419. },
  12420. onInsert: null,
  12421. onRemove: null
  12422. };
  12423. }
  12424. return wr.default = n, n.provides = { text: true }, wr;
  12425. }
  12426. var oa;
  12427. function Im() {
  12428. return oa || (oa = 1, function(t) {
  12429. var e = an.__createBinding || (Object.create ? function(d, f, E, R) {
  12430. R === void 0 && (R = E), Object.defineProperty(d, R, { enumerable: true, get: function() {
  12431. return f[E];
  12432. } });
  12433. } : function(d, f, E, R) {
  12434. R === void 0 && (R = E), d[R] = f[E];
  12435. }), n = an.__setModuleDefault || (Object.create ? function(d, f) {
  12436. Object.defineProperty(d, "default", { enumerable: true, value: f });
  12437. } : function(d, f) {
  12438. d.default = f;
  12439. }), r = an.__importStar || function(d) {
  12440. if (d && d.__esModule)
  12441. return d;
  12442. var f = {};
  12443. if (d != null)
  12444. for (var E in d)
  12445. Object.hasOwnProperty.call(d, E) && e(f, d, E);
  12446. return n(f, d), f;
  12447. }, s = an.__importDefault || function(d) {
  12448. return d && d.__esModule ? d : { default: d };
  12449. };
  12450. Object.defineProperty(t, "__esModule", { value: true }), t.type = t.remove = t.insert = void 0;
  12451. const i = Pi(), o = r(Zs()), a = s(Rm()), u = {
  12452. create(d) {
  12453. return d;
  12454. },
  12455. toString(d) {
  12456. return d;
  12457. },
  12458. builder(d) {
  12459. if (typeof d != "string")
  12460. throw Error("Invalid document snapshot: " + d);
  12461. const f = [];
  12462. return {
  12463. skip(E) {
  12464. let R = i.uniToStrPos(d, E);
  12465. if (R > d.length)
  12466. throw Error("The op is too long for this document");
  12467. f.push(d.slice(0, R)), d = d.slice(R);
  12468. },
  12469. append(E) {
  12470. f.push(E);
  12471. },
  12472. del(E) {
  12473. d = d.slice(i.uniToStrPos(d, E));
  12474. },
  12475. build() {
  12476. return f.join("") + d;
  12477. }
  12478. };
  12479. },
  12480. slice: o.uniSlice
  12481. }, c = o.default(u), l = Object.assign(Object.assign({}, c), { api: a.default });
  12482. t.type = l, t.insert = (d, f) => f.length === 0 ? [] : d === 0 ? [f] : [d, f], t.remove = (d, f) => o.dlen(f) === 0 ? [] : d === 0 ? [{ d: f }] : [d, { d: f }];
  12483. var h = Zs();
  12484. Object.defineProperty(t, "makeType", { enumerable: true, get: function() {
  12485. return h.default;
  12486. } });
  12487. }(an)), an;
  12488. }
  12489. var aa;
  12490. function vm() {
  12491. return aa || (aa = 1, function(t) {
  12492. var e = Ir.__importDefault || function(v) {
  12493. return v && v.__esModule ? v : {
  12494. default: v
  12495. };
  12496. };
  12497. Object.defineProperty(t, "__esModule", {
  12498. value: true
  12499. }), t.editOp = t.replaceOp = t.insertOp = t.moveOp = t.removeOp = t.type = void 0;
  12500. const n = e(Em()), r = e(Cm()), s = $u(), i = Bu();
  12501. function o(v, F) {
  12502. if (!v)
  12503. throw new Error(F);
  12504. }
  12505. t.type = {
  12506. name: "json1",
  12507. uri: "http://sharejs.org/types/JSONv1",
  12508. readCursor: s.readCursor,
  12509. writeCursor: s.writeCursor,
  12510. create: (v) => v,
  12511. isNoop: (v) => v == null,
  12512. setDebug(v) {
  12513. },
  12514. registerSubtype: U,
  12515. checkValidOp: fe,
  12516. normalize: ae,
  12517. apply: m,
  12518. transformPosition: j,
  12519. compose: y,
  12520. tryTransform: Y,
  12521. transform: he,
  12522. makeInvertible: w,
  12523. invert: M,
  12524. invertWithDoc: k,
  12525. RM_UNEXPECTED_CONTENT: i.ConflictType.RM_UNEXPECTED_CONTENT,
  12526. DROP_COLLISION: i.ConflictType.DROP_COLLISION,
  12527. BLACKHOLE: i.ConflictType.BLACKHOLE,
  12528. transformNoConflict: (v, F, V) => be(() => true, v, F, V),
  12529. typeAllowingConflictsPred: (v) => Object.assign(Object.assign({}, t.type), {
  12530. transform: (F, V, K) => be(v, F, V, K)
  12531. })
  12532. };
  12533. const a = (v) => v ? v.getComponent() : null;
  12534. function u(v) {
  12535. return v && typeof v == "object" && !Array.isArray(v);
  12536. }
  12537. const c = (v) => Array.isArray(v) ? v.slice() : v !== null && typeof v == "object" ? Object.assign({}, v) : v, l = (v) => v && (v.p != null || v.r !== void 0), h = (v) => v && (v.d != null || v.i !== void 0);
  12538. function d(v, F) {
  12539. return o(v != null), typeof F == "number" ? (o(Array.isArray(v), "Invalid key - child is not an array"), (v = v.slice()).splice(F, 1)) : (o(u(v), "Invalid key - child is not an object"), delete (v = Object.assign({}, v))[F]), v;
  12540. }
  12541. function f(v, F, V) {
  12542. return typeof F == "number" ? (o(v != null, "Container is missing for key"), o(Array.isArray(v), "Cannot use numerical key for object container"), o(v.length >= F, "Cannot insert into out of bounds index"), v.splice(F, 0, V)) : (o(u(v), "Cannot insert into missing item"), o(v[F] === void 0, "Trying to overwrite value at key. Your op needs to remove it first"), v[F] = V), V;
  12543. }
  12544. t.removeOp = (v, F = true) => s.writeCursor().writeAtPath(v, "r", F).get(), t.moveOp = (v, F) => s.writeCursor().writeMove(v, F).get(), t.insertOp = (v, F) => s.writeCursor().writeAtPath(v, "i", F).get(), t.replaceOp = (v, F, V) => s.writeCursor().at(v, (K) => {
  12545. K.write("r", F), K.write("i", V);
  12546. }).get(), t.editOp = (v, F, V, K = false) => s.writeCursor().at(v, (z) => A(z, F, V, K)).get();
  12547. const E = (v, F) => v != null && (typeof F == "number" ? Array.isArray(v) : typeof v == "object"), R = (v, F) => E(v, F) ? v[F] : void 0, O = {};
  12548. function U(v) {
  12549. let F = v.type ? v.type : v;
  12550. F.name && (O[F.name] = F), F.uri && (O[F.uri] = F);
  12551. }
  12552. const ne = (v) => {
  12553. const F = O[v];
  12554. if (F)
  12555. return F;
  12556. throw Error("Missing type: " + v);
  12557. };
  12558. U(Im());
  12559. const X = (v, F) => v + F;
  12560. U({
  12561. name: "number",
  12562. apply: X,
  12563. compose: X,
  12564. invert: (v) => -v,
  12565. transform: (v) => v
  12566. });
  12567. const de = (v) => v == null ? null : v.et ? ne(v.et) : v.es ? O["text-unicode"] : v.ena != null ? O.number : null, T = (v) => v.es ? v.es : v.ena != null ? v.ena : v.e, A = (v, F, V, K = false) => {
  12568. const [z, W] = typeof F == "string" ? [ne(F), F] : [F, F.name];
  12569. !K && z.isNoop && z.isNoop(V) || (W === "number" ? v.write("ena", V) : W === "text-unicode" ? v.write("es", V) : (v.write("et", W), v.write("e", V)));
  12570. };
  12571. function H(v) {
  12572. o(typeof v == "number"), o(v >= 0), o(v === (0 | v));
  12573. }
  12574. function Z(v) {
  12575. typeof v == "number" ? H(v) : o(typeof v == "string");
  12576. }
  12577. function fe(v) {
  12578. if (v === null)
  12579. return;
  12580. const F = /* @__PURE__ */ new Set(), V = /* @__PURE__ */ new Set(), K = (W) => {
  12581. let ue = true, oe = false;
  12582. for (let B in W) {
  12583. const ee = W[B];
  12584. if (ue = false, o(B === "p" || B === "r" || B === "d" || B === "i" || B === "e" || B === "es" || B === "ena" || B === "et", "Invalid component item '" + B + "'"), B === "p")
  12585. H(ee), o(!F.has(ee)), F.add(ee), o(W.r === void 0);
  12586. else if (B === "d")
  12587. H(ee), o(!V.has(ee)), V.add(ee), o(W.i === void 0);
  12588. else if (B === "e" || B === "es" || B === "ena") {
  12589. o(!oe), oe = true;
  12590. const ie = de(W);
  12591. o(ie, "Missing type in edit"), ie.checkValidOp && ie.checkValidOp(T(W));
  12592. }
  12593. }
  12594. o(!ue);
  12595. }, z = (W, ue, oe) => {
  12596. if (!Array.isArray(W))
  12597. throw Error("Op must be null or a list");
  12598. if (W.length === 0)
  12599. throw Error("Empty descent");
  12600. ue || Z(W[0]);
  12601. let B = 1, ee = 0, ie = 0;
  12602. for (let pe = 0; pe < W.length; pe++) {
  12603. const Oe = W[pe];
  12604. if (o(Oe != null), Array.isArray(Oe)) {
  12605. const Me = z(Oe, false);
  12606. if (ee) {
  12607. const G = typeof ie, Re = typeof Me;
  12608. G === Re ? o(ie < Me, "descent keys are not in order") : o(G === "number" && Re === "string");
  12609. }
  12610. ie = Me, ee++, B = 3;
  12611. } else
  12612. typeof Oe == "object" ? (o(B === 1, `Prev not scalar - instead ${B}`), K(Oe), B = 2) : (o(B !== 3), Z(Oe), o(s.isValidPathItem(Oe), "Invalid path key"), B = 1);
  12613. }
  12614. return o(ee !== 1, "Operation makes multiple descents. Remove some []"), o(B === 2 || B === 3), W[0];
  12615. };
  12616. z(v, true), o(F.size === V.size, "Mismatched picks and drops in op");
  12617. for (let W = 0; W < F.size; W++)
  12618. o(F.has(W)), o(V.has(W));
  12619. }
  12620. function ae(v) {
  12621. let F = 0, V = [];
  12622. const K = s.writeCursor();
  12623. return K.mergeTree(v, (z, W) => {
  12624. const ue = de(z);
  12625. if (ue) {
  12626. const B = T(z);
  12627. A(W, ue, ue.normalize ? ue.normalize(B) : B);
  12628. }
  12629. for (const B of ["r", "p", "i", "d"])
  12630. if (z[B] !== void 0) {
  12631. const ee = B === "p" || B === "d" ? (oe = z[B], V[oe] == null && (V[oe] = F++), V[oe]) : z[B];
  12632. W.write(B, ee);
  12633. }
  12634. var oe;
  12635. }), K.get();
  12636. }
  12637. function m(v, F) {
  12638. if (fe(F), F === null)
  12639. return v;
  12640. const V = [];
  12641. return function K(z, W) {
  12642. let ue = z, oe = 0, B = {
  12643. root: z
  12644. }, ee = 0, ie = B, pe = "root";
  12645. function Oe() {
  12646. for (; ee < oe; ee++) {
  12647. let Me = W[ee];
  12648. typeof Me != "object" && (o(E(ie, pe)), ie = ie[pe] = c(ie[pe]), pe = Me);
  12649. }
  12650. }
  12651. for (; oe < W.length; oe++) {
  12652. const Me = W[oe];
  12653. if (Array.isArray(Me)) {
  12654. const G = K(ue, Me);
  12655. G !== ue && G !== void 0 && (Oe(), ue = ie[pe] = G);
  12656. } else if (typeof Me == "object") {
  12657. Me.d != null ? (Oe(), ue = f(ie, pe, V[Me.d])) : Me.i !== void 0 && (Oe(), ue = f(ie, pe, Me.i));
  12658. const G = de(Me);
  12659. if (G)
  12660. Oe(), ue = ie[pe] = G.apply(ue, T(Me));
  12661. else if (Me.e !== void 0)
  12662. throw Error("Subtype " + Me.et + " undefined");
  12663. } else
  12664. ue = R(ue, Me);
  12665. }
  12666. return B.root;
  12667. }(v = function K(z, W) {
  12668. const ue = [];
  12669. let oe = 0;
  12670. for (; oe < W.length; oe++) {
  12671. const pe = W[oe];
  12672. if (Array.isArray(pe))
  12673. break;
  12674. typeof pe != "object" && (ue.push(z), z = R(z, pe));
  12675. }
  12676. for (let pe = W.length - 1; pe >= oe; pe--)
  12677. z = K(z, W[pe]);
  12678. for (--oe; oe >= 0; oe--) {
  12679. const pe = W[oe];
  12680. if (typeof pe != "object") {
  12681. const Oe = ue.pop();
  12682. z = z === R(Oe, pe) ? Oe : z === void 0 ? d(Oe, pe) : (ee = pe, ie = z, (B = c(B = Oe))[ee] = ie, B);
  12683. } else
  12684. l(pe) && (o(z !== void 0, "Cannot pick up or remove undefined"), pe.p != null && (V[pe.p] = z), z = void 0);
  12685. }
  12686. var B, ee, ie;
  12687. return z;
  12688. }(v, F), F);
  12689. }
  12690. function j(v, F) {
  12691. v = v.slice(), fe(F);
  12692. const V = s.readCursor(F);
  12693. let K, z, W = false;
  12694. const ue = [];
  12695. for (let B = 0; ; B++) {
  12696. const ee = v[B], ie = V.getComponent();
  12697. if (ie && (ie.r !== void 0 ? W = true : ie.p != null && (W = false, K = ie.p, z = B)), B >= v.length)
  12698. break;
  12699. let pe = 0;
  12700. const Oe = s.advancer(V, void 0, (G, Re) => {
  12701. l(Re) && pe++;
  12702. });
  12703. ue.unshift(Oe);
  12704. const Me = Oe(ee);
  12705. if (typeof ee == "number" && (v[B] -= pe), !Me)
  12706. break;
  12707. }
  12708. if (ue.forEach((B) => B.end()), W)
  12709. return null;
  12710. const oe = () => {
  12711. let B = 0;
  12712. if (K != null) {
  12713. const ee = V.getPath();
  12714. B = ee.length, v = ee.concat(v.slice(z));
  12715. }
  12716. for (; B < v.length; B++) {
  12717. const ee = v[B], ie = a(V), pe = de(ie);
  12718. if (pe) {
  12719. const G = T(ie);
  12720. pe.transformPosition && (v[B] = pe.transformPosition(v[B], G));
  12721. break;
  12722. }
  12723. let Oe = 0;
  12724. const Me = s.advancer(V, (G, Re) => h(Re) ? ~(G - Oe) : G - Oe, (G, Re) => {
  12725. h(Re) && Oe++;
  12726. })(ee);
  12727. if (typeof ee == "number" && (v[B] += Oe), !Me)
  12728. break;
  12729. }
  12730. };
  12731. return K != null ? V.eachDrop(null, (B) => {
  12732. B === K && oe();
  12733. }) : oe(), v;
  12734. }
  12735. function y(v, F) {
  12736. if (fe(v), fe(F), v == null)
  12737. return F;
  12738. if (F == null)
  12739. return v;
  12740. let V = 0;
  12741. const K = s.readCursor(v), z = s.readCursor(F), W = s.writeCursor(), ue = [], oe = [], B = [], ee = [], ie = [], pe = [], Oe = /* @__PURE__ */ new Set();
  12742. K.traverse(null, (G) => {
  12743. G.p != null && (B[G.p] = K.clone());
  12744. }), z.traverse(null, (G) => {
  12745. G.d != null && (ee[G.d] = z.clone());
  12746. });
  12747. const Me = s.writeCursor();
  12748. return function G(Re, He, Be, xe, Je, Rt, We, et) {
  12749. o(He || Be);
  12750. const ze = a(He), ct = a(Be), it = !!ct && ct.r !== void 0, xt = !!ze && ze.i !== void 0, ke = ze ? ze.d : null, ht = ct ? ct.p : null, _ = (Rt || it) && ht == null;
  12751. if (ht != null)
  12752. xe = ee[ht], We = oe[ht] = new s.WriteCursor();
  12753. else if (ct && ct.r !== void 0)
  12754. xe = null;
  12755. else {
  12756. const D = a(xe);
  12757. D && D.d != null && (xe = null);
  12758. }
  12759. const g = a(xe);
  12760. if (ke != null)
  12761. if (Re = B[ke], et = ue[ke] = new s.WriteCursor(), _)
  12762. Rt && !it && et.write("r", true);
  12763. else {
  12764. const D = ie[ke] = V++;
  12765. We.write("d", D);
  12766. }
  12767. else if (ze && ze.i !== void 0)
  12768. Re = null;
  12769. else {
  12770. const D = a(Re);
  12771. D && D.p != null && (Re = null);
  12772. }
  12773. let p;
  12774. xt ? (o(Je === void 0), p = ze.i) : p = Je;
  12775. const S = (ht == null ? !xt || Rt || it : p === void 0) ? null : We.getComponent();
  12776. if (ht != null) {
  12777. if (!(Je !== void 0 || xt)) {
  12778. const D = ke != null ? ie[ke] : V++;
  12779. pe[ht] = D, et.write("p", D);
  12780. }
  12781. } else
  12782. it && (xt || Je !== void 0 || (ct.r, et.write("r", ct.r)));
  12783. const N = _ ? null : de(ze), L = de(g);
  12784. if ((N || L) && (N && N.name, L && L.name), N && L) {
  12785. o(N === L);
  12786. const D = T(ze), q = T(g), Ce = N.compose(D, q);
  12787. A(We, N, Ce), Oe.add(g);
  12788. } else
  12789. N ? A(We, N, T(ze)) : L && (A(We, L, T(g)), Oe.add(g));
  12790. const x = typeof p == "object" && p != null;
  12791. let P = false, I = 0, Q = 0, _e = 0, J = 0, me = 0;
  12792. const ye = s.advancer(xe, (D, q) => h(q) ? J - D - 1 : D - J, (D, q) => {
  12793. h(q) && J++;
  12794. }), le = s.advancer(Re, (D, q) => l(q) ? I - D - 1 : D - I, (D, q) => {
  12795. l(q) && I++;
  12796. });
  12797. if (s.eachChildOf(He, Be, (D, q, Ce) => {
  12798. let Se, Le, Ue = D, je = D, dt = D;
  12799. if (typeof D == "number") {
  12800. let Ne = D + _e;
  12801. Le = ye(Ne), je = Ne + J;
  12802. let te = D + Q;
  12803. Se = le(te), h(a(Le)) && (Se = null), Ue = te + I, dt = D + me, o(Ue >= 0, "p1PickKey is negative"), o(je >= 0, "p2DropKey is negative");
  12804. const ut = h(a(q)), $e = l(a(Ce));
  12805. (ut || $e && !_) && me--, ut && Q--, $e && _e--;
  12806. } else
  12807. Se = le(D), Le = ye(D);
  12808. et.descend(Ue), We.descend(je);
  12809. const pt = x && !h(a(q)) ? p[dt] : void 0, Ee = G(Se, q, Ce, Le, pt, _, We, et);
  12810. var qe, ve, Ie;
  12811. x && !_ ? pt !== Ee && (P || (p = Array.isArray(p) ? p.slice() : Object.assign({}, p), P = true), qe = p, Ie = Ee, typeof (ve = dt) == "number" ? (o(Array.isArray(qe)), o(ve < qe.length)) : (o(!Array.isArray(qe)), o(qe[ve] !== void 0)), Ie === void 0 ? typeof ve == "number" ? qe.splice(ve, 1) : delete qe[ve] : qe[ve] = Ie) : o(Ee === void 0), We.ascend(), et.ascend();
  12812. }), le.end(), ye.end(), S != null)
  12813. S.i = p;
  12814. else if (!Rt && !it && ht == null)
  12815. return p;
  12816. }(K, K.clone(), z, z.clone(), void 0, false, W, Me), W.reset(), W.mergeTree(Me.get()), W.reset(), W.get(), ue.map((G) => G.get()), oe.map((G) => G.get()), K.traverse(W, (G, Re) => {
  12817. const He = G.p;
  12818. if (He != null) {
  12819. const Be = ie[He];
  12820. Be != null && Re.write("p", Be);
  12821. const xe = ue[He];
  12822. xe && xe.get(), xe && Re.mergeTree(xe.get());
  12823. } else
  12824. G.r !== void 0 && Re.write("r", G.r);
  12825. }), W.reset(), W.get(), z.traverse(W, (G, Re) => {
  12826. const He = G.d;
  12827. if (He != null) {
  12828. const xe = pe[He];
  12829. xe != null && Re.write("d", xe);
  12830. const Je = oe[He];
  12831. Je && Re.mergeTree(Je.get());
  12832. } else
  12833. G.i !== void 0 && Re.write("i", G.i);
  12834. const Be = de(G);
  12835. Be && !Oe.has(G) && A(Re, Be, T(G));
  12836. }), W.get();
  12837. }
  12838. function M(v) {
  12839. if (v == null)
  12840. return null;
  12841. const F = new s.ReadCursor(v), V = new s.WriteCursor();
  12842. let K;
  12843. const z = [], W = [];
  12844. return function ue(oe, B, ee) {
  12845. const ie = oe.getComponent();
  12846. let pe, Oe = false;
  12847. if (ie) {
  12848. ie.p != null && (B.write("d", ie.p), z[ie.p] = oe.clone()), ie.r !== void 0 && B.write("i", ie.r), ie.d != null && (B.write("p", ie.d), ee = void 0), ie.i !== void 0 && (ee = pe = ie.i);
  12849. const G = de(ie);
  12850. G && (ee === void 0 ? (K || (K = /* @__PURE__ */ new Set()), K.add(ie)) : (T(ie), ee = G.apply(ee, T(ie)), Oe = true));
  12851. }
  12852. let Me = 0;
  12853. for (const G of oe) {
  12854. B.descend(G);
  12855. const Re = typeof G == "number" ? G - Me : G, He = R(ee, Re);
  12856. h(oe.getComponent()) && Me++;
  12857. const Be = ue(oe, B, He);
  12858. if (ee !== void 0 && Be !== void 0) {
  12859. if (Oe || (Oe = true, ee = c(ee)), !E(ee, Re))
  12860. throw Error("Cannot modify child - invalid operation");
  12861. ee[Re] = Be;
  12862. }
  12863. B.ascend();
  12864. }
  12865. if (pe === void 0)
  12866. return Oe ? ee : void 0;
  12867. B.write("r", ee);
  12868. }(F, V, void 0), K && (V.reset(), function ue(oe, B, ee) {
  12869. const ie = B.getComponent();
  12870. if (ie) {
  12871. const G = ie.d;
  12872. if (G != null && (oe = z[G], ee = W[G] = s.writeCursor()), K.has(ie)) {
  12873. const Re = de(ie);
  12874. if (!Re.invert)
  12875. throw Error(`Cannot invert subtype ${Re.name}`);
  12876. A(ee, Re, Re.invert(T(ie)));
  12877. }
  12878. }
  12879. let pe = 0, Oe = 0;
  12880. const Me = s.advancer(oe, (G, Re) => l(Re) ? pe - G - 1 : G - pe, (G, Re) => {
  12881. l(Re) && pe++;
  12882. });
  12883. for (const G of B)
  12884. if (typeof G == "number") {
  12885. const Re = G - Oe, He = Me(Re), Be = Re + pe;
  12886. ee.descend(Be), ue(He, B, ee), h(B.getComponent()) && Oe++, ee.ascend();
  12887. } else
  12888. ee.descend(G), ue(Me(G), B, ee), ee.ascend();
  12889. Me.end();
  12890. }(F.clone(), F, V), W.length && (V.reset(), F.traverse(V, (ue, oe) => {
  12891. const B = ue.p;
  12892. if (B != null) {
  12893. const ee = W[B];
  12894. ee && ee.get(), ee && oe.mergeTree(ee.get());
  12895. }
  12896. }))), V.get();
  12897. }
  12898. const b = (v, F) => v.some((V) => typeof V == "object" && (Array.isArray(V) ? b(V, F) : F(V)));
  12899. function w(v, F) {
  12900. if (v == null || !b(v, (B) => {
  12901. var ee;
  12902. return B.r !== void 0 || ((ee = de(B)) === null || ee === void 0 ? void 0 : ee.makeInvertible) != null;
  12903. }))
  12904. return v;
  12905. const V = new s.ReadCursor(v), K = new s.WriteCursor();
  12906. let z = false;
  12907. const W = [], ue = [], oe = (B, ee, ie) => {
  12908. const pe = B.getComponent();
  12909. let Oe = false;
  12910. if (pe) {
  12911. pe.d != null && ee.write("d", pe.d), pe.i !== void 0 && ee.write("i", pe.i);
  12912. const G = pe.p;
  12913. if (G != null && (W[G] = B.clone(), o(ie !== void 0, "Operation picks up at an invalid key"), ue[G] = ie, ee.write("p", pe.p)), pe.r !== void 0 && ie === void 0)
  12914. throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");
  12915. const Re = de(pe);
  12916. Re && (Re.makeInvertible ? z = true : A(ee, Re, T(pe), true));
  12917. }
  12918. let Me = 0;
  12919. for (const G of B) {
  12920. ee.descend(G);
  12921. const Re = typeof G == "number" ? G - Me : G, He = R(ie, Re), Be = oe(B, ee, He);
  12922. He !== Be && (Oe || (Oe = true, ie = c(ie)), Be === void 0 ? (ie = d(ie, Re), typeof G == "number" && Me++) : ie[Re] = Be), ee.ascend();
  12923. }
  12924. return pe && (pe.r !== void 0 ? (ee.write("r", r.default(ie)), ie = void 0) : pe.p != null && (ie = void 0)), ie;
  12925. };
  12926. return oe(V, K, F), K.get(), z && (K.reset(), function B(ee, ie, pe, Oe, Me) {
  12927. const G = ie.getComponent();
  12928. if (G) {
  12929. G.i !== void 0 ? (Oe = G.i, Me = true) : G.d != null && (Oe = ue[G.d], ee = W[G.d], Me = false, G.d);
  12930. let xe = de(G);
  12931. if (xe && xe.makeInvertible) {
  12932. const Je = T(G);
  12933. A(pe, xe, xe.makeInvertible(Je, Oe), true);
  12934. }
  12935. }
  12936. let Re = 0, He = 0;
  12937. const Be = s.advancer(ee, (xe, Je) => l(Je) ? Re - xe - 1 : xe - Re, (xe, Je) => {
  12938. l(Je) && Re++;
  12939. });
  12940. for (const xe of ie)
  12941. if (typeof xe == "number") {
  12942. const Je = xe - He, Rt = Be(Je), We = Je + Re, et = R(Oe, Me ? Je : We);
  12943. pe.descend(xe), B(Rt, ie, pe, et, Me), h(ie.getComponent()) && He++, pe.ascend();
  12944. } else {
  12945. const Je = R(Oe, xe);
  12946. pe.descend(xe), B(Be(xe), ie, pe, Je, Me), pe.ascend();
  12947. }
  12948. Be.end();
  12949. }(V.clone(), V, K, F, false)), K.get();
  12950. }
  12951. function k(v, F) {
  12952. return M(w(v, F));
  12953. }
  12954. const $ = (v) => {
  12955. if (v == null)
  12956. return null;
  12957. const F = v.slice();
  12958. for (let V = 0; V < v.length; V++) {
  12959. const K = F[V];
  12960. Array.isArray(K) && (F[V] = $(K));
  12961. }
  12962. return F;
  12963. };
  12964. function Y(v, F, V) {
  12965. o(V === "left" || V === "right", "Direction must be left or right");
  12966. const K = V === "left" ? 0 : 1;
  12967. if (F == null)
  12968. return {
  12969. ok: true,
  12970. result: v
  12971. };
  12972. fe(v), fe(F);
  12973. let z = null;
  12974. const W = [], ue = [], oe = [], B = [], ee = [], ie = [], pe = [], Oe = [], Me = [], G = [], Re = [], He = [], Be = [], xe = [], Je = [];
  12975. let Rt = 0;
  12976. const We = s.readCursor(v), et = s.readCursor(F), ze = s.writeCursor();
  12977. if (function g(p, S = null, N) {
  12978. const L = a(S);
  12979. L && (L.r !== void 0 ? N = S.clone() : L.p != null && (N = null, ie[L.p] = p.clone()));
  12980. const x = p.getComponent();
  12981. let P;
  12982. x && (P = x.p) != null && (ee[P] = S ? S.clone() : null, oe[P] = p.clone(), N && (G[P] = true, Me[P] = N), L && L.p != null && (xe[P] = L.p));
  12983. const I = s.advancer(S);
  12984. for (const Q of p)
  12985. g(p, I(Q), N);
  12986. I.end();
  12987. }(et, We, null), function g(p, S, N, L, x) {
  12988. const P = N.getComponent();
  12989. let I, Q = false;
  12990. P && ((I = P.d) != null ? (B[I] = N.clone(), L != null && (Je[L] == null && (Je[L] = []), Je[L].push(I)), G[I], p = ee[I] || null, S = oe[I] || null, G[I] ? (x && (Re[I] = true), x = Me[I] || null) : !x || K !== 1 && xe[I] != null || z == null && (z = {
  12991. type: i.ConflictType.RM_UNEXPECTED_CONTENT,
  12992. op1: t.removeOp(x.getPath()),
  12993. op2: t.moveOp(S.getPath(), N.getPath())
  12994. }), Q = true) : P.i !== void 0 && (p = S = null, Q = true, x && z == null && (z = {
  12995. type: i.ConflictType.RM_UNEXPECTED_CONTENT,
  12996. op1: t.removeOp(x.getPath()),
  12997. op2: t.insertOp(N.getPath(), P.i)
  12998. })));
  12999. const _e = a(p);
  13000. _e && (_e.r !== void 0 ? x = p.clone() : _e.p != null && (_e.p, L = _e.p, x = null));
  13001. const J = de(P);
  13002. J && x && z == null && (z = {
  13003. type: i.ConflictType.RM_UNEXPECTED_CONTENT,
  13004. op1: t.removeOp(x.getPath()),
  13005. op2: t.editOp(N.getPath(), J, T(P), true)
  13006. });
  13007. let me = 0, ye = 0;
  13008. const le = s.advancer(S, (q, Ce) => l(Ce) ? me - q - 1 : q - me, (q, Ce) => {
  13009. l(Ce) && me++;
  13010. }), D = s.advancer(p);
  13011. for (const q of N)
  13012. if (typeof q == "number") {
  13013. const Ce = q - ye, Se = le(Ce);
  13014. ye += +g(D(Ce + me), Se, N, L, x);
  13015. } else {
  13016. const Ce = le(q);
  13017. g(D(q), Ce, N, L, x);
  13018. }
  13019. return le.end(), D.end(), Q;
  13020. }(We, et, et.clone(), null, null), B.map((g) => g && g.get()), z)
  13021. return {
  13022. ok: false,
  13023. conflict: z
  13024. };
  13025. Re.map((g) => !!g);
  13026. const ct = [];
  13027. let it = null;
  13028. (function g(p, S, N, L, x) {
  13029. let P = false;
  13030. const I = a(S);
  13031. if (l(I)) {
  13032. const le = I.p;
  13033. le != null ? (N = B[le], L = He[le] = s.writeCursor(), P = true, x = null) : (N = null, x = S.clone());
  13034. } else
  13035. h(a(N)) && (N = null);
  13036. const Q = p.getComponent();
  13037. if (Q) {
  13038. const le = Q.p;
  13039. le != null ? (x && (Oe[le] = x), ct[le] = x || K === 1 && P ? null : L.getComponent(), W[le] = p.clone(), N && (pe[le] = N.clone())) : Q.r !== void 0 && (x || L.write("r", true), (x || P) && (it == null && (it = /* @__PURE__ */ new Set()), it.add(Q)));
  13040. }
  13041. let _e = 0, J = 0;
  13042. const me = s.advancer(S, void 0, (le, D) => {
  13043. l(D) && _e++;
  13044. }), ye = s.advancer(N, (le, D) => h(D) ? ~(le - J) : le - J, (le, D) => {
  13045. h(D) && J++;
  13046. });
  13047. if (p)
  13048. for (const le of p)
  13049. if (typeof le == "string") {
  13050. const D = me(le), q = ye(le);
  13051. L.descend(le), g(p, D, q, L, x), L.ascend();
  13052. } else {
  13053. const D = me(le), q = le - _e, Ce = l(a(D)) ? null : ye(q), Se = q + J;
  13054. o(Se >= 0), L.descend(Se), g(p, D, Ce, L, x), L.ascend();
  13055. }
  13056. me.end(), ye.end();
  13057. })(We, et, et.clone(), ze, null), ze.reset();
  13058. let xt = [];
  13059. if (function g(p, S, N, L, x, P) {
  13060. o(S);
  13061. const I = S.getComponent();
  13062. let Q = a(L), _e = false;
  13063. const J = (ve, Ie, Ne) => ve ? t.moveOp(ve.getPath(), Ie.getPath()) : t.insertOp(Ie.getPath(), Ne.i);
  13064. if (h(I)) {
  13065. const ve = I.d;
  13066. ve != null && (ue[ve] = S.clone());
  13067. const Ie = ve != null ? ct[ve] : null;
  13068. let Ne = false;
  13069. if (I.i !== void 0 || ve != null && Ie) {
  13070. let te;
  13071. Q && (Q.i !== void 0 || (te = Q.d) != null && !G[te]) && (Ne = te != null ? ve != null && ve === xe[te] : n.default(Q.i, I.i), Ne || te != null && K !== 1 && xe[te] != null || z == null && (z = {
  13072. type: i.ConflictType.DROP_COLLISION,
  13073. op1: J(ve != null ? W[ve] : null, S, I),
  13074. op2: J(te != null ? oe[te] : null, L, Q)
  13075. })), Ne || (P ? z == null && (z = {
  13076. type: i.ConflictType.RM_UNEXPECTED_CONTENT,
  13077. op1: J(ve != null ? W[ve] : null, S, I),
  13078. op2: t.removeOp(P.getPath())
  13079. }) : (ve != null ? (xt[Rt] = ve, x.write("d", Ie.p = Rt++)) : x.write("i", r.default(I.i)), _e = true));
  13080. } else if (ve != null && !Ie) {
  13081. const te = Oe[ve];
  13082. te && (P = te.clone());
  13083. }
  13084. ve != null ? (p = W[ve], N = ie[ve], L = pe[ve]) : I.i !== void 0 && (p = N = null, Ne || (L = null));
  13085. } else
  13086. l(a(p)) && (p = N = L = null);
  13087. const me = a(p), ye = a(N);
  13088. if (l(ye)) {
  13089. const ve = ye.p;
  13090. ye.r !== void 0 && (!me || me.r === void 0) || G[ve] ? (L = null, P = N.clone()) : ve != null && (L = B[ve], K !== 1 && xe[ve] != null || ((x = Be[ve]) || (x = Be[ve] = s.writeCursor()), x.reset(), P = null));
  13091. } else
  13092. !h(I) && h(Q) && (L = null);
  13093. Q = L != null ? L.getComponent() : null;
  13094. const le = de(I);
  13095. if (le) {
  13096. const ve = T(I);
  13097. if (P)
  13098. z == null && (z = {
  13099. type: i.ConflictType.RM_UNEXPECTED_CONTENT,
  13100. op1: t.editOp(S.getPath(), le, ve, true),
  13101. op2: t.removeOp(P.getPath())
  13102. });
  13103. else {
  13104. const Ie = de(Q);
  13105. let Ne;
  13106. if (Ie) {
  13107. if (le !== Ie)
  13108. throw Error("Transforming incompatible types");
  13109. const te = T(Q);
  13110. Ne = le.transform(ve, te, V);
  13111. } else
  13112. Ne = r.default(ve);
  13113. A(x, le, Ne);
  13114. }
  13115. }
  13116. let D = 0, q = 0, Ce = 0, Se = 0, Le = 0, Ue = 0, je = p != null && p.descendFirst(), dt = je;
  13117. const pt = s.advancer(N, void 0, (ve, Ie) => {
  13118. l(Ie) && Ce++;
  13119. });
  13120. let Ee = L != null && L.descendFirst(), qe = Ee;
  13121. for (const ve of S)
  13122. if (typeof ve == "number") {
  13123. let Ie;
  13124. const Ne = h(S.getComponent()), te = ve - q;
  13125. {
  13126. let zt;
  13127. for (; je && typeof (zt = p.getKey()) == "number"; ) {
  13128. zt += D;
  13129. const bt = p.getComponent(), Cn = l(bt);
  13130. if (zt > te || zt === te && (!Cn || K === 0 && Ne))
  13131. break;
  13132. if (Cn) {
  13133. D--;
  13134. const sn = bt.p;
  13135. xe.includes(sn), bt.d, a(Be[bt.d]), l(a(Be[bt.d])), (bt.r === void 0 || it && it.has(bt)) && (sn == null || !ct[sn] || K !== 1 && xe.includes(sn)) || Le--;
  13136. }
  13137. je = p.nextSibling();
  13138. }
  13139. Ie = je && zt === te ? p : null;
  13140. }
  13141. const ut = te - D;
  13142. let $e = pt(ut);
  13143. const At = ut - Ce;
  13144. let dr = null;
  13145. {
  13146. let zt, bt;
  13147. for (; Ee && typeof (zt = L.getKey()) == "number"; ) {
  13148. bt = zt - Se;
  13149. const Cn = L.getComponent(), sn = h(Cn);
  13150. if (bt > At)
  13151. break;
  13152. if (bt === At) {
  13153. if (!sn) {
  13154. dr = L;
  13155. break;
  13156. }
  13157. {
  13158. if (K === 0 && Ne) {
  13159. dr = L;
  13160. break;
  13161. }
  13162. const Yt = $e && l($e.getComponent());
  13163. if (K === 0 && Yt)
  13164. break;
  13165. }
  13166. }
  13167. if (sn) {
  13168. const Yt = Cn.d;
  13169. G[Yt], xe[Yt], Cn.i === void 0 && (G[Yt] || xe[Yt] != null && K !== 1) ? (G[Yt] || xe[Yt] != null && K === 0) && (Se++, Ue--) : Se++;
  13170. }
  13171. Ee = L.nextSibling();
  13172. }
  13173. }
  13174. const Hi = At + Se + Le + Ue;
  13175. o(Hi >= 0, "trying to descend to a negative index"), x.descend(Hi), Ne && (Ie = $e = dr = null, q++), g(Ie, S, $e, dr, x, P) && Ue++, x.ascend();
  13176. } else {
  13177. let Ie;
  13178. for (; je && (Ie = p.getKey(), typeof Ie != "string" || !(Ie > ve || Ie === ve)); )
  13179. je = p.nextSibling();
  13180. const Ne = je && Ie === ve ? p : null, te = pt(ve);
  13181. let ut;
  13182. for (; Ee && (ut = L.getKey(), typeof ut != "string" || !(ut > ve || ut === ve)); )
  13183. Ee = L.nextSibling();
  13184. const $e = Ee && ut === ve ? L : null;
  13185. x.descend(ve), g(Ne, S, te, $e, x, P), x.ascend();
  13186. }
  13187. return pt.end(), dt && p.ascend(), qe && L.ascend(), _e;
  13188. }(We, We.clone(), et, et.clone(), ze, null), z)
  13189. return {
  13190. ok: false,
  13191. conflict: z
  13192. };
  13193. ze.reset();
  13194. const ke = (g, p, S) => g.traverse(p, (N, L) => {
  13195. N.d != null && S(N.d, g, L);
  13196. });
  13197. (G.length || He.length) && (ke(et, ze, (g, p, S) => {
  13198. G[g] && !Re[g] && S.write("r", true), He[g] && S.mergeTree(He[g].get());
  13199. }), ze.reset());
  13200. const ht = [], _ = [];
  13201. if ((Be.length || G.length) && !z) {
  13202. const g = s.readCursor($(ze.get()));
  13203. if (ke(g, null, (p, S) => {
  13204. ht[p] = S.clone();
  13205. }), Be.forEach((p) => {
  13206. p && ke(s.readCursor(p.get()), null, (S, N) => {
  13207. ht[S] = N.clone();
  13208. });
  13209. }), function p(S, N, L, x, P, I) {
  13210. const Q = a(N);
  13211. if (Q && l(Q))
  13212. if (Q.p != null) {
  13213. const D = Q.p;
  13214. ht[D].getPath(), L = ht[D], x = _[D] = s.writeCursor();
  13215. } else
  13216. Q.r !== void 0 && (L = null);
  13217. else
  13218. h(a(L)) && (L = null);
  13219. const _e = S.getComponent();
  13220. if (_e) {
  13221. let D;
  13222. if ((D = _e.d) != null) {
  13223. const q = Be[D];
  13224. q && (q.get(), x.mergeTree(q.get()), L = s.readCursor(q.get()));
  13225. }
  13226. }
  13227. let J = 0, me = 0;
  13228. const ye = s.advancer(N, void 0, (D, q) => {
  13229. l(q) && J--;
  13230. }), le = s.advancer(L, (D, q) => h(q) ? -(D - me) - 1 : D - me, (D, q) => {
  13231. h(q) && me++;
  13232. });
  13233. for (const D of S)
  13234. if (typeof D == "number") {
  13235. const q = ye(D), Ce = D + J, Se = le(Ce), Le = Ce + me;
  13236. x.descend(Le), p(S, q, Se, x), x.ascend();
  13237. } else
  13238. x.descend(D), p(S, ye(D), le(D), x), x.ascend();
  13239. ye.end(), le.end();
  13240. }(et, g, g.clone(), ze), ze.reset(), z)
  13241. return {
  13242. ok: false,
  13243. conflict: z
  13244. };
  13245. if (ze.get(), _.length) {
  13246. const p = _.map((N) => N ? N.get() : null), S = s.readCursor($(ze.get()));
  13247. if (ke(S, ze, (N, L, x) => {
  13248. const P = p[N];
  13249. P && (x.mergeTree(P), p[N] = null);
  13250. }), p.find((N) => N)) {
  13251. const N = s.writeCursor(), L = s.writeCursor();
  13252. let x = 0, P = 0;
  13253. p.forEach((I) => {
  13254. I != null && ke(s.readCursor(I), null, (Q) => {
  13255. const _e = xt[Q];
  13256. N.writeMove(W[_e].getPath(), ue[_e].getPath(), x++);
  13257. const J = Je[_e];
  13258. J && J.forEach((me) => {
  13259. G[me] || K !== 1 && xe[me] != null || L.writeMove(oe[me].getPath(), B[me].getPath(), P++);
  13260. });
  13261. });
  13262. }), z = {
  13263. type: i.ConflictType.BLACKHOLE,
  13264. op1: N.get(),
  13265. op2: L.get()
  13266. };
  13267. }
  13268. }
  13269. }
  13270. return z ? {
  13271. ok: false,
  13272. conflict: z
  13273. } : {
  13274. ok: true,
  13275. result: ze.get()
  13276. };
  13277. }
  13278. const se = (v) => {
  13279. const F = new Error("Transform detected write conflict");
  13280. throw F.conflict = v, F.type = F.name = "writeConflict", F;
  13281. };
  13282. function he(v, F, V) {
  13283. const K = Y(v, F, V);
  13284. if (K.ok)
  13285. return K.result;
  13286. se(K.conflict);
  13287. }
  13288. const ge = (v) => {
  13289. const F = s.writeCursor();
  13290. return s.readCursor(v).traverse(F, (V, K) => {
  13291. (h(V) || de(V)) && K.write("r", true);
  13292. }), F.get();
  13293. }, Ae = (v, F) => {
  13294. const { type: V, op1: K, op2: z } = v;
  13295. switch (V) {
  13296. case i.ConflictType.DROP_COLLISION:
  13297. return F === "left" ? [null, ge(z)] : [ge(K), null];
  13298. case i.ConflictType.RM_UNEXPECTED_CONTENT:
  13299. let W = false;
  13300. return s.readCursor(K).traverse(null, (ue) => {
  13301. ue.r !== void 0 && (W = true);
  13302. }), W ? [null, ge(z)] : [ge(K), null];
  13303. case i.ConflictType.BLACKHOLE:
  13304. return [ge(K), ge(z)];
  13305. default:
  13306. throw Error("Unrecognised conflict: " + V);
  13307. }
  13308. };
  13309. function be(v, F, V, K) {
  13310. let z = null;
  13311. for (; ; ) {
  13312. const W = Y(F, V, K);
  13313. if (W.ok)
  13314. return y(z, W.result);
  13315. {
  13316. const { conflict: ue } = W;
  13317. v(ue) || se(ue);
  13318. const [oe, B] = Ae(ue, K);
  13319. F = y(ae(F), oe), V = y(ae(V), B), z = y(z, B);
  13320. }
  13321. }
  13322. }
  13323. }(Ir)), Ir;
  13324. }
  13325. var ua;
  13326. function ym() {
  13327. return ua || (ua = 1, function(t) {
  13328. var e = $n.__createBinding || (Object.create ? function(i, o, a, u) {
  13329. u === void 0 && (u = a), Object.defineProperty(i, u, { enumerable: true, get: function() {
  13330. return o[a];
  13331. } });
  13332. } : function(i, o, a, u) {
  13333. u === void 0 && (u = a), i[u] = o[a];
  13334. }), n = $n.__exportStar || function(i, o) {
  13335. for (var a in i)
  13336. a !== "default" && !o.hasOwnProperty(a) && e(o, i, a);
  13337. };
  13338. Object.defineProperty(t, "__esModule", { value: true }), n(vm(), t);
  13339. var r = $u();
  13340. Object.defineProperty(t, "ReadCursor", { enumerable: true, get: function() {
  13341. return r.ReadCursor;
  13342. } }), Object.defineProperty(t, "WriteCursor", { enumerable: true, get: function() {
  13343. return r.WriteCursor;
  13344. } });
  13345. var s = Bu();
  13346. Object.defineProperty(t, "ConflictType", { enumerable: true, get: function() {
  13347. return s.ConflictType;
  13348. } });
  13349. }($n)), $n;
  13350. }
  13351. var mt = ym();
  13352. var wm = wt(mt);
  13353. var JC = jl({
  13354. __proto__: null,
  13355. default: wm
  13356. }, [mt]);
  13357. var ce = ((t) => (t.RETAIN = "r", t.INSERT = "i", t.DELETE = "d", t))(ce || {});
  13358. function _s(t, e = false) {
  13359. const n = [];
  13360. for (const r of t) {
  13361. const { st: s, ed: i, ts: o } = r;
  13362. if (r.sId === void 0 && delete r.sId, s === i || !e && re.isEmptyObject(o) && r.sId == null)
  13363. continue;
  13364. if (n.length === 0) {
  13365. n.push(r);
  13366. continue;
  13367. }
  13368. const a = n.pop();
  13369. Mg(r, a) && re.hasIntersectionBetweenTwoRanges(a.st, a.ed, r.st, r.ed) ? n.push({
  13370. ...r,
  13371. st: a.st,
  13372. ed: i
  13373. }) : n.push(a, r);
  13374. }
  13375. return n;
  13376. }
  13377. function ju(t, e, n, r) {
  13378. var c;
  13379. const { textRuns: s } = t;
  13380. if (s == null)
  13381. return;
  13382. const i = [], o = s.length;
  13383. let a = false;
  13384. const u = (c = e.textRuns) != null ? c : [];
  13385. if (u.length)
  13386. for (const l of u)
  13387. l.st += r, l.ed += r;
  13388. for (let l = 0; l < o; l++) {
  13389. const h = s[l], { st: d, ed: f } = h;
  13390. if (f <= r)
  13391. i.push(h);
  13392. else if (r > d && r < f) {
  13393. a = true;
  13394. const E = {
  13395. ...h,
  13396. ed: r
  13397. };
  13398. i.push(E), u.length && i.push(...u);
  13399. const R = {
  13400. ...h,
  13401. st: r + n,
  13402. ed: f + n
  13403. };
  13404. i.push(R);
  13405. } else
  13406. h.st += n, h.ed += n, a || (a = true, i.push(...u)), i.push(h);
  13407. }
  13408. a || (a = true, i.push(...u)), t.textRuns = _s(i);
  13409. }
  13410. function Hu(t, e, n, r) {
  13411. const { paragraphs: s } = t;
  13412. if (s == null)
  13413. return;
  13414. const { paragraphs: i } = e, o = [];
  13415. for (let u = 0, c = s.length; u < c; u++) {
  13416. const l = s[u], { startIndex: h } = l;
  13417. h >= r && (l.startIndex += n), o.push(l.startIndex);
  13418. }
  13419. let a = -1;
  13420. if (i) {
  13421. for (let u = 0, c = i.length; u < c; u++) {
  13422. const l = i[u];
  13423. l.startIndex += r;
  13424. const h = l.startIndex;
  13425. a = o.indexOf(h);
  13426. }
  13427. a !== -1 && s.splice(a, 1), s.push(...i), s.sort(ps("startIndex"));
  13428. }
  13429. }
  13430. function Wu(t, e, n, r) {
  13431. const { sectionBreaks: s } = t;
  13432. if (s == null)
  13433. return;
  13434. for (let o = 0, a = s.length; o < a; o++) {
  13435. const u = s[o], { startIndex: c } = u;
  13436. c >= r && (u.startIndex += n);
  13437. }
  13438. const i = e.sectionBreaks;
  13439. if (i) {
  13440. for (let o = 0, a = i.length; o < a; o++) {
  13441. const u = i[o];
  13442. u.startIndex += r;
  13443. }
  13444. s.push(...i), s.sort(ps("startIndex"));
  13445. }
  13446. }
  13447. function zu(t, e, n, r) {
  13448. const { customBlocks: s = [] } = t;
  13449. for (let o = 0, a = s.length; o < a; o++) {
  13450. const u = s[o], { startIndex: c } = u;
  13451. c >= r && (u.startIndex += n);
  13452. }
  13453. const i = e.customBlocks;
  13454. if (i) {
  13455. for (let o = 0, a = i.length; o < a; o++) {
  13456. const u = i[o];
  13457. u.startIndex += r;
  13458. }
  13459. s.push(...i), s.sort(ps("startIndex"));
  13460. }
  13461. s.length && !t.customBlocks && (t.customBlocks = s);
  13462. }
  13463. function Yu(t, e, n, r) {
  13464. const { tables: s } = t;
  13465. if (s == null)
  13466. return;
  13467. for (let o = 0, a = s.length; o < a; o++) {
  13468. const u = s[o], { startIndex: c, endIndex: l } = u;
  13469. c > r ? (u.startIndex += n, u.endIndex += n) : l > r && (u.endIndex += n);
  13470. }
  13471. const i = e.tables;
  13472. if (i) {
  13473. for (let o = 0, a = i.length; o < a; o++) {
  13474. const u = i[o];
  13475. u.startIndex += r, u.endIndex += r;
  13476. }
  13477. s.push(...i), s.sort(ps("startIndex"));
  13478. }
  13479. }
  13480. var Vu = "$";
  13481. var la = (t) => t.split(Vu)[0];
  13482. function ki(t) {
  13483. if (t.length <= 1)
  13484. return t;
  13485. t.sort((s, i) => s.startIndex - i.startIndex);
  13486. const e = [];
  13487. let n = { ...t[0] };
  13488. n.rangeId = la(n.rangeId);
  13489. for (let s = 1; s < t.length; s++) {
  13490. const i = t[s];
  13491. i.rangeId = la(i.rangeId), i.rangeId === n.rangeId && Df(n.properties, i.properties) && n.endIndex + 1 >= i.startIndex ? n.endIndex = i.endIndex : (e.push(n), n = { ...i });
  13492. }
  13493. e.push(n);
  13494. const r = /* @__PURE__ */ Object.create(null);
  13495. for (let s = 0, i = e.length; s < i; s++) {
  13496. const o = e[s], a = o.rangeId;
  13497. r[a] ? (o.rangeId = `${a}${Vu}${r[a]}`, r[a] = r[a] + 1) : r[a] = 1;
  13498. }
  13499. return e;
  13500. }
  13501. function Qs(t, e) {
  13502. const n = t.findIndex((s) => s.startIndex < e && s.endIndex >= e), r = t[n];
  13503. r && t.splice(
  13504. n,
  13505. 1,
  13506. {
  13507. rangeId: r.rangeId,
  13508. rangeType: r.rangeType,
  13509. startIndex: r.startIndex,
  13510. endIndex: e - 1,
  13511. properties: { ...r.properties }
  13512. },
  13513. {
  13514. rangeId: r.rangeId,
  13515. rangeType: r.rangeType,
  13516. startIndex: e,
  13517. endIndex: r.endIndex,
  13518. properties: { ...r.properties }
  13519. }
  13520. );
  13521. }
  13522. function Gu(t) {
  13523. if (t.length <= 1)
  13524. return t;
  13525. t.sort((r, s) => r.startIndex - s.startIndex);
  13526. const e = [];
  13527. let n = { ...t[0] };
  13528. for (let r = 1; r < t.length; r++) {
  13529. const s = t[r];
  13530. s.id === n.id && n.endIndex + 1 >= s.startIndex ? n.endIndex = s.endIndex : (e.push(n), n = { ...s });
  13531. }
  13532. return e.push(n), e;
  13533. }
  13534. function qs(t, e) {
  13535. t.filter((r) => r.startIndex < e && r.endIndex >= e).forEach((r) => {
  13536. const s = t.indexOf(r);
  13537. t.splice(
  13538. s,
  13539. 1,
  13540. {
  13541. id: r.id,
  13542. type: r.type,
  13543. startIndex: r.startIndex,
  13544. endIndex: e - 1
  13545. },
  13546. {
  13547. id: r.id,
  13548. type: r.type,
  13549. startIndex: e,
  13550. endIndex: r.endIndex
  13551. }
  13552. );
  13553. });
  13554. }
  13555. function Om(t, e, n, r) {
  13556. t.customRanges || (t.customRanges = []);
  13557. const { customRanges: s } = t;
  13558. Qs(s, r);
  13559. for (let o = 0, a = s.length; o < a; o++) {
  13560. const u = s[o], { startIndex: c } = u;
  13561. c >= r && (u.startIndex += n, u.endIndex += n);
  13562. }
  13563. const i = [];
  13564. if (e.customRanges) {
  13565. for (let o = 0, a = e.customRanges.length; o < a; o++) {
  13566. const u = e.customRanges[o];
  13567. u.startIndex += r, u.endIndex += r, i.push(u);
  13568. }
  13569. s.push(...i);
  13570. }
  13571. t.customRanges = ki(s);
  13572. }
  13573. function bm(t, e, n, r) {
  13574. t.customDecorations || (t.customDecorations = []);
  13575. const { customDecorations: s } = t;
  13576. qs(s, r);
  13577. for (let o = 0, a = s.length; o < a; o++) {
  13578. const u = s[o], { startIndex: c } = u;
  13579. c >= r && (u.startIndex += n, u.endIndex += n);
  13580. }
  13581. const i = [];
  13582. if (e.customDecorations) {
  13583. for (let o = 0, a = e.customDecorations.length; o < a; o++) {
  13584. const u = e.customDecorations[o];
  13585. u.startIndex += r, u.endIndex += r, i.push(u);
  13586. }
  13587. s.push(...i);
  13588. }
  13589. t.customDecorations = Gu(s);
  13590. }
  13591. function Ku(t, e, n) {
  13592. const { textRuns: r } = t, s = n, i = n + e, o = [];
  13593. if (r) {
  13594. const a = [];
  13595. for (let u = 0, c = r.length; u < c; u++) {
  13596. const l = r[u], { st: h, ed: d } = l;
  13597. if (s <= h && i >= d) {
  13598. o.push({
  13599. ...l,
  13600. st: h - s,
  13601. ed: d - s
  13602. });
  13603. continue;
  13604. } else
  13605. h <= s && d >= i ? (o.push({
  13606. ...l,
  13607. st: s - s,
  13608. ed: i - s
  13609. }), l.ed -= e) : s >= h && s < d ? (o.push({
  13610. ...l,
  13611. st: s - s,
  13612. ed: d - s
  13613. }), l.ed = s) : i > h && i <= d ? (o.push({
  13614. ...l,
  13615. st: h - s,
  13616. ed: i - s
  13617. }), l.st = i - e, l.ed -= e) : h >= i && (l.st -= e, l.ed -= e);
  13618. a.push(l);
  13619. }
  13620. t.textRuns = a;
  13621. }
  13622. return o.length === 0 && o.push({
  13623. st: 0,
  13624. ed: e,
  13625. ts: {}
  13626. }), o;
  13627. }
  13628. function Xu(t, e, n) {
  13629. const { paragraphs: r } = t, s = n, i = n + e, o = [];
  13630. if (r) {
  13631. const a = [];
  13632. for (let u = 0, c = r.length; u < c; u++) {
  13633. const l = r[u], { startIndex: h } = l;
  13634. if (h >= s && h < i) {
  13635. o.push({
  13636. ...l,
  13637. startIndex: h - n
  13638. });
  13639. continue;
  13640. } else
  13641. h >= i && (l.startIndex -= e);
  13642. a.push(l);
  13643. }
  13644. t.paragraphs = a;
  13645. }
  13646. return o;
  13647. }
  13648. function Ju(t, e, n) {
  13649. const { sectionBreaks: r } = t, s = n, i = n + e - 1, o = [];
  13650. if (r) {
  13651. const a = [];
  13652. for (let u = 0, c = r.length; u < c; u++) {
  13653. const l = r[u], { startIndex: h } = l;
  13654. if (h >= s && h <= i) {
  13655. o.push({
  13656. ...l,
  13657. startIndex: h - n
  13658. });
  13659. continue;
  13660. } else
  13661. h > i && (l.startIndex -= e);
  13662. a.push(l);
  13663. }
  13664. t.sectionBreaks = a;
  13665. }
  13666. return o;
  13667. }
  13668. function Zu(t, e, n) {
  13669. const { customBlocks: r = [] } = t, s = n, i = n + e - 1, o = [];
  13670. if (r) {
  13671. const a = [];
  13672. for (let u = 0, c = r.length; u < c; u++) {
  13673. const l = r[u], { startIndex: h } = l;
  13674. if (h >= s && h <= i) {
  13675. o.push({
  13676. ...l,
  13677. startIndex: h - n
  13678. });
  13679. continue;
  13680. } else
  13681. h > i && (l.startIndex -= e);
  13682. a.push(l);
  13683. }
  13684. t.customBlocks = a;
  13685. }
  13686. return r.length && !t.customBlocks && (t.customBlocks = r), o;
  13687. }
  13688. function Qu(t, e, n) {
  13689. const { tables: r } = t, s = n, i = n + e - 1, o = [];
  13690. if (r) {
  13691. const a = [];
  13692. for (let u = 0, c = r.length; u < c; u++) {
  13693. const l = r[u], { startIndex: h, endIndex: d } = l;
  13694. if (s <= h && i >= d) {
  13695. o.push({
  13696. ...l,
  13697. startIndex: h - n,
  13698. endIndex: d - n
  13699. });
  13700. continue;
  13701. } else if (h <= s && d >= i) {
  13702. const f = Li(h, d, s, i);
  13703. if (f.length === 0 || (l.startIndex = f[0], l.endIndex = f[1], l.startIndex === l.endIndex))
  13704. continue;
  13705. } else
  13706. i < h && (l.startIndex -= e, l.endIndex -= e);
  13707. a.push(l);
  13708. }
  13709. t.tables = a;
  13710. }
  13711. return o;
  13712. }
  13713. function Sm(t, e, n) {
  13714. const { customRanges: r } = t, s = n, i = n + e - 1, o = [];
  13715. if (r) {
  13716. const a = [];
  13717. for (let u = 0, c = r.length; u < c; u++) {
  13718. const l = r[u], { startIndex: h, endIndex: d } = l;
  13719. if (h >= s && d <= i) {
  13720. o.push(l);
  13721. continue;
  13722. } else if (Math.max(s, h) <= Math.min(i, d)) {
  13723. const f = Li(h, d, s, i);
  13724. if (f.length === 0)
  13725. continue;
  13726. l.startIndex = f[0], l.endIndex = f[1];
  13727. } else
  13728. i < h && (l.startIndex -= e, l.endIndex -= e);
  13729. a.push(l);
  13730. }
  13731. t.customRanges = ki(a);
  13732. }
  13733. return o;
  13734. }
  13735. function Am(t, e, n, r = true) {
  13736. const { customDecorations: s } = t, i = n, o = n + e - 1, a = [];
  13737. if (s) {
  13738. const u = [];
  13739. for (let c = 0, l = s.length; c < l; c++) {
  13740. const h = s[c], { startIndex: d, endIndex: f } = h;
  13741. if (d >= i && f <= o) {
  13742. a.push(h);
  13743. continue;
  13744. } else if (Math.max(i, d) <= Math.min(o, f)) {
  13745. const E = Li(d, f, i, o);
  13746. if (E.length === 0)
  13747. continue;
  13748. h.startIndex = E[0], h.endIndex = E[1];
  13749. } else
  13750. o < d && r && (h.startIndex -= e, h.endIndex -= e);
  13751. u.push(h);
  13752. }
  13753. t.customDecorations = u;
  13754. }
  13755. return a;
  13756. }
  13757. var Nm = ((t) => (t.ORDER_LIST_QUICK_1 = "1.", t.ORDER_LIST_QUICK_2 = "a)", t.ORDER_LIST_QUICK_3 = "a.", t.ORDER_LIST_QUICK_4 = "i.", t.ORDER_LIST_QUICK_5 = "A.", t.ORDER_LIST_QUICK_6 = "I.", t.ORDER_LIST_QUICK_7 = "01.", t))(Nm || {});
  13758. var Ft = ((t) => (t.BULLET_LIST = "BULLET_LIST", t.BULLET_LIST_1 = "BULLET_LIST_1", t.BULLET_LIST_2 = "BULLET_LIST_2", t.BULLET_LIST_3 = "BULLET_LIST_3", t.BULLET_LIST_4 = "BULLET_LIST_4", t.BULLET_LIST_5 = "BULLET_LIST_5", t.ORDER_LIST = "ORDER_LIST", t.ORDER_LIST_1 = "ORDER_LIST_1", t.ORDER_LIST_2 = "ORDER_LIST_2", t.ORDER_LIST_3 = "ORDER_LIST_3", t.ORDER_LIST_4 = "ORDER_LIST_4", t.ORDER_LIST_5 = "ORDER_LIST_5", t.ORDER_LIST_QUICK_2 = "ORDER_LIST_QUICK_2", t.ORDER_LIST_QUICK_3 = "ORDER_LIST_QUICK_3", t.ORDER_LIST_QUICK_4 = "ORDER_LIST_QUICK_4", t.ORDER_LIST_QUICK_5 = "ORDER_LIST_QUICK_5", t.ORDER_LIST_QUICK_6 = "ORDER_LIST_QUICK_6", t.CHECK_LIST = "CHECK_LIST", t.CHECK_LIST_CHECKED = "CHECK_LIST_CHECKED", t))(Ft || {});
  13759. var Or = {
  13760. "a)": { glyphFormat: "%1)", glyphType: Te.DECIMAL },
  13761. "1.": { glyphFormat: "%1.", glyphType: Te.DECIMAL },
  13762. "a.": { glyphFormat: "%1.", glyphType: Te.LOWER_LETTER },
  13763. "A.": { glyphFormat: "%1.", glyphType: Te.UPPER_LETTER },
  13764. "i.": { glyphFormat: "%1.", glyphType: Te.LOWER_ROMAN },
  13765. "I.": { glyphFormat: "%1.", glyphType: Te.UPPER_LETTER }
  13766. };
  13767. var Rn = (t) => [
  13768. ...t,
  13769. ...t,
  13770. ...t
  13771. ].map((e, n) => ({
  13772. glyphFormat: ` %${n + 1}`,
  13773. glyphSymbol: e,
  13774. bulletAlignment: ms.START,
  13775. textStyle: {
  13776. fs: 12
  13777. },
  13778. startNumber: 0,
  13779. paragraphProperties: {
  13780. hanging: { v: 21 },
  13781. indentStart: { v: 21 * n }
  13782. }
  13783. }));
  13784. var In = (t) => t.map((e, n) => ({
  13785. ...e,
  13786. bulletAlignment: ms.START,
  13787. textStyle: {
  13788. fs: 12
  13789. },
  13790. startNumber: 0,
  13791. paragraphProperties: {
  13792. hanging: { v: 21 },
  13793. indentStart: { v: 21 * n }
  13794. }
  13795. }));
  13796. var ca = (t, e) => new Array(9).fill(0).map((n, r) => ({
  13797. glyphFormat: ` %${r + 1}`,
  13798. glyphSymbol: t,
  13799. bulletAlignment: ms.START,
  13800. textStyle: {
  13801. fs: 16
  13802. },
  13803. startNumber: 0,
  13804. paragraphProperties: {
  13805. hanging: { v: 21 },
  13806. indentStart: { v: 21 * r },
  13807. textStyle: e
  13808. }
  13809. }));
  13810. var Es = {
  13811. BULLET_LIST: {
  13812. listType: "BULLET_LIST",
  13813. nestingLevel: Rn(["●", "○", "■"])
  13814. },
  13815. BULLET_LIST_1: {
  13816. listType: "BULLET_LIST",
  13817. nestingLevel: Rn(["❖", "➢", "■"])
  13818. },
  13819. BULLET_LIST_2: {
  13820. listType: "BULLET_LIST",
  13821. nestingLevel: Rn(["✔", "●", "◆"])
  13822. },
  13823. BULLET_LIST_3: {
  13824. listType: "BULLET_LIST",
  13825. nestingLevel: Rn(["■", "◆", "○"])
  13826. },
  13827. BULLET_LIST_4: {
  13828. listType: "BULLET_LIST",
  13829. nestingLevel: Rn(["✧", "○", "■"])
  13830. },
  13831. BULLET_LIST_5: {
  13832. listType: "BULLET_LIST",
  13833. nestingLevel: Rn(["➢", "○", "◆"])
  13834. },
  13835. ORDER_LIST: {
  13836. listType: "ORDER_LIST",
  13837. nestingLevel: In([
  13838. { glyphFormat: "%1.", glyphType: Te.DECIMAL },
  13839. { glyphFormat: "%2.", glyphType: Te.LOWER_LETTER },
  13840. { glyphFormat: "%3.", glyphType: Te.LOWER_ROMAN },
  13841. { glyphFormat: "%4.", glyphType: Te.DECIMAL },
  13842. { glyphFormat: "%5.", glyphType: Te.LOWER_LETTER },
  13843. { glyphFormat: "%6.", glyphType: Te.LOWER_ROMAN },
  13844. { glyphFormat: "%7.", glyphType: Te.DECIMAL },
  13845. { glyphFormat: "%8.", glyphType: Te.LOWER_LETTER },
  13846. { glyphFormat: "%9.", glyphType: Te.LOWER_ROMAN }
  13847. ])
  13848. },
  13849. ORDER_LIST_1: {
  13850. listType: "ORDER_LIST",
  13851. nestingLevel: In([
  13852. { glyphFormat: "%1)", glyphType: Te.DECIMAL },
  13853. { glyphFormat: "%2)", glyphType: Te.LOWER_LETTER },
  13854. { glyphFormat: "%3)", glyphType: Te.LOWER_ROMAN },
  13855. { glyphFormat: "%4)", glyphType: Te.DECIMAL },
  13856. { glyphFormat: "%5)", glyphType: Te.LOWER_LETTER },
  13857. { glyphFormat: "%6)", glyphType: Te.LOWER_ROMAN },
  13858. { glyphFormat: "%7)", glyphType: Te.DECIMAL },
  13859. { glyphFormat: "%8)", glyphType: Te.LOWER_LETTER },
  13860. { glyphFormat: "%9)", glyphType: Te.LOWER_ROMAN }
  13861. ])
  13862. },
  13863. ORDER_LIST_2: {
  13864. listType: "ORDER_LIST",
  13865. nestingLevel: In([
  13866. "%1.",
  13867. "%1.%2.",
  13868. "%1.%2.%3.",
  13869. "%1.%2.%3.%4.",
  13870. "%1.%2.%3.%4.%5.",
  13871. "%1.%2.%3.%4.%5.%6.",
  13872. "%1.%2.%3.%4.%5.%6.%7."
  13873. ].map((t) => ({ glyphFormat: t, glyphType: Te.DECIMAL })))
  13874. },
  13875. ORDER_LIST_3: {
  13876. listType: "ORDER_LIST",
  13877. nestingLevel: In([
  13878. { glyphFormat: "%1.", glyphType: Te.UPPER_LETTER },
  13879. { glyphFormat: "%2.", glyphType: Te.LOWER_LETTER },
  13880. { glyphFormat: "%3.", glyphType: Te.LOWER_ROMAN },
  13881. { glyphFormat: "%4.", glyphType: Te.UPPER_LETTER },
  13882. { glyphFormat: "%5.", glyphType: Te.LOWER_LETTER },
  13883. { glyphFormat: "%6.", glyphType: Te.LOWER_ROMAN },
  13884. { glyphFormat: "%7.", glyphType: Te.UPPER_LETTER },
  13885. { glyphFormat: "%8.", glyphType: Te.LOWER_LETTER },
  13886. { glyphFormat: "%9.", glyphType: Te.LOWER_ROMAN }
  13887. ])
  13888. },
  13889. ORDER_LIST_4: {
  13890. listType: "ORDER_LIST",
  13891. nestingLevel: In([
  13892. { glyphFormat: "%1.", glyphType: Te.UPPER_LETTER },
  13893. { glyphFormat: "%2.", glyphType: Te.DECIMAL },
  13894. { glyphFormat: "%3.", glyphType: Te.LOWER_ROMAN },
  13895. { glyphFormat: "%4.", glyphType: Te.UPPER_LETTER },
  13896. { glyphFormat: "%5.", glyphType: Te.DECIMAL },
  13897. { glyphFormat: "%6.", glyphType: Te.LOWER_ROMAN },
  13898. { glyphFormat: "%7.", glyphType: Te.UPPER_LETTER },
  13899. { glyphFormat: "%8.", glyphType: Te.DECIMAL },
  13900. { glyphFormat: "%9.", glyphType: Te.LOWER_ROMAN }
  13901. ])
  13902. },
  13903. ORDER_LIST_5: {
  13904. listType: "ORDER_LIST",
  13905. nestingLevel: In([
  13906. { glyphFormat: "%1.", glyphType: Te.DECIMAL_ZERO },
  13907. { glyphFormat: "%2.", glyphType: Te.LOWER_LETTER },
  13908. { glyphFormat: "%3.", glyphType: Te.LOWER_ROMAN },
  13909. { glyphFormat: "%4.", glyphType: Te.DECIMAL_ZERO },
  13910. { glyphFormat: "%5.", glyphType: Te.LOWER_LETTER },
  13911. { glyphFormat: "%6.", glyphType: Te.LOWER_ROMAN },
  13912. { glyphFormat: "%7.", glyphType: Te.DECIMAL_ZERO },
  13913. { glyphFormat: "%8.", glyphType: Te.LOWER_LETTER },
  13914. { glyphFormat: "%9.", glyphType: Te.LOWER_ROMAN }
  13915. ])
  13916. },
  13917. CHECK_LIST: {
  13918. listType: "CHECK_LIST",
  13919. nestingLevel: ca("☐")
  13920. },
  13921. CHECK_LIST_CHECKED: {
  13922. listType: "CHECK_LIST_CHECKED",
  13923. nestingLevel: ca(
  13924. "☑",
  13925. {
  13926. st: {
  13927. s: we.TRUE
  13928. }
  13929. }
  13930. )
  13931. }
  13932. };
  13933. var br = (t) => {
  13934. const { glyphFormat: e, glyphType: n } = t, r = re.deepClone(Es.ORDER_LIST);
  13935. return r.nestingLevel[0].glyphFormat = e, r.nestingLevel[0].glyphType = n, r;
  13936. };
  13937. var Tm = {
  13938. ORDER_LIST_QUICK_2: br(Or[
  13939. "a)"
  13940. /* ORDER_LIST_QUICK_2 */
  13941. ]),
  13942. ORDER_LIST_QUICK_3: br(Or[
  13943. "a."
  13944. /* ORDER_LIST_QUICK_3 */
  13945. ]),
  13946. ORDER_LIST_QUICK_4: br(Or[
  13947. "i."
  13948. /* ORDER_LIST_QUICK_4 */
  13949. ]),
  13950. ORDER_LIST_QUICK_6: br(Or[
  13951. "I."
  13952. /* ORDER_LIST_QUICK_6 */
  13953. ])
  13954. };
  13955. Object.assign(Es, Tm);
  13956. var ZC = {
  13957. "1.": "ORDER_LIST",
  13958. "a)": "ORDER_LIST_QUICK_2",
  13959. "a.": "ORDER_LIST_QUICK_3",
  13960. "i.": "ORDER_LIST_QUICK_4",
  13961. "A.": "ORDER_LIST_3",
  13962. "I.": "ORDER_LIST_QUICK_6",
  13963. "01.": "ORDER_LIST_5"
  13964. /* ORDER_LIST_5 */
  13965. };
  13966. function Mm(t, e, n, r, s) {
  13967. const i = Dm(t, e, n, r, s), o = xm(t, e, n, r, s), a = Lm(t, e, n, r, s), u = Um(t, e, n, r, s), c = Pm(t, e, n, r, s), l = km(t, e, n, r), h = Fm(t, e, n, r, s);
  13968. return {
  13969. dataStream: "",
  13970. textRuns: i,
  13971. paragraphs: o,
  13972. sectionBreaks: a,
  13973. customBlocks: u,
  13974. tables: c,
  13975. customRanges: l,
  13976. customDecorations: h
  13977. };
  13978. }
  13979. function Dm(t, e, n, r, s) {
  13980. const { textRuns: i } = t, { textRuns: o } = e;
  13981. if (i == null || o == null)
  13982. return;
  13983. const a = Ku(t, n, r);
  13984. if (s !== Pe.REPLACE) {
  13985. const u = qu(o, a, s);
  13986. e.textRuns = u;
  13987. }
  13988. return ju(t, e, n, r), a;
  13989. }
  13990. function qu(t, e, n) {
  13991. if (e.length === 0)
  13992. return t;
  13993. t = re.deepClone(t), e = re.deepClone(e);
  13994. const r = [], s = t.length, i = e.length;
  13995. let o = 0, a = 0, u = null;
  13996. function c() {
  13997. return u ? (r.push(u), u = null, true) : false;
  13998. }
  13999. for (; o < s && a < i; ) {
  14000. const { st: f, ed: E, ts: R } = t[o], { st: O, ed: U, ts: ne, sId: X } = e[a];
  14001. let de;
  14002. if (n === Pe.COVER ? de = { ...ne, ...R } : de = { ...R }, E < O)
  14003. c() || r.push(t[o]), o++;
  14004. else if (U < f)
  14005. c() || r.push(e[a]), a++;
  14006. else {
  14007. const T = {
  14008. st: Math.min(f, O),
  14009. ed: Math.max(f, O),
  14010. ts: f < O ? { ...R } : { ...ne },
  14011. sId: f < O ? void 0 : X
  14012. };
  14013. T.ed > T.st && r.push(T), r.push({
  14014. st: Math.max(f, O),
  14015. ed: Math.min(E, U),
  14016. ts: de,
  14017. sId: X
  14018. }), E < U ? (o++, e[a].st = E, e[a].st === e[a].ed && a++) : (a++, t[o].st = U, t[o].st === t[o].ed && o++);
  14019. const A = {
  14020. st: Math.min(E, U),
  14021. ed: Math.max(E, U),
  14022. ts: E < U ? { ...ne } : { ...R },
  14023. sId: E < U ? X : void 0
  14024. };
  14025. u = A.ed > A.st ? A : null;
  14026. }
  14027. }
  14028. c();
  14029. const l = r[r.length - 1], h = t[s - 1], d = e[i - 1];
  14030. return l && l.ed !== Math.max(h.ed, d.ed) && (h.ed > d.ed ? r.push(h) : r.push(d)), _s(r);
  14031. }
  14032. function xm(t, e, n, r, s) {
  14033. const { paragraphs: i } = t, { paragraphs: o } = e;
  14034. if (i == null || o == null)
  14035. return;
  14036. const a = Xu(t, n, r);
  14037. if (s !== Pe.REPLACE) {
  14038. const u = [];
  14039. for (const c of o) {
  14040. const {
  14041. startIndex: l,
  14042. paragraphStyle: h,
  14043. bullet: d
  14044. } = c;
  14045. let f = [];
  14046. for (const E of a) {
  14047. const {
  14048. startIndex: R,
  14049. paragraphStyle: O,
  14050. bullet: U
  14051. } = E;
  14052. let ne, X;
  14053. if (s === Pe.COVER ? (ne = { ...O, ...h }, X = {
  14054. listId: "",
  14055. listType: Ft.BULLET_LIST,
  14056. nestingLevel: 0,
  14057. textStyle: {},
  14058. ...U,
  14059. ...d
  14060. }) : (ne = { ...h, ...O }, X = {
  14061. listId: "",
  14062. listType: Ft.BULLET_LIST,
  14063. nestingLevel: 0,
  14064. textStyle: {},
  14065. ...d,
  14066. ...U
  14067. }), l === R) {
  14068. f.push({
  14069. startIndex: l,
  14070. paragraphStyle: ne,
  14071. bullet: X
  14072. });
  14073. break;
  14074. }
  14075. }
  14076. u.push(...f), f = [];
  14077. }
  14078. e.paragraphs = u;
  14079. }
  14080. return Hu(t, e, n, r), a;
  14081. }
  14082. function Lm(t, e, n, r, s) {
  14083. const { sectionBreaks: i } = t, { sectionBreaks: o } = e;
  14084. if (i == null || o == null)
  14085. return;
  14086. const a = Ju(t, n, r);
  14087. if (s !== Pe.REPLACE) {
  14088. const u = [];
  14089. for (const c of o) {
  14090. const { startIndex: l } = c;
  14091. let h = [];
  14092. for (const d of a) {
  14093. const { startIndex: f } = d;
  14094. if (l === f) {
  14095. s === Pe.COVER ? h.push({
  14096. ...d,
  14097. ...c
  14098. }) : h.push({
  14099. ...c,
  14100. ...d
  14101. });
  14102. break;
  14103. }
  14104. }
  14105. u.push(...h), h = [];
  14106. }
  14107. e.sectionBreaks = u;
  14108. }
  14109. return Wu(t, e, n, r), a;
  14110. }
  14111. function Um(t, e, n, r, s) {
  14112. const { customBlocks: i = [] } = t, { customBlocks: o } = e;
  14113. if (i == null || o == null)
  14114. return;
  14115. const a = Zu(t, n, r);
  14116. if (s !== Pe.REPLACE) {
  14117. const u = [];
  14118. for (const c of o) {
  14119. const { startIndex: l } = c;
  14120. let h = [];
  14121. for (const d of a) {
  14122. const { startIndex: f } = d;
  14123. if (l === f) {
  14124. s === Pe.COVER ? h.push({
  14125. ...d,
  14126. ...c
  14127. }) : h.push({
  14128. ...c,
  14129. ...d
  14130. });
  14131. break;
  14132. }
  14133. }
  14134. u.push(...h), h = [];
  14135. }
  14136. e.customBlocks = u;
  14137. }
  14138. return zu(t, e, n, r), i.length && !t.customBlocks && (t.customBlocks = i), a;
  14139. }
  14140. function Pm(t, e, n, r, s) {
  14141. const { tables: i } = t, { tables: o } = e;
  14142. if (i == null || o == null)
  14143. return;
  14144. const a = Qu(t, n, r);
  14145. if (s !== Pe.REPLACE) {
  14146. const u = [];
  14147. for (const c of o) {
  14148. const { startIndex: l, endIndex: h } = c;
  14149. let d = [];
  14150. for (const f of a) {
  14151. const { startIndex: E, endIndex: R } = f;
  14152. if (E >= l && R <= h) {
  14153. s === Pe.COVER ? d.push({
  14154. ...f,
  14155. ...c
  14156. }) : d.push({
  14157. ...c,
  14158. ...f
  14159. });
  14160. break;
  14161. }
  14162. }
  14163. u.push(...d), d = [];
  14164. }
  14165. e.tables = u;
  14166. }
  14167. return Yu(t, e, n, r), a;
  14168. }
  14169. function km(t, e, n, r, s) {
  14170. t.customRanges || (t.customRanges = []), Qs(t.customRanges, r), Qs(t.customRanges, r + n);
  14171. const i = r, o = r + n - 1, { customRanges: a } = e, u = [], c = /* @__PURE__ */ new Map();
  14172. t.customRanges.forEach((h) => {
  14173. const { startIndex: d, endIndex: f } = h;
  14174. d >= i && f <= o ? c.set(h.rangeId, h) : u.push(h);
  14175. });
  14176. const l = [];
  14177. return a ? (a.forEach((h) => {
  14178. const { startIndex: d, endIndex: f } = h;
  14179. u.push({
  14180. ...h,
  14181. startIndex: d + r,
  14182. endIndex: f + r
  14183. });
  14184. }), t.customRanges = ki(u), l) : [];
  14185. }
  14186. function Fm(t, e, n, r, s) {
  14187. t.customDecorations || (t.customDecorations = []), qs(t.customDecorations, r), qs(t.customDecorations, r + n);
  14188. const i = [], { customDecorations: o } = t, { customDecorations: a = [] } = e;
  14189. if (s === Pe.REPLACE) {
  14190. for (let u = 0; u < o.length; u++) {
  14191. const c = o[u], { startIndex: l, endIndex: h } = c;
  14192. l >= r && h <= r + n - 1 && i.push(c);
  14193. }
  14194. a.forEach((u) => {
  14195. const { startIndex: c, endIndex: l } = u;
  14196. o.push({
  14197. ...u,
  14198. startIndex: c + r,
  14199. endIndex: l + r
  14200. });
  14201. });
  14202. } else
  14203. for (const u of a) {
  14204. const { id: c } = u;
  14205. if (u.type === An.DELETED) {
  14206. const l = o.filter((h) => h.id === c);
  14207. l.length && i.push(...l);
  14208. } else
  14209. o.push({
  14210. ...u,
  14211. startIndex: u.startIndex + r,
  14212. endIndex: u.endIndex + r
  14213. });
  14214. }
  14215. for (const u of i) {
  14216. const { id: c } = u, l = o.findIndex((h) => h.id === c);
  14217. l !== -1 && o.splice(l, 1);
  14218. }
  14219. return t.customDecorations = Gu(o), i;
  14220. }
  14221. var el = ((t) => (t[t.copy = 0] = "copy", t[t.cut = 1] = "cut", t))(el || {});
  14222. function ei(t, e, n, r = true) {
  14223. const { textRuns: s } = t;
  14224. if (s) {
  14225. const i = [];
  14226. for (const o of s) {
  14227. const a = re.deepClone(o), { st: u, ed: c } = a;
  14228. re.hasIntersectionBetweenTwoRanges(u, c, e, n) && (e >= u && e <= c ? i.push({
  14229. ...a,
  14230. st: e,
  14231. ed: Math.min(n, c)
  14232. }) : n >= u && n <= c ? i.push({
  14233. ...a,
  14234. st: Math.max(e, u),
  14235. ed: n
  14236. }) : i.push(a));
  14237. }
  14238. return _s(
  14239. i.map((o) => {
  14240. const { st: a, ed: u } = o;
  14241. return {
  14242. ...o,
  14243. st: a - e,
  14244. ed: u - e
  14245. };
  14246. })
  14247. );
  14248. } else if (r)
  14249. return [{
  14250. st: 0,
  14251. ed: n - e,
  14252. ts: {}
  14253. }];
  14254. }
  14255. function $m(t, e, n) {
  14256. const { tables: r = [] } = t, s = [];
  14257. for (const i of r) {
  14258. const o = re.deepClone(i), { startIndex: a, endIndex: u } = o;
  14259. a >= e && u <= n && s.push({
  14260. ...o,
  14261. startIndex: a - e,
  14262. endIndex: u - e
  14263. });
  14264. }
  14265. return s;
  14266. }
  14267. function Bm(t, e, n) {
  14268. const { paragraphs: r = [] } = t, s = [];
  14269. for (const i of r) {
  14270. const { startIndex: o } = i;
  14271. o >= e && o < n && s.push(re.deepClone(i));
  14272. }
  14273. if (s.length)
  14274. return s.map((i) => ({
  14275. ...i,
  14276. startIndex: i.startIndex - e
  14277. }));
  14278. }
  14279. function QC(t, e, n) {
  14280. const { sectionBreaks: r = [] } = t, s = [];
  14281. for (const i of r) {
  14282. const { startIndex: o } = i;
  14283. o >= e && o <= n && s.push(re.deepClone(i));
  14284. }
  14285. if (s.length)
  14286. return s.map((i) => ({
  14287. ...i,
  14288. startIndex: i.startIndex - e
  14289. }));
  14290. }
  14291. function jm(t, e, n) {
  14292. const { customBlocks: r = [] } = t, s = [];
  14293. for (const i of r) {
  14294. const { startIndex: o } = i;
  14295. o >= e && o <= n && s.push(re.deepClone(i));
  14296. }
  14297. if (s.length)
  14298. return s.map((i) => ({
  14299. ...i,
  14300. startIndex: i.startIndex - e
  14301. }));
  14302. }
  14303. function Dt(t, e, n, r = true, s = 1) {
  14304. const { dataStream: i } = t, o = {
  14305. dataStream: i.slice(e, n)
  14306. };
  14307. o.textRuns = ei(t, e, n, r);
  14308. const a = $m(t, e, n);
  14309. if (a.length && (o.tables = a), o.paragraphs = Bm(t, e, n), s === 1) {
  14310. const c = Wm(t, e, n);
  14311. c ? o.customDecorations = c : r && (o.customDecorations = []);
  14312. }
  14313. const { customRanges: u } = Hm(t, e, n);
  14314. return u ? o.customRanges = u : r && (o.customRanges = []), o.customBlocks = jm(t, e, n), o;
  14315. }
  14316. function qC(t) {
  14317. const { dataStream: e, textRuns: n, paragraphs: r, customRanges: s, customDecorations: i, tables: o } = t;
  14318. let a = 0, u = 0;
  14319. s == null || s.forEach((l) => {
  14320. l.startIndex < 0 && (a = Math.max(a, -l.startIndex)), l.endIndex > e.length - 1 && (u = Math.max(u, l.endIndex - e.length + 1));
  14321. });
  14322. const c = `${e}`;
  14323. return n && (n[0] && (n[0].st = n[0].st - a), n[n.length - 1] && (n[n.length - 1].ed = n[n.length - 1].ed + u)), n == null || n.forEach((l) => {
  14324. l.st += a, l.ed += a;
  14325. }), r == null || r.forEach((l) => {
  14326. l.startIndex += a;
  14327. }), s == null || s.forEach((l) => {
  14328. l.startIndex += a, l.endIndex += a;
  14329. }), i == null || i.forEach((l) => {
  14330. l.startIndex += a, l.endIndex += u;
  14331. }), o == null || o.forEach((l) => {
  14332. l.startIndex += a, l.endIndex += u;
  14333. }), {
  14334. ...t,
  14335. dataStream: c,
  14336. textRuns: n,
  14337. paragraphs: r,
  14338. customRanges: s,
  14339. customDecorations: i,
  14340. tables: o
  14341. };
  14342. }
  14343. function Hm(t, e, n) {
  14344. if (t.customRanges == null)
  14345. return {};
  14346. const { customRanges: r } = t;
  14347. return {
  14348. customRanges: r.filter((a) => Math.max(a.startIndex, e) <= Math.min(a.endIndex, n - 1)).map((a) => ({
  14349. ...a,
  14350. startIndex: Math.max(a.startIndex, e),
  14351. endIndex: Math.min(a.endIndex, n - 1)
  14352. })).map((a) => ({
  14353. ...a,
  14354. startIndex: a.startIndex - e,
  14355. endIndex: a.endIndex - e
  14356. })),
  14357. leftOffset: 0,
  14358. rightOffset: 0
  14359. };
  14360. }
  14361. function Wm(t, e, n) {
  14362. if (t.customDecorations == null)
  14363. return;
  14364. const { customDecorations: r = [] } = t, s = [];
  14365. return r.forEach((i) => {
  14366. if (Math.max(i.startIndex, e) <= Math.min(i.endIndex, n - 1)) {
  14367. const o = re.deepClone(i);
  14368. s.push({
  14369. ...o,
  14370. startIndex: Math.max(o.startIndex - e, 0),
  14371. endIndex: Math.min(o.endIndex, n - 1) - e
  14372. });
  14373. }
  14374. }), s;
  14375. }
  14376. function zm(t, e, n) {
  14377. return t == null || e == null ? t != null ? t : e : qu(t, e, n);
  14378. }
  14379. function Ym(t, e, n) {
  14380. if (t == null || e == null)
  14381. return t != null ? t : e;
  14382. if (e.length === 0 || t.length === 0)
  14383. return t;
  14384. if (e.length > 1 || t.length > 1)
  14385. throw new Error("Cannot cover multiple customRanges");
  14386. return n === Pe.REPLACE ? [{
  14387. ...t[0]
  14388. }] : [{
  14389. ...e[0],
  14390. ...t[0]
  14391. }];
  14392. }
  14393. function Vm(t, e, n) {
  14394. return e.length === 0 || t.length === 0 || n === Pe.REPLACE ? t : [
  14395. ...t,
  14396. ...e.filter((r) => !t.some((s) => r.id === s.id))
  14397. ];
  14398. }
  14399. function ha(t, e, n = Pe.COVER) {
  14400. if (e.dataStream !== "")
  14401. throw new Error("Cannot compose other body with non-empty dataStream");
  14402. const r = {
  14403. dataStream: t.dataStream
  14404. }, {
  14405. textRuns: s,
  14406. paragraphs: i = [],
  14407. customRanges: o,
  14408. customDecorations: a = []
  14409. } = t, {
  14410. textRuns: u,
  14411. paragraphs: c = [],
  14412. customRanges: l,
  14413. customDecorations: h = []
  14414. } = e;
  14415. r.textRuns = zm(u, s, n), r.customRanges = Ym(l, o, n);
  14416. const d = Vm(h, a, n);
  14417. d.length && (r.customDecorations = d);
  14418. const f = [];
  14419. let E = 0, R = 0;
  14420. for (; E < i.length && R < c.length; ) {
  14421. const O = i[E], U = c[R], { startIndex: ne } = O, { startIndex: X } = U;
  14422. ne === X ? (f.push(re.deepMerge(O, U)), E++, R++) : ne < X ? (f.push(re.deepClone(O)), E++) : (f.push(re.deepClone(U)), R++);
  14423. }
  14424. return E < i.length && f.push(...i.slice(E)), R < c.length && f.push(...c.slice(R)), f.length && (r.paragraphs = f), r;
  14425. }
  14426. function Gm(t) {
  14427. const { body: e } = t;
  14428. if (e == null)
  14429. return true;
  14430. const { textRuns: n, paragraphs: r, customRanges: s, customBlocks: i, customDecorations: o, tables: a } = e;
  14431. return n == null && r == null && s == null && i == null && o == null && a == null;
  14432. }
  14433. var Bn = class {
  14434. constructor(e) {
  14435. C(this, "_index", 0);
  14436. C(this, "_offset", 0);
  14437. this._actions = e;
  14438. }
  14439. hasNext() {
  14440. return this.peekLength() < Number.POSITIVE_INFINITY;
  14441. }
  14442. next(e) {
  14443. e || (e = Number.POSITIVE_INFINITY);
  14444. const n = this._actions[this._index];
  14445. if (n) {
  14446. const r = this._offset, s = n.len;
  14447. return e >= s - r ? (e = s - r, this._index += 1, this._offset = 0) : this._offset += e, n.t === ce.DELETE || n.t === ce.RETAIN && n.body == null ? re.deepClone({
  14448. ...n,
  14449. len: e
  14450. }) : re.deepClone({
  14451. ...n,
  14452. len: e,
  14453. body: Dt(n.body, r, r + e, false)
  14454. });
  14455. } else
  14456. return {
  14457. t: ce.RETAIN,
  14458. len: Number.POSITIVE_INFINITY
  14459. };
  14460. }
  14461. peek() {
  14462. return this._actions[this._index];
  14463. }
  14464. peekLength() {
  14465. return this._actions[this._index] ? this._actions[this._index].len - this._offset : Number.POSITIVE_INFINITY;
  14466. }
  14467. peekType() {
  14468. const e = this._actions[this._index];
  14469. return e ? e.t : ce.RETAIN;
  14470. }
  14471. rest() {
  14472. if (this.hasNext()) {
  14473. if (this._offset === 0)
  14474. return this._actions.slice(this._index);
  14475. {
  14476. const e = this._offset, n = this._index, r = this.next(), s = this._actions.slice(this._index);
  14477. return this._offset = e, this._index = n, [r].concat(s);
  14478. }
  14479. } else
  14480. return [];
  14481. }
  14482. };
  14483. var lr = class {
  14484. constructor() {
  14485. C(this, "cursor", 0);
  14486. }
  14487. reset() {
  14488. return this.cursor = 0, this;
  14489. }
  14490. moveCursor(e) {
  14491. this.cursor += e;
  14492. }
  14493. moveCursorTo(e) {
  14494. this.cursor = e;
  14495. }
  14496. };
  14497. function Km(t, e, n) {
  14498. const { dataStream: r } = t, s = n, i = n + e, o = Ku(t, e, n), a = Xu(t, e, n), u = Ju(t, e, n), c = Zu(t, e, n), l = Qu(t, e, n), h = Sm(t, e, n), d = Am(t, e, n);
  14499. let f = "";
  14500. return r && (t.dataStream = pp(r, s, i), f = r.slice(s, i)), {
  14501. dataStream: f,
  14502. textRuns: o,
  14503. paragraphs: a,
  14504. sectionBreaks: u,
  14505. customBlocks: c,
  14506. tables: l,
  14507. customRanges: h,
  14508. customDecorations: d
  14509. };
  14510. }
  14511. function Xm(t, e, n, r) {
  14512. t.dataStream = gp(t.dataStream, r, e.dataStream), ju(t, e, n, r), Hu(t, e, n, r), Wu(t, e, n, r), zu(t, e, n, r), Yu(t, e, n, r), Om(t, e, n, r), bm(t, e, n, r);
  14513. }
  14514. function Jm(t, e, n, r, s = Pe.COVER) {
  14515. return Mm(t, e, n, r, s);
  14516. }
  14517. function Zm(t, e, n) {
  14518. return e <= 0 ? { dataStream: "" } : Km(t, e, n);
  14519. }
  14520. function Qm(t, e, n, r) {
  14521. n !== 0 && Xm(t, e, n, r);
  14522. }
  14523. function qm(t, e) {
  14524. const n = new lr();
  14525. return n.reset(), e.forEach((r) => {
  14526. const s = re.deepClone(r);
  14527. switch (s.t) {
  14528. case ce.RETAIN: {
  14529. const { coverType: i, body: o, len: a } = s;
  14530. o != null && Jm(t, o, a, n.cursor, i), n.moveCursor(a);
  14531. break;
  14532. }
  14533. case ce.INSERT: {
  14534. const { body: i, len: o } = s;
  14535. Qm(t, i, o, n.cursor), n.moveCursor(o);
  14536. break;
  14537. }
  14538. case ce.DELETE: {
  14539. const { len: i } = s;
  14540. Zm(t, i, n.cursor);
  14541. break;
  14542. }
  14543. default:
  14544. throw new Error(`Unknown action type for action: ${s}.`);
  14545. }
  14546. }), t;
  14547. }
  14548. function e_(t, e, n, r, s) {
  14549. if (t == null || e == null)
  14550. return e;
  14551. if (t.length === 0 || e.length === 0)
  14552. return [];
  14553. e = re.deepClone(e), t = re.deepClone(t);
  14554. const i = [], o = e.length, a = t.length;
  14555. let u = 0, c = 0, l = null;
  14556. function h() {
  14557. return l ? (i.push(l), l = null, true) : false;
  14558. }
  14559. for (; u < o && c < a; ) {
  14560. const { st: R, ed: O, ts: U } = e[u], { st: ne, ed: X, ts: de, sId: T } = t[c];
  14561. let A = {};
  14562. if (s === 0)
  14563. A = { ...U }, n === Pe.COVER && r === Pe.REPLACE && de && (A = Object.assign({}, de, A));
  14564. else if (A = { ...U }, n === Pe.REPLACE) {
  14565. if (r === Pe.REPLACE)
  14566. A = { ...de };
  14567. else if (U && de) {
  14568. const H = Object.keys(U);
  14569. for (const Z of H)
  14570. de[Z] && delete A[Z];
  14571. }
  14572. } else if (r === Pe.REPLACE) {
  14573. if (de) {
  14574. const H = Object.keys(de);
  14575. for (const Z of H)
  14576. de[Z] !== void 0 && (A[Z] = de[Z]);
  14577. }
  14578. } else if (de) {
  14579. const H = Object.keys(de);
  14580. for (const Z of H)
  14581. A[Z] !== void 0 && delete A[Z];
  14582. }
  14583. if (O < ne)
  14584. h() || i.push(e[u]), u++;
  14585. else if (X < R)
  14586. h() || i.push(t[c]), c++;
  14587. else {
  14588. const H = {
  14589. st: Math.min(R, ne),
  14590. ed: Math.max(R, ne),
  14591. ts: R < ne ? { ...U } : { ...de },
  14592. sId: R < ne ? void 0 : T
  14593. };
  14594. H.ed > H.st && i.push(), i.push({
  14595. st: Math.max(R, ne),
  14596. ed: Math.min(O, X),
  14597. ts: A,
  14598. sId: T
  14599. }), O < X ? (u++, t[c].st = O, t[c].st === t[c].ed && c++) : (c++, e[u].st = X, e[u].st === e[u].ed && u++);
  14600. const Z = {
  14601. st: Math.min(O, X),
  14602. ed: Math.max(O, X),
  14603. ts: O < X ? { ...de } : { ...U },
  14604. sId: O < X ? T : void 0
  14605. };
  14606. l = Z.ed > Z.st ? Z : null;
  14607. }
  14608. }
  14609. h();
  14610. const d = i[i.length - 1], f = e[o - 1], E = t[a - 1];
  14611. return d.ed !== Math.max(f.ed, E.ed) && (f.ed > E.ed ? i.push(f) : i.push(E)), _s(i, true);
  14612. }
  14613. function t_(t, e, n, r, s) {
  14614. if (t == null || e == null)
  14615. return e;
  14616. if (t.length === 0 || e.length === 0)
  14617. return [];
  14618. if (t.length > 1 || e.length > 1)
  14619. throw new Error("CustomRanges is only supported transform for length one now.");
  14620. const i = t[0], o = e[0];
  14621. if (n === Pe.REPLACE)
  14622. return s === 1 ? [re.deepClone(i)] : [re.deepClone(o)];
  14623. if (r === Pe.REPLACE) {
  14624. const a = re.deepClone(o);
  14625. return s === 1 && Object.assign(a, re.deepClone(i)), [a];
  14626. } else {
  14627. const a = re.deepClone(o);
  14628. return s === 1 && Object.assign(a, re.deepClone(i)), [a];
  14629. }
  14630. }
  14631. function da(t, e, n, r, s) {
  14632. const i = {
  14633. startIndex: e.startIndex
  14634. };
  14635. if (e.paragraphStyle && (i.paragraphStyle = re.deepClone(e.paragraphStyle), t.paragraphStyle)) {
  14636. if (n === Pe.REPLACE)
  14637. if (r === Pe.REPLACE)
  14638. s === 1 && (i.paragraphStyle = {
  14639. ...t.paragraphStyle
  14640. });
  14641. else if (s === 1) {
  14642. const o = Object.keys(t.paragraphStyle);
  14643. for (const a of o)
  14644. t.paragraphStyle[a] !== void 0 && (i.paragraphStyle[a] = t.paragraphStyle[a]);
  14645. } else {
  14646. const o = Object.keys(t.paragraphStyle);
  14647. for (const a of o)
  14648. i.paragraphStyle[a] === void 0 && (i.paragraphStyle[a] = t.paragraphStyle[a]);
  14649. }
  14650. else if (r === Pe.REPLACE)
  14651. if (s === 1) {
  14652. const o = Object.keys(t.paragraphStyle);
  14653. for (const a of o)
  14654. t.paragraphStyle[a] !== void 0 && (i.paragraphStyle[a] = t.paragraphStyle[a]);
  14655. } else {
  14656. const o = Object.keys(t.paragraphStyle);
  14657. for (const a of o)
  14658. i.paragraphStyle[a] === void 0 && (i.paragraphStyle[a] = t.paragraphStyle[a]);
  14659. }
  14660. else if (s === 1) {
  14661. const o = Object.keys(t.paragraphStyle);
  14662. for (const a of o)
  14663. i.paragraphStyle[a] && delete i.paragraphStyle[a];
  14664. }
  14665. }
  14666. return n === Pe.REPLACE && r === Pe.REPLACE ? i.bullet = s === 1 ? re.deepClone(t.bullet) : re.deepClone(e.bullet) : t.bullet === void 0 ? i.bullet = re.deepClone(e.bullet) : n === Pe.REPLACE || r === Pe.REPLACE ? i.bullet = s === 0 && e.bullet ? re.deepClone(e.bullet) : re.deepClone(t.bullet) : s === 0 && e.bullet !== void 0 && (i.bullet = re.deepClone(e.bullet)), i;
  14667. }
  14668. function n_(t, e) {
  14669. if (t == null || e == null)
  14670. return e;
  14671. if (t.length === 0 || e.length === 0)
  14672. return re.deepClone(e);
  14673. const n = [];
  14674. for (const r of e) {
  14675. const { id: s, type: i } = r;
  14676. let o = false;
  14677. for (const a of t)
  14678. if (a.id === s) {
  14679. (a.type === An.DELETED || i === An.DELETED) && (o = true, n.push({
  14680. ...r,
  14681. type: An.DELETED
  14682. }));
  14683. break;
  14684. }
  14685. o || n.push(r);
  14686. }
  14687. return n;
  14688. }
  14689. function r_(t, e, n = false) {
  14690. const { body: r, coverType: s = Pe.COVER } = t, { body: i, coverType: o = Pe.COVER } = e;
  14691. if (r == null || r.dataStream !== "" || i == null || i.dataStream !== "")
  14692. throw new Error("Data stream is not supported in retain transform.");
  14693. const a = {
  14694. dataStream: ""
  14695. }, u = o, {
  14696. textRuns: c,
  14697. paragraphs: l = [],
  14698. customRanges: h,
  14699. customDecorations: d
  14700. } = r, {
  14701. textRuns: f,
  14702. paragraphs: E = [],
  14703. customRanges: R,
  14704. customDecorations: O
  14705. } = i, U = e_(
  14706. c,
  14707. f,
  14708. s,
  14709. o,
  14710. n ? 1 : 0
  14711. /* COVER */
  14712. );
  14713. U && (a.textRuns = U);
  14714. const ne = t_(
  14715. h,
  14716. R,
  14717. s,
  14718. o,
  14719. n ? 1 : 0
  14720. /* COVER */
  14721. );
  14722. ne && (a.customRanges = ne);
  14723. const X = n_(
  14724. d,
  14725. O
  14726. );
  14727. X && (a.customDecorations = X);
  14728. const de = [];
  14729. let T = 0, A = 0;
  14730. for (; T < l.length && A < E.length; ) {
  14731. const H = l[T], Z = E[A], { startIndex: fe } = H, { startIndex: ae } = Z;
  14732. if (fe === ae) {
  14733. let m = {
  14734. startIndex: fe
  14735. };
  14736. n ? m = da(
  14737. H,
  14738. Z,
  14739. s,
  14740. o,
  14741. 1
  14742. /* COVER_ONLY_NOT_EXISTED */
  14743. ) : m = da(
  14744. H,
  14745. Z,
  14746. s,
  14747. o,
  14748. 0
  14749. /* COVER */
  14750. ), de.push(m), T++, A++;
  14751. } else
  14752. fe < ae ? T++ : (de.push(re.deepClone(Z)), A++);
  14753. }
  14754. return A < E.length && de.push(...E.slice(A)), de.length && (a.paragraphs = de), {
  14755. coverType: u,
  14756. body: a
  14757. };
  14758. }
  14759. function fa(t) {
  14760. return Object.keys(t).length === 1;
  14761. }
  14762. var wn = class wn2 {
  14763. constructor() {
  14764. C(this, "_actions", []);
  14765. }
  14766. static apply(e, n) {
  14767. return qm(e, n);
  14768. }
  14769. // eslint-disable-next-line complexity
  14770. static compose(e, n) {
  14771. const r = new Bn(e), s = new Bn(n), i = new wn2();
  14772. for (; r.hasNext() || s.hasNext(); )
  14773. if (s.peekType() === ce.INSERT)
  14774. i.push(s.next());
  14775. else if (r.peekType() === ce.DELETE)
  14776. i.push(r.next());
  14777. else {
  14778. const o = Math.min(r.peekLength(), s.peekLength()), a = r.next(o), u = s.next(o);
  14779. if (a.t === ce.INSERT && u.t === ce.RETAIN)
  14780. u.body == null ? i.push(a) : i.push({
  14781. ...a,
  14782. body: ha(a.body, u.body, u.coverType)
  14783. });
  14784. else if (a.t === ce.RETAIN && u.t === ce.RETAIN)
  14785. if (a.body == null && u.body == null)
  14786. i.push(a.len !== Number.POSITIVE_INFINITY ? a : u);
  14787. else if (a.body && u.body) {
  14788. const c = a.coverType === Pe.REPLACE || u.coverType === Pe.REPLACE ? Pe.REPLACE : Pe.COVER;
  14789. i.push({
  14790. ...a,
  14791. t: ce.RETAIN,
  14792. coverType: c,
  14793. body: ha(a.body, u.body, u.coverType)
  14794. });
  14795. } else
  14796. i.push(a.body ? a : u);
  14797. else
  14798. a.t === ce.RETAIN && u.t === ce.DELETE ? i.push(u) : a.t === ce.INSERT && (u.t, ce.DELETE);
  14799. }
  14800. return i.trimEndUselessRetainAction(), i.serialize();
  14801. }
  14802. /**
  14803. * |(this↓ \| other→) | **insert** | **retain** | **delete** |
  14804. * | ---------------- | ---------- | ---------- | ---------- |
  14805. * | **insert** | Case 1 | Case 2 | Case 2 |
  14806. * | **retain** | Case 1 | Case 5 | Case 4 |
  14807. * | **delete** | Case 1 | Case 3 | Case 3 |
  14808. *
  14809. * Case 1: When the other action type is an insert operation,
  14810. * the insert operation is retained regardless of the type of action this action
  14811. * Case 2: When this action type is an insert operation and the other action type is a
  14812. * non-insert operation, you need to retain the length of this action insert
  14813. * Case 3: When this action is a delete operation, there are two scenarios:
  14814. * 1) When other is a delete operation, since it is a delete operation, this has
  14815. * already been deleted, so the target does not need to be in delete, and it can
  14816. * be continued directly
  14817. * 2) When other is the retain operation, although this action delete occurs first,
  14818. * the delete priority is higher, so the delete operation is retained, and the origin
  14819. * delete has been applied, so it is directly continued
  14820. * Case 4: other is the delete operation, this is the retain operation, and the target delete operation
  14821. * is kept
  14822. * Case 5: When both other and this are retain operations
  14823. * 1) If the other body attribute does not exist, directly retain length
  14824. * 2) If the other body property exists, then execute the TransformBody logic to override it
  14825. */
  14826. // priority - if true, this actions takes priority over other, that is, this actions are considered to happen "first".
  14827. // thisActions is the target action.
  14828. static transform(e, n, r = "right") {
  14829. return this._transform(n, e, r === "left" ? "right" : "left");
  14830. }
  14831. // otherActions is the actions to be transformed.
  14832. static _transform(e, n, r = "right") {
  14833. const s = new Bn(e), i = new Bn(n), o = new wn2();
  14834. for (; s.hasNext() || i.hasNext(); )
  14835. if (s.peekType() === ce.INSERT && (r === "left" || i.peekType() !== ce.INSERT)) {
  14836. const a = s.next();
  14837. o.retain(a.len);
  14838. } else if (i.peekType() === ce.INSERT)
  14839. o.push(i.next());
  14840. else {
  14841. const a = Math.min(s.peekLength(), i.peekLength()), u = s.next(a), c = i.next(a);
  14842. if (u.t === ce.DELETE)
  14843. continue;
  14844. if (c.t === ce.DELETE) {
  14845. o.push(c);
  14846. continue;
  14847. }
  14848. if (u.body == null || c.body == null)
  14849. o.push(c);
  14850. else {
  14851. const { coverType: l, body: h } = r_(u, c, r === "left");
  14852. o.push({
  14853. ...c,
  14854. t: ce.RETAIN,
  14855. coverType: l,
  14856. body: h
  14857. });
  14858. }
  14859. }
  14860. return o.trimEndUselessRetainAction(), o.serialize();
  14861. }
  14862. /**
  14863. * Used to transform selection. Why not named transformSelection?
  14864. * Because Univer Doc supports multiple Selections in one document, user need to encapsulate transformSelections at the application layer.
  14865. */
  14866. static transformPosition(e, n, r = false) {
  14867. const s = new Bn(e);
  14868. let i = 0;
  14869. for (; s.hasNext() && i <= n; ) {
  14870. const o = s.peekLength(), a = s.peekType();
  14871. if (s.next(), a === ce.DELETE) {
  14872. n -= Math.min(o, n - i);
  14873. continue;
  14874. } else
  14875. a === ce.INSERT && (i < n || !r) && (n += o);
  14876. i += o;
  14877. }
  14878. return n;
  14879. }
  14880. static isNoop(e) {
  14881. return e.length === 0;
  14882. }
  14883. static invert(e) {
  14884. const n = [];
  14885. for (const r of e)
  14886. if (r.t === ce.INSERT)
  14887. n.push({
  14888. t: ce.DELETE,
  14889. len: r.len,
  14890. body: r.body
  14891. });
  14892. else if (r.t === ce.DELETE) {
  14893. if (r.body == null)
  14894. throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");
  14895. n.push({
  14896. t: ce.INSERT,
  14897. body: r.body,
  14898. len: r.len
  14899. });
  14900. } else if (r.body != null) {
  14901. if (r.oldBody == null)
  14902. throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");
  14903. n.push({
  14904. t: ce.RETAIN,
  14905. body: r.oldBody,
  14906. oldBody: r.body,
  14907. len: r.len,
  14908. coverType: Pe.REPLACE
  14909. });
  14910. } else
  14911. n.push(r);
  14912. return n;
  14913. }
  14914. static makeInvertible(e, n) {
  14915. const r = [];
  14916. let s = 0;
  14917. for (const i of e) {
  14918. if (i.t === ce.DELETE && (i.body == null || i.body && i.body.dataStream.length !== i.len)) {
  14919. const o = Dt(n, s, s + i.len, false);
  14920. i.len = o.dataStream.length, i.body = o;
  14921. }
  14922. if (i.t === ce.RETAIN && i.body != null) {
  14923. const o = Dt(n, s, s + i.len, true);
  14924. i.oldBody = {
  14925. ...o,
  14926. dataStream: ""
  14927. }, i.len = o.dataStream.length;
  14928. }
  14929. r.push(i), i.t !== ce.INSERT && (s += i.len);
  14930. }
  14931. return r;
  14932. }
  14933. insert(e, n) {
  14934. const r = {
  14935. t: ce.INSERT,
  14936. body: n,
  14937. len: e
  14938. };
  14939. return this.push(r), this;
  14940. }
  14941. retain(e, n, r) {
  14942. const s = {
  14943. t: ce.RETAIN,
  14944. len: e
  14945. };
  14946. return n != null && (s.body = n), r != null && (s.coverType = r), this.push(s), this;
  14947. }
  14948. delete(e) {
  14949. const n = {
  14950. t: ce.DELETE,
  14951. len: e
  14952. };
  14953. return this.push(n), this;
  14954. }
  14955. empty() {
  14956. return this._actions = [], this;
  14957. }
  14958. serialize() {
  14959. return this._actions;
  14960. }
  14961. // eslint-disable-next-line complexity
  14962. push(...e) {
  14963. if (e.length > 1) {
  14964. for (const i of e)
  14965. this.push(i);
  14966. return this;
  14967. }
  14968. let n = this._actions.length, r = this._actions[n - 1];
  14969. const s = re.deepClone(e[0]);
  14970. if (s.t === ce.RETAIN && s.len === 0 && s.body == null)
  14971. return this;
  14972. if (typeof r == "object") {
  14973. if (r.t === ce.DELETE && s.t === ce.DELETE)
  14974. return r.len += s.len, this;
  14975. if (r.t === ce.DELETE && s.t === ce.INSERT && (n -= 1, r = this._actions[n - 1], r == null))
  14976. return this._actions.unshift(s), this;
  14977. if (r.t === ce.RETAIN && s.t === ce.RETAIN && r.body == null && s.body == null)
  14978. return r.len += s.len, this;
  14979. if (r.t === ce.INSERT && fa(r.body) && s.t === ce.INSERT && fa(s.body))
  14980. return r.len += s.len, r.body.dataStream += s.body.dataStream, this;
  14981. }
  14982. return n === this._actions.length ? this._actions.push(s) : this._actions.splice(n, 0, s), this;
  14983. }
  14984. trimEndUselessRetainAction() {
  14985. let e = this._actions[this._actions.length - 1];
  14986. for (; e && e.t === ce.RETAIN && Gm(e); )
  14987. this._actions.pop(), e = this._actions[this._actions.length - 1];
  14988. return this;
  14989. }
  14990. };
  14991. C(wn, "id", "text-x"), C(wn, "uri", "https://github.com/dream-num/univer#text-x");
  14992. var Ke = wn;
  14993. Object.defineProperty(Ke, "name", {
  14994. value: "text-x"
  14995. });
  14996. var On = class On2 {
  14997. static registerSubtype(e) {
  14998. var n;
  14999. e == null || this._subTypes.has(e.name) && ((n = this._subTypes.get(e.name)) == null ? void 0 : n.id) !== Ke.id || (this._subTypes.set(e.name, e), mt.type.registerSubtype(e));
  15000. }
  15001. static apply(e, n) {
  15002. if (!mt.type.isNoop(n))
  15003. return mt.type.apply(e, n);
  15004. }
  15005. static compose(e, n) {
  15006. return mt.type.compose(e, n);
  15007. }
  15008. static transform(e, n, r) {
  15009. return mt.type.transform(e, n, r);
  15010. }
  15011. // Use to transform cursor position, just call TextXPro.transformPosition.
  15012. static transformPosition(e, n, r = "right") {
  15013. return e && e.length === 2 && e[0] === "body" && e[1].et === Ke.name ? Ke.transformPosition(e[1].e, n, r === "left") : n;
  15014. }
  15015. static invertWithDoc(e, n) {
  15016. return mt.type.invertWithDoc(e, n);
  15017. }
  15018. static isNoop(e) {
  15019. return mt.type.isNoop(e);
  15020. }
  15021. static getInstance() {
  15022. return this._instance == null && (this._instance = new On2()), this._instance;
  15023. }
  15024. // eslint-disable-next-line ts/no-explicit-any
  15025. removeOp(e, n) {
  15026. return mt.removeOp(e, n);
  15027. }
  15028. moveOp(e, n) {
  15029. return mt.moveOp(e, n);
  15030. }
  15031. // eslint-disable-next-line ts/no-explicit-any
  15032. insertOp(e, n) {
  15033. return mt.insertOp(e, n);
  15034. }
  15035. // eslint-disable-next-line ts/no-explicit-any
  15036. replaceOp(e, n, r) {
  15037. return mt.replaceOp(e, n, r);
  15038. }
  15039. editOp(e, n = ["body"]) {
  15040. return mt.editOp(n, Ke.name, e);
  15041. }
  15042. };
  15043. C(On, "uri", "https://github.com/dream-num/univer#json-x"), C(On, "_subTypes", /* @__PURE__ */ new Map()), C(On, "_instance", null);
  15044. var tn = On;
  15045. tn.registerSubtype(Ke);
  15046. var tl = {
  15047. id: "default_doc",
  15048. documentStyle: {}
  15049. };
  15050. var s_ = class extends Ui {
  15051. constructor(n) {
  15052. var r;
  15053. super();
  15054. C(this, "type", Fe.UNIVER_DOC);
  15055. C(this, "_name$", new BehaviorSubject(""));
  15056. C(this, "name$", this._name$.asObservable());
  15057. C(this, "snapshot");
  15058. this.snapshot = { ...tl, ...n }, this._name$.next((r = this.snapshot.title) != null ? r : "No Title");
  15059. }
  15060. getUnitId() {
  15061. throw new Error("Method not implemented.");
  15062. }
  15063. getRev() {
  15064. var n;
  15065. return (n = this.snapshot.rev) != null ? n : 1;
  15066. }
  15067. incrementRev() {
  15068. this.snapshot.rev = this.getRev() + 1;
  15069. }
  15070. setRev(n) {
  15071. this.snapshot.rev = n;
  15072. }
  15073. setName(n) {
  15074. this.snapshot.title = n, this._name$.next(n);
  15075. }
  15076. get drawings() {
  15077. return this.snapshot.drawings;
  15078. }
  15079. get documentStyle() {
  15080. return this.snapshot.documentStyle;
  15081. }
  15082. get lists() {
  15083. return this.snapshot.lists;
  15084. }
  15085. get zoomRatio() {
  15086. var n;
  15087. return ((n = this.snapshot.settings) == null ? void 0 : n.zoomRatio) || 1;
  15088. }
  15089. resetDrawing(n, r) {
  15090. this.snapshot.drawings = n, this.snapshot.drawingsOrder = r;
  15091. }
  15092. getBody() {
  15093. return this.snapshot.body;
  15094. }
  15095. getSnapshot() {
  15096. return this.snapshot;
  15097. }
  15098. getBulletPresetList() {
  15099. var s;
  15100. const n = (s = this.snapshot.lists) != null ? s : {};
  15101. return {
  15102. ...Es,
  15103. ...n
  15104. };
  15105. }
  15106. updateDocumentId(n) {
  15107. this.snapshot.id = n;
  15108. }
  15109. updateDocumentRenderConfig(n) {
  15110. const { documentStyle: r } = this.snapshot;
  15111. r.renderConfig == null ? r.renderConfig = n : r.renderConfig = {
  15112. ...r.renderConfig,
  15113. ...n
  15114. };
  15115. }
  15116. updateDocumentStyle(n) {
  15117. this.snapshot.documentStyle == null ? this.snapshot.documentStyle = n : this.snapshot.documentStyle = {
  15118. ...this.snapshot.documentStyle,
  15119. ...n
  15120. };
  15121. }
  15122. updateDocumentDataMargin(n) {
  15123. const { t: r, l: s, b: i, r: o } = n, { documentStyle: a } = this.snapshot;
  15124. r != null && (a.marginTop = r), s != null && (a.marginLeft = s), i != null && (a.marginBottom = i), o != null && (a.marginRight = o);
  15125. }
  15126. updateDocumentDataPageSize(n, r) {
  15127. const { documentStyle: s } = this.snapshot;
  15128. if (!s.pageSize) {
  15129. n = n != null ? n : Number.POSITIVE_INFINITY, r = r != null ? r : Number.POSITIVE_INFINITY, s.pageSize = {
  15130. width: n,
  15131. height: r
  15132. };
  15133. return;
  15134. }
  15135. n !== void 0 && (s.pageSize.width = n), r !== void 0 && (s.pageSize.height = r);
  15136. }
  15137. updateDrawing(n, r) {
  15138. const { drawings: s } = this, { width: i, height: o, left: a, top: u } = r, c = s == null ? void 0 : s[n];
  15139. if (!c)
  15140. return;
  15141. const l = c.docTransform;
  15142. l.size.width = i, l.size.height = o, l.positionH.posOffset = a, l.positionV.posOffset = u;
  15143. }
  15144. setZoomRatio(n = 1) {
  15145. this.snapshot.settings == null ? this.snapshot.settings = {
  15146. zoomRatio: n
  15147. } : this.snapshot.settings.zoomRatio = 1;
  15148. }
  15149. };
  15150. var jt = class _jt extends s_ {
  15151. constructor(n) {
  15152. var s, i;
  15153. super(re.isEmptyObject(n) ? _m() : n);
  15154. C(this, "_unitId");
  15155. C(this, "headerModelMap", /* @__PURE__ */ new Map());
  15156. C(this, "footerModelMap", /* @__PURE__ */ new Map());
  15157. C(this, "change$", new BehaviorSubject(0));
  15158. const r = 6;
  15159. this._unitId = (s = this.snapshot.id) != null ? s : re.generateRandomId(r), this._initializeHeaderFooterModel(), this._name$.next((i = this.snapshot.title) != null ? i : "");
  15160. }
  15161. dispose() {
  15162. super.dispose(), this.headerModelMap.forEach((n) => {
  15163. n.dispose();
  15164. }), this.footerModelMap.forEach((n) => {
  15165. n.dispose();
  15166. }), this._name$.complete();
  15167. }
  15168. getDrawings() {
  15169. return this.snapshot.drawings;
  15170. }
  15171. getDrawingsOrder() {
  15172. return this.snapshot.drawingsOrder;
  15173. }
  15174. getCustomRanges() {
  15175. var n;
  15176. return (n = this.snapshot.body) == null ? void 0 : n.customRanges;
  15177. }
  15178. getCustomDecorations() {
  15179. var n;
  15180. return (n = this.snapshot.body) == null ? void 0 : n.customDecorations;
  15181. }
  15182. getSettings() {
  15183. return this.snapshot.settings;
  15184. }
  15185. // TODO: @JOCS do not use reset, please use apply to modify the snapshot.
  15186. reset(n) {
  15187. if (n.id && n.id !== this._unitId)
  15188. throw new Error("Cannot reset a document model with a different unit id!");
  15189. this.snapshot = { ...tl, ...n }, this._initializeHeaderFooterModel(), this.change$.next(this.change$.value + 1);
  15190. }
  15191. getSelfOrHeaderFooterModel(n) {
  15192. if (n != null) {
  15193. if (this.headerModelMap.has(n))
  15194. return this.headerModelMap.get(n);
  15195. if (this.footerModelMap.has(n))
  15196. return this.footerModelMap.get(n);
  15197. }
  15198. return this;
  15199. }
  15200. getUnitId() {
  15201. return this._unitId;
  15202. }
  15203. apply(n) {
  15204. if (!tn.isNoop(n))
  15205. return this.snapshot = tn.apply(this.snapshot, n), n != null && n.some((r) => Array.isArray(r) && ((r == null ? void 0 : r[0]) === "headers" || (r == null ? void 0 : r[0]) === "footers")) && (this.headerModelMap.clear(), this.footerModelMap.clear(), this._initializeHeaderFooterModel()), this.change$.next(this.change$.value + 1), this.snapshot;
  15206. }
  15207. sliceBody(n, r, s = el.copy) {
  15208. const i = this.getBody();
  15209. if (i != null)
  15210. return Dt(i, n, r, false, s);
  15211. }
  15212. _initializeHeaderFooterModel() {
  15213. const { headers: n, footers: r } = this.getSnapshot();
  15214. if (n)
  15215. for (const s in n) {
  15216. const i = n[s];
  15217. this.headerModelMap.set(s, new _jt(i)), this.headerModelMap.get(s).updateDocumentId(this.getUnitId());
  15218. }
  15219. if (r)
  15220. for (const s in r) {
  15221. const i = r[s];
  15222. this.footerModelMap.set(s, new _jt(i)), this.footerModelMap.get(s).updateDocumentId(this.getUnitId());
  15223. }
  15224. }
  15225. updateDocumentId(n) {
  15226. super.updateDocumentId(n), this._unitId = n;
  15227. }
  15228. };
  15229. function i_(t) {
  15230. const { ranges: e, id: n, type: r } = t, s = new Ke();
  15231. let i = 0;
  15232. for (let o = 0; o < e.length; o++) {
  15233. const a = e[o], { startOffset: u, endOffset: c } = a;
  15234. u > 0 && s.push({
  15235. t: ce.RETAIN,
  15236. len: u - i
  15237. }), s.push({
  15238. t: ce.RETAIN,
  15239. body: {
  15240. dataStream: "",
  15241. customDecorations: [{
  15242. id: n,
  15243. type: r,
  15244. startIndex: 0,
  15245. endIndex: c - u - 1
  15246. }]
  15247. },
  15248. len: c - u
  15249. }), i = c;
  15250. }
  15251. return s;
  15252. }
  15253. function o_(t) {
  15254. var l, h, d;
  15255. const { id: e, segmentId: n, documentDataModel: r } = t, s = r == null ? void 0 : r.getBody();
  15256. if (!r || !s)
  15257. return false;
  15258. const i = (d = (h = (l = r.getSelfOrHeaderFooterModel(n)) == null ? void 0 : l.getBody()) == null ? void 0 : h.customDecorations) == null ? void 0 : d.find((f) => f.id === e);
  15259. if (!i)
  15260. return false;
  15261. const o = new Ke(), { startIndex: a, endIndex: u } = i, c = u - a + 1;
  15262. return o.push({
  15263. t: ce.RETAIN,
  15264. len: a
  15265. }), o.push({
  15266. t: ce.RETAIN,
  15267. len: c,
  15268. body: {
  15269. dataStream: "",
  15270. customDecorations: [
  15271. {
  15272. startIndex: 0,
  15273. endIndex: c - 1,
  15274. id: e,
  15275. type: An.DELETED
  15276. }
  15277. ]
  15278. }
  15279. }), o;
  15280. }
  15281. function nl(t, e, n, r) {
  15282. return t <= n && e >= n || t >= n && t <= r;
  15283. }
  15284. function a_(t, e) {
  15285. const n = [];
  15286. for (let r = 0, s = e.length; r < s; r++) {
  15287. const i = e[r];
  15288. t.collapsed ? i.startIndex < t.startOffset && t.startOffset <= i.endIndex && n.push(i) : nl(t.startOffset, t.endOffset - 1, i.startIndex, i.endIndex) && n.push(i);
  15289. }
  15290. return n;
  15291. }
  15292. function u_(t) {
  15293. return {
  15294. ...re.deepClone(t),
  15295. rangeId: qt()
  15296. };
  15297. }
  15298. function l_(t, e) {
  15299. const n = [];
  15300. let r = t[0];
  15301. for (const s of e)
  15302. s < t[0] || s > t[1] || (r < s && n.push([r, s - 1]), r = s + 1);
  15303. return r <= t[1] && n.push([r, t[1]]), n;
  15304. }
  15305. function rl(t, e, n, r) {
  15306. const s = [];
  15307. for (let i = 0, o = n.length; i < o; i++) {
  15308. const a = n[i];
  15309. if ((r === void 0 || a.rangeType === r) && Math.max(a.startIndex, t) <= Math.min(a.endIndex, e) && s.push({ ...a }), a.startIndex > e)
  15310. break;
  15311. }
  15312. return s;
  15313. }
  15314. function c_(t, e) {
  15315. var i, o, a, u, c;
  15316. const n = rl(t.startOffset, t.collapsed ? t.startOffset : t.endOffset - 1, (i = e.customRanges) != null ? i : []), r = Math.min(t.startOffset, (a = (o = n[0]) == null ? void 0 : o.startIndex) != null ? a : 1 / 0), s = Math.max(t.endOffset, ((c = (u = n[n.length - 1]) == null ? void 0 : u.endIndex) != null ? c : -1 / 0) + 1);
  15317. return {
  15318. startOffset: r,
  15319. endOffset: s,
  15320. collapsed: r === s
  15321. };
  15322. }
  15323. function h_(t) {
  15324. var h, d, f;
  15325. const { rangeId: e, segmentId: n, documentDataModel: r, insert: s } = t, i = (d = (h = r.getSelfOrHeaderFooterModel(n).getBody()) == null ? void 0 : h.customRanges) == null ? void 0 : d.find((E) => E.rangeId === e);
  15326. if (!i)
  15327. return false;
  15328. const { startIndex: o, endIndex: a } = i, u = new Ke(), c = a - o + 1;
  15329. u.push({
  15330. t: ce.RETAIN,
  15331. len: o
  15332. }), u.push({
  15333. t: ce.RETAIN,
  15334. len: c,
  15335. body: {
  15336. dataStream: "",
  15337. customRanges: []
  15338. }
  15339. }), s && u.push({
  15340. t: ce.INSERT,
  15341. body: s,
  15342. len: s.dataStream.length
  15343. });
  15344. const l = a + 1 + ((f = s == null ? void 0 : s.dataStream.length) != null ? f : 0);
  15345. return u.selections = [{
  15346. startOffset: l,
  15347. endOffset: l,
  15348. collapsed: true
  15349. }], u;
  15350. }
  15351. function d_(t) {
  15352. const { ranges: e, rangeId: n, rangeType: r, wholeEntity: s, properties: i, body: o } = t;
  15353. let a = 0;
  15354. const u = new Ke();
  15355. let c = false;
  15356. return e.forEach((l) => {
  15357. var X, de, T;
  15358. const h = c_(l, o);
  15359. if (!h || !o)
  15360. return false;
  15361. const { startOffset: d, endOffset: f } = h, E = (X = o.customRanges) != null ? X : [], R = (A, H, Z) => {
  15362. var y, M, b, w;
  15363. const fe = rl(A, H, E, r), ae = Math.min((M = (y = fe[0]) == null ? void 0 : y.startIndex) != null ? M : 1 / 0, A), m = Math.max((w = (b = fe[fe.length - 1]) == null ? void 0 : b.endIndex) != null ? w : -1 / 0, H), j = {
  15364. rangeId: Z ? `${n}$${Z}` : n,
  15365. rangeType: r,
  15366. startIndex: 0,
  15367. endIndex: m - ae,
  15368. wholeEntity: s,
  15369. properties: {
  15370. ...i
  15371. }
  15372. };
  15373. u.push({
  15374. t: ce.RETAIN,
  15375. len: ae - a
  15376. }), u.push({
  15377. t: ce.RETAIN,
  15378. len: m - ae + 1,
  15379. body: {
  15380. dataStream: "",
  15381. customRanges: [j]
  15382. },
  15383. coverType: Pe.COVER
  15384. }), a = m + 1;
  15385. }, O = ((de = o.paragraphs) != null ? de : []).filter((A) => A.startIndex < f && A.startIndex > d), U = ((T = o.customBlocks) != null ? T : []).filter((A) => A.startIndex < f && A.startIndex > d);
  15386. l_([d, f - 1], [...O.map((A) => A.startIndex), ...U.map((A) => A.startIndex)]).forEach(([A, H], Z) => R(A, H, Z)), c = true, u.selections = [{
  15387. startOffset: h.endOffset,
  15388. endOffset: h.endOffset,
  15389. collapsed: true
  15390. }];
  15391. }), c ? u : false;
  15392. }
  15393. function sl(t, e, n = 0, r = null, s = true) {
  15394. t.sort((c, l) => c.startOffset - l.startOffset);
  15395. const i = [], { paragraphs: o = [] } = e, a = o == null ? void 0 : o.find(
  15396. (c) => c.startIndex >= t[0].startOffset && c.startIndex < t[0].endOffset
  15397. );
  15398. let u = n;
  15399. if (t.forEach((c) => {
  15400. const { startOffset: l, endOffset: h } = c;
  15401. l > u && (i.push({
  15402. t: ce.RETAIN,
  15403. len: l - u
  15404. }), u = l), u < h && (i.push({
  15405. t: ce.DELETE,
  15406. len: h - u
  15407. }), u = h);
  15408. }), r && i.push({
  15409. t: ce.INSERT,
  15410. body: r,
  15411. len: r.dataStream.length
  15412. }), a && s) {
  15413. const c = o.find((l) => l.startIndex - n >= t[t.length - 1].endOffset - 1);
  15414. c && (c.startIndex > u && (i.push({
  15415. t: ce.RETAIN,
  15416. len: c.startIndex - u
  15417. }), u = c.startIndex), i.push({
  15418. t: ce.RETAIN,
  15419. len: 1,
  15420. body: {
  15421. dataStream: "",
  15422. paragraphs: [
  15423. {
  15424. ...c,
  15425. startIndex: 0,
  15426. bullet: a == null ? void 0 : a.bullet
  15427. }
  15428. ]
  15429. },
  15430. coverType: Pe.REPLACE
  15431. }));
  15432. }
  15433. return i;
  15434. }
  15435. function f_(t, e, n = 0) {
  15436. const r = [];
  15437. let s = n;
  15438. return t.forEach((i) => {
  15439. const { startOffset: o, endOffset: a } = i;
  15440. o > s && (r.push({
  15441. t: ce.RETAIN,
  15442. len: o - s
  15443. }), s = o), a > s && (r.push({
  15444. t: ce.RETAIN,
  15445. len: a - s,
  15446. body: {
  15447. ...re.deepClone(e),
  15448. dataStream: ""
  15449. }
  15450. }), s = a);
  15451. }), r;
  15452. }
  15453. var g_ = (t) => {
  15454. var h;
  15455. const { selection: e, body: n, doc: r } = t, s = e.segmentId, i = (h = r.getSelfOrHeaderFooterModel(s)) == null ? void 0 : h.getBody();
  15456. if (!i)
  15457. return false;
  15458. const o = e.collapsed ? null : Dt(i, e.startOffset, e.endOffset), a = ru(o ? o.dataStream : "", n.dataStream);
  15459. let u = 0;
  15460. const c = a.map(([d, f]) => {
  15461. switch (d) {
  15462. case 0: {
  15463. const E = {
  15464. t: ce.RETAIN,
  15465. body: {
  15466. ...Dt(n, u, u + f.length, false),
  15467. dataStream: ""
  15468. },
  15469. len: f.length
  15470. };
  15471. return u += f.length, E;
  15472. }
  15473. case 1: {
  15474. const E = {
  15475. t: ce.INSERT,
  15476. body: Dt(n, u, u + f.length),
  15477. len: f.length
  15478. };
  15479. return u += f.length, E;
  15480. }
  15481. default:
  15482. return {
  15483. t: ce.DELETE,
  15484. len: f.length
  15485. };
  15486. }
  15487. }), l = new Ke();
  15488. return l.push({
  15489. t: ce.RETAIN,
  15490. len: e.startOffset
  15491. }), l.push(...c), l;
  15492. };
  15493. function p_(t, e) {
  15494. return !!((t == null ? void 0 : t.length) === (e == null ? void 0 : e.length) && (t != null && t.every((n, r) => JSON.stringify(n) === JSON.stringify(e == null ? void 0 : e[r]))));
  15495. }
  15496. var m_ = (t) => {
  15497. var h;
  15498. const { selection: e, body: n, doc: r } = t, s = e.segmentId, i = (h = r.getSelfOrHeaderFooterModel(s)) == null ? void 0 : h.getBody();
  15499. if (!i)
  15500. return false;
  15501. const o = e.collapsed ? null : Dt(i, e.startOffset, e.endOffset), a = ru(o ? o.dataStream : "", n.dataStream);
  15502. let u = 0;
  15503. const c = a.map(([d, f]) => {
  15504. switch (d) {
  15505. case 0: {
  15506. const E = ei(n, u, u + f.length, false), R = ei(o, u, u + f.length, false), O = {
  15507. t: ce.RETAIN,
  15508. body: p_(E, R) ? void 0 : {
  15509. textRuns: E,
  15510. dataStream: ""
  15511. },
  15512. len: f.length
  15513. };
  15514. return u += f.length, O;
  15515. }
  15516. case 1: {
  15517. const E = {
  15518. t: ce.INSERT,
  15519. body: Dt(n, u, u + f.length),
  15520. len: f.length
  15521. };
  15522. return u += f.length, E;
  15523. }
  15524. default:
  15525. return {
  15526. t: ce.DELETE,
  15527. len: f.length
  15528. };
  15529. }
  15530. });
  15531. if (c.every((d) => d.t === ce.RETAIN && !d.body))
  15532. return false;
  15533. const l = new Ke();
  15534. return l.push({
  15535. t: ce.RETAIN,
  15536. len: e.startOffset
  15537. }), l.push(...c), l;
  15538. };
  15539. function __(t, e) {
  15540. const n = [], { customBlocks: r = [] } = t;
  15541. for (const s of e) {
  15542. const { startOffset: i, endOffset: o } = s;
  15543. if (!(i == null || o == null))
  15544. for (const a of r) {
  15545. const { startIndex: u } = a;
  15546. u >= i && u < o && n.push(a.blockId);
  15547. }
  15548. }
  15549. return n;
  15550. }
  15551. function E_(t, e = "") {
  15552. if (!e)
  15553. return ["body"];
  15554. const { headers: n, footers: r } = t.getSnapshot();
  15555. if (n == null && r == null)
  15556. throw new Error("Document data model must have headers or footers when update by segment id");
  15557. if ((n == null ? void 0 : n[e]) != null)
  15558. return ["headers", e, "body"];
  15559. if ((r == null ? void 0 : r[e]) != null)
  15560. return ["footers", e, "body"];
  15561. throw new Error("Segment id not found in headers or footers");
  15562. }
  15563. var C_ = (t) => {
  15564. var R, O, U, ne;
  15565. const { selection: e, documentDataModel: n, drawings: r } = t, { collapsed: s, startOffset: i, segmentId: o } = e, a = new Ke(), u = tn.getInstance(), c = [], l = n.getSelfOrHeaderFooterModel(o).getBody();
  15566. if (!l)
  15567. return false;
  15568. const h = (O = (R = n.getSnapshot().drawingsOrder) == null ? void 0 : R.length) != null ? O : 0;
  15569. let d = 0;
  15570. if (s)
  15571. i > 0 && a.push({
  15572. t: ce.RETAIN,
  15573. len: i
  15574. });
  15575. else {
  15576. const X = sl([e], l, 0, null, false);
  15577. a.push(...X);
  15578. const de = __(l, [e]), T = (U = n.getDrawings()) != null ? U : {}, A = (ne = n.getDrawingsOrder()) != null ? ne : [], H = de.sort((Z, fe) => A.indexOf(Z) > A.indexOf(fe) ? -1 : A.indexOf(Z) < A.indexOf(fe) ? 1 : 0);
  15579. if (H.length > 0)
  15580. for (const Z of H) {
  15581. const fe = T[Z], ae = A.indexOf(Z);
  15582. if (fe == null || ae < 0)
  15583. continue;
  15584. const m = u.removeOp(["drawings", Z], fe), j = u.removeOp(["drawingsOrder", ae], Z);
  15585. c.push(m), c.push(j), d++;
  15586. }
  15587. }
  15588. a.push({
  15589. t: ce.INSERT,
  15590. body: {
  15591. dataStream: "\b".repeat(r.length),
  15592. customBlocks: r.map((X, de) => ({
  15593. startIndex: de,
  15594. blockId: X.drawingId
  15595. }))
  15596. },
  15597. len: r.length
  15598. });
  15599. const f = E_(n, o), E = u.editOp(a.serialize(), f);
  15600. c.push(E);
  15601. for (const X of r) {
  15602. const { drawingId: de } = X, T = u.insertOp(["drawings", de], X), A = u.insertOp(["drawingsOrder", h - d], de);
  15603. c.push(T), c.push(A);
  15604. }
  15605. return c.reduce((X, de) => tn.compose(X, de), null);
  15606. };
  15607. var R_ = (t) => {
  15608. var h, d, f;
  15609. const { paragraphs: e, segmentId: n, document: r } = t;
  15610. let s = t.listType;
  15611. const i = (d = (h = r.getSelfOrHeaderFooterModel(n).getBody()) == null ? void 0 : h.paragraphs) != null ? d : [], o = e.every((E) => {
  15612. var R;
  15613. return ((R = E.bullet) == null ? void 0 : R.listType.indexOf(s)) === 0;
  15614. });
  15615. let u = re.generateRandomId(6);
  15616. if (e.length === 1) {
  15617. const E = i.indexOf(e[0]), R = i[E - 1], O = i[E + 1];
  15618. R && R.bullet && R.bullet.listType.indexOf(s) === 0 ? (u = R.bullet.listId, s !== Ft.CHECK_LIST && (s = R.bullet.listType)) : O && O.bullet && O.bullet.listType.indexOf(s) === 0 && (u = O.bullet.listId, s !== Ft.CHECK_LIST && (s = O.bullet.listType));
  15619. }
  15620. const c = new lr();
  15621. c.reset();
  15622. const l = new Ke();
  15623. for (const E of e) {
  15624. const { startIndex: R, paragraphStyle: O = {}, bullet: U } = E;
  15625. l.push({
  15626. t: ce.RETAIN,
  15627. len: R - c.cursor
  15628. }), l.push({
  15629. t: ce.RETAIN,
  15630. len: 1,
  15631. body: {
  15632. dataStream: "",
  15633. paragraphs: [
  15634. o ? {
  15635. paragraphStyle: O,
  15636. startIndex: 0
  15637. } : {
  15638. startIndex: 0,
  15639. paragraphStyle: {
  15640. ...O
  15641. },
  15642. bullet: {
  15643. nestingLevel: (f = U == null ? void 0 : U.nestingLevel) != null ? f : 0,
  15644. textStyle: {
  15645. fs: 20
  15646. },
  15647. listType: s,
  15648. listId: u
  15649. }
  15650. }
  15651. ]
  15652. },
  15653. coverType: Pe.REPLACE
  15654. }), c.moveCursorTo(R + 1);
  15655. }
  15656. return l;
  15657. };
  15658. var I_ = (t) => {
  15659. var h;
  15660. const { paragraphIndex: e, segmentId: n, document: r } = t, s = (h = r.getSelfOrHeaderFooterModel(n).getBody()) == null ? void 0 : h.paragraphs;
  15661. if (s == null)
  15662. return false;
  15663. const i = s.find((d) => d.startIndex === e);
  15664. if (!(i != null && i.bullet) || i.bullet.listType.indexOf(Ft.CHECK_LIST) === -1)
  15665. return false;
  15666. const o = new lr();
  15667. o.reset();
  15668. const a = new Ke(), { startIndex: u, paragraphStyle: c = {} } = i, l = i.bullet.listType === Ft.CHECK_LIST ? Ft.CHECK_LIST_CHECKED : Ft.CHECK_LIST;
  15669. return a.push({
  15670. t: ce.RETAIN,
  15671. len: u - o.cursor
  15672. }), a.push({
  15673. t: ce.RETAIN,
  15674. len: 1,
  15675. body: {
  15676. dataStream: "",
  15677. paragraphs: [
  15678. {
  15679. ...i,
  15680. paragraphStyle: c,
  15681. startIndex: 0,
  15682. bullet: {
  15683. ...i.bullet,
  15684. listType: l
  15685. }
  15686. }
  15687. ]
  15688. },
  15689. coverType: Pe.REPLACE
  15690. }), o.moveCursorTo(u + 1), a;
  15691. };
  15692. var v_ = (t) => {
  15693. var l, h;
  15694. const { paragraphs: e, listType: n, segmentId: r, document: s } = t;
  15695. if (((l = s.getSelfOrHeaderFooterModel(r).getBody()) == null ? void 0 : l.paragraphs) == null)
  15696. return false;
  15697. const a = re.generateRandomId(6), u = new lr();
  15698. u.reset();
  15699. const c = new Ke();
  15700. for (const d of e) {
  15701. const { startIndex: f, paragraphStyle: E = {}, bullet: R } = d;
  15702. c.push({
  15703. t: ce.RETAIN,
  15704. len: f - u.cursor
  15705. }), c.push({
  15706. t: ce.RETAIN,
  15707. len: 1,
  15708. body: {
  15709. dataStream: "",
  15710. paragraphs: [
  15711. {
  15712. startIndex: 0,
  15713. paragraphStyle: E,
  15714. bullet: {
  15715. nestingLevel: (h = R == null ? void 0 : R.nestingLevel) != null ? h : 0,
  15716. textStyle: (R == null ? void 0 : R.listType) === n ? R.textStyle : {
  15717. fs: 20
  15718. },
  15719. listType: n,
  15720. listId: a
  15721. }
  15722. }
  15723. ]
  15724. },
  15725. coverType: Pe.REPLACE
  15726. }), u.moveCursorTo(f + 1);
  15727. }
  15728. return c;
  15729. };
  15730. function y_(t, e) {
  15731. return e.some((n) => t.startIndex > n.startIndex && t.startIndex < n.endIndex);
  15732. }
  15733. var w_ = (t) => {
  15734. var l, h, d;
  15735. const { paragraphs: e, segmentId: n, document: r, type: s } = t, i = new lr();
  15736. i.reset();
  15737. const o = new Ke(), a = (l = r.getSnapshot().lists) != null ? l : {}, u = (d = (h = r.getBody()) == null ? void 0 : h.tables) != null ? d : [], c = {
  15738. ...Es,
  15739. ...a
  15740. };
  15741. for (const f of e) {
  15742. const { startIndex: E, paragraphStyle: R = {}, bullet: O } = f, U = y_(f, u);
  15743. if (o.push({
  15744. t: ce.RETAIN,
  15745. len: E - i.cursor
  15746. }), O) {
  15747. const ne = O.listType;
  15748. let X = c[ne].nestingLevel.length - 1;
  15749. U && (X = Math.min(X, 2)), o.push({
  15750. t: ce.RETAIN,
  15751. len: 1,
  15752. body: {
  15753. dataStream: "",
  15754. paragraphs: [
  15755. {
  15756. startIndex: 0,
  15757. paragraphStyle: {
  15758. ...R
  15759. },
  15760. bullet: {
  15761. ...O,
  15762. nestingLevel: Math.max(Math.min(O.nestingLevel + s, X), 0)
  15763. }
  15764. }
  15765. ]
  15766. },
  15767. coverType: Pe.REPLACE
  15768. });
  15769. } else
  15770. o.push({
  15771. t: ce.RETAIN,
  15772. len: 1
  15773. });
  15774. i.moveCursorTo(E + 1);
  15775. }
  15776. return o;
  15777. };
  15778. var O_ = ((t) => (t.PARAGRAPH = "PARAGRAPH", t.SECTION_BREAK = "SECTION_BREAK", t.TABLE = "TABLE", t.TABLE_ROW = "TABLE_ROW", t.TABLE_CELL = "TABLE_CELL", t.CUSTOM_BLOCK = "CUSTOM_BLOCK", t))(O_ || {});
  15779. var ln = ((t) => (t.PARAGRAPH = "\r", t.SECTION_BREAK = `
  15780. `, t.TABLE_START = "", t.TABLE_ROW_START = "\x1B", t.TABLE_CELL_START = "", t.TABLE_CELL_END = "", t.TABLE_ROW_END = "", t.TABLE_END = "", t.CUSTOM_RANGE_START = "", t.CUSTOM_RANGE_END = "", t.COLUMN_BREAK = "\v", t.PAGE_BREAK = "\f", t.DOCS_END = "\0", t.TAB = " ", t.CUSTOM_BLOCK = "\b", t.LETTER = "", t.SPACE = " ", t))(ln || {});
  15781. function eR(t) {
  15782. return `${t}`;
  15783. }
  15784. var b_ = [
  15785. // DataStreamTreeTokenType.PARAGRAPH, // 段落
  15786. // DataStreamTreeTokenType.SECTION_BREAK, // 章节
  15787. ln.TABLE_START,
  15788. // 表格开始
  15789. ln.TABLE_ROW_START,
  15790. // 表格开始
  15791. ln.TABLE_CELL_START,
  15792. // 表格开始
  15793. ln.TABLE_CELL_END,
  15794. // 表格开始
  15795. ln.TABLE_ROW_END,
  15796. // 表格开始
  15797. ln.TABLE_END
  15798. // 表格结束
  15799. // DataStreamTreeTokenType.COLUMN_BREAK, // 换列
  15800. // DataStreamTreeTokenType.PAGE_BREAK, // 换页
  15801. // DataStreamTreeTokenType.DOCS_END, // 文档结尾
  15802. // DataStreamTreeTokenType.TAB, // 制表符
  15803. // DataStreamTreeTokenType.CUSTOM_BLOCK, // 图片 mention 等不参与文档流的场景
  15804. ];
  15805. var il = (t) => {
  15806. const e = t.endsWith(`\r
  15807. `) ? t.slice(0, -2) : t;
  15808. return b_.reduce((n, r) => n.replaceAll(r, ""), e);
  15809. };
  15810. var S_ = (t) => t ? il(t).replaceAll("\r", "") === "" : true;
  15811. var A_ = (t) => {
  15812. const e = t.replace(/\n/g, "\r"), n = [], r = [];
  15813. let s = 0, i = "";
  15814. const o = (u, c = true) => {
  15815. const l = e.slice(s, u);
  15816. if (re.isLegalUrl(l)) {
  15817. const h = qt(), d = `${l}`, f = {
  15818. startIndex: s,
  15819. endIndex: s + d.length - 1,
  15820. rangeId: h,
  15821. rangeType: mn.HYPERLINK,
  15822. properties: {
  15823. url: t
  15824. }
  15825. };
  15826. r.push(f), i += d, s = u + 1, c && (i += "\r", n.push({ startIndex: u }));
  15827. } else
  15828. i += e.slice(s, u + 1), s = u + 1, c && n.push({ startIndex: u });
  15829. };
  15830. let a = 0;
  15831. for (let u = 0; u < e.length; u++)
  15832. e[u] === "\r" && (o(u), a = u);
  15833. return (a !== e.length - 1 || e.length === 1) && o(e.length, false), {
  15834. dataStream: i,
  15835. paragraphs: n,
  15836. customRanges: r
  15837. };
  15838. };
  15839. function N_(t, e) {
  15840. if (typeof e > "u")
  15841. return { startOffset: t, endOffset: t, collapsed: true };
  15842. if (e < t)
  15843. throw new Error(`Cannot make a doc selection when endOffset ${e} is less than startOffset ${t}.`);
  15844. return { startOffset: t, endOffset: e, collapsed: t === e };
  15845. }
  15846. function T_(t) {
  15847. const { startOffset: e, endOffset: n, collapsed: r } = t, s = Math.min(e, n), i = Math.max(e, n);
  15848. return {
  15849. startOffset: s,
  15850. endOffset: i,
  15851. collapsed: r
  15852. };
  15853. }
  15854. function M_(t, e, n, r) {
  15855. return Math.max(t, n) <= Math.min(e, r);
  15856. }
  15857. var st = class {
  15858. };
  15859. C(st, "customRange", {
  15860. add: d_,
  15861. delete: h_,
  15862. copyCustomRange: u_,
  15863. getCustomRangesInterestsWithSelection: a_,
  15864. isIntersecting: nl
  15865. }), C(st, "customDecoration", {
  15866. add: i_,
  15867. delete: o_
  15868. }), C(st, "selection", {
  15869. replace: g_,
  15870. makeSelection: N_,
  15871. normalizeSelection: T_,
  15872. delete: sl,
  15873. replaceTextRuns: m_,
  15874. retain: f_
  15875. }), C(st, "range", {
  15876. isIntersects: M_
  15877. }), C(st, "transform", {
  15878. getPlainText: il,
  15879. fromPlainText: A_,
  15880. isEmptyDocument: S_
  15881. }), C(st, "paragraph", {
  15882. bullet: {
  15883. set: v_,
  15884. switch: R_,
  15885. toggleChecklist: I_,
  15886. changeNestLevel: w_
  15887. }
  15888. }), C(st, "drawing", {
  15889. add: C_
  15890. });
  15891. function D_(t) {
  15892. if (t.customRanges || (t.customRanges = []), !t.paragraphs) {
  15893. t.paragraphs = [];
  15894. for (let e = 0; e < t.dataStream.length; e++)
  15895. t.dataStream[e] === "\r" && t.paragraphs.push({ startIndex: e });
  15896. }
  15897. return t.customBlocks || (t.customBlocks = []), t.textRuns || (t.textRuns = []), t.customDecorations || (t.customDecorations = []), t.sectionBreaks || (t.sectionBreaks = []), t.tables || (t.tables = []), t;
  15898. }
  15899. function ol(t) {
  15900. var e;
  15901. return t.body = D_((e = t.body) != null ? e : { dataStream: "" }), t.drawingsOrder || (t.drawingsOrder = []), t.drawings || (t.drawings = {}), t.documentStyle || (t.documentStyle = {}), t;
  15902. }
  15903. var cr = class _cr {
  15904. /**
  15905. * Creates a new TextStyleValue instance
  15906. * @param {ITextStyle} style The initial style object
  15907. * @example
  15908. * ```ts
  15909. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  15910. * console.log(style);
  15911. * ```
  15912. */
  15913. constructor(e = {}) {
  15914. C(this, "_style");
  15915. this._style = e;
  15916. }
  15917. /**
  15918. * Creates an instance of TextStyleValue.
  15919. * @param {ITextStyle} style style object
  15920. * @returns {TextStyleValue} font style instance
  15921. * @example
  15922. * ```ts
  15923. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  15924. * console.log(style);
  15925. * ```
  15926. */
  15927. static create(e = {}) {
  15928. return new _cr(e);
  15929. }
  15930. /**
  15931. * Gets the font family
  15932. * @returns {Nullable<string>} The font family name or undefined
  15933. * @example
  15934. * ```ts
  15935. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  15936. * console.log(style.fontFamily);
  15937. * ```
  15938. */
  15939. get fontFamily() {
  15940. return this._style.ff;
  15941. }
  15942. /**
  15943. * Gets the font size in points
  15944. * @returns {number | undefined} The font size or undefined
  15945. * @example
  15946. * ```ts
  15947. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  15948. * console.log(style.fontSize);
  15949. * ```
  15950. */
  15951. get fontSize() {
  15952. return this._style.fs;
  15953. }
  15954. /**
  15955. * Gets whether the text is italic
  15956. * @returns {boolean} True if italic, false otherwise
  15957. * @example
  15958. * ```ts
  15959. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  15960. * console.log(style.italic);
  15961. * ```
  15962. */
  15963. get italic() {
  15964. return this._style.it === we.TRUE;
  15965. }
  15966. /**
  15967. * Gets whether the text is bold
  15968. * @returns {boolean} True if bold, false otherwise
  15969. * @example
  15970. * ```ts
  15971. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  15972. * console.log(style.bold);
  15973. * ```
  15974. */
  15975. get bold() {
  15976. return this._style.bl === we.TRUE;
  15977. }
  15978. /**
  15979. * Gets the underline decoration
  15980. * @returns {TextDecorationBuilder | undefined} The underline decoration or undefined
  15981. * @example
  15982. * ```ts
  15983. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  15984. * console.log(style.underline);
  15985. * ```
  15986. */
  15987. get underline() {
  15988. return this._style.ul && Jt.create(this._style.ul);
  15989. }
  15990. /**
  15991. * Gets the bottom border line decoration
  15992. * @returns {TextDecorationBuilder | undefined} The bottom border line decoration or undefined
  15993. * @example
  15994. * ```ts
  15995. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  15996. * console.log(style.bottomBorderLine);
  15997. * ```
  15998. */
  15999. get bottomBorderLine() {
  16000. return this._style.bbl && Jt.create(this._style.bbl);
  16001. }
  16002. /**
  16003. * Gets the strikethrough decoration
  16004. * @returns {TextDecorationBuilder | undefined} The strikethrough decoration or undefined
  16005. * @example
  16006. * ```ts
  16007. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16008. * console.log(style.strikethrough);
  16009. * ```
  16010. */
  16011. get strikethrough() {
  16012. return this._style.st && Jt.create(this._style.st);
  16013. }
  16014. /**
  16015. * Gets the overline decoration
  16016. * @returns {TextDecorationBuilder | undefined} The overline decoration or undefined
  16017. * @example
  16018. * ```ts
  16019. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16020. * console.log(style.overline);
  16021. * ```
  16022. */
  16023. get overline() {
  16024. return this._style.ol && Jt.create(this._style.ol);
  16025. }
  16026. /**
  16027. * Gets the background color
  16028. * @returns {Nullable<IColorStyle>} The background color or null/undefined
  16029. * @example
  16030. * ```ts
  16031. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16032. * console.log(style.background);
  16033. * ```
  16034. */
  16035. get background() {
  16036. return this._style.bg;
  16037. }
  16038. /**
  16039. * Gets the border settings
  16040. * @returns {Nullable<IBorderData>} The border settings or null/undefined
  16041. * @example
  16042. * ```ts
  16043. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16044. * console.log(style.border);
  16045. * ```
  16046. */
  16047. get border() {
  16048. return this._style.bd;
  16049. }
  16050. /**
  16051. * Gets the text color
  16052. * @returns {Nullable<IColorStyle>} The text color or null/undefined
  16053. * @example
  16054. * ```ts
  16055. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16056. * console.log(style.color);
  16057. * ```
  16058. */
  16059. get color() {
  16060. return this._style.cl;
  16061. }
  16062. /**
  16063. * Gets the vertical alignment (subscript/superscript)
  16064. * @returns {Nullable<BaselineOffset>} The vertical alignment or null/undefined
  16065. * @example
  16066. * ```ts
  16067. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16068. * console.log(style.verticalAlign);
  16069. * ```
  16070. */
  16071. get verticalAlign() {
  16072. return this._style.va;
  16073. }
  16074. /**
  16075. * Gets the number format pattern
  16076. * @returns {Nullable<{ pattern: string }>} The number format pattern or null/undefined
  16077. * @example
  16078. * ```ts
  16079. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16080. * console.log(style.numberFormat);
  16081. * ```
  16082. */
  16083. get numberFormat() {
  16084. return this._style.n;
  16085. }
  16086. /**
  16087. * Creates a copy of this font style as a builder
  16088. * @returns {TextStyleBuilder} A new TextStyleBuilder instance with the same style
  16089. * @example
  16090. * ```ts
  16091. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16092. * const copy = style.copy();
  16093. * console.log(copy);
  16094. * ```
  16095. */
  16096. copy() {
  16097. return Qt.create(re.deepClone(this._style));
  16098. }
  16099. /**
  16100. * Gets the raw style object
  16101. * @returns {ITextStyle} The underlying style object
  16102. * @example
  16103. * ```ts
  16104. * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16105. * console.log(style.getValue());
  16106. * ```
  16107. */
  16108. getValue() {
  16109. return { ...this._style };
  16110. }
  16111. };
  16112. var Qt = class _Qt extends cr {
  16113. /**
  16114. * Creates a new TextStyleBuilder instance
  16115. * @param {ITextStyle} style Initial style object
  16116. * @returns {TextStyleBuilder} A new TextStyleBuilder instance
  16117. * @example
  16118. * ```ts
  16119. * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16120. * console.log(style);
  16121. * ```
  16122. */
  16123. static create(e = {}) {
  16124. return new _Qt(e);
  16125. }
  16126. /**
  16127. * Creates a new TextStyleBuilder instance
  16128. * @param {ITextStyle} style The initial style object
  16129. * @example
  16130. * ```ts
  16131. * const style = new TextStyleBuilder({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16132. * console.log(style);
  16133. * ```
  16134. */
  16135. constructor(e = {}) {
  16136. super(e);
  16137. }
  16138. /**
  16139. * Sets the font family
  16140. * @param {string} family The font family name
  16141. * @returns {TextStyleBuilder} The builder instance for chaining
  16142. * @example
  16143. * ```ts
  16144. * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16145. * style.setFontFamily('Times New Roman');
  16146. * console.log(style.fontFamily);
  16147. * ```
  16148. */
  16149. setFontFamily(e) {
  16150. return this._style.ff = e, this;
  16151. }
  16152. /**
  16153. * Sets the font size in points
  16154. * @param {number} size The font size
  16155. * @returns {TextStyleBuilder} The builder instance for chaining
  16156. * @example
  16157. * ```ts
  16158. * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16159. * style.setFontSize(14);
  16160. * console.log(style.fontSize);
  16161. * ```
  16162. */
  16163. setFontSize(e) {
  16164. return this._style.fs = e, this;
  16165. }
  16166. /**
  16167. * Sets the italic style
  16168. * @param {boolean} value True to make italic, false otherwise
  16169. * @returns {TextStyleBuilder} The builder instance for chaining
  16170. * @example
  16171. * ```ts
  16172. * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16173. * style.setItalic(true);
  16174. * console.log(style.italic);
  16175. * ```
  16176. */
  16177. setItalic(e) {
  16178. return this._style.it = e ? 1 : 0, this;
  16179. }
  16180. /**
  16181. * Sets the bold style
  16182. * @param {boolean} value True to make bold, false otherwise
  16183. * @returns {TextStyleBuilder} The builder instance for chaining
  16184. * @example
  16185. * ```ts
  16186. * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16187. * style.setBold(true);
  16188. * console.log(style.bold);
  16189. * ```
  16190. */
  16191. setBold(e) {
  16192. return this._style.bl = e ? 1 : 0, this;
  16193. }
  16194. /**
  16195. * Sets the underline decoration
  16196. * @param {TextDecorationBuilder} decoration The underline decoration settings
  16197. * @returns {TextStyleBuilder} The builder instance for chaining
  16198. * @example
  16199. * ```ts
  16200. * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16201. * style.setUnderline({ type: 'single', color: '#FF0000' });
  16202. * console.log(style.underline);
  16203. * ```
  16204. */
  16205. setUnderline(e) {
  16206. return this._style.ul = e.build(), this;
  16207. }
  16208. /**
  16209. * Sets the bottom border line decoration
  16210. * @param {TextDecorationBuilder} decoration The bottom border line decoration settings
  16211. * @returns {TextStyleBuilder} The builder instance for chaining
  16212. * @example
  16213. * ```ts
  16214. * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16215. * style.setBottomBorderLine({ type: 'single', color: '#FF0000' });
  16216. * console.log(style.bottomBorderLine);
  16217. * ```
  16218. */
  16219. setBottomBorderLine(e) {
  16220. return this._style.bbl = e.build(), this;
  16221. }
  16222. /**
  16223. * Sets the strikethrough decoration
  16224. * @param {TextDecorationBuilder} decoration The strikethrough decoration settings
  16225. * @returns {TextStyleBuilder} The builder instance for chaining
  16226. */
  16227. setStrikethrough(e) {
  16228. return this._style.st = e.build(), this;
  16229. }
  16230. /**
  16231. * Sets the overline decoration
  16232. * @param {TextDecorationBuilder} decoration The overline decoration settings
  16233. * @returns {TextStyleBuilder} The builder instance for chaining
  16234. */
  16235. setOverline(e) {
  16236. return this._style.ol = e.build(), this;
  16237. }
  16238. /**
  16239. * Sets the background color
  16240. * @param {IColorStyle | null} color The background color or null to remove
  16241. * @returns {TextStyleBuilder} The builder instance for chaining
  16242. */
  16243. setBackground(e) {
  16244. return this._style.bg = e, this;
  16245. }
  16246. /**
  16247. * Sets the border settings
  16248. * @param {IBorderData | null} border The border settings or null to remove
  16249. * @returns {TextStyleBuilder} The builder instance for chaining
  16250. */
  16251. setBorder(e) {
  16252. return this._style.bd = e, this;
  16253. }
  16254. /**
  16255. * Sets the text color
  16256. * @param {IColorStyle | null} color The text color or null to remove
  16257. * @returns {TextStyleBuilder} The builder instance for chaining
  16258. */
  16259. setColor(e) {
  16260. return this._style.cl = e, this;
  16261. }
  16262. /**
  16263. * Sets the vertical alignment (subscript/superscript)
  16264. * @param {BaselineOffset | null} offset The vertical alignment or null to remove
  16265. * @returns {TextStyleBuilder} The builder instance for chaining
  16266. */
  16267. setVerticalAlign(e) {
  16268. return this._style.va = e, this;
  16269. }
  16270. /**
  16271. * Creates a copy of this font style builder
  16272. * @returns {TextStyleBuilder} A new TextStyleBuilder instance with the same style
  16273. */
  16274. copy() {
  16275. return _Qt.create(re.deepClone(this._style));
  16276. }
  16277. /**
  16278. * Builds and returns the final style object
  16279. * @returns {ITextStyle} The complete style object
  16280. */
  16281. build() {
  16282. return this.getValue();
  16283. }
  16284. };
  16285. var Jt = class _Jt {
  16286. /**
  16287. * Creates a new TextDecorationBuilder instance
  16288. * @param {ITextDecoration} decoration The initial decoration object
  16289. * @example
  16290. * ```ts
  16291. * const decoration = new TextDecorationBuilder({ s: 1, t: TextDecoration.SINGLE });
  16292. * ```
  16293. */
  16294. constructor(e = { s: 1 }) {
  16295. C(this, "_decoration");
  16296. this._decoration = e;
  16297. }
  16298. /**
  16299. * Creates an instance of TextDecorationBuilder.
  16300. * @param {ITextDecoration} decoration Initial decoration object
  16301. * @returns {TextDecorationBuilder} text decoration builder instance
  16302. * @example
  16303. * ```ts
  16304. * const decoration = TextDecorationBuilder.create({ s: 1, t: TextDecoration.SINGLE });
  16305. * console.log(decoration);
  16306. * ```
  16307. */
  16308. static create(e = { s: 1 }) {
  16309. return new _Jt(e);
  16310. }
  16311. /**
  16312. * Gets whether the decoration is shown
  16313. * @returns {boolean} True if the decoration is shown
  16314. */
  16315. get show() {
  16316. return this._decoration.s === we.TRUE;
  16317. }
  16318. /**
  16319. * Gets whether the decoration color follows the font color
  16320. * @returns {boolean} True if the decoration color follows the font color
  16321. */
  16322. get followFontColor() {
  16323. return this._decoration.c === we.TRUE;
  16324. }
  16325. /**
  16326. * Gets the decoration color
  16327. * @returns {Nullable<IColorStyle>} The decoration color
  16328. */
  16329. get color() {
  16330. return this._decoration.cl;
  16331. }
  16332. /**
  16333. * Gets the decoration line type
  16334. * @returns {Nullable<TextDecoration>} The decoration line type
  16335. */
  16336. get type() {
  16337. return this._decoration.t;
  16338. }
  16339. /**
  16340. * Sets whether the decoration is shown
  16341. * @param {boolean} value True to show the decoration
  16342. * @returns {TextDecorationBuilder} The builder instance for chaining
  16343. * @example
  16344. * ```ts
  16345. * decoration.setShow(true);
  16346. * ```
  16347. */
  16348. setShow(e) {
  16349. return this._decoration.s = e ? 1 : 0, this;
  16350. }
  16351. /**
  16352. * Sets whether the decoration color follows the font color
  16353. * @param {boolean} value True to follow font color
  16354. * @returns {TextDecorationBuilder} The builder instance for chaining
  16355. * @example
  16356. * ```ts
  16357. * decoration.setFollowFontColor(false);
  16358. * ```
  16359. */
  16360. setFollowFontColor(e) {
  16361. return this._decoration.c = e ? 1 : 0, this;
  16362. }
  16363. /**
  16364. * Sets the decoration color
  16365. * @param {IColorStyle} color The color style
  16366. * @returns {TextDecorationBuilder} The builder instance for chaining
  16367. * @example
  16368. * ```ts
  16369. * decoration.setColor({ rgb: '#FF0000' });
  16370. * ```
  16371. */
  16372. setColor(e) {
  16373. return this._decoration.cl = e, this;
  16374. }
  16375. /**
  16376. * Sets the decoration line type
  16377. * @param {TextDecoration} type The line type
  16378. * @returns {TextDecorationBuilder} The builder instance for chaining
  16379. * @example
  16380. * ```ts
  16381. * decoration.setLineType(TextDecoration.SINGLE);
  16382. * ```
  16383. */
  16384. setLineType(e) {
  16385. return this._decoration.t = e, this;
  16386. }
  16387. /**
  16388. * Creates a copy of this text decoration builder
  16389. * @returns {TextDecorationBuilder} A new TextDecorationBuilder instance with the same decoration
  16390. * @example
  16391. * ```ts
  16392. * const copy = decoration.copy();
  16393. * ```
  16394. */
  16395. copy() {
  16396. return _Jt.create(re.deepClone(this._decoration));
  16397. }
  16398. /**
  16399. * Builds and returns the final decoration object
  16400. * @returns {ITextDecoration} The complete text decoration object
  16401. * @example
  16402. * ```ts
  16403. * const style = decoration.build();
  16404. * ```
  16405. */
  16406. build() {
  16407. return { ...this._decoration };
  16408. }
  16409. };
  16410. var hr = class _hr {
  16411. constructor(e = {}) {
  16412. C(this, "_style");
  16413. this._style = e;
  16414. }
  16415. /**
  16416. * Creates a new ParagraphStyleValue instance
  16417. * @param {IParagraphStyle} style The initial style object
  16418. * @returns A new ParagraphStyleValue instance
  16419. * @example
  16420. * ```ts
  16421. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16422. * ```
  16423. */
  16424. static create(e = {}) {
  16425. return new _hr(e);
  16426. }
  16427. /**
  16428. * Gets the first line indent
  16429. * @returns {Nullable<INumberUnit>} The first line indent
  16430. * @example
  16431. * ```ts
  16432. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16433. * console.log(style.indentFirstLine);
  16434. * ```
  16435. */
  16436. get indentFirstLine() {
  16437. return this._style.indentFirstLine;
  16438. }
  16439. /**
  16440. * Gets the hanging indent
  16441. * @returns {Nullable<INumberUnit>} The hanging indent
  16442. * @example
  16443. * ```ts
  16444. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16445. * console.log(style.hanging);
  16446. * ```
  16447. */
  16448. get hanging() {
  16449. return this._style.hanging;
  16450. }
  16451. /**
  16452. * Gets the indent start
  16453. * @returns {Nullable<INumberUnit>} The indent start
  16454. * @example
  16455. * ```ts
  16456. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16457. * console.log(style.indentStart);
  16458. * ```
  16459. */
  16460. get indentStart() {
  16461. return this._style.indentStart;
  16462. }
  16463. /**
  16464. * Gets the indent end
  16465. * @returns {Nullable<INumberUnit>} The indent end
  16466. * @example
  16467. * ```ts
  16468. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16469. * console.log(style.indentEnd);
  16470. * ```
  16471. */
  16472. get tabStops() {
  16473. return this._style.tabStops;
  16474. }
  16475. /**
  16476. * Gets the indent end
  16477. * @returns {Nullable<INumberUnit>} The indent end
  16478. * @example
  16479. * ```ts
  16480. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16481. * console.log(style.indentEnd);
  16482. * ```
  16483. */
  16484. get indentEnd() {
  16485. return this._style.indentEnd;
  16486. }
  16487. /**
  16488. * Gets the text style
  16489. * @returns {Nullable<ITextStyle>} The text style
  16490. * @example
  16491. * ```ts
  16492. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16493. * console.log(style.textStyle);
  16494. * ```
  16495. */
  16496. get textStyle() {
  16497. return this._style.textStyle;
  16498. }
  16499. /**
  16500. * Gets the heading id
  16501. * @returns {Nullable<string>} The heading id
  16502. * @example
  16503. * ```ts
  16504. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16505. * console.log(style.headingId);
  16506. * ```
  16507. */
  16508. get headingId() {
  16509. return this._style.headingId;
  16510. }
  16511. /**
  16512. * Gets the named style type
  16513. * @returns {Nullable<NamedStyleType>} The named style type
  16514. * @example
  16515. * ```ts
  16516. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16517. * console.log(style.namedStyleType);
  16518. * ```
  16519. */
  16520. get namedStyleType() {
  16521. return this._style.namedStyleType;
  16522. }
  16523. /**
  16524. * Gets the horizontal align
  16525. * @returns {Nullable<HorizontalAlign>} The horizontal align
  16526. * @example
  16527. * ```ts
  16528. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16529. * console.log(style.horizontalAlign);
  16530. * ```
  16531. */
  16532. get horizontalAlign() {
  16533. return this._style.horizontalAlign;
  16534. }
  16535. /**
  16536. * Gets the line spacing
  16537. * @returns {Nullable<number>} The line spacing
  16538. * @example
  16539. * ```ts
  16540. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16541. * console.log(style.lineSpacing);
  16542. * ```
  16543. */
  16544. get lineSpacing() {
  16545. return this._style.lineSpacing;
  16546. }
  16547. /**
  16548. * Gets the text direction
  16549. * @returns {Nullable<TextDirection>} The text direction
  16550. * @example
  16551. * ```ts
  16552. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16553. * console.log(style.direction);
  16554. * ```
  16555. */
  16556. get direction() {
  16557. return this._style.direction;
  16558. }
  16559. /**
  16560. * Gets the spacing rule
  16561. * @returns {Nullable<SpacingRule>} The spacing rule
  16562. * @example
  16563. * ```ts
  16564. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16565. * console.log(style.spacingRule);
  16566. * ```
  16567. */
  16568. get spacingRule() {
  16569. return this._style.spacingRule;
  16570. }
  16571. /**
  16572. * Gets the snap to grid
  16573. * @returns {Nullable<BooleanNumber>} The snap to grid
  16574. * @example
  16575. * ```ts
  16576. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16577. * console.log(style.snapToGrid);
  16578. * ```
  16579. */
  16580. get snapToGrid() {
  16581. return this._style.snapToGrid;
  16582. }
  16583. /**
  16584. * Gets the space above
  16585. * @returns {Nullable<INumberUnit>} The space above
  16586. * @example
  16587. * ```ts
  16588. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16589. * console.log(style.spaceAbove);
  16590. * ```
  16591. */
  16592. get spaceAbove() {
  16593. return this._style.spaceAbove;
  16594. }
  16595. /**
  16596. * Gets the space below
  16597. * @returns {Nullable<INumberUnit>} The space below
  16598. * @example
  16599. * ```ts
  16600. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16601. * console.log(style.spaceBelow);
  16602. * ```
  16603. */
  16604. get spaceBelow() {
  16605. return this._style.spaceBelow;
  16606. }
  16607. /**
  16608. * Gets the border between
  16609. * @returns {Nullable<IParagraphBorder>} The border between
  16610. * @example
  16611. * ```ts
  16612. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16613. * console.log(style.borderBetween);
  16614. * ```
  16615. */
  16616. get borderBetween() {
  16617. return this._style.borderBetween;
  16618. }
  16619. /**
  16620. * Gets the border top
  16621. * @returns {Nullable<IParagraphBorder>} The border top
  16622. * @example
  16623. * ```ts
  16624. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16625. * console.log(style.borderTop);
  16626. * ```
  16627. */
  16628. get borderTop() {
  16629. return this._style.borderTop;
  16630. }
  16631. /**
  16632. * Gets the border bottom
  16633. * @returns {Nullable<IParagraphBorder>} The border bottom
  16634. * @example
  16635. * ```ts
  16636. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16637. * console.log(style.borderBottom);
  16638. * ```
  16639. */
  16640. get borderBottom() {
  16641. return this._style.borderBottom;
  16642. }
  16643. /**
  16644. * Gets the border left
  16645. * @returns {Nullable<IParagraphBorder>} The border left
  16646. * @example
  16647. * ```ts
  16648. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16649. * console.log(style.borderLeft);
  16650. * ```
  16651. */
  16652. get borderLeft() {
  16653. return this._style.borderLeft;
  16654. }
  16655. /**
  16656. * Gets the border right
  16657. * @returns {Nullable<IParagraphBorder>} The border right
  16658. * @example
  16659. * ```ts
  16660. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16661. * console.log(style.borderRight);
  16662. * ```
  16663. */
  16664. get borderRight() {
  16665. return this._style.borderRight;
  16666. }
  16667. /**
  16668. * Gets the keep lines
  16669. * @returns {boolean} The keep lines
  16670. * @example
  16671. * ```ts
  16672. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16673. * console.log(style.keepLines);
  16674. * ```
  16675. */
  16676. get keepLines() {
  16677. return this._style.keepLines === we.TRUE;
  16678. }
  16679. /**
  16680. * Gets the keep next
  16681. * @returns {boolean} The keep next
  16682. * @example
  16683. * ```ts
  16684. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16685. * console.log(style.keepNext);
  16686. * ```
  16687. */
  16688. get keepNext() {
  16689. return this._style.keepNext === we.TRUE;
  16690. }
  16691. /**
  16692. * Gets the word wrap
  16693. * @returns {boolean} The word wrap
  16694. * @example
  16695. * ```ts
  16696. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16697. * console.log(style.wordWrap);
  16698. * ```
  16699. */
  16700. get wordWrap() {
  16701. return this._style.wordWrap === we.TRUE;
  16702. }
  16703. /**
  16704. * Gets the widow control
  16705. * @returns {boolean} The widow control
  16706. * @example
  16707. * ```ts
  16708. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16709. * console.log(style.widowControl);
  16710. * ```
  16711. */
  16712. get widowControl() {
  16713. return this._style.widowControl === we.TRUE;
  16714. }
  16715. /**
  16716. * Gets the shading
  16717. * @returns {Nullable<IShading>} The shading
  16718. * @example
  16719. * ```ts
  16720. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16721. * console.log(style.shading);
  16722. * ```
  16723. */
  16724. get shading() {
  16725. return this._style.shading;
  16726. }
  16727. /**
  16728. * Gets the suppress hyphenation
  16729. * @returns {boolean} The suppress hyphenation
  16730. * @example
  16731. * ```ts
  16732. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16733. * console.log(style.suppressHyphenation);
  16734. * ```
  16735. */
  16736. get suppressHyphenation() {
  16737. return this._style.suppressHyphenation === we.TRUE;
  16738. }
  16739. /**
  16740. * Creates a copy of the paragraph style
  16741. * @returns {ParagraphStyleBuilder} The copy
  16742. * @example
  16743. * ```ts
  16744. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16745. * const copy = style.copy();
  16746. * ```
  16747. */
  16748. copy() {
  16749. return nr.create(re.deepClone(this._style));
  16750. }
  16751. /**
  16752. * Gets the value
  16753. * @returns {IParagraphStyle} The value
  16754. * @example
  16755. * ```ts
  16756. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16757. * console.log(style.getValue());
  16758. * ```
  16759. */
  16760. getValue() {
  16761. return this._style;
  16762. }
  16763. };
  16764. var nr = class _nr extends hr {
  16765. /**
  16766. * Creates a new paragraph style builder
  16767. * @param style The paragraph style
  16768. * @returns A new paragraph style builder
  16769. * @example
  16770. * ```ts
  16771. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16772. * const copy = style.copy();
  16773. * ```
  16774. */
  16775. static create(e = {}) {
  16776. return new _nr(e);
  16777. }
  16778. constructor(e = {}) {
  16779. super(e);
  16780. }
  16781. /**
  16782. * Sets the indent first line
  16783. * @param value The indent first line
  16784. * @returns {ParagraphStyleBuilder} The paragraph style builder
  16785. * @example
  16786. * ```ts
  16787. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16788. * const copy = style.copy();
  16789. * copy.setIndentFirstLine(10);
  16790. * ```
  16791. */
  16792. setIndentFirstLine(e) {
  16793. return this._style.indentFirstLine = e, this;
  16794. }
  16795. /**
  16796. * Sets the hanging
  16797. * @param value The hanging
  16798. * @returns {ParagraphStyleBuilder} The paragraph style builder
  16799. * @example
  16800. * ```ts
  16801. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16802. * const copy = style.copy();
  16803. * copy.setHanging(10);
  16804. * ```
  16805. */
  16806. setHanging(e) {
  16807. return this._style.hanging = e, this;
  16808. }
  16809. /**
  16810. * Sets the indent start
  16811. * @param value The indent start
  16812. * @returns {ParagraphStyleBuilder} The paragraph style builder
  16813. * @example
  16814. * ```ts
  16815. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16816. * const copy = style.copy();
  16817. * copy.setIndentStart(10);
  16818. * ```
  16819. */
  16820. setIndentStart(e) {
  16821. return this._style.indentStart = e, this;
  16822. }
  16823. /**
  16824. * Sets the tab stops
  16825. * @param value The tab stops
  16826. * @returns {ParagraphStyleBuilder} The paragraph style builder
  16827. * @example
  16828. * ```ts
  16829. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16830. * const copy = style.copy();
  16831. * copy.setTabStops([{ value: 10 }]);
  16832. * ```
  16833. */
  16834. setTabStops(e) {
  16835. return this._style.tabStops = e, this;
  16836. }
  16837. /**
  16838. * Sets the indent end
  16839. * @param value The indent end
  16840. * @returns {ParagraphStyleBuilder} The paragraph style builder
  16841. * @example
  16842. * ```ts
  16843. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16844. * const copy = style.copy();
  16845. * copy.setIndentEnd(10);
  16846. * ```
  16847. */
  16848. setIndentEnd(e) {
  16849. return this._style.indentEnd = e, this;
  16850. }
  16851. /**
  16852. * Sets the text style
  16853. * @param value The text style
  16854. * @returns {ParagraphStyleBuilder} The paragraph style builder
  16855. * @example
  16856. * ```ts
  16857. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16858. * const copy = style.copy();
  16859. * copy.setTextStyle({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
  16860. * ```
  16861. */
  16862. setTextStyle(e) {
  16863. return this._style.textStyle = e, this;
  16864. }
  16865. /**
  16866. * Sets the heading id
  16867. * @param value The heading id
  16868. * @returns {ParagraphStyleBuilder} The paragraph style builder
  16869. * @example
  16870. * ```ts
  16871. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16872. * const copy = style.copy();
  16873. * copy.setHeadingId('test');
  16874. * ```
  16875. */
  16876. setHeadingId(e) {
  16877. return this._style.headingId = e, this;
  16878. }
  16879. /**
  16880. * Sets the named style type
  16881. * @param value The named style type
  16882. * @returns {ParagraphStyleBuilder} The paragraph style builder
  16883. * @example
  16884. * ```ts
  16885. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16886. * const copy = style.copy();
  16887. * copy.setNamedStyleType(NamedStyleType.CHAPTER);
  16888. * ```
  16889. */
  16890. setNamedStyleType(e) {
  16891. return this._style.namedStyleType = e, this;
  16892. }
  16893. /**
  16894. * Sets the vertical align
  16895. * @param value The vertical align
  16896. * @returns {ParagraphStyleBuilder} The paragraph style builder
  16897. * @example
  16898. * ```ts
  16899. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16900. * const copy = style.copy();
  16901. * copy.setVerticalAlign(VerticalAlign.CENTER);
  16902. * ```
  16903. */
  16904. setHorizontalAlign(e) {
  16905. return this._style.horizontalAlign = e, this;
  16906. }
  16907. /**
  16908. * Sets the line spacing
  16909. * @param value The line spacing
  16910. * @returns {ParagraphStyleBuilder} The paragraph style builder
  16911. * @example
  16912. * ```ts
  16913. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16914. * const copy = style.copy();
  16915. * copy.setLineSpacing(10);
  16916. * ```
  16917. */
  16918. setLineSpacing(e) {
  16919. return this._style.lineSpacing = e, this;
  16920. }
  16921. /**
  16922. * Sets the text direction
  16923. * @param value The text direction
  16924. * @returns {ParagraphStyleBuilder} The paragraph style builder
  16925. * @example
  16926. * ```ts
  16927. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16928. * const copy = style.copy();
  16929. * copy.setTextDirection(TextDirection.RIGHT_TO_LEFT);
  16930. * ```
  16931. */
  16932. setDirection(e) {
  16933. return this._style.direction = e, this;
  16934. }
  16935. /**
  16936. * Sets the spacing rule
  16937. * @param value The spacing rule
  16938. * @returns {ParagraphStyleBuilder} The paragraph style builder
  16939. * @example
  16940. * ```ts
  16941. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16942. * const copy = style.copy();
  16943. * copy.setSpacingRule(SpacingRule.AUTO);
  16944. * ```
  16945. */
  16946. setSpacingRule(e) {
  16947. return this._style.spacingRule = e, this;
  16948. }
  16949. /**
  16950. * Sets the snap to grid
  16951. * @param value The snap to grid
  16952. * @returns {ParagraphStyleBuilder} The paragraph style builder
  16953. * @example
  16954. * ```ts
  16955. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16956. * const copy = style.copy();
  16957. * copy.setSnapToGrid(true);
  16958. * ```
  16959. */
  16960. setSnapToGrid(e) {
  16961. return this._style.snapToGrid = e ? 1 : 0, this;
  16962. }
  16963. /**
  16964. * Sets the space above
  16965. * @param value The space above
  16966. * @returns {ParagraphStyleBuilder} The paragraph style builder
  16967. * @example
  16968. * ```ts
  16969. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16970. * const copy = style.copy();
  16971. * copy.setSpaceAbove(10);
  16972. * ```
  16973. */
  16974. setSpaceAbove(e) {
  16975. return this._style.spaceAbove = e, this;
  16976. }
  16977. /**
  16978. * Sets the space below
  16979. * @param value The space below
  16980. * @returns {ParagraphStyleBuilder} The paragraph style builder
  16981. * @example
  16982. * ```ts
  16983. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16984. * const copy = style.copy();
  16985. * copy.setSpaceBelow(10);
  16986. * ```
  16987. */
  16988. setSpaceBelow(e) {
  16989. return this._style.spaceBelow = e, this;
  16990. }
  16991. /**
  16992. * Sets the border between
  16993. * @param {IParagraphBorder} value The border between
  16994. * @returns {ParagraphStyleBuilder} The paragraph style builder
  16995. * @example
  16996. * ```ts
  16997. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  16998. * const copy = style.copy();
  16999. * copy.setBorderBetween({ color: 'red', width: 1 });
  17000. * ```
  17001. */
  17002. setBorderBetween(e) {
  17003. return this._style.borderBetween = e, this;
  17004. }
  17005. /**
  17006. * Sets the border top
  17007. * @param {IParagraphBorder} value The border top
  17008. * @returns {ParagraphStyleBuilder} The paragraph style builder
  17009. * @example
  17010. * ```ts
  17011. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  17012. * const copy = style.copy();
  17013. * copy.setBorderTop({ color: 'red', width: 1 });
  17014. * ```
  17015. */
  17016. setBorderTop(e) {
  17017. return this._style.borderTop = e, this;
  17018. }
  17019. /**
  17020. * Sets the border bottom
  17021. * @param {IParagraphBorder} value The border bottom
  17022. * @returns {ParagraphStyleBuilder} The paragraph style builder
  17023. * @example
  17024. * ```ts
  17025. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  17026. * const copy = style.copy();
  17027. * copy.setBorderBottom({ color: 'red', width: 1 });
  17028. * ```
  17029. */
  17030. setBorderBottom(e) {
  17031. return this._style.borderBottom = e, this;
  17032. }
  17033. /**
  17034. * Sets the border left
  17035. * @param {IParagraphBorder} value The border left
  17036. * @returns {ParagraphStyleBuilder} The paragraph style builder
  17037. * @example
  17038. * ```ts
  17039. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  17040. * const copy = style.copy();
  17041. * copy.setBorderLeft({ color: 'red', width: 1 });
  17042. * ```
  17043. */
  17044. setBorderLeft(e) {
  17045. return this._style.borderLeft = e, this;
  17046. }
  17047. /**
  17048. * Sets the border right
  17049. * @param {IParagraphBorder} value The border right
  17050. * @returns {ParagraphStyleBuilder} The paragraph style builder
  17051. * @example
  17052. * ```ts
  17053. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  17054. * const copy = style.copy();
  17055. * copy.setBorderRight({ color: 'red', width: 1 });
  17056. * ```
  17057. */
  17058. setBorderRight(e) {
  17059. return this._style.borderRight = e, this;
  17060. }
  17061. /**
  17062. * Sets the keep lines
  17063. * @param value The keep lines
  17064. * @returns {ParagraphStyleBuilder} The paragraph style builder
  17065. * @example
  17066. * ```ts
  17067. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  17068. * const copy = style.copy();
  17069. * copy.setKeepLines(true);
  17070. * ```
  17071. */
  17072. setKeepLines(e) {
  17073. return this._style.keepLines = e ? 1 : 0, this;
  17074. }
  17075. /**
  17076. * Sets the keep next
  17077. * @param value The keep next
  17078. * @returns {ParagraphStyleBuilder} The paragraph style builder
  17079. * @example
  17080. * ```ts
  17081. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  17082. * const copy = style.copy();
  17083. * copy.setKeepNext(true);
  17084. * ```
  17085. */
  17086. setKeepNext(e) {
  17087. return this._style.keepNext = e ? 1 : 0, this;
  17088. }
  17089. /**
  17090. * Sets the word wrap
  17091. * @param value The word wrap
  17092. * @returns {ParagraphStyleBuilder} The paragraph style builder
  17093. * @example
  17094. * ```ts
  17095. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  17096. * const copy = style.copy();
  17097. * copy.setWordWrap(true);
  17098. * ```
  17099. */
  17100. setWordWrap(e) {
  17101. return this._style.wordWrap = e ? 1 : 0, this;
  17102. }
  17103. /**
  17104. * Sets the widow control
  17105. * @param {boolean} value The widow control value
  17106. * @returns {ParagraphStyleBuilder} The paragraph style builder
  17107. * @example
  17108. * ```ts
  17109. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  17110. * const copy = style.copy();
  17111. * copy.setWidowControl(true);
  17112. * ```
  17113. */
  17114. setWidowControl(e) {
  17115. return this._style.widowControl = e ? 1 : 0, this;
  17116. }
  17117. /**
  17118. * Sets the shading style
  17119. * @param {IShading} value The shading configuration
  17120. * @returns {ParagraphStyleBuilder} The paragraph style builder
  17121. * @example
  17122. * ```ts
  17123. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  17124. * const copy = style.copy();
  17125. * copy.setShading({ backgroundColor: '#f0f0f0' });
  17126. * ```
  17127. */
  17128. setShading(e) {
  17129. return this._style.shading = e, this;
  17130. }
  17131. /**
  17132. * Sets whether to suppress hyphenation
  17133. * @param {boolean} value The suppress hyphenation value
  17134. * @returns {ParagraphStyleBuilder} The paragraph style builder
  17135. * @example
  17136. * ```ts
  17137. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  17138. * const copy = style.copy();
  17139. * copy.setSuppressHyphenation(true);
  17140. * ```
  17141. */
  17142. setSuppressHyphenation(e) {
  17143. return this._style.suppressHyphenation = e ? 1 : 0, this;
  17144. }
  17145. /**
  17146. * Creates a copy of the current paragraph style builder
  17147. * @returns {ParagraphStyleBuilder} A new instance of ParagraphStyleBuilder with the same settings
  17148. * @example
  17149. * ```ts
  17150. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  17151. * const copy = style.copy();
  17152. * ```
  17153. */
  17154. copy() {
  17155. return _nr.create(re.deepClone(this._style));
  17156. }
  17157. /**
  17158. * Builds and returns the final paragraph style configuration
  17159. * @returns {IParagraphStyle} The constructed paragraph style object
  17160. * @example
  17161. * ```ts
  17162. * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
  17163. * const finalStyle = style.build();
  17164. * ```
  17165. */
  17166. build() {
  17167. return this.getValue();
  17168. }
  17169. };
  17170. var Zt = class _Zt {
  17171. constructor(e) {
  17172. C(this, "_data");
  17173. if (!e.body)
  17174. throw new Error("Invalid document data, body is required");
  17175. this._data = ol(e);
  17176. }
  17177. /**
  17178. * Creates a new RichTextValue instance
  17179. * @param {IDocumentData} data The initial data for the rich text value
  17180. * @returns {RichTextValue} A new RichTextValue instance
  17181. * @example
  17182. * ```ts
  17183. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  17184. * ```
  17185. */
  17186. static create(e) {
  17187. return new _Zt(e);
  17188. }
  17189. /**
  17190. * Creates a new RichTextValue instance
  17191. * @param {IDocumentBody} data The initial data for the rich text value
  17192. * @returns {RichTextValue} A new RichTextValue instance
  17193. * @example
  17194. * ```ts
  17195. * const richText = RichTextValue.createByBody({ dataStream: 'Hello World\r\n' });
  17196. * ```
  17197. */
  17198. static createByBody(e) {
  17199. return new _Zt({ body: e, id: "d", documentStyle: {} });
  17200. }
  17201. /**
  17202. * Creates a copy of the current RichTextValue instance
  17203. * @returns {RichTextValue} A new instance of RichTextValue with the same data
  17204. * @example
  17205. * ```ts
  17206. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  17207. * const copy = richText.copy();
  17208. * ```
  17209. */
  17210. copy() {
  17211. return gn.create(re.deepClone(this._data));
  17212. }
  17213. /**
  17214. * Slices the current RichTextValue instance
  17215. * @param {number} start The start index
  17216. * @param {number} end The end index
  17217. * @returns {RichTextBuilder} A new instance of RichTextBuilder with the sliced data
  17218. * @example
  17219. * ```ts
  17220. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  17221. * const sliced = richText.slice(0, 5);
  17222. * ```
  17223. */
  17224. slice(e, n) {
  17225. const { body: r, ...s } = this._data;
  17226. return gn.create({
  17227. ...re.deepClone(s),
  17228. body: Dt(r, e, n)
  17229. });
  17230. }
  17231. /**
  17232. * Converts the current RichTextValue instance to plain text
  17233. * @returns {string} The plain text representation of the current RichTextValue instance
  17234. * @example
  17235. * ```ts
  17236. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  17237. * const plainText = richText.toPlainText();
  17238. * ```
  17239. */
  17240. toPlainText() {
  17241. var e, n;
  17242. return st.transform.getPlainText((n = (e = this._data.body) == null ? void 0 : e.dataStream) != null ? n : "").replaceAll("\r", `
  17243. `);
  17244. }
  17245. /**
  17246. * Gets the paragraph style of the current RichTextValue instance
  17247. * @returns {ParagraphStyleValue} The paragraph style of the current RichTextValue instance
  17248. * @example
  17249. * ```ts
  17250. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  17251. * const style = richText.getParagraphStyle();
  17252. * ```
  17253. */
  17254. getParagraphStyle() {
  17255. var e, n;
  17256. return hr.create((n = (e = this._data.body) == null ? void 0 : e.paragraphs) == null ? void 0 : n[0].paragraphStyle);
  17257. }
  17258. /**
  17259. * Gets the paragraph bullet of the current RichTextValue instance
  17260. * @returns {ParagraphBulletValue} The paragraph bullet of the current RichTextValue instance
  17261. * @example
  17262. * ```ts
  17263. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  17264. * const bullet = richText.getParagraphBullet();
  17265. * ```
  17266. */
  17267. getParagraphBullet() {
  17268. var e, n;
  17269. return (n = (e = this._data.body) == null ? void 0 : e.paragraphs) == null ? void 0 : n[0].bullet;
  17270. }
  17271. /**
  17272. * Gets the paragraphs of the current RichTextValue instance
  17273. * @returns {RichTextValue[]} The paragraphs of the current RichTextValue instance
  17274. * @example
  17275. * ```ts
  17276. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  17277. * const paragraphs = richText.getParagraphs();
  17278. * ```
  17279. */
  17280. getParagraphs() {
  17281. var r, s;
  17282. const e = (s = (r = this._data.body) == null ? void 0 : r.paragraphs) != null ? s : [];
  17283. let n = 0;
  17284. return e.map((i) => {
  17285. const o = this.slice(n, i.startIndex);
  17286. return n = i.startIndex, o;
  17287. });
  17288. }
  17289. /**
  17290. * Gets the text runs of the current RichTextValue instance
  17291. * @returns {TextRunValue[]} The text runs of the current RichTextValue instance
  17292. * @example
  17293. * ```ts
  17294. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  17295. * const textRuns = richText.getTextRuns();
  17296. * ```
  17297. */
  17298. getTextRuns() {
  17299. var e, n;
  17300. return ((n = (e = this._data.body) == null ? void 0 : e.textRuns) != null ? n : []).map((r) => ({
  17301. ...r,
  17302. ts: r.ts ? cr.create(r.ts) : null
  17303. }));
  17304. }
  17305. /**
  17306. * Gets the links of the current RichTextValue instance
  17307. * @returns {ICustomRange[]} The links of the current RichTextValue instance
  17308. * @example
  17309. * ```ts
  17310. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  17311. * const links = richText.getLinks();
  17312. * ```
  17313. */
  17314. getLinks() {
  17315. var e, n, r;
  17316. return (r = (n = (e = this._data.body) == null ? void 0 : e.customRanges) == null ? void 0 : n.filter((s) => s.rangeType === mn.HYPERLINK)) != null ? r : [];
  17317. }
  17318. /**
  17319. * Gets the data of the current RichTextValue instance
  17320. * @returns {IDocumentData} The data of the current RichTextValue instance
  17321. * @example
  17322. * ```ts
  17323. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  17324. * const data = richText.getData();
  17325. * ```
  17326. */
  17327. getData() {
  17328. return this._data;
  17329. }
  17330. };
  17331. var gn = class _gn extends Zt {
  17332. constructor(n) {
  17333. super(n);
  17334. C(this, "_doc");
  17335. this._doc = new jt(n);
  17336. }
  17337. static newEmptyData() {
  17338. return ol({
  17339. id: "d",
  17340. documentStyle: {},
  17341. drawings: {},
  17342. drawingsOrder: [],
  17343. body: {
  17344. dataStream: `\r
  17345. `,
  17346. customBlocks: [],
  17347. customRanges: [],
  17348. paragraphs: [{ startIndex: 0 }],
  17349. textRuns: [],
  17350. tables: [],
  17351. sectionBreaks: []
  17352. }
  17353. });
  17354. }
  17355. /**
  17356. * Creates a new RichTextBuilder instance
  17357. * @param {IDocumentData} data The initial data for the rich text builder
  17358. * @returns {RichTextBuilder} A new RichTextBuilder instance
  17359. */
  17360. static create(n) {
  17361. return new _gn(n != null ? n : _gn.newEmptyData());
  17362. }
  17363. insertText(n, r, s) {
  17364. var l, h;
  17365. let i = ((h = (l = this._data.body) == null ? void 0 : l.dataStream.length) != null ? h : 2) - 2, o, a;
  17366. if (typeof n == "string" ? o = n : (i = Math.min(n, i), o = r), typeof r == "object" ? a = r instanceof Qt ? r.build() : r : a = s instanceof Qt ? s.build() : s, !o)
  17367. return this;
  17368. const u = {
  17369. dataStream: o,
  17370. textRuns: a ? [
  17371. {
  17372. ts: a,
  17373. st: i,
  17374. ed: i + o.length
  17375. }
  17376. ] : []
  17377. }, c = st.selection.replace({
  17378. doc: this._doc,
  17379. selection: { startOffset: i, endOffset: i, collapsed: true },
  17380. body: u
  17381. });
  17382. if (!c)
  17383. throw new Error("Insert text failed, please check.");
  17384. return Ke.apply(this._doc.getBody(), c.serialize()), this;
  17385. }
  17386. insertRichText(n, r) {
  17387. var a, u;
  17388. let s = ((u = (a = this._data.body) == null ? void 0 : a.dataStream.length) != null ? u : 2) - 2, i;
  17389. typeof n == "object" ? i = n instanceof Zt ? n.getData() : n : (s = Math.min(n, s), i = r instanceof Zt ? r.getData() : r);
  17390. const o = st.selection.replace({
  17391. doc: this._doc,
  17392. selection: { startOffset: s, endOffset: s, collapsed: true },
  17393. body: i.body
  17394. });
  17395. if (!o)
  17396. throw new Error("Insert text failed, please check.");
  17397. return Ke.apply(this._doc.getBody(), o.serialize()), this;
  17398. }
  17399. delete(n, r) {
  17400. if (r !== void 0) {
  17401. if (!r)
  17402. return this;
  17403. const s = st.selection.delete([{ startOffset: n, endOffset: n + r, collapsed: true }], this._data.body);
  17404. Ke.apply(this._doc.getBody(), s);
  17405. }
  17406. return this;
  17407. }
  17408. /**
  17409. * Sets the style of the text at the specified start and end positions
  17410. * @param {number} start The start position of the text to set the style
  17411. * @param {number} end The end position of the text to set the style
  17412. * @param {TextStyleBuilder | ITextStyle} style The style to set
  17413. * @returns {RichTextBuilder} The current RichTextBuilder instance
  17414. * @example
  17415. * ```ts
  17416. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  17417. * const newRichText = richText.setStyle(5, 10, { ff: 'Arial', fs: 12 });
  17418. * ```
  17419. */
  17420. setStyle(n, r, s) {
  17421. const i = {
  17422. dataStream: "",
  17423. textRuns: [{
  17424. ts: s instanceof Qt ? s.build() : s,
  17425. st: 0,
  17426. ed: r - n
  17427. }]
  17428. }, o = st.selection.retain([{ startOffset: n, endOffset: r, collapsed: true }], i);
  17429. return Ke.apply(this._doc.getBody(), o), this;
  17430. }
  17431. /**
  17432. * Sets the link of the text at the specified start and end positions
  17433. * @param {number} start The start position of the text to set the link
  17434. * @param {number} end The end position of the text to set the link
  17435. * @param {string} link The link to set
  17436. * @returns {RichTextBuilder} The current RichTextBuilder instance
  17437. * @example
  17438. * ```ts
  17439. * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
  17440. * const newRichText = richText.setLink(5, 10, 'https://www.example.com');
  17441. * ```
  17442. */
  17443. setLink(n, r, s) {
  17444. const i = st.customRange.add({
  17445. rangeType: mn.HYPERLINK,
  17446. rangeId: qt(),
  17447. properties: {
  17448. url: s
  17449. },
  17450. ranges: [{ startOffset: n, endOffset: r, collapsed: false }],
  17451. body: this._data.body
  17452. });
  17453. if (!i)
  17454. throw new Error("Insert text failed, please check.");
  17455. return Ke.apply(this._doc.getBody(), i.serialize()), this;
  17456. }
  17457. cancelLink(n, r) {
  17458. if (typeof n == "string") {
  17459. const s = st.customRange.delete({
  17460. rangeId: n,
  17461. documentDataModel: this._doc
  17462. });
  17463. if (!s)
  17464. throw new Error("Insert text failed, please check.");
  17465. Ke.apply(this._doc.getBody(), s.serialize());
  17466. } else
  17467. this.slice(n, r).getLinks().forEach((i) => {
  17468. const o = st.customRange.delete({
  17469. rangeId: i.rangeId,
  17470. documentDataModel: this._doc
  17471. });
  17472. if (!o)
  17473. throw new Error("Insert text failed, please check.");
  17474. Ke.apply(this._doc.getBody(), o.serialize());
  17475. });
  17476. return this;
  17477. }
  17478. updateLink(n, r) {
  17479. var i, o;
  17480. const s = (o = (i = this._data.body) == null ? void 0 : i.customRanges) == null ? void 0 : o.find((a) => a.rangeId === n);
  17481. if (!s)
  17482. throw new Error("Link not found");
  17483. return s.properties.url = r, this;
  17484. }
  17485. insertParagraph(n, r) {
  17486. var o, a;
  17487. let s, i;
  17488. return typeof n == "object" ? (s = {
  17489. dataStream: "\r",
  17490. paragraphs: [{
  17491. startIndex: 0,
  17492. paragraphStyle: n.build()
  17493. }]
  17494. }, i = ((a = (o = this._data.body) == null ? void 0 : o.dataStream.length) != null ? a : 2) - 2) : (i = n, s = {
  17495. dataStream: "\r",
  17496. paragraphs: [{
  17497. startIndex: 0,
  17498. paragraphStyle: r == null ? void 0 : r.build()
  17499. }]
  17500. }), this.insertRichText(i, Zt.create({ body: s, id: "d", documentStyle: {} })), this;
  17501. }
  17502. insertLink(n, r, s) {
  17503. let i = "", o = "";
  17504. typeof n == "string" ? (i = n, o = r) : (i = r, o = s);
  17505. const a = _gn.createByBody({
  17506. dataStream: i,
  17507. customRanges: [{
  17508. rangeType: mn.HYPERLINK,
  17509. rangeId: qt(),
  17510. properties: {
  17511. url: o
  17512. },
  17513. startIndex: 0,
  17514. endIndex: i.length - 1
  17515. }]
  17516. });
  17517. return typeof n == "number" ? this.insertRichText(n, a) : this.insertRichText(a);
  17518. }
  17519. };
  17520. function tR(t, e = 16) {
  17521. let n = 0, r = null;
  17522. return function(...i) {
  17523. const o = Date.now();
  17524. o - n < e ? (r && clearTimeout(r), r = setTimeout(() => {
  17525. n = o, t.apply(this, i);
  17526. }, e)) : (n = o, t.apply(this, i));
  17527. };
  17528. }
  17529. var Vn = ((t) => (t[t.Style = 1] = "Style", t[t.Value = 2] = "Value", t))(Vn || {});
  17530. function nR(t) {
  17531. return `sheet_interceptor_${t}`;
  17532. }
  17533. var x_ = (t) => function(e, n) {
  17534. let r = -1, s = e;
  17535. for (let i = 0; i <= t.length; i++) {
  17536. if (i <= r)
  17537. throw new Error("[SheetInterceptorService]: next() called multiple times!");
  17538. if (r = i, i === t.length)
  17539. return s;
  17540. const o = t[i];
  17541. let a = false;
  17542. if (s = o.handler(s, n, (u) => (a = true, u)), !a)
  17543. break;
  17544. }
  17545. return s;
  17546. };
  17547. var rR = class {
  17548. constructor(e) {
  17549. C(this, "_interceptorsByName", /* @__PURE__ */ new Map());
  17550. C(this, "_interceptorPoints");
  17551. this._interceptorPoints = e;
  17552. }
  17553. /**
  17554. * Get the interceptors.
  17555. * @param name Name of the intercepted point.
  17556. * @param filter A callback function to filter the interceptors.
  17557. * @returns It will return a composed interceptor function. If you will perform the interceptor repeatedly,
  17558. * you should cache the result instead of calling this function multiple times.
  17559. */
  17560. fetchThroughInterceptors(e, n) {
  17561. const r = e;
  17562. let s = this._interceptorsByName.get(r);
  17563. return n && (s = s.filter(n)), x_(s || []);
  17564. }
  17565. intercept(e, n) {
  17566. const r = e;
  17567. this._interceptorsByName.has(r) || this._interceptorsByName.set(r, []);
  17568. const s = this._interceptorsByName.get(r);
  17569. return s.push(n), this._interceptorsByName.set(
  17570. r,
  17571. s.sort((i, o) => {
  17572. var a, u;
  17573. return ((a = o.priority) != null ? a : 0) - ((u = i.priority) != null ? u : 0);
  17574. })
  17575. // from large to small
  17576. ), () => cs(this._interceptorsByName.get(r), n);
  17577. }
  17578. getInterceptPoints() {
  17579. return this._interceptorPoints;
  17580. }
  17581. dispose() {
  17582. this._interceptorsByName.clear();
  17583. }
  17584. };
  17585. function sR(t) {
  17586. return `sheet_async_interceptor_${t}`;
  17587. }
  17588. var L_ = (t) => async function(e, n) {
  17589. let r = -1, s = e;
  17590. for (let i = 0; i <= t.length; i++) {
  17591. if (i <= r)
  17592. throw new Error("[SheetInterceptorService]: next() called multiple times!");
  17593. if (r = i, i === t.length)
  17594. return s;
  17595. const o = t[i];
  17596. let a = false;
  17597. if (s = await o.handler(s, n, async (u) => (a = true, u)), !a)
  17598. break;
  17599. }
  17600. return s;
  17601. };
  17602. var iR = class {
  17603. constructor(e) {
  17604. C(this, "_asyncInterceptorsByName", /* @__PURE__ */ new Map());
  17605. C(this, "_asyncInterceptorPoints");
  17606. this._asyncInterceptorPoints = e;
  17607. }
  17608. /**
  17609. * Get the interceptors.
  17610. * @param name Name of the intercepted point.
  17611. * @param filter A callback function to filter the interceptors.
  17612. * @returns It will return a composed interceptor function. If you will perform the interceptor repeatedly,
  17613. * you should cache the result instead of calling this function multiple times.
  17614. */
  17615. fetchThroughAsyncInterceptors(e, n) {
  17616. const r = e;
  17617. let s = this._asyncInterceptorsByName.get(r);
  17618. return n && (s = s.filter(n)), L_(s || []);
  17619. }
  17620. async interceptAsync(e, n) {
  17621. const r = e;
  17622. this._asyncInterceptorsByName.has(r) || this._asyncInterceptorsByName.set(r, []);
  17623. const s = this._asyncInterceptorsByName.get(r);
  17624. return s.push(n), this._asyncInterceptorsByName.set(
  17625. r,
  17626. s.sort((i, o) => {
  17627. var a, u;
  17628. return ((a = o.priority) != null ? a : 0) - ((u = i.priority) != null ? u : 0);
  17629. })
  17630. // from large to small
  17631. ), () => cs(this._asyncInterceptorsByName.get(r), n);
  17632. }
  17633. getInterceptPoints() {
  17634. return this._asyncInterceptorPoints;
  17635. }
  17636. dispose() {
  17637. this._asyncInterceptorsByName.clear();
  17638. }
  17639. };
  17640. function oR(t, e) {
  17641. for (const n in e)
  17642. e.hasOwnProperty(n) && (t[n] = e[n]);
  17643. }
  17644. var Fi = class extends nt {
  17645. static extend(e) {
  17646. Object.getOwnPropertyNames(e.prototype).forEach((n) => {
  17647. n !== "constructor" && (this.prototype[n] = e.prototype[n]);
  17648. }), Object.getOwnPropertyNames(e).forEach((n) => {
  17649. n !== "prototype" && n !== "name" && n !== "length" && (this[n] = e[n]);
  17650. });
  17651. }
  17652. };
  17653. var Ds = Symbol("initializers");
  17654. var al = class extends nt {
  17655. constructor(e) {
  17656. super(), this._injector = e;
  17657. const n = this, r = Object.getPrototypeOf(this)[Ds];
  17658. r && r.forEach(function(s) {
  17659. s.apply(n, [e]);
  17660. });
  17661. }
  17662. _initialize(e) {
  17663. }
  17664. static extend(e) {
  17665. Object.getOwnPropertyNames(e.prototype).forEach((n) => {
  17666. if (n === "_initialize") {
  17667. let r = this.prototype[Ds];
  17668. r || (r = [], this.prototype[Ds] = r), r.push(e.prototype._initialize);
  17669. } else
  17670. n !== "constructor" && (this.prototype[n] = e.prototype[n]);
  17671. }), Object.getOwnPropertyNames(e).forEach((n) => {
  17672. n !== "prototype" && n !== "name" && n !== "length" && (this[n] = e[n]);
  17673. });
  17674. }
  17675. };
  17676. var $i = class _$i {
  17677. constructor() {
  17678. C(this, "_data", []);
  17679. }
  17680. static create() {
  17681. return new _$i();
  17682. }
  17683. add(e) {
  17684. this._data.indexOf(e) > -1 || this._data.push(e);
  17685. }
  17686. delete(e) {
  17687. const n = this._data.indexOf(e);
  17688. this._data.splice(n, 1);
  17689. }
  17690. getData() {
  17691. return this._data;
  17692. }
  17693. };
  17694. var ul = class _ul {
  17695. constructor() {
  17696. C(this, "_data", /* @__PURE__ */ new Map());
  17697. }
  17698. static create() {
  17699. return new _ul();
  17700. }
  17701. add(e, n) {
  17702. this._data.has(e) || this._data.set(e, n);
  17703. }
  17704. delete(e) {
  17705. this._data.delete(e);
  17706. }
  17707. getData() {
  17708. return this._data;
  17709. }
  17710. };
  17711. var U_ = "0.5.5";
  17712. function P_(t = "", e = ur.ZH_CN, n = "") {
  17713. return {
  17714. id: t,
  17715. sheetOrder: [],
  17716. name: n,
  17717. appVersion: U_,
  17718. locale: e,
  17719. styles: {},
  17720. sheets: {},
  17721. resources: []
  17722. };
  17723. }
  17724. var k_ = class {
  17725. constructor(e = {}) {
  17726. C(this, "_styles");
  17727. C(this, "_cacheMap", new Qr(1e5));
  17728. this._styles = e, this._generateCacheMap();
  17729. }
  17730. each(e) {
  17731. return Object.entries(this._styles).forEach(e), this;
  17732. }
  17733. search(e, n) {
  17734. if (this._cacheMap.has(n))
  17735. return this._cacheMap.get(n);
  17736. const r = this._getExistingStyleId(e);
  17737. return r || "-1";
  17738. }
  17739. get(e) {
  17740. return typeof e != "string" ? e : (e = String(e), this._styles[e]);
  17741. }
  17742. add(e, n) {
  17743. const r = re.generateRandomId(6);
  17744. return this._styles[r] = e, this._cacheMap.set(n, r), r;
  17745. }
  17746. setValue(e) {
  17747. if (e == null)
  17748. return;
  17749. const n = JSON.stringify(e), r = this.search(e, n);
  17750. return r !== "-1" ? r : this.add(e, n);
  17751. }
  17752. toJSON() {
  17753. return this._styles;
  17754. }
  17755. getStyleByCell(e) {
  17756. let n;
  17757. e && re.isObject(e.s) ? n = e.s : n = (e == null ? void 0 : e.s) && this.get(e.s);
  17758. const r = e == null ? void 0 : e.interceptorStyle;
  17759. return r ? {
  17760. ...n,
  17761. ...r
  17762. } : n;
  17763. }
  17764. _generateCacheMap() {
  17765. const { _styles: e, _cacheMap: n } = this;
  17766. for (const r in e) {
  17767. const s = JSON.stringify(e[r]);
  17768. n.set(s, r);
  17769. }
  17770. }
  17771. _getExistingStyleId(e) {
  17772. const { _styles: n } = this;
  17773. for (const r in n)
  17774. if (re.diffValue(n[r], e))
  17775. return r;
  17776. return null;
  17777. }
  17778. };
  17779. var aR = (t, e) => e.length === t.length && !t.some((n) => e.some((r) => !en.equals(r, n)));
  17780. var uR = (t, e) => e.length === t.length && t.every((n, r) => {
  17781. const s = e[r];
  17782. return s.unitId === n.unitId && s.sheetId === n.sheetId && en.equals(n.range, s.range);
  17783. });
  17784. var ti = {
  17785. t: 0,
  17786. b: 2,
  17787. // must over 1, see https://github.com/dream-num/univer/issues/2727
  17788. l: 2,
  17789. r: 2
  17790. };
  17791. var F_ = (t) => ({
  17792. sbr: 0.6,
  17793. sbo: t,
  17794. spr: 0.6,
  17795. spo: t
  17796. });
  17797. var ga = 90;
  17798. function Sr(t, e, n = {}) {
  17799. const r = t.length, {
  17800. textRotation: s,
  17801. paddingData: i,
  17802. horizontalAlign: o = Xt.UNSPECIFIED,
  17803. verticalAlign: a = hn.UNSPECIFIED,
  17804. wrapStrategy: u = xn.UNSPECIFIED,
  17805. cellValueType: c
  17806. } = n, { t: l, r: h, b: d, l: f } = i || ti, { vertexAngle: E, centerAngle: R } = ll(s), O = {
  17807. id: "d",
  17808. body: {
  17809. dataStream: `${t}${Wd}`,
  17810. textRuns: [
  17811. {
  17812. ts: e,
  17813. st: 0,
  17814. ed: r
  17815. }
  17816. ],
  17817. paragraphs: [
  17818. {
  17819. startIndex: r,
  17820. paragraphStyle: {
  17821. horizontalAlign: o
  17822. }
  17823. }
  17824. ],
  17825. sectionBreaks: [{
  17826. startIndex: r + 1
  17827. }]
  17828. },
  17829. documentStyle: {
  17830. pageSize: {
  17831. width: Number.POSITIVE_INFINITY,
  17832. height: Number.POSITIVE_INFINITY
  17833. },
  17834. marginTop: l,
  17835. marginBottom: d,
  17836. marginRight: h,
  17837. marginLeft: f,
  17838. renderConfig: {
  17839. horizontalAlign: o,
  17840. verticalAlign: a,
  17841. centerAngle: R,
  17842. vertexAngle: E,
  17843. wrapStrategy: u,
  17844. cellValueType: c,
  17845. zeroWidthParagraphBreak: 1
  17846. }
  17847. },
  17848. drawings: {},
  17849. drawingsOrder: []
  17850. };
  17851. return new jt(O);
  17852. }
  17853. function $_(t) {
  17854. if (!t)
  17855. return {};
  17856. const {
  17857. tr: e,
  17858. td: n,
  17859. ht: r,
  17860. vt: s,
  17861. tb: i,
  17862. pd: o
  17863. } = t;
  17864. return {
  17865. textRotation: e,
  17866. textDirection: n,
  17867. horizontalAlign: r,
  17868. verticalAlign: s,
  17869. wrapStrategy: i,
  17870. paddingData: o
  17871. };
  17872. }
  17873. function pa(t) {
  17874. if (!t)
  17875. return {};
  17876. const { ff: e, fs: n, it: r, bl: s, ul: i, st: o, ol: a, cl: u } = t, c = {};
  17877. return e && (c.ff = e), n && (c.fs = n), r && (c.it = r), s && (c.bl = s), i && (c.ul = i), o && (c.st = o), a && (c.ol = a), u && (c.cl = u), c;
  17878. }
  17879. function B_(t, e, n) {
  17880. var i;
  17881. const r = t.getBody();
  17882. if ((i = r.customRanges) != null && i.some((o) => o.rangeType === mn.HYPERLINK))
  17883. return;
  17884. const s = st.customRange.add({
  17885. ranges: [
  17886. {
  17887. startOffset: 0,
  17888. endOffset: r.dataStream.length - 1,
  17889. collapsed: false
  17890. }
  17891. ],
  17892. rangeId: n,
  17893. rangeType: mn.HYPERLINK,
  17894. body: r,
  17895. properties: {
  17896. url: e,
  17897. refId: n
  17898. }
  17899. });
  17900. s && Ke.apply(r, s.serialize());
  17901. }
  17902. function j_(t) {
  17903. return t != null;
  17904. }
  17905. var H_ = '"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';
  17906. function ma(t) {
  17907. const e = gt.ff, n = gt.fs;
  17908. if (!t) {
  17909. const h = `${n}pt ${e}`;
  17910. return {
  17911. fontCache: h,
  17912. fontString: h,
  17913. fontSize: n,
  17914. originFontSize: n,
  17915. fontFamily: e
  17916. };
  17917. }
  17918. let r = Yn.ITALIC;
  17919. (t.it === 0 || t.it === void 0) && (r = Yn.NORMAL);
  17920. let s = Yn.BOLD;
  17921. (t.bl === 0 || t.bl === void 0) && (s = Yn.NORMAL);
  17922. let i = n;
  17923. t.fs && (i = Math.ceil(t.fs));
  17924. let o = e;
  17925. if (t.ff) {
  17926. let h = t.ff;
  17927. h = h.replace(/"/g, "").replace(/'/g, ""), h.indexOf(" ") > -1 && (h = `"${h}"`), h == null && (h = e), o = h;
  17928. }
  17929. const { va: a } = t;
  17930. let u = i;
  17931. if (a === Bt.SUBSCRIPT || a === Bt.SUPERSCRIPT) {
  17932. const h = W_(o, u), { sbr: d, spr: f } = h;
  17933. u *= a === Bt.SUBSCRIPT ? d : f;
  17934. }
  17935. const c = `${r} ${s} ${u}pt ${o}`, l = `${c}, ${H_} `;
  17936. return {
  17937. fontCache: c,
  17938. fontString: l,
  17939. fontSize: u,
  17940. originFontSize: i,
  17941. fontFamily: o
  17942. };
  17943. }
  17944. function W_(t, e) {
  17945. return F_(e);
  17946. }
  17947. function ll(t) {
  17948. const { a: e = 0, v: n = we.FALSE } = t || { a: 0, v: we.FALSE };
  17949. let r = 0, s = e;
  17950. return n === we.TRUE && (r = ga, s = ga), { centerAngle: r, vertexAngle: s };
  17951. }
  17952. var z_ = class {
  17953. constructor(e, n) {
  17954. C(this, "_columnData", {});
  17955. this._config = e, this._columnData = n;
  17956. }
  17957. /**
  17958. * Get width and hidden status of columns in the sheet
  17959. * @returns
  17960. */
  17961. getColumnData() {
  17962. return this._columnData;
  17963. }
  17964. getColVisible(e) {
  17965. const { _columnData: n } = this, r = n[e];
  17966. return r ? r.hd !== we.TRUE : true;
  17967. }
  17968. /**
  17969. * Get the column style
  17970. * @param {number} col Column index
  17971. * @returns {string | Nullable<IStyleData>} Style data, may be undefined
  17972. */
  17973. getColumnStyle(e) {
  17974. var n;
  17975. return (n = this._columnData[e]) == null ? void 0 : n.s;
  17976. }
  17977. /**
  17978. * Set the set column default style
  17979. * @param {number} col Column index
  17980. * @param {string | Nullable<IStyleData>} style Style data
  17981. */
  17982. setColumnStyle(e, n) {
  17983. const r = this.getColumnOrCreate(e);
  17984. r.s = n;
  17985. }
  17986. /**
  17987. * Get all hidden columns
  17988. * @param start Start index
  17989. * @param end End index
  17990. * @returns Hidden columns range list
  17991. */
  17992. getHiddenCols(e = 0, n = this.getSize() - 1) {
  17993. const r = [];
  17994. let s = false, i = -1;
  17995. for (let o = e; o <= n; o++) {
  17996. const a = this.getColVisible(o);
  17997. s && a ? (s = false, r.push({
  17998. rangeType: De.COLUMN,
  17999. startColumn: i,
  18000. endColumn: o - 1,
  18001. startRow: 0,
  18002. endRow: 0
  18003. })) : !s && !a && (s = true, i = o);
  18004. }
  18005. return s && r.push({
  18006. startRow: 0,
  18007. endRow: 0,
  18008. startColumn: i,
  18009. endColumn: n,
  18010. rangeType: De.COLUMN
  18011. }), r;
  18012. }
  18013. /**
  18014. * Get all visible columns
  18015. * @param start Start index
  18016. * @param end End index
  18017. * @returns Visible columns range list
  18018. */
  18019. getVisibleCols(e = 0, n = this.getSize() - 1) {
  18020. const r = [];
  18021. let s = false, i = -1;
  18022. for (let o = e; o <= n; o++) {
  18023. const a = this.getColVisible(o);
  18024. s && !a ? (s = false, r.push({
  18025. rangeType: De.COLUMN,
  18026. startColumn: i,
  18027. endColumn: o - 1,
  18028. startRow: 0,
  18029. endRow: 0
  18030. })) : !s && a && (s = true, i = o);
  18031. }
  18032. return s && r.push({
  18033. startRow: 0,
  18034. endRow: 0,
  18035. startColumn: i,
  18036. endColumn: n,
  18037. rangeType: De.COLUMN
  18038. }), r;
  18039. }
  18040. getColumnDatas(e, n) {
  18041. const r = {};
  18042. let s = 0;
  18043. for (let i = e; i < e + n; i++) {
  18044. const o = this.getColumnOrCreate(i);
  18045. r[s] = o, s++;
  18046. }
  18047. return r;
  18048. }
  18049. /**
  18050. * Get count of column in the sheet
  18051. * @returns
  18052. */
  18053. getSize() {
  18054. return fn(this._columnData);
  18055. }
  18056. /**
  18057. * Get the width of column
  18058. * @param columnPos column index
  18059. * @returns
  18060. */
  18061. getColumnWidth(e) {
  18062. const { _columnData: n } = this, r = this._config;
  18063. let s = 0;
  18064. return s = (n[e] || {
  18065. hd: we.FALSE,
  18066. w: r.defaultColumnWidth
  18067. }).w || r.defaultColumnWidth, s;
  18068. }
  18069. /**
  18070. * get given column data
  18071. * @param columnPos column index
  18072. */
  18073. getColumn(e) {
  18074. const n = this._columnData[e];
  18075. if (n)
  18076. return n;
  18077. }
  18078. /**
  18079. * Remove column data of given column
  18080. * @param columnPos
  18081. */
  18082. removeColumn(e) {
  18083. delete this._columnData[e];
  18084. }
  18085. /**
  18086. * get given column data or create a column data when it's null
  18087. * @param columnPos column index
  18088. * @returns {Partial<IColumnData>} columnData
  18089. */
  18090. getColumnOrCreate(e) {
  18091. const { _columnData: n } = this, r = n[e];
  18092. if (r)
  18093. return r;
  18094. const s = {};
  18095. return this._columnData[e] = s, s;
  18096. }
  18097. setCustomMetadata(e, n) {
  18098. const r = this.getColumn(e);
  18099. r && (r.custom = n);
  18100. }
  18101. getCustomMetadata(e) {
  18102. var n;
  18103. return (n = this.getColumn(e)) == null ? void 0 : n.custom;
  18104. }
  18105. };
  18106. var Y_ = class {
  18107. constructor(e, n, r) {
  18108. C(this, "_rowData");
  18109. this._config = e, this._viewModel = n, this._rowData = r;
  18110. }
  18111. /**
  18112. * Get height and hidden status of columns in the sheet
  18113. * @returns
  18114. */
  18115. getRowData() {
  18116. return this._rowData;
  18117. }
  18118. /**
  18119. * Get the row style
  18120. * @param {number} row Row index
  18121. * @returns {string | Nullable<IStyleData>} Style data, may be undefined
  18122. */
  18123. getRowStyle(e) {
  18124. var n;
  18125. return (n = this._rowData[e]) == null ? void 0 : n.s;
  18126. }
  18127. /**
  18128. * Set row default style
  18129. * @param {number} row The row index
  18130. * @param {string | Nullable<IStyleData>} style The style data
  18131. */
  18132. setRowStyle(e, n) {
  18133. const r = this.getRowOrCreate(e);
  18134. r.s = n;
  18135. }
  18136. getRowDatas(e, n) {
  18137. const r = {};
  18138. let s = 0;
  18139. for (let i = e; i < e + n; i++) {
  18140. const o = this.getRowOrCreate(i);
  18141. r[s] = o, s++;
  18142. }
  18143. return r;
  18144. }
  18145. getRowHeight(e, n = 1) {
  18146. const { _rowData: r } = this, s = this._config;
  18147. let i = 0;
  18148. for (let o = 0; o < n; o++) {
  18149. const a = r[o + e] || {
  18150. hd: we.FALSE,
  18151. h: s.defaultRowHeight
  18152. }, { ia: u, ah: c, h: l = s.defaultRowHeight } = a;
  18153. i += (u == null || u === we.TRUE) && typeof c == "number" ? c : l;
  18154. }
  18155. return i;
  18156. }
  18157. /**
  18158. * Get row data of given row
  18159. * @param rowPos row index
  18160. * @returns {Nullable<Partial<IRowData>>} rowData
  18161. */
  18162. getRow(e) {
  18163. return this._rowData[e];
  18164. }
  18165. /**
  18166. * Remove row data of given row
  18167. * @param rowPos
  18168. */
  18169. removeRow(e) {
  18170. delete this._rowData[e];
  18171. }
  18172. /**
  18173. * Get given row data or create a row data when it's null
  18174. * @param rowPos row index
  18175. * @returns {Partial<IRowData>} rowData
  18176. */
  18177. getRowOrCreate(e) {
  18178. const { _rowData: n } = this, r = n[e];
  18179. if (r)
  18180. return r;
  18181. const s = {};
  18182. return n[e] = s, s;
  18183. }
  18184. /**
  18185. * Get all hidden rows
  18186. * @param start Start index
  18187. * @param end End index
  18188. * @returns Hidden rows range list
  18189. */
  18190. getHiddenRows(e = 0, n = this.getSize() - 1) {
  18191. const r = [];
  18192. let s = false, i = -1;
  18193. for (let o = e; o <= n; o++) {
  18194. const a = this.getRowRawVisible(o);
  18195. s && a ? (s = false, r.push({
  18196. startRow: i,
  18197. endRow: o - 1,
  18198. startColumn: 0,
  18199. endColumn: 0,
  18200. rangeType: De.ROW
  18201. })) : !s && !a && (s = true, i = o);
  18202. }
  18203. return s && r.push({ startRow: i, endRow: n, startColumn: 0, endColumn: 0, rangeType: De.ROW }), r;
  18204. }
  18205. /**
  18206. * Get all visible rows
  18207. * @param start Start index
  18208. * @param end End index
  18209. * @returns Visible rows range list
  18210. */
  18211. getVisibleRows(e = 0, n = this.getSize() - 1) {
  18212. const r = [];
  18213. let s = false, i = -1;
  18214. for (let o = e; o <= n; o++) {
  18215. const a = this.getRowRawVisible(o);
  18216. s && !a ? (s = false, r.push({
  18217. startRow: i,
  18218. endRow: o - 1,
  18219. startColumn: 0,
  18220. endColumn: 0,
  18221. rangeType: De.ROW
  18222. })) : !s && a && (s = true, i = o);
  18223. }
  18224. return s && r.push({ startRow: i, endRow: n, startColumn: 0, endColumn: 0, rangeType: De.ROW }), r;
  18225. }
  18226. getRowRawVisible(e) {
  18227. const n = this.getRow(e);
  18228. return n ? n.hd !== we.TRUE : true;
  18229. }
  18230. /**
  18231. * Get count of row in the sheet
  18232. * @returns {number} row count
  18233. */
  18234. getSize() {
  18235. return fn(this._rowData);
  18236. }
  18237. setCustomMetadata(e, n) {
  18238. const r = this.getRow(e);
  18239. r && (r.custom = n);
  18240. }
  18241. getCustomMetadata(e) {
  18242. var n;
  18243. return (n = this.getRow(e)) == null ? void 0 : n.custom;
  18244. }
  18245. };
  18246. var lR = "DEFAULT_WORKSHEET_ROW_COUNT";
  18247. var V_ = 1e3;
  18248. var cR = "DEFAULT_WORKSHEET_COLUMN_COUNT";
  18249. var G_ = 20;
  18250. var hR = "DEFAULT_WORKSHEET_ROW_HEIGHT";
  18251. var K_ = 24;
  18252. var dR = "DEFAULT_WORKSHEET_COLUMN_WIDTH";
  18253. var X_ = 88;
  18254. var fR = "DEFAULT_WORKSHEET_ROW_TITLE_WIDTH";
  18255. var J_ = 46;
  18256. var gR = "DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT";
  18257. var Z_ = 20;
  18258. function Q_(t) {
  18259. const e = {
  18260. name: "Sheet1",
  18261. // TODO: name should have i18n
  18262. id: "sheet-01",
  18263. tabColor: "",
  18264. hidden: we.FALSE,
  18265. rowCount: V_,
  18266. columnCount: G_,
  18267. zoomRatio: 1,
  18268. freeze: {
  18269. xSplit: 0,
  18270. ySplit: 0,
  18271. startRow: -1,
  18272. startColumn: -1
  18273. },
  18274. scrollTop: 0,
  18275. scrollLeft: 0,
  18276. defaultColumnWidth: X_,
  18277. defaultRowHeight: K_,
  18278. mergeData: [],
  18279. cellData: {},
  18280. rowData: {},
  18281. columnData: {},
  18282. showGridlines: we.TRUE,
  18283. rowHeader: {
  18284. width: J_,
  18285. hidden: we.FALSE
  18286. },
  18287. columnHeader: {
  18288. height: Z_,
  18289. hidden: we.FALSE
  18290. },
  18291. rightToLeft: we.FALSE
  18292. };
  18293. return Object.keys(e).forEach((n) => {
  18294. const r = n;
  18295. typeof t[r] > "u" && (t[r] = e[r]);
  18296. }), t;
  18297. }
  18298. var q_ = class extends nt {
  18299. constructor(n) {
  18300. super();
  18301. C(this, "_cellCache", /* @__PURE__ */ new Map());
  18302. C(this, "_rowCache", /* @__PURE__ */ new Map());
  18303. C(this, "_columnCache", /* @__PURE__ */ new Map());
  18304. C(this, "_hasRow", false);
  18305. C(this, "_hasColumn", false);
  18306. C(this, "_hasAll", false);
  18307. C(this, "_allIndex", -1);
  18308. C(this, "_mergeData");
  18309. C(this, "_rangeMap", new Qr(5e4));
  18310. C(this, "_skeletonCache", new Qr(5e4));
  18311. this._init(n.concat());
  18312. }
  18313. _init(n) {
  18314. this._mergeData = n, this._createCache(n);
  18315. }
  18316. _clearCache() {
  18317. this._cellCache.clear(), this._rowCache.clear(), this._columnCache.clear(), this._hasAll = false, this._allIndex = -1, this._rangeMap.clear(), this._skeletonCache.clear(), this._hasColumn = false, this._hasRow = false;
  18318. }
  18319. _createCache(n) {
  18320. let r = 0;
  18321. for (const s of n) {
  18322. const { rangeType: i } = s;
  18323. i === De.ROW ? this._createRowCache(s, r) : i === De.COLUMN ? this._createColumnCache(s, r) : i === De.ALL ? this._createCellAllCache(r) : this._createCellCache(s, r), r++;
  18324. }
  18325. }
  18326. /**
  18327. * Rebuild the merge data cache when the merge data is changed.
  18328. * @param {IRange[]} mergeData
  18329. */
  18330. rebuild(n) {
  18331. this._clearCache(), this._init(n.concat());
  18332. }
  18333. _createRowCache(n, r) {
  18334. const { startRow: s, endRow: i } = n;
  18335. for (let o = s; o <= i; o++)
  18336. this._rowCache.set(o, r), this._hasRow = true;
  18337. }
  18338. _createColumnCache(n, r) {
  18339. const { startColumn: s, endColumn: i } = n;
  18340. for (let o = s; o <= i; o++)
  18341. this._columnCache.set(o, r), this._hasColumn = true;
  18342. }
  18343. _createCellAllCache(n) {
  18344. this._hasAll = true, this._allIndex = n;
  18345. }
  18346. _createCellCache(n, r) {
  18347. for (let s = n.startRow; s <= n.endRow; s++) {
  18348. let i = this._cellCache.get(s);
  18349. i == null && (i = /* @__PURE__ */ new Map(), this._cellCache.set(s, i));
  18350. for (let o = n.startColumn; o <= n.endColumn; o++)
  18351. i.set(o, r);
  18352. }
  18353. }
  18354. add(n) {
  18355. this._mergeData.push(n), this._clearCache(), this._createCache(this._mergeData);
  18356. }
  18357. remove(n, r) {
  18358. const s = this._getMergeDataIndex(n, r);
  18359. s !== -1 && (this._mergeData.splice(s, 1), this._clearCache(), this._createCache(this._mergeData));
  18360. }
  18361. getMergedCell(n, r) {
  18362. const s = this._getMergeDataIndex(n, r);
  18363. return s !== -1 ? this._mergeData[s] : null;
  18364. }
  18365. /**
  18366. * Return index of merge data if (row,col) is in merge range. -1 means not in merge range.
  18367. * @param row
  18368. * @param column
  18369. * @returns {number} index of merge range.
  18370. */
  18371. getMergeDataIndex(n, r) {
  18372. return this._getMergeDataIndex(n, r);
  18373. }
  18374. isRowContainsMergedCell(n) {
  18375. return this._hasAll || !re.isEmptyObject(this._columnCache) ? true : this._mergeData.some((r) => r.startRow <= n && n <= r.endRow);
  18376. }
  18377. isColumnContainsMergedCell(n) {
  18378. return this._hasAll || !re.isEmptyObject(this._rowCache) ? true : this._mergeData.some((r) => r.startColumn <= n && n <= r.endColumn);
  18379. }
  18380. getMergedCellRange(n, r, s, i) {
  18381. const o = [], a = `${n}-${r}-${s}-${i}`;
  18382. if (this._rangeMap.has(a))
  18383. return this._getRangeFromCache(a);
  18384. let u = 0;
  18385. const c = [];
  18386. for (const l of this._mergeData || [])
  18387. en.intersects(l, {
  18388. startRow: n,
  18389. endRow: s,
  18390. startColumn: r,
  18391. endColumn: i
  18392. }) && (o.push({
  18393. ...l
  18394. }), c.push(u)), u++;
  18395. return this._rangeMap.set(a, c), o;
  18396. }
  18397. /**
  18398. * @deprecated sigificant performance impact, use _getCellMergeInfo instead.
  18399. * @param startRow
  18400. * @param startColumn
  18401. * @param endRow
  18402. * @param endColumn
  18403. */
  18404. getMergedCellRangeForSkeleton(n, r, s, i) {
  18405. const o = [], a = this._mergeData, u = `${n}-${r}-${s}-${i}`;
  18406. if (this._skeletonCache.has(u))
  18407. return this._getSkeletonRangeFromCache(u);
  18408. const c = [];
  18409. for (let l = 0; l < a.length; l++) {
  18410. const {
  18411. startRow: h,
  18412. endRow: d,
  18413. startColumn: f,
  18414. endColumn: E
  18415. } = a[l];
  18416. for (let R = n; R <= s; R++) {
  18417. let O = false;
  18418. for (let U = r; U <= i; U++)
  18419. if (R >= h && R <= d && U >= f && U <= E) {
  18420. o.push({
  18421. startRow: h,
  18422. endRow: d,
  18423. startColumn: f,
  18424. endColumn: E
  18425. }), c.push(l), O = true;
  18426. break;
  18427. }
  18428. if (O)
  18429. break;
  18430. }
  18431. }
  18432. return this._skeletonCache.set(u, c), o;
  18433. }
  18434. _getRangeFromCache(n) {
  18435. const r = this._rangeMap.get(n) || [], s = [];
  18436. for (const i of r)
  18437. s.push({
  18438. ...this._mergeData[i]
  18439. });
  18440. return s;
  18441. }
  18442. _getSkeletonRangeFromCache(n) {
  18443. const r = this._skeletonCache.get(n) || [], s = [];
  18444. for (const i of r)
  18445. s.push({
  18446. ...this._mergeData[i]
  18447. });
  18448. return s;
  18449. }
  18450. _getMergeDataIndex(n, r) {
  18451. var i;
  18452. if (this._hasAll)
  18453. return this._allIndex;
  18454. if (this._hasRow) {
  18455. const o = this._rowCache.get(n);
  18456. if (o !== void 0)
  18457. return o;
  18458. }
  18459. if (this._hasColumn) {
  18460. const o = this._columnCache.get(r);
  18461. if (o !== void 0)
  18462. return o;
  18463. }
  18464. const s = (i = this._cellCache.get(n)) == null ? void 0 : i.get(r);
  18465. return s !== void 0 ? s : -1;
  18466. }
  18467. getMergeDataSnapshot() {
  18468. return this._mergeData;
  18469. }
  18470. dispose() {
  18471. this._clearCache(), this._mergeData = [];
  18472. }
  18473. };
  18474. var eE = class extends nt {
  18475. constructor(n) {
  18476. super();
  18477. C(this, "_cellContentInterceptor", null);
  18478. C(this, "_rowFilteredInterceptor", null);
  18479. this.getRawCell = n;
  18480. }
  18481. dispose() {
  18482. super.dispose(), this._cellContentInterceptor = null, this._rowFilteredInterceptor = null;
  18483. }
  18484. getCell(n, r, s, i) {
  18485. return this._cellContentInterceptor ? this._cellContentInterceptor.getCell(n, r, Vn.Value | Vn.Style, s, i) : this.getRawCell(n, r);
  18486. }
  18487. getCellValueOnly(n, r) {
  18488. return this._cellContentInterceptor ? this._cellContentInterceptor.getCell(n, r, Vn.Value) : this.getRawCell(n, r);
  18489. }
  18490. getCellStyleOnly(n, r) {
  18491. return this._cellContentInterceptor ? this._cellContentInterceptor.getCell(n, r, Vn.Style) : this.getRawCell(n, r);
  18492. }
  18493. getRowFiltered(n) {
  18494. var r, s;
  18495. return (s = (r = this._rowFilteredInterceptor) == null ? void 0 : r.getRowFiltered(n)) != null ? s : false;
  18496. }
  18497. registerCellContentInterceptor(n) {
  18498. if (this._cellContentInterceptor)
  18499. throw new Error("[SheetViewModel]: Interceptor already registered.");
  18500. return this._cellContentInterceptor = n, Ze(() => this._cellContentInterceptor = null);
  18501. }
  18502. registerRowFilteredInterceptor(n) {
  18503. if (this._rowFilteredInterceptor)
  18504. throw new Error("[SheetViewModel]: Interceptor already registered.");
  18505. return this._rowFilteredInterceptor = n, Ze(() => this._rowFilteredInterceptor = null);
  18506. }
  18507. };
  18508. var _a = {
  18509. isDeepClone: false,
  18510. displayRawFormula: false,
  18511. ignoreTextRotation: false
  18512. };
  18513. var es = class _es {
  18514. constructor(e, n, r) {
  18515. C(this, "_sheetId");
  18516. C(this, "_snapshot");
  18517. C(this, "_cellData");
  18518. C(this, "_rowManager");
  18519. C(this, "_columnManager");
  18520. C(this, "_viewModel");
  18521. C(this, "_spanModel");
  18522. var a;
  18523. this.unitId = e, this._styles = r, this._snapshot = Q_(n);
  18524. const { columnData: s, rowData: i, cellData: o } = this._snapshot;
  18525. this._sheetId = (a = this._snapshot.id) != null ? a : re.generateRandomId(6), this._cellData = new kt(o), this._viewModel = new eE((u, c) => this.getCellRaw(u, c)), this._rowManager = new Y_(this._snapshot, this._viewModel, i), this._columnManager = new z_(this._snapshot, s), this._spanModel = new q_(this._snapshot.mergeData);
  18526. }
  18527. /**
  18528. * @internal
  18529. * @param callback
  18530. */
  18531. __interceptViewModel(e) {
  18532. e(this._viewModel);
  18533. }
  18534. getSnapshot() {
  18535. return this._snapshot;
  18536. }
  18537. /**
  18538. * Set the merge data of the sheet, all the merged cells will be rebuilt.
  18539. * @param mergeData
  18540. */
  18541. setMergeData(e) {
  18542. this._snapshot.mergeData = e, this.getSpanModel().rebuild(e);
  18543. }
  18544. getSpanModel() {
  18545. return this._spanModel;
  18546. }
  18547. getStyleDataByHash(e) {
  18548. return { ...this._styles.get(e) };
  18549. }
  18550. setStyleData(e) {
  18551. return this._styles.setValue(e);
  18552. }
  18553. /**
  18554. * Get the style of the column.
  18555. * @param {number} column The column index
  18556. * @param {boolean} [keepRaw] If true, return the raw style data, otherwise return the style data object
  18557. * @returns {Nullable<IStyleData>|string} The style of the column
  18558. */
  18559. getColumnStyle(e, n = false) {
  18560. return n ? this._columnManager.getColumnStyle(e) : this._styles.get(this._columnManager.getColumnStyle(e));
  18561. }
  18562. /**
  18563. * Set the style of the column.
  18564. * @param {number} column The column index
  18565. * @param {string|Nullable<IStyleData>} style The style to be set
  18566. */
  18567. setColumnStyle(e, n) {
  18568. this._columnManager.setColumnStyle(e, n);
  18569. }
  18570. /**
  18571. * Get the style of the row.
  18572. * @param {number} row The row index
  18573. * @param {boolean} [keepRaw] If true, return the raw style data, otherwise return the style data object
  18574. * @returns {Nullable<IStyleData>} The style of the row
  18575. */
  18576. getRowStyle(e, n = false) {
  18577. return n ? this._rowManager.getRowStyle(e) : this._styles.get(this._rowManager.getRowStyle(e));
  18578. }
  18579. /**
  18580. * Set the style of the row.
  18581. * @param {number} row
  18582. * @param {string|Nullable<IStyleData>} style The style to be set
  18583. */
  18584. setRowStyle(e, n) {
  18585. this._rowManager.setRowStyle(e, n);
  18586. }
  18587. /**
  18588. * this function is used to mixin default style to cell raw{number}
  18589. * @param {number} row The row index
  18590. * @param {number} col The column index
  18591. * @param cellRaw The cell raw data
  18592. * @param {boolean} isRowStylePrecedeColumnStyle The priority of row style and column style
  18593. */
  18594. mixinDefaultStyleToCellRaw(e, n, r, s) {
  18595. const i = this.getColumnStyle(n), o = this.getRowStyle(e), a = this.getDefaultCellStyleInternal();
  18596. if (a || i || o) {
  18597. let u = r == null ? void 0 : r.s;
  18598. typeof u == "string" && (u = this._styles.get(u));
  18599. const c = s ? Mo(a, i, o, u) : Mo(a, o, i, u);
  18600. r || (r = {}), r.s = c;
  18601. }
  18602. }
  18603. /**
  18604. * Get the default style of the worksheet.
  18605. * @returns {Nullable<IStyleData>} Default Style
  18606. */
  18607. getDefaultCellStyle() {
  18608. return this._snapshot.defaultStyle;
  18609. }
  18610. getDefaultCellStyleInternal() {
  18611. const e = this._snapshot.defaultStyle;
  18612. return this._styles.get(e);
  18613. }
  18614. /**
  18615. * Set Default Style, if the style has been set, all cells style will be base on this style.
  18616. * @param {Nullable<IStyleData>} style The style to be set as default style
  18617. */
  18618. setDefaultCellStyle(e) {
  18619. this._snapshot.defaultStyle = e;
  18620. }
  18621. /**
  18622. * Returns WorkSheet Cell Data Matrix
  18623. * @returns WorkSheet Cell Data Matrix
  18624. */
  18625. getCellMatrix() {
  18626. return this._cellData;
  18627. }
  18628. /**
  18629. * Get worksheet printable cell range.
  18630. * @returns
  18631. */
  18632. // eslint-disable-next-line max-lines-per-function
  18633. getCellMatrixPrintRange() {
  18634. const e = this.getCellMatrix(), n = this.getMergeData();
  18635. let r = -1, s = -1, i = -1, o = -1, a = false, u = false;
  18636. return e.forEach((c, l) => {
  18637. Object.keys(l).forEach((h) => {
  18638. const d = +h, f = e.getValue(c, d), E = f != null && f.s ? this._styles.get(f.s) : null, R = (E == null ? void 0 : E.bd) && (E.bd.b || E.bd.l || E.bd.r || E.bd.t || E.bd.bc_tr || E.bd.bl_tr || E.bd.ml_tr || E.bd.tl_bc || E.bd.tl_br || E.bd.tl_mr);
  18639. (f && (f.v || f.p) || E != null && E.bg || R) && (a ? r = Math.min(r, c) : (r = c, a = true), s = Math.max(s, c), u ? i = Math.min(i, d) : (u = true, i = d), o = Math.max(o, d));
  18640. });
  18641. }), n.forEach((c) => {
  18642. a ? r = Math.min(r, c.startRow) : (r = c.startRow, a = true), s = Math.max(s, c.endRow), u ? i = Math.min(i, c.startColumn) : (i = c.startColumn, a = true), o = Math.max(o, c.endColumn);
  18643. }), !a || !u ? null : {
  18644. startColumn: i,
  18645. startRow: r,
  18646. endColumn: o,
  18647. endRow: s
  18648. };
  18649. }
  18650. /**
  18651. * Returns Row Manager
  18652. * @returns Row Manager
  18653. */
  18654. getRowManager() {
  18655. return this._rowManager;
  18656. }
  18657. /**
  18658. * Returns the ID of its parent unit.
  18659. */
  18660. getUnitId() {
  18661. return this.unitId;
  18662. }
  18663. /**
  18664. * Returns the ID of the sheet represented by this object.
  18665. * @returns ID of the sheet
  18666. */
  18667. getSheetId() {
  18668. return this._sheetId;
  18669. }
  18670. /**
  18671. * Returns Column Manager
  18672. * @returns Column Manager
  18673. */
  18674. getColumnManager() {
  18675. return this._columnManager;
  18676. }
  18677. /**
  18678. * Returns the name of the sheet.
  18679. * @returns name of the sheet
  18680. */
  18681. getName() {
  18682. return this._snapshot.name;
  18683. }
  18684. /**
  18685. * Returns WorkSheet Clone Object
  18686. * @returns WorkSheet Clone Object
  18687. * @deprecated
  18688. */
  18689. clone() {
  18690. const { _snapshot: e } = this, n = re.deepClone(e);
  18691. return new _es(this.unitId, n, this._styles);
  18692. }
  18693. /**
  18694. * Get the merged cell list of the sheet.
  18695. * @returns {IRange[]} merged cell list
  18696. */
  18697. getMergeData() {
  18698. return this._spanModel.getMergeDataSnapshot();
  18699. }
  18700. /**
  18701. * Get the merged cell Range of the sheet cell.
  18702. * If (row, col) is not in a merged cell, return null
  18703. *
  18704. * @param {number} row The row index of test cell
  18705. * @param {number} col The column index of test cell
  18706. * @returns {Nullable<IRange>} The merged cell range of the cell, if the cell is not in a merged cell, return null
  18707. */
  18708. getMergedCell(e, n) {
  18709. return this._spanModel.getMergedCell(e, n);
  18710. }
  18711. /**
  18712. * Get the merged cell info list which has intersection with the given range.
  18713. * @param {number} startRow The start row index of the range
  18714. * @param {number} startColumn The start column index of the range
  18715. * @param {number} endRow The end row index of the range
  18716. * @param {number} endColumn The end column index of the range
  18717. * @returns {IRange} The merged cell info list which has intersection with the given range or empty array if no merged cell in the range
  18718. */
  18719. getMergedCellRange(e, n, r, s) {
  18720. return this._spanModel.getMergedCellRange(e, n, r, s);
  18721. }
  18722. /**
  18723. * Get if the row contains merged cell
  18724. * @param {number} row The row index
  18725. * @returns {boolean} Is merge cell across row
  18726. */
  18727. isRowContainsMergedCell(e) {
  18728. return this._spanModel.isRowContainsMergedCell(e);
  18729. }
  18730. /**
  18731. * Get if the column contains merged cell
  18732. * @param {number} column The column index
  18733. * @returns {boolean} Is merge cell across column
  18734. */
  18735. isColumnContainsMergedCell(e) {
  18736. return this._spanModel.isColumnContainsMergedCell(e);
  18737. }
  18738. /**
  18739. * Get cell info with merge data
  18740. * @param {number} row - The row index of the cell.
  18741. * @param {number} column - The column index of the cell.
  18742. * @type {selectionCell}
  18743. * @property {number} actualRow - The actual row index of the cell
  18744. * @property {number} actualColumn - The actual column index of the cell
  18745. * @property {boolean} isMergedMainCell - Whether the cell is the main cell of the merged cell, only the upper left cell in the merged cell returns true here
  18746. * @property {boolean} isMerged - Whether the cell is in a merged cell, the upper left cell in the merged cell returns false here
  18747. * @property {number} endRow - The end row index of the merged cell
  18748. * @property {number} endColumn - The end column index of the merged cell
  18749. * @property {number} startRow - The start row index of the merged cell
  18750. * @property {number} startColumn - The start column index of the merged cell
  18751. * @returns {selectionCell} - The cell info with merge data
  18752. */
  18753. getCellInfoInMergeData(e, n) {
  18754. const r = this.getMergedCell(e, n);
  18755. let s = false, i = false, o = e, a = n, u = e, c = n;
  18756. if (r) {
  18757. const {
  18758. startRow: l,
  18759. endRow: h,
  18760. startColumn: d,
  18761. endColumn: f
  18762. } = r;
  18763. e === l && n === d ? (o = h, a = f, u = l, c = d, i = true) : e >= l && e <= h && n >= d && n <= f && (o = h, a = f, u = l, c = d, s = true);
  18764. }
  18765. return {
  18766. actualRow: e,
  18767. actualColumn: n,
  18768. isMergedMainCell: i,
  18769. isMerged: s,
  18770. endRow: o,
  18771. endColumn: a,
  18772. startRow: u,
  18773. startColumn: c
  18774. };
  18775. }
  18776. /**
  18777. * Get cellData, includes cellData, customRender, markers, dataValidate, etc.
  18778. *
  18779. * WARNING: All sheet CELL_CONTENT interceptors will be called in this method, cause performance issue.
  18780. * example: this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT);
  18781. *
  18782. * @param row
  18783. * @param col
  18784. * @returns ICellDataForSheetInterceptor
  18785. */
  18786. getCell(e, n) {
  18787. return e < 0 || n < 0 ? null : this._viewModel.getCell(e, n);
  18788. }
  18789. /**
  18790. * Get cellData only use effect on value interceptor
  18791. * @param {number} number row The row index of the cell.
  18792. * @param {number} number col The column index of the cell.
  18793. * @returns {Nullable<ICellDataForSheetInterceptor>} The cell data only use effect on value interceptor
  18794. */
  18795. getCellValueOnly(e, n) {
  18796. return e < 0 || n < 0 ? null : this._viewModel.getCellValueOnly(e, n);
  18797. }
  18798. /**
  18799. * Get cellData only use effect on style interceptor
  18800. * @param {number} row The row index of the cell.
  18801. * @param {number} col The column index of the cell.
  18802. * @returns {Nullable<ICellDataForSheetInterceptor>} The cell data only use effect on style interceptor
  18803. */
  18804. getCellStyleOnly(e, n) {
  18805. return e < 0 || n < 0 ? null : this._viewModel.getCellStyleOnly(e, n);
  18806. }
  18807. getCellRaw(e, n) {
  18808. return this.getCellMatrix().getValue(e, n);
  18809. }
  18810. // eslint-disable-next-line ts/no-explicit-any
  18811. getCellWithFilteredInterceptors(e, n, r, s) {
  18812. return this._viewModel.getCell(e, n, r, s);
  18813. }
  18814. getRowFiltered(e) {
  18815. return this._viewModel.getRowFiltered(e);
  18816. }
  18817. getMatrixWithMergedCells(e, n, r, s, i = zn.Raw) {
  18818. const o = this.getCellMatrix(), a = this._spanModel.getMergedCellRange(e, n, r, s), u = new kt();
  18819. return Qo(e, r, n, s).forEach((c, l) => {
  18820. var d;
  18821. let h;
  18822. if (i === zn.Raw)
  18823. h = this.getCellRaw(c, l);
  18824. else if (i === zn.Intercepted)
  18825. h = this.getCell(c, l);
  18826. else if (i === zn.Both) {
  18827. const f = this.getCellRaw(c, l);
  18828. if (f) {
  18829. h = { ...f };
  18830. const E = (d = this.getCell(c, l)) == null ? void 0 : d.v;
  18831. j_(E) && h && (h.displayV = String(E));
  18832. }
  18833. }
  18834. h && u.setValue(c, l, h);
  18835. }), a.forEach((c) => {
  18836. const { startColumn: l, startRow: h, endColumn: d, endRow: f } = c;
  18837. Qo(h, f, l, d).forEach((E, R) => {
  18838. E === h && R === l && u.setValue(E, R, {
  18839. ...o.getValue(E, R),
  18840. rowSpan: f - h + 1,
  18841. colSpan: d - l + 1
  18842. }), (E !== h || R !== l) && u.realDeleteValue(E, R);
  18843. });
  18844. }), u;
  18845. }
  18846. getRange(e, n, r, s) {
  18847. return typeof e == "object" ? new tr(this, e, {
  18848. getStyles: () => this._styles
  18849. }) : new tr(
  18850. this,
  18851. {
  18852. startRow: e,
  18853. startColumn: n,
  18854. endColumn: s || n,
  18855. endRow: r || e
  18856. },
  18857. {
  18858. getStyles: () => this._styles
  18859. }
  18860. );
  18861. }
  18862. getScrollLeftTopFromSnapshot() {
  18863. return {
  18864. scrollLeft: this._snapshot.scrollLeft,
  18865. scrollTop: this._snapshot.scrollTop
  18866. };
  18867. }
  18868. /**
  18869. * Return WorkSheetZoomRatio
  18870. * @return zoomRatio
  18871. */
  18872. getZoomRatio() {
  18873. return this._snapshot.zoomRatio || 1;
  18874. }
  18875. /**
  18876. * Returns WorkSheet Configures
  18877. * @returns WorkSheet Configures
  18878. */
  18879. getConfig() {
  18880. return this._snapshot;
  18881. }
  18882. /**
  18883. * Returns frozen.
  18884. * @returns frozen
  18885. */
  18886. getFreeze() {
  18887. return this._snapshot.freeze;
  18888. }
  18889. /**
  18890. * Returns the current number of columns in the sheet, regardless of content.
  18891. * @returns the current number of columns in the sheet, regardless of content
  18892. */
  18893. getMaxColumns() {
  18894. const { _snapshot: e } = this, { columnCount: n } = e;
  18895. return n;
  18896. }
  18897. /**
  18898. * Returns the current number of rows in the sheet, regardless of content.
  18899. * @returns the current number of rows in the sheet, regardless of content
  18900. */
  18901. getMaxRows() {
  18902. const { _snapshot: e } = this, { rowCount: n } = e;
  18903. return n;
  18904. }
  18905. getRowCount() {
  18906. return this._snapshot.rowCount;
  18907. }
  18908. setRowCount(e) {
  18909. this._snapshot.rowCount = e;
  18910. }
  18911. getColumnCount() {
  18912. return this._snapshot.columnCount;
  18913. }
  18914. setColumnCount(e) {
  18915. this._snapshot.columnCount = e;
  18916. }
  18917. /**
  18918. * isSheetHidden
  18919. * @returns hidden status of sheet
  18920. */
  18921. isSheetHidden() {
  18922. return this._snapshot.hidden;
  18923. }
  18924. /**
  18925. * Returns true if the sheet's gridlines are hidden; otherwise returns false. Gridlines are visible by default.
  18926. * @returns {boolean} Gridlines Hidden Status.
  18927. */
  18928. hasHiddenGridlines() {
  18929. const { _snapshot: e } = this, { showGridlines: n } = e;
  18930. return n === 0;
  18931. }
  18932. /**
  18933. * Returns the color of the gridlines, or undefined if the gridlines are not colored.
  18934. * @returns {string | undefined} returns the color of the gridlines, or undefined if the gridlines are default.
  18935. */
  18936. getGridlinesColor() {
  18937. return this.getConfig().gridlinesColor;
  18938. }
  18939. /**
  18940. * Gets the sheet tab color, or null if the sheet tab has no color.
  18941. * @returns the sheet tab color or null
  18942. */
  18943. getTabColor() {
  18944. const { _snapshot: e } = this, { tabColor: n } = e;
  18945. return n;
  18946. }
  18947. /**
  18948. * Gets the width in pixels of the given column.
  18949. * @param columnPosition column index
  18950. * @returns Gets the width in pixels of the given column.
  18951. */
  18952. getColumnWidth(e) {
  18953. return this.getColumnManager().getColumnWidth(e);
  18954. }
  18955. /**
  18956. * Gets the height in pixels of the given row.
  18957. * @param row row index
  18958. * @returns Gets the height in pixels of the given row.
  18959. */
  18960. getRowHeight(e) {
  18961. return this._viewModel.getRowFiltered(e) ? 0 : this.getRowManager().getRowHeight(e);
  18962. }
  18963. /**
  18964. * Row is filtered out, that means this row is invisible.
  18965. * @param row
  18966. * @returns {boolean} is row hidden by filter
  18967. */
  18968. isRowFiltered(e) {
  18969. return this._viewModel.getRowFiltered(e);
  18970. }
  18971. /**
  18972. * Get if the row is visible. It may be affected by features like filter and view.
  18973. * @param row the row index
  18974. * @returns {boolean} if the row in visible to the user
  18975. */
  18976. getRowVisible(e) {
  18977. return !this.isRowFiltered(e) && this.getRowRawVisible(e);
  18978. }
  18979. /**
  18980. * Get if the row does not have `hidden` property. This value won't affected by features like filter and view.
  18981. * @param row the row index
  18982. * @returns if the row does not have `hidden` property
  18983. */
  18984. getRowRawVisible(e) {
  18985. return this.getRowManager().getRowRawVisible(e);
  18986. }
  18987. getHiddenRows(e, n) {
  18988. const r = this.getMaxColumns() - 1, s = this._rowManager.getHiddenRows(e, n);
  18989. return s.forEach((i) => i.endColumn = r), s;
  18990. }
  18991. getColVisible(e) {
  18992. return this._columnManager.getColVisible(e);
  18993. }
  18994. getHiddenCols(e, n) {
  18995. const r = this.getMaxRows() - 1, s = this._columnManager.getHiddenCols(e, n);
  18996. return s.forEach((i) => i.endRow = r), s;
  18997. }
  18998. /**
  18999. * Get all visible rows in the sheet.(not include filter & view, like getRawVisibleRows)
  19000. * @returns Visible rows range list
  19001. */
  19002. getVisibleRows() {
  19003. const e = this.getRowCount();
  19004. return this._rowManager.getVisibleRows(0, e - 1);
  19005. }
  19006. /**
  19007. * Get all visible columns in the sheet.(not include filter & view)
  19008. * @returns Visible columns range list
  19009. */
  19010. getVisibleCols() {
  19011. const e = this.getColumnCount();
  19012. return this._columnManager.getVisibleCols(0, e - 1);
  19013. }
  19014. /**
  19015. * Returns true if this sheet layout is right-to-left. Returns false if the sheet uses the default left-to-right layout.
  19016. * @returns true if this sheet layout is right-to-left. Returns false if the sheet uses the default left-to-right layout.
  19017. */
  19018. isRightToLeft() {
  19019. const { _snapshot: e } = this, { rightToLeft: n } = e;
  19020. return n;
  19021. }
  19022. /**
  19023. * Returns the position of the last row that has content.
  19024. * @returns the position of the last row that has content.
  19025. */
  19026. getLastRowWithContent() {
  19027. return this._cellData.getLength() - 1;
  19028. }
  19029. /**
  19030. * Returns the position of the last column that has content.
  19031. * @returns the position of the last column that has content.
  19032. */
  19033. getLastColumnWithContent() {
  19034. return this._cellData.getRange().endColumn;
  19035. }
  19036. getDataRangeScope() {
  19037. return this._cellData.getStartEndScope();
  19038. }
  19039. cellHasValue(e) {
  19040. return e && (e.v !== void 0 || e.f !== void 0 || e.p !== void 0);
  19041. }
  19042. // #region iterators
  19043. // NOTE: performance intensive. Should keep an eye on methods in this region.
  19044. /**
  19045. * Iterate a range row by row.
  19046. *
  19047. * Performance intensive.
  19048. *
  19049. * @param range the iterate range
  19050. * @param skipEmpty whether to skip empty cells, default to be `true`
  19051. */
  19052. iterateByRow(e, n = true) {
  19053. const { startRow: r, startColumn: s, endRow: i, endColumn: o } = e, a = this;
  19054. return {
  19055. [Symbol.iterator]: () => {
  19056. let u = r, c = s;
  19057. return {
  19058. next() {
  19059. for (; ; ) {
  19060. if (c > o && (u += 1, c = s), u > i)
  19061. return { done: true, value: void 0 };
  19062. const l = a.getCell(u, c), h = !l, d = a.getMergedCell(u, c);
  19063. if (d) {
  19064. if (u !== d.startRow || c !== d.startColumn) {
  19065. c = d.endColumn + 1;
  19066. continue;
  19067. }
  19068. if (h && n) {
  19069. c = d.endColumn + 1;
  19070. continue;
  19071. }
  19072. const E = { row: u, col: c, value: l };
  19073. return E.colSpan = d.endColumn - d.startColumn + 1, E.rowSpan = d.endRow - d.startRow + 1, c = d.endColumn + 1, { done: false, value: E };
  19074. }
  19075. if (h && n)
  19076. c += 1;
  19077. else {
  19078. const f = { row: u, col: c, value: l };
  19079. return c += 1, { done: false, value: f };
  19080. }
  19081. }
  19082. }
  19083. };
  19084. }
  19085. };
  19086. }
  19087. /**
  19088. * Iterate a range column by column. This is pretty similar to `iterateByRow` but with different order.
  19089. *
  19090. * Performance intensive.
  19091. *
  19092. * @param range The iterate range.
  19093. * @param skipEmpty Whether to skip empty cells, default to be `true`.
  19094. * @param skipNonTopLeft Whether to skip non-top-left cells of merged cells, default to be `true`. If the
  19095. * parameter is set to `false`, the iterator will return cells in the top row.
  19096. */
  19097. iterateByColumn(e, n = true, r = true) {
  19098. const { startRow: s, startColumn: i, endRow: o, endColumn: a } = e, u = this;
  19099. return {
  19100. [Symbol.iterator]: () => {
  19101. let c = s, l = i;
  19102. return {
  19103. next() {
  19104. for (; ; ) {
  19105. if (c > o && (l += 1, c = s), l > a)
  19106. return { done: true, value: void 0 };
  19107. const h = u.getMergedCell(c, l);
  19108. if (h) {
  19109. const E = c !== h.startRow, R = E || l !== h.startColumn;
  19110. if (r && R || !r && E) {
  19111. c = h.endRow + 1;
  19112. continue;
  19113. }
  19114. const O = u.getCell(h.startRow, h.startColumn);
  19115. if (!O && n) {
  19116. c = h.endRow + 1;
  19117. continue;
  19118. }
  19119. const ne = { row: c, col: h.startColumn, value: O };
  19120. return ne.colSpan = h.endColumn - h.startColumn + 1, ne.rowSpan = h.endRow - h.startRow + 1, c = h.endRow + 1, { done: false, value: ne };
  19121. }
  19122. const d = u.getCell(c, l);
  19123. if (!d && n)
  19124. c += 1;
  19125. else {
  19126. const E = { row: c, col: l, value: d };
  19127. return c += 1, { done: false, value: E };
  19128. }
  19129. }
  19130. }
  19131. };
  19132. }
  19133. };
  19134. }
  19135. /**
  19136. * This method generates a document model based on the cell's properties and handles the associated styles and configurations.
  19137. * If the cell does not exist, it will return null.
  19138. * PS: This method has significant impact on performance.
  19139. * @param cell
  19140. * @param options
  19141. */
  19142. // eslint-disable-next-line complexity, max-lines-per-function
  19143. _getCellDocumentModel(e, n = _a) {
  19144. var R;
  19145. const { isDeepClone: r, displayRawFormula: s, ignoreTextRotation: i } = {
  19146. ..._a,
  19147. ...n
  19148. }, o = this._styles.getStyleByCell(e);
  19149. if (!e)
  19150. return;
  19151. let a, u = "document";
  19152. const c = $_(o), l = i ? gt.tr : c.textRotation || gt.tr;
  19153. let h = c.horizontalAlign || gt.ht;
  19154. const d = c.verticalAlign || gt.vt, f = c.wrapStrategy || gt.tb, E = c.paddingData || ti;
  19155. if (e.f && s)
  19156. a = Sr(e.f.toString(), {}, { verticalAlign: d }), h = gt.ht;
  19157. else if (e.p) {
  19158. const { centerAngle: O, vertexAngle: U } = ll(l);
  19159. a = this._updateConfigAndGetDocumentModel(
  19160. r ? re.deepClone(e.p) : e.p,
  19161. h,
  19162. E,
  19163. {
  19164. horizontalAlign: h,
  19165. verticalAlign: d,
  19166. centerAngle: O,
  19167. vertexAngle: U,
  19168. wrapStrategy: f,
  19169. zeroWidthParagraphBreak: 1
  19170. }
  19171. );
  19172. } else if (e.v != null) {
  19173. const O = pa(o);
  19174. u = ma(O).fontCache;
  19175. let U = tE(e);
  19176. e.t === dn.FORCE_STRING && s && (U = `'${U}`), a = Sr(U, O, {
  19177. ...c,
  19178. textRotation: l,
  19179. cellValueType: e.t
  19180. });
  19181. }
  19182. return a && e.linkUrl && e.linkId && B_(a, e.linkUrl, e.linkId), {
  19183. documentModel: a,
  19184. fontString: u,
  19185. textRotation: l,
  19186. wrapStrategy: f,
  19187. verticalAlign: d,
  19188. horizontalAlign: h,
  19189. paddingData: E,
  19190. fill: (R = o == null ? void 0 : o.bg) == null ? void 0 : R.rgb
  19191. };
  19192. }
  19193. _updateConfigAndGetDocumentModel(e, n, r, s) {
  19194. var o, a, u, c, l;
  19195. if (!s || !((o = e.body) != null && o.dataStream))
  19196. return;
  19197. e.documentStyle || (e.documentStyle = {}), e.documentStyle.marginTop = (a = r.t) != null ? a : 0, e.documentStyle.marginBottom = (u = r.b) != null ? u : 2, e.documentStyle.marginLeft = (c = r.l) != null ? c : 2, e.documentStyle.marginRight = (l = r.r) != null ? l : 2, e.documentStyle.pageSize = {
  19198. width: Number.POSITIVE_INFINITY,
  19199. height: Number.POSITIVE_INFINITY
  19200. }, e.documentStyle.renderConfig = {
  19201. ...e.documentStyle.renderConfig,
  19202. ...s
  19203. };
  19204. const i = e.body.paragraphs || [];
  19205. for (const h of i)
  19206. h.paragraphStyle || (h.paragraphStyle = {}), h.paragraphStyle.horizontalAlign = n;
  19207. return new jt(e);
  19208. }
  19209. /**
  19210. * Only used for cell edit, and no need to rotate text when edit cell content!
  19211. */
  19212. getBlankCellDocumentModel(e) {
  19213. const n = this._getCellDocumentModel(e, { ignoreTextRotation: true }), r = this._styles.getStyleByCell(e), s = pa(r);
  19214. if (n != null)
  19215. return n.documentModel == null && (n.documentModel = Sr("", s)), n;
  19216. const i = "";
  19217. let o = "document";
  19218. const a = gt.tr, u = gt.ht, c = gt.vt, l = gt.tb, h = ti;
  19219. return o = ma({}).fontCache, {
  19220. documentModel: Sr(i, s),
  19221. fontString: o,
  19222. textRotation: a,
  19223. wrapStrategy: l,
  19224. verticalAlign: c,
  19225. horizontalAlign: u,
  19226. paddingData: h
  19227. };
  19228. }
  19229. // Only used for cell edit, and no need to rotate text when edit cell content!
  19230. getCellDocumentModelWithFormula(e) {
  19231. return this._getCellDocumentModel(e, {
  19232. isDeepClone: true,
  19233. displayRawFormula: true,
  19234. ignoreTextRotation: true
  19235. });
  19236. }
  19237. /**
  19238. * Get custom metadata of worksheet
  19239. * @returns {CustomData | undefined} custom metadata
  19240. */
  19241. getCustomMetadata() {
  19242. return this._snapshot.custom;
  19243. }
  19244. /**
  19245. * Set custom metadata of workbook
  19246. * @param {CustomData | undefined} custom custom metadata
  19247. */
  19248. setCustomMetadata(e) {
  19249. this._snapshot.custom = e;
  19250. }
  19251. };
  19252. function tE(t) {
  19253. var r, s;
  19254. if (!t)
  19255. return "";
  19256. const e = (s = (r = t.p) == null ? void 0 : r.body) == null ? void 0 : s.dataStream;
  19257. if (e)
  19258. return st.transform.getPlainText(e);
  19259. const n = t.v;
  19260. return typeof n == "string" ? t.t === dn.BOOLEAN ? n.toUpperCase() : n.replace(/[\r\n]/g, "") : typeof n == "number" ? t.t === dn.BOOLEAN ? n ? "TRUE" : "FALSE" : n.toString() : typeof n == "boolean" ? n ? "TRUE" : "FALSE" : "";
  19261. }
  19262. function pR(t) {
  19263. if (t === null)
  19264. return "";
  19265. if (t != null && t.p) {
  19266. const e = t == null ? void 0 : t.p.body;
  19267. if (e == null)
  19268. return "";
  19269. const n = e.dataStream;
  19270. return st.transform.getPlainText(n);
  19271. }
  19272. return t == null ? void 0 : t.v;
  19273. }
  19274. var nE = Object.defineProperty;
  19275. var rE = Object.getOwnPropertyDescriptor;
  19276. var sE = (t, e, n, r) => {
  19277. for (var s = r > 1 ? void 0 : r ? rE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  19278. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  19279. return r && s && nE(e, n, s), s;
  19280. };
  19281. var iE = (t, e) => (n, r) => e(n, r, t);
  19282. function mR(t, e) {
  19283. return `${t.getUnitId()}|${e.getSheetId()}`;
  19284. }
  19285. var ts = class extends Ui {
  19286. constructor(e = {}, n) {
  19287. super();
  19288. C(this, "type", Fe.UNIVER_SHEET);
  19289. C(this, "_sheetCreated$", new Subject());
  19290. C(this, "sheetCreated$", this._sheetCreated$.asObservable());
  19291. C(this, "_sheetDisposed$", new Subject());
  19292. C(this, "sheetDisposed$", this._sheetDisposed$.asObservable());
  19293. C(this, "_activeSheet$", new BehaviorSubject(null));
  19294. C(this, "activeSheet$", this._activeSheet$.asObservable());
  19295. C(this, "_worksheets");
  19296. C(this, "_styles");
  19297. C(this, "_snapshot");
  19298. C(this, "_unitId");
  19299. C(this, "_count");
  19300. C(this, "_name$");
  19301. C(this, "name$");
  19302. this._logService = n;
  19303. const r = P_();
  19304. re.isEmptyObject(e) ? this._snapshot = r : this._snapshot = re.commonExtend(r, e);
  19305. const { styles: s } = this._snapshot;
  19306. (this._snapshot.id == null || this._snapshot.id.length === 0) && (this._snapshot.id = re.generateRandomId(6)), this._unitId = this._snapshot.id, this._styles = new k_(s), this._count = 1, this._worksheets = /* @__PURE__ */ new Map(), this._name$ = new BehaviorSubject(e.name || ""), this.name$ = this._name$.asObservable(), this._parseWorksheetSnapshots();
  19307. }
  19308. get _activeSheet() {
  19309. return this._activeSheet$.getValue();
  19310. }
  19311. get name() {
  19312. return this._name$.getValue();
  19313. }
  19314. static isIRangeType(e) {
  19315. return typeof e == "string" || "startRow" in e || "row" in e;
  19316. }
  19317. dispose() {
  19318. super.dispose(), this._sheetCreated$.complete(), this._sheetDisposed$.complete(), this._activeSheet$.complete(), this._name$.complete();
  19319. }
  19320. /**
  19321. * Create a clone of the current snapshot.
  19322. * Call resourceLoaderService.saveWorkbook to save the data associated with the current plugin if needed.
  19323. * @memberof Workbook
  19324. */
  19325. save() {
  19326. return re.deepClone(this._snapshot);
  19327. }
  19328. /**
  19329. * Get current snapshot reference.
  19330. * Call resourceLoaderService.saveWorkbook to save the data associated with the current plugin if needed.
  19331. * @return {*} {IWorkbookData}
  19332. * @memberof Workbook
  19333. */
  19334. getSnapshot() {
  19335. return this._snapshot;
  19336. }
  19337. /** @deprecated use use name property instead */
  19338. getName() {
  19339. return this._snapshot.name;
  19340. }
  19341. setName(e) {
  19342. this._name$.next(e), this._snapshot.name = e;
  19343. }
  19344. getUnitId() {
  19345. return this._unitId;
  19346. }
  19347. getRev() {
  19348. var e;
  19349. return (e = this._snapshot.rev) != null ? e : 1;
  19350. }
  19351. incrementRev() {
  19352. this._snapshot.rev = this.getRev() + 1;
  19353. }
  19354. setRev(e) {
  19355. this._snapshot.rev = e;
  19356. }
  19357. /**
  19358. * Add a Worksheet into Workbook.
  19359. */
  19360. addWorksheet(e, n, r) {
  19361. const { sheets: s, sheetOrder: i } = this._snapshot;
  19362. if (s[e])
  19363. return false;
  19364. s[e] = r, i.splice(n, 0, e);
  19365. const o = new es(this._unitId, r, this._styles);
  19366. return this._worksheets.set(e, o), this._sheetCreated$.next(o), true;
  19367. }
  19368. getSheetOrders() {
  19369. return this._snapshot.sheetOrder;
  19370. }
  19371. getWorksheets() {
  19372. return this._worksheets;
  19373. }
  19374. getActiveSpreadsheet() {
  19375. return this;
  19376. }
  19377. getStyles() {
  19378. return this._styles;
  19379. }
  19380. getConfig() {
  19381. return this._snapshot;
  19382. }
  19383. getIndexBySheetId(e) {
  19384. const { sheetOrder: n } = this._snapshot;
  19385. return n.findIndex((r) => r === e);
  19386. }
  19387. getActiveSheet(e) {
  19388. if (!this._activeSheet && typeof e > "u")
  19389. throw new Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);
  19390. return this._activeSheet;
  19391. }
  19392. /**
  19393. * If there is no active sheet, the first sheet would
  19394. * be set active.
  19395. * @returns
  19396. */
  19397. ensureActiveSheet() {
  19398. const e = this._activeSheet;
  19399. if (e)
  19400. return e;
  19401. const n = this._snapshot.sheetOrder;
  19402. for (let s = 0, i = n.length; s < i; s++) {
  19403. const o = this._worksheets.get(n[s]);
  19404. if (o && o.isSheetHidden() !== we.TRUE)
  19405. return this.setActiveSheet(o), o;
  19406. }
  19407. const r = this._worksheets.get(n[0]);
  19408. return this.setActiveSheet(r), r;
  19409. }
  19410. /**
  19411. * ActiveSheet should not be null!
  19412. * There is at least one sheet in a workbook. You can not delete all sheets in a workbook.
  19413. * @param worksheet
  19414. */
  19415. setActiveSheet(e) {
  19416. this._activeSheet$.next(e);
  19417. }
  19418. removeSheet(e) {
  19419. const n = this._worksheets.get(e);
  19420. return n ? (this._worksheets.delete(e), this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(e), 1), delete this._snapshot.sheets[e], this._sheetDisposed$.next(n), true) : false;
  19421. }
  19422. getActiveSheetIndex() {
  19423. const { sheetOrder: e } = this._snapshot;
  19424. return e.findIndex((n) => this._worksheets.get(n) === this._activeSheet);
  19425. }
  19426. getSheetSize() {
  19427. return this._snapshot.sheetOrder.length;
  19428. }
  19429. getSheets() {
  19430. const { sheetOrder: e } = this._snapshot;
  19431. return e.map((n) => this._worksheets.get(n));
  19432. }
  19433. getSheetsName() {
  19434. const { sheetOrder: e } = this._snapshot, n = [];
  19435. return e.forEach((r) => {
  19436. const s = this._worksheets.get(r);
  19437. s && n.push(s.getName());
  19438. }), n;
  19439. }
  19440. getSheetIndex(e) {
  19441. const { sheetOrder: n } = this._snapshot;
  19442. return n.findIndex((r) => e.getSheetId() === r);
  19443. }
  19444. getSheetBySheetName(e) {
  19445. const { sheetOrder: n } = this._snapshot, r = n.find((s) => this._worksheets.get(s).getName() === e);
  19446. return this._worksheets.get(r);
  19447. }
  19448. getSheetBySheetId(e) {
  19449. return this._worksheets.get(e);
  19450. }
  19451. getSheetByIndex(e) {
  19452. const { sheetOrder: n } = this._snapshot;
  19453. return this._worksheets.get(n[e]);
  19454. }
  19455. getHiddenWorksheets() {
  19456. return this.getSheets().filter((e) => e.getConfig().hidden === we.TRUE).map((e) => e.getConfig().id);
  19457. }
  19458. getUnhiddenWorksheets() {
  19459. return this.getSheets().filter((e) => e.getConfig().hidden !== we.TRUE).map((e) => e.getConfig().id);
  19460. }
  19461. load(e) {
  19462. this._snapshot = e;
  19463. }
  19464. /**
  19465. * Check if sheet name is unique
  19466. * @param name sheet name
  19467. * @returns True if sheet name is unique
  19468. */
  19469. checkSheetName(e) {
  19470. return this.getSheetsName().includes(e);
  19471. }
  19472. /**
  19473. * Check whether the sheet name is unique and generate a new unique sheet name
  19474. * @param name sheet name
  19475. * @returns Unique sheet name
  19476. */
  19477. uniqueSheetName(e = "Sheet1") {
  19478. let n = e;
  19479. for (; this.checkSheetName(n); )
  19480. n = e + this._count, this._count++;
  19481. return n;
  19482. }
  19483. /**
  19484. * Automatically generate new sheet name
  19485. * @param name sheet name
  19486. * @returns New sheet name
  19487. */
  19488. generateNewSheetName(e) {
  19489. let n = e + this._count;
  19490. for (; this.checkSheetName(n); )
  19491. n = e + this._count, this._count++;
  19492. return n;
  19493. }
  19494. // FIXME: now we always create worksheet from DEFAULT_WORKSHEET?
  19495. /**
  19496. * Get Default Sheet
  19497. */
  19498. _parseWorksheetSnapshots() {
  19499. const { _snapshot: e, _worksheets: n } = this, { sheets: r, sheetOrder: s } = e;
  19500. if (re.isEmptyObject(r)) {
  19501. const i = re.generateRandomId();
  19502. r[i] = { id: i };
  19503. }
  19504. for (const i in r) {
  19505. const o = r[i], { name: a } = o;
  19506. o.name = this.uniqueSheetName(a), o.name !== a && this._logService.debug("[Workbook]", `The worksheet name ${a} is duplicated, we changed it to ${o.name}. Please fix the problem in your snapshot.`);
  19507. const u = new es(this._unitId, o, this._styles);
  19508. n.set(i, u), s.includes(i) || s.push(i);
  19509. }
  19510. this.ensureActiveSheet();
  19511. }
  19512. /**
  19513. * Get custom metadata of workbook
  19514. * @returns {CustomData | undefined} custom metadata
  19515. */
  19516. getCustomMetadata() {
  19517. return this._snapshot.custom;
  19518. }
  19519. /**
  19520. * Set custom metadata of workbook
  19521. * @param {CustomData | undefined} custom custom metadata
  19522. */
  19523. setCustomMetadata(e) {
  19524. this._snapshot.custom = e;
  19525. }
  19526. };
  19527. ts = sE([
  19528. iE(1, Mt)
  19529. ], ts);
  19530. var cl = class extends Ui {
  19531. constructor(n) {
  19532. var r;
  19533. super();
  19534. C(this, "type", Fe.UNIVER_SLIDE);
  19535. C(this, "_activePage$", new BehaviorSubject(null));
  19536. C(this, "activePage$", this._activePage$.asObservable());
  19537. C(this, "_name$");
  19538. C(this, "name$");
  19539. C(this, "_snapshot");
  19540. C(this, "_unitId");
  19541. this._snapshot = { ...Ap, ...n }, this._unitId = (r = this._snapshot.id) != null ? r : re.generateRandomId(6), this._name$ = new BehaviorSubject(this._snapshot.title), this.name$ = this._name$.asObservable();
  19542. }
  19543. get _activePage() {
  19544. var r, s;
  19545. const n = this._activePage$.getValue();
  19546. if (!n) {
  19547. const i = (r = this.getPageOrder()) == null ? void 0 : r[0];
  19548. return i ? (s = this.getPages()) == null ? void 0 : s[i] : null;
  19549. }
  19550. return n;
  19551. }
  19552. setName(n) {
  19553. var r;
  19554. this._snapshot.title = n, this._name$.next(n), this._unitId = (r = this._snapshot.id) != null ? r : qt(6);
  19555. }
  19556. getRev() {
  19557. return 0;
  19558. }
  19559. incrementRev() {
  19560. }
  19561. setRev(n) {
  19562. }
  19563. getSnapshot() {
  19564. return this._snapshot;
  19565. }
  19566. getUnitId() {
  19567. return this._unitId;
  19568. }
  19569. getPages() {
  19570. var n;
  19571. return (n = this._snapshot.body) == null ? void 0 : n.pages;
  19572. }
  19573. getPageOrder() {
  19574. var n;
  19575. return (n = this._snapshot.body) == null ? void 0 : n.pageOrder;
  19576. }
  19577. getPage(n) {
  19578. const r = this.getPages();
  19579. return r == null ? void 0 : r[n];
  19580. }
  19581. getElementsByPage(n) {
  19582. var r;
  19583. return (r = this.getPage(n)) == null ? void 0 : r.pageElements;
  19584. }
  19585. getElement(n, r) {
  19586. var s;
  19587. return (s = this.getElementsByPage(n)) == null ? void 0 : s[r];
  19588. }
  19589. getPageSize() {
  19590. return this._snapshot.pageSize;
  19591. }
  19592. getBlankPage() {
  19593. const n = qt(6);
  19594. return {
  19595. id: n,
  19596. pageType: Fu.SLIDE,
  19597. zIndex: 10,
  19598. title: n,
  19599. description: "",
  19600. pageBackgroundFill: {
  19601. rgb: "rgb(255,255,255)"
  19602. },
  19603. pageElements: {}
  19604. };
  19605. }
  19606. setActivePage(n) {
  19607. this._activePage$.next(n);
  19608. }
  19609. getActivePage() {
  19610. return this._activePage;
  19611. }
  19612. updatePage(n, r) {
  19613. this._snapshot.body && (this._snapshot.body.pages[n] = r);
  19614. }
  19615. appendPage(n) {
  19616. var i;
  19617. if (!this._snapshot.body)
  19618. return;
  19619. this._snapshot.body.pages[n.id] = n;
  19620. const r = this._activePage, s = this._snapshot.body.pageOrder.indexOf((i = r == null ? void 0 : r.id) != null ? i : "");
  19621. this._snapshot.body.pageOrder.splice(s + 1, 0, n.id);
  19622. }
  19623. };
  19624. var Ar = "FOCUSING_UNIT";
  19625. var Gn = "FOCUSING_SHEET";
  19626. var Nr = "FOCUSING_DOC";
  19627. var Tr = "FOCUSING_SLIDE";
  19628. var _R = "FOCUSING_EDITOR_BUT_HIDDEN";
  19629. var oE = "EDITOR_ACTIVATED";
  19630. var ER = "FOCUSING_EDITOR_INPUT_FORMULA";
  19631. var aE = "FOCUSING_FX_BAR_EDITOR";
  19632. var CR = "FOCUSING_UNIVER_EDITOR";
  19633. var RR = "FOCUSING_EDITOR_INPUT_FORMULA";
  19634. var IR = "FOCUSING_PANEL_EDITOR";
  19635. var vR = "FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE";
  19636. var yR = "FOCUSING_COMMON_DRAWINGS";
  19637. var wR = "FORMULA_EDITOR_ACTIVATED";
  19638. var uE = Object.defineProperty;
  19639. var lE = Object.getOwnPropertyDescriptor;
  19640. var cE = (t, e, n, r) => {
  19641. for (var s = r > 1 ? void 0 : r ? lE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  19642. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  19643. return r && s && uE(e, n, s), s;
  19644. };
  19645. var Ea = (t, e) => (n, r) => e(n, r, t);
  19646. var _n = Ct("univer.current");
  19647. var ni = class extends nt {
  19648. constructor(e, n) {
  19649. super();
  19650. C(this, "_unitsByType", /* @__PURE__ */ new Map());
  19651. C(this, "_createHandler");
  19652. C(this, "_ctorByType", /* @__PURE__ */ new Map());
  19653. C(this, "_currentUnits", /* @__PURE__ */ new Map());
  19654. C(this, "_currentUnits$", new BehaviorSubject(this._currentUnits));
  19655. C(this, "currentUnits$", this._currentUnits$.asObservable());
  19656. C(this, "_unitAdded$", new Subject());
  19657. C(this, "unitAdded$", this._unitAdded$.asObservable());
  19658. C(this, "_unitDisposed$", new Subject());
  19659. C(this, "unitDisposed$", this._unitDisposed$.asObservable());
  19660. C(this, "_focused$", new BehaviorSubject(null));
  19661. C(this, "focused$", this._focused$.asObservable());
  19662. this._injector = e, this._contextService = n;
  19663. }
  19664. dispose() {
  19665. super.dispose(), this._focused$.complete();
  19666. }
  19667. __setCreateHandler(e) {
  19668. this._createHandler = e;
  19669. }
  19670. createUnit(e, n, r) {
  19671. return this._createHandler(e, n, this._ctorByType.get(e), r);
  19672. }
  19673. registerCtorForType(e, n) {
  19674. return this._ctorByType.set(e, n), {
  19675. dispose: () => {
  19676. this._ctorByType.delete(e);
  19677. }
  19678. };
  19679. }
  19680. getCurrentTypeOfUnit$(e) {
  19681. return this.currentUnits$.pipe(map((n) => {
  19682. var r;
  19683. return (r = n.get(e)) != null ? r : null;
  19684. }), distinctUntilChanged());
  19685. }
  19686. getCurrentUnitForType(e) {
  19687. return this._currentUnits.get(e);
  19688. }
  19689. setCurrentUnitForType(e) {
  19690. const n = this._getUnitById(e);
  19691. if (!n)
  19692. throw new Error(`[UniverInstanceService]: no document with unitId ${e}!`);
  19693. this._currentUnits.set(n[1], n[0]), this._currentUnits$.next(this._currentUnits);
  19694. }
  19695. getTypeOfUnitAdded$(e) {
  19696. return this._unitAdded$.pipe(filter((n) => n.type === e));
  19697. }
  19698. /**
  19699. * Add a unit into Univer.
  19700. *
  19701. * @ignore
  19702. *
  19703. * @param unit The unit to be added.
  19704. */
  19705. __addUnit(e, n) {
  19706. var o;
  19707. const r = e.type;
  19708. this._unitsByType.has(r) || this._unitsByType.set(r, []);
  19709. const s = this._unitsByType.get(r), i = e.getUnitId();
  19710. if (s.findIndex((a) => a.getUnitId() === i) !== -1)
  19711. throw new Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${i}.`);
  19712. s.push(e), this._unitAdded$.next(e), ((o = n == null ? void 0 : n.makeCurrent) == null || o) && this.setCurrentUnitForType(e.getUnitId());
  19713. }
  19714. getTypeOfUnitDisposed$(e) {
  19715. return this.unitDisposed$.pipe(filter((n) => n.type === e));
  19716. }
  19717. getUnit(e, n) {
  19718. var s;
  19719. const r = (s = this._getUnitById(e)) == null ? void 0 : s[0];
  19720. return n && (r == null ? void 0 : r.type) !== n ? null : r;
  19721. }
  19722. getCurrentUniverDocInstance() {
  19723. return this.getCurrentUnitForType(Fe.UNIVER_DOC);
  19724. }
  19725. getUniverDocInstance(e) {
  19726. return this.getUnit(e, Fe.UNIVER_DOC);
  19727. }
  19728. getUniverSheetInstance(e) {
  19729. return this.getUnit(e, Fe.UNIVER_SHEET);
  19730. }
  19731. getAllUnitsForType(e) {
  19732. var n;
  19733. return (n = this._unitsByType.get(e)) != null ? n : [];
  19734. }
  19735. changeDoc(e, n) {
  19736. const r = this.getAllUnitsForType(Fe.UNIVER_DOC), s = r.find((i) => i.getUnitId() === e);
  19737. if (s != null) {
  19738. const i = r.indexOf(s);
  19739. r.splice(i, 1);
  19740. }
  19741. this.__addUnit(n);
  19742. }
  19743. get focused() {
  19744. var n;
  19745. const e = this._focused$.getValue();
  19746. return e ? (n = this._getUnitById(e)) == null ? void 0 : n[0] : null;
  19747. }
  19748. focusUnit(e) {
  19749. this._focused$.next(e), this.focused instanceof ts ? (this._contextService.setContextValue(Ar, true), this._contextService.setContextValue(Nr, false), this._contextService.setContextValue(Gn, true), this._contextService.setContextValue(Tr, false), this.setCurrentUnitForType(e)) : this.focused instanceof jt ? (this._contextService.setContextValue(Ar, true), this._contextService.setContextValue(Nr, true), this._contextService.setContextValue(Gn, false), this._contextService.setContextValue(Tr, false), this.setCurrentUnitForType(e)) : this.focused instanceof cl ? (this._contextService.setContextValue(Ar, true), this._contextService.setContextValue(Nr, false), this._contextService.setContextValue(Gn, false), this._contextService.setContextValue(Tr, true), this.setCurrentUnitForType(e)) : (this._contextService.setContextValue(Ar, false), this._contextService.setContextValue(Nr, false), this._contextService.setContextValue(Gn, false), this._contextService.setContextValue(Tr, false));
  19750. }
  19751. getFocusedUnit() {
  19752. return this.focused;
  19753. }
  19754. getUnitType(e) {
  19755. const n = this._getUnitById(e);
  19756. return n ? n[1] : Fe.UNRECOGNIZED;
  19757. }
  19758. disposeUnit(e) {
  19759. const n = this._getUnitById(e);
  19760. if (!n)
  19761. return false;
  19762. const [r, s] = n, i = this._unitsByType.get(s), o = i.indexOf(r);
  19763. return i.splice(o, 1), this._tryRemoveCurrentUnitForType(e, s), this._tryBlurUnitOnRemoval(e), this._unitDisposed$.next(r), true;
  19764. }
  19765. _tryRemoveCurrentUnitForType(e, n) {
  19766. const r = this.getCurrentUnitForType(n);
  19767. (r == null ? void 0 : r.getUnitId()) === e && (this._currentUnits.set(n, null), this._currentUnits$.next(this._currentUnits));
  19768. }
  19769. _tryBlurUnitOnRemoval(e) {
  19770. var n;
  19771. ((n = this.focused) == null ? void 0 : n.getUnitId()) === e && this._focused$.next(null);
  19772. }
  19773. _getUnitById(e) {
  19774. for (const [n, r] of this._unitsByType) {
  19775. const s = r.find((i) => i.getUnitId() === e);
  19776. if (s)
  19777. return [s, n];
  19778. }
  19779. }
  19780. };
  19781. ni = cE([
  19782. Ea(0, ot(Ot)),
  19783. Ea(1, fs)
  19784. ], ni);
  19785. var Ve = ((t) => (t[t.Starting = 0] = "Starting", t[t.Ready = 1] = "Ready", t[t.Rendered = 2] = "Rendered", t[t.Steady = 3] = "Steady", t))(Ve || {});
  19786. var hE = {
  19787. 0: "Starting",
  19788. 1: "Ready",
  19789. 2: "Rendered",
  19790. 3: "Steady"
  19791. };
  19792. var dE = Object.defineProperty;
  19793. var fE = Object.getOwnPropertyDescriptor;
  19794. var gE = (t, e, n, r) => {
  19795. for (var s = r > 1 ? void 0 : r ? fE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  19796. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  19797. return r && s && dE(e, n, s), s;
  19798. };
  19799. var pE = (t, e) => (n, r) => e(n, r, t);
  19800. var Ht = class extends nt {
  19801. constructor(e) {
  19802. super();
  19803. C(this, "_lifecycle$", new BehaviorSubject(Ve.Starting));
  19804. C(this, "lifecycle$", this._lifecycle$.asObservable());
  19805. C(this, "_lock", false);
  19806. this._logService = e, this._reportProgress(Ve.Starting);
  19807. }
  19808. get stage() {
  19809. return this._lifecycle$.getValue();
  19810. }
  19811. set stage(e) {
  19812. if (this._lock)
  19813. throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");
  19814. if (e < this.stage)
  19815. throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");
  19816. e !== this.stage && (this._lock = true, this._reportProgress(e), this._lifecycle$.next(e), this._lock = false);
  19817. }
  19818. dispose() {
  19819. this._lifecycle$.complete(), super.dispose();
  19820. }
  19821. /**
  19822. * Subscribe to lifecycle changes and all previous stages and the current
  19823. * stage will be emitted immediately.
  19824. * @returns
  19825. */
  19826. subscribeWithPrevious() {
  19827. return merge(hl(this.stage), this._lifecycle$.pipe(skip(1))).pipe(Kf((e) => e === Ve.Steady));
  19828. }
  19829. _reportProgress(e) {
  19830. this._logService.debug("[LifecycleService]", `lifecycle progressed to "${hE[e]}".`);
  19831. }
  19832. };
  19833. Ht = gE([
  19834. pE(0, Mt)
  19835. ], Ht);
  19836. function hl(t) {
  19837. switch (t) {
  19838. case Ve.Starting:
  19839. return of(Ve.Starting);
  19840. case Ve.Ready:
  19841. return of(Ve.Starting, Ve.Ready);
  19842. case Ve.Rendered:
  19843. return of(Ve.Starting, Ve.Ready, Ve.Rendered);
  19844. default:
  19845. return of(
  19846. Ve.Starting,
  19847. Ve.Ready,
  19848. Ve.Rendered,
  19849. Ve.Steady
  19850. );
  19851. }
  19852. }
  19853. var mE = Object.defineProperty;
  19854. var _E = Object.getOwnPropertyDescriptor;
  19855. var EE = (t, e, n, r) => {
  19856. for (var s = r > 1 ? void 0 : r ? _E(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  19857. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  19858. return r && s && mE(e, n, s), s;
  19859. };
  19860. var xs = (t, e) => (n, r) => e(n, r, t);
  19861. var cn = Ct("univer.undo-redo.service");
  19862. var CE = 20;
  19863. var dl = class {
  19864. dispose() {
  19865. }
  19866. async dispatchToHandlers() {
  19867. return false;
  19868. }
  19869. };
  19870. var RE = "univer.command.redo";
  19871. var IE = "univer.command.undo";
  19872. var Nn = new class extends dl {
  19873. constructor() {
  19874. super(...arguments);
  19875. C(this, "type", ar.COMMAND);
  19876. C(this, "id", IE);
  19877. }
  19878. handler(e) {
  19879. const n = e.get(cn), r = n.pitchTopUndoElement();
  19880. if (!r)
  19881. return false;
  19882. const s = e.get(Pt);
  19883. return mu(r.undoMutations, s) ? (n.popUndoToRedo(), true) : false;
  19884. }
  19885. }();
  19886. var Tn = new class extends dl {
  19887. constructor() {
  19888. super(...arguments);
  19889. C(this, "type", ar.COMMAND);
  19890. C(this, "id", RE);
  19891. }
  19892. handler(e) {
  19893. const n = e.get(cn), r = n.pitchTopRedoElement();
  19894. if (!r)
  19895. return false;
  19896. const s = e.get(Pt);
  19897. return mu(r.redoMutations, s) ? (n.popRedoToUndo(), true) : false;
  19898. }
  19899. }();
  19900. var ri = class extends nt {
  19901. constructor(e, n, r) {
  19902. super();
  19903. C(this, "undoRedoStatus$");
  19904. C(this, "_undoRedoStatus$", new BehaviorSubject({ undos: 0, redos: 0 }));
  19905. C(this, "_undoStacks", /* @__PURE__ */ new Map());
  19906. C(this, "_redoStacks", /* @__PURE__ */ new Map());
  19907. C(this, "_batchingStatus", /* @__PURE__ */ new Map());
  19908. this._univerInstanceService = e, this._commandService = n, this._contextService = r, this.undoRedoStatus$ = this._undoRedoStatus$.asObservable(), this.disposeWithMe(this._commandService.registerCommand(Nn)), this.disposeWithMe(this._commandService.registerCommand(Tn)), this.disposeWithMe(Ze(() => this._undoRedoStatus$.complete())), this.disposeWithMe(Ze(this._univerInstanceService.focused$.subscribe(() => this._updateStatus())));
  19909. }
  19910. pushUndoRedo(e) {
  19911. const { unitID: n } = e, r = this._getRedoStack(n, true), s = this._getUndoStack(n, true);
  19912. if (r.length = 0, this._batchingStatus.has(e.unitID)) {
  19913. const o = this._batchingStatus.get(e.unitID), a = this._pitchUndoElement(e.unitID);
  19914. o === 0 || !a ? (i(e), this._batchingStatus.set(
  19915. e.unitID,
  19916. 1
  19917. /* CREATED */
  19918. )) : this._tryBatchingElements(a, e);
  19919. } else
  19920. i(e);
  19921. function i(o) {
  19922. s.push(o), s.length > CE && s.splice(0, 1);
  19923. }
  19924. this._updateStatus();
  19925. }
  19926. clearUndoRedo(e) {
  19927. const n = this._getRedoStack(e);
  19928. n && (n.length = 0);
  19929. const r = this._getUndoStack(e);
  19930. r && (r.length = 0), this._updateStatus();
  19931. }
  19932. pitchTopUndoElement() {
  19933. const e = this._getFocusedUnitId();
  19934. return this._pitchUndoElement(e);
  19935. }
  19936. pitchTopRedoElement() {
  19937. const e = this._getFocusedUnitId();
  19938. return this._pitchRedoElement(e);
  19939. }
  19940. _pitchUndoElement(e) {
  19941. const n = this._getUndoStack(e);
  19942. return n != null && n.length ? n[n.length - 1] : null;
  19943. }
  19944. _pitchRedoElement(e) {
  19945. const n = this._getRedoStack(e);
  19946. return n != null && n.length ? n[n.length - 1] : null;
  19947. }
  19948. popUndoToRedo() {
  19949. const n = this._getUndoStackForFocused().pop();
  19950. n && (this._getRedoStackForFocused().push(n), this._updateStatus());
  19951. }
  19952. popRedoToUndo() {
  19953. const n = this._getRedoStackForFocused().pop();
  19954. n && (this._getUndoStackForFocused().push(n), this._updateStatus());
  19955. }
  19956. __tempBatchingUndoRedo(e) {
  19957. if (this._batchingStatus.has(e))
  19958. throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");
  19959. return this._batchingStatus.set(
  19960. e,
  19961. 0
  19962. /* WAITING */
  19963. ), Ze(() => this._batchingStatus.delete(e));
  19964. }
  19965. _updateStatus() {
  19966. var s, i;
  19967. const e = this._getFocusedUnitId(), n = e && ((s = this._undoStacks.get(e)) == null ? void 0 : s.length) || 0, r = e && ((i = this._redoStacks.get(e)) == null ? void 0 : i.length) || 0;
  19968. this._undoRedoStatus$.next({
  19969. undos: n,
  19970. redos: r
  19971. });
  19972. }
  19973. _getUndoStack(e, n = false) {
  19974. let r = this._undoStacks.get(e);
  19975. return !r && n && (r = [], this._undoStacks.set(e, r)), r || null;
  19976. }
  19977. _getRedoStack(e, n = false) {
  19978. let r = this._redoStacks.get(e);
  19979. return !r && n && (r = [], this._redoStacks.set(e, r)), r || null;
  19980. }
  19981. _getUndoStackForFocused() {
  19982. const e = this._getFocusedUnitId();
  19983. if (!e)
  19984. throw new Error("No focused univer instance!");
  19985. return this._getUndoStack(e, true);
  19986. }
  19987. _getRedoStackForFocused() {
  19988. const e = this._getFocusedUnitId();
  19989. if (!e)
  19990. throw new Error("No focused univer instance!");
  19991. return this._getRedoStack(e, true);
  19992. }
  19993. _tryBatchingElements(e, n) {
  19994. e.redoMutations.push(...n.redoMutations), e.undoMutations.push(...n.undoMutations);
  19995. }
  19996. _getFocusedUnitId() {
  19997. var i, o, a, u;
  19998. let e = "";
  19999. const n = this._contextService.getContextValue(Gn), r = this._contextService.getContextValue(aE), s = this._contextService.getContextValue(oE);
  20000. return n ? r ? e = iu : s ? e = su : e = (o = (i = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : i.getUnitId()) != null ? o : "" : e = (u = (a = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : a.getUnitId()) != null ? u : "", e;
  20001. }
  20002. };
  20003. ri = EE([
  20004. xs(0, _n),
  20005. xs(1, Pt),
  20006. xs(2, fs)
  20007. ], ri);
  20008. var Bi = Ct("core.resource-manager.service");
  20009. var si = {
  20010. [Tt.Editor]: "Editor",
  20011. [Tt.Owner]: "Owner",
  20012. [Tt.Reader]: "Reader",
  20013. [Tt.UNRECOGNIZED]: "UNRECOGNIZED"
  20014. };
  20015. var ii = (t) => t ? {
  20016. userID: `${si[t]}_${re.generateRandomId(8)}`,
  20017. name: si[t],
  20018. avatar: ""
  20019. } : {
  20020. userID: "",
  20021. name: "",
  20022. avatar: "",
  20023. anonymous: true,
  20024. canBindAnonymous: false
  20025. };
  20026. var vE = (t, e) => t.startsWith(si[e]);
  20027. var rr = class {
  20028. constructor() {
  20029. C(this, "_model", /* @__PURE__ */ new Map());
  20030. C(this, "_userChange$", new Subject());
  20031. C(this, "userChange$", this._userChange$.asObservable());
  20032. C(this, "_currentUser$", new BehaviorSubject(ii()));
  20033. C(this, "currentUser$", this._currentUser$.asObservable());
  20034. }
  20035. getCurrentUser() {
  20036. return this._currentUser$.getValue();
  20037. }
  20038. setCurrentUser(e) {
  20039. this.addUser(e), this._currentUser$.next(e);
  20040. }
  20041. addUser(e) {
  20042. this._model.set(e.userID, e), this._userChange$.next({ type: "add", user: e });
  20043. }
  20044. getUser(e, n) {
  20045. const r = this._model.get(e);
  20046. if (r)
  20047. return r;
  20048. n && n();
  20049. }
  20050. delete(e) {
  20051. const n = this.getUser(e);
  20052. this._model.delete(e), n && this._userChange$.next({ type: "delete", user: n });
  20053. }
  20054. clear() {
  20055. this._model.clear(), this._userChange$.next({ type: "clear" });
  20056. }
  20057. list() {
  20058. return Array.from(this._model.values());
  20059. }
  20060. };
  20061. var yE = Object.defineProperty;
  20062. var wE = Object.getOwnPropertyDescriptor;
  20063. var OE = (t, e, n, r) => {
  20064. for (var s = r > 1 ? void 0 : r ? wE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  20065. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  20066. return r && s && yE(e, n, s), s;
  20067. };
  20068. var Ca = (t, e) => (n, r) => e(n, r, t);
  20069. var oi = class {
  20070. // private _sheetPermissionPointMap: Map<string, { action: UnitAction; allowed: boolean }[]> = new Map();
  20071. constructor(t, e) {
  20072. C(this, "_permissionMap", /* @__PURE__ */ new Map([]));
  20073. this._resourceManagerService = t, this._userManagerService = e, this._initSnapshot(), this._initDefaultUser();
  20074. }
  20075. _initDefaultUser() {
  20076. const t = this._userManagerService.getCurrentUser();
  20077. t && t.userID || this._userManagerService.setCurrentUser(ii(Tt.Owner));
  20078. }
  20079. _getRole(t) {
  20080. const e = this._userManagerService.getCurrentUser();
  20081. return e ? vE(e.userID, t) : false;
  20082. }
  20083. _initSnapshot() {
  20084. this._resourceManagerService.registerPluginResource({
  20085. toJson: (t) => {
  20086. const e = [...this._permissionMap.keys()].reduce((n, r) => {
  20087. const s = this._permissionMap.get(r);
  20088. return n[r] = s, n;
  20089. }, {});
  20090. return JSON.stringify(e);
  20091. },
  20092. parseJson: (t) => JSON.parse(t),
  20093. pluginName: "SHEET_AuthzIoMockService_PLUGIN",
  20094. businesses: [Fe.UNIVER_SHEET, Fe.UNIVER_DOC, Fe.UNIVER_SLIDE],
  20095. onLoad: (t, e) => {
  20096. for (const n in e)
  20097. this._permissionMap.set(n, e[n]);
  20098. },
  20099. onUnLoad: () => {
  20100. this._permissionMap.clear();
  20101. }
  20102. });
  20103. }
  20104. async create(t) {
  20105. return qt(8);
  20106. }
  20107. async allowed(t) {
  20108. return Promise.resolve([]);
  20109. }
  20110. async batchAllowed(t) {
  20111. return Promise.resolve([]);
  20112. }
  20113. // eslint-disable-next-line max-lines-per-function
  20114. async list(t) {
  20115. const e = [];
  20116. return t.objectIDs.forEach((n) => {
  20117. const r = this._permissionMap.get(n);
  20118. if (r) {
  20119. const s = {
  20120. objectID: n,
  20121. unitID: t.unitID,
  20122. objectType: r.objectType,
  20123. name: r.name,
  20124. shareOn: false,
  20125. shareRole: Tt.Owner,
  20126. shareScope: -1,
  20127. scope: {
  20128. read: Js.AllCollaborator,
  20129. edit: Js.AllCollaborator
  20130. },
  20131. creator: ii(Tt.Owner),
  20132. strategies: [
  20133. {
  20134. action: 6,
  20135. role: 1
  20136. },
  20137. {
  20138. action: 16,
  20139. role: 1
  20140. },
  20141. {
  20142. action: 17,
  20143. role: 1
  20144. },
  20145. {
  20146. action: 18,
  20147. role: 1
  20148. },
  20149. {
  20150. action: 19,
  20151. role: 1
  20152. },
  20153. {
  20154. action: 33,
  20155. role: 1
  20156. },
  20157. {
  20158. action: 34,
  20159. role: 1
  20160. },
  20161. {
  20162. action: 35,
  20163. role: 1
  20164. },
  20165. {
  20166. action: 36,
  20167. role: 1
  20168. },
  20169. {
  20170. action: 37,
  20171. role: 1
  20172. },
  20173. {
  20174. action: 38,
  20175. role: 1
  20176. },
  20177. {
  20178. action: 39,
  20179. role: 1
  20180. },
  20181. {
  20182. action: 40,
  20183. role: 1
  20184. }
  20185. ],
  20186. actions: t.actions.map((i) => ({ action: i, allowed: this._getRole(Tt.Owner) || this._getRole(Tt.Editor) }))
  20187. };
  20188. e.push(s);
  20189. }
  20190. }), e;
  20191. }
  20192. async listCollaborators() {
  20193. return [];
  20194. }
  20195. async listRoles() {
  20196. return {
  20197. roles: [],
  20198. actions: []
  20199. };
  20200. }
  20201. async deleteCollaborator() {
  20202. }
  20203. async update(t) {
  20204. }
  20205. async updateCollaborator() {
  20206. }
  20207. async createCollaborator() {
  20208. }
  20209. async putCollaborators(t) {
  20210. }
  20211. };
  20212. oi = OE([
  20213. Ca(0, Bi),
  20214. Ca(1, ot(rr))
  20215. ], oi);
  20216. var bE = Ct("IAuthzIoIoService");
  20217. var SE = Ct("univer.config-service");
  20218. var AE = class {
  20219. constructor() {
  20220. C(this, "_configChanged$", new Subject());
  20221. C(this, "configChanged$", this._configChanged$.asObservable());
  20222. C(this, "_config", /* @__PURE__ */ new Map());
  20223. }
  20224. dispose() {
  20225. this._configChanged$.complete();
  20226. }
  20227. getConfig(e) {
  20228. return this._config.get(e);
  20229. }
  20230. setConfig(e, n, r) {
  20231. var o;
  20232. const { merge: s = false } = r || {};
  20233. let i = (o = this._config.get(e)) != null ? o : {};
  20234. s ? i = nu(i, n) : i = n, this._config.set(e, i), this._configChanged$.next({ [e]: i });
  20235. }
  20236. deleteConfig(e) {
  20237. return this._config.delete(e);
  20238. }
  20239. subscribeConfigValue$(e) {
  20240. return new Observable((n) => {
  20241. Object.prototype.hasOwnProperty.call(this._config, e) && n.next(this._config.get(e));
  20242. const r = this.configChanged$.pipe(filter((s) => Object.prototype.hasOwnProperty.call(s, e))).subscribe((s) => n.next(s[e]));
  20243. return () => r.unsubscribe();
  20244. });
  20245. }
  20246. };
  20247. var NE = class extends nt {
  20248. constructor() {
  20249. super(...arguments);
  20250. C(this, "_error$", new Subject());
  20251. C(this, "error$", this._error$.asObservable());
  20252. }
  20253. dispose() {
  20254. this._error$.complete();
  20255. }
  20256. emit(n) {
  20257. this._error$.next({ errorKey: n });
  20258. }
  20259. };
  20260. var Vr = class extends nt {
  20261. constructor() {
  20262. super();
  20263. C(this, "_currentLocale$", new BehaviorSubject(ur.ZH_CN));
  20264. C(this, "currentLocale$", this._currentLocale$.asObservable());
  20265. C(this, "_locales", null);
  20266. C(this, "localeChanged$", new Subject());
  20267. C(this, "t", (n, ...r) => {
  20268. if (!this._locales)
  20269. throw new Error("[LocaleService]: Locale not initialized");
  20270. const s = n.split("."), i = this.resolveKeyPath(this._locales[this._currentLocale], s);
  20271. if (typeof i == "string") {
  20272. let o = i;
  20273. return r.forEach((a, u) => {
  20274. o = o.replace(`{${u}}`, a);
  20275. }), o;
  20276. } else
  20277. return n;
  20278. });
  20279. this.disposeWithMe(Ze(() => this.localeChanged$.complete()));
  20280. }
  20281. get _currentLocale() {
  20282. return this._currentLocale$.value;
  20283. }
  20284. /**
  20285. * Load more locales after init.
  20286. *
  20287. * @param locales - Locale object
  20288. */
  20289. load(n) {
  20290. var r;
  20291. this._locales = nu((r = this._locales) != null ? r : {}, n);
  20292. }
  20293. setLocale(n) {
  20294. this._currentLocale$.next(n), this.localeChanged$.next();
  20295. }
  20296. getLocales() {
  20297. var n;
  20298. return (n = this._locales) == null ? void 0 : n[this._currentLocale];
  20299. }
  20300. getCurrentLocale() {
  20301. return this._currentLocale;
  20302. }
  20303. resolveKeyPath(n, r) {
  20304. const s = r.shift();
  20305. if (s && n && s in n) {
  20306. const i = n[s];
  20307. return r.length > 0 && (typeof i == "object" || Array.isArray(i)) ? this.resolveKeyPath(i, r) : i;
  20308. }
  20309. return null;
  20310. }
  20311. };
  20312. var TE = Object.defineProperty;
  20313. var ME = Object.getOwnPropertyDescriptor;
  20314. var DE = (t, e, n, r) => {
  20315. for (var s = r > 1 ? void 0 : r ? ME(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  20316. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  20317. return r && s && TE(e, n, s), s;
  20318. };
  20319. var xE = (t, e) => (n, r) => e(n, r, t);
  20320. var ai = class {
  20321. constructor(t) {
  20322. this._userManagerService = t;
  20323. }
  20324. async list(t) {
  20325. return {
  20326. list: [{
  20327. type: Zr.PERSON,
  20328. mentions: [
  20329. {
  20330. objectType: Zr.PERSON,
  20331. objectId: this._userManagerService.getCurrentUser().userID,
  20332. label: this._userManagerService.getCurrentUser().name,
  20333. metadata: {
  20334. icon: this._userManagerService.getCurrentUser().avatar
  20335. }
  20336. }
  20337. ],
  20338. metadata: {},
  20339. title: "PEOPLE"
  20340. }],
  20341. page: t.page,
  20342. size: t.size,
  20343. total: 1
  20344. };
  20345. }
  20346. };
  20347. ai = DE([
  20348. xE(0, ot(rr))
  20349. ], ai);
  20350. var LE = Ct("univer.service.mention-io");
  20351. var fl = ((t) => (t.INIT = "init", t.FETCHING = "fetching", t.DONE = "done", t))(fl || {});
  20352. var UE = Ct("univer.permission-service");
  20353. var PE = class extends nt {
  20354. constructor() {
  20355. super(...arguments);
  20356. C(this, "_permissionPointMap", /* @__PURE__ */ new Map());
  20357. C(this, "_permissionPointUpdate$", new Subject());
  20358. C(this, "permissionPointUpdate$", this._permissionPointUpdate$.asObservable());
  20359. C(this, "_showComponents", true);
  20360. }
  20361. setShowComponents(n) {
  20362. this._showComponents = n;
  20363. }
  20364. getShowComponents() {
  20365. return this._showComponents;
  20366. }
  20367. deletePermissionPoint(n) {
  20368. const r = this._permissionPointMap.get(n);
  20369. r && (r.complete(), this._permissionPointMap.delete(n));
  20370. }
  20371. addPermissionPoint(n) {
  20372. const r = n instanceof BehaviorSubject, s = r ? n.getValue() : n;
  20373. if (!s.id)
  20374. return false;
  20375. if (this._permissionPointMap.get(s.id))
  20376. throw new Error(`${s.id} PermissionPoint already exists`);
  20377. return this._permissionPointMap.set(s.id, r ? n : new BehaviorSubject(s)), this._permissionPointUpdate$.next(s), true;
  20378. }
  20379. updatePermissionPoint(n, r) {
  20380. const s = this._permissionPointMap.get(n);
  20381. if (!s)
  20382. return;
  20383. const i = s.getValue();
  20384. i.value = r, i.status = fl.DONE, s.next(i), this._permissionPointUpdate$.next(i);
  20385. }
  20386. clearPermissionMap() {
  20387. this._permissionPointMap.clear();
  20388. }
  20389. getPermissionPoint(n) {
  20390. const r = this._permissionPointMap.get(n);
  20391. if (r)
  20392. return r.getValue();
  20393. }
  20394. getPermissionPoint$(n) {
  20395. const r = this._permissionPointMap.get(n);
  20396. if (r)
  20397. return r;
  20398. }
  20399. composePermission$(n) {
  20400. const r = n.map((s) => {
  20401. var o;
  20402. const i = (o = this._permissionPointMap) == null ? void 0 : o.get(s);
  20403. if (!i)
  20404. throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);
  20405. return i.asObservable();
  20406. });
  20407. return combineLatest(r).pipe(
  20408. // Check that all permissions exist
  20409. map((s) => s)
  20410. );
  20411. }
  20412. composePermission(n) {
  20413. return n.map((s) => {
  20414. var o;
  20415. const i = (o = this._permissionPointMap) == null ? void 0 : o.get(s);
  20416. if (!i)
  20417. throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);
  20418. return i.getValue();
  20419. });
  20420. }
  20421. getAllPermissionPoint() {
  20422. const n = /* @__PURE__ */ new Map();
  20423. return this._permissionPointMap.forEach((r, s) => {
  20424. n.set(s, r);
  20425. }), n;
  20426. }
  20427. };
  20428. function kE(t, e) {
  20429. if (!e)
  20430. return t;
  20431. const n = [];
  20432. for (const r of t) {
  20433. const s = e.find(([i]) => i === r[0]);
  20434. if (s) {
  20435. if (s[1] === null)
  20436. continue;
  20437. n.push([r[0], s[1]]);
  20438. } else
  20439. n.push(r);
  20440. }
  20441. return n;
  20442. }
  20443. var gl = Symbol("DependentOn");
  20444. var Ra = class extends nt {
  20445. onStarting() {
  20446. }
  20447. onReady() {
  20448. }
  20449. onRendered() {
  20450. }
  20451. onSteady() {
  20452. }
  20453. getUniverInstanceType() {
  20454. return this.constructor.type;
  20455. }
  20456. getPluginName() {
  20457. return this.constructor.pluginName;
  20458. }
  20459. };
  20460. C(Ra, "pluginName"), C(Ra, "type", Fe.UNIVER_UNKNOWN);
  20461. var FE = class {
  20462. constructor() {
  20463. C(this, "_plugins", []);
  20464. }
  20465. addPlugin(e) {
  20466. this._plugins.push(e);
  20467. }
  20468. removePlugins() {
  20469. const e = this._plugins.slice();
  20470. return this._plugins.length = 0, e;
  20471. }
  20472. forEachPlugin(e) {
  20473. this._plugins.forEach(e);
  20474. }
  20475. };
  20476. var $E = class {
  20477. constructor() {
  20478. C(this, "_pluginsRegistered", []);
  20479. }
  20480. // eslint-disable-next-line ts/no-explicit-any
  20481. registerPlugin(e, n) {
  20482. this._pluginsRegistered.push({ plugin: e, options: n });
  20483. }
  20484. getRegisterPlugins() {
  20485. return this._pluginsRegistered.slice();
  20486. }
  20487. removePlugins() {
  20488. this._pluginsRegistered = [];
  20489. }
  20490. };
  20491. var BE = Object.defineProperty;
  20492. var jE = Object.getOwnPropertyDescriptor;
  20493. var pl = (t, e, n, r) => {
  20494. for (var s = r > 1 ? void 0 : r ? jE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  20495. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  20496. return r && s && BE(e, n, s), s;
  20497. };
  20498. var Gr = (t, e) => (n, r) => e(n, r, t);
  20499. var HE = 4;
  20500. function OR(...t) {
  20501. return function(e) {
  20502. e[gl] = t;
  20503. };
  20504. }
  20505. var ns = class {
  20506. constructor(t) {
  20507. C(this, "_pluginHolderForUniver");
  20508. C(this, "_pluginHoldersForTypes", /* @__PURE__ */ new Map());
  20509. C(this, "_seenPlugins", /* @__PURE__ */ new Set());
  20510. C(this, "_flushTimer");
  20511. this._injector = t, this._pluginHolderForUniver = this._injector.createInstance(
  20512. rs,
  20513. this._checkPluginSeen.bind(this),
  20514. this._immediateInitPlugin.bind(this)
  20515. ), this._pluginHoldersForTypes.set(Fe.UNIVER_UNKNOWN, this._pluginHolderForUniver), this._pluginHolderForUniver.start();
  20516. }
  20517. dispose() {
  20518. this._clearFlushTimer();
  20519. for (const t of this._pluginHoldersForTypes.values())
  20520. t.dispose();
  20521. this._pluginHolderForUniver.dispose();
  20522. }
  20523. /** Register a plugin into univer. */
  20524. registerPlugin(t, e) {
  20525. this._assertPluginValid(t), this._scheduleInitPlugin();
  20526. const { type: n } = t;
  20527. n === Fe.UNIVER_UNKNOWN ? (this._pluginHolderForUniver.register(t, e), this._pluginHolderForUniver.flush()) : this._ensurePluginHolderForType(n).register(t, e);
  20528. }
  20529. startPluginForType(t) {
  20530. this._ensurePluginHolderForType(t).start();
  20531. }
  20532. _ensurePluginHolderForType(t) {
  20533. if (!this._pluginHoldersForTypes.has(t)) {
  20534. const e = this._injector.createInstance(
  20535. rs,
  20536. this._checkPluginSeen.bind(this),
  20537. this._immediateInitPlugin.bind(this)
  20538. );
  20539. return this._pluginHoldersForTypes.set(t, e), e;
  20540. }
  20541. return this._pluginHoldersForTypes.get(t);
  20542. }
  20543. _immediateInitPlugin(t) {
  20544. this._seenPlugins.add(t.pluginName), this._ensurePluginHolderForType(t.type).immediateInitPlugin(t);
  20545. }
  20546. _checkPluginSeen(t) {
  20547. return this._seenPlugins.has(t.pluginName);
  20548. }
  20549. _assertPluginValid(t) {
  20550. const { type: e, pluginName: n } = t;
  20551. if (e === Fe.UNRECOGNIZED)
  20552. throw new Error(`[PluginService]: invalid plugin type for ${t.name}. Please assign a "type" to your plugin.`);
  20553. if (!n)
  20554. throw new Error(`[PluginService]: no plugin name for ${t.name}. Please assign a "pluginName" to your plugin.`);
  20555. if (this._seenPlugins.has(n))
  20556. throw new Error(`[PluginService]: duplicated plugin name for "${n}". Maybe a plugin that dependents on "${n} has already registered it. In that case please register "${n}" before the that plugin.`);
  20557. this._seenPlugins.add(t.pluginName);
  20558. }
  20559. _scheduleInitPlugin() {
  20560. this._flushTimer === void 0 && (this._flushTimer = setTimeout(
  20561. () => {
  20562. this._pluginHolderForUniver.started || this._pluginHolderForUniver.start(), this._flushPlugins(), this._clearFlushTimer();
  20563. },
  20564. HE
  20565. ));
  20566. }
  20567. _clearFlushTimer() {
  20568. this._flushTimer && (clearTimeout(this._flushTimer), this._flushTimer = void 0);
  20569. }
  20570. _flushPlugins() {
  20571. this._pluginHolderForUniver.flush();
  20572. for (const [t, e] of this._pluginHoldersForTypes)
  20573. e.started && e.flush();
  20574. }
  20575. };
  20576. ns = pl([
  20577. Gr(0, ot(Ot))
  20578. ], ns);
  20579. var rs = class extends nt {
  20580. constructor(e, n, r, s, i) {
  20581. super();
  20582. C(this, "_started", false);
  20583. C(this, "_warnedAboutOnStartingDeprecation", false);
  20584. C(this, "_pluginRegistry", new $E());
  20585. C(this, "_pluginStore", new FE());
  20586. C(this, "_pluginsInBatches", []);
  20587. this._checkPluginRegistered = e, this._registerPlugin = n, this._logService = r, this._injector = s, this._lifecycleService = i, this.disposeWithMe(this._lifecycleService.lifecycle$.pipe(skip(1)).subscribe((o) => {
  20588. this._pluginsInBatches.forEach((a) => this._runStage(a, o));
  20589. }));
  20590. }
  20591. get started() {
  20592. return this._started;
  20593. }
  20594. dispose() {
  20595. super.dispose(), this._pluginStore.forEachPlugin((e) => e.dispose()), this._pluginStore.removePlugins(), this._pluginRegistry.removePlugins(), this._pluginsInBatches.length = 0;
  20596. }
  20597. register(e, n) {
  20598. this._pluginRegistry.registerPlugin(e, n);
  20599. }
  20600. immediateInitPlugin(e) {
  20601. const n = this._initPlugin(e, void 0);
  20602. this._pluginsRunLifecycle([n]);
  20603. }
  20604. start() {
  20605. this._started || (this._started = true, this.flush());
  20606. }
  20607. flush() {
  20608. if (!this._started)
  20609. return;
  20610. const e = this._pluginRegistry.getRegisterPlugins().map(({ plugin: n, options: r }) => this._initPlugin(n, r));
  20611. e.length && (this._pluginsRunLifecycle(e), this._pluginRegistry.removePlugins());
  20612. }
  20613. // eslint-disable-next-line ts/no-explicit-any
  20614. _initPlugin(e, n) {
  20615. const r = e[gl];
  20616. if (r) {
  20617. const i = () => {
  20618. const o = r.find((a) => !this._checkPluginRegistered(a));
  20619. return o ? (this._logService.debug(
  20620. "[PluginService]",
  20621. `Plugin "${e.pluginName}" depends on "${o.pluginName}" which is not registered. Univer will automatically register it with default configuration.`
  20622. ), this._registerPlugin(o, void 0), true) : false;
  20623. };
  20624. for (; i(); )
  20625. ;
  20626. }
  20627. const s = this._injector.createInstance(e, n);
  20628. return this._pluginStore.addPlugin(s), this._logService.debug("[PluginService]", `Plugin "${s.getPluginName()}" registered.`), s;
  20629. }
  20630. // Here we should be careful with the sequence of which plugin should run first. We should manually add a queue here.
  20631. // Because lately registered plugins may get executed first.
  20632. _pluginsRunLifecycle(e) {
  20633. hl(this._lifecycleService.stage).subscribe((n) => this._runStage(e, n)), this._pluginsInBatches.push(e);
  20634. }
  20635. _runStage(e, n) {
  20636. e.forEach((r) => {
  20637. switch (n) {
  20638. case Ve.Starting:
  20639. r.onStarting();
  20640. break;
  20641. case Ve.Ready:
  20642. r.onReady();
  20643. break;
  20644. case Ve.Rendered:
  20645. r.onRendered();
  20646. break;
  20647. case Ve.Steady:
  20648. r.onSteady();
  20649. break;
  20650. }
  20651. });
  20652. }
  20653. };
  20654. rs = pl([
  20655. Gr(2, Mt),
  20656. Gr(3, ot(Ot)),
  20657. Gr(4, ot(Ht))
  20658. ], rs);
  20659. var WE = Object.defineProperty;
  20660. var zE = Object.getOwnPropertyDescriptor;
  20661. var YE = (t, e, n, r) => {
  20662. for (var s = r > 1 ? void 0 : r ? zE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  20663. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  20664. return r && s && WE(e, n, s), s;
  20665. };
  20666. var Ia = (t, e) => (n, r) => e(n, r, t);
  20667. var ui = class extends nt {
  20668. constructor(t, e) {
  20669. super(), this._resourceManagerService = t, this._univerInstanceService = e, this._init();
  20670. }
  20671. _init() {
  20672. const t = (n) => {
  20673. n.businesses.forEach((r) => {
  20674. switch (r) {
  20675. case Fe.UNRECOGNIZED:
  20676. case Fe.UNIVER_UNKNOWN:
  20677. case Fe.UNIVER_SLIDE:
  20678. case Fe.UNIVER_DOC: {
  20679. this._univerInstanceService.getAllUnitsForType(Fe.UNIVER_DOC).forEach((s) => {
  20680. const o = (s.getSnapshot().resources || []).find((a) => a.name === n.pluginName);
  20681. if (o)
  20682. try {
  20683. const a = n.parseJson(o.data);
  20684. n.onLoad(s.getUnitId(), a);
  20685. } catch {
  20686. console.error(`Load Document{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`);
  20687. }
  20688. });
  20689. break;
  20690. }
  20691. case Fe.UNIVER_SHEET:
  20692. this._univerInstanceService.getAllUnitsForType(Fe.UNIVER_SHEET).forEach((s) => {
  20693. const o = (s.getSnapshot().resources || []).find((a) => a.name === n.pluginName);
  20694. if (o)
  20695. try {
  20696. const a = n.parseJson(o.data);
  20697. n.onLoad(s.getUnitId(), a);
  20698. } catch {
  20699. console.error(`Load Workbook{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`);
  20700. }
  20701. });
  20702. }
  20703. });
  20704. };
  20705. this._resourceManagerService.getAllResourceHooks().forEach((n) => t(n)), this.disposeWithMe(this._resourceManagerService.register$.subscribe((n) => t(n))), this.disposeWithMe(
  20706. this._univerInstanceService.getTypeOfUnitAdded$(Fe.UNIVER_SHEET).subscribe((n) => {
  20707. this._resourceManagerService.loadResources(n.getUnitId(), n.getSnapshot().resources);
  20708. })
  20709. ), this.disposeWithMe(
  20710. this._univerInstanceService.getTypeOfUnitAdded$(Fe.UNIVER_DOC).subscribe((n) => {
  20711. const r = n.getUnitId();
  20712. zd(r) || this._resourceManagerService.loadResources(n.getUnitId(), n.getSnapshot().resources);
  20713. })
  20714. ), this.disposeWithMe(
  20715. this._univerInstanceService.getTypeOfUnitDisposed$(Fe.UNIVER_SHEET).subscribe((n) => {
  20716. this._resourceManagerService.unloadResources(n.getUnitId());
  20717. })
  20718. ), this.disposeWithMe(
  20719. this._univerInstanceService.getTypeOfUnitDisposed$(Fe.UNIVER_DOC).subscribe((n) => {
  20720. this._resourceManagerService.unloadResources(n.getUnitId());
  20721. })
  20722. );
  20723. }
  20724. saveUnit(t) {
  20725. const e = this._univerInstanceService.getUnit(t);
  20726. if (!e)
  20727. return null;
  20728. const n = this._resourceManagerService.getResources(t, e.type), r = re.deepClone(e.getSnapshot());
  20729. return r.resources = n, r;
  20730. }
  20731. };
  20732. ui = YE([
  20733. Ia(0, ot(Bi)),
  20734. Ia(1, ot(_n))
  20735. ], ui);
  20736. var va = Ct("resource-loader-service");
  20737. var VE = class extends nt {
  20738. constructor() {
  20739. super(...arguments);
  20740. C(this, "_resourceMap", /* @__PURE__ */ new Map());
  20741. C(this, "_register$", new Subject());
  20742. C(this, "register$", this._register$.asObservable());
  20743. }
  20744. getAllResourceHooks() {
  20745. return [...this._resourceMap.values()];
  20746. }
  20747. getResources(n, r) {
  20748. return r ? this.getResourcesByType(n, r) : this.getAllResourceHooks().map((o) => {
  20749. const a = o.toJson(n);
  20750. return {
  20751. name: o.pluginName,
  20752. data: a
  20753. };
  20754. });
  20755. }
  20756. getResourcesByType(n, r) {
  20757. return this.getAllResourceHooks().filter((o) => o.businesses.includes(r)).map((o) => {
  20758. const a = o.toJson(n);
  20759. return {
  20760. name: o.pluginName,
  20761. data: a
  20762. };
  20763. });
  20764. }
  20765. registerPluginResource(n) {
  20766. const r = n.pluginName;
  20767. if (this._resourceMap.has(r))
  20768. throw new Error(`the pluginName is registered {${r}}`);
  20769. return this._resourceMap.set(r, n), this._register$.next(n), Ze(() => this._resourceMap.delete(r));
  20770. }
  20771. disposePluginResource(n) {
  20772. this._resourceMap.delete(n);
  20773. }
  20774. loadResources(n, r) {
  20775. this.getAllResourceHooks().forEach((s) => {
  20776. var o;
  20777. const i = (o = r == null ? void 0 : r.find((a) => a.name === s.pluginName)) == null ? void 0 : o.data;
  20778. if (i)
  20779. try {
  20780. const a = s.parseJson(i);
  20781. s.onLoad(n, a);
  20782. } catch {
  20783. console.error("LoadResources Error!");
  20784. }
  20785. });
  20786. }
  20787. unloadResources(n) {
  20788. this.getAllResourceHooks().forEach((r) => {
  20789. r.onUnLoad(n);
  20790. });
  20791. }
  20792. dispose() {
  20793. this._register$.complete(), this._resourceMap.clear();
  20794. }
  20795. };
  20796. var ml = class extends nt {
  20797. constructor() {
  20798. super();
  20799. C(this, "_currentTheme");
  20800. C(this, "_currentTheme$", new BehaviorSubject({}));
  20801. C(this, "currentTheme$", this._currentTheme$.asObservable());
  20802. this.disposeWithMe(Ze(() => this._currentTheme$.complete()));
  20803. }
  20804. getCurrentTheme() {
  20805. if (!this._currentTheme)
  20806. throw new Error("[ThemeService]: current theme is not set!");
  20807. return this._currentTheme;
  20808. }
  20809. setTheme(n) {
  20810. this._currentTheme = n, this._currentTheme$.next(n);
  20811. }
  20812. };
  20813. var GE = class {
  20814. /**
  20815. * Create a Univer instance.
  20816. * @param config Configuration data for Univer
  20817. * @param parentInjector An optional parent injector of the Univer injector. For more information, see https://redi.wendell.fun/docs/hierarchy.
  20818. */
  20819. constructor(e = {}, n) {
  20820. C(this, "_startedTypes", /* @__PURE__ */ new Set());
  20821. C(this, "_injector");
  20822. C(this, "_disposingCallbacks", new Mi());
  20823. const r = this._injector = KE(n, e == null ? void 0 : e.override), { theme: s, locale: i, locales: o, logLevel: a } = e;
  20824. s && this._injector.get(ml).setTheme(s), o && this._injector.get(Vr).load(o), i && this._injector.get(Vr).setLocale(i), a && this._injector.get(Mt).setLogLevel(a), this._init(r);
  20825. }
  20826. get _univerInstanceService() {
  20827. return this._injector.get(_n);
  20828. }
  20829. get _pluginService() {
  20830. return this._injector.get(ns);
  20831. }
  20832. __getInjector() {
  20833. return this._injector;
  20834. }
  20835. /**
  20836. * Register a callback function which will be called when this Univer instance is disposing.
  20837. *
  20838. * @ignore
  20839. *
  20840. * @param callback The callback function.
  20841. * @returns To remove this callback function from this Univer instance's on disposing list.
  20842. */
  20843. onDispose(e) {
  20844. const n = this._disposingCallbacks.add(Ze(e));
  20845. return Ze(() => n.dispose(true));
  20846. }
  20847. dispose() {
  20848. this._disposingCallbacks.dispose(), this._injector.dispose();
  20849. }
  20850. setLocale(e) {
  20851. this._injector.get(Vr).setLocale(e);
  20852. }
  20853. createUnit(e, n) {
  20854. return this._univerInstanceService.createUnit(e, n);
  20855. }
  20856. /**
  20857. * Create a univer sheet instance with internal dependency injection.
  20858. *
  20859. * @deprecated use `createUnit` instead
  20860. */
  20861. createUniverSheet(e) {
  20862. return this._injector.get(Mt).warn("[Univer]: Univer.createUniverSheet is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(Fe.UNIVER_SHEET, e);
  20863. }
  20864. /**
  20865. * @deprecated use `createUnit` instead
  20866. */
  20867. createUniverDoc(e) {
  20868. return this._injector.get(Mt).warn("[Univer]: Univer.createUniverDoc is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(Fe.UNIVER_DOC, e);
  20869. }
  20870. /**
  20871. * @deprecated use `createUnit` instead
  20872. */
  20873. createUniverSlide(e) {
  20874. return this._injector.get(Mt).warn("[Univer]: Univer.createUniverSlide is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(Fe.UNIVER_SLIDE, e);
  20875. }
  20876. _init(e) {
  20877. this._univerInstanceService.registerCtorForType(Fe.UNIVER_SHEET, ts), this._univerInstanceService.registerCtorForType(Fe.UNIVER_DOC, jt), this._univerInstanceService.registerCtorForType(Fe.UNIVER_SLIDE, cl);
  20878. const n = e.get(_n);
  20879. n.__setCreateHandler(
  20880. (r, s, i, o) => {
  20881. if (!this._startedTypes.has(r)) {
  20882. this._pluginService.startPluginForType(r), this._startedTypes.add(r);
  20883. const u = e.createInstance(i, s);
  20884. return n.__addUnit(u, o), this._tryProgressToReady(), u;
  20885. }
  20886. const a = e.createInstance(i, s);
  20887. return n.__addUnit(a, o), a;
  20888. }
  20889. );
  20890. }
  20891. _tryProgressToReady() {
  20892. this._injector.get(Ht).stage < Ve.Ready && (this._injector.get(Ht).stage = Ve.Ready);
  20893. }
  20894. /** Register a plugin into univer. */
  20895. registerPlugin(e, n) {
  20896. this._pluginService.registerPlugin(e, n);
  20897. }
  20898. };
  20899. function KE(t, e) {
  20900. const n = kE([
  20901. [NE],
  20902. [Vr],
  20903. [ml],
  20904. [Ht],
  20905. [ns],
  20906. [rr],
  20907. // abstract services
  20908. [_n, { useClass: ni }],
  20909. [UE, { useClass: PE }],
  20910. [Mt, { useClass: Bf, lazy: true }],
  20911. [Pt, { useClass: Ys }],
  20912. [cn, { useClass: ri, lazy: true }],
  20913. [SE, { useClass: AE }],
  20914. [fs, { useClass: Ff }],
  20915. [Bi, { useClass: VE, lazy: true }],
  20916. [va, { useClass: ui, lazy: true }],
  20917. [bE, { useClass: oi, lazy: true }],
  20918. [LE, { useClass: ai, lazy: true }]
  20919. ], e), r = t ? t.createChild(n) : new Ot(n);
  20920. return Mf(r, [
  20921. [rr],
  20922. [va]
  20923. ]), r;
  20924. }
  20925. var XE = Object.defineProperty;
  20926. var JE = Object.getOwnPropertyDescriptor;
  20927. var ZE = (t, e, n, r) => {
  20928. for (var s = r > 1 ? void 0 : r ? JE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  20929. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  20930. return r && s && XE(e, n, s), s;
  20931. };
  20932. var QE = (t, e) => (n, r) => e(n, r, t);
  20933. var ss = class extends Fi {
  20934. constructor(t, e) {
  20935. super(), this._blob = t, this._injector = e;
  20936. }
  20937. /**
  20938. * Returns a copy of this blob.
  20939. * @returns a new blob by copying the current blob
  20940. * @example
  20941. * ```ts
  20942. * const blob = univerAPI.newBlob(blob);
  20943. * const newBlob = blob.copyBlob();
  20944. * console.log(newBlob);
  20945. * ```
  20946. */
  20947. copyBlob() {
  20948. return this._injector.createInstance(ss, this._blob);
  20949. }
  20950. /**
  20951. * Return the data inside this object as a blob converted to the specified content type.
  20952. * @param contentType the content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types
  20953. * @returns a new blob by converting the current blob to the specified content type
  20954. * @example
  20955. * ```ts
  20956. * const blob = univerAPI.newBlob(blob);
  20957. * const newBlob = blob.getBlob();
  20958. * ```
  20959. */
  20960. getAs(t) {
  20961. const e = this.copyBlob();
  20962. return e.setContentType(t), e;
  20963. }
  20964. getDataAsString(t) {
  20965. return this._blob === null ? Promise.resolve("") : t === void 0 ? this._blob.text() : new Promise((e, n) => {
  20966. this._blob.arrayBuffer().then((r) => {
  20967. const s = new TextDecoder(t).decode(r);
  20968. e(s);
  20969. }).catch((r) => {
  20970. n(new Error(`Failed to read Blob as ArrayBuffer: ${r.message}`));
  20971. });
  20972. });
  20973. }
  20974. /**
  20975. * Gets the data stored in this blob.
  20976. * @returns the blob content as a byte array
  20977. * @example
  20978. * ```ts
  20979. * const blob = univerAPI.newBlob(blob);
  20980. * const newBlob = blob.getBytes();
  20981. * console.log(newBlob);
  20982. * ```
  20983. */
  20984. getBytes() {
  20985. return this._blob ? this._blob.arrayBuffer().then((t) => new Uint8Array(t)) : Promise.reject(new Error("Blob is undefined or null."));
  20986. }
  20987. /**
  20988. * Sets the data stored in this blob.
  20989. * @param bytes a byte array
  20990. * @returns the blob object
  20991. * @example
  20992. * ```ts
  20993. * const blob = univerAPI.newBlob();
  20994. * const bytes = new Uint8Array(10);
  20995. * blob.setBytes(bytes);
  20996. * ```
  20997. */
  20998. setBytes(t) {
  20999. return this._blob = new Blob([t]), this;
  21000. }
  21001. setDataFromString(t, e) {
  21002. const n = e != null ? e : "text/plain", r = new Blob([t], { type: n });
  21003. return this._blob = r, this;
  21004. }
  21005. /**
  21006. * Gets the content type of the data stored in this blob.
  21007. * @returns the content type
  21008. * @example
  21009. * ```ts
  21010. * const blob = univerAPI.newBlob(blob);
  21011. * const newBlob = blob.getContentType();
  21012. * console.log(newBlob);
  21013. * ```
  21014. */
  21015. getContentType() {
  21016. var t;
  21017. return (t = this._blob) == null ? void 0 : t.type;
  21018. }
  21019. /**
  21020. * Sets the content type of the data stored in this blob.
  21021. * @param contentType the content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types
  21022. * @returns the blob object
  21023. * @example
  21024. * ```ts
  21025. * const blob = univerAPI.newBlob(blob);
  21026. * const newBlob = blob.setContentType('text/plain');
  21027. * console.log(newBlob);
  21028. * ```
  21029. */
  21030. setContentType(t) {
  21031. var e;
  21032. return this._blob = (e = this._blob) == null ? void 0 : e.slice(0, this._blob.size, t), this;
  21033. }
  21034. };
  21035. ss = ZE([
  21036. QE(1, ot(Ot))
  21037. ], ss);
  21038. var qE = Object.defineProperty;
  21039. var e0 = Object.getOwnPropertyDescriptor;
  21040. var t0 = (t, e, n, r) => {
  21041. for (var s = r > 1 ? void 0 : r ? e0(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  21042. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  21043. return r && s && qE(e, n, s), s;
  21044. };
  21045. var n0 = (t, e) => (n, r) => e(n, r, t);
  21046. var li = class extends al {
  21047. constructor(t, e) {
  21048. super(e), this.doc = t;
  21049. }
  21050. };
  21051. li = t0([
  21052. n0(1, ot(Ot))
  21053. ], li);
  21054. var _l = ((t) => (t[t.INFO = 0] = "INFO", t[t.STOP = 1] = "STOP", t[t.WARNING = 2] = "WARNING", t))(_l || {});
  21055. var El = ((t) => (t.BETWEEN = "between", t.EQUAL = "equal", t.GREATER_THAN = "greaterThan", t.GREATER_THAN_OR_EQUAL = "greaterThanOrEqual", t.LESS_THAN = "lessThan", t.LESS_THAN_OR_EQUAL = "lessThanOrEqual", t.NOT_BETWEEN = "notBetween", t.NOT_EQUAL = "notEqual", t))(El || {});
  21056. var Cl = ((t) => (t[t.TEXT = 0] = "TEXT", t[t.ARROW = 1] = "ARROW", t[t.CUSTOM = 2] = "CUSTOM", t))(Cl || {});
  21057. var Rl = ((t) => (t.VALID = "valid", t.INVALID = "invalid", t.VALIDATING = "validating", t))(Rl || {});
  21058. var Il = ((t) => (t.CUSTOM = "custom", t.LIST = "list", t.LIST_MULTIPLE = "listMultiple", t.NONE = "none", t.TEXT_LENGTH = "textLength", t.DATE = "date", t.TIME = "time", t.WHOLE = "whole", t.DECIMAL = "decimal", t.CHECKBOX = "checkbox", t.ANY = "any", t))(Il || {});
  21059. var bn = class bn2 {
  21060. static get() {
  21061. if (this._instance)
  21062. return this._instance;
  21063. const e = new bn2();
  21064. return this._instance = e, e;
  21065. }
  21066. static extend(e) {
  21067. Object.getOwnPropertyNames(e.prototype).forEach((n) => {
  21068. n !== "constructor" && (this.prototype[n] = e.prototype[n]);
  21069. }), Object.getOwnPropertyNames(e).forEach((n) => {
  21070. n !== "prototype" && n !== "name" && n !== "length" && (this[n] = e[n]);
  21071. });
  21072. }
  21073. constructor() {
  21074. for (const e in bn2.prototype)
  21075. this[e] = bn2.prototype[e];
  21076. }
  21077. /**
  21078. * Defines different types of Univer instances
  21079. */
  21080. get UniverInstanceType() {
  21081. return Fe;
  21082. }
  21083. /**
  21084. * Represents different stages in the lifecycle
  21085. */
  21086. get LifecycleStages() {
  21087. return Ve;
  21088. }
  21089. /**
  21090. * Different types of data validation
  21091. */
  21092. get DataValidationType() {
  21093. return Il;
  21094. }
  21095. /**
  21096. * Different error display styles
  21097. */
  21098. get DataValidationErrorStyle() {
  21099. return _l;
  21100. }
  21101. /**
  21102. * Different validation rendering modes
  21103. */
  21104. get DataValidationRenderMode() {
  21105. return Cl;
  21106. }
  21107. /**
  21108. * Different validation operators
  21109. */
  21110. get DataValidationOperator() {
  21111. return El;
  21112. }
  21113. /**
  21114. * Different validation states
  21115. */
  21116. get DataValidationStatus() {
  21117. return Rl;
  21118. }
  21119. /**
  21120. * Different types of commands
  21121. */
  21122. get CommandType() {
  21123. return ar;
  21124. }
  21125. /**
  21126. * Different baseline offsets for text baseline positioning
  21127. */
  21128. get BaselineOffset() {
  21129. return Bt;
  21130. }
  21131. /**
  21132. * Boolean number representations
  21133. */
  21134. get BooleanNumber() {
  21135. return we;
  21136. }
  21137. /**
  21138. * Different horizontal text alignment options
  21139. */
  21140. get HorizontalAlign() {
  21141. return Xt;
  21142. }
  21143. /**
  21144. * Different text decoration styles
  21145. */
  21146. get TextDecoration() {
  21147. return Nu;
  21148. }
  21149. /**
  21150. * Different text direction options
  21151. */
  21152. get TextDirection() {
  21153. return er;
  21154. }
  21155. /**
  21156. * Different vertical text alignment options
  21157. */
  21158. get VerticalAlign() {
  21159. return hn;
  21160. }
  21161. /**
  21162. * Different border types
  21163. */
  21164. get BorderType() {
  21165. return Eu;
  21166. }
  21167. /**
  21168. * Different border style types
  21169. */
  21170. get BorderStyleTypes() {
  21171. return Xe;
  21172. }
  21173. /**
  21174. * Auto fill series types
  21175. */
  21176. get AutoFillSeries() {
  21177. return _u;
  21178. }
  21179. /**
  21180. * Color types
  21181. */
  21182. get ColorType() {
  21183. return vt;
  21184. }
  21185. /**
  21186. * Common hide types
  21187. */
  21188. get CommonHideTypes() {
  21189. return Cu;
  21190. }
  21191. /**
  21192. * Copy paste types
  21193. */
  21194. get CopyPasteType() {
  21195. return Ru;
  21196. }
  21197. /**
  21198. * Delete direction types
  21199. */
  21200. get DeleteDirection() {
  21201. return Iu;
  21202. }
  21203. /**
  21204. * Developer metadata visibility types
  21205. */
  21206. get DeveloperMetadataVisibility() {
  21207. return vu;
  21208. }
  21209. /**
  21210. * Dimension types
  21211. */
  21212. get Dimension() {
  21213. return yu;
  21214. }
  21215. /**
  21216. * Direction types
  21217. */
  21218. get Direction() {
  21219. return wu;
  21220. }
  21221. /**
  21222. * Interpolation point types
  21223. */
  21224. get InterpolationPointType() {
  21225. return Ou;
  21226. }
  21227. /**
  21228. * Locale types
  21229. */
  21230. get LocaleType() {
  21231. return ur;
  21232. }
  21233. /**
  21234. * Mention types
  21235. */
  21236. get MentionType() {
  21237. return Zr;
  21238. }
  21239. /**
  21240. * Protection types
  21241. */
  21242. get ProtectionType() {
  21243. return bu;
  21244. }
  21245. /**
  21246. * Relative date types
  21247. */
  21248. get RelativeDate() {
  21249. return Su;
  21250. }
  21251. /**
  21252. * Sheet types
  21253. */
  21254. get SheetTypes() {
  21255. return Au;
  21256. }
  21257. /**
  21258. * Theme color types
  21259. */
  21260. get ThemeColorType() {
  21261. return ft;
  21262. }
  21263. };
  21264. C(bn, "_instance");
  21265. var ci = bn;
  21266. var Sn = class Sn2 {
  21267. static get() {
  21268. if (this._instance)
  21269. return this._instance;
  21270. const e = new Sn2();
  21271. return this._instance = e, e;
  21272. }
  21273. static extend(e) {
  21274. Object.getOwnPropertyNames(e.prototype).forEach((n) => {
  21275. n !== "constructor" && (this.prototype[n] = e.prototype[n]);
  21276. }), Object.getOwnPropertyNames(e).forEach((n) => {
  21277. n !== "prototype" && n !== "name" && n !== "length" && (this[n] = e[n]);
  21278. });
  21279. }
  21280. constructor() {
  21281. for (const e in Sn2.prototype)
  21282. this[e] = Sn2.prototype[e];
  21283. }
  21284. /**
  21285. * Event fired when a document is created
  21286. * @see {@link IDocCreatedParam}
  21287. * @example
  21288. * ```ts
  21289. * univerAPI.addEvent(univerAPI.event.DocCreated, (params) => {
  21290. * const { unitId, type, doc, unit } = params;
  21291. * console.log('doc created', params);
  21292. * });
  21293. * ```
  21294. */
  21295. get DocCreated() {
  21296. return "DocCreated";
  21297. }
  21298. /**
  21299. * Event fired when a document is disposed
  21300. * @see {@link IDocDisposedEvent}
  21301. * @example
  21302. * ```ts
  21303. * univerAPI.addEvent(univerAPI.event.DocDisposed, (params) => {
  21304. * const { unitId, unitType, snapshot } = params;
  21305. * console.log('doc disposed', params);
  21306. * });
  21307. * ```
  21308. */
  21309. get DocDisposed() {
  21310. return "DocDisposed";
  21311. }
  21312. /**
  21313. * Event fired when life cycle is changed
  21314. * @see {@link ILifeCycleChangedEvent}
  21315. * @example
  21316. * ```ts
  21317. * univerAPI.addEvent(univerAPI.event.LifeCycleChanged, (params) => {
  21318. * const { stage } = params;
  21319. * console.log('life cycle changed', params);
  21320. * });
  21321. * ```
  21322. */
  21323. get LifeCycleChanged() {
  21324. return "LifeCycleChanged";
  21325. }
  21326. /**
  21327. * Event fired when a redo command is executed
  21328. * @see {@link ICommandEvent}
  21329. * @example
  21330. * ```ts
  21331. * univerAPI.addEvent(univerAPI.event.Redo, (event) => {
  21332. * const { params, id, type } = event;
  21333. * console.log('command executed', event);
  21334. * });
  21335. * ```
  21336. */
  21337. get Redo() {
  21338. return "Redo";
  21339. }
  21340. /**
  21341. * Event fired when an undo command is executed
  21342. * @see {@link ICommandEvent}
  21343. * @example
  21344. * ```ts
  21345. * univerAPI.addEvent(univerAPI.event.Undo, (event) => {
  21346. * const { params, id, type } = event;
  21347. * console.log('command executed', event);
  21348. * });
  21349. * ```
  21350. */
  21351. get Undo() {
  21352. return "Undo";
  21353. }
  21354. /**
  21355. * Event fired before a redo command is executed
  21356. * @see {@link ICommandEvent}
  21357. * @example
  21358. * ```ts
  21359. * univerAPI.addEvent(univerAPI.event.BeforeRedo, (event) => {
  21360. * const { params, id, type } = event;
  21361. * console.log('command executed', event);
  21362. * });
  21363. * ```
  21364. */
  21365. get BeforeRedo() {
  21366. return "BeforeRedo";
  21367. }
  21368. /**
  21369. * Event fired before an undo command is executed
  21370. * @see {@link ICommandEvent}
  21371. * @example
  21372. * ```ts
  21373. * univerAPI.addEvent(univerAPI.event.BeforeUndo, (event) => {
  21374. * const { params, id, type } = event;
  21375. * console.log('command executed', event);
  21376. * });
  21377. * ```
  21378. */
  21379. get BeforeUndo() {
  21380. return "BeforeUndo";
  21381. }
  21382. /**
  21383. * Event fired when a command is executed
  21384. * @see {@link ICommandEvent}
  21385. * @example
  21386. * ```ts
  21387. * univerAPI.addEvent(univerAPI.event.CommandExecuted, (event) => {
  21388. * const { params, id, type } = event;
  21389. * console.log('command executed', event);
  21390. * });
  21391. * ```
  21392. */
  21393. get CommandExecuted() {
  21394. return "CommandExecuted";
  21395. }
  21396. /**
  21397. * Event fired before a command is executed
  21398. * @see {@link ICommandEvent}
  21399. * @example
  21400. * ```ts
  21401. * univerAPI.addEvent(univerAPI.event.BeforeCommandExecute, (event) => {
  21402. * const { params, id, type } = event;
  21403. * console.log('command executed', event);
  21404. * });
  21405. * ```
  21406. */
  21407. get BeforeCommandExecute() {
  21408. return "BeforeCommandExecute";
  21409. }
  21410. };
  21411. C(Sn, "_instance");
  21412. var hi = Sn;
  21413. var r0 = Object.defineProperty;
  21414. var s0 = Object.getOwnPropertyDescriptor;
  21415. var i0 = (t, e, n, r) => {
  21416. for (var s = r > 1 ? void 0 : r ? s0(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  21417. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  21418. return r && s && r0(e, n, s), s;
  21419. };
  21420. var ya = (t, e) => (n, r) => e(n, r, t);
  21421. var di = class extends Fi {
  21422. constructor(t, e) {
  21423. super(), this._injector = t, this._lifecycleService = e;
  21424. }
  21425. /**
  21426. * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifecycleChanged)` as instead
  21427. */
  21428. onStarting(t) {
  21429. return Ze(this._lifecycleService.lifecycle$.pipe(filter((e) => e === Ve.Starting)).subscribe(t));
  21430. }
  21431. /**
  21432. * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifecycleChanged)` as instead
  21433. */
  21434. onReady(t) {
  21435. return Ze(this._lifecycleService.lifecycle$.pipe(filter((e) => e === Ve.Ready)).subscribe(t));
  21436. }
  21437. /**
  21438. * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifecycleChanged, () => {})` as instead
  21439. */
  21440. onRendered(t) {
  21441. return Ze(this._lifecycleService.lifecycle$.pipe(filter((e) => e === Ve.Rendered)).subscribe(t));
  21442. }
  21443. /**
  21444. * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifecycleChanged, () => {})` as instead
  21445. */
  21446. onSteady(t) {
  21447. return Ze(this._lifecycleService.lifecycle$.pipe(filter((e) => e === Ve.Steady)).subscribe(t));
  21448. }
  21449. /**
  21450. * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeUndo, () => {})` as instead
  21451. */
  21452. onBeforeUndo(t) {
  21453. return this._injector.get(Pt).beforeCommandExecuted((n) => {
  21454. if (n.id === Nn.id) {
  21455. const s = this._injector.get(cn).pitchTopUndoElement();
  21456. s && t(s);
  21457. }
  21458. });
  21459. }
  21460. /**
  21461. * @deprecated use `univerAPI.addEvent(univerAPI.Event.Undo, () => {})` as instead
  21462. */
  21463. onUndo(t) {
  21464. return this._injector.get(Pt).onCommandExecuted((n) => {
  21465. if (n.id === Nn.id) {
  21466. const s = this._injector.get(cn).pitchTopUndoElement();
  21467. s && t(s);
  21468. }
  21469. });
  21470. }
  21471. /**
  21472. * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeRedo, () => {})` as instead
  21473. */
  21474. onBeforeRedo(t) {
  21475. return this._injector.get(Pt).beforeCommandExecuted((n) => {
  21476. if (n.id === Tn.id) {
  21477. const s = this._injector.get(cn).pitchTopRedoElement();
  21478. s && t(s);
  21479. }
  21480. });
  21481. }
  21482. /**
  21483. * @deprecated use `univerAPI.addEvent(univerAPI.Event.Redo, () => {})` as instead
  21484. */
  21485. onRedo(t) {
  21486. return this._injector.get(Pt).onCommandExecuted((n) => {
  21487. if (n.id === Tn.id) {
  21488. const s = this._injector.get(cn).pitchTopRedoElement();
  21489. s && t(s);
  21490. }
  21491. });
  21492. }
  21493. };
  21494. di = i0([
  21495. ya(0, ot(Ot)),
  21496. ya(1, ot(Ht))
  21497. ], di);
  21498. var o0 = Object.defineProperty;
  21499. var a0 = Object.getOwnPropertyDescriptor;
  21500. var u0 = (t, e, n, r) => {
  21501. for (var s = r > 1 ? void 0 : r ? a0(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  21502. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  21503. return r && s && o0(e, n, s), s;
  21504. };
  21505. var wa = (t, e) => (n, r) => e(n, r, t);
  21506. var fi = class extends Fi {
  21507. constructor(t, e) {
  21508. super(), this._injector = t, this._userManagerService = e;
  21509. }
  21510. /**
  21511. * Get current user info.
  21512. * @returns {IUser} Current user info.
  21513. * @example
  21514. * ```typescript
  21515. * univerAPI.getUserManager().getCurrentUser();
  21516. * ```
  21517. */
  21518. getCurrentUser() {
  21519. return this._userManagerService.getCurrentUser();
  21520. }
  21521. };
  21522. fi = u0([
  21523. wa(0, ot(Ot)),
  21524. wa(1, ot(rr))
  21525. ], fi);
  21526. var is = class is2 {
  21527. static get() {
  21528. if (this._instance)
  21529. return this._instance;
  21530. const e = new is2();
  21531. return this._instance = e, e;
  21532. }
  21533. static extend(e) {
  21534. Object.getOwnPropertyNames(e.prototype).forEach((n) => {
  21535. n !== "constructor" && (this.prototype[n] = e.prototype[n]);
  21536. }), Object.getOwnPropertyNames(e).forEach((n) => {
  21537. n !== "prototype" && n !== "name" && n !== "length" && (this[n] = e[n]);
  21538. });
  21539. }
  21540. /**
  21541. * Rectangle utils, including range operations likes merge, subtract, split
  21542. */
  21543. get rectangle() {
  21544. return en;
  21545. }
  21546. /**
  21547. * Number format utils, including parse and strigify about date, price, etc
  21548. */
  21549. get numfmt() {
  21550. return Op;
  21551. }
  21552. /**
  21553. * common tools
  21554. */
  21555. get tools() {
  21556. return re;
  21557. }
  21558. };
  21559. C(is, "_instance");
  21560. var gi = is;
  21561. var l0 = Object.defineProperty;
  21562. var c0 = Object.getOwnPropertyDescriptor;
  21563. var h0 = (t, e, n, r) => {
  21564. for (var s = r > 1 ? void 0 : r ? c0(e, n) : e, i = t.length - 1, o; i >= 0; i--)
  21565. (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
  21566. return r && s && l0(e, n, s), s;
  21567. };
  21568. var Mr = (t, e) => (n, r) => e(n, r, t);
  21569. var pi = class extends al {
  21570. constructor(e, n, r, s) {
  21571. super(e);
  21572. C(this, "_eventRegistry", /* @__PURE__ */ new Map());
  21573. this._injector = e, this._commandService = n, this._univerInstanceService = r, this._lifecycleService = s, this.disposeWithMe(
  21574. this._lifecycleService.lifecycle$.subscribe((i) => {
  21575. this.fireEvent(this.Event.LifeCycleChanged, { stage: i });
  21576. })
  21577. ), this.disposeWithMe(
  21578. this._commandService.beforeCommandExecuted((i) => {
  21579. if (!this._eventRegistry.get(this.Event.BeforeRedo) && !this._eventRegistry.get(this.Event.BeforeUndo) && !this._eventRegistry.get(this.Event.BeforeCommandExecute))
  21580. return;
  21581. const { id: o, type: a, params: u } = i, l = { id: o, type: a, params: u };
  21582. switch (i.id) {
  21583. case Tn.id:
  21584. this.fireEvent(this.Event.BeforeRedo, l);
  21585. break;
  21586. case Nn.id:
  21587. this.fireEvent(this.Event.BeforeUndo, l);
  21588. break;
  21589. default:
  21590. this.fireEvent(this.Event.BeforeCommandExecute, l);
  21591. break;
  21592. }
  21593. if (l.cancel)
  21594. throw new xf();
  21595. })
  21596. ), this.disposeWithMe(
  21597. this._commandService.onCommandExecuted((i) => {
  21598. if (!this._eventRegistry.get(this.Event.Redo) && !this._eventRegistry.get(this.Event.Undo) && !this._eventRegistry.get(this.Event.CommandExecuted))
  21599. return;
  21600. const { id: o, type: a, params: u } = i, l = { id: o, type: a, params: u };
  21601. switch (i.id) {
  21602. case Tn.id:
  21603. this.fireEvent(this.Event.Redo, l);
  21604. break;
  21605. case Nn.id:
  21606. this.fireEvent(this.Event.Undo, l);
  21607. break;
  21608. default:
  21609. this.fireEvent(this.Event.CommandExecuted, l);
  21610. break;
  21611. }
  21612. })
  21613. ), this._initUnitEvent(this._injector), this._injector.onDispose(() => {
  21614. this.dispose();
  21615. });
  21616. }
  21617. /**
  21618. * Create an FUniver instance, if the injector is not provided, it will create a new Univer instance.
  21619. * @static
  21620. * @param {Univer | Injector} wrapped - The Univer instance or injector instance.
  21621. * @returns {FUniver} - The FUniver instance.
  21622. */
  21623. static newAPI(e) {
  21624. return (e instanceof GE ? e.__getInjector() : e).createInstance(pi);
  21625. }
  21626. _ensureEventRegistry(e) {
  21627. return this._eventRegistry.has(e) || this._eventRegistry.set(e, new $i()), this._eventRegistry.get(e);
  21628. }
  21629. _initUnitEvent(e) {
  21630. const n = e.get(_n);
  21631. this.disposeWithMe(
  21632. n.unitDisposed$.subscribe((r) => {
  21633. this._eventRegistry.get(this.Event.DocDisposed) && r.type === Fe.UNIVER_DOC && this.fireEvent(
  21634. this.Event.DocDisposed,
  21635. {
  21636. unitId: r.getUnitId(),
  21637. unitType: r.type,
  21638. snapshot: r.getSnapshot()
  21639. }
  21640. );
  21641. })
  21642. ), this.disposeWithMe(
  21643. n.unitAdded$.subscribe((r) => {
  21644. if (this._eventRegistry.get(this.Event.DocCreated) && r.type === Fe.UNIVER_DOC) {
  21645. const s = r, i = e.createInstance(li, s);
  21646. this.fireEvent(
  21647. this.Event.DocCreated,
  21648. {
  21649. unitId: r.getUnitId(),
  21650. type: r.type,
  21651. doc: i,
  21652. unit: i
  21653. }
  21654. );
  21655. }
  21656. })
  21657. );
  21658. }
  21659. _eventListend(e) {
  21660. return this._eventRegistry.get(e);
  21661. }
  21662. /**
  21663. * Dispose the UniverSheet by the `unitId`. The UniverSheet would be unload from the application.
  21664. * @param unitId The unit id of the UniverSheet.
  21665. * @returns Whether the Univer instance is disposed successfully.
  21666. */
  21667. disposeUnit(e) {
  21668. return this._univerInstanceService.disposeUnit(e);
  21669. }
  21670. /**
  21671. * Get the current lifecycle stage.
  21672. * @returns {LifecycleStages} - The current lifecycle stage.
  21673. */
  21674. getCurrentLifecycleStage() {
  21675. return this._injector.get(Ht).stage;
  21676. }
  21677. /**
  21678. * Undo an editing on the currently focused document.
  21679. * @returns {Promise<boolean>} undo result
  21680. */
  21681. undo() {
  21682. return this._commandService.executeCommand(Nn.id);
  21683. }
  21684. /**
  21685. * Redo an editing on the currently focused document.
  21686. * @returns {Promise<boolean>} redo result
  21687. */
  21688. redo() {
  21689. return this._commandService.executeCommand(Tn.id);
  21690. }
  21691. /**
  21692. * Register a callback that will be triggered before invoking a command.
  21693. * @deprecated use `addEvent(univerAPI.event.BeforeCommandExecute, () => {})` instead.
  21694. * @param {CommandListener} callback The callback.
  21695. * @returns {IDisposable} The disposable instance.
  21696. */
  21697. onBeforeCommandExecute(e) {
  21698. return this._commandService.beforeCommandExecuted((n, r) => {
  21699. e(n, r);
  21700. });
  21701. }
  21702. /**
  21703. * Register a callback that will be triggered when a command is invoked.
  21704. * @deprecated use `addEvent(univerAPI.event.CommandExecuted, () => {})` instead.
  21705. * @param {CommandListener} callback The callback.
  21706. * @returns {IDisposable} The disposable instance.
  21707. */
  21708. onCommandExecuted(e) {
  21709. return this._commandService.onCommandExecuted((n, r) => {
  21710. e(n, r);
  21711. });
  21712. }
  21713. /**
  21714. * Execute a command with the given id and parameters.
  21715. * @param id Identifier of the command.
  21716. * @param params Parameters of this execution.
  21717. * @param options Options of this execution.
  21718. * @returns The result of the execution. It is a boolean value by default which indicates the command is executed.
  21719. */
  21720. executeCommand(e, n, r) {
  21721. return this._commandService.executeCommand(e, n, r);
  21722. }
  21723. /**
  21724. * Execute a command with the given id and parameters synchronously.
  21725. * @param id Identifier of the command.
  21726. * @param params Parameters of this execution.
  21727. * @param options Options of this execution.
  21728. * @returns The result of the execution. It is a boolean value by default which indicates the command is executed.
  21729. */
  21730. syncExecuteCommand(e, n, r) {
  21731. return this._commandService.syncExecuteCommand(e, n, r);
  21732. }
  21733. /**
  21734. * Get hooks.
  21735. * @deprecated use `addEvent` instead.
  21736. * @returns {FHooks} FHooks instance
  21737. */
  21738. getHooks() {
  21739. return this._injector.createInstance(di);
  21740. }
  21741. get Enum() {
  21742. return ci.get();
  21743. }
  21744. get Event() {
  21745. return hi.get();
  21746. }
  21747. get Util() {
  21748. return gi.get();
  21749. }
  21750. /**
  21751. * Add an event listener
  21752. * @param event key of event
  21753. * @param callback callback when event triggered
  21754. * @returns {Disposable} The Disposable instance, for remove the listener
  21755. * @example
  21756. * ```ts
  21757. * univerAPI.addEvent(univerAPI.event.UnitCreated, (params) => {
  21758. * console.log('unit created', params);
  21759. * });
  21760. * ```
  21761. */
  21762. addEvent(e, n) {
  21763. return this._ensureEventRegistry(e).add(n), Ze(() => this._ensureEventRegistry(e).delete(n));
  21764. }
  21765. /**
  21766. * Fire an event, used in internal only.
  21767. * @param event {string} key of event
  21768. * @param params {any} params of event
  21769. * @returns {boolean} should cancel
  21770. * @example
  21771. * ```ts
  21772. * this.fireEvent(univerAPI.event.UnitCreated, params);
  21773. * ```
  21774. */
  21775. fireEvent(e, n) {
  21776. var r;
  21777. return (r = this._eventRegistry.get(e)) == null || r.getData().forEach((s) => {
  21778. s(n);
  21779. }), n.cancel;
  21780. }
  21781. /**
  21782. * Get the callback map corresponding to the event
  21783. * @param event
  21784. * @returns {number} The number of callbacks
  21785. */
  21786. hasEventCallback(e) {
  21787. var r, s;
  21788. return ((s = (r = this._eventRegistry.get(e)) == null ? void 0 : r.getData().length) != null ? s : 0) > 0;
  21789. }
  21790. getUserManager() {
  21791. return this._injector.createInstance(fi);
  21792. }
  21793. /**
  21794. * Create a new blob.
  21795. * @returns {FBlob} The new blob instance
  21796. * @example
  21797. * ```ts
  21798. * const blob = univerApi.newBlob();
  21799. * ```
  21800. */
  21801. newBlob() {
  21802. return this._injector.createInstance(ss);
  21803. }
  21804. /**
  21805. * Create a new color.
  21806. * @returns {ColorBuilder} The new color instance
  21807. * @example
  21808. * ```ts
  21809. * const color = univerApi.newColor();
  21810. * ```
  21811. */
  21812. newColor() {
  21813. return new gs();
  21814. }
  21815. /**
  21816. * Create a new rich text.
  21817. * @param data
  21818. * @returns {RichTextBuilder} The new rich text instance
  21819. * @example
  21820. * ```ts
  21821. * const richText = univerApi.newRichText();
  21822. * ```
  21823. */
  21824. newRichText(e) {
  21825. return gn.create(e);
  21826. }
  21827. /**
  21828. * Create a new rich text value.
  21829. * @param data - The rich text data
  21830. * @returns {RichTextValue} The new rich text value instance
  21831. * @example
  21832. * ```ts
  21833. * const richTextValue = univerApi.newRichTextValue();
  21834. * ```
  21835. */
  21836. newRichTextValue(e) {
  21837. return Zt.create(e);
  21838. }
  21839. /**
  21840. * Create a new paragraph style.
  21841. * @param style - The paragraph style
  21842. * @returns {ParagraphStyleBuilder} The new paragraph style instance
  21843. * @example
  21844. * ```ts
  21845. * const paragraphStyle = univerApi.newParagraphStyle();
  21846. * ```
  21847. */
  21848. newParagraphStyle(e) {
  21849. return nr.create(e);
  21850. }
  21851. /**
  21852. * Create a new paragraph style value.
  21853. * @param style - The paragraph style
  21854. * @returns {ParagraphStyleValue} The new paragraph style value instance
  21855. * @example
  21856. * ```ts
  21857. * const paragraphStyleValue = univerApi.newParagraphStyleValue();
  21858. * ```
  21859. */
  21860. newParagraphStyleValue(e) {
  21861. return hr.create(e);
  21862. }
  21863. /**
  21864. * Create a new text style.
  21865. * @param style - The text style
  21866. * @returns {TextStyleBuilder} The new text style instance
  21867. * @example
  21868. * ```ts
  21869. * const textStyle = univerApi.newTextStyle();
  21870. * ```
  21871. */
  21872. newTextStyle(e) {
  21873. return Qt.create(e);
  21874. }
  21875. /**
  21876. * Create a new text style value.
  21877. * @param style - The text style
  21878. * @returns {TextStyleValue} The new text style value instance
  21879. * @example
  21880. * ```ts
  21881. * const textStyleValue = univerApi.newTextStyleValue();
  21882. * ```
  21883. */
  21884. newTextStyleValue(e) {
  21885. return cr.create(e);
  21886. }
  21887. newTextDecoration(e) {
  21888. return new Jt(e);
  21889. }
  21890. };
  21891. pi = h0([
  21892. Mr(0, ot(Ot)),
  21893. Mr(1, Pt),
  21894. Mr(2, _n),
  21895. Mr(3, ot(Ht))
  21896. ], pi);
  21897. function d0(t) {
  21898. return /^-?\d+(\.\d+)?$/.test(t);
  21899. }
  21900. function bR(t) {
  21901. return d0(t) ? Number(t) <= Number.MAX_SAFE_INTEGER : false;
  21902. }
  21903. function SR(t) {
  21904. const e = new MessageChannel();
  21905. let n = false;
  21906. const r = () => {
  21907. n || t();
  21908. };
  21909. return e.port1.onmessage = r, e.port2.postMessage(null), () => {
  21910. n = true, e.port1.close(), e.port2.close();
  21911. };
  21912. }
  21913. function AR(t, e) {
  21914. return e.forEach((n) => t.add(n)), t;
  21915. }
  21916. function NR(t, e, n, r) {
  21917. var c;
  21918. if (e === "")
  21919. return t;
  21920. const s = {
  21921. id: "mock-id",
  21922. body: t,
  21923. documentStyle: {}
  21924. }, i = new jt(s), o = e.length;
  21925. let a;
  21926. for (; (a = (r ? i.getBody().dataStream : i.getBody().dataStream.toLowerCase()).indexOf(e)) >= 0; ) {
  21927. const l = new Ke(), h = tn.getInstance();
  21928. if (a > 0 && l.retain(a), n.length > 0) {
  21929. const d = i.sliceBody(a, a + o), f = {
  21930. dataStream: n
  21931. };
  21932. if (Array.isArray(d == null ? void 0 : d.textRuns) && d.textRuns.length && (f.textRuns = [{
  21933. ...d.textRuns[0],
  21934. st: 0,
  21935. ed: n.length
  21936. }]), (c = d == null ? void 0 : d.customRanges) != null && c.length) {
  21937. const E = d.customRanges[0];
  21938. f.customRanges = [{
  21939. ...E,
  21940. startIndex: 0,
  21941. endIndex: n.length - 1
  21942. }];
  21943. }
  21944. l.insert(n.length, f);
  21945. }
  21946. l.delete(o), i.apply(h.editOp(l.serialize()));
  21947. }
  21948. const u = i.getBody();
  21949. return i.dispose(), u;
  21950. }
  21951. var TR = "__default_document_sub_component_id20231101__";
  21952. var f0 = class {
  21953. constructor() {
  21954. C(this, "skipNextObservers", false);
  21955. C(this, "lastReturnValue");
  21956. C(this, "isStopPropagation", false);
  21957. }
  21958. stopPropagation() {
  21959. this.isStopPropagation = true;
  21960. }
  21961. };
  21962. var MR = class extends Subject {
  21963. constructor() {
  21964. super(...arguments);
  21965. C(this, "_sortedObservers", []);
  21966. }
  21967. /** @deprecated Use `subscribeEvent` instead. */
  21968. subscribe() {
  21969. throw new Error("[EventSubject]: please use `subscribeEvent` instead of `subscribe` method for `EventSubject`.");
  21970. }
  21971. /** @deprecated Use `emitEvent` instead. */
  21972. next() {
  21973. throw new Error("[EventSubject]: please use `emitEvent` instead of `next` method for `EventSubject`.");
  21974. }
  21975. unsubscribe() {
  21976. super.unsubscribe(), this._sortedObservers.length = 0;
  21977. }
  21978. complete() {
  21979. super.complete(), this._sortedObservers.length = 0;
  21980. }
  21981. subscribeEvent(n) {
  21982. let r;
  21983. typeof n == "function" ? r = { next: ([i, o]) => n(i, o) } : r = n;
  21984. const s = super.subscribe(r);
  21985. return this._sortedObservers.push(r), this._sortedObservers.sort((i, o) => {
  21986. var a, u;
  21987. return ((a = i.priority) != null ? a : 0) - ((u = o.priority) != null ? u : 0);
  21988. }), s.add(() => this._sortedObservers = this._sortedObservers.filter((i) => i !== r)), s;
  21989. }
  21990. clearObservers() {
  21991. this._sortedObservers.forEach((n) => {
  21992. var r;
  21993. return (r = n.complete) == null ? void 0 : r.call(n);
  21994. }), this._sortedObservers.length = 0;
  21995. }
  21996. emitEvent(n) {
  21997. var r;
  21998. if (!this.closed) {
  21999. const s = new f0();
  22000. s.lastReturnValue = n;
  22001. for (const i of this._sortedObservers) {
  22002. const o = (r = i.next) == null ? void 0 : r.call(i, [n, s]);
  22003. if (s.lastReturnValue = o, s.skipNextObservers)
  22004. return {
  22005. handled: true,
  22006. lastReturnValue: s.lastReturnValue,
  22007. stopPropagation: s.isStopPropagation
  22008. };
  22009. }
  22010. return {
  22011. handled: this._sortedObservers.length > 0,
  22012. lastReturnValue: s.lastReturnValue,
  22013. stopPropagation: s.isStopPropagation
  22014. };
  22015. }
  22016. throw new Error("[EventSubject]: cannot emit event on a closed subject.");
  22017. }
  22018. };
  22019. function DR(t) {
  22020. return new Observable((e) => {
  22021. const n = t.subscribeEvent((r) => {
  22022. e.next(r);
  22023. });
  22024. return () => n.unsubscribe();
  22025. });
  22026. }
  22027. var xR = Ct("ILocalStorageService");
  22028. function LR(t) {
  22029. return !(t.length === 0 || t.length > 31 || t.startsWith("'") || t.endsWith("'") || /[:\\\/\?\*\[\]]/.test(t));
  22030. }
  22031. function UR(t) {
  22032. return new Promise((e) => setTimeout(e, t));
  22033. }
  22034. function PR(t = 1) {
  22035. return new Promise((e) => {
  22036. let n = 0;
  22037. const r = () => {
  22038. n++, n >= t ? e() : requestAnimationFrame(r);
  22039. };
  22040. requestAnimationFrame(r);
  22041. });
  22042. }
  22043. var vl = ((t) => (t.URL = "URL", t.UUID = "UUID", t.BASE64 = "BASE64", t))(vl || {});
  22044. var g0 = ((t) => (t.SUCCUSS = "0", t.ERROR_EXCEED_SIZE = "1", t.ERROR_IMAGE_TYPE = "2", t.ERROR_UPLOAD_COUNT_LIMIT = "3", t.ERROR_IMAGE = "4", t))(g0 || {});
  22045. var Oa = Ct("core.image-io.service");
  22046. var kR = class {
  22047. constructor(e, n = 100) {
  22048. C(this, "_imageCacheMap");
  22049. this._injector = e, this._imageCacheMap = new Qr(n);
  22050. }
  22051. _getImageCacheKey(e, n) {
  22052. return `${e}-${n}`;
  22053. }
  22054. getImage(e, n, r, s) {
  22055. const i = this._getImageCacheKey(e, n);
  22056. let o = this._imageCacheMap.get(i);
  22057. return o || ((async () => {
  22058. o = new Image();
  22059. const a = this._injector.has(Oa) ? this._injector.get(Oa) : null;
  22060. if (e === vl.UUID)
  22061. try {
  22062. o.src = await (a == null ? void 0 : a.getImage(n)) || "";
  22063. } catch (u) {
  22064. console.error(u);
  22065. }
  22066. else
  22067. o.src = n;
  22068. o.onload = () => {
  22069. r == null || r();
  22070. }, o.onerror = () => {
  22071. s == null || s();
  22072. }, this._imageCacheMap.set(i, o);
  22073. })(), null);
  22074. }
  22075. };
  22076. var FR = ["script", "style", "meta", "comment", "link"];
  22077. var p0 = ((t) => (t[t.DISABLED = 0] = "DISABLED", t[t.FULL_ALPHA = 1] = "FULL_ALPHA", t[t.FULL_HANGUL = 2] = "FULL_HANGUL", t[t.FULL_KATAKANA = 3] = "FULL_KATAKANA", t[t.HALF_ALPHA = 4] = "HALF_ALPHA", t[t.HALF_HANGUL = 5] = "HALF_HANGUL", t[t.HALF_KATAKANA = 6] = "HALF_KATAKANA", t[t.HIRAGANA = 7] = "HIRAGANA", t[t.NO_CONTROL = 8] = "NO_CONTROL", t[t.OFF = 9] = "OFF", t[t.ON = 10] = "ON", t))(p0 || {});
  22078. var ba = [
  22079. Int8Array,
  22080. Uint8Array,
  22081. Uint8ClampedArray,
  22082. Int16Array,
  22083. Uint16Array,
  22084. Int32Array,
  22085. Uint32Array,
  22086. Float32Array,
  22087. Float64Array
  22088. ];
  22089. var Ls = 1;
  22090. var jn = 8;
  22091. var ji = class _ji {
  22092. /**
  22093. * Creates an index from raw `ArrayBuffer` data.
  22094. * @param {ArrayBuffer} data
  22095. */
  22096. static from(e) {
  22097. if (!(e instanceof ArrayBuffer))
  22098. throw new Error("Data must be an instance of ArrayBuffer.");
  22099. const [n, r] = new Uint8Array(e, 0, 2);
  22100. if (n !== 219)
  22101. throw new Error("Data does not appear to be in a KDBush format.");
  22102. const s = r >> 4;
  22103. if (s !== Ls)
  22104. throw new Error(`Got v${s} data when expected v${Ls}.`);
  22105. const i = ba[r & 15];
  22106. if (!i)
  22107. throw new Error("Unrecognized array type.");
  22108. const [o] = new Uint16Array(e, 2, 1), [a] = new Uint32Array(e, 4, 1);
  22109. return new _ji(a, o, i, e);
  22110. }
  22111. /**
  22112. * Creates an index that will hold a given number of items.
  22113. * @param {number} numItems
  22114. * @param {number} [nodeSize=64] Size of the KD-tree node (64 by default).
  22115. * @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).
  22116. * @param {ArrayBuffer} [data] (For internal use only)
  22117. */
  22118. constructor(e, n = 64, r = Float64Array, s) {
  22119. if (isNaN(e) || e < 0)
  22120. throw new Error(`Unpexpected numItems value: ${e}.`);
  22121. this.numItems = +e, this.nodeSize = Math.min(Math.max(+n, 2), 65535), this.ArrayType = r, this.IndexArrayType = e < 65536 ? Uint16Array : Uint32Array;
  22122. const i = ba.indexOf(this.ArrayType), o = e * 2 * this.ArrayType.BYTES_PER_ELEMENT, a = e * this.IndexArrayType.BYTES_PER_ELEMENT, u = (8 - a % 8) % 8;
  22123. if (i < 0)
  22124. throw new Error(`Unexpected typed array class: ${r}.`);
  22125. s && s instanceof ArrayBuffer ? (this.data = s, this.ids = new this.IndexArrayType(this.data, jn, e), this.coords = new this.ArrayType(this.data, jn + a + u, e * 2), this._pos = e * 2, this._finished = true) : (this.data = new ArrayBuffer(jn + o + a + u), this.ids = new this.IndexArrayType(this.data, jn, e), this.coords = new this.ArrayType(this.data, jn + a + u, e * 2), this._pos = 0, this._finished = false, new Uint8Array(this.data, 0, 2).set([219, (Ls << 4) + i]), new Uint16Array(this.data, 2, 1)[0] = n, new Uint32Array(this.data, 4, 1)[0] = e);
  22126. }
  22127. /**
  22128. * Add a point to the index.
  22129. * @param {number} x
  22130. * @param {number} y
  22131. * @returns {number} An incremental index associated with the added item (starting from `0`).
  22132. */
  22133. add(e, n) {
  22134. const r = this._pos >> 1;
  22135. return this.ids[r] = r, this.coords[this._pos++] = e, this.coords[this._pos++] = n, r;
  22136. }
  22137. /**
  22138. * Perform indexing of the added points.
  22139. */
  22140. finish() {
  22141. const e = this._pos >> 1;
  22142. if (e !== this.numItems)
  22143. throw new Error(`Added ${e} items when expected ${this.numItems}.`);
  22144. return mi(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = true, this;
  22145. }
  22146. /**
  22147. * Search the index for items within a given bounding box.
  22148. * @param {number} minX
  22149. * @param {number} minY
  22150. * @param {number} maxX
  22151. * @param {number} maxY
  22152. * @returns {number[]} An array of indices correponding to the found items.
  22153. */
  22154. range(e, n, r, s) {
  22155. if (!this._finished)
  22156. throw new Error("Data not yet indexed - call index.finish().");
  22157. const { ids: i, coords: o, nodeSize: a } = this, u = [0, i.length - 1, 0], c = [];
  22158. for (; u.length; ) {
  22159. const l = u.pop() || 0, h = u.pop() || 0, d = u.pop() || 0;
  22160. if (h - d <= a) {
  22161. for (let O = d; O <= h; O++) {
  22162. const U = o[2 * O], ne = o[2 * O + 1];
  22163. U >= e && U <= r && ne >= n && ne <= s && c.push(i[O]);
  22164. }
  22165. continue;
  22166. }
  22167. const f = d + h >> 1, E = o[2 * f], R = o[2 * f + 1];
  22168. E >= e && E <= r && R >= n && R <= s && c.push(i[f]), (l === 0 ? e <= E : n <= R) && (u.push(d), u.push(f - 1), u.push(1 - l)), (l === 0 ? r >= E : s >= R) && (u.push(f + 1), u.push(h), u.push(1 - l));
  22169. }
  22170. return c;
  22171. }
  22172. /**
  22173. * Search the index for items within a given radius.
  22174. * @param {number} qx
  22175. * @param {number} qy
  22176. * @param {number} r Query radius.
  22177. * @returns {number[]} An array of indices correponding to the found items.
  22178. */
  22179. within(e, n, r) {
  22180. if (!this._finished)
  22181. throw new Error("Data not yet indexed - call index.finish().");
  22182. const { ids: s, coords: i, nodeSize: o } = this, a = [0, s.length - 1, 0], u = [], c = r * r;
  22183. for (; a.length; ) {
  22184. const l = a.pop() || 0, h = a.pop() || 0, d = a.pop() || 0;
  22185. if (h - d <= o) {
  22186. for (let O = d; O <= h; O++)
  22187. Sa(i[2 * O], i[2 * O + 1], e, n) <= c && u.push(s[O]);
  22188. continue;
  22189. }
  22190. const f = d + h >> 1, E = i[2 * f], R = i[2 * f + 1];
  22191. Sa(E, R, e, n) <= c && u.push(s[f]), (l === 0 ? e - r <= E : n - r <= R) && (a.push(d), a.push(f - 1), a.push(1 - l)), (l === 0 ? e + r >= E : n + r >= R) && (a.push(f + 1), a.push(h), a.push(1 - l));
  22192. }
  22193. return u;
  22194. }
  22195. };
  22196. function mi(t, e, n, r, s, i) {
  22197. if (s - r <= n)
  22198. return;
  22199. const o = r + s >> 1;
  22200. yl(t, e, o, r, s, i), mi(t, e, n, r, o - 1, 1 - i), mi(t, e, n, o + 1, s, 1 - i);
  22201. }
  22202. function yl(t, e, n, r, s, i) {
  22203. for (; s > r; ) {
  22204. if (s - r > 600) {
  22205. const c = s - r + 1, l = n - r + 1, h = Math.log(c), d = 0.5 * Math.exp(2 * h / 3), f = 0.5 * Math.sqrt(h * d * (c - d) / c) * (l - c / 2 < 0 ? -1 : 1), E = Math.max(r, Math.floor(n - l * d / c + f)), R = Math.min(s, Math.floor(n + (c - l) * d / c + f));
  22206. yl(t, e, n, E, R, i);
  22207. }
  22208. const o = e[2 * n + i];
  22209. let a = r, u = s;
  22210. for (Hn(t, e, r, n), e[2 * s + i] > o && Hn(t, e, r, s); a < u; ) {
  22211. for (Hn(t, e, a, u), a++, u--; e[2 * a + i] < o; )
  22212. a++;
  22213. for (; e[2 * u + i] > o; )
  22214. u--;
  22215. }
  22216. e[2 * r + i] === o ? Hn(t, e, r, u) : (u++, Hn(t, e, u, s)), u <= n && (r = u + 1), n <= u && (s = u - 1);
  22217. }
  22218. }
  22219. function Hn(t, e, n, r) {
  22220. Us(t, n, r), Us(e, 2 * n, 2 * r), Us(e, 2 * n + 1, 2 * r + 1);
  22221. }
  22222. function Us(t, e, n) {
  22223. const r = t[e];
  22224. t[e] = t[n], t[n] = r;
  22225. }
  22226. function Sa(t, e, n, r) {
  22227. const s = t - n, i = e - r;
  22228. return s * s + i * i;
  22229. }
  22230. function wl(t, e, n = 0, r = t.length - 1, s = m0) {
  22231. for (; r > n; ) {
  22232. if (r - n > 600) {
  22233. const u = r - n + 1, c = e - n + 1, l = Math.log(u), h = 0.5 * Math.exp(2 * l / 3), d = 0.5 * Math.sqrt(l * h * (u - h) / u) * (c - u / 2 < 0 ? -1 : 1), f = Math.max(n, Math.floor(e - c * h / u + d)), E = Math.min(r, Math.floor(e + (u - c) * h / u + d));
  22234. wl(t, e, f, E, s);
  22235. }
  22236. const i = t[e];
  22237. let o = n, a = r;
  22238. for (Wn(t, n, e), s(t[r], i) > 0 && Wn(t, n, r); o < a; ) {
  22239. for (Wn(t, o, a), o++, a--; s(t[o], i) < 0; )
  22240. o++;
  22241. for (; s(t[a], i) > 0; )
  22242. a--;
  22243. }
  22244. s(t[n], i) === 0 ? Wn(t, n, a) : (a++, Wn(t, a, r)), a <= e && (n = a + 1), e <= a && (r = a - 1);
  22245. }
  22246. }
  22247. function Wn(t, e, n) {
  22248. const r = t[e];
  22249. t[e] = t[n], t[n] = r;
  22250. }
  22251. function m0(t, e) {
  22252. return t < e ? -1 : t > e ? 1 : 0;
  22253. }
  22254. var Aa = class {
  22255. constructor(e = 9) {
  22256. this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
  22257. }
  22258. all() {
  22259. return this._all(this.data, []);
  22260. }
  22261. search(e) {
  22262. let n = this.data;
  22263. const r = [];
  22264. if (!xr(e, n))
  22265. return r;
  22266. const s = this.toBBox, i = [];
  22267. for (; n; ) {
  22268. for (let o = 0; o < n.children.length; o++) {
  22269. const a = n.children[o], u = n.leaf ? s(a) : a;
  22270. xr(e, u) && (n.leaf ? r.push(a) : ks(e, u) ? this._all(a, r) : i.push(a));
  22271. }
  22272. n = i.pop();
  22273. }
  22274. return r;
  22275. }
  22276. collides(e) {
  22277. let n = this.data;
  22278. if (!xr(e, n))
  22279. return false;
  22280. const r = [];
  22281. for (; n; ) {
  22282. for (let s = 0; s < n.children.length; s++) {
  22283. const i = n.children[s], o = n.leaf ? this.toBBox(i) : i;
  22284. if (xr(e, o)) {
  22285. if (n.leaf || ks(e, o))
  22286. return true;
  22287. r.push(i);
  22288. }
  22289. }
  22290. n = r.pop();
  22291. }
  22292. return false;
  22293. }
  22294. load(e) {
  22295. if (!(e && e.length))
  22296. return this;
  22297. if (e.length < this._minEntries) {
  22298. for (let r = 0; r < e.length; r++)
  22299. this.insert(e[r]);
  22300. return this;
  22301. }
  22302. let n = this._build(e.slice(), 0, e.length - 1, 0);
  22303. if (!this.data.children.length)
  22304. this.data = n;
  22305. else if (this.data.height === n.height)
  22306. this._splitRoot(this.data, n);
  22307. else {
  22308. if (this.data.height < n.height) {
  22309. const r = this.data;
  22310. this.data = n, n = r;
  22311. }
  22312. this._insert(n, this.data.height - n.height - 1, true);
  22313. }
  22314. return this;
  22315. }
  22316. insert(e) {
  22317. return e && this._insert(e, this.data.height - 1), this;
  22318. }
  22319. clear() {
  22320. return this.data = yn([]), this;
  22321. }
  22322. remove(e, n) {
  22323. if (!e)
  22324. return this;
  22325. let r = this.data;
  22326. const s = this.toBBox(e), i = [], o = [];
  22327. let a, u, c;
  22328. for (; r || i.length; ) {
  22329. if (r || (r = i.pop(), u = i[i.length - 1], a = o.pop(), c = true), r.leaf) {
  22330. const l = _0(e, r.children, n);
  22331. if (l !== -1)
  22332. return r.children.splice(l, 1), i.push(r), this._condense(i), this;
  22333. }
  22334. !c && !r.leaf && ks(r, s) ? (i.push(r), o.push(a), a = 0, u = r, r = r.children[0]) : u ? (a++, r = u.children[a], c = false) : r = null;
  22335. }
  22336. return this;
  22337. }
  22338. toBBox(e) {
  22339. return e;
  22340. }
  22341. compareMinX(e, n) {
  22342. return e.minX - n.minX;
  22343. }
  22344. compareMinY(e, n) {
  22345. return e.minY - n.minY;
  22346. }
  22347. toJSON() {
  22348. return this.data;
  22349. }
  22350. fromJSON(e) {
  22351. return this.data = e, this;
  22352. }
  22353. _all(e, n) {
  22354. const r = [];
  22355. for (; e; )
  22356. e.leaf ? n.push(...e.children) : r.push(...e.children), e = r.pop();
  22357. return n;
  22358. }
  22359. _build(e, n, r, s) {
  22360. const i = r - n + 1;
  22361. let o = this._maxEntries, a;
  22362. if (i <= o)
  22363. return a = yn(e.slice(n, r + 1)), vn(a, this.toBBox), a;
  22364. s || (s = Math.ceil(Math.log(i) / Math.log(o)), o = Math.ceil(i / Math.pow(o, s - 1))), a = yn([]), a.leaf = false, a.height = s;
  22365. const u = Math.ceil(i / o), c = u * Math.ceil(Math.sqrt(o));
  22366. Na(e, n, r, c, this.compareMinX);
  22367. for (let l = n; l <= r; l += c) {
  22368. const h = Math.min(l + c - 1, r);
  22369. Na(e, l, h, u, this.compareMinY);
  22370. for (let d = l; d <= h; d += u) {
  22371. const f = Math.min(d + u - 1, h);
  22372. a.children.push(this._build(e, d, f, s - 1));
  22373. }
  22374. }
  22375. return vn(a, this.toBBox), a;
  22376. }
  22377. _chooseSubtree(e, n, r, s) {
  22378. for (; s.push(n), !(n.leaf || s.length - 1 === r); ) {
  22379. let i = 1 / 0, o = 1 / 0, a;
  22380. for (let u = 0; u < n.children.length; u++) {
  22381. const c = n.children[u], l = Ps(c), h = R0(e, c) - l;
  22382. h < o ? (o = h, i = l < i ? l : i, a = c) : h === o && l < i && (i = l, a = c);
  22383. }
  22384. n = a || n.children[0];
  22385. }
  22386. return n;
  22387. }
  22388. _insert(e, n, r) {
  22389. const s = r ? e : this.toBBox(e), i = [], o = this._chooseSubtree(s, this.data, n, i);
  22390. for (o.children.push(e), Xn(o, s); n >= 0 && i[n].children.length > this._maxEntries; )
  22391. this._split(i, n), n--;
  22392. this._adjustParentBBoxes(s, i, n);
  22393. }
  22394. // split overflowed node into two
  22395. _split(e, n) {
  22396. const r = e[n], s = r.children.length, i = this._minEntries;
  22397. this._chooseSplitAxis(r, i, s);
  22398. const o = this._chooseSplitIndex(r, i, s), a = yn(r.children.splice(o, r.children.length - o));
  22399. a.height = r.height, a.leaf = r.leaf, vn(r, this.toBBox), vn(a, this.toBBox), n ? e[n - 1].children.push(a) : this._splitRoot(r, a);
  22400. }
  22401. _splitRoot(e, n) {
  22402. this.data = yn([e, n]), this.data.height = e.height + 1, this.data.leaf = false, vn(this.data, this.toBBox);
  22403. }
  22404. _chooseSplitIndex(e, n, r) {
  22405. let s, i = 1 / 0, o = 1 / 0;
  22406. for (let a = n; a <= r - n; a++) {
  22407. const u = Kn(e, 0, a, this.toBBox), c = Kn(e, a, r, this.toBBox), l = I0(u, c), h = Ps(u) + Ps(c);
  22408. l < i ? (i = l, s = a, o = h < o ? h : o) : l === i && h < o && (o = h, s = a);
  22409. }
  22410. return s || r - n;
  22411. }
  22412. // sorts node children by the best axis for split
  22413. _chooseSplitAxis(e, n, r) {
  22414. const s = e.leaf ? this.compareMinX : E0, i = e.leaf ? this.compareMinY : C0, o = this._allDistMargin(e, n, r, s), a = this._allDistMargin(e, n, r, i);
  22415. o < a && e.children.sort(s);
  22416. }
  22417. // total margin of all possible split distributions where each node is at least m full
  22418. _allDistMargin(e, n, r, s) {
  22419. e.children.sort(s);
  22420. const i = this.toBBox, o = Kn(e, 0, n, i), a = Kn(e, r - n, r, i);
  22421. let u = Dr(o) + Dr(a);
  22422. for (let c = n; c < r - n; c++) {
  22423. const l = e.children[c];
  22424. Xn(o, e.leaf ? i(l) : l), u += Dr(o);
  22425. }
  22426. for (let c = r - n - 1; c >= n; c--) {
  22427. const l = e.children[c];
  22428. Xn(a, e.leaf ? i(l) : l), u += Dr(a);
  22429. }
  22430. return u;
  22431. }
  22432. _adjustParentBBoxes(e, n, r) {
  22433. for (let s = r; s >= 0; s--)
  22434. Xn(n[s], e);
  22435. }
  22436. _condense(e) {
  22437. for (let n = e.length - 1, r; n >= 0; n--)
  22438. e[n].children.length === 0 ? n > 0 ? (r = e[n - 1].children, r.splice(r.indexOf(e[n]), 1)) : this.clear() : vn(e[n], this.toBBox);
  22439. }
  22440. };
  22441. function _0(t, e, n) {
  22442. if (!n)
  22443. return e.indexOf(t);
  22444. for (let r = 0; r < e.length; r++)
  22445. if (n(t, e[r]))
  22446. return r;
  22447. return -1;
  22448. }
  22449. function vn(t, e) {
  22450. Kn(t, 0, t.children.length, e, t);
  22451. }
  22452. function Kn(t, e, n, r, s) {
  22453. s || (s = yn(null)), s.minX = 1 / 0, s.minY = 1 / 0, s.maxX = -1 / 0, s.maxY = -1 / 0;
  22454. for (let i = e; i < n; i++) {
  22455. const o = t.children[i];
  22456. Xn(s, t.leaf ? r(o) : o);
  22457. }
  22458. return s;
  22459. }
  22460. function Xn(t, e) {
  22461. return t.minX = Math.min(t.minX, e.minX), t.minY = Math.min(t.minY, e.minY), t.maxX = Math.max(t.maxX, e.maxX), t.maxY = Math.max(t.maxY, e.maxY), t;
  22462. }
  22463. function E0(t, e) {
  22464. return t.minX - e.minX;
  22465. }
  22466. function C0(t, e) {
  22467. return t.minY - e.minY;
  22468. }
  22469. function Ps(t) {
  22470. return (t.maxX - t.minX) * (t.maxY - t.minY);
  22471. }
  22472. function Dr(t) {
  22473. return t.maxX - t.minX + (t.maxY - t.minY);
  22474. }
  22475. function R0(t, e) {
  22476. return (Math.max(e.maxX, t.maxX) - Math.min(e.minX, t.minX)) * (Math.max(e.maxY, t.maxY) - Math.min(e.minY, t.minY));
  22477. }
  22478. function I0(t, e) {
  22479. const n = Math.max(t.minX, e.minX), r = Math.max(t.minY, e.minY), s = Math.min(t.maxX, e.maxX), i = Math.min(t.maxY, e.maxY);
  22480. return Math.max(0, s - n) * Math.max(0, i - r);
  22481. }
  22482. function ks(t, e) {
  22483. return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;
  22484. }
  22485. function xr(t, e) {
  22486. return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY;
  22487. }
  22488. function yn(t) {
  22489. return {
  22490. children: t,
  22491. height: 1,
  22492. leaf: true,
  22493. minX: 1 / 0,
  22494. minY: 1 / 0,
  22495. maxX: -1 / 0,
  22496. maxY: -1 / 0
  22497. };
  22498. }
  22499. function Na(t, e, n, r, s) {
  22500. const i = [e, n];
  22501. for (; i.length; ) {
  22502. if (n = i.pop(), e = i.pop(), n - e <= r)
  22503. continue;
  22504. const o = e + Math.ceil((n - e) / r / 2) * r;
  22505. wl(t, o, e, n, s), i.push(e, o, o, n);
  22506. }
  22507. }
  22508. var $R = class {
  22509. constructor(e = false) {
  22510. C(this, "_tree", /* @__PURE__ */ new Map());
  22511. C(this, "_oneCellCache", /* @__PURE__ */ new Map());
  22512. C(this, "_kdTree", /* @__PURE__ */ new Map());
  22513. this._enableOneCellCache = e;
  22514. }
  22515. dispose() {
  22516. this.clear();
  22517. }
  22518. getTree(e, n) {
  22519. return this._tree.has(e) || this._tree.set(e, /* @__PURE__ */ new Map()), this._tree.get(e).has(n) || this._tree.get(e).set(n, new Aa()), this._tree.get(e).get(n);
  22520. }
  22521. _getOneCellCache(e, n, r, s) {
  22522. return this._oneCellCache.has(e) || this._oneCellCache.set(e, /* @__PURE__ */ new Map()), this._oneCellCache.get(e).has(n) || this._oneCellCache.get(e).set(n, /* @__PURE__ */ new Map()), this._oneCellCache.get(e).get(n).has(r) || this._oneCellCache.get(e).get(n).set(r, /* @__PURE__ */ new Map()), this._oneCellCache.get(e).get(n).get(r).has(s) || this._oneCellCache.get(e).get(n).get(r).set(s, /* @__PURE__ */ new Set()), this._oneCellCache.get(e).get(n).get(r).get(s);
  22523. }
  22524. _removeOneCellCache(e, n, r, s, i) {
  22525. const o = this._oneCellCache.get(e);
  22526. if (!o)
  22527. return;
  22528. const a = o.get(n);
  22529. if (!a)
  22530. return;
  22531. const u = a.get(r);
  22532. if (!u)
  22533. return;
  22534. const c = u.get(s);
  22535. c && c.delete(i);
  22536. }
  22537. _removeCellCacheByRange(e) {
  22538. const { unitId: n, sheetId: r, range: s, id: i } = e, o = this._oneCellCache.get(n);
  22539. if (!o)
  22540. return;
  22541. const a = o.get(r);
  22542. if (!a)
  22543. return;
  22544. const { startRow: u, startColumn: c, endRow: l, endColumn: h } = s;
  22545. for (let d = u; d <= l; d++) {
  22546. const f = a.get(d);
  22547. if (f)
  22548. for (let E = c; E <= h; E++) {
  22549. const R = f.get(E);
  22550. R && R.delete(i);
  22551. }
  22552. }
  22553. }
  22554. _insertOneCellCache(e, n, r, s, i) {
  22555. this._getOneCellCache(e, n, r, s).add(i);
  22556. }
  22557. _getRdTreeItems(e) {
  22558. const n = [];
  22559. for (const [r, s] of e)
  22560. for (const [i, o] of s)
  22561. n.push({
  22562. x: i,
  22563. y: r,
  22564. ids: o
  22565. });
  22566. return n;
  22567. }
  22568. _searchByOneCellCache(e) {
  22569. var E;
  22570. const { unitId: n, sheetId: r, range: s } = e, { startRow: i, startColumn: o, endRow: a, endColumn: u } = s, c = (E = this._kdTree.get(n)) == null ? void 0 : E.get(r);
  22571. if (!c)
  22572. return [];
  22573. const { tree: l, items: h } = c, d = l.range(o, i, u, a), f = [];
  22574. for (const R of d) {
  22575. const O = h[R];
  22576. f.push(...Array.from(O.ids));
  22577. }
  22578. return f;
  22579. }
  22580. /**
  22581. * Open the kd-tree search state.
  22582. * The kd-tree is used to search for data in a single cell.
  22583. */
  22584. openKdTree() {
  22585. var e;
  22586. for (const [n, r] of this._oneCellCache) {
  22587. this._kdTree.has(n) || this._kdTree.set(n, /* @__PURE__ */ new Map());
  22588. for (const [s, i] of r) {
  22589. const o = this._getRdTreeItems(i), a = new ji(o.length);
  22590. (e = this._kdTree.get(n)) == null || e.set(s, {
  22591. tree: a,
  22592. items: o
  22593. });
  22594. for (const u of o)
  22595. a.add(u.x, u.y);
  22596. a.finish();
  22597. }
  22598. }
  22599. }
  22600. closeKdTree() {
  22601. var e;
  22602. for (const [n, r] of this._oneCellCache)
  22603. for (const [s, i] of r)
  22604. (e = this._kdTree.get(n)) == null || e.set(s, void 0);
  22605. }
  22606. insert(e) {
  22607. const { unitId: n, sheetId: r, range: s, id: i } = e;
  22608. if (!n || n.length === 0)
  22609. return;
  22610. let { startRow: o, endRow: a, startColumn: u, endColumn: c } = s;
  22611. if (this._enableOneCellCache && o === a && u === c) {
  22612. this._insertOneCellCache(n, r, o, u, i);
  22613. return;
  22614. }
  22615. const l = this.getTree(n, r);
  22616. Number.isNaN(o) && (o = 0), Number.isNaN(u) && (u = 0), Number.isNaN(a) && (a = Number.POSITIVE_INFINITY), Number.isNaN(c) && (c = Number.POSITIVE_INFINITY), l.insert({
  22617. minX: u,
  22618. minY: o,
  22619. maxX: c,
  22620. maxY: a,
  22621. id: i
  22622. });
  22623. }
  22624. bulkInsert(e) {
  22625. for (const n of e)
  22626. this.insert(n);
  22627. }
  22628. *searchGenerator(e) {
  22629. var a;
  22630. const { unitId: n, sheetId: r, range: s } = e;
  22631. if (this._enableOneCellCache) {
  22632. const u = this._searchByOneCellCache(e);
  22633. for (const c of u)
  22634. yield c;
  22635. }
  22636. const i = (a = this._tree.get(n)) == null ? void 0 : a.get(r);
  22637. if (!i)
  22638. return;
  22639. const o = i.search({
  22640. minX: s.startColumn,
  22641. minY: s.startRow,
  22642. maxX: s.endColumn,
  22643. maxY: s.endRow
  22644. });
  22645. for (const u of o)
  22646. yield u.id;
  22647. }
  22648. bulkSearch(e, n) {
  22649. const r = /* @__PURE__ */ new Set();
  22650. for (const s of e)
  22651. for (const i of this.searchGenerator(s))
  22652. (n == null ? void 0 : n.has(i)) !== true && r.add(i);
  22653. return r;
  22654. }
  22655. removeById(e, n) {
  22656. var r, s;
  22657. n ? ((r = this._tree.get(e)) == null || r.delete(n), (s = this._oneCellCache.get(e)) == null || s.delete(n)) : (this._tree.delete(e), this._oneCellCache.delete(e));
  22658. }
  22659. _removeRTreeItem(e) {
  22660. const { unitId: n, sheetId: r, range: s, id: i } = e, o = this.getTree(n, r), a = o.search({
  22661. minX: s.startColumn,
  22662. minY: s.startRow,
  22663. maxX: s.endColumn,
  22664. maxY: s.endRow
  22665. });
  22666. for (let u = 0; u < a.length; u++)
  22667. a[u].id === i && o.remove(a[u]);
  22668. }
  22669. remove(e) {
  22670. const { unitId: n, sheetId: r, range: s, id: i } = e, { startRow: o, startColumn: a, endRow: u, endColumn: c } = s;
  22671. this._enableOneCellCache ? o === u && a === c ? this._removeOneCellCache(n, r, s.startRow, s.startColumn, i) : (this._removeCellCacheByRange(e), this._removeRTreeItem(e)) : this._removeRTreeItem(e);
  22672. }
  22673. bulkRemove(e) {
  22674. for (const n of e)
  22675. this.remove(n);
  22676. }
  22677. clear() {
  22678. this._tree.clear(), this._oneCellCache.clear();
  22679. }
  22680. toJSON() {
  22681. const e = {};
  22682. return this._tree.forEach((n, r) => {
  22683. e[r] = {}, n.forEach((s, i) => {
  22684. e[r][i] = s.toJSON();
  22685. });
  22686. }), e;
  22687. }
  22688. fromJSON(e) {
  22689. this._tree.clear();
  22690. for (const n in e) {
  22691. this._tree.set(n, /* @__PURE__ */ new Map());
  22692. for (const r in e[n]) {
  22693. const s = new Aa();
  22694. s.fromJSON(e[n][r]), this._tree.get(n).set(r, s);
  22695. }
  22696. }
  22697. }
  22698. };
  22699. Hl();
  22700. export {
  22701. Subscription,
  22702. noop,
  22703. Observable,
  22704. Subject,
  22705. BehaviorSubject,
  22706. ReplaySubject,
  22707. animationFrameScheduler,
  22708. EMPTY,
  22709. of,
  22710. isObservable,
  22711. firstValueFrom,
  22712. map,
  22713. combineLatest,
  22714. fromEvent,
  22715. merge,
  22716. filter,
  22717. bufferTime,
  22718. bufferWhen,
  22719. combineLatestWith,
  22720. debounceTime,
  22721. take,
  22722. distinctUntilChanged,
  22723. first,
  22724. shareReplay,
  22725. skip,
  22726. startWith,
  22727. switchMap,
  22728. takeUntil,
  22729. tap,
  22730. throttleTime,
  22731. withLatestFrom,
  22732. b0,
  22733. S0,
  22734. A0,
  22735. nu,
  22736. N0,
  22737. ru,
  22738. cs,
  22739. T0,
  22740. M0,
  22741. D0,
  22742. x0,
  22743. L0,
  22744. su,
  22745. iu,
  22746. Hd,
  22747. Wd,
  22748. U0,
  22749. P0,
  22750. k0,
  22751. zd,
  22752. ou,
  22753. ao,
  22754. uo,
  22755. lo,
  22756. co,
  22757. ys,
  22758. at,
  22759. Ge,
  22760. $t,
  22761. Ct,
  22762. Jd,
  22763. Zd,
  22764. tf,
  22765. nf,
  22766. ot,
  22767. of2,
  22768. F0,
  22769. $0,
  22770. go,
  22771. Ot,
  22772. ds,
  22773. gu,
  22774. vf,
  22775. B0,
  22776. j0,
  22777. H0,
  22778. Af,
  22779. W0,
  22780. Tf,
  22781. z0,
  22782. Y0,
  22783. V0,
  22784. G0,
  22785. K0,
  22786. Mf,
  22787. Df,
  22788. wo,
  22789. xf,
  22790. Lf,
  22791. Uf,
  22792. Ze,
  22793. X0,
  22794. Mi,
  22795. nt,
  22796. J0,
  22797. Z0,
  22798. fs,
  22799. Ff,
  22800. $f,
  22801. Mt,
  22802. Bf,
  22803. ar,
  22804. Pt,
  22805. Yf,
  22806. Ys,
  22807. mu,
  22808. Q0,
  22809. Gf,
  22810. Kf,
  22811. q0,
  22812. eC,
  22813. tC,
  22814. Xf,
  22815. nC,
  22816. Jf,
  22817. rC,
  22818. sC,
  22819. mr,
  22820. Zf,
  22821. iC,
  22822. _u,
  22823. Xe,
  22824. Eu,
  22825. vt,
  22826. Cu,
  22827. Ru,
  22828. Iu,
  22829. vu,
  22830. yu,
  22831. wu,
  22832. oC,
  22833. Ou,
  22834. ur,
  22835. Zr,
  22836. bu,
  22837. Qf,
  22838. qf,
  22839. eg,
  22840. tg,
  22841. Su,
  22842. Au,
  22843. er,
  22844. Nu,
  22845. Xt,
  22846. hn,
  22847. xn,
  22848. Vs,
  22849. Gs,
  22850. Bt,
  22851. we,
  22852. dn,
  22853. ft,
  22854. Di,
  22855. re,
  22856. qt,
  22857. Mo,
  22858. aC,
  22859. Os,
  22860. uC,
  22861. Do,
  22862. gg,
  22863. gs,
  22864. Ln,
  22865. pg,
  22866. Ks,
  22867. Xs,
  22868. lC,
  22869. cC,
  22870. xo,
  22871. Nt,
  22872. hC,
  22873. dC,
  22874. Pe,
  22875. fC,
  22876. gC,
  22877. pC,
  22878. mC,
  22879. De,
  22880. tt,
  22881. _C,
  22882. Sg,
  22883. Ag,
  22884. EC,
  22885. zn,
  22886. Ng,
  22887. CC,
  22888. RC,
  22889. Tg,
  22890. IC,
  22891. Lt,
  22892. vC,
  22893. yC,
  22894. wC,
  22895. OC,
  22896. bC,
  22897. SC,
  22898. AC,
  22899. Lu,
  22900. Mg,
  22901. NC,
  22902. rn,
  22903. Li,
  22904. TC,
  22905. MC,
  22906. fp,
  22907. gp,
  22908. pp,
  22909. DC,
  22910. xC,
  22911. Qr,
  22912. Cr,
  22913. Op,
  22914. fn,
  22915. Vo,
  22916. Go,
  22917. LC,
  22918. UC,
  22919. Ko,
  22920. kt,
  22921. PC,
  22922. kC,
  22923. FC,
  22924. $C,
  22925. gt,
  22926. Ap,
  22927. BC,
  22928. Np,
  22929. tr,
  22930. jC,
  22931. Uu,
  22932. HC,
  22933. en,
  22934. WC,
  22935. zC,
  22936. Qo,
  22937. YC,
  22938. VC,
  22939. $p,
  22940. GC,
  22941. KC,
  22942. XC,
  22943. ps,
  22944. Bp,
  22945. jp,
  22946. Te,
  22947. ms,
  22948. mn,
  22949. An,
  22950. Hp,
  22951. ku,
  22952. Wp,
  22953. zp,
  22954. Yp,
  22955. Vp,
  22956. Gp,
  22957. Kp,
  22958. Xp,
  22959. Jp,
  22960. Zp,
  22961. Qp,
  22962. qp,
  22963. em,
  22964. tm,
  22965. nm,
  22966. rm,
  22967. sm,
  22968. im,
  22969. Yn,
  22970. om,
  22971. am,
  22972. um,
  22973. lm,
  22974. cm,
  22975. hm,
  22976. dm,
  22977. fm,
  22978. gm,
  22979. Fu,
  22980. pm,
  22981. mm,
  22982. Fe,
  22983. Ui,
  22984. JC,
  22985. ce,
  22986. _s,
  22987. Nm,
  22988. Ft,
  22989. Es,
  22990. ZC,
  22991. el,
  22992. ei,
  22993. $m,
  22994. Bm,
  22995. QC,
  22996. jm,
  22997. Dt,
  22998. qC,
  22999. Hm,
  23000. Wm,
  23001. ha,
  23002. Bn,
  23003. lr,
  23004. Km,
  23005. Xm,
  23006. Ke,
  23007. tn,
  23008. tl,
  23009. jt,
  23010. O_,
  23011. ln,
  23012. eR,
  23013. st,
  23014. cr,
  23015. Qt,
  23016. Jt,
  23017. hr,
  23018. nr,
  23019. Zt,
  23020. gn,
  23021. tR,
  23022. Vn,
  23023. nR,
  23024. x_,
  23025. rR,
  23026. sR,
  23027. iR,
  23028. oR,
  23029. Fi,
  23030. al,
  23031. $i,
  23032. ul,
  23033. k_,
  23034. aR,
  23035. uR,
  23036. Sr,
  23037. B_,
  23038. j_,
  23039. lR,
  23040. V_,
  23041. cR,
  23042. G_,
  23043. hR,
  23044. K_,
  23045. dR,
  23046. X_,
  23047. fR,
  23048. J_,
  23049. gR,
  23050. Z_,
  23051. Q_,
  23052. eE,
  23053. es,
  23054. tE,
  23055. pR,
  23056. mR,
  23057. ts,
  23058. cl,
  23059. Ar,
  23060. Gn,
  23061. Nr,
  23062. Tr,
  23063. _R,
  23064. oE,
  23065. ER,
  23066. aE,
  23067. CR,
  23068. RR,
  23069. IR,
  23070. vR,
  23071. yR,
  23072. wR,
  23073. _n,
  23074. ni,
  23075. Ve,
  23076. Ht,
  23077. cn,
  23078. RE,
  23079. IE,
  23080. Nn,
  23081. Tn,
  23082. ri,
  23083. Bi,
  23084. ii,
  23085. rr,
  23086. oi,
  23087. bE,
  23088. SE,
  23089. AE,
  23090. NE,
  23091. Vr,
  23092. ai,
  23093. LE,
  23094. fl,
  23095. UE,
  23096. PE,
  23097. kE,
  23098. Ra,
  23099. OR,
  23100. ns,
  23101. va,
  23102. VE,
  23103. ml,
  23104. GE,
  23105. ss,
  23106. _l,
  23107. El,
  23108. Cl,
  23109. Rl,
  23110. Il,
  23111. ci,
  23112. hi,
  23113. di,
  23114. gi,
  23115. pi,
  23116. d0,
  23117. bR,
  23118. SR,
  23119. AR,
  23120. NR,
  23121. TR,
  23122. f0,
  23123. MR,
  23124. DR,
  23125. xR,
  23126. LR,
  23127. UR,
  23128. PR,
  23129. vl,
  23130. g0,
  23131. Oa,
  23132. kR,
  23133. FR,
  23134. p0,
  23135. Aa,
  23136. $R
  23137. };
  23138. //# sourceMappingURL=chunk-23V3HWTR.js.map