123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259 |
- import {
- require_react
- } from "./chunk-GNR2UJZM.js";
- import {
- __toESM
- } from "./chunk-2LSFTFF7.js";
- // node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
- var extendStatics = function(d, b) {
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
- d2.__proto__ = b2;
- } || function(d2, b2) {
- for (var p in b2)
- if (Object.prototype.hasOwnProperty.call(b2, p))
- d2[p] = b2[p];
- };
- return extendStatics(d, b);
- };
- function __extends(d, b) {
- if (typeof b !== "function" && b !== null)
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- extendStatics(d, b);
- function __2() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__2.prototype = b.prototype, new __2());
- }
- function __awaiter(thisArg, _arguments, P, generator) {
- function adopt(value) {
- return value instanceof P ? value : new P(function(resolve) {
- resolve(value);
- });
- }
- return new (P || (P = Promise))(function(resolve, reject) {
- function fulfilled(value) {
- try {
- step(generator.next(value));
- } catch (e) {
- reject(e);
- }
- }
- function rejected(value) {
- try {
- step(generator["throw"](value));
- } catch (e) {
- reject(e);
- }
- }
- function step(result) {
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
- }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- }
- function __generator(thisArg, body) {
- var _ = { label: 0, sent: function() {
- if (t[0] & 1)
- throw t[1];
- return t[1];
- }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
- return this;
- }), g;
- function verb(n) {
- return function(v) {
- return step([n, v]);
- };
- }
- function step(op2) {
- if (f)
- throw new TypeError("Generator is already executing.");
- while (g && (g = 0, op2[0] && (_ = 0)), _)
- try {
- 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)
- return t;
- if (y = 0, t)
- op2 = [op2[0] & 2, t.value];
- switch (op2[0]) {
- case 0:
- case 1:
- t = op2;
- break;
- case 4:
- _.label++;
- return { value: op2[1], done: false };
- case 5:
- _.label++;
- y = op2[1];
- op2 = [0];
- continue;
- case 7:
- op2 = _.ops.pop();
- _.trys.pop();
- continue;
- default:
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op2[0] === 6 || op2[0] === 2)) {
- _ = 0;
- continue;
- }
- if (op2[0] === 3 && (!t || op2[1] > t[0] && op2[1] < t[3])) {
- _.label = op2[1];
- break;
- }
- if (op2[0] === 6 && _.label < t[1]) {
- _.label = t[1];
- t = op2;
- break;
- }
- if (t && _.label < t[2]) {
- _.label = t[2];
- _.ops.push(op2);
- break;
- }
- if (t[2])
- _.ops.pop();
- _.trys.pop();
- continue;
- }
- op2 = body.call(thisArg, _);
- } catch (e) {
- op2 = [6, e];
- y = 0;
- } finally {
- f = t = 0;
- }
- if (op2[0] & 5)
- throw op2[1];
- return { value: op2[0] ? op2[1] : void 0, done: true };
- }
- }
- function __values(o) {
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
- if (m)
- return m.call(o);
- if (o && typeof o.length === "number")
- return {
- next: function() {
- if (o && i >= o.length)
- o = void 0;
- return { value: o && o[i++], done: !o };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- }
- function __read(o, n) {
- var m = typeof Symbol === "function" && o[Symbol.iterator];
- if (!m)
- return o;
- var i = m.call(o), r, ar2 = [], e;
- try {
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
- ar2.push(r.value);
- } catch (error) {
- e = { error };
- } finally {
- try {
- if (r && !r.done && (m = i["return"]))
- m.call(i);
- } finally {
- if (e)
- throw e.error;
- }
- }
- return ar2;
- }
- function __spreadArray(to2, from2, pack) {
- if (pack || arguments.length === 2)
- for (var i = 0, l = from2.length, ar2; i < l; i++) {
- if (ar2 || !(i in from2)) {
- if (!ar2)
- ar2 = Array.prototype.slice.call(from2, 0, i);
- ar2[i] = from2[i];
- }
- }
- return to2.concat(ar2 || Array.prototype.slice.call(from2));
- }
- function __await(v) {
- return this instanceof __await ? (this.v = v, this) : new __await(v);
- }
- function __asyncGenerator(thisArg, _arguments, generator) {
- if (!Symbol.asyncIterator)
- throw new TypeError("Symbol.asyncIterator is not defined.");
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
- return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
- return this;
- }, i;
- function awaitReturn(f) {
- return function(v) {
- return Promise.resolve(v).then(f, reject);
- };
- }
- function verb(n, f) {
- if (g[n]) {
- i[n] = function(v) {
- return new Promise(function(a, b) {
- q.push([n, v, a, b]) > 1 || resume(n, v);
- });
- };
- if (f)
- i[n] = f(i[n]);
- }
- }
- function resume(n, v) {
- try {
- step(g[n](v));
- } catch (e) {
- settle(q[0][3], e);
- }
- }
- function step(r) {
- r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
- }
- function fulfill(value) {
- resume("next", value);
- }
- function reject(value) {
- resume("throw", value);
- }
- function settle(f, v) {
- if (f(v), q.shift(), q.length)
- resume(q[0][0], q[0][1]);
- }
- }
- function __asyncValues(o) {
- if (!Symbol.asyncIterator)
- throw new TypeError("Symbol.asyncIterator is not defined.");
- var m = o[Symbol.asyncIterator], i;
- 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() {
- return this;
- }, i);
- function verb(n) {
- i[n] = o[n] && function(v) {
- return new Promise(function(resolve, reject) {
- v = o[n](v), settle(resolve, reject, v.done, v.value);
- });
- };
- }
- function settle(resolve, reject, d, v) {
- Promise.resolve(v).then(function(v2) {
- resolve({ value: v2, done: d });
- }, reject);
- }
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isFunction.js
- function isFunction(value) {
- return typeof value === "function";
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js
- function createErrorClass(createImpl) {
- var _super = function(instance) {
- Error.call(instance);
- instance.stack = new Error().stack;
- };
- var ctorFunc = createImpl(_super);
- ctorFunc.prototype = Object.create(Error.prototype);
- ctorFunc.prototype.constructor = ctorFunc;
- return ctorFunc;
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js
- var UnsubscriptionError = createErrorClass(function(_super) {
- return function UnsubscriptionErrorImpl(errors) {
- _super(this);
- this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(err, i) {
- return i + 1 + ") " + err.toString();
- }).join("\n ") : "";
- this.name = "UnsubscriptionError";
- this.errors = errors;
- };
- });
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js
- function arrRemove(arr, item) {
- if (arr) {
- var index = arr.indexOf(item);
- 0 <= index && arr.splice(index, 1);
- }
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Subscription.js
- var Subscription = function() {
- function Subscription2(initialTeardown) {
- this.initialTeardown = initialTeardown;
- this.closed = false;
- this._parentage = null;
- this._finalizers = null;
- }
- Subscription2.prototype.unsubscribe = function() {
- var e_1, _a2, e_2, _b;
- var errors;
- if (!this.closed) {
- this.closed = true;
- var _parentage = this._parentage;
- if (_parentage) {
- this._parentage = null;
- if (Array.isArray(_parentage)) {
- try {
- for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
- var parent_1 = _parentage_1_1.value;
- parent_1.remove(this);
- }
- } catch (e_1_1) {
- e_1 = { error: e_1_1 };
- } finally {
- try {
- if (_parentage_1_1 && !_parentage_1_1.done && (_a2 = _parentage_1.return))
- _a2.call(_parentage_1);
- } finally {
- if (e_1)
- throw e_1.error;
- }
- }
- } else {
- _parentage.remove(this);
- }
- }
- var initialFinalizer = this.initialTeardown;
- if (isFunction(initialFinalizer)) {
- try {
- initialFinalizer();
- } catch (e) {
- errors = e instanceof UnsubscriptionError ? e.errors : [e];
- }
- }
- var _finalizers = this._finalizers;
- if (_finalizers) {
- this._finalizers = null;
- try {
- for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
- var finalizer = _finalizers_1_1.value;
- try {
- execFinalizer(finalizer);
- } catch (err) {
- errors = errors !== null && errors !== void 0 ? errors : [];
- if (err instanceof UnsubscriptionError) {
- errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
- } else {
- errors.push(err);
- }
- }
- }
- } catch (e_2_1) {
- e_2 = { error: e_2_1 };
- } finally {
- try {
- if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return))
- _b.call(_finalizers_1);
- } finally {
- if (e_2)
- throw e_2.error;
- }
- }
- }
- if (errors) {
- throw new UnsubscriptionError(errors);
- }
- }
- };
- Subscription2.prototype.add = function(teardown) {
- var _a2;
- if (teardown && teardown !== this) {
- if (this.closed) {
- execFinalizer(teardown);
- } else {
- if (teardown instanceof Subscription2) {
- if (teardown.closed || teardown._hasParent(this)) {
- return;
- }
- teardown._addParent(this);
- }
- (this._finalizers = (_a2 = this._finalizers) !== null && _a2 !== void 0 ? _a2 : []).push(teardown);
- }
- }
- };
- Subscription2.prototype._hasParent = function(parent) {
- var _parentage = this._parentage;
- return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent);
- };
- Subscription2.prototype._addParent = function(parent) {
- var _parentage = this._parentage;
- this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
- };
- Subscription2.prototype._removeParent = function(parent) {
- var _parentage = this._parentage;
- if (_parentage === parent) {
- this._parentage = null;
- } else if (Array.isArray(_parentage)) {
- arrRemove(_parentage, parent);
- }
- };
- Subscription2.prototype.remove = function(teardown) {
- var _finalizers = this._finalizers;
- _finalizers && arrRemove(_finalizers, teardown);
- if (teardown instanceof Subscription2) {
- teardown._removeParent(this);
- }
- };
- Subscription2.EMPTY = function() {
- var empty2 = new Subscription2();
- empty2.closed = true;
- return empty2;
- }();
- return Subscription2;
- }();
- var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
- function isSubscription(value) {
- return value instanceof Subscription || value && "closed" in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe);
- }
- function execFinalizer(finalizer) {
- if (isFunction(finalizer)) {
- finalizer();
- } else {
- finalizer.unsubscribe();
- }
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/config.js
- var config = {
- onUnhandledError: null,
- onStoppedNotification: null,
- Promise: void 0,
- useDeprecatedSynchronousErrorHandling: false,
- useDeprecatedNextContext: false
- };
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js
- var timeoutProvider = {
- setTimeout: function(handler, timeout2) {
- var args = [];
- for (var _i2 = 2; _i2 < arguments.length; _i2++) {
- args[_i2 - 2] = arguments[_i2];
- }
- var delegate = timeoutProvider.delegate;
- if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
- return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout2], __read(args)));
- }
- return setTimeout.apply(void 0, __spreadArray([handler, timeout2], __read(args)));
- },
- clearTimeout: function(handle) {
- var delegate = timeoutProvider.delegate;
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
- },
- delegate: void 0
- };
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js
- function reportUnhandledError(err) {
- timeoutProvider.setTimeout(function() {
- var onUnhandledError = config.onUnhandledError;
- if (onUnhandledError) {
- onUnhandledError(err);
- } else {
- throw err;
- }
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/noop.js
- function noop() {
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js
- var COMPLETE_NOTIFICATION = function() {
- return createNotification("C", void 0, void 0);
- }();
- function errorNotification(error) {
- return createNotification("E", void 0, error);
- }
- function nextNotification(value) {
- return createNotification("N", value, void 0);
- }
- function createNotification(kind, value, error) {
- return {
- kind,
- value,
- error
- };
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/errorContext.js
- var context = null;
- function errorContext(cb) {
- if (config.useDeprecatedSynchronousErrorHandling) {
- var isRoot = !context;
- if (isRoot) {
- context = { errorThrown: false, error: null };
- }
- cb();
- if (isRoot) {
- var _a2 = context, errorThrown = _a2.errorThrown, error = _a2.error;
- context = null;
- if (errorThrown) {
- throw error;
- }
- }
- } else {
- cb();
- }
- }
- function captureError(err) {
- if (config.useDeprecatedSynchronousErrorHandling && context) {
- context.errorThrown = true;
- context.error = err;
- }
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Subscriber.js
- var Subscriber = function(_super) {
- __extends(Subscriber2, _super);
- function Subscriber2(destination) {
- var _this = _super.call(this) || this;
- _this.isStopped = false;
- if (destination) {
- _this.destination = destination;
- if (isSubscription(destination)) {
- destination.add(_this);
- }
- } else {
- _this.destination = EMPTY_OBSERVER;
- }
- return _this;
- }
- Subscriber2.create = function(next, error, complete) {
- return new SafeSubscriber(next, error, complete);
- };
- Subscriber2.prototype.next = function(value) {
- if (this.isStopped) {
- handleStoppedNotification(nextNotification(value), this);
- } else {
- this._next(value);
- }
- };
- Subscriber2.prototype.error = function(err) {
- if (this.isStopped) {
- handleStoppedNotification(errorNotification(err), this);
- } else {
- this.isStopped = true;
- this._error(err);
- }
- };
- Subscriber2.prototype.complete = function() {
- if (this.isStopped) {
- handleStoppedNotification(COMPLETE_NOTIFICATION, this);
- } else {
- this.isStopped = true;
- this._complete();
- }
- };
- Subscriber2.prototype.unsubscribe = function() {
- if (!this.closed) {
- this.isStopped = true;
- _super.prototype.unsubscribe.call(this);
- this.destination = null;
- }
- };
- Subscriber2.prototype._next = function(value) {
- this.destination.next(value);
- };
- Subscriber2.prototype._error = function(err) {
- try {
- this.destination.error(err);
- } finally {
- this.unsubscribe();
- }
- };
- Subscriber2.prototype._complete = function() {
- try {
- this.destination.complete();
- } finally {
- this.unsubscribe();
- }
- };
- return Subscriber2;
- }(Subscription);
- var _bind = Function.prototype.bind;
- function bind(fn2, thisArg) {
- return _bind.call(fn2, thisArg);
- }
- var ConsumerObserver = function() {
- function ConsumerObserver2(partialObserver) {
- this.partialObserver = partialObserver;
- }
- ConsumerObserver2.prototype.next = function(value) {
- var partialObserver = this.partialObserver;
- if (partialObserver.next) {
- try {
- partialObserver.next(value);
- } catch (error) {
- handleUnhandledError(error);
- }
- }
- };
- ConsumerObserver2.prototype.error = function(err) {
- var partialObserver = this.partialObserver;
- if (partialObserver.error) {
- try {
- partialObserver.error(err);
- } catch (error) {
- handleUnhandledError(error);
- }
- } else {
- handleUnhandledError(err);
- }
- };
- ConsumerObserver2.prototype.complete = function() {
- var partialObserver = this.partialObserver;
- if (partialObserver.complete) {
- try {
- partialObserver.complete();
- } catch (error) {
- handleUnhandledError(error);
- }
- }
- };
- return ConsumerObserver2;
- }();
- var SafeSubscriber = function(_super) {
- __extends(SafeSubscriber2, _super);
- function SafeSubscriber2(observerOrNext, error, complete) {
- var _this = _super.call(this) || this;
- var partialObserver;
- if (isFunction(observerOrNext) || !observerOrNext) {
- partialObserver = {
- next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0,
- error: error !== null && error !== void 0 ? error : void 0,
- complete: complete !== null && complete !== void 0 ? complete : void 0
- };
- } else {
- var context_1;
- if (_this && config.useDeprecatedNextContext) {
- context_1 = Object.create(observerOrNext);
- context_1.unsubscribe = function() {
- return _this.unsubscribe();
- };
- partialObserver = {
- next: observerOrNext.next && bind(observerOrNext.next, context_1),
- error: observerOrNext.error && bind(observerOrNext.error, context_1),
- complete: observerOrNext.complete && bind(observerOrNext.complete, context_1)
- };
- } else {
- partialObserver = observerOrNext;
- }
- }
- _this.destination = new ConsumerObserver(partialObserver);
- return _this;
- }
- return SafeSubscriber2;
- }(Subscriber);
- function handleUnhandledError(error) {
- if (config.useDeprecatedSynchronousErrorHandling) {
- captureError(error);
- } else {
- reportUnhandledError(error);
- }
- }
- function defaultErrorHandler(err) {
- throw err;
- }
- function handleStoppedNotification(notification, subscriber) {
- var onStoppedNotification = config.onStoppedNotification;
- onStoppedNotification && timeoutProvider.setTimeout(function() {
- return onStoppedNotification(notification, subscriber);
- });
- }
- var EMPTY_OBSERVER = {
- closed: true,
- next: noop,
- error: defaultErrorHandler,
- complete: noop
- };
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/symbol/observable.js
- var observable = function() {
- return typeof Symbol === "function" && Symbol.observable || "@@observable";
- }();
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/identity.js
- function identity(x) {
- return x;
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/pipe.js
- function pipe() {
- var fns = [];
- for (var _i2 = 0; _i2 < arguments.length; _i2++) {
- fns[_i2] = arguments[_i2];
- }
- return pipeFromArray(fns);
- }
- function pipeFromArray(fns) {
- if (fns.length === 0) {
- return identity;
- }
- if (fns.length === 1) {
- return fns[0];
- }
- return function piped(input) {
- return fns.reduce(function(prev, fn2) {
- return fn2(prev);
- }, input);
- };
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Observable.js
- var Observable = function() {
- function Observable2(subscribe) {
- if (subscribe) {
- this._subscribe = subscribe;
- }
- }
- Observable2.prototype.lift = function(operator) {
- var observable2 = new Observable2();
- observable2.source = this;
- observable2.operator = operator;
- return observable2;
- };
- Observable2.prototype.subscribe = function(observerOrNext, error, complete) {
- var _this = this;
- var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
- errorContext(function() {
- var _a2 = _this, operator = _a2.operator, source = _a2.source;
- subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber));
- });
- return subscriber;
- };
- Observable2.prototype._trySubscribe = function(sink) {
- try {
- return this._subscribe(sink);
- } catch (err) {
- sink.error(err);
- }
- };
- Observable2.prototype.forEach = function(next, promiseCtor) {
- var _this = this;
- promiseCtor = getPromiseCtor(promiseCtor);
- return new promiseCtor(function(resolve, reject) {
- var subscriber = new SafeSubscriber({
- next: function(value) {
- try {
- next(value);
- } catch (err) {
- reject(err);
- subscriber.unsubscribe();
- }
- },
- error: reject,
- complete: resolve
- });
- _this.subscribe(subscriber);
- });
- };
- Observable2.prototype._subscribe = function(subscriber) {
- var _a2;
- return (_a2 = this.source) === null || _a2 === void 0 ? void 0 : _a2.subscribe(subscriber);
- };
- Observable2.prototype[observable] = function() {
- return this;
- };
- Observable2.prototype.pipe = function() {
- var operations = [];
- for (var _i2 = 0; _i2 < arguments.length; _i2++) {
- operations[_i2] = arguments[_i2];
- }
- return pipeFromArray(operations)(this);
- };
- Observable2.prototype.toPromise = function(promiseCtor) {
- var _this = this;
- promiseCtor = getPromiseCtor(promiseCtor);
- return new promiseCtor(function(resolve, reject) {
- var value;
- _this.subscribe(function(x) {
- return value = x;
- }, function(err) {
- return reject(err);
- }, function() {
- return resolve(value);
- });
- });
- };
- Observable2.create = function(subscribe) {
- return new Observable2(subscribe);
- };
- return Observable2;
- }();
- function getPromiseCtor(promiseCtor) {
- var _a2;
- return (_a2 = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a2 !== void 0 ? _a2 : Promise;
- }
- function isObserver(value) {
- return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
- }
- function isSubscriber(value) {
- return value && value instanceof Subscriber || isObserver(value) && isSubscription(value);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/lift.js
- function hasLift(source) {
- return isFunction(source === null || source === void 0 ? void 0 : source.lift);
- }
- function operate(init) {
- return function(source) {
- if (hasLift(source)) {
- return source.lift(function(liftedSource) {
- try {
- return init(liftedSource, this);
- } catch (err) {
- this.error(err);
- }
- });
- }
- throw new TypeError("Unable to lift unknown Observable type");
- };
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js
- function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
- return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
- }
- var OperatorSubscriber = function(_super) {
- __extends(OperatorSubscriber2, _super);
- function OperatorSubscriber2(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
- var _this = _super.call(this, destination) || this;
- _this.onFinalize = onFinalize;
- _this.shouldUnsubscribe = shouldUnsubscribe;
- _this._next = onNext ? function(value) {
- try {
- onNext(value);
- } catch (err) {
- destination.error(err);
- }
- } : _super.prototype._next;
- _this._error = onError ? function(err) {
- try {
- onError(err);
- } catch (err2) {
- destination.error(err2);
- } finally {
- this.unsubscribe();
- }
- } : _super.prototype._error;
- _this._complete = onComplete ? function() {
- try {
- onComplete();
- } catch (err) {
- destination.error(err);
- } finally {
- this.unsubscribe();
- }
- } : _super.prototype._complete;
- return _this;
- }
- OperatorSubscriber2.prototype.unsubscribe = function() {
- var _a2;
- if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
- var closed_1 = this.closed;
- _super.prototype.unsubscribe.call(this);
- !closed_1 && ((_a2 = this.onFinalize) === null || _a2 === void 0 ? void 0 : _a2.call(this));
- }
- };
- return OperatorSubscriber2;
- }(Subscriber);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/refCount.js
- function refCount() {
- return operate(function(source, subscriber) {
- var connection = null;
- source._refCount++;
- var refCounter = createOperatorSubscriber(subscriber, void 0, void 0, void 0, function() {
- if (!source || source._refCount <= 0 || 0 < --source._refCount) {
- connection = null;
- return;
- }
- var sharedConnection = source._connection;
- var conn = connection;
- connection = null;
- if (sharedConnection && (!conn || sharedConnection === conn)) {
- sharedConnection.unsubscribe();
- }
- subscriber.unsubscribe();
- });
- source.subscribe(refCounter);
- if (!refCounter.closed) {
- connection = source.connect();
- }
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/ConnectableObservable.js
- var ConnectableObservable = function(_super) {
- __extends(ConnectableObservable2, _super);
- function ConnectableObservable2(source, subjectFactory) {
- var _this = _super.call(this) || this;
- _this.source = source;
- _this.subjectFactory = subjectFactory;
- _this._subject = null;
- _this._refCount = 0;
- _this._connection = null;
- if (hasLift(source)) {
- _this.lift = source.lift;
- }
- return _this;
- }
- ConnectableObservable2.prototype._subscribe = function(subscriber) {
- return this.getSubject().subscribe(subscriber);
- };
- ConnectableObservable2.prototype.getSubject = function() {
- var subject = this._subject;
- if (!subject || subject.isStopped) {
- this._subject = this.subjectFactory();
- }
- return this._subject;
- };
- ConnectableObservable2.prototype._teardown = function() {
- this._refCount = 0;
- var _connection = this._connection;
- this._subject = this._connection = null;
- _connection === null || _connection === void 0 ? void 0 : _connection.unsubscribe();
- };
- ConnectableObservable2.prototype.connect = function() {
- var _this = this;
- var connection = this._connection;
- if (!connection) {
- connection = this._connection = new Subscription();
- var subject_1 = this.getSubject();
- connection.add(this.source.subscribe(createOperatorSubscriber(subject_1, void 0, function() {
- _this._teardown();
- subject_1.complete();
- }, function(err) {
- _this._teardown();
- subject_1.error(err);
- }, function() {
- return _this._teardown();
- })));
- if (connection.closed) {
- this._connection = null;
- connection = Subscription.EMPTY;
- }
- }
- return connection;
- };
- ConnectableObservable2.prototype.refCount = function() {
- return refCount()(this);
- };
- return ConnectableObservable2;
- }(Observable);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/performanceTimestampProvider.js
- var performanceTimestampProvider = {
- now: function() {
- return (performanceTimestampProvider.delegate || performance).now();
- },
- delegate: void 0
- };
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/animationFrameProvider.js
- var animationFrameProvider = {
- schedule: function(callback) {
- var request = requestAnimationFrame;
- var cancel = cancelAnimationFrame;
- var delegate = animationFrameProvider.delegate;
- if (delegate) {
- request = delegate.requestAnimationFrame;
- cancel = delegate.cancelAnimationFrame;
- }
- var handle = request(function(timestamp2) {
- cancel = void 0;
- callback(timestamp2);
- });
- return new Subscription(function() {
- return cancel === null || cancel === void 0 ? void 0 : cancel(handle);
- });
- },
- requestAnimationFrame: function() {
- var args = [];
- for (var _i2 = 0; _i2 < arguments.length; _i2++) {
- args[_i2] = arguments[_i2];
- }
- var delegate = animationFrameProvider.delegate;
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.requestAnimationFrame) || requestAnimationFrame).apply(void 0, __spreadArray([], __read(args)));
- },
- cancelAnimationFrame: function() {
- var args = [];
- for (var _i2 = 0; _i2 < arguments.length; _i2++) {
- args[_i2] = arguments[_i2];
- }
- var delegate = animationFrameProvider.delegate;
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.cancelAnimationFrame) || cancelAnimationFrame).apply(void 0, __spreadArray([], __read(args)));
- },
- delegate: void 0
- };
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/dom/animationFrames.js
- function animationFramesFactory(timestampProvider) {
- return new Observable(function(subscriber) {
- var provider = timestampProvider || performanceTimestampProvider;
- var start = provider.now();
- var id2 = 0;
- var run = function() {
- if (!subscriber.closed) {
- id2 = animationFrameProvider.requestAnimationFrame(function(timestamp2) {
- id2 = 0;
- var now = provider.now();
- subscriber.next({
- timestamp: timestampProvider ? now : timestamp2,
- elapsed: now - start
- });
- run();
- });
- }
- };
- run();
- return function() {
- if (id2) {
- animationFrameProvider.cancelAnimationFrame(id2);
- }
- };
- });
- }
- var DEFAULT_ANIMATION_FRAMES = animationFramesFactory();
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/ObjectUnsubscribedError.js
- var ObjectUnsubscribedError = createErrorClass(function(_super) {
- return function ObjectUnsubscribedErrorImpl() {
- _super(this);
- this.name = "ObjectUnsubscribedError";
- this.message = "object unsubscribed";
- };
- });
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Subject.js
- var Subject = function(_super) {
- __extends(Subject2, _super);
- function Subject2() {
- var _this = _super.call(this) || this;
- _this.closed = false;
- _this.currentObservers = null;
- _this.observers = [];
- _this.isStopped = false;
- _this.hasError = false;
- _this.thrownError = null;
- return _this;
- }
- Subject2.prototype.lift = function(operator) {
- var subject = new AnonymousSubject(this, this);
- subject.operator = operator;
- return subject;
- };
- Subject2.prototype._throwIfClosed = function() {
- if (this.closed) {
- throw new ObjectUnsubscribedError();
- }
- };
- Subject2.prototype.next = function(value) {
- var _this = this;
- errorContext(function() {
- var e_1, _a2;
- _this._throwIfClosed();
- if (!_this.isStopped) {
- if (!_this.currentObservers) {
- _this.currentObservers = Array.from(_this.observers);
- }
- try {
- for (var _b = __values(_this.currentObservers), _c2 = _b.next(); !_c2.done; _c2 = _b.next()) {
- var observer = _c2.value;
- observer.next(value);
- }
- } catch (e_1_1) {
- e_1 = { error: e_1_1 };
- } finally {
- try {
- if (_c2 && !_c2.done && (_a2 = _b.return))
- _a2.call(_b);
- } finally {
- if (e_1)
- throw e_1.error;
- }
- }
- }
- });
- };
- Subject2.prototype.error = function(err) {
- var _this = this;
- errorContext(function() {
- _this._throwIfClosed();
- if (!_this.isStopped) {
- _this.hasError = _this.isStopped = true;
- _this.thrownError = err;
- var observers = _this.observers;
- while (observers.length) {
- observers.shift().error(err);
- }
- }
- });
- };
- Subject2.prototype.complete = function() {
- var _this = this;
- errorContext(function() {
- _this._throwIfClosed();
- if (!_this.isStopped) {
- _this.isStopped = true;
- var observers = _this.observers;
- while (observers.length) {
- observers.shift().complete();
- }
- }
- });
- };
- Subject2.prototype.unsubscribe = function() {
- this.isStopped = this.closed = true;
- this.observers = this.currentObservers = null;
- };
- Object.defineProperty(Subject2.prototype, "observed", {
- get: function() {
- var _a2;
- return ((_a2 = this.observers) === null || _a2 === void 0 ? void 0 : _a2.length) > 0;
- },
- enumerable: false,
- configurable: true
- });
- Subject2.prototype._trySubscribe = function(subscriber) {
- this._throwIfClosed();
- return _super.prototype._trySubscribe.call(this, subscriber);
- };
- Subject2.prototype._subscribe = function(subscriber) {
- this._throwIfClosed();
- this._checkFinalizedStatuses(subscriber);
- return this._innerSubscribe(subscriber);
- };
- Subject2.prototype._innerSubscribe = function(subscriber) {
- var _this = this;
- var _a2 = this, hasError = _a2.hasError, isStopped = _a2.isStopped, observers = _a2.observers;
- if (hasError || isStopped) {
- return EMPTY_SUBSCRIPTION;
- }
- this.currentObservers = null;
- observers.push(subscriber);
- return new Subscription(function() {
- _this.currentObservers = null;
- arrRemove(observers, subscriber);
- });
- };
- Subject2.prototype._checkFinalizedStatuses = function(subscriber) {
- var _a2 = this, hasError = _a2.hasError, thrownError = _a2.thrownError, isStopped = _a2.isStopped;
- if (hasError) {
- subscriber.error(thrownError);
- } else if (isStopped) {
- subscriber.complete();
- }
- };
- Subject2.prototype.asObservable = function() {
- var observable2 = new Observable();
- observable2.source = this;
- return observable2;
- };
- Subject2.create = function(destination, source) {
- return new AnonymousSubject(destination, source);
- };
- return Subject2;
- }(Observable);
- var AnonymousSubject = function(_super) {
- __extends(AnonymousSubject2, _super);
- function AnonymousSubject2(destination, source) {
- var _this = _super.call(this) || this;
- _this.destination = destination;
- _this.source = source;
- return _this;
- }
- AnonymousSubject2.prototype.next = function(value) {
- var _a2, _b;
- (_b = (_a2 = this.destination) === null || _a2 === void 0 ? void 0 : _a2.next) === null || _b === void 0 ? void 0 : _b.call(_a2, value);
- };
- AnonymousSubject2.prototype.error = function(err) {
- var _a2, _b;
- (_b = (_a2 = this.destination) === null || _a2 === void 0 ? void 0 : _a2.error) === null || _b === void 0 ? void 0 : _b.call(_a2, err);
- };
- AnonymousSubject2.prototype.complete = function() {
- var _a2, _b;
- (_b = (_a2 = this.destination) === null || _a2 === void 0 ? void 0 : _a2.complete) === null || _b === void 0 ? void 0 : _b.call(_a2);
- };
- AnonymousSubject2.prototype._subscribe = function(subscriber) {
- var _a2, _b;
- return (_b = (_a2 = this.source) === null || _a2 === void 0 ? void 0 : _a2.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
- };
- return AnonymousSubject2;
- }(Subject);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/BehaviorSubject.js
- var BehaviorSubject = function(_super) {
- __extends(BehaviorSubject2, _super);
- function BehaviorSubject2(_value) {
- var _this = _super.call(this) || this;
- _this._value = _value;
- return _this;
- }
- Object.defineProperty(BehaviorSubject2.prototype, "value", {
- get: function() {
- return this.getValue();
- },
- enumerable: false,
- configurable: true
- });
- BehaviorSubject2.prototype._subscribe = function(subscriber) {
- var subscription = _super.prototype._subscribe.call(this, subscriber);
- !subscription.closed && subscriber.next(this._value);
- return subscription;
- };
- BehaviorSubject2.prototype.getValue = function() {
- var _a2 = this, hasError = _a2.hasError, thrownError = _a2.thrownError, _value = _a2._value;
- if (hasError) {
- throw thrownError;
- }
- this._throwIfClosed();
- return _value;
- };
- BehaviorSubject2.prototype.next = function(value) {
- _super.prototype.next.call(this, this._value = value);
- };
- return BehaviorSubject2;
- }(Subject);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/dateTimestampProvider.js
- var dateTimestampProvider = {
- now: function() {
- return (dateTimestampProvider.delegate || Date).now();
- },
- delegate: void 0
- };
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/ReplaySubject.js
- var ReplaySubject = function(_super) {
- __extends(ReplaySubject2, _super);
- function ReplaySubject2(_bufferSize, _windowTime, _timestampProvider) {
- if (_bufferSize === void 0) {
- _bufferSize = Infinity;
- }
- if (_windowTime === void 0) {
- _windowTime = Infinity;
- }
- if (_timestampProvider === void 0) {
- _timestampProvider = dateTimestampProvider;
- }
- var _this = _super.call(this) || this;
- _this._bufferSize = _bufferSize;
- _this._windowTime = _windowTime;
- _this._timestampProvider = _timestampProvider;
- _this._buffer = [];
- _this._infiniteTimeWindow = true;
- _this._infiniteTimeWindow = _windowTime === Infinity;
- _this._bufferSize = Math.max(1, _bufferSize);
- _this._windowTime = Math.max(1, _windowTime);
- return _this;
- }
- ReplaySubject2.prototype.next = function(value) {
- var _a2 = this, isStopped = _a2.isStopped, _buffer = _a2._buffer, _infiniteTimeWindow = _a2._infiniteTimeWindow, _timestampProvider = _a2._timestampProvider, _windowTime = _a2._windowTime;
- if (!isStopped) {
- _buffer.push(value);
- !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);
- }
- this._trimBuffer();
- _super.prototype.next.call(this, value);
- };
- ReplaySubject2.prototype._subscribe = function(subscriber) {
- this._throwIfClosed();
- this._trimBuffer();
- var subscription = this._innerSubscribe(subscriber);
- var _a2 = this, _infiniteTimeWindow = _a2._infiniteTimeWindow, _buffer = _a2._buffer;
- var copy = _buffer.slice();
- for (var i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {
- subscriber.next(copy[i]);
- }
- this._checkFinalizedStatuses(subscriber);
- return subscription;
- };
- ReplaySubject2.prototype._trimBuffer = function() {
- var _a2 = this, _bufferSize = _a2._bufferSize, _timestampProvider = _a2._timestampProvider, _buffer = _a2._buffer, _infiniteTimeWindow = _a2._infiniteTimeWindow;
- var adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;
- _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);
- if (!_infiniteTimeWindow) {
- var now = _timestampProvider.now();
- var last3 = 0;
- for (var i = 1; i < _buffer.length && _buffer[i] <= now; i += 2) {
- last3 = i;
- }
- last3 && _buffer.splice(0, last3 + 1);
- }
- };
- return ReplaySubject2;
- }(Subject);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/AsyncSubject.js
- var AsyncSubject = function(_super) {
- __extends(AsyncSubject2, _super);
- function AsyncSubject2() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this._value = null;
- _this._hasValue = false;
- _this._isComplete = false;
- return _this;
- }
- AsyncSubject2.prototype._checkFinalizedStatuses = function(subscriber) {
- var _a2 = this, hasError = _a2.hasError, _hasValue = _a2._hasValue, _value = _a2._value, thrownError = _a2.thrownError, isStopped = _a2.isStopped, _isComplete = _a2._isComplete;
- if (hasError) {
- subscriber.error(thrownError);
- } else if (isStopped || _isComplete) {
- _hasValue && subscriber.next(_value);
- subscriber.complete();
- }
- };
- AsyncSubject2.prototype.next = function(value) {
- if (!this.isStopped) {
- this._value = value;
- this._hasValue = true;
- }
- };
- AsyncSubject2.prototype.complete = function() {
- var _a2 = this, _hasValue = _a2._hasValue, _value = _a2._value, _isComplete = _a2._isComplete;
- if (!_isComplete) {
- this._isComplete = true;
- _hasValue && _super.prototype.next.call(this, _value);
- _super.prototype.complete.call(this);
- }
- };
- return AsyncSubject2;
- }(Subject);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/Action.js
- var Action = function(_super) {
- __extends(Action2, _super);
- function Action2(scheduler, work) {
- return _super.call(this) || this;
- }
- Action2.prototype.schedule = function(state, delay2) {
- if (delay2 === void 0) {
- delay2 = 0;
- }
- return this;
- };
- return Action2;
- }(Subscription);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/intervalProvider.js
- var intervalProvider = {
- setInterval: function(handler, timeout2) {
- var args = [];
- for (var _i2 = 2; _i2 < arguments.length; _i2++) {
- args[_i2 - 2] = arguments[_i2];
- }
- var delegate = intervalProvider.delegate;
- if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
- return delegate.setInterval.apply(delegate, __spreadArray([handler, timeout2], __read(args)));
- }
- return setInterval.apply(void 0, __spreadArray([handler, timeout2], __read(args)));
- },
- clearInterval: function(handle) {
- var delegate = intervalProvider.delegate;
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearInterval) || clearInterval)(handle);
- },
- delegate: void 0
- };
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/AsyncAction.js
- var AsyncAction = function(_super) {
- __extends(AsyncAction2, _super);
- function AsyncAction2(scheduler, work) {
- var _this = _super.call(this, scheduler, work) || this;
- _this.scheduler = scheduler;
- _this.work = work;
- _this.pending = false;
- return _this;
- }
- AsyncAction2.prototype.schedule = function(state, delay2) {
- var _a2;
- if (delay2 === void 0) {
- delay2 = 0;
- }
- if (this.closed) {
- return this;
- }
- this.state = state;
- var id2 = this.id;
- var scheduler = this.scheduler;
- if (id2 != null) {
- this.id = this.recycleAsyncId(scheduler, id2, delay2);
- }
- this.pending = true;
- this.delay = delay2;
- this.id = (_a2 = this.id) !== null && _a2 !== void 0 ? _a2 : this.requestAsyncId(scheduler, this.id, delay2);
- return this;
- };
- AsyncAction2.prototype.requestAsyncId = function(scheduler, _id, delay2) {
- if (delay2 === void 0) {
- delay2 = 0;
- }
- return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay2);
- };
- AsyncAction2.prototype.recycleAsyncId = function(_scheduler, id2, delay2) {
- if (delay2 === void 0) {
- delay2 = 0;
- }
- if (delay2 != null && this.delay === delay2 && this.pending === false) {
- return id2;
- }
- if (id2 != null) {
- intervalProvider.clearInterval(id2);
- }
- return void 0;
- };
- AsyncAction2.prototype.execute = function(state, delay2) {
- if (this.closed) {
- return new Error("executing a cancelled action");
- }
- this.pending = false;
- var error = this._execute(state, delay2);
- if (error) {
- return error;
- } else if (this.pending === false && this.id != null) {
- this.id = this.recycleAsyncId(this.scheduler, this.id, null);
- }
- };
- AsyncAction2.prototype._execute = function(state, _delay) {
- var errored = false;
- var errorValue;
- try {
- this.work(state);
- } catch (e) {
- errored = true;
- errorValue = e ? e : new Error("Scheduled action threw falsy error");
- }
- if (errored) {
- this.unsubscribe();
- return errorValue;
- }
- };
- AsyncAction2.prototype.unsubscribe = function() {
- if (!this.closed) {
- var _a2 = this, id2 = _a2.id, scheduler = _a2.scheduler;
- var actions = scheduler.actions;
- this.work = this.state = this.scheduler = null;
- this.pending = false;
- arrRemove(actions, this);
- if (id2 != null) {
- this.id = this.recycleAsyncId(scheduler, id2, null);
- }
- this.delay = null;
- _super.prototype.unsubscribe.call(this);
- }
- };
- return AsyncAction2;
- }(Action);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/Immediate.js
- var nextHandle = 1;
- var resolved;
- var activeHandles = {};
- function findAndClearHandle(handle) {
- if (handle in activeHandles) {
- delete activeHandles[handle];
- return true;
- }
- return false;
- }
- var Immediate = {
- setImmediate: function(cb) {
- var handle = nextHandle++;
- activeHandles[handle] = true;
- if (!resolved) {
- resolved = Promise.resolve();
- }
- resolved.then(function() {
- return findAndClearHandle(handle) && cb();
- });
- return handle;
- },
- clearImmediate: function(handle) {
- findAndClearHandle(handle);
- }
- };
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/immediateProvider.js
- var setImmediate = Immediate.setImmediate;
- var clearImmediate = Immediate.clearImmediate;
- var immediateProvider = {
- setImmediate: function() {
- var args = [];
- for (var _i2 = 0; _i2 < arguments.length; _i2++) {
- args[_i2] = arguments[_i2];
- }
- var delegate = immediateProvider.delegate;
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.setImmediate) || setImmediate).apply(void 0, __spreadArray([], __read(args)));
- },
- clearImmediate: function(handle) {
- var delegate = immediateProvider.delegate;
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearImmediate) || clearImmediate)(handle);
- },
- delegate: void 0
- };
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/AsapAction.js
- var AsapAction = function(_super) {
- __extends(AsapAction2, _super);
- function AsapAction2(scheduler, work) {
- var _this = _super.call(this, scheduler, work) || this;
- _this.scheduler = scheduler;
- _this.work = work;
- return _this;
- }
- AsapAction2.prototype.requestAsyncId = function(scheduler, id2, delay2) {
- if (delay2 === void 0) {
- delay2 = 0;
- }
- if (delay2 !== null && delay2 > 0) {
- return _super.prototype.requestAsyncId.call(this, scheduler, id2, delay2);
- }
- scheduler.actions.push(this);
- return scheduler._scheduled || (scheduler._scheduled = immediateProvider.setImmediate(scheduler.flush.bind(scheduler, void 0)));
- };
- AsapAction2.prototype.recycleAsyncId = function(scheduler, id2, delay2) {
- var _a2;
- if (delay2 === void 0) {
- delay2 = 0;
- }
- if (delay2 != null ? delay2 > 0 : this.delay > 0) {
- return _super.prototype.recycleAsyncId.call(this, scheduler, id2, delay2);
- }
- var actions = scheduler.actions;
- if (id2 != null && ((_a2 = actions[actions.length - 1]) === null || _a2 === void 0 ? void 0 : _a2.id) !== id2) {
- immediateProvider.clearImmediate(id2);
- if (scheduler._scheduled === id2) {
- scheduler._scheduled = void 0;
- }
- }
- return void 0;
- };
- return AsapAction2;
- }(AsyncAction);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Scheduler.js
- var Scheduler = function() {
- function Scheduler2(schedulerActionCtor, now) {
- if (now === void 0) {
- now = Scheduler2.now;
- }
- this.schedulerActionCtor = schedulerActionCtor;
- this.now = now;
- }
- Scheduler2.prototype.schedule = function(work, delay2, state) {
- if (delay2 === void 0) {
- delay2 = 0;
- }
- return new this.schedulerActionCtor(this, work).schedule(state, delay2);
- };
- Scheduler2.now = dateTimestampProvider.now;
- return Scheduler2;
- }();
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/AsyncScheduler.js
- var AsyncScheduler = function(_super) {
- __extends(AsyncScheduler2, _super);
- function AsyncScheduler2(SchedulerAction, now) {
- if (now === void 0) {
- now = Scheduler.now;
- }
- var _this = _super.call(this, SchedulerAction, now) || this;
- _this.actions = [];
- _this._active = false;
- return _this;
- }
- AsyncScheduler2.prototype.flush = function(action) {
- var actions = this.actions;
- if (this._active) {
- actions.push(action);
- return;
- }
- var error;
- this._active = true;
- do {
- if (error = action.execute(action.state, action.delay)) {
- break;
- }
- } while (action = actions.shift());
- this._active = false;
- if (error) {
- while (action = actions.shift()) {
- action.unsubscribe();
- }
- throw error;
- }
- };
- return AsyncScheduler2;
- }(Scheduler);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/AsapScheduler.js
- var AsapScheduler = function(_super) {
- __extends(AsapScheduler2, _super);
- function AsapScheduler2() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- AsapScheduler2.prototype.flush = function(action) {
- this._active = true;
- var flushId = this._scheduled;
- this._scheduled = void 0;
- var actions = this.actions;
- var error;
- action = action || actions.shift();
- do {
- if (error = action.execute(action.state, action.delay)) {
- break;
- }
- } while ((action = actions[0]) && action.id === flushId && actions.shift());
- this._active = false;
- if (error) {
- while ((action = actions[0]) && action.id === flushId && actions.shift()) {
- action.unsubscribe();
- }
- throw error;
- }
- };
- return AsapScheduler2;
- }(AsyncScheduler);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/asap.js
- var asapScheduler = new AsapScheduler(AsapAction);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/async.js
- var asyncScheduler = new AsyncScheduler(AsyncAction);
- var async = asyncScheduler;
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/QueueAction.js
- var QueueAction = function(_super) {
- __extends(QueueAction2, _super);
- function QueueAction2(scheduler, work) {
- var _this = _super.call(this, scheduler, work) || this;
- _this.scheduler = scheduler;
- _this.work = work;
- return _this;
- }
- QueueAction2.prototype.schedule = function(state, delay2) {
- if (delay2 === void 0) {
- delay2 = 0;
- }
- if (delay2 > 0) {
- return _super.prototype.schedule.call(this, state, delay2);
- }
- this.delay = delay2;
- this.state = state;
- this.scheduler.flush(this);
- return this;
- };
- QueueAction2.prototype.execute = function(state, delay2) {
- return delay2 > 0 || this.closed ? _super.prototype.execute.call(this, state, delay2) : this._execute(state, delay2);
- };
- QueueAction2.prototype.requestAsyncId = function(scheduler, id2, delay2) {
- if (delay2 === void 0) {
- delay2 = 0;
- }
- if (delay2 != null && delay2 > 0 || delay2 == null && this.delay > 0) {
- return _super.prototype.requestAsyncId.call(this, scheduler, id2, delay2);
- }
- scheduler.flush(this);
- return 0;
- };
- return QueueAction2;
- }(AsyncAction);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/QueueScheduler.js
- var QueueScheduler = function(_super) {
- __extends(QueueScheduler2, _super);
- function QueueScheduler2() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- return QueueScheduler2;
- }(AsyncScheduler);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/queue.js
- var queueScheduler = new QueueScheduler(QueueAction);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/AnimationFrameAction.js
- var AnimationFrameAction = function(_super) {
- __extends(AnimationFrameAction2, _super);
- function AnimationFrameAction2(scheduler, work) {
- var _this = _super.call(this, scheduler, work) || this;
- _this.scheduler = scheduler;
- _this.work = work;
- return _this;
- }
- AnimationFrameAction2.prototype.requestAsyncId = function(scheduler, id2, delay2) {
- if (delay2 === void 0) {
- delay2 = 0;
- }
- if (delay2 !== null && delay2 > 0) {
- return _super.prototype.requestAsyncId.call(this, scheduler, id2, delay2);
- }
- scheduler.actions.push(this);
- return scheduler._scheduled || (scheduler._scheduled = animationFrameProvider.requestAnimationFrame(function() {
- return scheduler.flush(void 0);
- }));
- };
- AnimationFrameAction2.prototype.recycleAsyncId = function(scheduler, id2, delay2) {
- var _a2;
- if (delay2 === void 0) {
- delay2 = 0;
- }
- if (delay2 != null ? delay2 > 0 : this.delay > 0) {
- return _super.prototype.recycleAsyncId.call(this, scheduler, id2, delay2);
- }
- var actions = scheduler.actions;
- if (id2 != null && ((_a2 = actions[actions.length - 1]) === null || _a2 === void 0 ? void 0 : _a2.id) !== id2) {
- animationFrameProvider.cancelAnimationFrame(id2);
- scheduler._scheduled = void 0;
- }
- return void 0;
- };
- return AnimationFrameAction2;
- }(AsyncAction);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/AnimationFrameScheduler.js
- var AnimationFrameScheduler = function(_super) {
- __extends(AnimationFrameScheduler2, _super);
- function AnimationFrameScheduler2() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- AnimationFrameScheduler2.prototype.flush = function(action) {
- this._active = true;
- var flushId = this._scheduled;
- this._scheduled = void 0;
- var actions = this.actions;
- var error;
- action = action || actions.shift();
- do {
- if (error = action.execute(action.state, action.delay)) {
- break;
- }
- } while ((action = actions[0]) && action.id === flushId && actions.shift());
- this._active = false;
- if (error) {
- while ((action = actions[0]) && action.id === flushId && actions.shift()) {
- action.unsubscribe();
- }
- throw error;
- }
- };
- return AnimationFrameScheduler2;
- }(AsyncScheduler);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/animationFrame.js
- var animationFrameScheduler = new AnimationFrameScheduler(AnimationFrameAction);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduler/VirtualTimeScheduler.js
- var VirtualTimeScheduler = function(_super) {
- __extends(VirtualTimeScheduler2, _super);
- function VirtualTimeScheduler2(schedulerActionCtor, maxFrames) {
- if (schedulerActionCtor === void 0) {
- schedulerActionCtor = VirtualAction;
- }
- if (maxFrames === void 0) {
- maxFrames = Infinity;
- }
- var _this = _super.call(this, schedulerActionCtor, function() {
- return _this.frame;
- }) || this;
- _this.maxFrames = maxFrames;
- _this.frame = 0;
- _this.index = -1;
- return _this;
- }
- VirtualTimeScheduler2.prototype.flush = function() {
- var _a2 = this, actions = _a2.actions, maxFrames = _a2.maxFrames;
- var error;
- var action;
- while ((action = actions[0]) && action.delay <= maxFrames) {
- actions.shift();
- this.frame = action.delay;
- if (error = action.execute(action.state, action.delay)) {
- break;
- }
- }
- if (error) {
- while (action = actions.shift()) {
- action.unsubscribe();
- }
- throw error;
- }
- };
- VirtualTimeScheduler2.frameTimeFactor = 10;
- return VirtualTimeScheduler2;
- }(AsyncScheduler);
- var VirtualAction = function(_super) {
- __extends(VirtualAction2, _super);
- function VirtualAction2(scheduler, work, index) {
- if (index === void 0) {
- index = scheduler.index += 1;
- }
- var _this = _super.call(this, scheduler, work) || this;
- _this.scheduler = scheduler;
- _this.work = work;
- _this.index = index;
- _this.active = true;
- _this.index = scheduler.index = index;
- return _this;
- }
- VirtualAction2.prototype.schedule = function(state, delay2) {
- if (delay2 === void 0) {
- delay2 = 0;
- }
- if (Number.isFinite(delay2)) {
- if (!this.id) {
- return _super.prototype.schedule.call(this, state, delay2);
- }
- this.active = false;
- var action = new VirtualAction2(this.scheduler, this.work);
- this.add(action);
- return action.schedule(state, delay2);
- } else {
- return Subscription.EMPTY;
- }
- };
- VirtualAction2.prototype.requestAsyncId = function(scheduler, id2, delay2) {
- if (delay2 === void 0) {
- delay2 = 0;
- }
- this.delay = scheduler.frame + delay2;
- var actions = scheduler.actions;
- actions.push(this);
- actions.sort(VirtualAction2.sortActions);
- return 1;
- };
- VirtualAction2.prototype.recycleAsyncId = function(scheduler, id2, delay2) {
- if (delay2 === void 0) {
- delay2 = 0;
- }
- return void 0;
- };
- VirtualAction2.prototype._execute = function(state, delay2) {
- if (this.active === true) {
- return _super.prototype._execute.call(this, state, delay2);
- }
- };
- VirtualAction2.sortActions = function(a, b) {
- if (a.delay === b.delay) {
- if (a.index === b.index) {
- return 0;
- } else if (a.index > b.index) {
- return 1;
- } else {
- return -1;
- }
- } else if (a.delay > b.delay) {
- return 1;
- } else {
- return -1;
- }
- };
- return VirtualAction2;
- }(AsyncAction);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/empty.js
- var EMPTY = new Observable(function(subscriber) {
- return subscriber.complete();
- });
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isScheduler.js
- function isScheduler(value) {
- return value && isFunction(value.schedule);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/args.js
- function last(arr) {
- return arr[arr.length - 1];
- }
- function popResultSelector(args) {
- return isFunction(last(args)) ? args.pop() : void 0;
- }
- function popScheduler(args) {
- return isScheduler(last(args)) ? args.pop() : void 0;
- }
- function popNumber(args, defaultValue) {
- return typeof last(args) === "number" ? args.pop() : defaultValue;
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isArrayLike.js
- var isArrayLike = function(x) {
- return x && typeof x.length === "number" && typeof x !== "function";
- };
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isPromise.js
- function isPromise(value) {
- return isFunction(value === null || value === void 0 ? void 0 : value.then);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isInteropObservable.js
- function isInteropObservable(input) {
- return isFunction(input[observable]);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isAsyncIterable.js
- function isAsyncIterable(obj) {
- return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/throwUnobservableError.js
- function createInvalidObservableTypeError(input) {
- 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.");
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/symbol/iterator.js
- function getSymbolIterator() {
- if (typeof Symbol !== "function" || !Symbol.iterator) {
- return "@@iterator";
- }
- return Symbol.iterator;
- }
- var iterator = getSymbolIterator();
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isIterable.js
- function isIterable(input) {
- return isFunction(input === null || input === void 0 ? void 0 : input[iterator]);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isReadableStreamLike.js
- function readableStreamLikeToAsyncGenerator(readableStream) {
- return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
- var reader, _a2, value, done;
- return __generator(this, function(_b) {
- switch (_b.label) {
- case 0:
- reader = readableStream.getReader();
- _b.label = 1;
- case 1:
- _b.trys.push([1, , 9, 10]);
- _b.label = 2;
- case 2:
- if (false)
- return [3, 8];
- return [4, __await(reader.read())];
- case 3:
- _a2 = _b.sent(), value = _a2.value, done = _a2.done;
- if (!done)
- return [3, 5];
- return [4, __await(void 0)];
- case 4:
- return [2, _b.sent()];
- case 5:
- return [4, __await(value)];
- case 6:
- return [4, _b.sent()];
- case 7:
- _b.sent();
- return [3, 2];
- case 8:
- return [3, 10];
- case 9:
- reader.releaseLock();
- return [7];
- case 10:
- return [2];
- }
- });
- });
- }
- function isReadableStreamLike(obj) {
- return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/innerFrom.js
- function innerFrom(input) {
- if (input instanceof Observable) {
- return input;
- }
- if (input != null) {
- if (isInteropObservable(input)) {
- return fromInteropObservable(input);
- }
- if (isArrayLike(input)) {
- return fromArrayLike(input);
- }
- if (isPromise(input)) {
- return fromPromise(input);
- }
- if (isAsyncIterable(input)) {
- return fromAsyncIterable(input);
- }
- if (isIterable(input)) {
- return fromIterable(input);
- }
- if (isReadableStreamLike(input)) {
- return fromReadableStreamLike(input);
- }
- }
- throw createInvalidObservableTypeError(input);
- }
- function fromInteropObservable(obj) {
- return new Observable(function(subscriber) {
- var obs = obj[observable]();
- if (isFunction(obs.subscribe)) {
- return obs.subscribe(subscriber);
- }
- throw new TypeError("Provided object does not correctly implement Symbol.observable");
- });
- }
- function fromArrayLike(array) {
- return new Observable(function(subscriber) {
- for (var i = 0; i < array.length && !subscriber.closed; i++) {
- subscriber.next(array[i]);
- }
- subscriber.complete();
- });
- }
- function fromPromise(promise) {
- return new Observable(function(subscriber) {
- promise.then(function(value) {
- if (!subscriber.closed) {
- subscriber.next(value);
- subscriber.complete();
- }
- }, function(err) {
- return subscriber.error(err);
- }).then(null, reportUnhandledError);
- });
- }
- function fromIterable(iterable) {
- return new Observable(function(subscriber) {
- var e_1, _a2;
- try {
- for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next(); !iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
- var value = iterable_1_1.value;
- subscriber.next(value);
- if (subscriber.closed) {
- return;
- }
- }
- } catch (e_1_1) {
- e_1 = { error: e_1_1 };
- } finally {
- try {
- if (iterable_1_1 && !iterable_1_1.done && (_a2 = iterable_1.return))
- _a2.call(iterable_1);
- } finally {
- if (e_1)
- throw e_1.error;
- }
- }
- subscriber.complete();
- });
- }
- function fromAsyncIterable(asyncIterable) {
- return new Observable(function(subscriber) {
- process2(asyncIterable, subscriber).catch(function(err) {
- return subscriber.error(err);
- });
- });
- }
- function fromReadableStreamLike(readableStream) {
- return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
- }
- function process2(asyncIterable, subscriber) {
- var asyncIterable_1, asyncIterable_1_1;
- var e_2, _a2;
- return __awaiter(this, void 0, void 0, function() {
- var value, e_2_1;
- return __generator(this, function(_b) {
- switch (_b.label) {
- case 0:
- _b.trys.push([0, 5, 6, 11]);
- asyncIterable_1 = __asyncValues(asyncIterable);
- _b.label = 1;
- case 1:
- return [4, asyncIterable_1.next()];
- case 2:
- if (!(asyncIterable_1_1 = _b.sent(), !asyncIterable_1_1.done))
- return [3, 4];
- value = asyncIterable_1_1.value;
- subscriber.next(value);
- if (subscriber.closed) {
- return [2];
- }
- _b.label = 3;
- case 3:
- return [3, 1];
- case 4:
- return [3, 11];
- case 5:
- e_2_1 = _b.sent();
- e_2 = { error: e_2_1 };
- return [3, 11];
- case 6:
- _b.trys.push([6, , 9, 10]);
- if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a2 = asyncIterable_1.return)))
- return [3, 8];
- return [4, _a2.call(asyncIterable_1)];
- case 7:
- _b.sent();
- _b.label = 8;
- case 8:
- return [3, 10];
- case 9:
- if (e_2)
- throw e_2.error;
- return [7];
- case 10:
- return [7];
- case 11:
- subscriber.complete();
- return [2];
- }
- });
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/executeSchedule.js
- function executeSchedule(parentSubscription, scheduler, work, delay2, repeat2) {
- if (delay2 === void 0) {
- delay2 = 0;
- }
- if (repeat2 === void 0) {
- repeat2 = false;
- }
- var scheduleSubscription = scheduler.schedule(function() {
- work();
- if (repeat2) {
- parentSubscription.add(this.schedule(null, delay2));
- } else {
- this.unsubscribe();
- }
- }, delay2);
- parentSubscription.add(scheduleSubscription);
- if (!repeat2) {
- return scheduleSubscription;
- }
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/observeOn.js
- function observeOn(scheduler, delay2) {
- if (delay2 === void 0) {
- delay2 = 0;
- }
- return operate(function(source, subscriber) {
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
- return executeSchedule(subscriber, scheduler, function() {
- return subscriber.next(value);
- }, delay2);
- }, function() {
- return executeSchedule(subscriber, scheduler, function() {
- return subscriber.complete();
- }, delay2);
- }, function(err) {
- return executeSchedule(subscriber, scheduler, function() {
- return subscriber.error(err);
- }, delay2);
- }));
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/subscribeOn.js
- function subscribeOn(scheduler, delay2) {
- if (delay2 === void 0) {
- delay2 = 0;
- }
- return operate(function(source, subscriber) {
- subscriber.add(scheduler.schedule(function() {
- return source.subscribe(subscriber);
- }, delay2));
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduled/scheduleObservable.js
- function scheduleObservable(input, scheduler) {
- return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduled/schedulePromise.js
- function schedulePromise(input, scheduler) {
- return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduled/scheduleArray.js
- function scheduleArray(input, scheduler) {
- return new Observable(function(subscriber) {
- var i = 0;
- return scheduler.schedule(function() {
- if (i === input.length) {
- subscriber.complete();
- } else {
- subscriber.next(input[i++]);
- if (!subscriber.closed) {
- this.schedule();
- }
- }
- });
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduled/scheduleIterable.js
- function scheduleIterable(input, scheduler) {
- return new Observable(function(subscriber) {
- var iterator2;
- executeSchedule(subscriber, scheduler, function() {
- iterator2 = input[iterator]();
- executeSchedule(subscriber, scheduler, function() {
- var _a2;
- var value;
- var done;
- try {
- _a2 = iterator2.next(), value = _a2.value, done = _a2.done;
- } catch (err) {
- subscriber.error(err);
- return;
- }
- if (done) {
- subscriber.complete();
- } else {
- subscriber.next(value);
- }
- }, 0, true);
- });
- return function() {
- return isFunction(iterator2 === null || iterator2 === void 0 ? void 0 : iterator2.return) && iterator2.return();
- };
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduled/scheduleAsyncIterable.js
- function scheduleAsyncIterable(input, scheduler) {
- if (!input) {
- throw new Error("Iterable cannot be null");
- }
- return new Observable(function(subscriber) {
- executeSchedule(subscriber, scheduler, function() {
- var iterator2 = input[Symbol.asyncIterator]();
- executeSchedule(subscriber, scheduler, function() {
- iterator2.next().then(function(result) {
- if (result.done) {
- subscriber.complete();
- } else {
- subscriber.next(result.value);
- }
- });
- }, 0, true);
- });
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduled/scheduleReadableStreamLike.js
- function scheduleReadableStreamLike(input, scheduler) {
- return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/scheduled/scheduled.js
- function scheduled(input, scheduler) {
- if (input != null) {
- if (isInteropObservable(input)) {
- return scheduleObservable(input, scheduler);
- }
- if (isArrayLike(input)) {
- return scheduleArray(input, scheduler);
- }
- if (isPromise(input)) {
- return schedulePromise(input, scheduler);
- }
- if (isAsyncIterable(input)) {
- return scheduleAsyncIterable(input, scheduler);
- }
- if (isIterable(input)) {
- return scheduleIterable(input, scheduler);
- }
- if (isReadableStreamLike(input)) {
- return scheduleReadableStreamLike(input, scheduler);
- }
- }
- throw createInvalidObservableTypeError(input);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/from.js
- function from(input, scheduler) {
- return scheduler ? scheduled(input, scheduler) : innerFrom(input);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/of.js
- function of() {
- var args = [];
- for (var _i2 = 0; _i2 < arguments.length; _i2++) {
- args[_i2] = arguments[_i2];
- }
- var scheduler = popScheduler(args);
- return from(args, scheduler);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/throwError.js
- function throwError(errorOrErrorFactory, scheduler) {
- var errorFactory = isFunction(errorOrErrorFactory) ? errorOrErrorFactory : function() {
- return errorOrErrorFactory;
- };
- var init = function(subscriber) {
- return subscriber.error(errorFactory());
- };
- return new Observable(scheduler ? function(subscriber) {
- return scheduler.schedule(init, 0, subscriber);
- } : init);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/Notification.js
- var NotificationKind;
- (function(NotificationKind2) {
- NotificationKind2["NEXT"] = "N";
- NotificationKind2["ERROR"] = "E";
- NotificationKind2["COMPLETE"] = "C";
- })(NotificationKind || (NotificationKind = {}));
- var Notification = function() {
- function Notification2(kind, value, error) {
- this.kind = kind;
- this.value = value;
- this.error = error;
- this.hasValue = kind === "N";
- }
- Notification2.prototype.observe = function(observer) {
- return observeNotification(this, observer);
- };
- Notification2.prototype.do = function(nextHandler, errorHandler, completeHandler) {
- var _a2 = this, kind = _a2.kind, value = _a2.value, error = _a2.error;
- 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();
- };
- Notification2.prototype.accept = function(nextOrObserver, error, complete) {
- var _a2;
- return isFunction((_a2 = nextOrObserver) === null || _a2 === void 0 ? void 0 : _a2.next) ? this.observe(nextOrObserver) : this.do(nextOrObserver, error, complete);
- };
- Notification2.prototype.toObservable = function() {
- var _a2 = this, kind = _a2.kind, value = _a2.value, error = _a2.error;
- var result = kind === "N" ? of(value) : kind === "E" ? throwError(function() {
- return error;
- }) : kind === "C" ? EMPTY : 0;
- if (!result) {
- throw new TypeError("Unexpected notification kind " + kind);
- }
- return result;
- };
- Notification2.createNext = function(value) {
- return new Notification2("N", value);
- };
- Notification2.createError = function(err) {
- return new Notification2("E", void 0, err);
- };
- Notification2.createComplete = function() {
- return Notification2.completeNotification;
- };
- Notification2.completeNotification = new Notification2("C");
- return Notification2;
- }();
- function observeNotification(notification, observer) {
- var _a2, _b, _c2;
- var _d2 = notification, kind = _d2.kind, value = _d2.value, error = _d2.error;
- if (typeof kind !== "string") {
- throw new TypeError('Invalid notification, missing "kind"');
- }
- 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);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isObservable.js
- function isObservable(obj) {
- return !!obj && (obj instanceof Observable || isFunction(obj.lift) && isFunction(obj.subscribe));
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/EmptyError.js
- var EmptyError = createErrorClass(function(_super) {
- return function EmptyErrorImpl() {
- _super(this);
- this.name = "EmptyError";
- this.message = "no elements in sequence";
- };
- });
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/firstValueFrom.js
- function firstValueFrom(source, config2) {
- var hasConfig = typeof config2 === "object";
- return new Promise(function(resolve, reject) {
- var subscriber = new SafeSubscriber({
- next: function(value) {
- resolve(value);
- subscriber.unsubscribe();
- },
- error: reject,
- complete: function() {
- if (hasConfig) {
- resolve(config2.defaultValue);
- } else {
- reject(new EmptyError());
- }
- }
- });
- source.subscribe(subscriber);
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/ArgumentOutOfRangeError.js
- var ArgumentOutOfRangeError = createErrorClass(function(_super) {
- return function ArgumentOutOfRangeErrorImpl() {
- _super(this);
- this.name = "ArgumentOutOfRangeError";
- this.message = "argument out of range";
- };
- });
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/NotFoundError.js
- var NotFoundError = createErrorClass(function(_super) {
- return function NotFoundErrorImpl(message) {
- _super(this);
- this.name = "NotFoundError";
- this.message = message;
- };
- });
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/SequenceError.js
- var SequenceError = createErrorClass(function(_super) {
- return function SequenceErrorImpl(message) {
- _super(this);
- this.name = "SequenceError";
- this.message = message;
- };
- });
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/isDate.js
- function isValidDate(value) {
- return value instanceof Date && !isNaN(value);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/timeout.js
- var TimeoutError = createErrorClass(function(_super) {
- return function TimeoutErrorImpl(info) {
- if (info === void 0) {
- info = null;
- }
- _super(this);
- this.message = "Timeout has occurred";
- this.name = "TimeoutError";
- this.info = info;
- };
- });
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/map.js
- function map(project, thisArg) {
- return operate(function(source, subscriber) {
- var index = 0;
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
- subscriber.next(project.call(thisArg, value, index++));
- }));
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/mapOneOrManyArgs.js
- var isArray = Array.isArray;
- function callOrApply(fn2, args) {
- return isArray(args) ? fn2.apply(void 0, __spreadArray([], __read(args))) : fn2(args);
- }
- function mapOneOrManyArgs(fn2) {
- return map(function(args) {
- return callOrApply(fn2, args);
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/argsArgArrayOrObject.js
- var isArray2 = Array.isArray;
- var getPrototypeOf = Object.getPrototypeOf;
- var objectProto = Object.prototype;
- var getKeys = Object.keys;
- function argsArgArrayOrObject(args) {
- if (args.length === 1) {
- var first_1 = args[0];
- if (isArray2(first_1)) {
- return { args: first_1, keys: null };
- }
- if (isPOJO(first_1)) {
- var keys = getKeys(first_1);
- return {
- args: keys.map(function(key) {
- return first_1[key];
- }),
- keys
- };
- }
- }
- return { args, keys: null };
- }
- function isPOJO(obj) {
- return obj && typeof obj === "object" && getPrototypeOf(obj) === objectProto;
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/createObject.js
- function createObject(keys, values) {
- return keys.reduce(function(result, key, i) {
- return result[key] = values[i], result;
- }, {});
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/combineLatest.js
- function combineLatest() {
- var args = [];
- for (var _i2 = 0; _i2 < arguments.length; _i2++) {
- args[_i2] = arguments[_i2];
- }
- var scheduler = popScheduler(args);
- var resultSelector = popResultSelector(args);
- var _a2 = argsArgArrayOrObject(args), observables = _a2.args, keys = _a2.keys;
- if (observables.length === 0) {
- return from([], scheduler);
- }
- var result = new Observable(combineLatestInit(observables, scheduler, keys ? function(values) {
- return createObject(keys, values);
- } : identity));
- return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result;
- }
- function combineLatestInit(observables, scheduler, valueTransform) {
- if (valueTransform === void 0) {
- valueTransform = identity;
- }
- return function(subscriber) {
- maybeSchedule(scheduler, function() {
- var length = observables.length;
- var values = new Array(length);
- var active = length;
- var remainingFirstValues = length;
- var _loop_1 = function(i2) {
- maybeSchedule(scheduler, function() {
- var source = from(observables[i2], scheduler);
- var hasFirstValue = false;
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
- values[i2] = value;
- if (!hasFirstValue) {
- hasFirstValue = true;
- remainingFirstValues--;
- }
- if (!remainingFirstValues) {
- subscriber.next(valueTransform(values.slice()));
- }
- }, function() {
- if (!--active) {
- subscriber.complete();
- }
- }));
- }, subscriber);
- };
- for (var i = 0; i < length; i++) {
- _loop_1(i);
- }
- }, subscriber);
- };
- }
- function maybeSchedule(scheduler, execute, subscription) {
- if (scheduler) {
- executeSchedule(subscription, scheduler, execute);
- } else {
- execute();
- }
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/mergeInternals.js
- function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand2, innerSubScheduler, additionalFinalizer) {
- var buffer2 = [];
- var active = 0;
- var index = 0;
- var isComplete = false;
- var checkComplete = function() {
- if (isComplete && !buffer2.length && !active) {
- subscriber.complete();
- }
- };
- var outerNext = function(value) {
- return active < concurrent ? doInnerSub(value) : buffer2.push(value);
- };
- var doInnerSub = function(value) {
- expand2 && subscriber.next(value);
- active++;
- var innerComplete = false;
- innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, function(innerValue) {
- onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);
- if (expand2) {
- outerNext(innerValue);
- } else {
- subscriber.next(innerValue);
- }
- }, function() {
- innerComplete = true;
- }, void 0, function() {
- if (innerComplete) {
- try {
- active--;
- var _loop_1 = function() {
- var bufferedValue = buffer2.shift();
- if (innerSubScheduler) {
- executeSchedule(subscriber, innerSubScheduler, function() {
- return doInnerSub(bufferedValue);
- });
- } else {
- doInnerSub(bufferedValue);
- }
- };
- while (buffer2.length && active < concurrent) {
- _loop_1();
- }
- checkComplete();
- } catch (err) {
- subscriber.error(err);
- }
- }
- }));
- };
- source.subscribe(createOperatorSubscriber(subscriber, outerNext, function() {
- isComplete = true;
- checkComplete();
- }));
- return function() {
- additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
- };
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/mergeMap.js
- function mergeMap(project, resultSelector, concurrent) {
- if (concurrent === void 0) {
- concurrent = Infinity;
- }
- if (isFunction(resultSelector)) {
- return mergeMap(function(a, i) {
- return map(function(b, ii2) {
- return resultSelector(a, b, i, ii2);
- })(innerFrom(project(a, i)));
- }, concurrent);
- } else if (typeof resultSelector === "number") {
- concurrent = resultSelector;
- }
- return operate(function(source, subscriber) {
- return mergeInternals(source, subscriber, project, concurrent);
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/mergeAll.js
- function mergeAll(concurrent) {
- if (concurrent === void 0) {
- concurrent = Infinity;
- }
- return mergeMap(identity, concurrent);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/concatAll.js
- function concatAll() {
- return mergeAll(1);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/concat.js
- function concat() {
- var args = [];
- for (var _i2 = 0; _i2 < arguments.length; _i2++) {
- args[_i2] = arguments[_i2];
- }
- return concatAll()(from(args, popScheduler(args)));
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/fromEvent.js
- var nodeEventEmitterMethods = ["addListener", "removeListener"];
- var eventTargetMethods = ["addEventListener", "removeEventListener"];
- var jqueryMethods = ["on", "off"];
- function fromEvent(target, eventName, options, resultSelector) {
- if (isFunction(options)) {
- resultSelector = options;
- options = void 0;
- }
- if (resultSelector) {
- return fromEvent(target, eventName, options).pipe(mapOneOrManyArgs(resultSelector));
- }
- var _a2 = __read(isEventTarget(target) ? eventTargetMethods.map(function(methodName) {
- return function(handler) {
- return target[methodName](eventName, handler, options);
- };
- }) : isNodeStyleEventEmitter(target) ? nodeEventEmitterMethods.map(toCommonHandlerRegistry(target, eventName)) : isJQueryStyleEventEmitter(target) ? jqueryMethods.map(toCommonHandlerRegistry(target, eventName)) : [], 2), add = _a2[0], remove = _a2[1];
- if (!add) {
- if (isArrayLike(target)) {
- return mergeMap(function(subTarget) {
- return fromEvent(subTarget, eventName, options);
- })(innerFrom(target));
- }
- }
- if (!add) {
- throw new TypeError("Invalid event target");
- }
- return new Observable(function(subscriber) {
- var handler = function() {
- var args = [];
- for (var _i2 = 0; _i2 < arguments.length; _i2++) {
- args[_i2] = arguments[_i2];
- }
- return subscriber.next(1 < args.length ? args : args[0]);
- };
- add(handler);
- return function() {
- return remove(handler);
- };
- });
- }
- function toCommonHandlerRegistry(target, eventName) {
- return function(methodName) {
- return function(handler) {
- return target[methodName](eventName, handler);
- };
- };
- }
- function isNodeStyleEventEmitter(target) {
- return isFunction(target.addListener) && isFunction(target.removeListener);
- }
- function isJQueryStyleEventEmitter(target) {
- return isFunction(target.on) && isFunction(target.off);
- }
- function isEventTarget(target) {
- return isFunction(target.addEventListener) && isFunction(target.removeEventListener);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/timer.js
- function timer(dueTime, intervalOrScheduler, scheduler) {
- if (dueTime === void 0) {
- dueTime = 0;
- }
- if (scheduler === void 0) {
- scheduler = async;
- }
- var intervalDuration = -1;
- if (intervalOrScheduler != null) {
- if (isScheduler(intervalOrScheduler)) {
- scheduler = intervalOrScheduler;
- } else {
- intervalDuration = intervalOrScheduler;
- }
- }
- return new Observable(function(subscriber) {
- var due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;
- if (due < 0) {
- due = 0;
- }
- var n = 0;
- return scheduler.schedule(function() {
- if (!subscriber.closed) {
- subscriber.next(n++);
- if (0 <= intervalDuration) {
- this.schedule(void 0, intervalDuration);
- } else {
- subscriber.complete();
- }
- }
- }, due);
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/merge.js
- function merge() {
- var args = [];
- for (var _i2 = 0; _i2 < arguments.length; _i2++) {
- args[_i2] = arguments[_i2];
- }
- var scheduler = popScheduler(args);
- var concurrent = popNumber(args, Infinity);
- var sources = args;
- return !sources.length ? EMPTY : sources.length === 1 ? innerFrom(sources[0]) : mergeAll(concurrent)(from(sources, scheduler));
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/observable/never.js
- var NEVER = new Observable(noop);
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/util/argsOrArgArray.js
- var isArray3 = Array.isArray;
- function argsOrArgArray(args) {
- return args.length === 1 && isArray3(args[0]) ? args[0] : args;
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/filter.js
- function filter(predicate, thisArg) {
- return operate(function(source, subscriber) {
- var index = 0;
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
- return predicate.call(thisArg, value, index++) && subscriber.next(value);
- }));
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/bufferTime.js
- function bufferTime(bufferTimeSpan) {
- var _a2, _b;
- var otherArgs = [];
- for (var _i2 = 1; _i2 < arguments.length; _i2++) {
- otherArgs[_i2 - 1] = arguments[_i2];
- }
- var scheduler = (_a2 = popScheduler(otherArgs)) !== null && _a2 !== void 0 ? _a2 : asyncScheduler;
- var bufferCreationInterval = (_b = otherArgs[0]) !== null && _b !== void 0 ? _b : null;
- var maxBufferSize = otherArgs[1] || Infinity;
- return operate(function(source, subscriber) {
- var bufferRecords = [];
- var restartOnEmit = false;
- var emit = function(record) {
- var buffer2 = record.buffer, subs = record.subs;
- subs.unsubscribe();
- arrRemove(bufferRecords, record);
- subscriber.next(buffer2);
- restartOnEmit && startBuffer();
- };
- var startBuffer = function() {
- if (bufferRecords) {
- var subs = new Subscription();
- subscriber.add(subs);
- var buffer2 = [];
- var record_1 = {
- buffer: buffer2,
- subs
- };
- bufferRecords.push(record_1);
- executeSchedule(subs, scheduler, function() {
- return emit(record_1);
- }, bufferTimeSpan);
- }
- };
- if (bufferCreationInterval !== null && bufferCreationInterval >= 0) {
- executeSchedule(subscriber, scheduler, startBuffer, bufferCreationInterval, true);
- } else {
- restartOnEmit = true;
- }
- startBuffer();
- var bufferTimeSubscriber = createOperatorSubscriber(subscriber, function(value) {
- var e_1, _a3;
- var recordsCopy = bufferRecords.slice();
- try {
- for (var recordsCopy_1 = __values(recordsCopy), recordsCopy_1_1 = recordsCopy_1.next(); !recordsCopy_1_1.done; recordsCopy_1_1 = recordsCopy_1.next()) {
- var record = recordsCopy_1_1.value;
- var buffer2 = record.buffer;
- buffer2.push(value);
- maxBufferSize <= buffer2.length && emit(record);
- }
- } catch (e_1_1) {
- e_1 = { error: e_1_1 };
- } finally {
- try {
- if (recordsCopy_1_1 && !recordsCopy_1_1.done && (_a3 = recordsCopy_1.return))
- _a3.call(recordsCopy_1);
- } finally {
- if (e_1)
- throw e_1.error;
- }
- }
- }, function() {
- while (bufferRecords === null || bufferRecords === void 0 ? void 0 : bufferRecords.length) {
- subscriber.next(bufferRecords.shift().buffer);
- }
- bufferTimeSubscriber === null || bufferTimeSubscriber === void 0 ? void 0 : bufferTimeSubscriber.unsubscribe();
- subscriber.complete();
- subscriber.unsubscribe();
- }, void 0, function() {
- return bufferRecords = null;
- });
- source.subscribe(bufferTimeSubscriber);
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/bufferWhen.js
- function bufferWhen(closingSelector) {
- return operate(function(source, subscriber) {
- var buffer2 = null;
- var closingSubscriber = null;
- var openBuffer = function() {
- closingSubscriber === null || closingSubscriber === void 0 ? void 0 : closingSubscriber.unsubscribe();
- var b = buffer2;
- buffer2 = [];
- b && subscriber.next(b);
- innerFrom(closingSelector()).subscribe(closingSubscriber = createOperatorSubscriber(subscriber, openBuffer, noop));
- };
- openBuffer();
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
- return buffer2 === null || buffer2 === void 0 ? void 0 : buffer2.push(value);
- }, function() {
- buffer2 && subscriber.next(buffer2);
- subscriber.complete();
- }, void 0, function() {
- return buffer2 = closingSubscriber = null;
- }));
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/combineLatest.js
- function combineLatest2() {
- var args = [];
- for (var _i2 = 0; _i2 < arguments.length; _i2++) {
- args[_i2] = arguments[_i2];
- }
- var resultSelector = popResultSelector(args);
- return resultSelector ? pipe(combineLatest2.apply(void 0, __spreadArray([], __read(args))), mapOneOrManyArgs(resultSelector)) : operate(function(source, subscriber) {
- combineLatestInit(__spreadArray([source], __read(argsOrArgArray(args))))(subscriber);
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/combineLatestWith.js
- function combineLatestWith() {
- var otherSources = [];
- for (var _i2 = 0; _i2 < arguments.length; _i2++) {
- otherSources[_i2] = arguments[_i2];
- }
- return combineLatest2.apply(void 0, __spreadArray([], __read(otherSources)));
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/debounceTime.js
- function debounceTime(dueTime, scheduler) {
- if (scheduler === void 0) {
- scheduler = asyncScheduler;
- }
- return operate(function(source, subscriber) {
- var activeTask = null;
- var lastValue = null;
- var lastTime = null;
- var emit = function() {
- if (activeTask) {
- activeTask.unsubscribe();
- activeTask = null;
- var value = lastValue;
- lastValue = null;
- subscriber.next(value);
- }
- };
- function emitWhenIdle() {
- var targetTime = lastTime + dueTime;
- var now = scheduler.now();
- if (now < targetTime) {
- activeTask = this.schedule(void 0, targetTime - now);
- subscriber.add(activeTask);
- return;
- }
- emit();
- }
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
- lastValue = value;
- lastTime = scheduler.now();
- if (!activeTask) {
- activeTask = scheduler.schedule(emitWhenIdle, dueTime);
- subscriber.add(activeTask);
- }
- }, function() {
- emit();
- subscriber.complete();
- }, void 0, function() {
- lastValue = activeTask = null;
- }));
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/defaultIfEmpty.js
- function defaultIfEmpty(defaultValue) {
- return operate(function(source, subscriber) {
- var hasValue = false;
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
- hasValue = true;
- subscriber.next(value);
- }, function() {
- if (!hasValue) {
- subscriber.next(defaultValue);
- }
- subscriber.complete();
- }));
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/take.js
- function take(count2) {
- return count2 <= 0 ? function() {
- return EMPTY;
- } : operate(function(source, subscriber) {
- var seen = 0;
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
- if (++seen <= count2) {
- subscriber.next(value);
- if (count2 <= seen) {
- subscriber.complete();
- }
- }
- }));
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/distinctUntilChanged.js
- function distinctUntilChanged(comparator, keySelector) {
- if (keySelector === void 0) {
- keySelector = identity;
- }
- comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;
- return operate(function(source, subscriber) {
- var previousKey;
- var first2 = true;
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
- var currentKey = keySelector(value);
- if (first2 || !comparator(previousKey, currentKey)) {
- first2 = false;
- previousKey = currentKey;
- subscriber.next(value);
- }
- }));
- });
- }
- function defaultCompare(a, b) {
- return a === b;
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/throwIfEmpty.js
- function throwIfEmpty(errorFactory) {
- if (errorFactory === void 0) {
- errorFactory = defaultErrorFactory;
- }
- return operate(function(source, subscriber) {
- var hasValue = false;
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
- hasValue = true;
- subscriber.next(value);
- }, function() {
- return hasValue ? subscriber.complete() : subscriber.error(errorFactory());
- }));
- });
- }
- function defaultErrorFactory() {
- return new EmptyError();
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/first.js
- function first(predicate, defaultValue) {
- var hasDefaultValue = arguments.length >= 2;
- return function(source) {
- return source.pipe(predicate ? filter(function(v, i) {
- return predicate(v, i, source);
- }) : identity, take(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(function() {
- return new EmptyError();
- }));
- };
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/share.js
- function share(options) {
- if (options === void 0) {
- options = {};
- }
- var _a2 = options.connector, connector = _a2 === void 0 ? function() {
- return new Subject();
- } : _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;
- return function(wrapperSource) {
- var connection;
- var resetConnection;
- var subject;
- var refCount2 = 0;
- var hasCompleted = false;
- var hasErrored = false;
- var cancelReset = function() {
- resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe();
- resetConnection = void 0;
- };
- var reset = function() {
- cancelReset();
- connection = subject = void 0;
- hasCompleted = hasErrored = false;
- };
- var resetAndUnsubscribe = function() {
- var conn = connection;
- reset();
- conn === null || conn === void 0 ? void 0 : conn.unsubscribe();
- };
- return operate(function(source, subscriber) {
- refCount2++;
- if (!hasErrored && !hasCompleted) {
- cancelReset();
- }
- var dest = subject = subject !== null && subject !== void 0 ? subject : connector();
- subscriber.add(function() {
- refCount2--;
- if (refCount2 === 0 && !hasErrored && !hasCompleted) {
- resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero);
- }
- });
- dest.subscribe(subscriber);
- if (!connection && refCount2 > 0) {
- connection = new SafeSubscriber({
- next: function(value) {
- return dest.next(value);
- },
- error: function(err) {
- hasErrored = true;
- cancelReset();
- resetConnection = handleReset(reset, resetOnError, err);
- dest.error(err);
- },
- complete: function() {
- hasCompleted = true;
- cancelReset();
- resetConnection = handleReset(reset, resetOnComplete);
- dest.complete();
- }
- });
- innerFrom(source).subscribe(connection);
- }
- })(wrapperSource);
- };
- }
- function handleReset(reset, on2) {
- var args = [];
- for (var _i2 = 2; _i2 < arguments.length; _i2++) {
- args[_i2 - 2] = arguments[_i2];
- }
- if (on2 === true) {
- reset();
- return;
- }
- if (on2 === false) {
- return;
- }
- var onSubscriber = new SafeSubscriber({
- next: function() {
- onSubscriber.unsubscribe();
- reset();
- }
- });
- return innerFrom(on2.apply(void 0, __spreadArray([], __read(args)))).subscribe(onSubscriber);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/shareReplay.js
- function shareReplay(configOrBufferSize, windowTime2, scheduler) {
- var _a2, _b, _c2;
- var bufferSize;
- var refCount2 = false;
- if (configOrBufferSize && typeof configOrBufferSize === "object") {
- _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;
- } else {
- bufferSize = configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity;
- }
- return share({
- connector: function() {
- return new ReplaySubject(bufferSize, windowTime2, scheduler);
- },
- resetOnError: true,
- resetOnComplete: false,
- resetOnRefCountZero: refCount2
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/skip.js
- function skip(count2) {
- return filter(function(_, index) {
- return count2 <= index;
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/startWith.js
- function startWith() {
- var values = [];
- for (var _i2 = 0; _i2 < arguments.length; _i2++) {
- values[_i2] = arguments[_i2];
- }
- var scheduler = popScheduler(values);
- return operate(function(source, subscriber) {
- (scheduler ? concat(values, source, scheduler) : concat(values, source)).subscribe(subscriber);
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/switchMap.js
- function switchMap(project, resultSelector) {
- return operate(function(source, subscriber) {
- var innerSubscriber = null;
- var index = 0;
- var isComplete = false;
- var checkComplete = function() {
- return isComplete && !innerSubscriber && subscriber.complete();
- };
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
- innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();
- var innerIndex = 0;
- var outerIndex = index++;
- innerFrom(project(value, outerIndex)).subscribe(innerSubscriber = createOperatorSubscriber(subscriber, function(innerValue) {
- return subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue);
- }, function() {
- innerSubscriber = null;
- checkComplete();
- }));
- }, function() {
- isComplete = true;
- checkComplete();
- }));
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/takeUntil.js
- function takeUntil(notifier) {
- return operate(function(source, subscriber) {
- innerFrom(notifier).subscribe(createOperatorSubscriber(subscriber, function() {
- return subscriber.complete();
- }, noop));
- !subscriber.closed && source.subscribe(subscriber);
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/tap.js
- function tap(observerOrNext, error, complete) {
- var tapObserver = isFunction(observerOrNext) || error || complete ? { next: observerOrNext, error, complete } : observerOrNext;
- return tapObserver ? operate(function(source, subscriber) {
- var _a2;
- (_a2 = tapObserver.subscribe) === null || _a2 === void 0 ? void 0 : _a2.call(tapObserver);
- var isUnsub = true;
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
- var _a3;
- (_a3 = tapObserver.next) === null || _a3 === void 0 ? void 0 : _a3.call(tapObserver, value);
- subscriber.next(value);
- }, function() {
- var _a3;
- isUnsub = false;
- (_a3 = tapObserver.complete) === null || _a3 === void 0 ? void 0 : _a3.call(tapObserver);
- subscriber.complete();
- }, function(err) {
- var _a3;
- isUnsub = false;
- (_a3 = tapObserver.error) === null || _a3 === void 0 ? void 0 : _a3.call(tapObserver, err);
- subscriber.error(err);
- }, function() {
- var _a3, _b;
- if (isUnsub) {
- (_a3 = tapObserver.unsubscribe) === null || _a3 === void 0 ? void 0 : _a3.call(tapObserver);
- }
- (_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);
- }));
- }) : identity;
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/throttle.js
- function throttle(durationSelector, config2) {
- return operate(function(source, subscriber) {
- 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;
- var hasValue = false;
- var sendValue = null;
- var throttled = null;
- var isComplete = false;
- var endThrottling = function() {
- throttled === null || throttled === void 0 ? void 0 : throttled.unsubscribe();
- throttled = null;
- if (trailing) {
- send();
- isComplete && subscriber.complete();
- }
- };
- var cleanupThrottling = function() {
- throttled = null;
- isComplete && subscriber.complete();
- };
- var startThrottle = function(value) {
- return throttled = innerFrom(durationSelector(value)).subscribe(createOperatorSubscriber(subscriber, endThrottling, cleanupThrottling));
- };
- var send = function() {
- if (hasValue) {
- hasValue = false;
- var value = sendValue;
- sendValue = null;
- subscriber.next(value);
- !isComplete && startThrottle(value);
- }
- };
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
- hasValue = true;
- sendValue = value;
- !(throttled && !throttled.closed) && (leading ? send() : startThrottle(value));
- }, function() {
- isComplete = true;
- !(trailing && hasValue && throttled && !throttled.closed) && subscriber.complete();
- }));
- });
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/throttleTime.js
- function throttleTime(duration, scheduler, config2) {
- if (scheduler === void 0) {
- scheduler = asyncScheduler;
- }
- var duration$ = timer(duration, scheduler);
- return throttle(function() {
- return duration$;
- }, config2);
- }
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/timeInterval.js
- var TimeInterval = function() {
- function TimeInterval2(value, interval2) {
- this.value = value;
- this.interval = interval2;
- }
- return TimeInterval2;
- }();
- // node_modules/.pnpm/rxjs@7.8.1/node_modules/rxjs/dist/esm5/internal/operators/withLatestFrom.js
- function withLatestFrom() {
- var inputs = [];
- for (var _i2 = 0; _i2 < arguments.length; _i2++) {
- inputs[_i2] = arguments[_i2];
- }
- var project = popResultSelector(inputs);
- return operate(function(source, subscriber) {
- var len = inputs.length;
- var otherValues = new Array(len);
- var hasValue = inputs.map(function() {
- return false;
- });
- var ready = false;
- var _loop_1 = function(i2) {
- innerFrom(inputs[i2]).subscribe(createOperatorSubscriber(subscriber, function(value) {
- otherValues[i2] = value;
- if (!ready && !hasValue[i2]) {
- hasValue[i2] = true;
- (ready = hasValue.every(identity)) && (hasValue = null);
- }
- }, noop));
- };
- for (var i = 0; i < len; i++) {
- _loop_1(i);
- }
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
- if (ready) {
- var values = __spreadArray([value], __read(otherValues));
- subscriber.next(project ? project.apply(void 0, __spreadArray([], __read(values))) : values);
- }
- }));
- });
- }
- // 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
- var St = __toESM(require_react());
- var import_react = __toESM(require_react());
- var Ol = Object.defineProperty;
- var bl = (t, e, n) => e in t ? Ol(t, e, { enumerable: true, configurable: true, writable: true, value: n }) : t[e] = n;
- var C = (t, e, n) => bl(t, typeof e != "symbol" ? e + "" : e, n);
- function jl(t, e) {
- for (var n = 0; n < e.length; n++) {
- const r = e[n];
- if (typeof r != "string" && !Array.isArray(r)) {
- for (const s in r)
- if (s !== "default" && !(s in t)) {
- const i = Object.getOwnPropertyDescriptor(r, s);
- i && Object.defineProperty(t, s, i.get ? i : {
- enumerable: true,
- get: () => r[s]
- });
- }
- }
- }
- return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }));
- }
- function Hl() {
- Wl();
- }
- var gr = typeof global < "u" ? global : typeof self < "u" ? self : window;
- function Wl() {
- typeof gr.requestIdleCallback != "function" && (gr.requestIdleCallback = function(n) {
- const r = Date.now();
- return setTimeout(function() {
- const i = Math.max(0, 50 - (Date.now() - r));
- n({
- didTimeout: i === 0,
- timeRemaining() {
- return i;
- }
- });
- }, 1);
- }), typeof gr.cancelIdleCallback != "function" && (gr.cancelIdleCallback = function(n) {
- clearTimeout(n);
- });
- }
- var Pa = typeof global == "object" && global && global.Object === Object && global;
- var zl = typeof self == "object" && self && self.Object === Object && self;
- var En = Pa || zl || Function("return this")();
- var Mn = En.Symbol;
- var ka = Object.prototype;
- var Yl = ka.hasOwnProperty;
- var Vl = ka.toString;
- var Fn = Mn ? Mn.toStringTag : void 0;
- function Gl(t) {
- var e = Yl.call(t, Fn), n = t[Fn];
- try {
- t[Fn] = void 0;
- var r = true;
- } catch {
- }
- var s = Vl.call(t);
- return r && (e ? t[Fn] = n : delete t[Fn]), s;
- }
- var Kl = Object.prototype;
- var Xl = Kl.toString;
- function Jl(t) {
- return Xl.call(t);
- }
- var Zl = "[object Null]";
- var Ql = "[object Undefined]";
- var zi = Mn ? Mn.toStringTag : void 0;
- function ir(t) {
- return t == null ? t === void 0 ? Ql : Zl : zi && zi in Object(t) ? Gl(t) : Jl(t);
- }
- function Un(t) {
- return t != null && typeof t == "object";
- }
- var ql = "[object Symbol]";
- function os(t) {
- return typeof t == "symbol" || Un(t) && ir(t) == ql;
- }
- function ec(t, e) {
- for (var n = -1, r = t == null ? 0 : t.length, s = Array(r); ++n < r; )
- s[n] = e(t[n], n, t);
- return s;
- }
- var Dn = Array.isArray;
- var Yi = Mn ? Mn.prototype : void 0;
- var Vi = Yi ? Yi.toString : void 0;
- function Fa(t) {
- if (typeof t == "string")
- return t;
- if (Dn(t))
- return ec(t, Fa) + "";
- if (os(t))
- return Vi ? Vi.call(t) : "";
- var e = t + "";
- return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
- }
- var tc = /\s/;
- function nc(t) {
- for (var e = t.length; e-- && tc.test(t.charAt(e)); )
- ;
- return e;
- }
- var rc = /^\s+/;
- function sc(t) {
- return t && t.slice(0, nc(t) + 1).replace(rc, "");
- }
- function yt(t) {
- var e = typeof t;
- return t != null && (e == "object" || e == "function");
- }
- var Gi = NaN;
- var ic = /^[-+]0x[0-9a-f]+$/i;
- var oc = /^0b[01]+$/i;
- var ac = /^0o[0-7]+$/i;
- var uc = parseInt;
- function Ki(t) {
- if (typeof t == "number")
- return t;
- if (os(t))
- return Gi;
- if (yt(t)) {
- var e = typeof t.valueOf == "function" ? t.valueOf() : t;
- t = yt(e) ? e + "" : e;
- }
- if (typeof t != "string")
- return t === 0 ? t : +t;
- t = sc(t);
- var n = oc.test(t);
- return n || ac.test(t) ? uc(t.slice(2), n ? 2 : 8) : ic.test(t) ? Gi : +t;
- }
- function $a(t) {
- return t;
- }
- var lc = "[object AsyncFunction]";
- var cc = "[object Function]";
- var hc = "[object GeneratorFunction]";
- var dc = "[object Proxy]";
- function Ci(t) {
- if (!yt(t))
- return false;
- var e = ir(t);
- return e == cc || e == hc || e == lc || e == dc;
- }
- var Cs = En["__core-js_shared__"];
- var Xi = function() {
- var t = /[^.]+$/.exec(Cs && Cs.keys && Cs.keys.IE_PROTO || "");
- return t ? "Symbol(src)_1." + t : "";
- }();
- function fc(t) {
- return !!Xi && Xi in t;
- }
- var gc = Function.prototype;
- var pc = gc.toString;
- function mc(t) {
- if (t != null) {
- try {
- return pc.call(t);
- } catch {
- }
- try {
- return t + "";
- } catch {
- }
- }
- return "";
- }
- var _c = /[\\^$.*+?()[\]{}|]/g;
- var Ec = /^\[object .+?Constructor\]$/;
- var Cc = Function.prototype;
- var Rc = Object.prototype;
- var Ic = Cc.toString;
- var vc = Rc.hasOwnProperty;
- var yc = RegExp(
- "^" + Ic.call(vc).replace(_c, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
- );
- function wc(t) {
- if (!yt(t) || fc(t))
- return false;
- var e = Ci(t) ? yc : Ec;
- return e.test(mc(t));
- }
- function Oc(t, e) {
- return t == null ? void 0 : t[e];
- }
- function Ri(t, e) {
- var n = Oc(t, e);
- return wc(n) ? n : void 0;
- }
- var Ji = Object.create;
- var bc = function() {
- function t() {
- }
- return function(e) {
- if (!yt(e))
- return {};
- if (Ji)
- return Ji(e);
- t.prototype = e;
- var n = new t();
- return t.prototype = void 0, n;
- };
- }();
- function Sc(t, e, n) {
- switch (n.length) {
- case 0:
- return t.call(e);
- case 1:
- return t.call(e, n[0]);
- case 2:
- return t.call(e, n[0], n[1]);
- case 3:
- return t.call(e, n[0], n[1], n[2]);
- }
- return t.apply(e, n);
- }
- function Ac(t, e) {
- var n = -1, r = t.length;
- for (e || (e = Array(r)); ++n < r; )
- e[n] = t[n];
- return e;
- }
- var Nc = 800;
- var Tc = 16;
- var Mc = Date.now;
- function Dc(t) {
- var e = 0, n = 0;
- return function() {
- var r = Mc(), s = Tc - (r - n);
- if (n = r, s > 0) {
- if (++e >= Nc)
- return arguments[0];
- } else
- e = 0;
- return t.apply(void 0, arguments);
- };
- }
- function xc(t) {
- return function() {
- return t;
- };
- }
- var Kr = function() {
- try {
- var t = Ri(Object, "defineProperty");
- return t({}, "", {}), t;
- } catch {
- }
- }();
- var Lc = Kr ? function(t, e) {
- return Kr(t, "toString", {
- configurable: true,
- enumerable: false,
- value: xc(e),
- writable: true
- });
- } : $a;
- var Uc = Dc(Lc);
- var Pc = 9007199254740991;
- var kc = /^(?:0|[1-9]\d*)$/;
- function Ii(t, e) {
- var n = typeof t;
- return e = e == null ? Pc : e, !!e && (n == "number" || n != "symbol" && kc.test(t)) && t > -1 && t % 1 == 0 && t < e;
- }
- function vi(t, e, n) {
- e == "__proto__" && Kr ? Kr(t, e, {
- configurable: true,
- enumerable: true,
- value: n,
- writable: true
- }) : t[e] = n;
- }
- function as(t, e) {
- return t === e || t !== t && e !== e;
- }
- var Fc = Object.prototype;
- var $c = Fc.hasOwnProperty;
- function Ba(t, e, n) {
- var r = t[e];
- (!($c.call(t, e) && as(r, n)) || n === void 0 && !(e in t)) && vi(t, e, n);
- }
- function Bc(t, e, n, r) {
- var s = !n;
- n || (n = {});
- for (var i = -1, o = e.length; ++i < o; ) {
- var a = e[i], u = void 0;
- u === void 0 && (u = t[a]), s ? vi(n, a, u) : Ba(n, a, u);
- }
- return n;
- }
- var Zi = Math.max;
- function jc(t, e, n) {
- return e = Zi(e === void 0 ? t.length - 1 : e, 0), function() {
- for (var r = arguments, s = -1, i = Zi(r.length - e, 0), o = Array(i); ++s < i; )
- o[s] = r[e + s];
- s = -1;
- for (var a = Array(e + 1); ++s < e; )
- a[s] = r[s];
- return a[e] = n(o), Sc(t, this, a);
- };
- }
- function Hc(t, e) {
- return Uc(jc(t, e, $a), t + "");
- }
- var Wc = 9007199254740991;
- function ja(t) {
- return typeof t == "number" && t > -1 && t % 1 == 0 && t <= Wc;
- }
- function yi(t) {
- return t != null && ja(t.length) && !Ci(t);
- }
- function zc(t, e, n) {
- if (!yt(n))
- return false;
- var r = typeof e;
- return (r == "number" ? yi(n) && Ii(e, n.length) : r == "string" && e in n) ? as(n[e], t) : false;
- }
- function Ha(t) {
- return Hc(function(e, n) {
- var r = -1, s = n.length, i = s > 1 ? n[s - 1] : void 0, o = s > 2 ? n[2] : void 0;
- 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; ) {
- var a = n[r];
- a && t(e, a, r, i);
- }
- return e;
- });
- }
- var Yc = Object.prototype;
- function Wa(t) {
- var e = t && t.constructor, n = typeof e == "function" && e.prototype || Yc;
- return t === n;
- }
- function Vc(t, e) {
- for (var n = -1, r = Array(t); ++n < t; )
- r[n] = e(n);
- return r;
- }
- var Gc = "[object Arguments]";
- function Qi(t) {
- return Un(t) && ir(t) == Gc;
- }
- var za = Object.prototype;
- var Kc = za.hasOwnProperty;
- var Xc = za.propertyIsEnumerable;
- var Fs = Qi(function() {
- return arguments;
- }()) ? Qi : function(t) {
- return Un(t) && Kc.call(t, "callee") && !Xc.call(t, "callee");
- };
- function Jc() {
- return false;
- }
- var Ya = typeof exports == "object" && exports && !exports.nodeType && exports;
- var qi = Ya && typeof module == "object" && module && !module.nodeType && module;
- var Zc = qi && qi.exports === Ya;
- var eo = Zc ? En.Buffer : void 0;
- var Qc = eo ? eo.isBuffer : void 0;
- var Va = Qc || Jc;
- var qc = "[object Arguments]";
- var eh = "[object Array]";
- var th = "[object Boolean]";
- var nh = "[object Date]";
- var rh = "[object Error]";
- var sh = "[object Function]";
- var ih = "[object Map]";
- var oh = "[object Number]";
- var ah = "[object Object]";
- var uh = "[object RegExp]";
- var lh = "[object Set]";
- var ch = "[object String]";
- var hh = "[object WeakMap]";
- var dh = "[object ArrayBuffer]";
- var fh = "[object DataView]";
- var gh = "[object Float32Array]";
- var ph = "[object Float64Array]";
- var mh = "[object Int8Array]";
- var _h = "[object Int16Array]";
- var Eh = "[object Int32Array]";
- var Ch = "[object Uint8Array]";
- var Rh = "[object Uint8ClampedArray]";
- var Ih = "[object Uint16Array]";
- var vh = "[object Uint32Array]";
- var Qe = {};
- Qe[gh] = Qe[ph] = Qe[mh] = Qe[_h] = Qe[Eh] = Qe[Ch] = Qe[Rh] = Qe[Ih] = Qe[vh] = true;
- 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;
- function yh(t) {
- return Un(t) && ja(t.length) && !!Qe[ir(t)];
- }
- function wh(t) {
- return function(e) {
- return t(e);
- };
- }
- var Ga = typeof exports == "object" && exports && !exports.nodeType && exports;
- var Jn = Ga && typeof module == "object" && module && !module.nodeType && module;
- var Oh = Jn && Jn.exports === Ga;
- var Rs = Oh && Pa.process;
- var to = function() {
- try {
- var t = Jn && Jn.require && Jn.require("util").types;
- return t || Rs && Rs.binding && Rs.binding("util");
- } catch {
- }
- }();
- var no = to && to.isTypedArray;
- var Ka = no ? wh(no) : yh;
- function bh(t, e) {
- 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;
- for (var c in t)
- o && // Safari 9 has enumerable `arguments.length` in strict mode.
- (c == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
- s && (c == "offset" || c == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
- i && (c == "buffer" || c == "byteLength" || c == "byteOffset") || // Skip index properties.
- Ii(c, u)) || a.push(c);
- return a;
- }
- function Sh(t, e) {
- return function(n) {
- return t(e(n));
- };
- }
- function Ah(t) {
- var e = [];
- if (t != null)
- for (var n in Object(t))
- e.push(n);
- return e;
- }
- var Nh = Object.prototype;
- var Th = Nh.hasOwnProperty;
- function Mh(t) {
- if (!yt(t))
- return Ah(t);
- var e = Wa(t), n = [];
- for (var r in t)
- r == "constructor" && (e || !Th.call(t, r)) || n.push(r);
- return n;
- }
- function Xa(t) {
- return yi(t) ? bh(t) : Mh(t);
- }
- var Dh = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
- var xh = /^\w*$/;
- function Lh(t, e) {
- if (Dn(t))
- return false;
- var n = typeof t;
- return n == "number" || n == "symbol" || n == "boolean" || t == null || os(t) ? true : xh.test(t) || !Dh.test(t) || e != null && t in Object(e);
- }
- var qn = Ri(Object, "create");
- function Uh() {
- this.__data__ = qn ? qn(null) : {}, this.size = 0;
- }
- function Ph(t) {
- var e = this.has(t) && delete this.__data__[t];
- return this.size -= e ? 1 : 0, e;
- }
- var kh = "__lodash_hash_undefined__";
- var Fh = Object.prototype;
- var $h = Fh.hasOwnProperty;
- function Bh(t) {
- var e = this.__data__;
- if (qn) {
- var n = e[t];
- return n === kh ? void 0 : n;
- }
- return $h.call(e, t) ? e[t] : void 0;
- }
- var jh = Object.prototype;
- var Hh = jh.hasOwnProperty;
- function Wh(t) {
- var e = this.__data__;
- return qn ? e[t] !== void 0 : Hh.call(e, t);
- }
- var zh = "__lodash_hash_undefined__";
- function Yh(t, e) {
- var n = this.__data__;
- return this.size += this.has(t) ? 0 : 1, n[t] = qn && e === void 0 ? zh : e, this;
- }
- function pn(t) {
- var e = -1, n = t == null ? 0 : t.length;
- for (this.clear(); ++e < n; ) {
- var r = t[e];
- this.set(r[0], r[1]);
- }
- }
- pn.prototype.clear = Uh;
- pn.prototype.delete = Ph;
- pn.prototype.get = Bh;
- pn.prototype.has = Wh;
- pn.prototype.set = Yh;
- function Vh() {
- this.__data__ = [], this.size = 0;
- }
- function us(t, e) {
- for (var n = t.length; n--; )
- if (as(t[n][0], e))
- return n;
- return -1;
- }
- var Gh = Array.prototype;
- var Kh = Gh.splice;
- function Xh(t) {
- var e = this.__data__, n = us(e, t);
- if (n < 0)
- return false;
- var r = e.length - 1;
- return n == r ? e.pop() : Kh.call(e, n, 1), --this.size, true;
- }
- function Jh(t) {
- var e = this.__data__, n = us(e, t);
- return n < 0 ? void 0 : e[n][1];
- }
- function Zh(t) {
- return us(this.__data__, t) > -1;
- }
- function Qh(t, e) {
- var n = this.__data__, r = us(n, t);
- return r < 0 ? (++this.size, n.push([t, e])) : n[r][1] = e, this;
- }
- function Wt(t) {
- var e = -1, n = t == null ? 0 : t.length;
- for (this.clear(); ++e < n; ) {
- var r = t[e];
- this.set(r[0], r[1]);
- }
- }
- Wt.prototype.clear = Vh;
- Wt.prototype.delete = Xh;
- Wt.prototype.get = Jh;
- Wt.prototype.has = Zh;
- Wt.prototype.set = Qh;
- var Ja = Ri(En, "Map");
- function qh() {
- this.size = 0, this.__data__ = {
- hash: new pn(),
- map: new (Ja || Wt)(),
- string: new pn()
- };
- }
- function ed(t) {
- var e = typeof t;
- return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
- }
- function ls(t, e) {
- var n = t.__data__;
- return ed(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
- }
- function td(t) {
- var e = ls(this, t).delete(t);
- return this.size -= e ? 1 : 0, e;
- }
- function nd(t) {
- return ls(this, t).get(t);
- }
- function rd(t) {
- return ls(this, t).has(t);
- }
- function sd(t, e) {
- var n = ls(this, t), r = n.size;
- return n.set(t, e), this.size += n.size == r ? 0 : 1, this;
- }
- function nn(t) {
- var e = -1, n = t == null ? 0 : t.length;
- for (this.clear(); ++e < n; ) {
- var r = t[e];
- this.set(r[0], r[1]);
- }
- }
- nn.prototype.clear = qh;
- nn.prototype.delete = td;
- nn.prototype.get = nd;
- nn.prototype.has = rd;
- nn.prototype.set = sd;
- var id = "Expected a function";
- function wi(t, e) {
- if (typeof t != "function" || e != null && typeof e != "function")
- throw new TypeError(id);
- var n = function() {
- var r = arguments, s = e ? e.apply(this, r) : r[0], i = n.cache;
- if (i.has(s))
- return i.get(s);
- var o = t.apply(this, r);
- return n.cache = i.set(s, o) || i, o;
- };
- return n.cache = new (wi.Cache || nn)(), n;
- }
- wi.Cache = nn;
- var od = 500;
- function ad(t) {
- var e = wi(t, function(r) {
- return n.size === od && n.clear(), r;
- }), n = e.cache;
- return e;
- }
- var ud = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
- var ld = /\\(\\)?/g;
- var cd = ad(function(t) {
- var e = [];
- return t.charCodeAt(0) === 46 && e.push(""), t.replace(ud, function(n, r, s, i) {
- e.push(s ? i.replace(ld, "$1") : r || n);
- }), e;
- });
- function hd(t) {
- return t == null ? "" : Fa(t);
- }
- function Za(t, e) {
- return Dn(t) ? t : Lh(t, e) ? [t] : cd(hd(t));
- }
- function Qa(t) {
- if (typeof t == "string" || os(t))
- return t;
- var e = t + "";
- return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
- }
- function dd(t, e) {
- e = Za(e, t);
- for (var n = 0, r = e.length; t != null && n < r; )
- t = t[Qa(e[n++])];
- return n && n == r ? t : void 0;
- }
- function b0(t, e, n) {
- var r = t == null ? void 0 : dd(t, e);
- return r === void 0 ? n : r;
- }
- var qa = Sh(Object.getPrototypeOf, Object);
- var fd = "[object Object]";
- var gd = Function.prototype;
- var pd = Object.prototype;
- var eu = gd.toString;
- var md = pd.hasOwnProperty;
- var _d = eu.call(Object);
- function Ed(t) {
- if (!Un(t) || ir(t) != fd)
- return false;
- var e = qa(t);
- if (e === null)
- return true;
- var n = md.call(e, "constructor") && e.constructor;
- return typeof n == "function" && n instanceof n && eu.call(n) == _d;
- }
- function Cd() {
- this.__data__ = new Wt(), this.size = 0;
- }
- function Rd(t) {
- var e = this.__data__, n = e.delete(t);
- return this.size = e.size, n;
- }
- function Id(t) {
- return this.__data__.get(t);
- }
- function vd(t) {
- return this.__data__.has(t);
- }
- var yd = 200;
- function wd(t, e) {
- var n = this.__data__;
- if (n instanceof Wt) {
- var r = n.__data__;
- if (!Ja || r.length < yd - 1)
- return r.push([t, e]), this.size = ++n.size, this;
- n = this.__data__ = new nn(r);
- }
- return n.set(t, e), this.size = n.size, this;
- }
- function Pn(t) {
- var e = this.__data__ = new Wt(t);
- this.size = e.size;
- }
- Pn.prototype.clear = Cd;
- Pn.prototype.delete = Rd;
- Pn.prototype.get = Id;
- Pn.prototype.has = vd;
- Pn.prototype.set = wd;
- var tu = typeof exports == "object" && exports && !exports.nodeType && exports;
- var ro = tu && typeof module == "object" && module && !module.nodeType && module;
- var Od = ro && ro.exports === tu;
- var so = Od ? En.Buffer : void 0;
- so && so.allocUnsafe;
- function bd(t, e) {
- return t.slice();
- }
- var io = En.Uint8Array;
- function Sd(t) {
- var e = new t.constructor(t.byteLength);
- return new io(e).set(new io(t)), e;
- }
- function Ad(t, e) {
- var n = Sd(t.buffer);
- return new t.constructor(n, t.byteOffset, t.length);
- }
- function Nd(t) {
- return typeof t.constructor == "function" && !Wa(t) ? bc(qa(t)) : {};
- }
- function Td(t) {
- return function(e, n, r) {
- for (var s = -1, i = Object(e), o = r(e), a = o.length; a--; ) {
- var u = o[++s];
- if (n(i[u], u, i) === false)
- break;
- }
- return e;
- };
- }
- var Md = Td();
- var Is = function() {
- return En.Date.now();
- };
- var Dd = "Expected a function";
- var xd = Math.max;
- var Ld = Math.min;
- function S0(t, e, n) {
- var r, s, i, o, a, u, c = 0, l = false, h = false, d = true;
- if (typeof t != "function")
- throw new TypeError(Dd);
- 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);
- function f(A) {
- var H = r, Z = s;
- return r = s = void 0, c = A, o = t.apply(Z, H), o;
- }
- function E(A) {
- return c = A, a = setTimeout(U, e), l ? f(A) : o;
- }
- function R(A) {
- var H = A - u, Z = A - c, fe = e - H;
- return h ? Ld(fe, i - Z) : fe;
- }
- function O(A) {
- var H = A - u, Z = A - c;
- return u === void 0 || H >= e || H < 0 || h && Z >= i;
- }
- function U() {
- var A = Is();
- if (O(A))
- return ne(A);
- a = setTimeout(U, R(A));
- }
- function ne(A) {
- return a = void 0, d && r ? f(A) : (r = s = void 0, o);
- }
- function X() {
- a !== void 0 && clearTimeout(a), c = 0, r = u = s = a = void 0;
- }
- function de() {
- return a === void 0 ? o : ne(Is());
- }
- function T() {
- var A = Is(), H = O(A);
- if (r = arguments, s = this, u = A, H) {
- if (a === void 0)
- return E(u);
- if (h)
- return clearTimeout(a), a = setTimeout(U, e), f(u);
- }
- return a === void 0 && (a = setTimeout(U, e)), o;
- }
- return T.cancel = X, T.flush = de, T;
- }
- function $s(t, e, n) {
- (n !== void 0 && !as(t[e], n) || n === void 0 && !(e in t)) && vi(t, e, n);
- }
- function Ud(t) {
- return Un(t) && yi(t);
- }
- function Bs(t, e) {
- if (!(e === "constructor" && typeof t[e] == "function") && e != "__proto__")
- return t[e];
- }
- function Pd(t) {
- return Bc(t, Xa(t));
- }
- function kd(t, e, n, r, s, i, o) {
- var a = Bs(t, n), u = Bs(e, n), c = o.get(u);
- if (c) {
- $s(t, n, c);
- return;
- }
- var l = i ? i(a, u, n + "", t, e, o) : void 0, h = l === void 0;
- if (h) {
- var d = Dn(u), f = !d && Va(u), E = !d && !f && Ka(u);
- 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;
- }
- h && (o.set(u, l), s(l, u, r, i, o), o.delete(u)), $s(t, n, l);
- }
- function Oi(t, e, n, r, s) {
- t !== e && Md(e, function(i, o) {
- if (s || (s = new Pn()), yt(i))
- kd(t, e, o, n, Oi, r, s);
- else {
- var a = r ? r(Bs(t, o), i, o + "", t, e, s) : void 0;
- a === void 0 && (a = i), $s(t, o, a);
- }
- }, Xa);
- }
- var A0 = Ha(function(t, e, n, r) {
- Oi(t, e, n, r);
- });
- var nu = Ha(function(t, e, n) {
- Oi(t, e, n);
- });
- function Fd(t, e, n, r) {
- if (!yt(t))
- return t;
- e = Za(e, t);
- for (var s = -1, i = e.length, o = i - 1, a = t; a != null && ++s < i; ) {
- var u = Qa(e[s]), c = n;
- if (u === "__proto__" || u === "constructor" || u === "prototype")
- return t;
- if (s != o) {
- var l = a[u];
- c = void 0, c === void 0 && (c = yt(l) ? l : Ii(e[s + 1]) ? [] : {});
- }
- Ba(a, u, c), a = a[u];
- }
- return t;
- }
- function N0(t, e, n) {
- return t == null ? t : Fd(t, e, n);
- }
- function wt(t) {
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
- }
- var vs;
- var oo;
- function $d() {
- if (oo)
- return vs;
- oo = 1;
- var t = -1, e = 1, n = 0;
- function r(m, j, y, M, b) {
- if (m === j)
- return m ? [[n, m]] : [];
- if (y != null) {
- var w = fe(m, j, y);
- if (w)
- return w;
- }
- var k = a(m, j), $ = m.substring(0, k);
- m = m.substring(k), j = j.substring(k), k = c(m, j);
- var Y = m.substring(m.length - k);
- m = m.substring(0, m.length - k), j = j.substring(0, j.length - k);
- var se = s(m, j);
- return $ && se.unshift([n, $]), Y && se.push([n, Y]), ne(se, b), M && h(se), se;
- }
- function s(m, j) {
- var y;
- if (!m)
- return [[e, j]];
- if (!j)
- return [[t, m]];
- var M = m.length > j.length ? m : j, b = m.length > j.length ? j : m, w = M.indexOf(b);
- if (w !== -1)
- return y = [
- [e, M.substring(0, w)],
- [n, b],
- [e, M.substring(w + b.length)]
- ], m.length > j.length && (y[0][0] = y[2][0] = t), y;
- if (b.length === 1)
- return [
- [t, m],
- [e, j]
- ];
- var k = l(m, j);
- if (k) {
- var $ = k[0], Y = k[1], se = k[2], he = k[3], ge = k[4], Ae = r($, se), be = r(Y, he);
- return Ae.concat([[n, ge]], be);
- }
- return i(m, j);
- }
- function i(m, j) {
- 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++)
- $[se] = -1, Y[se] = -1;
- $[w + 1] = 0, Y[w + 1] = 0;
- for (var he = y - M, ge = he % 2 !== 0, Ae = 0, be = 0, v = 0, F = 0, V = 0; V < b; V++) {
- for (var K = -V + Ae; K <= V - be; K += 2) {
- var z = w + K, W;
- K === -V || K !== V && $[z - 1] < $[z + 1] ? W = $[z + 1] : W = $[z - 1] + 1;
- for (var ue = W - K; W < y && ue < M && m.charAt(W) === j.charAt(ue); )
- W++, ue++;
- if ($[z] = W, W > y)
- be += 2;
- else if (ue > M)
- Ae += 2;
- else if (ge) {
- var oe = w + he - K;
- if (oe >= 0 && oe < k && Y[oe] !== -1) {
- var B = y - Y[oe];
- if (W >= B)
- return o(m, j, W, ue);
- }
- }
- }
- for (var ee = -V + v; ee <= V - F; ee += 2) {
- var oe = w + ee, B;
- ee === -V || ee !== V && Y[oe - 1] < Y[oe + 1] ? B = Y[oe + 1] : B = Y[oe - 1] + 1;
- for (var ie = B - ee; B < y && ie < M && m.charAt(y - B - 1) === j.charAt(M - ie - 1); )
- B++, ie++;
- if (Y[oe] = B, B > y)
- F += 2;
- else if (ie > M)
- v += 2;
- else if (!ge) {
- var z = w + he - ee;
- if (z >= 0 && z < k && $[z] !== -1) {
- var W = $[z], ue = w + W - z;
- if (B = y - B, W >= B)
- return o(m, j, W, ue);
- }
- }
- }
- }
- return [
- [t, m],
- [e, j]
- ];
- }
- function o(m, j, y, M) {
- 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, $);
- return Y.concat(se);
- }
- function a(m, j) {
- if (!m || !j || m.charAt(0) !== j.charAt(0))
- return 0;
- for (var y = 0, M = Math.min(m.length, j.length), b = M, w = 0; y < b; )
- m.substring(w, b) == j.substring(w, b) ? (y = b, w = y) : M = b, b = Math.floor((M - y) / 2 + y);
- return X(m.charCodeAt(b - 1)) && b--, b;
- }
- function u(m, j) {
- var y = m.length, M = j.length;
- if (y == 0 || M == 0)
- return 0;
- y > M ? m = m.substring(y - M) : y < M && (j = j.substring(0, y));
- var b = Math.min(y, M);
- if (m == j)
- return b;
- for (var w = 0, k = 1; ; ) {
- var $ = m.substring(b - k), Y = j.indexOf($);
- if (Y == -1)
- return w;
- k += Y, (Y == 0 || m.substring(b - k) == j.substring(0, k)) && (w = k, k++);
- }
- }
- function c(m, j) {
- if (!m || !j || m.slice(-1) !== j.slice(-1))
- return 0;
- for (var y = 0, M = Math.min(m.length, j.length), b = M, w = 0; y < b; )
- 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);
- return de(m.charCodeAt(m.length - b)) && b--, b;
- }
- function l(m, j) {
- var y = m.length > j.length ? m : j, M = m.length > j.length ? j : m;
- if (y.length < 4 || M.length * 2 < y.length)
- return null;
- function b(be, v, F) {
- 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; ) {
- var ee = a(
- be.substring(F),
- v.substring(K)
- ), ie = c(
- be.substring(0, F),
- v.substring(0, K)
- );
- 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));
- }
- return z.length * 2 >= be.length ? [
- W,
- ue,
- oe,
- B,
- z
- ] : null;
- }
- var w = b(
- y,
- M,
- Math.ceil(y.length / 4)
- ), k = b(
- y,
- M,
- Math.ceil(y.length / 2)
- ), $;
- if (!w && !k)
- return null;
- k ? w ? $ = w[4].length > k[4].length ? w : k : $ = k : $ = w;
- var Y, se, he, ge;
- m.length > j.length ? (Y = $[0], se = $[1], he = $[2], ge = $[3]) : (he = $[0], ge = $[1], Y = $[2], se = $[3]);
- var Ae = $[4];
- return [Y, se, he, ge, Ae];
- }
- function h(m) {
- for (var j = false, y = [], M = 0, b = null, w = 0, k = 0, $ = 0, Y = 0, se = 0; w < m.length; )
- 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, [
- t,
- b
- ]), 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++;
- for (j && ne(m), U(m), w = 1; w < m.length; ) {
- if (m[w - 1][0] == t && m[w][0] == e) {
- var he = m[w - 1][1], ge = m[w][1], Ae = u(he, ge), be = u(ge, he);
- Ae >= be ? (Ae >= he.length / 2 || Ae >= ge.length / 2) && (m.splice(w, 0, [
- n,
- ge.substring(0, Ae)
- ]), m[w - 1][1] = he.substring(
- 0,
- he.length - Ae
- ), m[w + 1][1] = ge.substring(Ae), w++) : (be >= he.length / 2 || be >= ge.length / 2) && (m.splice(w, 0, [
- n,
- he.substring(0, be)
- ]), m[w - 1][0] = e, m[w - 1][1] = ge.substring(
- 0,
- ge.length - be
- ), m[w + 1][0] = t, m[w + 1][1] = he.substring(be), w++), w++;
- }
- w++;
- }
- }
- var d = /[^a-zA-Z0-9]/, f = /\s/, E = /[\r\n]/, R = /\n\r?\n$/, O = /^\r?\n\r?\n/;
- function U(m) {
- function j(be, v) {
- if (!be || !v)
- return 6;
- 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);
- return ee || ie ? 5 : oe || B ? 4 : K && !W && ue ? 3 : W || ue ? 2 : K || z ? 1 : 0;
- }
- for (var y = 1; y < m.length - 1; ) {
- if (m[y - 1][0] == n && m[y + 1][0] == n) {
- var M = m[y - 1][1], b = m[y][1], w = m[y + 1][1], k = c(M, b);
- if (k) {
- var $ = b.substring(b.length - k);
- M = M.substring(0, M.length - k), b = $ + b.substring(0, b.length - k), w = $ + w;
- }
- for (var Y = M, se = b, he = w, ge = j(M, b) + j(b, w); b.charAt(0) === w.charAt(0); ) {
- M += b.charAt(0), b = b.substring(1) + w.charAt(0), w = w.substring(1);
- var Ae = j(M, b) + j(b, w);
- Ae >= ge && (ge = Ae, Y = M, se = b, he = w);
- }
- 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--));
- }
- y++;
- }
- }
- function ne(m, j) {
- m.push([n, ""]);
- for (var y = 0, M = 0, b = 0, w = "", k = "", $; y < m.length; ) {
- if (y < m.length - 1 && !m[y][1]) {
- m.splice(y, 1);
- continue;
- }
- switch (m[y][0]) {
- case e:
- b++, k += m[y][1], y++;
- break;
- case t:
- M++, w += m[y][1], y++;
- break;
- case n:
- var Y = y - b - M - 1;
- if (j) {
- if (Y >= 0 && A(m[Y][1])) {
- var se = m[Y][1].slice(-1);
- if (m[Y][1] = m[Y][1].slice(
- 0,
- -1
- ), w = se + w, k = se + k, !m[Y][1]) {
- m.splice(Y, 1), y--;
- var he = Y - 1;
- 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;
- }
- }
- if (T(m[y][1])) {
- var se = m[y][1].charAt(0);
- m[y][1] = m[y][1].slice(1), w += se, k += se;
- }
- }
- if (y < m.length - 1 && !m[y][1]) {
- m.splice(y, 1);
- break;
- }
- if (w.length > 0 || k.length > 0) {
- w.length > 0 && k.length > 0 && ($ = a(k, w), $ !== 0 && (Y >= 0 ? m[Y][1] += k.substring(
- 0,
- $
- ) : (m.splice(0, 0, [
- n,
- k.substring(0, $)
- ]), y++), k = k.substring($), w = w.substring($)), $ = c(k, w), $ !== 0 && (m[y][1] = k.substring(k.length - $) + m[y][1], k = k.substring(
- 0,
- k.length - $
- ), w = w.substring(
- 0,
- w.length - $
- )));
- var ge = b + M;
- 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(
- y - ge,
- ge,
- [t, w],
- [e, k]
- ), y = y - ge + 2);
- }
- 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 = "";
- break;
- }
- }
- m[m.length - 1][1] === "" && m.pop();
- var Ae = false;
- for (y = 1; y < m.length - 1; )
- m[y - 1][0] === n && m[y + 1][0] === n && (m[y][1].substring(
- m[y][1].length - m[y - 1][1].length
- ) === m[y - 1][1] ? (m[y][1] = m[y - 1][1] + m[y][1].substring(
- 0,
- m[y][1].length - m[y - 1][1].length
- ), 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++;
- Ae && ne(m, j);
- }
- function X(m) {
- return m >= 55296 && m <= 56319;
- }
- function de(m) {
- return m >= 56320 && m <= 57343;
- }
- function T(m) {
- return de(m.charCodeAt(0));
- }
- function A(m) {
- return X(m.charCodeAt(m.length - 1));
- }
- function H(m) {
- for (var j = [], y = 0; y < m.length; y++)
- m[y][1].length > 0 && j.push(m[y]);
- return j;
- }
- function Z(m, j, y, M) {
- return A(m) || T(M) ? null : H([
- [n, m],
- [t, j],
- [e, y],
- [n, M]
- ]);
- }
- function fe(m, j, y) {
- var M = typeof y == "number" ? { index: y, length: 0 } : y.oldRange, b = typeof y == "number" ? null : y.newRange, w = m.length, k = j.length;
- if (M.length === 0 && (b === null || b.length === 0)) {
- var $ = M.index, Y = m.slice(0, $), se = m.slice($), he = b ? b.index : null;
- e: {
- var ge = $ + k - w;
- if (he !== null && he !== ge || ge < 0 || ge > k)
- break e;
- var Ae = j.slice(0, ge), be = j.slice(ge);
- if (be !== se)
- break e;
- var v = Math.min($, ge), F = Y.slice(0, v), V = Ae.slice(0, v);
- if (F !== V)
- break e;
- var K = Y.slice(v), z = Ae.slice(v);
- return Z(F, K, z, se);
- }
- e: {
- if (he !== null && he !== $)
- break e;
- var W = $, Ae = j.slice(0, W), be = j.slice(W);
- if (Ae !== Y)
- break e;
- var ue = Math.min(w - W, k - W), oe = se.slice(se.length - ue), B = be.slice(be.length - ue);
- if (oe !== B)
- break e;
- var K = se.slice(0, se.length - ue), z = be.slice(0, be.length - ue);
- return Z(Y, K, z, oe);
- }
- }
- if (M.length > 0 && b && b.length === 0)
- e: {
- var F = m.slice(0, M.index), oe = m.slice(M.index + M.length), v = F.length, ue = oe.length;
- if (k < v + ue)
- break e;
- var V = j.slice(0, v), B = j.slice(k - ue);
- if (F !== V || oe !== B)
- break e;
- var K = m.slice(v, w - ue), z = j.slice(v, k - ue);
- return Z(F, K, z, oe);
- }
- return null;
- }
- function ae(m, j, y, M) {
- return r(m, j, y, M, true);
- }
- return ae.INSERT = e, ae.DELETE = t, ae.EQUAL = n, vs = ae, vs;
- }
- var Bd = $d();
- var ru = wt(Bd);
- function cs(t, e) {
- const n = t.indexOf(e);
- return n > -1 ? (t.splice(n, 1), true) : false;
- }
- function T0(t) {
- const e = /* @__PURE__ */ new Set(), n = [];
- for (const r of t)
- e.has(r) || (e.add(r), n.push(r));
- return n;
- }
- function jd(t, e) {
- for (let n = t.length - 1; n > -1; n--) {
- const r = t[n];
- if (e(r, n))
- return r;
- }
- return null;
- }
- function M0(t, e) {
- if (t.length === 0)
- return t;
- const n = e % t.length;
- return t.slice(n).concat(t.slice(0, n));
- }
- function D0(t, e) {
- const n = /* @__PURE__ */ new Map();
- return t.forEach((r) => {
- const s = e(r);
- let i = n.get(s);
- n.has(s) || (i = [], n.set(s, i)), i.push(r);
- }), n;
- }
- function x0(t) {
- return Array.isArray(t) ? t : [t];
- }
- function L0(t) {
- return ["true", "false"].includes(t.toLowerCase());
- }
- var or = "__INTERNAL_EDITOR__";
- var su = `${or}DOCS_NORMAL`;
- var iu = `${or}DOCS_FORMULA_BAR`;
- var Hd = `${or}ZEN_EDITOR`;
- var Wd = `\r
- `;
- var U0 = "isRowStylePrecedeColumnStyle";
- var P0 = Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");
- function k0(t) {
- return `${or}${t}`;
- }
- function zd(t) {
- return t.startsWith(or);
- }
- var bi = Symbol("$$IDENTIFIER_DECORATOR");
- function Yd(t) {
- return t && t[bi] === true;
- }
- function ou(t) {
- return typeof t == "function";
- }
- function ao(t) {
- return !!(t && typeof t.useClass < "u");
- }
- function uo(t) {
- return !!(t && typeof t.useFactory < "u");
- }
- function lo(t) {
- return !!(t && typeof t.useValue < "u");
- }
- function Vd(t) {
- return !!(t && typeof t.useExisting < "u");
- }
- function co(t) {
- return !!(t && typeof t.useAsync < "u");
- }
- var au = Symbol("AsyncHook");
- function ys(t) {
- return !!(t && t.__symbol === au);
- }
- function Et(t) {
- return typeof t > "u" ? "undefined" : ou(t) && !t[bi] ? t.name : t.toString();
- }
- var Gd = function() {
- var t = function(e, n) {
- return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
- r.__proto__ = s;
- } || function(r, s) {
- for (var i in s)
- Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
- }, t(e, n);
- };
- return function(e, n) {
- if (typeof n != "function" && n !== null)
- throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
- t(e, n);
- function r() {
- this.constructor = e;
- }
- e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
- };
- }();
- var at = (
- /** @class */
- function(t) {
- Gd(e, t);
- function e(n) {
- return t.call(this, "[redi]: ".concat(n)) || this;
- }
- return e;
- }(Error)
- );
- var Ge;
- (function(t) {
- t.MANY = "many", t.OPTIONAL = "optional", t.REQUIRED = "required";
- })(Ge || (Ge = {}));
- var $t;
- (function(t) {
- t.SELF = "self", t.SKIP_SELF = "skipSelf";
- })($t || ($t = {}));
- var uu = function() {
- var t = function(e, n) {
- return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
- r.__proto__ = s;
- } || function(r, s) {
- for (var i in s)
- Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
- }, t(e, n);
- };
- return function(e, n) {
- if (typeof n != "function" && n !== null)
- throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
- t(e, n);
- function r() {
- this.constructor = e;
- }
- e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
- };
- }();
- var ho = Symbol("$$TARGET");
- var js = Symbol("$$DEPENDENCIES");
- var Kd = (
- /** @class */
- function(t) {
- uu(e, t);
- function e(n, r) {
- var s = "Could not find dependency registered on the ".concat(n, ' (indexed) parameter of the constructor of "').concat(Et(r), '".');
- return t.call(this, s) || this;
- }
- return e;
- }(at)
- );
- var lu = (
- /** @class */
- function(t) {
- uu(e, t);
- function e(n, r) {
- 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');
- return t.call(this, s) || this;
- }
- return e;
- }(at)
- );
- function cu(t) {
- var e = t;
- return e[js] || [];
- }
- function Si(t, e) {
- var n = cu(t), r = n.find(function(s) {
- return s.paramIndex === e;
- });
- if (!r)
- throw new Kd(e, t);
- return r;
- }
- function Ai(t, e, n, r, s) {
- r === void 0 && (r = Ge.REQUIRED);
- var i = {
- paramIndex: n,
- identifier: e,
- quantity: r,
- lookUp: s,
- withNew: false
- };
- if (typeof e > "u")
- throw new lu(t, n);
- var o = t;
- o[ho] === o ? o[js].push(i) : (o[js] = [i], o[ho] = o);
- }
- var fo = /* @__PURE__ */ new Set();
- function Ct(t) {
- if (fo.has(t))
- throw new at('Identifier "'.concat(t, '" already exists.'));
- fo.add(t);
- var e = function(n, r, s) {
- Ai(n, e, s);
- };
- return e.toString = function() {
- return t;
- }, e[bi] = true, e;
- }
- function Xd(t, e, n) {
- var r = Si(t, e);
- r.lookUp = n;
- }
- function hu(t) {
- return function e() {
- return this instanceof e ? this : function(n, r, s) {
- Xd(n, s, t);
- };
- };
- }
- var Jd = hu($t.SKIP_SELF);
- var Zd = hu($t.SELF);
- var Qd = function() {
- var t = function(e, n) {
- return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
- r.__proto__ = s;
- } || function(r, s) {
- for (var i in s)
- Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
- }, t(e, n);
- };
- return function(e, n) {
- if (typeof n != "function" && n !== null)
- throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
- t(e, n);
- function r() {
- this.constructor = e;
- }
- e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
- };
- }();
- var Hs = (
- /** @class */
- function(t) {
- Qd(e, t);
- function e(n, r, s) {
- var i = this, o = 'Expect "'.concat(r, '" dependency items for id "').concat(Et(n), '" but get ').concat(s, ".");
- 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;
- }
- return e;
- }(at)
- );
- function Ni(t, e, n) {
- if (e === Ge.OPTIONAL && n > 1 || e === Ge.REQUIRED && n !== 1)
- throw new Hs(t, e, n);
- }
- function qd(t, e) {
- return t === Ge.MANY ? e : e[0];
- }
- function ef(t, e, n) {
- var r = Si(t, e);
- r.quantity = n;
- }
- function Ti(t) {
- return function e(n) {
- return this instanceof e ? this : function(r, s, i) {
- if (n)
- Ai(r, n, i, t);
- else {
- if (t === Ge.REQUIRED)
- throw new lu(r, i);
- ef(r, i, t);
- }
- };
- };
- }
- var tf = Ti(Ge.MANY);
- var nf = Ti(Ge.OPTIONAL);
- var ot = Ti(Ge.REQUIRED);
- function rf(t, e, n) {
- var r = Si(t, e);
- r.withNew = n;
- }
- function sf(t) {
- return function e() {
- return this instanceof e ? this : function(n, r, s) {
- rf(n, s, t);
- };
- };
- }
- var of2 = sf(true);
- function du(t, e) {
- return e === void 0 && (e = 0), t ? t.map(function(n, r) {
- if (r += e, !Array.isArray(n))
- return {
- paramIndex: r,
- identifier: n,
- quantity: Ge.REQUIRED,
- withNew: false
- };
- var s = n.slice(0, n.length - 1), i = n[n.length - 1], o, a = Ge.REQUIRED, u = false;
- return s.forEach(function(c) {
- if (c instanceof Zd)
- o = $t.SELF;
- else if (c instanceof Jd)
- o = $t.SKIP_SELF;
- else if (c instanceof nf)
- a = Ge.OPTIONAL;
- else if (c instanceof tf)
- a = Ge.MANY;
- else if (c instanceof of2)
- u = true;
- else
- throw new at("unknown dep modifier ".concat(c, "."));
- }), {
- paramIndex: r,
- identifier: i,
- quantity: a,
- lookUp: o,
- withNew: u
- };
- }) : [];
- }
- function F0(t, e, n) {
- n === void 0 && (n = 0);
- var r = du(e, n);
- r.forEach(function(s) {
- Ai(t, s.identifier, s.paramIndex, s.quantity, s.lookUp);
- });
- }
- function $0(t) {
- return {
- unwrap: t
- };
- }
- function af(t) {
- return !!t && typeof t.unwrap == "function";
- }
- function uf(t) {
- return af(t) ? t.unwrap() : t;
- }
- function go(t) {
- return !!t && typeof t.dispose == "function";
- }
- var fu = function() {
- var t = function(e, n) {
- return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
- r.__proto__ = s;
- } || function(r, s) {
- for (var i in s)
- Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
- }, t(e, n);
- };
- return function(e, n) {
- if (typeof n != "function" && n !== null)
- throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
- t(e, n);
- function r() {
- this.constructor = e;
- }
- e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
- };
- }();
- function lf(t) {
- return t.length === 1;
- }
- var hs = [];
- function po(t) {
- hs.push(t);
- }
- function mo() {
- hs.pop();
- }
- function cf() {
- hs.length = 0;
- }
- var _o = (
- /** @class */
- function(t) {
- fu(e, t);
- function e(n, r, s) {
- 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, '".');
- return t.call(this, i) || this;
- }
- return e;
- }(at)
- );
- var Ur = (
- /** @class */
- function(t) {
- fu(e, t);
- function e(n) {
- var r = this, s = 'Cannot find "'.concat(Et(n), '" registered by any injector. The stack of dependencies is: "').concat(hs.map(function(i) {
- return Et(i);
- }).join(" -> "), '".');
- return r = t.call(this, s) || this, cf(), r;
- }
- return e;
- }(at)
- );
- var hf = (
- /** @class */
- function() {
- function t(e) {
- var n = this;
- this.dependencyMap = /* @__PURE__ */ new Map(), this.normalizeDependencies(e).map(function(r) {
- return n.add(r[0], r[1]);
- });
- }
- return t.prototype.add = function(e, n) {
- typeof n > "u" && (n = { useClass: e, lazy: false });
- var r = this.dependencyMap.get(e);
- typeof r > "u" && (r = [], this.dependencyMap.set(e, r)), r.push(n);
- }, t.prototype.delete = function(e) {
- this.dependencyMap.delete(e);
- }, t.prototype.get = function(e, n) {
- n === void 0 && (n = Ge.REQUIRED);
- var r = this.dependencyMap.get(e);
- return Ni(e, n, r.length), qd(n, r);
- }, t.prototype.has = function(e) {
- return this.dependencyMap.has(e);
- }, t.prototype.append = function(e) {
- var n = this;
- this.normalizeDependencies(e).forEach(function(r) {
- return n.add(r[0], r[1]);
- });
- }, t.prototype.dispose = function() {
- this.dependencyMap.clear();
- }, t.prototype.normalizeDependencies = function(e) {
- return e.map(function(n) {
- var r = n[0], s;
- return lf(n) ? s = {
- useClass: n[0],
- lazy: false
- } : s = n[1], [r, s];
- });
- }, t;
- }()
- );
- var df = (
- /** @class */
- function() {
- function t() {
- this.resolvedDependencies = /* @__PURE__ */ new Map();
- }
- return t.prototype.add = function(e, n) {
- var r = this.resolvedDependencies.get(e);
- typeof r > "u" && (r = [], this.resolvedDependencies.set(e, r)), r.push(n);
- }, t.prototype.has = function(e) {
- return this.resolvedDependencies.has(e);
- }, t.prototype.delete = function(e) {
- if (this.resolvedDependencies.has(e)) {
- var n = this.resolvedDependencies.get(e);
- n.forEach(function(r) {
- return go(r) ? r.dispose() : void 0;
- }), this.resolvedDependencies.delete(e);
- }
- }, t.prototype.get = function(e, n) {
- n === void 0 && (n = Ge.REQUIRED);
- var r = this.resolvedDependencies.get(e);
- if (!r)
- throw new Ur(e);
- return Ni(e, n, r.length), n === Ge.MANY ? r : r[0];
- }, t.prototype.dispose = function() {
- Array.from(this.resolvedDependencies.values()).forEach(function(e) {
- e.forEach(function(n) {
- return go(n) ? n.dispose() : void 0;
- });
- }), this.resolvedDependencies.clear();
- }, t;
- }()
- );
- var Ws;
- (function() {
- if (typeof requestIdleCallback < "u" && typeof cancelIdleCallback < "u")
- Ws = function(e, n) {
- var r = requestIdleCallback(e, typeof n == "number" ? { timeout: n } : void 0), s = false;
- return function() {
- s || (s = true, cancelIdleCallback(r));
- };
- };
- else {
- var t = Object.freeze({
- didTimeout: true,
- timeRemaining: function() {
- return 15;
- }
- });
- Ws = function(e) {
- var n = setTimeout(function() {
- return e(t);
- }), r = false;
- return function() {
- r || (r = true, clearTimeout(n));
- };
- };
- }
- })();
- var ff = (
- /** @class */
- function() {
- function t(e) {
- var n = this;
- this.didRun = false, this.selfExecutor = function() {
- try {
- n.value = e();
- } catch (r) {
- n.error = r;
- } finally {
- n.didRun = true;
- }
- }, this.disposeCallback = Ws(function() {
- return n.selfExecutor();
- });
- }
- return t.prototype.hasRun = function() {
- return this.didRun;
- }, t.prototype.dispose = function() {
- this.disposeCallback();
- }, t.prototype.getValue = function() {
- if (this.didRun || (this.dispose(), this.selfExecutor()), this.error)
- throw this.error;
- return this.value;
- }, t;
- }()
- );
- var kn = function() {
- var t = function(e, n) {
- return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
- r.__proto__ = s;
- } || function(r, s) {
- for (var i in s)
- Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
- }, t(e, n);
- };
- return function(e, n) {
- if (typeof n != "function" && n !== null)
- throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
- t(e, n);
- function r() {
- this.constructor = e;
- }
- e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
- };
- }();
- var Xr = function() {
- return Xr = Object.assign || function(t) {
- for (var e, n = 1, r = arguments.length; n < r; n++) {
- e = arguments[n];
- for (var s in e)
- Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
- }
- return t;
- }, Xr.apply(this, arguments);
- };
- var on = function(t, e, n) {
- if (n || arguments.length === 2)
- for (var r = 0, s = e.length, i; r < s; r++)
- (i || !(r in e)) && (i || (i = Array.prototype.slice.call(e, 0, r)), i[r] = e[r]);
- return t.concat(i || Array.prototype.slice.call(e));
- };
- var gf = 300;
- var pr = Symbol("$$NOT_INSTANTIATED_SYMBOL");
- var pf = (
- /** @class */
- function(t) {
- kn(e, t);
- function e(n) {
- return t.call(this, 'Detecting cyclic dependency. The last identifier is "'.concat(Et(n), '".')) || this;
- }
- return e;
- }(at)
- );
- var mf = (
- /** @class */
- function(t) {
- kn(e, t);
- function e() {
- return t.call(this, "Injector cannot be accessed after it was disposed.") || this;
- }
- return e;
- }(at)
- );
- var _f = (
- /** @class */
- function(t) {
- kn(e, t);
- function e(n) {
- return t.call(this, 'Async item "'.concat(Et(n), '" returns another async item.')) || this;
- }
- return e;
- }(at)
- );
- var Ef = (
- /** @class */
- function(t) {
- kn(e, t);
- function e(n) {
- return t.call(this, 'Cannot get async item "'.concat(Et(n), '" from sync api.')) || this;
- }
- return e;
- }(at)
- );
- var Eo = (
- /** @class */
- function(t) {
- kn(e, t);
- function e(n) {
- return t.call(this, 'Cannot add dependency "'.concat(Et(n), '" after it is already resolved.')) || this;
- }
- return e;
- }(at)
- );
- var Cf = (
- /** @class */
- function(t) {
- kn(e, t);
- function e(n) {
- return t.call(this, 'Cannot dependency dependency "'.concat(Et(n), '" after it is already resolved.')) || this;
- }
- return e;
- }(at)
- );
- var Ot = (
- /** @class */
- function() {
- function t(e, n) {
- 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);
- }
- return t.prototype.onDispose = function(e) {
- var n = this;
- return this.disposingCallbacks.add(e), { dispose: function() {
- return n.disposingCallbacks.delete(e);
- } };
- }, t.prototype.createChild = function(e) {
- return this._ensureInjectorNotDisposed(), new t(e, this);
- }, t.prototype.dispose = function() {
- this.children.forEach(function(e) {
- return e.dispose();
- }), this.children.length = 0, this.dependencyCollection.dispose(), this.resolvedDependencyCollection.dispose(), this.deleteSelfFromParent(), this.disposed = true, this.disposingCallbacks.forEach(function(e) {
- return e();
- }), this.disposingCallbacks.clear();
- }, t.prototype.deleteSelfFromParent = function() {
- if (this.parent) {
- var e = this.parent.children.indexOf(this);
- e > -1 && this.parent.children.splice(e, 1);
- }
- }, t.prototype.add = function(e) {
- this._ensureInjectorNotDisposed();
- var n = e[0], r = e[1];
- if (this.resolvedDependencyCollection.has(n))
- throw new Eo(n);
- 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);
- }, t.prototype.replace = function(e) {
- this._ensureInjectorNotDisposed();
- var n = e[0];
- if (this.resolvedDependencyCollection.has(n))
- throw new Eo(n);
- this.dependencyCollection.delete(n), e.length === 1 ? this.dependencyCollection.add(n) : this.dependencyCollection.add(n, e[1]);
- }, t.prototype.delete = function(e) {
- if (this._ensureInjectorNotDisposed(), this.resolvedDependencyCollection.has(e))
- throw new Cf(e);
- this.dependencyCollection.delete(e);
- }, t.prototype.invoke = function(e) {
- for (var n = this, r = [], s = 1; s < arguments.length; s++)
- r[s - 1] = arguments[s];
- this._ensureInjectorNotDisposed();
- var i = {
- get: function(o, a, u) {
- return n._get(o, a, u);
- },
- has: function(o) {
- return n.has(o);
- }
- };
- return e.apply(void 0, on([i], r, false));
- }, t.prototype.has = function(e) {
- var n;
- return this.dependencyCollection.has(e) || ((n = this.parent) === null || n === void 0 ? void 0 : n.has(e)) || false;
- }, t.prototype.get = function(e, n, r) {
- this._ensureInjectorNotDisposed();
- var s = this._get(e, n, r);
- if (Array.isArray(s) && s.some(function(i) {
- return ys(i);
- }) || ys(s))
- throw new Ef(e);
- return s;
- }, t.prototype._get = function(e, n, r, s) {
- var i = Ge.REQUIRED;
- if (n === Ge.REQUIRED || n === Ge.OPTIONAL || n === Ge.MANY ? i = n : r = n, !s) {
- var o = this.getValue(e, i, r);
- if (o !== pr)
- return o;
- }
- return this.createDependency(e, i, r, !s);
- }, t.prototype.getAsync = function(e) {
- this._ensureInjectorNotDisposed();
- var n = this.getValue(e, Ge.REQUIRED);
- if (n !== pr)
- return Promise.resolve(n);
- var r = this.createDependency(e, Ge.REQUIRED);
- return ys(r) ? r.whenReady() : Promise.resolve(r);
- }, t.prototype.createInstance = function(e) {
- for (var n = [], r = 1; r < arguments.length; r++)
- n[r - 1] = arguments[r];
- return this._ensureInjectorNotDisposed(), this._resolveClassImpl.apply(this, on([{
- useClass: e
- }], n, false));
- }, t.prototype._resolveDependency = function(e, n, r) {
- r === void 0 && (r = true);
- var s;
- po(e);
- try {
- 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();
- } catch (i) {
- throw mo(), i;
- }
- return s;
- }, t.prototype._resolveExisting = function(e, n) {
- var r = this.get(n.useExisting);
- return this.resolvedDependencyCollection.add(e, r), r;
- }, t.prototype._resolveValueDependency = function(e, n) {
- var r = n.useValue;
- return this.resolvedDependencyCollection.add(e, r), r;
- }, t.prototype._resolveClass = function(e, n, r) {
- var s = this;
- r === void 0 && (r = true);
- var i;
- if (n.lazy) {
- var o = new ff(function() {
- return s._ensureInjectorNotDisposed(), s._resolveClassImpl(n);
- });
- i = new Proxy(/* @__PURE__ */ Object.create(null), {
- get: function(a, u) {
- if (u in a)
- return a[u];
- if (u !== "whenReady") {
- var c = o.getValue(), l = c[u];
- return typeof l != "function" || (l = l.bind(c), a[u] = l), l;
- }
- },
- set: function(a, u, c) {
- return o.getValue()[u] = c, true;
- }
- });
- } else
- i = this._resolveClassImpl(n);
- return e && r && this.resolvedDependencyCollection.add(e, i), i;
- }, t.prototype._resolveClassImpl = function(e) {
- for (var n, r = [], s = 1; s < arguments.length; s++)
- r[s - 1] = arguments[s];
- var i = e.useClass;
- this.markNewResolution(i);
- for (var o = cu(i).sort(function(O, U) {
- return O.paramIndex - U.paramIndex;
- }).map(function(O) {
- return Xr(Xr({}, O), { identifier: uf(O.identifier) });
- }), a = [], u = 0, c = o; u < c.length; u++) {
- var l = c[u];
- try {
- var h = this._get(l.identifier, l.quantity, l.lookUp, l.withNew);
- a.push(h);
- } catch (O) {
- throw O instanceof Ur || O instanceof Hs && O.actual === 0 ? new _o(i, l.identifier, l.paramIndex) : O;
- }
- }
- var d = on([], r, true), f = o.length > 0 ? o[0].paramIndex : d.length;
- if (d.length !== f) {
- console.warn("[redi]: Expect ".concat(f, " custom parameter(s) of ").concat(Et(i), " but get ").concat(d.length, "."));
- var E = f - d.length;
- E > 0 ? d = on(on([], d, true), Array.from({ length: E }).fill(void 0), true) : d = d.slice(0, f);
- }
- var R = new (i.bind.apply(i, on(on([void 0], d, false), a, false)))();
- return (n = e == null ? void 0 : e.onInstantiation) === null || n === void 0 || n.call(e, R), this.markResolutionCompleted(), R;
- }, t.prototype._resolveFactory = function(e, n, r) {
- var s;
- this.markNewResolution(e);
- for (var i = du(n.deps), o = [], a = 0, u = i; a < u.length; a++) {
- var c = u[a];
- try {
- var l = this._get(c.identifier, c.quantity, c.lookUp, c.withNew);
- o.push(l);
- } catch (d) {
- throw d instanceof Ur || d instanceof Hs && d.actual === 0 ? new _o(e, c.identifier, c.paramIndex) : d;
- }
- }
- var h = n.useFactory.apply(null, o);
- 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;
- }, t.prototype._resolveAsync = function(e, n) {
- var r = this, s = {
- __symbol: au,
- whenReady: function() {
- return r._resolveAsyncImpl(e, n);
- }
- };
- return s;
- }, t.prototype._resolveAsyncImpl = function(e, n) {
- var r = this;
- return n.useAsync().then(function(s) {
- var i = r.getValue(e);
- if (i !== pr)
- return i;
- var o;
- if (Array.isArray(s)) {
- var a = s[1];
- if (co(a))
- throw new _f(e);
- o = r._resolveDependency(e, a);
- } else
- ou(s) ? o = r._resolveClassImpl({
- useClass: s,
- onInstantiation: n.onInstantiation
- }) : o = s;
- return r.resolvedDependencyCollection.add(e, o), o;
- });
- }, t.prototype.getValue = function(e, n, r) {
- var s = this;
- n === void 0 && (n = Ge.REQUIRED);
- var i = function() {
- return s.dependencyCollection.has(e) && !s.resolvedDependencyCollection.has(e) ? pr : s.resolvedDependencyCollection.get(e, n);
- }, o = function() {
- return s.parent ? s.parent.getValue(e, n) : (Ni(e, n, 0), n === Ge.MANY ? [] : null);
- };
- return r === $t.SKIP_SELF ? o() : e === t ? this : r === $t.SELF || this.resolvedDependencyCollection.has(e) || this.dependencyCollection.has(e) ? i() : o();
- }, t.prototype.createDependency = function(e, n, r, s) {
- var i = this;
- n === void 0 && (n = Ge.REQUIRED), s === void 0 && (s = true);
- var o = function() {
- var u = i.dependencyCollection.get(e, n), c = null;
- return Array.isArray(u) ? c = u.map(function(l) {
- return i._resolveDependency(e, l, s);
- }) : u && (c = i._resolveDependency(e, u, s)), c;
- }, a = function() {
- if (i.parent)
- return i.parent.createDependency(e, n, void 0, s);
- if (n === Ge.OPTIONAL)
- return null;
- throw po(e), new Ur(e);
- };
- return r === $t.SKIP_SELF ? a() : this.dependencyCollection.has(e) ? o() : a();
- }, t.prototype.markNewResolution = function(e) {
- if (this.resolutionOngoing += 1, this.resolutionOngoing >= gf)
- throw new pf(e);
- }, t.prototype.markResolutionCompleted = function() {
- this.resolutionOngoing -= 1;
- }, t.prototype._ensureInjectorNotDisposed = function() {
- if (this.disposed)
- throw new mf();
- }, t;
- }()
- );
- var Co = typeof globalThis < "u" && globalThis || typeof window < "u" && window || typeof global < "u" && global;
- var Ro = "REDI_GLOBAL_LOCK";
- var Rf = typeof process < "u" && process.versions != null && process.versions.node != null;
- Co[Ro] ? Rf || console.error(`[redi]: You are loading scripts of redi more than once! This may cause undesired behavior in your application.
- Maybe your dependencies added redi as its dependency and bundled redi to its dist files. Or you import different versions of redi.
- 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;
- var Io = "REDI_CONTEXT_LOCK";
- var If = typeof process < "u" && process.versions != null && process.versions.node != null;
- var vo = typeof globalThis < "u" && globalThis || typeof window < "u" && window || typeof global < "u" && global;
- 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;
- var ds = St.createContext({
- injector: null
- });
- ds.displayName = "RediContext";
- var gu = ds.Provider;
- var vf = ds.Consumer;
- var Jr = function() {
- return Jr = Object.assign || function(t) {
- for (var e, n = 1, r = arguments.length; n < r; n++) {
- e = arguments[n];
- for (var s in e)
- Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
- }
- return t;
- }, Jr.apply(this, arguments);
- };
- function yf(t) {
- var e = t.children, n = t.dependencies, r = St.useRef(null);
- return St.useEffect(function() {
- return function() {
- var s;
- return (s = r.current) === null || s === void 0 ? void 0 : s.dispose();
- };
- }, []), St.createElement(vf, null, function(s) {
- var i;
- 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);
- });
- }
- function B0(t, e) {
- return function(r) {
- return St.createElement(
- gu,
- { value: { injector: e } },
- St.createElement(t, Jr({}, r))
- );
- };
- }
- function j0(t, e) {
- return function(r) {
- return St.createElement(
- yf,
- { dependencies: e },
- St.createElement(t, Jr({}, r))
- );
- };
- }
- var wf = function() {
- var t = function(e, n) {
- return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
- r.__proto__ = s;
- } || function(r, s) {
- for (var i in s)
- Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
- }, t(e, n);
- };
- return function(e, n) {
- if (typeof n != "function" && n !== null)
- throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
- t(e, n);
- function r() {
- this.constructor = e;
- }
- e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
- };
- }();
- var Of = (
- /** @class */
- function(t) {
- wf(e, t);
- function e(n) {
- 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;
- }
- return e;
- }(at)
- );
- function H0(t, e, n) {
- return function() {
- return {
- get: function() {
- var r = this, s = r.context;
- if (!s || !s.injector)
- throw new Of(r);
- var i = s.injector, o = i.get(t, e || Ge.REQUIRED, n);
- return o;
- }
- };
- };
- }
- var bf = function() {
- var t = function(e, n) {
- return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, s) {
- r.__proto__ = s;
- } || function(r, s) {
- for (var i in s)
- Object.prototype.hasOwnProperty.call(s, i) && (r[i] = s[i]);
- }, t(e, n);
- };
- return function(e, n) {
- if (typeof n != "function" && n !== null)
- throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
- t(e, n);
- function r() {
- this.constructor = e;
- }
- e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
- };
- }();
- var Sf = (
- /** @class */
- function(t) {
- bf(e, t);
- function e() {
- return t.call(this, "Using dependency injection outside of a RediContext.") || this;
- }
- return e;
- }(at)
- );
- function Af() {
- var t = St.useContext(ds);
- if (!t.injector)
- throw new Sf();
- return t.injector;
- }
- function W0(t, e, n) {
- var r = Af();
- return St.useMemo(function() {
- return r.get(t, e, n);
- }, [t, e, n]);
- }
- var Nf = function(t, e, n) {
- if (n || arguments.length === 2)
- for (var r = 0, s = e.length, i; r < s; r++)
- (i || !(r in e)) && (i || (i = Array.prototype.slice.call(e, 0, r)), i[r] = e[r]);
- return t.concat(i || Array.prototype.slice.call(e));
- };
- function Tf(t, e) {
- var n = t instanceof BehaviorSubject && typeof e > "u" ? t.getValue() : e, r = (0, import_react.useState)(n), s = r[0], i = r[1];
- return (0, import_react.useEffect)(function() {
- var o = t.subscribe(function(a) {
- return i(a);
- });
- return function() {
- return o.unsubscribe();
- };
- }, [t]), s;
- }
- function yo(t) {
- return typeof t == "function" ? t() : t;
- }
- function z0(t, e, n, r) {
- if (typeof t == "function" && !r)
- throw new at("Expected deps to be provided when observable is a function!");
- var s = (0, import_react.useRef)(null), i = (0, import_react.useRef)(false), o = (0, import_react.useMemo)(function() {
- return t;
- }, Nf([], typeof r < "u" ? r : [t], true)), a = (0, import_react.useState)(0);
- a[0];
- var u = a[1], c = (0, import_react.useRef)(function() {
- var l;
- if (o) {
- var h = yo(o).subscribe(function(d) {
- i.current = true, l = d;
- });
- h.unsubscribe();
- }
- return l != null ? l : e;
- }());
- if ((0, import_react.useEffect)(function() {
- var l = null;
- return o && (s.current = yo(o), l = s.current.subscribe(function(h) {
- c.current = h, u(function(d) {
- return d + 1;
- });
- })), function() {
- return l == null ? void 0 : l.unsubscribe();
- };
- }, [o]), n && !i.current)
- throw new Error("Expect `shouldHaveSyncValue` but not getting a sync value!");
- return c.current;
- }
- function Y0(t) {
- var e = (0, import_react.useState)(0), n = e[1];
- (0, import_react.useEffect)(function() {
- var r = t.subscribe(function() {
- return n(function(s) {
- return s + 1;
- });
- });
- return function() {
- return r.unsubscribe();
- };
- }, []);
- }
- var zs = /* @__PURE__ */ new WeakMap();
- function V0(t, e) {
- var n = (0, import_react.useRef)(void 0), r = Tf(t, e), s = (0, import_react.useMemo)(function() {
- return (0, import_react.createContext)(r);
- }, [t]), i = (0, import_react.useCallback)(function(o) {
- return import_react.default.createElement(s.Provider, { value: r }, o.children);
- }, [t, r]);
- return n.current !== t && (n.current && zs.delete(n.current), n.current = t, zs.set(t, s)), {
- Provider: i,
- value: r
- };
- }
- function G0(t) {
- var e = zs.get(t);
- if (!e)
- throw new at("try to read context value but no ancestor component subscribed it.");
- return (0, import_react.useContext)(e);
- }
- function K0(t, e) {
- e.forEach((n) => t.add(n));
- }
- function Mf(t, e) {
- e.forEach(([n]) => {
- t.has(n) && t.get(n);
- });
- }
- function Df(t, e) {
- if (Object.is(t, e))
- return true;
- if (typeof t != "object" || !t || typeof e != "object" || !e)
- return false;
- const n = Object.keys(t), r = Object.keys(e);
- if (n.length !== r.length)
- return false;
- const s = Object.prototype.hasOwnProperty.bind(e);
- for (let i = 0; i < n.length; i++) {
- const o = n[i];
- if (!s(o))
- return false;
- const a = t[o], u = e[o];
- if (a !== u)
- return false;
- }
- return true;
- }
- var wo = class extends Error {
- constructor(e) {
- super(e), this.name = "CustomCommandExecutionError";
- }
- };
- var xf = class extends Error {
- constructor() {
- super("Canceled by facade"), this.name = "CanceledError";
- }
- };
- async function Lf(t) {
- for (const [e, n] of t.entries())
- try {
- if (!await n())
- return {
- index: e,
- result: false
- };
- } catch (r) {
- return {
- index: e,
- result: false,
- error: r
- };
- }
- return {
- result: true,
- index: -1
- };
- }
- function Uf(t) {
- for (const [e, n] of t.entries())
- try {
- if (!n())
- return {
- index: e,
- result: false
- };
- } catch (r) {
- return {
- index: e,
- result: false,
- error: r
- };
- }
- return {
- result: true,
- index: -1
- };
- }
- function Oo(t) {
- var e = typeof Symbol == "function" && Symbol.iterator, n = e && t[e], r = 0;
- if (n)
- return n.call(t);
- if (t && typeof t.length == "number")
- return {
- next: function() {
- return t && r >= t.length && (t = void 0), { value: t && t[r++], done: !t };
- }
- };
- throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
- }
- function bo(t, e) {
- var n = typeof Symbol == "function" && t[Symbol.iterator];
- if (!n)
- return t;
- var r = n.call(t), s, i = [], o;
- try {
- for (; (e === void 0 || e-- > 0) && !(s = r.next()).done; )
- i.push(s.value);
- } catch (a) {
- o = { error: a };
- } finally {
- try {
- s && !s.done && (n = r.return) && n.call(r);
- } finally {
- if (o)
- throw o.error;
- }
- }
- return i;
- }
- function So(t, e, n) {
- if (n || arguments.length === 2)
- for (var r = 0, s = e.length, i; r < s; r++)
- (i || !(r in e)) && (i || (i = Array.prototype.slice.call(e, 0, r)), i[r] = e[r]);
- return t.concat(i || Array.prototype.slice.call(e));
- }
- function Zn(t) {
- return typeof t == "function";
- }
- function Pf(t) {
- var e = function(r) {
- Error.call(r), r.stack = new Error().stack;
- }, n = t(e);
- return n.prototype = Object.create(Error.prototype), n.prototype.constructor = n, n;
- }
- var ws = Pf(function(t) {
- return function(n) {
- t(this), this.message = n ? n.length + ` errors occurred during unsubscription:
- ` + n.map(function(r, s) {
- return s + 1 + ") " + r.toString();
- }).join(`
- `) : "", this.name = "UnsubscriptionError", this.errors = n;
- };
- });
- function Ao(t, e) {
- if (t) {
- var n = t.indexOf(e);
- 0 <= n && t.splice(n, 1);
- }
- }
- var pu = function() {
- function t(e) {
- this.initialTeardown = e, this.closed = false, this._parentage = null, this._finalizers = null;
- }
- return t.prototype.unsubscribe = function() {
- var e, n, r, s, i;
- if (!this.closed) {
- this.closed = true;
- var o = this._parentage;
- if (o)
- if (this._parentage = null, Array.isArray(o))
- try {
- for (var a = Oo(o), u = a.next(); !u.done; u = a.next()) {
- var c = u.value;
- c.remove(this);
- }
- } catch (R) {
- e = { error: R };
- } finally {
- try {
- u && !u.done && (n = a.return) && n.call(a);
- } finally {
- if (e)
- throw e.error;
- }
- }
- else
- o.remove(this);
- var l = this.initialTeardown;
- if (Zn(l))
- try {
- l();
- } catch (R) {
- i = R instanceof ws ? R.errors : [R];
- }
- var h = this._finalizers;
- if (h) {
- this._finalizers = null;
- try {
- for (var d = Oo(h), f = d.next(); !f.done; f = d.next()) {
- var E = f.value;
- try {
- No(E);
- } catch (R) {
- i = i != null ? i : [], R instanceof ws ? i = So(So([], bo(i)), bo(R.errors)) : i.push(R);
- }
- }
- } catch (R) {
- r = { error: R };
- } finally {
- try {
- f && !f.done && (s = d.return) && s.call(d);
- } finally {
- if (r)
- throw r.error;
- }
- }
- }
- if (i)
- throw new ws(i);
- }
- }, t.prototype.add = function(e) {
- var n;
- if (e && e !== this)
- if (this.closed)
- No(e);
- else {
- if (e instanceof t) {
- if (e.closed || e._hasParent(this))
- return;
- e._addParent(this);
- }
- (this._finalizers = (n = this._finalizers) !== null && n !== void 0 ? n : []).push(e);
- }
- }, t.prototype._hasParent = function(e) {
- var n = this._parentage;
- return n === e || Array.isArray(n) && n.includes(e);
- }, t.prototype._addParent = function(e) {
- var n = this._parentage;
- this._parentage = Array.isArray(n) ? (n.push(e), n) : n ? [n, e] : e;
- }, t.prototype._removeParent = function(e) {
- var n = this._parentage;
- n === e ? this._parentage = null : Array.isArray(n) && Ao(n, e);
- }, t.prototype.remove = function(e) {
- var n = this._finalizers;
- n && Ao(n, e), e instanceof t && e._removeParent(this);
- }, t.EMPTY = function() {
- var e = new t();
- return e.closed = true, e;
- }(), t;
- }();
- pu.EMPTY;
- function kf(t) {
- return t instanceof pu || t && "closed" in t && Zn(t.remove) && Zn(t.add) && Zn(t.unsubscribe);
- }
- function No(t) {
- Zn(t) ? t() : t.unsubscribe();
- }
- function Ze(t) {
- let e = false;
- return t ? kf(t) ? {
- dispose: () => t.unsubscribe()
- } : typeof t == "function" ? {
- dispose: () => {
- e || (e = true, t());
- }
- } : t : Ze(() => {
- });
- }
- function X0(t) {
- return Ze(() => {
- t.unsubscribe();
- });
- }
- var Mi = class {
- constructor() {
- C(this, "_disposables", /* @__PURE__ */ new Set());
- }
- add(e) {
- const n = Ze(e);
- return this._disposables.add(n), {
- dispose: (r = false) => {
- r || n.dispose(), this._disposables.delete(n);
- }
- };
- }
- dispose() {
- this._disposables.forEach((e) => {
- e.dispose();
- }), this._disposables.clear();
- }
- };
- var nt = class {
- constructor() {
- C(this, "_disposed", false);
- C(this, "_collection", new Mi());
- }
- disposeWithMe(e) {
- return this._collection.add(e);
- }
- ensureNotDisposed() {
- if (this._disposed)
- throw new Error("[Disposable]: object is disposed!");
- }
- dispose() {
- this._disposed || (this._disposed = true, this._collection.dispose());
- }
- };
- var J0 = class extends nt {
- constructor() {
- super(...arguments);
- C(this, "dispose$", new Subject());
- }
- dispose() {
- super.dispose(), this.dispose$.next(), this.dispose$.complete();
- }
- };
- var Z0 = class extends nt {
- constructor(n) {
- super();
- C(this, "_ref", 0);
- this._rootDisposable = n;
- }
- inc() {
- if (this._disposed)
- throw new Error("[RCDisposable]: should not ref to a disposed.");
- this._ref += 1;
- }
- dec() {
- this._ref -= 1, this._ref === 0 && (this._rootDisposable.dispose(), this.dispose());
- }
- };
- var fs = Ct("univer.context-service");
- var Ff = class extends nt {
- constructor() {
- super(...arguments);
- C(this, "_contextChanged$", new Subject());
- C(this, "contextChanged$", this._contextChanged$.asObservable());
- C(this, "_contextMap", /* @__PURE__ */ new Map());
- }
- dispose() {
- super.dispose(), this._contextChanged$.complete();
- }
- getContextValue(n) {
- var r;
- return (r = this._contextMap.get(n)) != null ? r : false;
- }
- setContextValue(n, r) {
- this._contextMap.set(n, r), this._contextChanged$.next({ [n]: r });
- }
- subscribeContextValue$(n) {
- return new Observable((r) => {
- const s = this._contextChanged$.pipe(filter((i) => typeof i[n] < "u")).subscribe((i) => r.next(i[n]));
- return this._contextMap.has(n) && r.next(this._contextMap.get(n)), () => s.unsubscribe();
- });
- }
- };
- 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 || {});
- var Mt = Ct("univer.log");
- var Bf = class extends nt {
- constructor() {
- super(...arguments);
- C(this, "_logLevel", 3);
- }
- debug(...n) {
- this._logLevel >= 4 && this._log(console.debug, ...n);
- }
- log(...n) {
- this._logLevel >= 3 && this._log(console.log, ...n);
- }
- warn(...n) {
- this._logLevel >= 2 && this._log(console.warn, ...n);
- }
- error(...n) {
- this._logLevel >= 1 && this._log(console.error, ...n);
- }
- setLogLevel(n) {
- this._logLevel = n;
- }
- _log(n, ...r) {
- const s = r[0];
- /^\[(.*?)\]/g.test(s) ? n(`\x1B[97;104m${s}\x1B[0m`, ...r.slice(1)) : n(...r);
- }
- };
- var jf = Object.defineProperty;
- var Hf = Object.getOwnPropertyDescriptor;
- var Wf = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? Hf(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && jf(e, n, s), s;
- };
- var To = (t, e) => (n, r) => e(n, r, t);
- var ar = ((t) => (t[t.COMMAND = 0] = "COMMAND", t[t.OPERATION = 1] = "OPERATION", t[t.MUTATION = 2] = "MUTATION", t))(ar || {});
- var Pt = Ct("anywhere.command-service");
- var zf = class {
- constructor() {
- C(this, "_commands", /* @__PURE__ */ new Map());
- C(this, "_commandTypes", /* @__PURE__ */ new Map());
- }
- registerCommand(e) {
- if (this._commands.has(e.id))
- throw new Error(`[CommandRegistry]: command "${e.id}" has been registered before.`);
- return this._commands.set(e.id, e), this._commandTypes.set(e.id, e.type), Ze(() => {
- this._commands.delete(e.id), this._commandTypes.delete(e.id);
- });
- }
- hasCommand(e) {
- return this._commands.has(e);
- }
- getCommand(e) {
- return this._commands.has(e) ? [this._commands.get(e)] : null;
- }
- getCommandType(e) {
- return this._commandTypes.get(e);
- }
- };
- var Yf = {
- id: "nil",
- type: 0,
- handler: () => true
- };
- var Ys = class extends nt {
- constructor(e, n) {
- super();
- C(this, "_commandRegistry");
- C(this, "_beforeCommandExecutionListeners", []);
- C(this, "_commandExecutedListeners", []);
- C(this, "_multiCommandDisposables", /* @__PURE__ */ new Map());
- C(this, "_commandExecutingLevel", 0);
- C(this, "_commandExecutionStack", []);
- this._injector = e, this._logService = n, this._commandRegistry = new zf(), this._registerCommand(Yf);
- }
- dispose() {
- super.dispose(), this._commandExecutedListeners.length = 0, this._beforeCommandExecutionListeners.length = 0;
- }
- hasCommand(e) {
- return this._commandRegistry.hasCommand(e);
- }
- registerCommand(e) {
- return this._registerCommand(e);
- }
- registerMultipleCommand(e) {
- return this._registerMultiCommand(e);
- }
- beforeCommandExecuted(e) {
- if (this._beforeCommandExecutionListeners.indexOf(e) === -1)
- return this._beforeCommandExecutionListeners.push(e), Ze(() => {
- const n = this._beforeCommandExecutionListeners.indexOf(e);
- this._beforeCommandExecutionListeners.splice(n, 1);
- });
- throw new Error("[CommandService]: could not add a listener twice.");
- }
- onCommandExecuted(e) {
- if (this._commandExecutedListeners.indexOf(e) === -1)
- return this._commandExecutedListeners.push(e), Ze(() => {
- const n = this._commandExecutedListeners.indexOf(e);
- this._commandExecutedListeners.splice(n, 1);
- });
- throw new Error("[CommandService]: could not add a listener twice.");
- }
- async executeCommand(e, n, r) {
- try {
- const s = this._commandRegistry.getCommand(e);
- if (s) {
- const [i] = s, o = {
- id: i.id,
- type: i.type,
- params: n
- }, a = this._pushCommandExecutionStack(o);
- this._beforeCommandExecutionListeners.forEach((c) => c(o, r));
- const u = await this._execute(i, n, r);
- return this._commandExecutedListeners.forEach((c) => c(o, r)), a.dispose(), u;
- }
- throw new Error(`[CommandService]: command "${e}" is not registered.`);
- } catch (s) {
- if (s instanceof wo)
- return false;
- throw s;
- }
- }
- syncExecuteCommand(e, n, r) {
- var s;
- try {
- const i = this._commandRegistry.getCommand(e);
- if (i) {
- const [o] = i, a = {
- id: o.id,
- type: o.type,
- params: n
- };
- if (o.type === 2) {
- const l = jd(
- this._commandExecutionStack,
- (h) => h.type === 0
- /* COMMAND */
- );
- l && (a.params = (s = a.params) != null ? s : {}, a.params.trigger = l.id);
- }
- const u = this._pushCommandExecutionStack(a);
- this._beforeCommandExecutionListeners.forEach((l) => l(a, r));
- const c = this._syncExecute(o, n, r);
- return this._commandExecutedListeners.forEach((l) => l(a, r)), u.dispose(), c;
- }
- throw new Error(`[CommandService]: command "${e}" is not registered.`);
- } catch (i) {
- if (i instanceof wo)
- return false;
- throw i;
- }
- }
- _pushCommandExecutionStack(e) {
- return this._commandExecutionStack.push(e), Ze(() => cs(this._commandExecutionStack, e));
- }
- _registerCommand(e) {
- return this._commandRegistry.registerCommand(e);
- }
- _registerMultiCommand(e) {
- const n = this._commandRegistry.getCommand(e.id);
- let r;
- if (n) {
- if (n[0].multi !== true)
- throw new Error("Command has registered as a single command.");
- r = n[0];
- } else {
- const i = new Mi();
- r = new Vf(e.id), i.add(this._commandRegistry.registerCommand(r)), i.add(
- Ze(() => {
- this._multiCommandDisposables.delete(e.id);
- })
- ), this._multiCommandDisposables.set(e.id, i);
- }
- const s = r.registerImplementation(e);
- return Ze(() => {
- var i;
- s.dispose(), r.hasImplementations() || (i = this._multiCommandDisposables.get(e.id)) == null || i.dispose();
- });
- }
- async _execute(e, n, r) {
- this._logService.debug(
- "[CommandService]",
- `${"|-".repeat(Math.max(this._commandExecutingLevel, 0))}executing command "${e.id}"`
- ), this._commandExecutingLevel++;
- let s;
- try {
- s = await this._injector.invoke(e.handler, n, r), this._commandExecutingLevel--;
- } catch (i) {
- throw s = false, this._commandExecutingLevel = 0, i;
- }
- return s;
- }
- _syncExecute(e, n, r) {
- this._logService.debug(
- "[CommandService]",
- `${"|-".repeat(Math.max(0, this._commandExecutingLevel))}executing command "${e.id}".`
- ), this._commandExecutingLevel++;
- let s;
- try {
- if (s = this._injector.invoke(e.handler, n, r), s instanceof Promise)
- throw new TypeError("[CommandService]: Command handler should not return a promise.");
- this._commandExecutingLevel--;
- } catch (i) {
- throw s = false, this._commandExecutingLevel = 0, i;
- }
- return s;
- }
- };
- Ys = Wf([
- To(0, ot(Ot)),
- To(1, Mt)
- ], Ys);
- var Vf = class {
- constructor(e) {
- C(this, "name");
- C(this, "multi", true);
- C(this, "type", 0);
- C(this, "priority", 0);
- C(this, "_implementations", []);
- C(this, "handler", async (e2, n) => {
- if (!this._implementations.length)
- return false;
- const r = e2.get(Mt), s = e2.get(fs), i = e2.get(Ot);
- for (const o of this._implementations) {
- const a = o.command.preconditions;
- if ((!a || a && a(s)) && (r.debug("[MultiCommand]", `executing implementation "${o.command.name}".`), await i.invoke(o.command.handler, n)))
- return true;
- }
- return false;
- });
- this.id = e, this.name = e;
- }
- registerImplementation(e) {
- const n = { command: e };
- return this._implementations.push(n), this._implementations.sort((r, s) => s.command.priority - r.command.priority), Ze(() => {
- const r = this._implementations.indexOf(n);
- this._implementations.splice(r, 1);
- });
- }
- hasImplementations() {
- return this._implementations.length > 0;
- }
- };
- function mu(t, e, n) {
- const r = t.map((s) => () => e.syncExecuteCommand(s.id, s.params, n));
- return Uf(r);
- }
- function Q0(t, e, n) {
- const r = t.map((s) => () => e.executeCommand(s.id, s.params, n));
- return Lf(r);
- }
- function Gf(t) {
- return new Observable((e) => {
- const n = t((...r) => e.next(r));
- return () => n == null ? void 0 : n.dispose();
- });
- }
- function Kf(t) {
- return function(n) {
- return new Observable((r) => (n.subscribe({
- next: (s) => {
- r.next(s), t(s) && r.complete();
- },
- complete: () => r.complete(),
- error: (s) => r.error(s)
- }), () => r.unsubscribe()));
- };
- }
- function q0(t = 0) {
- return (e) => {
- let n = [];
- return e.pipe(
- tap((r) => n.push(r)),
- debounceTime(t),
- map(() => n),
- tap(() => n = [])
- );
- };
- }
- function eC(t) {
- const e = new ReplaySubject(1);
- return setTimeout(() => e.next(), t), e.pipe(take(1));
- }
- var tC = (t) => new Promise((e) => {
- merge(
- Gf(t.onCommandExecuted.bind(t)).pipe(filter(([n]) => n.type === ar.MUTATION)),
- timer(300)
- ).pipe(debounceTime(16), first()).subscribe(() => {
- e();
- });
- });
- function Xf(t, e) {
- let n = 0, r = t.length - 1;
- if (e < t[0])
- return 0;
- if (e >= t[t.length - 1])
- return t.length - 1;
- for (; n <= r; ) {
- if (t[n] === e) {
- for (; n < t.length && t[n] === e; )
- n++;
- return n;
- }
- if (e > t[n] && e < t[n + 1])
- return n + 1;
- if (t[r] === e) {
- for (; r < t.length && t[r] === e; )
- r++;
- return r;
- }
- if (e > t[r - 1] && e < t[r])
- return r;
- n++, r--;
- }
- return -1;
- }
- function nC(t, e) {
- let n = 0, r = t.length - 1;
- for (; n <= r; ) {
- const s = Math.floor((r + n) / 2);
- if (e < t[s] && (s === 0 || e >= t[s - 1]))
- return s;
- if (e >= t[s])
- n = s + 1;
- else if (e < t[s])
- r = s - 1;
- else
- return -1;
- }
- return -1;
- }
- function Jf(t, e) {
- let n = 0, r = t.length;
- for (; n < r; ) {
- const s = Math.floor((n + r) / 2);
- t[s] <= e ? n = s + 1 : r = s;
- }
- return n < t.length ? n : t.length - 1;
- }
- function rC(t, e, n = false) {
- let r = t.length - 1;
- if (e < 0 || e < t[0])
- return 0;
- if (t.length < 40 || e <= t[20] || e >= t[r - 20] ? r = Xf(t, e) : r = Jf(t, e), n) {
- const s = t[r];
- return t.indexOf(s);
- }
- return r;
- }
- function sC(t) {
- const e = new Blob([t], { type: "text/javascript" });
- return window.URL.createObjectURL(e);
- }
- var mr = 2;
- var Zf = 1;
- function iC(t, e) {
- if (e == null || t == null)
- return true;
- 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;
- 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;
- }
- var _u = ((t) => (t[t.DEFAULT_SERIES = 0] = "DEFAULT_SERIES", t[t.ALTERNATE_SERIES = 1] = "ALTERNATE_SERIES", t))(_u || {});
- 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 || {});
- 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 || {});
- 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 || {});
- var Cu = ((t) => (t[t.ON = 0] = "ON", t[t.OFF = 1] = "OFF", t))(Cu || {});
- 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 || {});
- var Iu = ((t) => (t[t.LEFT = 0] = "LEFT", t[t.RIGHT = 1] = "RIGHT", t))(Iu || {});
- var vu = ((t) => (t[t.DOCUMENT = 0] = "DOCUMENT", t[t.PROJECT = 1] = "PROJECT", t))(vu || {});
- var yu = ((t) => (t[t.COLUMNS = 0] = "COLUMNS", t[t.ROWS = 1] = "ROWS", t))(yu || {});
- 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 || {});
- function oC(t) {
- switch (t) {
- case 3:
- return 1;
- case 1:
- return 3;
- case 0:
- return 2;
- case 2:
- return 0;
- }
- }
- 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 || {});
- 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 || {});
- 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 || {});
- var bu = ((t) => (t[t.RANGE = 0] = "RANGE", t[t.SHEET = 1] = "SHEET", t))(bu || {});
- 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 || {});
- 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 || {});
- 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 || {});
- 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 || {});
- 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 || {});
- var Au = ((t) => (t[t.GRID = 0] = "GRID", t[t.KANBAN = 1] = "KANBAN", t[t.GANTT = 2] = "GANTT", t))(Au || {});
- 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 || {});
- 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 || {});
- 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 || {});
- 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 || {});
- 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 || {});
- var Vs = ((t) => (t[t.NORMAL = 0] = "NORMAL", t[t.ITALIC = 1] = "ITALIC", t))(Vs || {});
- var Gs = ((t) => (t[t.NORMAL = 0] = "NORMAL", t[t.BOLD = 1] = "BOLD", t))(Gs || {});
- var Bt = ((t) => (t[t.NORMAL = 1] = "NORMAL", t[t.SUBSCRIPT = 2] = "SUBSCRIPT", t[t.SUPERSCRIPT = 3] = "SUPERSCRIPT", t))(Bt || {});
- var we = ((t) => (t[t.FALSE = 0] = "FALSE", t[t.TRUE = 1] = "TRUE", t))(we || {});
- 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 || {});
- 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 || {});
- 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 || {});
- var ng = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
- var rg = (t) => crypto.getRandomValues(new Uint8Array(t));
- var sg = (t, e, n) => {
- let r = (2 << Math.log2(t.length - 1)) - 1, s = -~(1.6 * r * e / t.length);
- return (i = e) => {
- let o = "";
- for (; ; ) {
- let a = n(s), u = s | 0;
- for (; u--; )
- if (o += t[a[u] & r] || "", o.length >= i)
- return o;
- }
- };
- };
- var ig = (t, e = 21) => sg(t, e | 0, rg);
- var og = (t = 21) => {
- let e = "", n = crypto.getRandomValues(new Uint8Array(t |= 0));
- for (; t--; )
- e += ng[n[t] & 63];
- return e;
- };
- var Tu = /* @__PURE__ */ new Set([
- "ac",
- "ad",
- "ae",
- "aero",
- "af",
- "ag",
- "ai",
- "al",
- "am",
- "ao",
- "aq",
- "ar",
- "arpa",
- "as",
- "asia",
- "at",
- "au",
- "aw",
- "ax",
- "az",
- "ba",
- "bb",
- "bd",
- "be",
- "bf",
- "bg",
- "bh",
- "bi",
- "biz",
- "bj",
- "bm",
- "bn",
- "bo",
- "br",
- "bs",
- "bt",
- "bv",
- "bw",
- "by",
- "bz",
- "ca",
- "cat",
- "cc",
- "cd",
- "cf",
- "cg",
- "ch",
- "ci",
- "ck",
- "cl",
- "cm",
- "cn",
- "co",
- "com",
- "coop",
- "cr",
- "cu",
- "cv",
- "cw",
- "cx",
- "cy",
- "cz",
- "de",
- "dj",
- "dk",
- "dm",
- "do",
- "dz",
- "ec",
- "edu",
- "ee",
- "eg",
- "er",
- "es",
- "et",
- "eu",
- "fi",
- "fj",
- "fk",
- "fm",
- "fo",
- "fr",
- "ga",
- "gb",
- "gd",
- "ge",
- "gf",
- "gg",
- "gh",
- "gi",
- "gl",
- "gm",
- "gn",
- "gov",
- "gp",
- "gq",
- "gr",
- "gs",
- "gt",
- "gu",
- "gw",
- "gy",
- "hk",
- "hm",
- "hn",
- "hr",
- "ht",
- "hu",
- "id",
- "ie",
- "il",
- "im",
- "in",
- "info",
- "int",
- "io",
- "iq",
- "ir",
- "is",
- "it",
- "je",
- "jm",
- "jo",
- "jobs",
- "jp",
- "ke",
- "kg",
- "kh",
- "ki",
- "km",
- "kn",
- "kp",
- "kr",
- "kw",
- "ky",
- "kz",
- "la",
- "lb",
- "lc",
- "li",
- "lk",
- "lr",
- "ls",
- "lt",
- "lu",
- "lv",
- "ly",
- "ma",
- "mc",
- "md",
- "me",
- "mg",
- "mh",
- "mil",
- "mk",
- "ml",
- "mm",
- "mn",
- "mo",
- "mobi",
- "mp",
- "mq",
- "mr",
- "ms",
- "mt",
- "mu",
- "museum",
- "mv",
- "mw",
- "mx",
- "my",
- "mz",
- "na",
- "name",
- "nc",
- "ne",
- "net",
- "nf",
- "ng",
- "ni",
- "nl",
- "no",
- "np",
- "nr",
- "nu",
- "nz",
- "om",
- "onion",
- "org",
- "pa",
- "pe",
- "pf",
- "pg",
- "ph",
- "pk",
- "pl",
- "pm",
- "pn",
- "post",
- "pr",
- "pro",
- "ps",
- "pt",
- "pw",
- "py",
- "qa",
- "re",
- "ro",
- "rs",
- "ru",
- "rw",
- "sa",
- "sb",
- "sc",
- "sd",
- "se",
- "sg",
- "sh",
- "si",
- "sj",
- "sk",
- "sl",
- "sm",
- "sn",
- "so",
- "sr",
- "ss",
- "st",
- "su",
- "sv",
- "sx",
- "sy",
- "sz",
- "tc",
- "td",
- "tel",
- "tf",
- "tg",
- "th",
- "tj",
- "tk",
- "tl",
- "tm",
- "tn",
- "to",
- "tr",
- "tt",
- "tv",
- "tw",
- "tz",
- "ua",
- "ug",
- "uk",
- "us",
- "uy",
- "uz",
- "va",
- "vc",
- "ve",
- "vg",
- "vi",
- "vn",
- "vu",
- "wf",
- "ws",
- "yt",
- "za",
- "zm",
- "zw"
- ]);
- var ag = new RegExp(
- "^(?:(?:(?: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*)?$",
- "i"
- );
- function ug(t) {
- if (!Number.isNaN(+t))
- return false;
- if (t.startsWith("http://localhost:3002") || t.startsWith("localhost:3002"))
- return true;
- if (ag.test(t)) {
- if (Mu(t))
- return true;
- try {
- const r = new URL(Du(t)).hostname.split(".").pop();
- if (r && Tu.has(r))
- return true;
- } catch {
- return false;
- }
- }
- return false;
- }
- function Mu(t) {
- return /^[a-zA-Z]+:\/\//.test(t);
- }
- function lg(t) {
- return /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(t);
- }
- function Du(t) {
- return Mu(t) ? t : lg(t) ? `mailto://${t}` : `https://${t}`;
- }
- var cg = /^-ms-/;
- var hg = /-([a-z])/g;
- var Vt = [
- "A",
- "B",
- "C",
- "D",
- "E",
- "F",
- "G",
- "H",
- "I",
- "J",
- "K",
- "L",
- "M",
- "N",
- "O",
- "P",
- "Q",
- "R",
- "S",
- "T",
- "U",
- "V",
- "W",
- "X",
- "Y",
- "Z"
- ];
- function xi(t, e) {
- const n = re.getValueType(t), r = re.getValueType(e);
- 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;
- }
- function dg(t, e) {
- if (t.length !== e.length)
- return false;
- for (let n = 0, r = t.length; n < r; n++) {
- const s = t[n], i = e[n];
- if (!xi(s, i))
- return false;
- }
- return true;
- }
- function fg(t, e) {
- const n = Object.keys(t), r = Object.keys(e);
- if (n.length !== r.length)
- return false;
- for (const s of n) {
- if (!r.includes(s))
- return false;
- const i = t[s], o = e[s];
- if (!xi(i, o))
- return false;
- }
- return true;
- }
- var re = class _re {
- static stringAt(e) {
- let n = "", r = e;
- for (; r >= Vt.length; )
- r /= Vt.length, r -= 1, n += Vt[r % Vt.length];
- const s = e % Vt.length;
- return n += Vt[s], n;
- }
- static indexAt(e) {
- let n = 0;
- for (let r = 0; r < e.length - 1; r += 1) {
- const s = e.charCodeAt(r) - 65, i = e.length - 1 - r;
- n += Vt.length ** i + Vt.length * s;
- }
- return n += e.charCodeAt(e.length - 1) - 65, n;
- }
- static deleteBlank(e) {
- return _re.isString(e) ? e.replace(/\s/g, "") : e;
- }
- // eslint-disable-next-line complexity
- static getSystemType() {
- const e = navigator.userAgent, n = navigator.platform === "Win32" || navigator.platform === "Windows", r = navigator.platform === "Mac68K" || navigator.platform === "MacPPC" || navigator.platform === "Macintosh" || navigator.platform === "MacIntel";
- if (r)
- return "Mac";
- if (navigator.platform === "X11" && !n && !r)
- return "Unix";
- if (String(navigator.platform).indexOf("Linux") > -1)
- return "Linux";
- if (n) {
- if (e.indexOf("Windows NT 5.0") > -1 || e.indexOf("Windows 2000") > -1)
- return "Windows 2000";
- if (e.indexOf("Windows NT 5.1") > -1 || e.indexOf("Windows XP") > -1)
- return "Windows XP";
- if (e.indexOf("Windows NT 5.2") > -1 || e.indexOf("Windows 2003") > -1)
- return "Windows 2003";
- if (e.indexOf("Windows NT 6.0") > -1 || e.indexOf("Windows Vista") > -1)
- return "Windows Vista";
- if (e.indexOf("Windows NT 6.1") > -1 || e.indexOf("Windows 7") > -1)
- return "Windows 7";
- if (e.indexOf("Windows NT 10") > -1 || e.indexOf("Windows 10") > -1)
- return "Windows 10";
- if (e.indexOf("Windows NT 11") > -1 || e.indexOf("Windows 11") > -1)
- return "Windows 11";
- }
- return "Unknown system";
- }
- static getBrowserType() {
- 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;
- if (r) {
- new RegExp("MSIE (\\d+\\.\\d+);").test(e);
- const l = Number.parseFloat(RegExp.$1);
- return l === 7 ? "IE7" : l === 8 ? "IE8" : l === 9 ? "IE9" : l === 10 ? "IE10" : "0";
- }
- return o ? "FF" : n ? "Opera" : a ? "Safari" : u ? "Chrome" : i ? "Edge" : s ? "IE11" : "Unknown browser";
- }
- /**
- * Use this method without `Tools`.
- *
- * @deprecated
- */
- static generateRandomId(e = 21, n) {
- return qt(e, n);
- }
- static getClassName(e) {
- return e.constructor.name;
- }
- /** @deprecated This method is deprecated, please use `import { merge } from '@univerjs/core` instead */
- static deepMerge(e, ...n) {
- n.forEach((o) => o && i(o));
- function r(o, a) {
- o.forEach((u, c) => {
- var l, h;
- if (_re.isArray(u)) {
- const d = (l = a[c]) != null ? l : [];
- a[c] = d, r(u, d);
- return;
- }
- if (_re.isObject(u)) {
- const d = (h = a[c]) != null ? h : {};
- a[c] = d, s(u, d);
- return;
- }
- a[c] = u;
- });
- }
- function s(o, a) {
- Object.keys(o).forEach((u) => {
- var l, h;
- const c = o[u];
- if (_re.isObject(c)) {
- const d = (l = a[u]) != null ? l : {};
- a[u] = d, s(c, d);
- return;
- }
- if (_re.isArray(c)) {
- const d = (h = a[u]) != null ? h : [];
- a[u] = d, r(c, d);
- return;
- }
- a[u] = c;
- });
- }
- function i(o) {
- Object.keys(o).forEach((a) => {
- var c, l;
- const u = o[a];
- if (_re.isArray(u)) {
- const h = (c = e[a]) != null ? c : [];
- e[a] = h, r(u, h);
- return;
- }
- if (_re.isObject(u)) {
- const h = (l = e[a]) != null ? l : {};
- e[a] = h, s(u, h);
- return;
- }
- e[a] = u;
- });
- }
- return e;
- }
- static numberFixed(e, n) {
- return Number(Number(e).toFixed(n));
- }
- static diffValue(e, n) {
- return xi(e, n);
- }
- static deepClone(e) {
- if (!this.isDefine(e))
- return e;
- if (this.isRegExp(e))
- return new RegExp(e);
- if (this.isDate(e))
- return new Date(e);
- if (this.isArray(e)) {
- const n = [];
- return e.forEach((r, s) => {
- n[s] = _re.deepClone(r);
- }), n;
- }
- if (this.isObject(e)) {
- const n = {};
- return Object.keys(e).forEach((r) => {
- const s = e[r];
- n[r] = _re.deepClone(s);
- }), Object.setPrototypeOf(n, Object.getPrototypeOf(e)), n;
- }
- return e;
- }
- static getLanguage() {
- const e = "en-US";
- return globalThis.navigator && (navigator.languages && navigator.languages[0] || navigator.language) || e;
- }
- static getValueType(e) {
- return Object.prototype.toString.apply(e);
- }
- static isDefine(e) {
- return e != null;
- }
- static isBlank(e) {
- return this.isDefine(e) ? this.isString(e) ? e.trim() === "" : false : true;
- }
- static isBoolean(e) {
- return this.getValueType(e) === "[object Boolean]";
- }
- static isPlainObject(e) {
- return this.isDefine(e) ? Object.getPrototypeOf(e) === Object.getPrototypeOf({}) : false;
- }
- static isFunction(e) {
- return this.getValueType(e) === "[object Function]";
- }
- static isDate(e) {
- return this.getValueType(e) === "[object Date]";
- }
- static isRegExp(e) {
- return this.getValueType(e) === "[object RegExp]";
- }
- static isArray(e) {
- return this.getValueType(e) === "[object Array]";
- }
- static isString(e) {
- return this.getValueType(e) === "[object String]";
- }
- static isNumber(e) {
- return this.getValueType(e) === "[object Number]";
- }
- static isStringNumber(e) {
- return !isNaN(Number.parseFloat(e)) && isFinite(e);
- }
- static isObject(e) {
- return this.getValueType(e) === "[object Object]";
- }
- static isEmptyObject(e) {
- for (const n in e)
- return false;
- return true;
- }
- static isMobile() {
- let e = 0, n = 0;
- 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;
- }
- static isTablet() {
- return /ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase());
- }
- static isWeChat() {
- const e = navigator.userAgent.toLowerCase();
- return String(e.match(/MicroMessenger/i)) === "micromessenger";
- }
- static isAndroid() {
- const e = navigator.userAgent;
- return e.indexOf("Android") > -1 || e.indexOf("Linux") > -1;
- }
- static isIPhone() {
- return /iPhone/i.test(navigator.userAgent);
- }
- static isLegalUrl(e) {
- return ug(e);
- }
- static normalizeUrl(e) {
- return Du(e);
- }
- static topLevelDomainCombiningString() {
- return [...Tu].join("|");
- }
- static itCount(e) {
- return (n) => {
- for (let r = 0; r < e; r++)
- n && n();
- };
- }
- static hasLength(e, n) {
- return _re.isDefine(e) ? _re.isDefine(n) ? e.length === n : e.length > 0 : false;
- }
- static capitalize(e) {
- return e.charAt(0).toUpperCase() + e.slice(1);
- }
- // Used by camelCase as callback to replace()
- static fCamelCase(e, n) {
- return n.toUpperCase();
- }
- // Convert dashed to camelCase; used by the css and data modules
- // Support: IE <=9 - 11, Edge 12 - 15
- // Microsoft forgot to hump their vendor prefix (#9572)
- static camelCase(e) {
- return e.replace(cg, "ms-").replace(hg, this.fCamelCase);
- }
- /**
- * remove all null from object
- * @param obj
- * @returns
- */
- static removeNull(e) {
- return this.isObject(e) && Object.keys(e).forEach((n) => {
- const r = e[n];
- r == null ? delete e[n] : _re.removeNull(r);
- }), e;
- }
- /**
- * Generate a two-dimensional array with the specified number of rows and columns, and fill in the values
- * @param rows row length
- * @param columns column length
- * @param value value to be set
- * @returns
- */
- static fillTwoDimensionalArray(e, n, r) {
- return new Array(e).fill(r).map((s) => new Array(n).fill(r));
- }
- /**
- * Generate a two-dimensional array with the specified number of rows and columns, and fill in the values
- * @param rows row length
- * @param columns column length
- * @param value value to be set
- * @returns
- */
- // static fillObjectMatrix<T>(rows: number, columns: number, value: T): IObjectMatrixPrimitiveType<T> {
- // const matrix = new ObjectMatrix<T>();
- // for (let r = 0; r < rows; r++) {
- // for (let c = 0; c < columns; c++) {
- // matrix.setValue(r, c, value);
- // }
- // }
- // return matrix.getData();
- // }
- static numToWord(e) {
- let n = "";
- for (; e > 0; ) {
- let r = e % 26;
- r = r === 0 ? r = 26 : r, n = String.fromCharCode(96 + r) + n, e = (e - r) / 26;
- }
- return n.toLocaleUpperCase();
- }
- /**
- *
- * Column subscript letter to number
- *
- * @privateRemarks
- * zh: 列下标 字母转数字
- *
- * @param a - Column subscript letter,e.g.,"A1"
- * @returns Column subscript number,e.g.,0
- *
- */
- static ABCatNum(e) {
- if (e == null || e.length === 0)
- return Number.NaN;
- const n = e.toLowerCase().split(""), r = n.length;
- let s = 0, i = 0;
- for (let o = 0; o < r; o++)
- i = n[o].charCodeAt(0) - 96, s += i * 26 ** (r - o - 1);
- return s === 0 ? Number.NaN : s - 1;
- }
- /**
- * en: Column subscript number to letter
- *
- * zh: 列下标 数字转字母
- *
- * @param n Column subscript number,e.g.,0
- * @returns Column subscript letter,e.g.,"A1"
- */
- static chatAtABC(e) {
- let i = "";
- for (; e >= 0; )
- i = String.fromCharCode(e % 26 + 97) + i, e = Math.floor(e / 26) - 1;
- return i.toUpperCase();
- }
- static randSort(e) {
- for (let n = 0, r = e.length; n < r; n++) {
- const s = Number.parseInt((Math.random() * r).toString()), i = e[s];
- e[s] = e[n], e[n] = i;
- }
- return e;
- }
- /**
- * extend two objects
- * @param originJson
- * @param extendJson
- * @returns
- */
- static commonExtend(e, n) {
- const r = {};
- for (const s in e)
- r[s] = e[s];
- for (const s in n)
- n[s] != null && (r[s] = n[s]);
- return r;
- }
- static commonExtend1(e, n) {
- for (const r in e)
- n[r] == null && (n[r] = e[r]);
- return n;
- }
- static arrayToObject(e) {
- const n = {};
- return e.forEach((r, s) => {
- n[s] = {}, r.forEach((i, o) => {
- n[s][o] = i;
- });
- }), n;
- }
- static hasIntersectionBetweenTwoRanges(e, n, r, s) {
- return n >= r && s >= e;
- }
- static isStartValidPosition(e) {
- return /^[A-Za-z_]/.test(e);
- }
- static isValidParameter(e) {
- const n = /[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(e), r = e.length <= 255;
- return !n && r;
- }
- static clamp(e, n, r) {
- return Math.max(n, Math.min(r, e));
- }
- static now() {
- return performance && performance.now ? performance.now() : Date.now();
- }
- };
- function qt(t = 21, e) {
- return e ? ig(e, t)() : og(t);
- }
- function Mo(...t) {
- const e = {}, n = t.length;
- for (let r = n - 1; r >= 0; r--) {
- const s = t[r];
- if (s) {
- const i = Object.keys(s);
- for (const o of i)
- e[o] === void 0 && (e[o] = s[o]);
- }
- }
- return e;
- }
- var aC = () => typeof process < "u" && process.versions != null && process.versions.node != null;
- function Os(t, e, n) {
- const { dataStream: r, textRuns: s = [] } = t;
- let i = e;
- const o = [];
- for (const a of s) {
- const { st: u, ed: c } = a;
- re.hasIntersectionBetweenTwoRanges(e, n, u, c) && (u > i ? (o.push(r.slice(i, u)), o.push(Do(r, {
- ...a,
- ed: Math.min(c, n)
- }))) : o.push(Do(r, {
- ...a,
- st: i,
- ed: Math.min(c, n)
- }))), i = Math.max(e, Math.min(c, n));
- }
- return i !== n && o.push(r.slice(i, n)), o.join("");
- }
- function uC(t, e = true) {
- var n;
- if (e && ((n = t.paragraphs) != null && n.length)) {
- const { dataStream: r, paragraphs: s = [] } = t;
- let i = "", o = -1;
- for (const a of s) {
- const { startIndex: u, paragraphStyle: c = {} } = a, { spaceAbove: l, spaceBelow: h, lineSpacing: d } = c, f = [];
- 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;
- }
- return o !== r.length && (i += Os(t, o, r.length)), i;
- } else
- return Os(t, 0, t.dataStream.length);
- }
- function Do(t, e) {
- 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;
- let R = t.slice(n, r);
- const O = [];
- 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;
- }
- var gg = {
- [Di.OFFICE]: {
- [ft.ACCENT1]: "#4472C4",
- [ft.ACCENT2]: "#ED7D31",
- [ft.ACCENT3]: "#A5A5A5",
- [ft.ACCENT4]: "#70AD47",
- [ft.ACCENT5]: "#5B9BD5",
- [ft.ACCENT6]: "#70AD47",
- [ft.DARK1]: "#000000",
- [ft.DARK2]: "#44546A",
- [ft.LIGHT1]: "#FFFFFF",
- [ft.LIGHT2]: "#E7E6E6",
- [ft.HYPERLINK]: "#0563C1",
- [ft.FOLLOWED_HYPERLINK]: "#954F72"
- }
- };
- var gs = class {
- constructor() {
- C(this, "_themeValue", ft.LIGHT1);
- C(this, "_themeColors");
- C(this, "_themeTint");
- C(this, "_rgbValue", "");
- C(this, "_colorType");
- this._colorType = vt.UNSUPPORTED, this._themeColors = Di.OFFICE, this._themeTint = 0;
- }
- asRgbColor() {
- return new Ks(this._rgbValue, this);
- }
- asThemeColor() {
- return new Xs(this._themeValue, this._themeTint, this._themeColors, this);
- }
- build() {
- switch (this._colorType) {
- case vt.THEME:
- return this.asThemeColor();
- case vt.RGB:
- return this.asRgbColor();
- case vt.UNSUPPORTED:
- throw new Error("unsupported color type");
- }
- }
- setRgbColor(e) {
- return this._colorType = vt.RGB, this._rgbValue = e, this;
- }
- setThemeColors(e) {
- this._colorType = vt.THEME, this._themeColors = e;
- }
- setThemeTint(e) {
- this._colorType = vt.THEME, this._themeTint = e;
- }
- setThemeColor(e) {
- return this._colorType = vt.THEME, this._themeValue = e, this;
- }
- getColorType() {
- return this._colorType;
- }
- };
- var Ln = class _Ln {
- constructor(e) {
- C(this, "_builder");
- this._builder = e;
- }
- static rgbColorToHexValue(e) {
- return `#${((1 << 24) + (e.getRed() << 16) + (e.getGreen() << 8) + e.getBlue()).toString(16).slice(1)}`;
- }
- static hexValueToRgbColor(e) {
- e ? e.indexOf("#") > -1 && (e = e.substring(1)) : e = "#000000";
- const n = +`0x${e[0]}${e[1]}`, r = +`0x${e[2]}${e[3]}`, s = +`0x${e[4]}${e[5]}`;
- return new gs().setRgbColor(`rgb(${n},${r},${s})`).asRgbColor();
- }
- static hexToRgbString(e) {
- const n = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
- e = e.replace(n, (i, o, a, u) => o + o + a + a + u + u);
- const r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
- let s = null;
- if (r) {
- const i = Number.parseInt(r[1], 16), o = Number.parseInt(r[2], 16), a = Number.parseInt(r[3], 16);
- s = `rgba(${i},${o},${a})`;
- }
- return s;
- }
- asRgbColor() {
- return this._builder.asRgbColor();
- }
- asThemeColor() {
- return this._builder.asThemeColor();
- }
- getColorType() {
- return this._builder.getColorType();
- }
- clone() {
- return new _Ln(this._builder);
- }
- equals(e) {
- return false;
- }
- };
- var pg = class {
- constructor(e) {
- C(this, "_saturation", 0);
- C(this, "_hue", 0);
- C(this, "_lightness", 0);
- C(this, "_alpha", 0);
- 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;
- if (a === o) {
- this._hue = 0, this._saturation = 0, this._lightness = a;
- return;
- }
- 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;
- }
- asRgbColor() {
- const e = new gs();
- if (this._saturation === 0)
- return e.setRgbColor(
- `rgba(${this._lightness * 255},${this._lightness * 255},${this._lightness * 255},${this._alpha * 255})`
- ), e.asRgbColor();
- let n;
- this._lightness < 0.5 ? n = this._lightness * (1 + this._saturation) : n = this._lightness + this._saturation - this._lightness * this._saturation;
- 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);
- return e.setRgbColor(
- `rgba(${Math.round(o * 255)},${Math.round(a * 255)},${Math.round(c * 255)},${this._alpha * 255})`
- ), e.asRgbColor();
- }
- getLightness() {
- return this._lightness;
- }
- getHue() {
- return this._hue;
- }
- getSaturation() {
- return this._saturation;
- }
- getAlpha() {
- return this._alpha;
- }
- setColor(e, n, r) {
- r < 0 && (r += 1), r > 1 && (r -= 1);
- let s;
- 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;
- }
- setLightness(e) {
- this._lightness = e;
- }
- };
- var It = class It2 extends Ln {
- constructor(n, r) {
- super(r);
- C(this, "_cssString");
- C(this, "_red");
- C(this, "_green");
- C(this, "_blue");
- C(this, "_alpha");
- let s = n.match(It2.RGBA_EXTRACT);
- if (s) {
- const i = +s[1], o = +s[2], a = +s[3], u = +s[4];
- this._cssString = n, this._red = i, this._green = o, this._blue = a, this._alpha = u;
- return;
- }
- if (s = n.match(It2.RGB_EXTRACT), s) {
- const i = +s[1], o = +s[2], a = +s[3];
- this._cssString = n, this._red = i, this._green = o, this._blue = a, this._alpha = 1;
- return;
- }
- throw new Error("Invalid rgba or rgb color");
- }
- asHexString() {
- return Ln.rgbColorToHexValue(this);
- }
- getRed() {
- let n = this._red + It2.RGB_COLOR_AMT;
- return n > 255 ? n = 255 : n < 0 && (n = 0), n;
- }
- getGreen() {
- let n = this._green + It2.RGB_COLOR_AMT;
- return n > 255 ? n = 255 : n < 0 && (n = 0), n;
- }
- getBlue() {
- let n = this._blue + It2.RGB_COLOR_AMT;
- return n > 255 ? n = 255 : n < 0 && (n = 0), n;
- }
- getAlpha() {
- return this._alpha;
- }
- getColorType() {
- return vt.RGB;
- }
- clone() {
- return new It2(this._cssString, this._builder);
- }
- asThemeColor() {
- throw new Error("rgb color not support to themeColor");
- }
- equals(n) {
- return n instanceof It2 ? n._red === this._red && n._blue === this._blue && n._green === this._green && n._alpha === this._alpha : false;
- }
- getCssString() {
- return this._cssString;
- }
- };
- C(It, "RGB_COLOR_AMT", 0), C(It, "RGBA_EXTRACT", new RegExp(
- "\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*"
- )), C(It, "RGB_EXTRACT", new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));
- var Ks = It;
- var Gt = class Gt2 extends Ln {
- constructor(n, r, s, i) {
- super(i);
- C(this, "_themeColorType");
- C(this, "_themeTint");
- C(this, "_themeColors");
- this._themeColorType = n, this._themeTint = r, this._themeColors = s;
- }
- lumValue(n, r) {
- if (n == null)
- return r;
- let s;
- return n < 0 ? s = r * (1 + n) : s = r * (1 - n) + (255 - 255 * (1 - n)), s;
- }
- asRgbColor() {
- const n = gg[this._themeColors];
- if (n == null)
- throw new Error("not find themeColors type");
- const r = n[this._themeColorType];
- if (r == null)
- throw new Error("not find themeColors value");
- let s;
- if (Gt2._cacheThemeColor.has(this._themeColors)) {
- if (s = Gt2._cacheThemeColor.get(this._themeColors), s.has(this._themeColorType))
- return s.get(this._themeColorType);
- } else
- s = /* @__PURE__ */ new Map(), Gt2._cacheThemeColor.set(this._themeColors, s);
- const i = new pg(Ln.hexValueToRgbColor(r));
- i.setLightness(this.lumValue(this._themeTint, i.getLightness() * 255) / 255);
- const o = i.asRgbColor();
- return s.set(this._themeColorType, o), o;
- }
- clone() {
- return new Gt2(this._themeColorType, this._themeTint, this._themeColors, this._builder);
- }
- equals(n) {
- return n instanceof Gt2 ? n._themeColorType === this._themeColorType : false;
- }
- getColorType() {
- return vt.THEME;
- }
- getThemeColorType() {
- return this._themeColorType;
- }
- };
- C(Gt, "_cacheThemeColor", /* @__PURE__ */ new Map());
- var Xs = Gt;
- var lC = "rgb(";
- var cC = "rgba(";
- var xo = {
- aliceBlue: [240, 248, 255],
- antiqueWhite: [250, 235, 215],
- aqua: [0, 255, 255],
- aquamarine: [127, 255, 212],
- azure: [240, 255, 255],
- beige: [245, 245, 220],
- bisque: [255, 228, 196],
- black: [0, 0, 0],
- blancheAlmond: [255, 235, 205],
- blue: [0, 0, 255],
- blueViolet: [138, 43, 226],
- brown: [165, 42, 42],
- burlyWood: [222, 184, 135],
- cadetBlue: [95, 158, 160],
- chartreuse: [127, 255, 0],
- chocolate: [210, 105, 30],
- coral: [255, 127, 80],
- cornFlowerBlue: [100, 149, 237],
- cornSilk: [255, 248, 220],
- crimson: [220, 20, 60],
- cyan: [0, 255, 255],
- darkblue: [0, 0, 139],
- darkCyan: [0, 139, 139],
- darkGoldenrod: [184, 132, 11],
- darkGray: [169, 169, 169],
- darkGreen: [0, 100, 0],
- darkGrey: [169, 169, 169],
- darkKhaki: [189, 183, 107],
- darkMagenta: [139, 0, 139],
- darkOliveGreen: [85, 107, 47],
- darkOrange: [255, 140, 0],
- darkOrchid: [153, 50, 204],
- darkRed: [139, 0, 0],
- darkSalmon: [233, 150, 122],
- darkSeaGreen: [143, 188, 143],
- darkSlateBlue: [72, 61, 139],
- darkSlateGray: [47, 79, 79],
- darkSlateGrey: [47, 79, 79],
- darkTurquoise: [0, 206, 209],
- darkViolet: [148, 0, 211],
- deepPink: [255, 20, 147],
- deepSkyBlue: [0, 191, 255],
- dimGray: [105, 105, 105],
- dimGrey: [105, 105, 105],
- dodgerBlue: [30, 144, 255],
- firebrick: [178, 34, 34],
- floralWhite: [255, 255, 240],
- forestGreen: [34, 139, 34],
- fuchsia: [255, 0, 255],
- gainsboro: [220, 220, 220],
- ghostWhite: [248, 248, 255],
- gold: [255, 215, 0],
- goldenrod: [218, 165, 32],
- gray: [128, 128, 128],
- green: [0, 128, 0],
- greenYellow: [173, 255, 47],
- grey: [128, 128, 128],
- honeydew: [240, 255, 240],
- hotPink: [255, 105, 180],
- indianRed: [205, 92, 92],
- indigo: [75, 0, 130],
- ivory: [255, 255, 240],
- khaki: [240, 230, 140],
- lavender: [230, 230, 250],
- lavenderBlush: [255, 240, 245],
- lawnGreen: [124, 252, 0],
- lemonChiffon: [255, 250, 205],
- lightblue: [173, 216, 230],
- lightCoral: [240, 128, 128],
- lightCyan: [224, 255, 255],
- lightGoldenrodYellow: [250, 250, 210],
- lightGray: [211, 211, 211],
- lightGreen: [144, 238, 144],
- lightGrey: [211, 211, 211],
- lightPink: [255, 182, 193],
- lightSalmon: [255, 160, 122],
- lightSeaGreen: [32, 178, 170],
- lightSkyBlue: [135, 206, 250],
- lightSlateGray: [119, 136, 153],
- lightSlateGrey: [119, 136, 153],
- lightSteelBlue: [176, 196, 222],
- lightYellow: [255, 255, 224],
- lime: [0, 255, 0],
- limeGreen: [50, 205, 50],
- linen: [250, 240, 230],
- magenta: [255, 0, 255],
- maroon: [128, 0, 0],
- mediumAquamarine: [102, 205, 170],
- mediumBlue: [0, 0, 205],
- mediumOrchid: [186, 85, 211],
- mediumPurple: [147, 112, 219],
- mediumSeaGreen: [60, 179, 113],
- mediumSlateBlue: [123, 104, 238],
- mediumSpringGreen: [0, 250, 154],
- mediumTurquoise: [72, 209, 204],
- mediumVioletRed: [199, 21, 133],
- midBightBlue: [25, 25, 112],
- mintCream: [245, 255, 250],
- mistyRose: [255, 228, 225],
- moccasin: [255, 228, 181],
- navajoWhite: [255, 222, 173],
- navy: [0, 0, 128],
- oldLace: [253, 245, 230],
- olive: [128, 128, 0],
- oliveDrab: [107, 142, 35],
- orange: [255, 165, 0],
- orangeRed: [255, 69, 0],
- orchid: [218, 112, 214],
- paleGoldenrod: [238, 232, 170],
- paleGreen: [152, 251, 152],
- paleTurquoise: [175, 238, 238],
- paleVioletRed: [219, 112, 147],
- papayaWhip: [255, 239, 213],
- peachPuff: [255, 218, 185],
- peru: [205, 133, 63],
- pink: [255, 192, 203],
- plum: [221, 160, 203],
- powderBlue: [176, 224, 230],
- purple: [128, 0, 128],
- rebeccaPurple: [102, 51, 153],
- red: [255, 0, 0],
- rosyBrown: [188, 143, 143],
- royalBlue: [65, 105, 225],
- saddleBrown: [139, 69, 19],
- salmon: [250, 128, 114],
- sandyBrown: [244, 164, 96],
- seaGreen: [46, 139, 87],
- seashell: [255, 245, 238],
- sienna: [160, 82, 45],
- silver: [192, 192, 192],
- skyBlue: [135, 206, 235],
- slateBlue: [106, 90, 205],
- slateGray: [119, 128, 144],
- slateGrey: [119, 128, 144],
- snow: [255, 255, 250],
- springGreen: [0, 255, 127],
- steelBlue: [70, 130, 180],
- tan: [210, 180, 140],
- teal: [0, 128, 128],
- thistle: [216, 191, 216],
- transparent: [255, 255, 255, 0],
- tomato: [255, 99, 71],
- turquoise: [64, 224, 208],
- violet: [238, 130, 238],
- wheat: [245, 222, 179],
- white: [255, 255, 255],
- whiteSmoke: [245, 245, 245],
- yellow: [255, 255, 0],
- yellowGreen: [154, 205, 5]
- };
- var Nt = class _Nt {
- constructor(e) {
- C(this, "_color");
- C(this, "_rgbColor");
- C(this, "_isValid", false);
- if (e == null) {
- this._setNullColor();
- return;
- }
- if (e instanceof _Nt) {
- this._color = { ...e._color }, this._rgbColor = { ...e._rgbColor };
- return;
- }
- const n = xu(e);
- if (n == null) {
- this._setNullColor();
- return;
- }
- this._color = n;
- const r = Rg(this._color);
- if (r == null) {
- this._setNullColor();
- return;
- }
- this._rgbColor = r, this._isValid = true;
- }
- static mix(e, n, r) {
- var c, l;
- r = Math.min(1, Math.max(0, r));
- 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 = {
- r: (i.r - s.r) * r + s.r,
- g: (i.g - s.g) * r + s.g,
- b: (i.b - s.b) * r + s.b,
- a: (a - o) * r + o
- };
- return new _Nt(u);
- }
- static getContrastRatio(e, n) {
- const r = new _Nt(e).getLuminance(), s = new _Nt(n).getLuminance();
- return (Math.max(r, s) + 0.05) / (Math.min(r, s) + 0.05);
- }
- get isValid() {
- return this._isValid;
- }
- toRgb() {
- return this._rgbColor;
- }
- toRgbString() {
- const { r: e, g: n, b: r, a: s = 1 } = this.toRgb(), i = s < 1;
- return `rgb${i ? "a" : ""}(${e},${n},${r}${i ? `,${s}` : ""})`;
- }
- toString() {
- return this.toRgbString();
- }
- toHexString(e) {
- const { r: n, g: r, b: s, a: i = 1 } = this.toRgb(), o = i < 1, a = [
- _r(Math.round(n).toString(16)),
- _r(Math.round(r).toString(16)),
- _r(Math.round(s).toString(16)),
- _r(Math.round(i * 255).toString(16))
- ];
- 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]}`;
- }
- toHsv() {
- return wg(this.toRgb());
- }
- toHsl() {
- return yg(this.toRgb());
- }
- lighten(e = 10) {
- const n = this.toHsl();
- return n.l += e, n.l = Math.min(Math.max(n.l, 0), 100), new _Nt(n);
- }
- darken(e = 10) {
- const n = this.toHsl();
- return n.l -= e, n.l = Math.min(Math.max(n.l, 0), 100), new _Nt(n);
- }
- setAlpha(e) {
- return new _Nt({ ...this._rgbColor, a: e });
- }
- getLuminance() {
- let { r: e, g: n, b: r } = this.toRgb();
- return e = bs(e), n = bs(n), r = bs(r), Number((0.2126 * e + 0.7152 * n + 0.0722 * r).toFixed(3));
- }
- getBrightness() {
- const { r: e, g: n, b: r } = this.toRgb();
- return (e * 299 + n * 587 + r * 114) / 1e3;
- }
- getAlpha() {
- var e;
- return (e = this._color.a) != null ? e : 1;
- }
- isDark() {
- return this.getBrightness() < 128;
- }
- isLight() {
- return !this.isDark();
- }
- _setNullColor() {
- this._isValid = false, this._color = {
- r: 0,
- g: 0,
- b: 0,
- a: 0
- }, this._rgbColor = {
- r: 0,
- g: 0,
- b: 0,
- a: 0
- };
- }
- };
- var _r = (t) => t.length === 1 ? `0${t}` : t;
- var bs = (t) => (t /= 255, t <= 0.03928 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4);
- var xu = (t) => {
- if (bg(t)) {
- if ("r" in t) {
- const r = {
- r: Math.round(t.r),
- g: Math.round(t.g),
- b: Math.round(t.b)
- };
- return t.a !== void 0 && (r.a = t.a), r;
- }
- if ("l" in t) {
- const r = {
- h: Math.round(t.h),
- s: t.s,
- l: t.l
- };
- return t.a !== void 0 && (r.a = t.a), r;
- }
- const n = {
- h: Math.round(t.h),
- s: t.s,
- v: t.v
- };
- return t.a !== void 0 && (n.a = t.a), n;
- }
- const e = t.trim();
- if (xo[e]) {
- const n = xo[e], r = {
- r: Math.round(n[0]),
- g: Math.round(n[1]),
- b: Math.round(n[2])
- };
- return r.a = n[3] || 1, r;
- }
- if (e.startsWith("#"))
- return mg(e);
- if (e.startsWith("rgb"))
- return _g(e);
- if (e.startsWith("hsl"))
- return Eg(e);
- if (e.startsWith("hsv"))
- return Cg(e);
- };
- var mg = (t) => {
- const e = t.substring(1), n = new RegExp(`.{1,${e.length >= 6 ? 2 : 1}}`, "g");
- let r = e.match(n);
- if (!r || r.length < 3)
- throw new Error(`The color '${t}' is illegal hex color`);
- r[0].length === 1 && (r = r.map((i) => i + i));
- const s = {
- r: Number.parseInt(r[0], 16),
- g: Number.parseInt(r[1], 16),
- b: Number.parseInt(r[2], 16)
- };
- return r.length > 3 && (s.a = Number.parseInt(r[3], 16) / 255), s;
- };
- var _g = (t) => {
- const e = t.indexOf("(");
- if (e === -1)
- throw new Error(`The color '${t}' is illegal rgb color`);
- const n = t.substring(e + 1, t.length - 1).split(",");
- if (n.length < 3)
- throw new Error(`The color '${t}' is illegal rgb color`);
- const r = {
- r: Number.parseInt(n[0], 10),
- g: Number.parseInt(n[1], 10),
- b: Number.parseInt(n[2], 10)
- };
- return n.length > 3 && (r.a = Number.parseFloat(n[3])), r;
- };
- var Eg = (t) => {
- const e = t.indexOf("(");
- if (e === -1)
- throw new Error(`The color '${t}' is illegal hsl color`);
- const n = t.substring(e + 1, t.length - 1).split(",");
- if (n.length < 3)
- throw new Error(`The color '${t}' is illegal hsl color`);
- const r = {
- h: Number.parseInt(n[0], 10),
- s: Number.parseFloat(n[1]),
- l: Number.parseFloat(n[2])
- };
- return n.length > 3 && (r.a = Number.parseFloat(n[3])), r;
- };
- var Cg = (t) => {
- const e = t.indexOf("(");
- if (e === -1)
- throw new Error(`The color '${t}' is illegal hsv color`);
- const n = t.substring(e + 1, t.length - 1).split(",");
- if (n.length < 3)
- throw new Error(`The color '${t}' is illegal hsv color`);
- const r = {
- h: Number.parseInt(n[0], 10),
- s: Number.parseFloat(n[1]),
- v: Number.parseFloat(n[2])
- };
- return n.length > 3 && (r.a = Number.parseFloat(n[3])), r;
- };
- var Rg = (t) => {
- const e = xu(t);
- if (e != null)
- return "r" in e ? e : "l" in e ? Ig(e) : vg(e);
- };
- 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);
- var Ig = (t) => {
- let { h: e, s: n, l: r } = t;
- e /= 360, n /= 100, r /= 100;
- let s = 0, i = 0, o = 0;
- if (n === 0)
- s = i = o = r;
- else {
- const u = r < 0.5 ? r * (1 + n) : r + n - r * n, c = 2 * r - u;
- s = Ss(c, u, e + 1 / 3), i = Ss(c, u, e), o = Ss(c, u, e - 1 / 3);
- }
- const a = {
- r: Math.round(s * 255),
- g: Math.round(i * 255),
- b: Math.round(o * 255)
- };
- return t.a !== void 0 && (a.a = t.a), a;
- };
- var vg = (t) => {
- let { h: e, s: n, v: r } = t;
- e = e / 360 * 6, n /= 100, r /= 100;
- 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 = {
- r: l * 255,
- g: h * 255,
- b: d * 255
- };
- return t.a !== void 0 && (f.a = t.a), f;
- };
- var yg = (t) => {
- let { r: e, g: n, b: r } = t;
- e /= 255, n /= 255, r /= 255;
- const s = Math.max(e, n, r), i = Math.min(e, n, r), o = (s + i) / 2;
- let a, u;
- if (s === i)
- a = u = 0;
- else {
- const l = s - i;
- switch (u = o > 0.5 ? l / (2 - s - i) : l / (s + i), s) {
- case e:
- a = (n - r) / l + (n < r ? 6 : 0);
- break;
- case n:
- a = (r - e) / l + 2;
- break;
- default:
- a = (e - n) / l + 4;
- break;
- }
- a /= 6;
- }
- const c = {
- h: Math.round(a * 360),
- s: Math.round(u * 100),
- l: Math.round(o * 100)
- };
- return t.a !== void 0 && (c.a = t.a), c;
- };
- var wg = (t) => {
- let { r: e, g: n, b: r } = t;
- e /= 255, n /= 255, r /= 255;
- const s = Math.max(e, n, r), i = Math.min(e, n, r);
- let o;
- const a = s, u = s - i, c = s === 0 ? 0 : u / s;
- if (s === i)
- o = 0;
- else {
- switch (s) {
- case e:
- o = (n - r) / u + (n < r ? 6 : 0);
- break;
- case n:
- o = (r - e) / u + 2;
- break;
- default:
- o = (e - n) / u + 4;
- break;
- }
- o /= 6;
- }
- const l = {
- h: Math.round(o * 360),
- s: Math.round(c * 100),
- v: Math.round(a * 100)
- };
- return t.a !== void 0 && (l.a = t.a), l;
- };
- var Og = (t) => t == null;
- var bg = (t) => !Og(t) && typeof t == "object";
- function hC(t) {
- 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+)\)$/;
- return !!(e.test(t) || n.test(t) || r.test(t) || s.test(t) || i.test(t));
- }
- function dC(t) {
- 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+)\)$/;
- return !!(e.test(t) || n.test(t) || r.test(t) || s.test(t) || i.test(t));
- }
- var Pe = ((t) => (t[t.COVER = 0] = "COVER", t[t.REPLACE = 1] = "REPLACE", t))(Pe || {});
- function fC(t) {
- 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);
- }
- function gC(t) {
- if (t.t !== void 0)
- return t.t;
- if (typeof t.v == "string")
- return dn.STRING;
- if (typeof t.v == "number")
- return dn.NUMBER;
- if (typeof t.v == "boolean")
- return dn.BOOLEAN;
- }
- function pC(t) {
- if (t == null)
- return true;
- const { v: e, f: n, si: r, p: s, custom: i } = t;
- return !(!(e == null || typeof e == "string" && e.length === 0) || n != null && n.length > 0 || r != null && r.length > 0 || s != null || i != null);
- }
- function mC(t) {
- return t != null && (typeof t == "string" || typeof t == "number" || typeof t == "boolean");
- }
- 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 || {});
- 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 || {});
- function _C(t) {
- return [t.startRow, t.startColumn, t.endRow, t.endColumn];
- }
- var Sg = ((t) => (t.NONE = "none", t.BACKWARD = "backward", t.FORWARD = "forward", t))(Sg || {});
- var Ag = ((t) => (t.RECT = "RECT", t.TEXT = "TEXT", t))(Ag || {});
- function EC(t, e, n) {
- let r = false, s = false, i = t, o = e, a = t, u = e;
- if (n == null)
- return {
- actualRow: t,
- actualColumn: e,
- isMergedMainCell: s,
- isMerged: r,
- endRow: i,
- endColumn: o,
- startRow: a,
- startColumn: u
- };
- for (let c = 0; c < n.length; c++) {
- const {
- startRow: l,
- endRow: h,
- startColumn: d,
- endColumn: f
- } = n[c];
- if (t === l && e === d) {
- i = h, o = f, a = l, u = d, s = true;
- break;
- }
- if (t >= l && t <= h && e >= d && e <= f) {
- i = h, o = f, a = l, u = d, r = true;
- break;
- }
- }
- return {
- actualRow: t,
- actualColumn: e,
- isMergedMainCell: s,
- isMerged: r,
- endRow: i,
- endColumn: o,
- startRow: a,
- startColumn: u
- };
- }
- var zn = ((t) => (t.Raw = "raw", t.Intercepted = "intercepted", t.Both = "both", t))(zn || {});
- function Ng(t) {
- const { actualRow: e, actualColumn: n, isMerged: r, isMergedMainCell: s, mergeInfo: i } = t;
- let { startY: o, endY: a, startX: u, endX: c } = t, l = e, h = n, d = e, f = n;
- if (r && i) {
- const {
- startRow: E,
- startColumn: R,
- endRow: O,
- endColumn: U,
- startY: ne,
- endY: X,
- startX: de,
- endX: T
- } = i;
- l = E, h = R, d = O, f = U, o = ne, a = X, u = de, c = T;
- }
- return s && (o = i.startY, a = i.endY, u = i.startX, c = i.endX, d = i.endRow, f = i.endColumn), {
- startRow: l,
- startColumn: h,
- endRow: d,
- endColumn: f,
- startY: o,
- endY: a,
- startX: u,
- endX: c
- };
- }
- var CC = Ng;
- function RC(t) {
- if (!t)
- return;
- const {
- actualRow: e,
- actualColumn: n,
- isMerged: r,
- isMergedMainCell: s,
- startRow: i,
- startColumn: o,
- endRow: a,
- endColumn: u
- } = t;
- let c = e, l = n, h = e, d = n;
- return (r || s) && (c = i, l = o, h = a, d = u), {
- startRow: c,
- startColumn: l,
- endRow: h,
- endColumn: d
- };
- }
- function Tg(t) {
- var n;
- return !t || (((n = t == null ? void 0 : t.v) == null ? void 0 : n.toString()) || "").length === 0 && !t.p;
- }
- function IC(t) {
- return Tg(t) && (t == null ? void 0 : t.coverable) !== false;
- }
- function Lt(t) {
- if (t) {
- if (t.rgb)
- return t.rgb;
- if (t.th)
- return new gs().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString();
- }
- return null;
- }
- function vC(t) {
- return re.isString(t) && t.substring(0, 1) === "=" && t.length > 1;
- }
- function yC(t) {
- return re.isString(t) && t.length > 0;
- }
- function wC(t, e = false) {
- var i;
- let n = "";
- const r = /* @__PURE__ */ new Map([
- [
- "ff",
- () => {
- t.ff && (n += `font-family: ${t.ff}; `);
- }
- ],
- [
- "fs",
- () => {
- if (t.fs) {
- let o = t.fs;
- t.va && (o /= 2), n += `font-size: ${o}pt; `;
- }
- }
- ],
- [
- "it",
- () => {
- t.it && (n += "font-style: italic; ");
- }
- ],
- [
- "bl",
- () => {
- t.bl && (n += "font-weight: bold; ");
- }
- ],
- [
- "ul",
- () => {
- var o;
- (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} `));
- }
- ],
- [
- "st",
- () => {
- var o;
- (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} `));
- }
- ],
- [
- "ol",
- () => {
- var o;
- (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} `));
- }
- ],
- [
- "bg",
- () => {
- t.bg && (n += `background: ${Lt(t.bg)}; `);
- }
- ],
- [
- "bd",
- () => {
- var o, a, u, c, l, h, d, f, E, R, O, U;
- (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 : ""}; `);
- }
- ],
- [
- "cl",
- () => {
- t.cl && (n += `color: ${Lt(t.cl)}; `);
- }
- ],
- [
- "va",
- () => {
- t.va === Bt.SUBSCRIPT ? n += "vertical-align: sub; " : t.va === Bt.SUPERSCRIPT && (n += "vertical-align: super; ");
- }
- ],
- [
- "td",
- () => {
- t.td === er.LEFT_TO_RIGHT ? n += "direction: ltr; " : t.td === er.RIGHT_TO_LEFT && (n += "direction: rtl; ");
- }
- ],
- [
- "tr",
- () => {
- var o, a, u;
- 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}` : ""});`);
- }
- ],
- [
- "ht",
- () => {
- 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; ");
- }
- ],
- [
- "vt",
- () => {
- t.vt === hn.BOTTOM ? n += "vertical-align: bottom; " : t.vt === hn.TOP ? n += "vertical-align: top; " : t.vt === hn.MIDDLE && (n += "vertical-align: middle; ");
- }
- ],
- [
- "tb",
- () => {
- t.tb === xn.CLIP ? n += "white-space: nowrap; overflow-x: hidden; " : t.tb === xn.WRAP && (n += "white-space: normal;");
- }
- ],
- [
- "pd",
- () => {
- var l, h, d, f, E, R, O, U;
- 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`;
- (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}; `);
- }
- ]
- ]), s = ["bd", "tr", "tb"];
- for (const o in t)
- e && s.includes(o) || (i = r.get(o)) == null || i();
- return n;
- }
- function Er(t) {
- let e = "";
- 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;
- }
- function OC(t) {
- let e = 0;
- if (t = t.trim(), t === "none")
- e = Xe.NONE;
- else if (t === "0.5pt solid")
- e = Xe.THIN;
- else if (t === "0.5pt double")
- e = Xe.HAIR;
- else if (t === "0.5pt dotted")
- e = Xe.DOTTED;
- else if (t === "0.5pt dashed")
- e = Xe.DASHED;
- else if (t === "1pt solid")
- e = Xe.MEDIUM;
- else if (t === "1pt dashed")
- e = Xe.MEDIUM_DASHED;
- else if (t === "1pt dotted")
- e = Xe.MEDIUM_DASH_DOT_DOT;
- else if (t === "1.5pt solid")
- e = Xe.THICK;
- else if (!t.includes("none"))
- e = Xe.THIN;
- else
- return Xe.NONE;
- return e;
- }
- function bC(t, e) {
- let n = t.body;
- if (e) {
- const { headers: r, footers: s } = t;
- r != null && r[e] ? n = r[e].body : s != null && s[e] && (n = s[e].body);
- }
- return n;
- }
- function SC(t, e) {
- const { startRow: n, endRow: r, startColumn: s, endColumn: i, rangeType: o } = t;
- 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)))
- return false;
- if (e) {
- const a = e.getRowCount(), u = e.getColumnCount();
- if (r >= a || i >= u)
- return false;
- }
- return true;
- }
- function AC(t, e) {
- return { startRow: t, endRow: t, startColumn: e, endColumn: e };
- }
- function Lu(t, e) {
- 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;
- }
- function Mg(t, e) {
- const n = t.ts || {}, r = e.ts || {};
- return t.sId !== e.sId ? false : Lu(n, r);
- }
- function NC(t, e) {
- return e.some((n) => t.indexOf(n) > -1);
- }
- var Pr = { exports: {} };
- var Dg = Pr.exports;
- var Lo;
- function xg() {
- return Lo || (Lo = 1, function(t, e) {
- (function(n, r) {
- t.exports = r();
- })(Dg, function() {
- 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) {
- var b = ["th", "st", "nd", "rd"], w = M % 100;
- return "[" + M + (b[(w - 20) % 10] || b[w] || b[0]) + "]";
- } }, X = function(M, b, w) {
- var k = String(M);
- return !k || k.length >= b ? M : "" + Array(b + 1 - k.length).join(w) + M;
- }, de = { s: X, z: function(M) {
- var b = -M.utcOffset(), w = Math.abs(b), k = Math.floor(w / 60), $ = w % 60;
- return (b <= 0 ? "+" : "-") + X(k, 2, "0") + ":" + X($, 2, "0");
- }, m: function M(b, w) {
- if (b.date() < w.date())
- return -M(w, b);
- 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);
- return +(-(k + (w - $) / (Y ? $ - se : se - $)) || 0);
- }, a: function(M) {
- return M < 0 ? Math.ceil(M) || 0 : Math.floor(M);
- }, p: function(M) {
- 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$/, "");
- }, u: function(M) {
- return M === void 0;
- } }, T = "en", A = {};
- A[T] = ne;
- var H = "$isDayjsObject", Z = function(M) {
- return M instanceof j || !(!M || !M[H]);
- }, fe = function M(b, w, k) {
- var $;
- if (!b)
- return T;
- if (typeof b == "string") {
- var Y = b.toLowerCase();
- A[Y] && ($ = Y), w && (A[Y] = w, $ = Y);
- var se = b.split("-");
- if (!$ && se.length > 1)
- return M(se[0]);
- } else {
- var he = b.name;
- A[he] = b, $ = he;
- }
- return !k && $ && (T = $), $ || !k && T;
- }, ae = function(M, b) {
- if (Z(M))
- return M.clone();
- var w = typeof b == "object" ? b : {};
- return w.date = M, w.args = arguments, new j(w);
- }, m = de;
- m.l = fe, m.i = Z, m.w = function(M, b) {
- return ae(M, { locale: b.$L, utc: b.$u, x: b.$x, $offset: b.$offset });
- };
- var j = function() {
- function M(w) {
- this.$L = fe(w.locale, null, true), this.parse(w), this.$x = this.$x || w.x || {}, this[H] = true;
- }
- var b = M.prototype;
- return b.parse = function(w) {
- this.$d = function(k) {
- var $ = k.date, Y = k.utc;
- if ($ === null)
- return /* @__PURE__ */ new Date(NaN);
- if (m.u($))
- return /* @__PURE__ */ new Date();
- if ($ instanceof Date)
- return new Date($);
- if (typeof $ == "string" && !/Z$/i.test($)) {
- var se = $.match(O);
- if (se) {
- var he = se[2] - 1 || 0, ge = (se[7] || "0").substring(0, 3);
- 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);
- }
- }
- return new Date($);
- }(w), this.init();
- }, b.init = function() {
- var w = this.$d;
- 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();
- }, b.$utils = function() {
- return m;
- }, b.isValid = function() {
- return this.$d.toString() !== R;
- }, b.isSame = function(w, k) {
- var $ = ae(w);
- return this.startOf(k) <= $ && $ <= this.endOf(k);
- }, b.isAfter = function(w, k) {
- return ae(w) < this.startOf(k);
- }, b.isBefore = function(w, k) {
- return this.endOf(k) < ae(w);
- }, b.$g = function(w, k, $) {
- return m.u(w) ? this[k] : this.set($, w);
- }, b.unix = function() {
- return Math.floor(this.valueOf() / 1e3);
- }, b.valueOf = function() {
- return this.$d.getTime();
- }, b.startOf = function(w, k) {
- var $ = this, Y = !!m.u(k) || k, se = m.p(w), he = function(z, W) {
- var ue = m.w($.$u ? Date.UTC($.$y, W, z) : new Date($.$y, W, z), $);
- return Y ? ue : ue.endOf(c);
- }, ge = function(z, W) {
- return m.w($.toDate()[z].apply($.toDate("s"), (Y ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(W)), $);
- }, Ae = this.$W, be = this.$M, v = this.$D, F = "set" + (this.$u ? "UTC" : "");
- switch (se) {
- case f:
- return Y ? he(1, 0) : he(31, 11);
- case h:
- return Y ? he(1, be) : he(0, be + 1);
- case l:
- var V = this.$locale().weekStart || 0, K = (Ae < V ? Ae + 7 : Ae) - V;
- return he(Y ? v - K : v + (6 - K), be);
- case c:
- case E:
- return ge(F + "Hours", 0);
- case u:
- return ge(F + "Minutes", 1);
- case a:
- return ge(F + "Seconds", 2);
- case o:
- return ge(F + "Milliseconds", 3);
- default:
- return this.clone();
- }
- }, b.endOf = function(w) {
- return this.startOf(w, false);
- }, b.$set = function(w, k) {
- 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;
- if (Y === h || Y === f) {
- var Ae = this.clone().set(E, 1);
- Ae.$d[he](ge), Ae.init(), this.$d = Ae.set(E, Math.min(this.$D, Ae.daysInMonth())).$d;
- } else
- he && this.$d[he](ge);
- return this.init(), this;
- }, b.set = function(w, k) {
- return this.clone().$set(w, k);
- }, b.get = function(w) {
- return this[m.p(w)]();
- }, b.add = function(w, k) {
- var $, Y = this;
- w = Number(w);
- var se = m.p(k), he = function(be) {
- var v = ae(Y);
- return m.w(v.date(v.date() + Math.round(be * w)), Y);
- };
- if (se === h)
- return this.set(h, this.$M + w);
- if (se === f)
- return this.set(f, this.$y + w);
- if (se === c)
- return he(1);
- if (se === l)
- return he(7);
- var ge = ($ = {}, $[a] = r, $[u] = s, $[o] = n, $)[se] || 1, Ae = this.$d.getTime() + w * ge;
- return m.w(Ae, this);
- }, b.subtract = function(w, k) {
- return this.add(-1 * w, k);
- }, b.format = function(w) {
- var k = this, $ = this.$locale();
- if (!this.isValid())
- return $.invalidDate || R;
- 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) {
- return W && (W[ue] || W(k, Y)) || oe[ue].slice(0, B);
- }, K = function(W) {
- return m.s(he % 12 || 12, W, "0");
- }, z = F || function(W, ue, oe) {
- var B = W < 12 ? "AM" : "PM";
- return oe ? B.toLowerCase() : B;
- };
- return Y.replace(U, function(W, ue) {
- return ue || function(oe) {
- switch (oe) {
- case "YY":
- return String(k.$y).slice(-2);
- case "YYYY":
- return m.s(k.$y, 4, "0");
- case "M":
- return Ae + 1;
- case "MM":
- return m.s(Ae + 1, 2, "0");
- case "MMM":
- return V($.monthsShort, Ae, v, 3);
- case "MMMM":
- return V(v, Ae);
- case "D":
- return k.$D;
- case "DD":
- return m.s(k.$D, 2, "0");
- case "d":
- return String(k.$W);
- case "dd":
- return V($.weekdaysMin, k.$W, be, 2);
- case "ddd":
- return V($.weekdaysShort, k.$W, be, 3);
- case "dddd":
- return be[k.$W];
- case "H":
- return String(he);
- case "HH":
- return m.s(he, 2, "0");
- case "h":
- return K(1);
- case "hh":
- return K(2);
- case "a":
- return z(he, ge, true);
- case "A":
- return z(he, ge, false);
- case "m":
- return String(ge);
- case "mm":
- return m.s(ge, 2, "0");
- case "s":
- return String(k.$s);
- case "ss":
- return m.s(k.$s, 2, "0");
- case "SSS":
- return m.s(k.$ms, 3, "0");
- case "Z":
- return se;
- }
- return null;
- }(W) || se.replace(":", "");
- });
- }, b.utcOffset = function() {
- return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
- }, b.diff = function(w, k, $) {
- var Y, se = this, he = m.p(k), ge = ae(w), Ae = (ge.utcOffset() - this.utcOffset()) * r, be = this - ge, v = function() {
- return m.m(se, ge);
- };
- switch (he) {
- case f:
- Y = v() / 12;
- break;
- case h:
- Y = v();
- break;
- case d:
- Y = v() / 3;
- break;
- case l:
- Y = (be - Ae) / 6048e5;
- break;
- case c:
- Y = (be - Ae) / 864e5;
- break;
- case u:
- Y = be / s;
- break;
- case a:
- Y = be / r;
- break;
- case o:
- Y = be / n;
- break;
- default:
- Y = be;
- }
- return $ ? Y : m.a(Y);
- }, b.daysInMonth = function() {
- return this.endOf(h).$D;
- }, b.$locale = function() {
- return A[this.$L];
- }, b.locale = function(w, k) {
- if (!w)
- return this.$L;
- var $ = this.clone(), Y = fe(w, k, true);
- return Y && ($.$L = Y), $;
- }, b.clone = function() {
- return m.w(this.$d, this);
- }, b.toDate = function() {
- return new Date(this.valueOf());
- }, b.toJSON = function() {
- return this.isValid() ? this.toISOString() : null;
- }, b.toISOString = function() {
- return this.$d.toISOString();
- }, b.toString = function() {
- return this.$d.toUTCString();
- }, M;
- }(), y = j.prototype;
- return ae.prototype = y, [["$ms", i], ["$s", o], ["$m", a], ["$H", u], ["$W", c], ["$M", h], ["$y", f], ["$D", E]].forEach(function(M) {
- y[M[1]] = function(b) {
- return this.$g(b, M[0], M[1]);
- };
- }), ae.extend = function(M, b) {
- return M.$i || (M(b, j, ae), M.$i = true), ae;
- }, ae.locale = fe, ae.isDayjs = Z, ae.unix = function(M) {
- return ae(1e3 * M);
- }, ae.en = A[T], ae.Ls = A, ae.p = {}, ae;
- });
- }(Pr)), Pr.exports;
- }
- var Lg = xg();
- var rn = wt(Lg);
- var kr = { exports: {} };
- var Ug = kr.exports;
- var Uo;
- function Pg() {
- return Uo || (Uo = 1, function(t, e) {
- (function(n, r) {
- t.exports = r();
- })(Ug, function() {
- return function(n, r) {
- var s = r.prototype, i = s.format;
- s.format = function(o) {
- var a = this, u = this.$locale();
- if (!this.isValid())
- return i.bind(this)(o);
- 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) {
- switch (h) {
- case "Q":
- return Math.ceil((a.$M + 1) / 3);
- case "Do":
- return u.ordinal(a.$D);
- case "gggg":
- return a.weekYear();
- case "GGGG":
- return a.isoWeekYear();
- case "wo":
- return u.ordinal(a.week(), "W");
- case "w":
- case "ww":
- return c.s(a.week(), h === "w" ? 1 : 2, "0");
- case "W":
- case "WW":
- return c.s(a.isoWeek(), h === "W" ? 1 : 2, "0");
- case "k":
- case "kk":
- return c.s(String(a.$H === 0 ? 24 : a.$H), h === "k" ? 1 : 2, "0");
- case "X":
- return Math.floor(a.$d.getTime() / 1e3);
- case "x":
- return a.$d.getTime();
- case "z":
- return "[" + a.offsetName() + "]";
- case "zzz":
- return "[" + a.offsetName("long") + "]";
- default:
- return h;
- }
- });
- return i.bind(this)(l);
- };
- };
- });
- }(kr)), kr.exports;
- }
- var kg = Pg();
- var Fg = wt(kg);
- var Fr = { exports: {} };
- var $g = Fr.exports;
- var Po;
- function Bg() {
- return Po || (Po = 1, function(t, e) {
- (function(n, r) {
- t.exports = r();
- })($g, function() {
- 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) {
- return (O = +O) + (O > 68 ? 1900 : 2e3);
- }, l = function(O) {
- return function(U) {
- this[O] = +U;
- };
- }, h = [/[+-]\d\d:?(\d\d)?|Z/, function(O) {
- (this.zone || (this.zone = {})).offset = function(U) {
- if (!U || U === "Z")
- return 0;
- var ne = U.match(/([+-]|\d\d)/g), X = 60 * ne[1] + (+ne[2] || 0);
- return X === 0 ? 0 : ne[0] === "+" ? -X : X;
- }(O);
- }], d = function(O) {
- var U = u[O];
- return U && (U.indexOf ? U : U.s.concat(U.f));
- }, f = function(O, U) {
- var ne, X = u.meridiem;
- if (X) {
- for (var de = 1; de <= 24; de += 1)
- if (O.indexOf(X(de, 0, U)) > -1) {
- ne = de > 12;
- break;
- }
- } else
- ne = O === (U ? "pm" : "PM");
- return ne;
- }, E = { A: [a, function(O) {
- this.afternoon = f(O, false);
- }], a: [a, function(O) {
- this.afternoon = f(O, true);
- }], Q: [s, function(O) {
- this.month = 3 * (O - 1) + 1;
- }], S: [s, function(O) {
- this.milliseconds = 100 * +O;
- }], SS: [i, function(O) {
- this.milliseconds = 10 * +O;
- }], SSS: [/\d{3}/, function(O) {
- this.milliseconds = +O;
- }], 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) {
- var U = u.ordinal, ne = O.match(/\d+/);
- if (this.day = ne[0], U)
- for (var X = 1; X <= 31; X += 1)
- U(X).replace(/\[|\]/g, "") === O && (this.day = X);
- }], w: [o, l("week")], ww: [i, l("week")], M: [o, l("month")], MM: [i, l("month")], MMM: [a, function(O) {
- var U = d("months"), ne = (d("monthsShort") || U.map(function(X) {
- return X.slice(0, 3);
- })).indexOf(O) + 1;
- if (ne < 1)
- throw new Error();
- this.month = ne % 12 || ne;
- }], MMMM: [a, function(O) {
- var U = d("months").indexOf(O) + 1;
- if (U < 1)
- throw new Error();
- this.month = U % 12 || U;
- }], Y: [/[+-]?\d+/, l("year")], YY: [i, function(O) {
- this.year = c(O);
- }], YYYY: [/\d{4}/, l("year")], Z: h, ZZ: h };
- function R(O) {
- var U, ne;
- U = O, ne = u && u.formats;
- for (var X = (O = U.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(ae, m, j) {
- var y = j && j.toUpperCase();
- return m || ne[j] || n[j] || ne[y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(M, b, w) {
- return b || w.slice(1);
- });
- })).match(r), de = X.length, T = 0; T < de; T += 1) {
- var A = X[T], H = E[A], Z = H && H[0], fe = H && H[1];
- X[T] = fe ? { regex: Z, parser: fe } : A.replace(/^\[|\]$/g, "");
- }
- return function(ae) {
- for (var m = {}, j = 0, y = 0; j < de; j += 1) {
- var M = X[j];
- if (typeof M == "string")
- y += M.length;
- else {
- var b = M.regex, w = M.parser, k = ae.slice(y), $ = b.exec(k)[0];
- w.call(m, $), ae = ae.replace($, "");
- }
- }
- return function(Y) {
- var se = Y.afternoon;
- if (se !== void 0) {
- var he = Y.hours;
- se ? he < 12 && (Y.hours += 12) : he === 12 && (Y.hours = 0), delete Y.afternoon;
- }
- }(m), m;
- };
- }
- return function(O, U, ne) {
- ne.p.customParseFormat = true, O && O.parseTwoDigitYear && (c = O.parseTwoDigitYear);
- var X = U.prototype, de = X.parse;
- X.parse = function(T) {
- var A = T.date, H = T.utc, Z = T.args;
- this.$u = H;
- var fe = Z[1];
- if (typeof fe == "string") {
- var ae = Z[2] === true, m = Z[3] === true, j = ae || m, y = Z[2];
- m && (y = Z[2]), u = this.$locale(), !ae && y && (u = ne.Ls[y]), this.$d = function(k, $, Y, se) {
- try {
- if (["x", "X"].indexOf($) > -1)
- return new Date(($ === "X" ? 1e3 : 1) * k);
- 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;
- ge && !Ae || (ee = Ae > 0 ? Ae - 1 : ue.getMonth());
- var ie, pe = v || 0, Oe = F || 0, Me = V || 0, G = K || 0;
- 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);
- } catch {
- return /* @__PURE__ */ new Date("");
- }
- }(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 = {};
- } else if (fe instanceof Array)
- for (var M = fe.length, b = 1; b <= M; b += 1) {
- Z[1] = fe[b - 1];
- var w = ne.apply(this, Z);
- if (w.isValid()) {
- this.$d = w.$d, this.$L = w.$L, this.init();
- break;
- }
- b === M && (this.$d = /* @__PURE__ */ new Date(""));
- }
- else
- de.call(this, T);
- };
- };
- });
- }(Fr)), Fr.exports;
- }
- var jg = Bg();
- var Hg = wt(jg);
- var $r = { exports: {} };
- var Wg = $r.exports;
- var ko;
- function zg() {
- return ko || (ko = 1, function(t, e) {
- (function(n, r) {
- t.exports = r();
- })(Wg, function() {
- return function(n, r, s) {
- var i = r.prototype, o = function(h) {
- return h && (h.indexOf ? h : h.s);
- }, a = function(h, d, f, E, R) {
- var O = h.name ? h : h.$locale(), U = o(O[d]), ne = o(O[f]), X = U || ne.map(function(T) {
- return T.slice(0, E);
- });
- if (!R)
- return X;
- var de = O.weekStart;
- return X.map(function(T, A) {
- return X[(A + (de || 0)) % 7];
- });
- }, u = function() {
- return s.Ls[s.locale()];
- }, c = function(h, d) {
- return h.formats[d] || function(f) {
- return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(E, R, O) {
- return R || O.slice(1);
- });
- }(h.formats[d.toUpperCase()]);
- }, l = function() {
- var h = this;
- return { months: function(d) {
- return d ? d.format("MMMM") : a(h, "months");
- }, monthsShort: function(d) {
- return d ? d.format("MMM") : a(h, "monthsShort", "months", 3);
- }, firstDayOfWeek: function() {
- return h.$locale().weekStart || 0;
- }, weekdays: function(d) {
- return d ? d.format("dddd") : a(h, "weekdays");
- }, weekdaysMin: function(d) {
- return d ? d.format("dd") : a(h, "weekdaysMin", "weekdays", 2);
- }, weekdaysShort: function(d) {
- return d ? d.format("ddd") : a(h, "weekdaysShort", "weekdays", 3);
- }, longDateFormat: function(d) {
- return c(h.$locale(), d);
- }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
- };
- i.localeData = function() {
- return l.bind(this)();
- }, s.localeData = function() {
- var h = u();
- return { firstDayOfWeek: function() {
- return h.weekStart || 0;
- }, weekdays: function() {
- return s.weekdays();
- }, weekdaysShort: function() {
- return s.weekdaysShort();
- }, weekdaysMin: function() {
- return s.weekdaysMin();
- }, months: function() {
- return s.months();
- }, monthsShort: function() {
- return s.monthsShort();
- }, longDateFormat: function(d) {
- return c(h, d);
- }, meridiem: h.meridiem, ordinal: h.ordinal };
- }, s.months = function() {
- return a(u(), "months");
- }, s.monthsShort = function() {
- return a(u(), "monthsShort", "months", 3);
- }, s.weekdays = function(h) {
- return a(u(), "weekdays", null, null, h);
- }, s.weekdaysShort = function(h) {
- return a(u(), "weekdaysShort", "weekdays", 3, h);
- }, s.weekdaysMin = function(h) {
- return a(u(), "weekdaysMin", "weekdays", 2, h);
- };
- };
- });
- }($r)), $r.exports;
- }
- var Yg = zg();
- var Vg = wt(Yg);
- var Br = { exports: {} };
- var Gg = Br.exports;
- var Fo;
- function Kg() {
- return Fo || (Fo = 1, function(t, e) {
- (function(n, r) {
- t.exports = r();
- })(Gg, function() {
- 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" };
- return function(r, s, i) {
- var o = s.prototype, a = o.format;
- i.en.formats = n, o.format = function(u) {
- u === void 0 && (u = "YYYY-MM-DDTHH:mm:ssZ");
- var c = this.$locale().formats, l = function(h, d) {
- return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(f, E, R) {
- var O = R && R.toUpperCase();
- return E || d[R] || n[R] || d[O].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(U, ne, X) {
- return ne || X.slice(1);
- });
- });
- }(u, c === void 0 ? {} : c);
- return a.call(this, l);
- };
- };
- });
- }(Br)), Br.exports;
- }
- var Xg = Kg();
- var Jg = wt(Xg);
- var jr = { exports: {} };
- var Zg = jr.exports;
- var $o;
- function Qg() {
- return $o || ($o = 1, function(t, e) {
- (function(n, r) {
- t.exports = r();
- })(Zg, function() {
- var n = "minute", r = /[+-]\d\d(?::?\d\d)?/g, s = /([+-]|\d\d)/g;
- return function(i, o, a) {
- var u = o.prototype;
- a.utc = function(R) {
- var O = { date: R, utc: true, args: arguments };
- return new o(O);
- }, u.utc = function(R) {
- var O = a(this.toDate(), { locale: this.$L, utc: true });
- return R ? O.add(this.utcOffset(), n) : O;
- }, u.local = function() {
- return a(this.toDate(), { locale: this.$L, utc: false });
- };
- var c = u.parse;
- u.parse = function(R) {
- R.utc && (this.$u = true), this.$utils().u(R.$offset) || (this.$offset = R.$offset), c.call(this, R);
- };
- var l = u.init;
- u.init = function() {
- if (this.$u) {
- var R = this.$d;
- 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();
- } else
- l.call(this);
- };
- var h = u.utcOffset;
- u.utcOffset = function(R, O) {
- var U = this.$utils().u;
- if (U(R))
- return this.$u ? 0 : U(this.$offset) ? h.call(this) : this.$offset;
- if (typeof R == "string" && (R = function(T) {
- T === void 0 && (T = "");
- var A = T.match(r);
- if (!A)
- return null;
- var H = ("" + A[0]).match(s) || ["-", 0, 0], Z = H[0], fe = 60 * +H[1] + +H[2];
- return fe === 0 ? 0 : Z === "+" ? fe : -fe;
- }(R), R === null))
- return this;
- var ne = Math.abs(R) <= 16 ? 60 * R : R, X = this;
- if (O)
- return X.$offset = ne, X.$u = R === 0, X;
- if (R !== 0) {
- var de = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
- (X = this.local().add(ne + de, n)).$offset = ne, X.$x.$localOffset = de;
- } else
- X = this.utc();
- return X;
- };
- var d = u.format;
- u.format = function(R) {
- var O = R || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
- return d.call(this, O);
- }, u.valueOf = function() {
- var R = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
- return this.$d.valueOf() - 6e4 * R;
- }, u.isUTC = function() {
- return !!this.$u;
- }, u.toISOString = function() {
- return this.toDate().toISOString();
- }, u.toString = function() {
- return this.toDate().toUTCString();
- };
- var f = u.toDate;
- u.toDate = function(R) {
- return R === "s" && this.$offset ? a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : f.call(this);
- };
- var E = u.diff;
- u.diff = function(R, O, U) {
- if (R && this.$u === R.$u)
- return E.call(this, R, O, U);
- var ne = this.local(), X = a(R).local();
- return E.call(ne, X, O, U);
- };
- };
- });
- }(jr)), jr.exports;
- }
- var qg = Qg();
- var ep = wt(qg);
- var Hr = { exports: {} };
- var tp = Hr.exports;
- var Bo;
- function np() {
- return Bo || (Bo = 1, function(t, e) {
- (function(n, r) {
- t.exports = r();
- })(tp, function() {
- return function(n, r) {
- r.prototype.weekday = function(s) {
- var i = this.$locale().weekStart || 0, o = this.$W, a = (o < i ? o + 7 : o) - i;
- return this.$utils().u(s) ? a : this.subtract(a, "day").add(s, "day");
- };
- };
- });
- }(Hr)), Hr.exports;
- }
- var rp = np();
- var sp = wt(rp);
- var Wr = { exports: {} };
- var ip = Wr.exports;
- var jo;
- function op() {
- return jo || (jo = 1, function(t, e) {
- (function(n, r) {
- t.exports = r();
- })(ip, function() {
- var n = "week", r = "year";
- return function(s, i, o) {
- var a = i.prototype;
- a.week = function(u) {
- if (u === void 0 && (u = null), u !== null)
- return this.add(7 * (u - this.week()), "day");
- var c = this.$locale().yearStart || 1;
- if (this.month() === 11 && this.date() > 25) {
- var l = o(this).startOf(r).add(1, r).date(c), h = o(this).endOf(n);
- if (l.isBefore(h))
- return 1;
- }
- var d = o(this).startOf(r).date(c).startOf(n).subtract(1, "millisecond"), f = this.diff(d, n, true);
- return f < 0 ? o(this).startOf("week").week() : Math.ceil(f);
- }, a.weeks = function(u) {
- return u === void 0 && (u = null), this.week(u);
- };
- };
- });
- }(Wr)), Wr.exports;
- }
- var ap = op();
- var up = wt(ap);
- var zr = { exports: {} };
- var lp = zr.exports;
- var Ho;
- function cp() {
- return Ho || (Ho = 1, function(t, e) {
- (function(n, r) {
- t.exports = r();
- })(lp, function() {
- return function(n, r) {
- r.prototype.weekYear = function() {
- var s = this.month(), i = this.week(), o = this.year();
- return i === 1 && s === 11 ? o + 1 : s === 0 && i >= 52 ? o - 1 : o;
- };
- };
- });
- }(zr)), zr.exports;
- }
- var hp = cp();
- var dp = wt(hp);
- rn.extend(Hg);
- rn.extend(Fg);
- rn.extend(sp);
- rn.extend(Vg);
- rn.extend(up);
- rn.extend(dp);
- rn.extend(ep);
- rn.extend(Jg);
- function Li(t, e, n, r) {
- if (t > e)
- throw new Error("a1 should be less than a2");
- if (n > r)
- throw new Error("b1 should be less than b2");
- if (e < n || r < t)
- return [t, e];
- if (n <= t && r >= e)
- return [];
- const s = r - n + 1;
- 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];
- }
- function TC(t) {
- if (t == null)
- return false;
- const e = t.bullet;
- return (e == null ? void 0 : e.listId) != null;
- }
- function MC(t) {
- if (t == null)
- return false;
- const e = t.paragraphStyle;
- return fp(e);
- }
- function fp(t) {
- var e;
- return !(t == null || (t.indentStart == null || t.indentStart.v === 0) && t.hanging == null || ((e = t.hanging) == null ? void 0 : e.v) === 0);
- }
- function gp(t, e, n) {
- return t.slice(0, e) + n + t.slice(e);
- }
- function pp(t, e, n) {
- return e > n ? t : t.slice(0, e) + t.slice(n);
- }
- var mp = /\s/g;
- function DC(t) {
- return t === null || t.toString().replace(mp, "") === "" || typeof t == "boolean" ? false : !isNaN(t);
- }
- function xC(t) {
- let e = 0;
- for (let n = 0; n < t.length; n++)
- e = t.charCodeAt(n) + (e << 6) + (e << 16) - e;
- return e >>> 0;
- }
- var Ye = Symbol("newer");
- var rt = Symbol("older");
- var _p = class {
- constructor(e) {
- C(this, "entry");
- this.entry = e;
- }
- [Symbol.iterator]() {
- return this;
- }
- next() {
- const e = this.entry;
- return e ? (this.entry = e[Ye], { done: false, value: e.key }) : { done: true, value: void 0 };
- }
- };
- var Ep = class {
- constructor(e) {
- C(this, "entry");
- this.entry = e;
- }
- [Symbol.iterator]() {
- return this;
- }
- next() {
- const e = this.entry;
- return e ? (this.entry = e[Ye], { done: false, value: e.value }) : { done: true, value: void 0 };
- }
- };
- var Cp = class {
- constructor(e) {
- C(this, "entry");
- this.entry = e;
- }
- [Symbol.iterator]() {
- return this;
- }
- next() {
- const e = this.entry;
- return e ? (this.entry = e[Ye], { done: false, value: [e.key, e.value] }) : { done: true, value: void 0 };
- }
- };
- var Ta;
- var Ma;
- Ma = Ye, Ta = rt;
- var Wo = class {
- constructor(e, n) {
- C(this, "key");
- C(this, "value");
- C(this, Ma);
- C(this, Ta);
- this.key = e, this.value = n, this[Ye] = void 0, this[rt] = void 0;
- }
- toJSON() {
- return {
- key: this.key,
- value: this.value
- };
- }
- };
- var Qr = class {
- constructor(...e) {
- C(this, "_keymap");
- C(this, "size", 0);
- C(this, "limit");
- C(this, "oldest");
- C(this, "newest");
- C(this, "_onShiftListeners", []);
- if (Cr.hasLength(e, 1)) {
- if (Cr.isNumber(e[0])) {
- const n = e[0];
- this._initialize(n, void 0);
- return;
- }
- if (Cr.isIterable(e[0])) {
- const n = e[0];
- this._initialize(0, n);
- return;
- }
- return;
- }
- if (Cr.hasLength(e, 2)) {
- const n = e[0], r = e[1];
- this._initialize(n, r);
- }
- }
- onShift(e) {
- if (this._onShiftListeners.indexOf(e) === -1)
- return this._onShiftListeners.push(e), Ze(() => cs(this._onShiftListeners, e));
- throw new Error("[LRUMap]: the listener has been registered!");
- }
- _initialize(e, n) {
- 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));
- }
- _markEntryAsUsed(e) {
- 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);
- }
- assign(e) {
- let n, r = this.limit || Number.MAX_VALUE;
- this._keymap.clear();
- const s = e[Symbol.iterator]();
- for (let i = s.next(); !i.done; i = s.next()) {
- const o = new Wo(i.value[0], i.value[1]);
- if (this._keymap.set(o.key, o), n ? (n[Ye] = o, o[rt] = n) : this.oldest = o, n = o, r-- === 0)
- throw new Error("overflow");
- }
- this.newest = n, this.size = this._keymap.size;
- }
- set(e, n) {
- let r = this._keymap.get(e);
- 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);
- }
- shift() {
- const e = this.oldest;
- if (e)
- 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];
- }
- get(e) {
- const n = this._keymap.get(e);
- if (n)
- return this._markEntryAsUsed(n), n.value;
- }
- has(e) {
- return this._keymap.has(e);
- }
- find(e) {
- const n = this._keymap.get(e);
- return n ? n.value : void 0;
- }
- delete(e) {
- const n = this._keymap.get(e);
- if (n)
- 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;
- }
- clear() {
- this.oldest = void 0, this.newest = void 0, this.size = 0, this._keymap.clear();
- }
- keys() {
- return new _p(this.oldest);
- }
- values() {
- return new Ep(this.oldest);
- }
- entries() {
- return this[Symbol.iterator]();
- }
- [Symbol.iterator]() {
- return new Cp(this.oldest);
- }
- forEach(e, n) {
- typeof n != "object" && (n = this);
- let r = this.oldest;
- for (; r; )
- e.call(n, r.value, r.key, this), r = r[Ye];
- }
- toJSON() {
- const e = new Array(this.size);
- let n = 0, r = this.oldest;
- for (; r; )
- e[n++] = { key: r.key, value: r.value }, r = r[Ye];
- return e;
- }
- toString() {
- let e = "", n = this.oldest;
- for (; n; )
- e += `${String(n.key)}:${n.value}`, n = n[Ye], n && (e += " < ");
- return e;
- }
- };
- var Cr = class {
- static hasLength(e, n) {
- return e.length === n;
- }
- static getValueType(e) {
- return Object.prototype.toString.apply(e);
- }
- static isObject(e) {
- return this.getValueType(e) === "[object Object]";
- }
- static isIterable(e) {
- return e[Symbol.iterator] != null;
- }
- static isNumber(e) {
- return this.getValueType(e) === "[object Number]";
- }
- };
- var Yr = { exports: {} };
- var Rp = Yr.exports;
- var zo;
- function Ip() {
- return zo || (zo = 1, function(t, e) {
- (function(n, r) {
- t.exports = r();
- })(typeof self < "u" ? self : Rp, function() {
- return function() {
- var n = { d: function(_, g) {
- for (var p in g)
- n.o(g, p) && !n.o(_, p) && Object.defineProperty(_, p, { enumerable: true, get: g[p] });
- }, o: function(_, g) {
- return Object.prototype.hasOwnProperty.call(_, g);
- } }, r = {};
- n.d(r, { default: function() {
- return ht;
- } });
- 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" };
- 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"] };
- function u(_) {
- const g = i.exec(_);
- if (!g)
- throw new SyntaxError("Malformed locale: ".concat(_));
- return { lang: g[1] + (g[2] ? "_" + g[2] : ""), language: g[1], territory: g[2] || "", codeset: g[3] || "", modifier: g[4] || "" };
- }
- function c(_) {
- if (typeof _ == "number")
- return s[65535 & _] || null;
- const g = parseInt(_, 16);
- return isFinite(g) && s[65535 & g] ? s[65535 & g] || null : i.test(_) ? _ : null;
- }
- function l(_) {
- const g = c(_);
- let p = null;
- if (g) {
- const S = u(g);
- p = o[S.lang] || o[S.language] || null;
- }
- return p;
- }
- function h(_) {
- return Object.assign({}, a, _);
- }
- function d(_, g) {
- const p = typeof g == "object" ? g : u(g);
- return o[p.lang] = h(_), p.language === p.lang || o[p.language] || (o[p.language] = h(_)), o[p.lang];
- }
- const f = h({ group: "," });
- function E(_, g) {
- if (typeof _ != "number")
- return _;
- if (_ < 0)
- return -E(-_, g);
- if (g) {
- const p = 10 ** (g || 0) || 1;
- return E(_ * p, 0) / p;
- }
- return Math.round(_);
- }
- 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");
- function R(_, g, p) {
- const S = _ < 0 ? -1 : 1, N = 10 ** (g || 2), L = 10 ** (p || 2);
- let x, P, I = Math.abs(_), Q = 0, _e = 0, J = 0, me = 1;
- if ((_ = I) % 1 == 0)
- P = [_ * S, 1];
- else if (_ < 1e-19)
- P = [S, 1e19];
- else if (_ > 1e19)
- P = [1e19 * S, 1];
- else {
- do
- 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)
- return [S * _e, Q];
- while (Math.abs(_ - J / me) >= 1e-10 && I !== Math.floor(I));
- P = [S * J, me];
- }
- return P;
- }
- const O = { overflow: "######", dateErrorThrows: false, dateErrorNumber: true, dateSpanLarge: true, leap1900: true, nbsp: true, throws: true, invalid: "######", locale: "", ignoreTimezone: false }, U = Object.assign({}, O);
- function ne(_) {
- if (_ === null && (_ = O), _) {
- for (const g in _)
- if (g in O) {
- const p = _[g];
- U[g] = p == null ? O[g] : p;
- }
- }
- return { ...U };
- }
- 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("") + "]");
- function Z(_, g, p) {
- return g[p + "_max"] = _.length, g[p + "_min"] = _.replace(/#/g, "").length, g;
- }
- const fe = {};
- function ae(_) {
- if (!(_ in fe)) {
- const g = [], p = _.replace(/^[#,]+/, "").replace(/[1-9]\d*/g, (S) => "?".repeat(S.length));
- for (let S = 0; S < p.length; S++) {
- const N = p.charAt(S);
- g[S] = N in X ? X[N] : N;
- }
- fe[_] = g.join("");
- }
- return fe[_];
- }
- function m(_, g) {
- typeof _ == "string" && (_ = { type: "string", value: _ = _.replace(/ /g, X["?"]) }), g.push(_);
- }
- function j(_) {
- 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 };
- let S = _ + "", N = "int", L = false, x = null;
- const P = [];
- let I, Q, _e = false;
- for (; S && !L; ) {
- if (I = /^General/i.exec(S))
- p.general = true, m({ type: "general" }, g);
- else if (N === "int" && (I = /^[#?0]+(?:,[#?0]+)*/.exec(S)) || N === "den" && (I = /^[#?\d]+/.exec(S)) || (I = /^[#?0]+/.exec(S)))
- p[N + "_pattern"].push(I[0]), x = { type: N, num: I[0] }, m(x, g);
- else if ((I = /^\//.exec(S)) && p[N + "_pattern"].length) {
- if (!x)
- throw new SyntaxError("Missing a numerator in pattern ".concat(_));
- p.fractions = true, p.num_pattern.push(p[N + "_pattern"].pop()), x.type = "num", N = "den", m({ type: "div" }, g);
- } else if (I = /^,+/.exec(S)) {
- const D = S.charAt(1) in X;
- Q.slice(-1) in X && (I[0].length > 1 || !D) ? p.scale = 1e-3 ** I[0].length : p.dec_fractions || m(I[0], g);
- } else {
- if (I = /^;/.exec(S)) {
- L = true;
- break;
- }
- if (I = /^[@+-]/.exec(S))
- I[0] === "@" && (p.text = true), m({ type: de[I[0]] }, g);
- else if (I = /^(?:\[(h+|m+|s+)\])/i.exec(S)) {
- const D = I[1].toLowerCase(), q = D[0], Ce = { type: "", size: 0, date: 1, raw: I[0], pad: D.length };
- 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);
- } else if (I = /^(?:B2)/i.exec(S))
- _e || (p.date_system = 6);
- else if (I = /^(?:B1)/i.exec(S))
- _e || (p.date_system = 1);
- else if (I = /^(?:([hHmMsSyYbBdDegG])\1*)/.exec(S)) {
- const D = { type: "", size: 0, date: 1, raw: I[0] }, q = I[0].toLowerCase(), Ce = q[0];
- if (q === "y" || q === "yy")
- D.size = 2, D.type = "year-short";
- else if (Ce === "y" || Ce === "e")
- D.size = 2, D.type = "year";
- else if (q === "b" || q === "bb")
- D.size = 2, D.type = "b-year-short";
- else if (Ce === "b")
- D.size = 2, D.type = "b-year";
- else if (q === "d" || q === "dd")
- D.size = 8, D.type = "day", D.pad = /dd/.test(q);
- else if (q === "ddd")
- D.size = 8, D.type = "weekday-short";
- else if (Ce === "d")
- D.size = 8, D.type = "weekday";
- else if (Ce === "h")
- D.size = 16, D.type = "hour", D.pad = /hh/i.test(q);
- else if (Ce === "m") {
- 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");
- const Se = P[P.length - 1];
- !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);
- } else if (Ce === "s") {
- D.size = 64, D.type = "sec", D.pad = /ss/.test(q);
- const Se = P[P.length - 1];
- Se && 32 & Se.size ? D.used = true : Se && Se.indeterminate && (delete Se.indeterminate, Se.size = 32, Se.type = "min", D.used = true);
- }
- p.date = p.date | D.size, p.date_eval = true, P.push(D), m(D, g);
- } else if (I = /^(?:AM\/PM|am\/pm|A\/P)/.exec(S))
- p.clock = 12, p.date = 16 | p.date, p.date_eval = true, m({ type: "am", short: I[0] === "A/P" }, g);
- else if (p.date && (I = /^\.0{1,3}/i.exec(S))) {
- const D = I[0].length - 1, q = [64, 128, 256, 512][D];
- 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);
- } else if ((I = /^\\(.)/.exec(S)) || (I = /^"([^"]*?)"/.exec(S)))
- m(I[1], g);
- else if (I = /^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/.exec(S))
- p.condition = [I[1], parseFloat(I[2], 10)];
- else if (I = /^\[\$([^\]]+)\]/.exec(S)) {
- const D = I[1].split("-"), q = D.length < 2 ? "" : D[D.length - 1], Ce = D[0];
- Ce && m(Ce, g);
- const Se = c(q);
- Se && (p.locale = Se);
- const Le = parseInt(q, 16);
- isFinite(Le) && 16711680 & Le && (Le >> 16 & 255) === 6 && (p.date_system = 6), _e = true;
- } else if (I = /^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*(\d+))\]/i.exec(S))
- p.color = I[2] ? T[parseInt(I[2], 10)] || "#000" : I[1].toLowerCase();
- else if (!(I = /^\[(DBNum1|ENG|HIJ|JPN|TWN)\]/i.exec(S))) {
- if (I = /^%/.exec(S))
- p.scale = 100, p.percent = true, m("%", g);
- else if (I = /^_(\\.|.)/.exec(S))
- m(" ", g);
- else if (I = /^\./.exec(S))
- m({ type: "point", value: I[0] }, g), p.dec_fractions = true, N = "frac";
- else if (I = /^[Ee]([+-]?|(?=[0#?]))/.exec(S))
- p.exponential = true, p.exp_plus = I[1] === "+", N = "man", m({ type: "exp", plus: I[1] === "+" }, g);
- else if (!(I = /^\*(\\.|.)/.exec(S))) {
- if (I = /^[BENn[]/.exec(S))
- throw new SyntaxError("Unexpected char ".concat(S.charAt(0), " in pattern ").concat(_));
- S[0] === "(" && (p.parens = true), I = [S[0]], m(I[0], g);
- }
- }
- }
- Q = I[0], S = S.slice(I ? I[0].length : 1);
- }
- 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)
- throw new SyntaxError("Invalid pattern: ".concat(p.pattern));
- const J = p.int_pattern.join("");
- if (p.grouping = J.indexOf(",") >= 0, p.grouping) {
- const D = J.split(","), q = D.length;
- 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);
- } else
- p.group_pri = 0, p.group_sec = 0;
- Z(J.replace(/[,]/g, ""), p, "int"), Z(p.frac_pattern.join(""), p, "frac"), Z(p.man_pattern.join(""), p, "man");
- let me = p.num_pattern.join(""), ye = p.den_pattern.join("");
- const le = /\?/.test(ye) || /\?/.test(me);
- 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) => {
- const Ce = g[q + 1];
- D.type === "string" && Ce && (Ce.type === "num" ? D.rule = "num+int" : Ce.type === "div" ? D.rule = "num" : Ce.type === "den" && (D.rule = "den"));
- }), p;
- }
- const y = (_) => {
- const g = _.condition;
- g && g[1] < 0 && (g[0] === "<" || g[0] === "<=" || g[0] === "=") || _.tokens.unshift({ type: "minus", volatile: true });
- };
- function M(_) {
- const g = [];
- let p, S = false, N = null, L = _, x = 0, P = false, I = 0, Q = 0;
- do {
- if (P = j(L), (P.date || P.general) && (P.int_pattern.length || P.frac_pattern.length || P.scale !== 1 || P.text))
- throw new Error("Illegal format");
- if (P.condition && (Q++, S = true), P.text) {
- if (N)
- throw new Error("Unexpected partition");
- N = P;
- }
- 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++;
- } while (x && I < 4 && Q < 3);
- if (x)
- throw new Error("Unexpected partition");
- if (Q > 2)
- throw new Error("Unexpected condition");
- const _e = g[3];
- if (_e && (_e.int_pattern.length || _e.frac_pattern.length || _e.date))
- throw new Error("Unexpected partition");
- if (S) {
- const J = g.length;
- if (J === 1 && (g[1] = j("General"), g[1].generated = true), J < 3) {
- const me = g[0], ye = g[1];
- if (y(me), ye.condition)
- y(ye);
- else {
- const le = me.condition;
- (le[0] === "=" || le[1] >= 0 && (le[0] === ">" || le[0] === ">=")) && ye.tokens.unshift({ type: "minus", volatile: true });
- }
- } else
- g.forEach(y);
- } else {
- if (g.length < 4 && N)
- for (let J = 0, me = g.length; J < me; J++)
- g[J] === N && g.splice(J, 1);
- if (g.length < 1 && N && (g[0] = j("General"), g[0].generated = true), g.length < 2) {
- const J = j(g[0].pattern);
- J.tokens.unshift({ type: "minus", volatile: true }), J.generated = true, g.push(J);
- }
- if (g.length < 3) {
- const J = j(g[0].pattern);
- J.generated = true, g.push(J);
- }
- if (g.length < 4)
- if (N)
- g.push(N);
- else {
- const J = j("@");
- J.generated = true, g.push(J);
- }
- g[0].condition = [">", 0], g[1].condition = ["<", 0], g[2].condition = null;
- }
- return { pattern: _, partitions: g, locale: p };
- }
- const b = Math.floor;
- function w(_) {
- if ((!(arguments.length > 1 && arguments[1] !== void 0) || arguments[1]) && _ >= 0) {
- if (_ === 0)
- return [1900, 1, 0];
- if (_ === 60)
- return [1900, 2, 29];
- if (_ < 60)
- return [1900, _ < 32 ? 1 : 2, (_ - 1) % 31 + 1];
- }
- let p = _ + 68569 + 2415019;
- const S = b(4 * p / 146097);
- p -= b((146097 * S + 3) / 4);
- const N = b(4e3 * (p + 1) / 1461001);
- p = p - b(1461 * N / 4) + 31;
- const L = b(80 * p / 2447), x = p - b(2447 * L / 80);
- p = b(L / 11);
- const P = L + 2 - 12 * p;
- return [0 | 100 * (S - 49) + N + p, 0 | P, 0 | x];
- }
- function k(_) {
- return w(_ + 1462);
- }
- function $(_) {
- if (_ === 60)
- throw new Error("#VALUE!");
- if (_ <= 1)
- return [1317, 8, 29];
- if (_ < 60)
- return [1317, _ < 32 ? 9 : 10, 1 + (_ - 2) % 30];
- const g = 10631 / 30, p = 0.1335;
- let S = _ + 466935;
- const N = b(S / 10631);
- S -= 10631 * N;
- const L = b((S - p) / g);
- S -= b(L * g + p);
- const x = b((S + 28.5001) / 29.5);
- return x === 13 ? [30 * N + L, 12, 30] : [30 * N + L, x, S - b(29.5001 * x - 29)];
- }
- function Y(_) {
- let g = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, p = !(arguments.length > 2 && arguments[2] !== void 0) || arguments[2];
- const S = b(_);
- return g === 6 ? $(S) : g === -1 ? k(S) : w(S, p);
- }
- const se = Math.floor, he = 86400;
- function ge(_, g) {
- let p = null;
- if (Array.isArray(_)) {
- const [S, N, L, x, P, I] = _;
- p = Date.UTC(S, N == null ? 0 : N - 1, L != null ? L : 1, x || 0, P || 0, I || 0);
- } else if (_ instanceof Date && (p = 1 * _, !g || !g.ignoreTimezone)) {
- const S = /* @__PURE__ */ new Date();
- S.setUTCFullYear(_.getFullYear(), _.getMonth(), _.getDate()), S.setUTCHours(_.getHours(), _.getMinutes(), _.getSeconds(), _.getMilliseconds()), p = 1 * S;
- }
- if (p != null && isFinite(p)) {
- const S = p / 864e5;
- return S - (S <= -25509 ? -25568 : -25569);
- }
- return _;
- }
- function Ae(_, g) {
- let p = 0 | _;
- const S = he * (_ - p);
- let N = se(S);
- S - N > 0.9999 && (N += 1, N === he && (N = 0, p += 1));
- 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;
- if (g && g.nativeDate) {
- const me = /* @__PURE__ */ new Date(0);
- return me.setUTCFullYear(x, P - 1, I), me.setUTCHours(Q, _e, J), me;
- }
- return [x, P, I, Q, _e, J];
- }
- function be(_) {
- return !!(_[0] && _[0].percent || _[1] && _[1].percent || _[2] && _[2].percent || _[3] && _[3].percent);
- }
- function v(_) {
- return !!(_[0] && _[0].date || _[1] && _[1].date || _[2] && _[2].date || _[3] && _[3].date);
- }
- function F(_) {
- const [g, p, S, N] = _;
- return !(g && !g.generated || p && !p.generated || S && !S.generated || !N || !N.text || N.generated);
- }
- 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);
- function ue(_, g, p, S) {
- const N = 0 | p;
- if (typeof p == "string")
- _.push(p);
- else if (p === N)
- _.push(Math.abs(N));
- else {
- const L = Math.abs(p);
- let x = L ? Math.floor(Math.log10(L)) : 0, P = x < 0 ? L * 10 ** -x : L / 10 ** x;
- P === 10 && (P = 1, x++);
- const I = function(_e) {
- let J = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1];
- const me = Math.abs(_e);
- if (!me)
- return z;
- const ye = J && _e < 0 ? 1 : 0, le = Math.floor(me), D = Math.floor(Math.log10(me) + 1);
- let q = 0, Ce = 0;
- if (le !== me) {
- q = 1;
- const Se = String(E(D < 0 ? me * 10 ** -D : me / 10 ** D, 15));
- let Le = Se.length, Ue = true, je = 0;
- for (; je <= Se.length; ) {
- if (Se[je] === ".") {
- Le--;
- break;
- }
- Se[je] === "0" && Ue ? Le-- : Ue = false, je++;
- }
- Ce = Le - D, Ce < 0 && (Ce = 0, q = 0);
- }
- 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 };
- }(L), Q = () => {
- const _e = Math.abs(x);
- let J;
- J = P === 1 ? P : E(P, 5), _.push(W(J + "", S), S.exponent, x < 0 ? S.negative : S.positive, _e < 10 ? "0" : "", _e);
- };
- if (x >= -4 && x <= -1) {
- const _e = L.toPrecision(10 + x).replace(/\.?0+$/, "");
- _.push(W(_e, S));
- } else if (x === 10) {
- const _e = L.toFixed(10).slice(0, 12).replace(/\.$/, "");
- _.push(W(_e, S));
- } else if (Math.abs(x) <= 9)
- if (I.total <= 11) {
- const _e = E(L, 9).toFixed(I.frac);
- _.push(W(_e, S));
- } else
- x === 9 ? _.push(Math.floor(L)) : x >= 0 && x < 9 ? _.push(E(L, 9 - x)) : Q();
- else
- I.total >= 12 ? Q() : Math.floor(L) === L ? _.push(Math.floor(L)) : _.push(W(E(L, 9).toFixed(I.frac), S));
- }
- return _;
- }
- const oe = 86400, B = { int: "integer", frac: "fraction", man: "mantissa", num: "numerator", den: "denominator" }, ee = function(_) {
- let g = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
- const p = Math.floor(Math.log10(_));
- return g > 1 ? Math.floor(p / g) * g : p;
- };
- function ie(_, g, p, S) {
- 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;
- const Ue = S || f;
- if (!g.text && isFinite(g.scale) && g.scale !== 1 && (_ = function(Ie) {
- if (Ie === 0)
- return Ie;
- const Ne = Math.ceil(Math.log10(Ie < 0 ? -Ie : Ie)), te = 10 ** (16 - Math.floor(Ne));
- return Math.round(Ie * te) / te;
- }(_ * g.scale)), g.exponential) {
- let Ie = Math.abs(_);
- if (Ie) {
- const Ne = 10 ** -ee(Ie, g.int_max), te = E(Ie * Ne, g.frac_max) / Ne;
- Q = ee(te, g.int_max);
- }
- Ie /= 10 ** Q, _ = _ < 0 ? -Ie : Ie, N += Math.abs(Q);
- }
- if (g.integer) {
- const Ie = Math.abs(E(_, g.fractions ? 1 : g.frac_max));
- I += Ie < 1 ? "" : Math.floor(Ie);
- }
- if (g.grouping) {
- let Ie = "", Ne = I.length;
- for (Ne > g.group_pri && (Ne -= g.group_pri, Ie = Ue.group + I.slice(Ne, Ne + g.group_pri) + Ie); Ne > g.group_sec; )
- Ne -= g.group_sec, Ie = Ue.group + I.slice(Ne, Ne + g.group_sec) + Ie;
- I = Ne ? I.slice(0, Ne) + Ie : Ie;
- }
- g.dec_fractions && (P = String(E(_, g.frac_max)).split(".")[1] || "");
- let je = false;
- if (g.fractions) {
- const Ie = Math.abs(g.integer ? _ % 1 : _);
- if (Ie)
- if (je = true, isFinite(g.denominator))
- x += g.denominator, L += E(Ie * g.denominator), L === "0" && (L = "", x = "", je = false, I || (I = "0"));
- else {
- const Ne = R(Ie, g.integer ? g.num_max : 1 / 0, g.den_max);
- L += Ne[0], x += Ne[1], g.integer && L === "0" && (I || (I = "0"), L = "", x = "", je = false);
- }
- }
- if (g.date) {
- _e = Math.trunc(_);
- const Ie = oe * (_ - _e);
- 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) {
- const Ne = 512 & g.date || 256 & g.date || 128 & g.date;
- (Ne === 512 && Le > 0.9995 || Ne === 256 && Le > 0.995 || Ne === 128 && Le > 0.95 || !Ne && Le >= 0.5) && (J++, Le = 0);
- }
- if (_e || g.date_system) {
- const Ne = Y(_, g.date_system, p.leap1900);
- me = Ne[0], ye = Ne[1], le = Ne[2];
- }
- if (J) {
- const Ne = J < 0 ? oe + J : J;
- Se = Math.floor(Ne) % 60, Ce = Math.floor(Ne / 60) % 60, q = Math.floor(Ne / 60 / 60) % 60;
- }
- if (D = (6 + _e) % 7, g.date_eval && (dt = _, pt = _e + J / oe, p.dateSpanLarge ? dt < -694324 || pt >= 35830291 : dt < 0 || pt >= 2958466)) {
- if (p.dateErrorThrows)
- throw new Error("Date out of bounds");
- return p.dateErrorNumber ? ue(_ < 0 ? [Ue.negative] : [], 0, _, Ue).join("") : p.overflow;
- }
- }
- var dt, pt;
- 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) {
- const Ie = g.exp_plus ? "+" : "";
- 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;
- }
- const Ee = [];
- let qe = 0;
- const ve = { int: 0, frac: 0, man: 0, num: 0, den: 0 };
- for (let Ie = 0, Ne = g.tokens.length; Ie < Ne; Ie++) {
- const te = g.tokens[Ie], ut = te.num ? te.num.length : 0;
- if (te.type === "string")
- 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);
- else if (te.type === "error")
- Ee.push(p.invalid);
- else if (te.type === "point")
- Ee.push(g.date ? te.value : Ue.decimal);
- else if (te.type === "general")
- ue(Ee, 0, _, Ue);
- else if (te.type === "exp")
- Ee.push(Ue.exponent);
- else if (te.type === "minus")
- 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));
- else if (te.type === "plus")
- Ee.push(Ue.positive);
- else if (te.type === "text")
- Ee.push(_);
- else if (te.type === "div")
- je ? Ee.push("/") : g.num_min > 0 || g.den_min > 0 ? Ee.push(X["?"]) : Ee.push(X["#"]);
- else if (te.type === "int")
- if (g.int_pattern.length === 1)
- Ee.push(I);
- else {
- 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);
- Ee.push(I.substring(I.length - $e, I.length - At)), qe++, ve.int += te.num.length;
- }
- else if (te.type === "frac") {
- const $e = ve.frac;
- for (let At = 0; At < ut; At++)
- Ee.push(P[At + $e] || X[te.num[At]]);
- ve.frac += ut;
- } else if (te.type in B)
- 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);
- else if (te.type === "year")
- me < 0 && Ee.push(Ue.negative), Ee.push(String(Math.abs(me)).padStart(4, "0"));
- else if (te.type === "year-short") {
- const $e = me % 100;
- Ee.push($e < 10 ? "0" : "", $e);
- } else if (te.type === "month")
- Ee.push(te.pad && ye < 10 ? "0" : "", ye);
- else if (te.type === "monthname-single")
- g.date_system === 6 ? Ee.push(Ue.mmmm6[ye - 1].charAt(0)) : Ee.push(Ue.mmmm[ye - 1].charAt(0));
- else if (te.type === "monthname-short")
- g.date_system === 6 ? Ee.push(Ue.mmm6[ye - 1]) : Ee.push(Ue.mmm[ye - 1]);
- else if (te.type === "monthname")
- g.date_system === 6 ? Ee.push(Ue.mmmm6[ye - 1]) : Ee.push(Ue.mmmm[ye - 1]);
- else if (te.type === "weekday-short")
- Ee.push(Ue.ddd[D]);
- else if (te.type === "weekday")
- Ee.push(Ue.dddd[D]);
- else if (te.type === "day")
- Ee.push(te.pad && le < 10 ? "0" : "", le);
- else if (te.type === "hour") {
- const $e = q % g.clock || (g.clock < 24 ? g.clock : 0);
- Ee.push(te.pad && $e < 10 ? "0" : "", $e);
- } else if (te.type === "min")
- Ee.push(te.pad && Ce < 10 ? "0" : "", Ce);
- else if (te.type === "sec")
- Ee.push(te.pad && Se < 10 ? "0" : "", Se);
- else if (te.type === "subsec") {
- Ee.push(Ue.decimal);
- const $e = Le.toFixed(g.sec_decimals);
- Ee.push($e.slice(2, 2 + te.decimals));
- } else if (te.type === "am") {
- const $e = q < 12 ? 0 : 1;
- te.short && !S ? Ee.push("AP"[$e]) : Ee.push(Ue.ampm[$e]);
- } else if (te.type === "hour-elap") {
- _ < 0 && Ee.push(Ue.negative);
- const $e = 24 * _e + Math.floor(Math.abs(J) / 3600);
- Ee.push(String(Math.abs($e)).padStart(te.pad, "0"));
- } else if (te.type === "min-elap") {
- _ < 0 && Ee.push(Ue.negative);
- const $e = 1440 * _e + Math.floor(Math.abs(J) / 60);
- Ee.push(String(Math.abs($e)).padStart(te.pad, "0"));
- } else if (te.type === "sec-elap") {
- _ < 0 && Ee.push(Ue.negative);
- const $e = _e * oe + Math.abs(J);
- Ee.push(String(Math.abs($e)).padStart(te.pad, "0"));
- } else if (te.type === "b-year")
- Ee.push(me + 543);
- else if (te.type === "b-year-short") {
- const $e = (me + 543) % 100;
- Ee.push($e < 10 ? "0" : "", $e);
- }
- }
- return p.nbsp ? Ee.join("") : Ee.join("").replace(/\u00a0/g, " ");
- }
- function pe(_, g) {
- for (let p = 0; p < 3; p++) {
- const S = g[p];
- if (S) {
- let N;
- if (S.condition) {
- const L = S.condition[0], x = S.condition[1];
- L === "=" ? N = _ === x : L === ">" ? N = _ > x : L === "<" ? N = _ < x : L === ">=" ? N = _ >= x : L === "<=" ? N = _ <= x : L === "<>" && (N = _ !== x);
- } else
- N = true;
- if (N)
- return S;
- }
- }
- }
- const Oe = j("@"), Me = "black", G = {};
- function Re(_, g) {
- if (_) {
- const p = _[0];
- g[p] = g[p] || {}, Re(_.slice(1), g[p]);
- } else
- g.$ = true;
- }
- ["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((_) => {
- 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);
- });
- 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();
- function Rt(_) {
- const g = new RegExp("^([\\s+%" + A.join("") + "(-]*)(((?:(?:\\d[\\d,]*)(?:\\.\\d*)?|(?:\\.\\d+)))([eE][+-]?\\d+)?)([\\s%" + A.join("") + ")]*)$").exec(_);
- if (g) {
- const [, p, S, N, L, x] = g;
- let P = 1, I = "", Q = false, _e = false, J = false, me = false, ye = false, le = null, D = false, q = parseFloat(S.replace(/,/g, ""));
- if (!isFinite(q))
- return null;
- for (let Se = 0; Se < p.length; Se++) {
- const Le = p[Se];
- if (Le === "-") {
- if (Q || _e)
- return null;
- Q = true, P = -1;
- } else if (H.test(Le)) {
- if (ye)
- return null;
- ye = true, le = Le;
- } else if (Le === "(") {
- if (_e || Q)
- return null;
- _e = true, P = -1;
- } else if (Le === "%") {
- if (me)
- return null;
- me = true;
- }
- }
- for (let Se = 0; Se < x.length; Se++) {
- const Le = x[Se];
- if (H.test(Le)) {
- if (ye)
- return null;
- ye = true, le = Le, D = true;
- } else if (Le === ")") {
- if (J || !_e)
- return null;
- J = true;
- } else if (Le === "%") {
- if (me)
- return null;
- me = true;
- }
- }
- if (L) {
- if (me || ye)
- return null;
- I = "0.00E+00";
- } else if (me) {
- if (ye)
- return null;
- I = N.includes(".") ? "0.00%" : "0%", q *= 0.01;
- } else if (ye) {
- const Se = N.includes(".") ? "#,##0.00" : "#,##0";
- I = D ? Se + le : le + Se;
- } else
- N.includes(",") && (I = N.includes(".") ? "#,##0.00" : "#,##0");
- const Ce = { v: q * P };
- return I && (Ce.z = I), Ce;
- }
- }
- const We = (_, g, p) => {
- const S = p.path || "", N = Object.keys(g);
- for (let L = 0; L < N.length; L++) {
- let x;
- const P = N[L];
- if (g[P]) {
- if (P === "$" || P === "€")
- _ || (x = p);
- else if (P === "-") {
- const I = /^(\s*([./-]|,\s)\s*|\s+)/.exec(_);
- if (I) {
- const Q = I[1] === "-" || I[1] === "/" || I[1] === "." ? I[1] : " ";
- if (!p.sep || p.sep === Q) {
- const _e = I[0].replace(/\s+/g, " ");
- x = We(_.slice(I[0].length), g[P], { ...p, sep: Q, path: S + _e });
- }
- }
- } else if (P === " ") {
- const I = /^[,.]?\s+/.exec(_);
- if (I) {
- const Q = I[0].replace(/\s+/g, " ");
- x = We(_.slice(I[0].length), g[P], { ...p, path: S + Q });
- }
- } else if (P === "j" || P === "d") {
- const I = /^(0?[1-9]|1\d|2\d|3[01])\b/.exec(_);
- I && (x = We(_.slice(I[0].length), g[P], { ...p, day: I[0], path: S + P }));
- } else if (P === "n" || P === "m") {
- const I = /^(0?[1-9]|1[012])\b/.exec(_);
- I && (x = We(_.slice(I[0].length), g[P], { ...p, month: +I[0], _mon: I[0], path: S + P }));
- } else if (P === "F" || P === "M") {
- const I = /^([a-z]{3,9})\b/i.exec(_), Q = I && (P === "F" ? Be : He)[I[0].toLowerCase()];
- Q && (x = We(_.slice(I[0].length), g[P], { ...p, month: Q, _mon: I[0], path: S + P }));
- } else if (P === "l" || P === "D") {
- const I = /^([a-z]{3,9})\b/i.exec(_);
- (I && xe[I[0].toLowerCase()]) === P && (x = We(_.slice(I[0].length), g[P], { ...p, path: S + P }));
- } else if (P === "y") {
- const I = /^\d\d\b/.exec(_);
- if (I) {
- const Q = +I[0] >= 30 ? +I[0] + 1900 : +I[0] + 2e3;
- x = We(_.slice(I[0].length), g[P], { ...p, year: Q, path: S + P });
- }
- } else if (P === "Y") {
- const I = /^\d\d\d\d\b/.exec(_);
- I && (x = We(_.slice(I[0].length), g[P], { ...p, year: +I[0], path: S + P }));
- } else {
- if (P !== "x")
- throw new Error('Unknown date token "'.concat(P, '"'));
- {
- const I = ze(_);
- I && (x = We("", g[P], { ...p, time: I.v, tf: I.z, path: S + P }));
- }
- }
- if (x)
- return x;
- }
- }
- };
- function et(_, g) {
- const p = We(_.trim(), G, { path: "" });
- if (p) {
- var S;
- if (p.sep === "." && p.path.length === 3)
- return null;
- const N = +((S = p.year) !== null && S !== void 0 ? S : Je);
- if (p.day || (p.day = 1), !function(P, I, Q) {
- if (Q < 1 || I < 1 || I > 12)
- return false;
- if (I === 2) {
- if (Q > (P % 4 == 0 && P % 100 != 0 || P % 400 == 0 || P === 1900 ? 29 : 28))
- return false;
- } 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)
- return false;
- return true;
- }(N, p.month, p.day))
- return null;
- let L = -1 / 0;
- if (N < 1900)
- return null;
- N <= 1900 && p.month <= 2 ? L = 25568 : N < 1e4 && (L = 25569);
- const x = Date.UTC(N, p.month - 1, p.day) / 864e5 + L + (p.time || 0);
- if (x >= 0 && x <= 2958465) {
- 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);
- return g && g.nativeDate ? { v: Ae(x, g), z: I } : { v: x, z: I };
- }
- }
- return null;
- }
- function ze(_) {
- 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(_);
- if (g) {
- const [, p, S, N, L, x] = g;
- if (L && !N || !x && !S && !N)
- return null;
- let P = 1 * (p || 0);
- if (x) {
- if (P >= 13)
- return null;
- x[0] !== "p" && x[0] !== "P" || (P += 12);
- }
- 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" : "") };
- }
- return null;
- }
- function ct(_) {
- return /^\s*true\s*$/i.test(_) ? { v: true } : /^\s*false\s*$/i.test(_) ? { v: false } : null;
- }
- const it = {};
- function xt(_, g) {
- const { pattern: p, partitions: S, locale: N } = _, L = (I) => {
- const Q = Object.assign({}, ne(), g, I);
- return N && (Q.locale = N), Q;
- }, x = (I, Q) => {
- const _e = L(Q);
- return function(J, me, ye) {
- const le = l(ye.locale), D = me[3] ? me[3] : Oe;
- if (typeof J == "boolean" && (J = J ? "TRUE" : "FALSE"), J == null)
- return "";
- if (typeof J != "number")
- return ie(J, D, ye, le);
- if (!isFinite(J)) {
- const Ce = le || f;
- return isNaN(J) ? Ce.nan : (J < 0 ? Ce.negative : "") + Ce.infinity;
- }
- const q = pe(J, me);
- return q ? ie(J, q, ye, le) : ye.overflow;
- }(ge(I, _e), S, _e);
- };
- x.color = (I, Q) => function(_e, J) {
- if (typeof _e != "number" || !isFinite(_e))
- return (J[3] ? J[3].color : Oe.color) || Me;
- const me = pe(_e, J);
- return me && me.color || Me;
- }(ge(I, L(Q)), S);
- const P = function(I) {
- var Q;
- let _e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
- 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)));
- let q = "G", Ce = ye >= 0 ? Math.min(15, ye) : "", Se = "", Le = "";
- if (me && me.color && (Le = "-", le.color = 1), J.parens && (Se = "()", le.parentheses = 1), D)
- q = "C", le.type = "currency";
- else if (J.error)
- le.type = "error", le.maxDecimals = 0;
- else if (le.isDate) {
- let Ue = 0, je = 0, dt = "";
- J.tokens.forEach((Ee) => {
- const qe = Ee.type;
- /^(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++);
- }), le.type = "date", je && Ue ? le.type = "datetime" : !je && Ue && (le.type = "time");
- const pt = K.find((Ee) => dt.startsWith(Ee[0]));
- q = pt ? "D" : "G", Ce = pt ? pt[1] : "";
- } else
- 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");
- return le.code = q + Ce + Le + Se, le.level = V[le.type], Object.freeze(le);
- }(S, (g || {}).currency) || new SyntaxError();
- return x.info = P, x.dateInfo = function(I) {
- const [Q] = I;
- 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 };
- }(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);
- }
- function ke(_, g) {
- _ || (_ = "General");
- let p = null;
- return it[_] ? p = it[_] : (p = Object.assign({}, ne(), g).throws ? M(_) : function(S) {
- try {
- return M(S);
- } catch (N) {
- const L = { tokens: [{ type: "error" }], error: N.message };
- return { pattern: S, partitions: [L, L, L, L], error: N.message, locale: null };
- }
- }(_), p.error || (it[_] = p)), xt(p, g);
- }
- 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) => {
- const p = u(g);
- return delete it[p.lang], delete it[p.language], d(_, p);
- }, ke.format = function(_, g, p) {
- let S = arguments.length > 3 && arguments[3] !== void 0 && arguments[3];
- const N = p && typeof p == "object" ? p : { locale: p, throws: !S };
- return ke(_, N)(ge(g, N), N);
- }, ke.is_date = ke.isDate, ke.parseNumber = Rt, ke.parseDate = et, ke.parseTime = ze, ke.parseBool = ct, ke.parseValue = function(_, g) {
- var p, S, N;
- return (p = (S = (N = Rt(_)) !== null && N !== void 0 ? N : et(_, g)) !== null && S !== void 0 ? S : ze(_)) !== null && p !== void 0 ? p : ct(_);
- };
- var ht = ke;
- return r = r.default;
- }();
- });
- }(Yr)), Yr.exports;
- }
- var As;
- var Yo;
- function vp() {
- return Yo || (Yo = 1, As = Ip()), As;
- }
- var yp = vp();
- var wp = wt(yp);
- var Op = wp;
- function fn(t) {
- let e = 0;
- const n = Object.keys(t);
- for (const r of n) {
- const s = Number(r);
- e = Math.max(e, s);
- }
- return e + 1;
- }
- function Vo(t, e, n) {
- const r = fn(n), s = n;
- for (let i = r - 1; i >= t; i--)
- s[i + 1] = s[i];
- s[t] = e;
- }
- function Go(t, e, n) {
- const r = Object.keys(n).reduce((s, i) => Math.max(s, Number.parseInt(i)), 0) + 1;
- for (let s = t; s < r; s++)
- s < t + e ? delete n[s] : n[s] !== void 0 && (n[s - e] = n[s], delete n[s]);
- }
- function LC(t, e) {
- const n = t, r = Object.keys(n), s = r.length, i = e, o = Object.keys(i), a = o.length, u = {};
- let c = 0;
- for (let l = 0; l < s; l++, c++) {
- const h = r[l];
- u[c] = n[h];
- }
- for (let l = 0; l < a; l++, c++) {
- const h = o[l];
- u[c] = i[h];
- }
- return u;
- }
- function UC(t, e, n) {
- const r = n;
- if (fn(n) > 0) {
- const i = {};
- let o = 0;
- for (let a = t; a <= e; a++)
- r[a] && (i[o] = r[a], o++);
- return i;
- }
- return {};
- }
- function Ko(t, e, n, r) {
- const s = t > n;
- if (!s && t + e > n)
- throw new Error("Invalid move operation");
- s ? bp(t, e, n, r) : Sp(t, e, n, r);
- }
- function bp(t, e, n, r) {
- const s = r, i = [];
- for (let o = t; o < t + e; o++)
- i.push(s[o]);
- for (let o = t - 1; o >= n; o--) {
- const a = s[o];
- s[o + e] = a, a === void 0 && delete s[o + e];
- }
- i.forEach((o, a) => {
- s[n + a] = o, o === void 0 && delete s[n + a];
- });
- }
- function Sp(t, e, n, r) {
- const s = r, i = [];
- for (let o = t; o < t + e; o++)
- i.push(s[o]);
- for (let o = t + e; o < n; o++) {
- const a = s[o];
- s[o - e] = a, a === void 0 && delete s[o - e];
- }
- i.forEach((o, a) => {
- s[n + a - e] = o, o === void 0 && delete s[n + a - e];
- });
- }
- var kt = class _kt {
- constructor(e = {}) {
- C(this, "_matrix");
- this._setOriginValue(e);
- }
- static MakeObjectMatrixSize(e) {
- return new _kt({
- [e - 1]: {}
- });
- }
- getMatrix() {
- return this._matrix;
- }
- forEach(e) {
- const n = this._matrix, r = Object.keys(n);
- for (const s of r) {
- const i = Number(s), o = n[i];
- if (e(i, o) === false)
- return this;
- }
- return this;
- }
- forRow(e) {
- const n = this._matrix, r = Object.keys(n);
- for (const s of r) {
- const i = Number(s), o = n[i];
- if (e(
- i,
- Object.keys(o).map((u) => Number(u))
- ) === false)
- return this;
- }
- return this;
- }
- /**
- * Iterate the object matrix with row priority, which means it scan the whole range row by row.
- */
- forValue(e) {
- const n = this._matrix;
- for (const r in n) {
- const s = Number(r), i = n[s];
- if (i)
- for (const o in i) {
- const a = Number(o), u = i[a];
- if (e(s, a, u) === false)
- return this;
- }
- }
- return this;
- }
- swapRow(e, n) {
- const r = this._matrix[e], s = this._matrix[n];
- this._matrix[e] = s, this._matrix[n] = r;
- }
- getRow(e) {
- return this._matrix[e];
- }
- getRowOrCreate(e) {
- let n = this.getRow(e);
- return n == null && (n = {}, this._matrix[e] = n), n;
- }
- reset() {
- this._setOriginValue({});
- }
- hasValue() {
- const e = this._matrix, n = Object.keys(e);
- if (n.length === 0)
- return false;
- for (const r of n) {
- const s = Number(r), i = e[s];
- if (Object.keys(i).length > 0)
- return true;
- }
- return false;
- }
- getValue(e, n) {
- var r, s;
- return (s = (r = this._matrix) == null ? void 0 : r[e]) == null ? void 0 : s[n];
- }
- setValue(e, n, r) {
- const s = this.getRowOrCreate(e);
- s[n] = r;
- }
- /**
- * !!
- * Please +1 ‘!’, who fell into this pit.
- * @deprecated use `realDelete` or `splice`
- */
- deleteValue(e, n) {
- var r, s;
- (s = (r = this._matrix) == null ? void 0 : r[e]) == null || delete s[n];
- }
- realDeleteValue(e, n) {
- var r, s, i;
- if ((s = (r = this._matrix) == null ? void 0 : r[e]) == null || delete s[n], this.getRow(e)) {
- const o = this.getRow(e);
- if (o == null)
- return;
- Object.keys(o).length === 0 && ((i = this._matrix) == null || delete i[e]);
- }
- }
- setRow(e, n) {
- this._matrix[e] = n;
- }
- moveRows(e, n, r) {
- Ko(e, n, r, this._matrix);
- }
- moveColumns(e, n, r) {
- this.forEach((s, i) => {
- Ko(e, n, r, i);
- });
- }
- insertRows(e, n) {
- for (let r = e; r < e + n; r++)
- Vo(r, {}, this._matrix);
- }
- insertColumns(e, n) {
- for (let r = e; r < e + n; r++)
- this.forEach((s, i) => {
- i && Vo(r, void 0, i);
- });
- }
- removeRows(e, n) {
- Go(e, n, this._matrix);
- }
- removeColumns(e, n) {
- this.forEach((r, s) => {
- s && Go(e, n, s);
- });
- }
- /**
- * Return a fragment of the original data matrix. Note that the returned matrix's row matrix would start from
- * 0 not `startRow`. Neither does its column matrix. If you want to get the original matrix, use `getSlice`.
- *
- * @param startRow
- * @param endRow
- * @param startColumn
- * @param endColumn
- * @returns
- */
- getFragment(e, n, r, s) {
- const i = new _kt();
- let o = 0;
- for (let a = e; a <= n; a++) {
- const u = {};
- let c = 0;
- for (let l = r; l <= s; l++) {
- const h = this.getValue(a, l);
- u[c] = h, c++;
- }
- i.setRow(o, u), o++;
- }
- return i;
- }
- /**
- * Return a slice of the original data matrix. Note that the returned matrix's row matrix would start from
- * `startRow` not 0, and the same does its column index. You may be looking for `getFragment` if you want
- * both of the indexes start from 0.
- *
- * @param startRow
- * @param endRow
- * @param startColumn
- * @param endColumn
- * @returns
- */
- getSlice(e, n, r, s) {
- const i = new _kt();
- for (let o = e; o <= n; o++)
- for (let a = r; a <= s; a++) {
- const u = this.getValue(o, a);
- u && i.setValue(o, a, re.deepClone(u));
- }
- return i;
- }
- getSizeOf() {
- return Object.keys(this._matrix).length;
- }
- getLength() {
- return fn(this._matrix);
- }
- getRange() {
- const r = this.getLength() - 1;
- let s = 0;
- const i = this.getLength();
- for (let o = 0; o < i; o++) {
- const a = this.getRow(o);
- if (a) {
- const u = fn(a) - 1;
- s = u > s ? u : s;
- }
- }
- return {
- startRow: 0,
- startColumn: 0,
- endRow: r,
- endColumn: s
- };
- }
- toNativeArray() {
- const e = new Array();
- return this.forValue((n, r, s) => {
- e.push(s);
- }), e;
- }
- toArray() {
- const e = [];
- return this.forRow((n, r) => {
- e[n] == null && (e[n] = []), r.forEach((s) => {
- e[n][s] = this.getValue(n, s);
- });
- }), e;
- }
- toFullArray() {
- const e = this.getRange(), { endColumn: n, endRow: r } = e, s = [];
- for (let i = 0; i <= r; i++) {
- const o = new Array(n + 1).fill(void 0);
- s.push(o);
- }
- return this.forValue((i, o, a) => {
- s[i][o] = a;
- }), s;
- }
- /**
- * @deprecated Use getMatrix as a substitute.
- */
- toJSON() {
- return this._matrix;
- }
- clone() {
- const e = JSON.stringify(this._matrix);
- return JSON.parse(e);
- }
- /**
- * @deprecated Use clone as a substitute.
- */
- getData() {
- const e = JSON.stringify(this._matrix);
- return JSON.parse(e);
- }
- getArrayData() {
- let e = 0, n = 0, r = false, s = false;
- const i = new _kt();
- return this.forEach((o, a) => {
- r || (r = true, e = o), Object.keys(a).forEach((u) => {
- const c = Number(u);
- s ? c < n && (n = c) : (s = true, n = c);
- const l = this.getValue(o, c);
- i.setValue(o - e, c - n, l);
- });
- }), i.getData();
- }
- /**
- * the function can only be used in all the row and column are positive integer
- * @description the positive integer in V8 Object is stored in a fast memory space and it is sorted when we get the keys
- * @returns {IRange} the start and end scope of the matrix
- */
- getStartEndScope() {
- let e = 1 / 0, n = -1 / 0, r = 1 / 0, s = -1 / 0;
- const i = Object.keys(this._matrix);
- i.length > 0 && (e = +i[0], n = +i[i.length - 1]);
- for (const o of i) {
- const a = Object.keys(this._matrix[o]);
- a.length > 0 && (r = Math.min(r, +a[0]), s = Math.max(s, +a[a.length - 1]));
- }
- return { startRow: e, endRow: n, startColumn: r, endColumn: s };
- }
- getDataRange() {
- let e = 0, n = 0, r = 0, s = -1, i = false, o = false;
- return this.forEach((a, u) => {
- if (i || (i = true, e = a), u == null)
- return;
- const c = fn(u) - 1;
- c > r && (r = c), Object.keys(u).forEach((l) => {
- const h = Number(l);
- o ? h < n && (n = h) : (o = true, n = h);
- }), a > s && (s = a);
- }), {
- startRow: e,
- startColumn: n,
- endRow: s,
- endColumn: r
- };
- }
- getDiscreteRanges() {
- const e = [];
- return this.forEach((n, r) => {
- Object.keys(r).forEach((s) => {
- const i = Number(s);
- let o = false;
- for (const a of e)
- if (n >= a.startRow && n <= a.endRow + 1 && i >= a.startColumn && i <= a.endColumn + 1) {
- a.endRow = Math.max(n, a.endRow), a.endColumn = Math.max(i, a.endColumn), o = true;
- break;
- }
- o || e.push({
- startRow: n,
- endRow: n,
- startColumn: i,
- endColumn: i
- });
- });
- }), e;
- }
- merge(e) {
- this.forValue((n, r) => {
- const s = e.getValue(n, r);
- s != null && this.setValue(n, r, s);
- });
- }
- _setOriginValue(e = {}) {
- this._matrix = e;
- }
- };
- var PC = {
- sheetId: "",
- range: {
- startRow: -1,
- endRow: -1,
- startColumn: -1,
- endColumn: -1
- }
- };
- var kC = {
- startRow: -1,
- startColumn: -1,
- endRow: -1,
- endColumn: -1
- };
- var FC = {
- startRow: 0,
- startColumn: 0,
- endRow: 0,
- endColumn: 0
- };
- var $C = {
- row: 0,
- column: 0
- };
- var gt = {
- /**
- * fontFamily
- */
- ff: "Arial",
- /**
- * fontSize
- */
- fs: 11,
- /**
- * italic
- * 0: false
- * 1: true
- */
- it: we.FALSE,
- /**
- * bold
- * 0: false
- * 1: true
- */
- bl: we.FALSE,
- /**
- * underline
- */
- ul: {
- s: we.FALSE
- },
- /**
- * strikethrough
- */
- st: {
- s: we.FALSE
- },
- /**
- * overline
- */
- ol: {
- s: we.FALSE
- },
- /**
- * textRotation
- */
- tr: {
- a: 0,
- /**
- * true : 1
- * false : 0
- */
- v: we.FALSE
- },
- /**
- * textDirection
- */
- td: er.UNSPECIFIED,
- /**
- * color
- */
- cl: {
- rgb: "#000"
- },
- /**
- * background
- */
- bg: {
- rgb: "#fff"
- },
- /**
- * horizontalAlignment
- */
- ht: Xt.UNSPECIFIED,
- /**
- * verticalAlignment
- */
- vt: hn.UNSPECIFIED,
- /**
- * wrapStrategy
- */
- tb: xn.UNSPECIFIED,
- /**
- * padding
- */
- pd: {
- t: 0,
- r: 0,
- b: 0,
- l: 0
- },
- n: null,
- /**
- * border
- */
- bd: {
- b: null,
- l: null,
- r: null,
- t: null
- }
- };
- var Ap = {
- id: "default_slide",
- title: "defaultSlide",
- pageSize: {
- width: 300,
- height: 300
- }
- };
- var BC = [su, Hd, iu];
- var Np = ((t) => (t.ARRAY_CONVERTOR = "ARRAY_CONVERTOR", t.MATRIX_CONVERTOR = "MATRIX_CONVERTOR", t))(Np || {});
- function Rr(t, e) {
- const { textRuns: n = [] } = e;
- let r = 0;
- for (const i of n) {
- const { ts: o = {}, st: a, ed: u } = i;
- if (o[t] == null)
- return we.FALSE;
- switch (t) {
- case "bl":
- case "it": {
- if (o[t] === we.FALSE)
- return we.FALSE;
- break;
- }
- case "ul":
- case "st": {
- if (o[t].s === we.FALSE)
- return we.FALSE;
- break;
- }
- default:
- throw new Error(`unknown style key: ${t} in IStyleBase`);
- }
- r += u - a;
- }
- return e.dataStream.indexOf(`\r
- `) === r ? we.TRUE : we.FALSE;
- }
- var Qn = class Qn2 {
- constructor(e, n, r) {
- C(this, "_range");
- C(this, "_worksheet");
- this._deps = r, this._range = n, this._worksheet = e;
- }
- static foreach(e, n) {
- const { startRow: r, startColumn: s, endRow: i, endColumn: o } = e;
- for (let a = r; a <= i; a++)
- for (let u = s; u <= o; u++)
- n(a, u);
- }
- /**
- * get current range data
- *
- * @returns current range
- */
- getRangeData() {
- return this._range;
- }
- /**
- * Returns the value of the top-left cell in the range. The value may be of type Number, Boolean, Date, or String
- * depending on the value of the cell. Empty cells return an empty string.
- * @returns The value in this cell
- */
- getValue() {
- return this.getValues()[0][0];
- }
- /**
- * Returns the rectangular grid of values for this range.
- *
- * Returns a two-dimensional array of values, indexed by row, then by column. The values may be of type Number,
- * Boolean, Date, or String, depending on the value of the cell. Empty cells are represented by an empty string
- * in the array. Remember that while a range index starts at 0, 0, same as the JavaScript array is indexed from [0][0].
- *
- * In web apps, a Date value isn't a legal parameter. getValues() fails to return data to a web app if the range
- * contains a cell with a Date value. Instead, transform all the values retrieved from the sheet to a supported
- * JavaScript primitive like a Number, Boolean, or String.
- *
- * @returns A two-dimensional array of values.
- */
- getValues() {
- const { startRow: e, endRow: n, startColumn: r, endColumn: s } = this._range, i = [];
- for (let o = e; o <= n; o++) {
- const a = [];
- for (let u = r; u <= s; u++)
- a.push(this.getMatrix().getValue(o, u) || null);
- i.push(a);
- }
- return i;
- }
- /**
- * get range matrix
- *
- * @returns range matrix
- */
- getMatrix() {
- const { startRow: e, endRow: n, startColumn: r, endColumn: s } = this._range, i = this._worksheet.getCellMatrix(), o = new kt();
- for (let a = e; a <= n; a++)
- for (let u = r; u <= s; u++)
- o.setValue(a, u, i.getValue(a, u) || null);
- return o;
- }
- /**
- * get range matrix object
- *
- * @returns range matrix object
- */
- getMatrixObject() {
- const { startRow: e, endRow: n, startColumn: r, endColumn: s } = this._range, i = this._worksheet.getCellMatrix(), o = new kt();
- for (let a = e; a <= n; a++)
- for (let u = r; u <= s; u++)
- o.setValue(a - e, u - r, i.getValue(a, u) || {});
- return o;
- }
- /**
- * Returns a string description of the range, in A1 notation.
- *
- * @returns The string description of the range in A1 notation.
- */
- getA1Notation() {
- const { startRow: e, endRow: n, startColumn: r, endColumn: s } = this._range;
- let i, o;
- 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}`;
- }
- /**
- * Returns the background color of the top-left cell in the range (for example, '#ffffff').
- *
- * @returns — The color code of the background.
- */
- getBackground() {
- return this.getBackgrounds()[0][0];
- }
- /**
- * Returns the background colors of the cells in the range (for example, '#ffffff').
- *
- * @returns — A two-dimensional array of color codes of the backgrounds.
- */
- getBackgrounds() {
- const e = this._deps.getStyles();
- return this.getValues().map(
- (n) => n.map((r) => {
- var i;
- const s = e.getStyleByCell(r);
- return ((i = s == null ? void 0 : s.bg) == null ? void 0 : i.rgb) || gt.bg.rgb;
- })
- );
- }
- /**
- * Returns a given cell within a range.
- *
- * The row and column here are relative to the range
- * e.g. "B2:D4", getCell(0,0) in this code returns the cell at B2
- * @returns — A range containing a single cell at the specified coordinates.
- */
- getCell(e, n) {
- const { startRow: r, startColumn: s } = this._range, i = {
- startRow: r + e,
- endRow: r + e,
- startColumn: s + n,
- endColumn: s + n
- };
- return new Qn2(this._worksheet, i, this._deps);
- }
- /**
- * Returns the starting column position for this range
- *
- * @returns — The range's starting column position in the spreadsheet.
- */
- getColumn() {
- return this._range.startColumn;
- }
- /**
- * Returns the data of the object structure, and can set whether to bring styles
- */
- getObjectValue(e = {}) {
- return this.getObjectValues(e)[0][0];
- }
- /**
- * Returns the data of the object structure, and can set whether to bring styles
- *
- * @param options set whether to include style
- * @returns Returns a value in object format
- */
- getObjectValues(e = {}) {
- var a;
- const { startRow: n, endRow: r, startColumn: s, endColumn: i } = this._range, o = this._worksheet.getCellMatrix().getFragment(n, r, s, i).getData();
- if (e.isIncludeStyle) {
- const u = this._deps.getStyles();
- for (let c = 0; c <= r - n; c++)
- for (let l = 0; l <= i - s; l++) {
- if (o == null || ((a = o == null ? void 0 : o[c]) == null ? void 0 : a[l]) == null)
- continue;
- const h = o[c][l].s;
- h && (o[c][l].s = u.get(h));
- }
- }
- return o;
- }
- /**
- * Returns the font color of the cell in the top-left corner of the range, in CSS notation
- */
- getFontColor() {
- return this.getFontColors()[0][0];
- }
- /**
- * Returns the font colors of the cells in the range in CSS notation (such as '#ffffff' or 'white').
- */
- getFontColors() {
- const e = this._deps.getStyles();
- return this.getValues().map(
- (n) => n.map((r) => {
- var i;
- const s = e.getStyleByCell(r);
- return ((i = s == null ? void 0 : s.cl) == null ? void 0 : i.rgb) || gt.cl.rgb;
- })
- );
- }
- /**
- * Returns the font families of the cells in the range.
- */
- getFontFamilies() {
- return this._getStyles("ff");
- }
- /**
- * Returns the font family of the cell in the top-left corner of the range.
- */
- getFontFamily() {
- return this.getFontFamilies()[0][0];
- }
- /**
- * Returns the underlines of the cells in the range.
- */
- getUnderlines() {
- return this._getStyles("ul");
- }
- /**
- * Returns the underline of the cells in the range.
- */
- getUnderline() {
- var n, r;
- const { p: e } = (n = this.getValue()) != null ? n : {};
- return e && Array.isArray((r = e.body) == null ? void 0 : r.textRuns) && e.body.textRuns.length > 0 ? Rr("ul", e.body) === we.TRUE ? {
- s: we.TRUE
- } : {
- s: we.FALSE
- } : this.getUnderlines()[0][0];
- }
- /**
- * Returns the overlines of the cells in the range.
- */
- getOverlines() {
- return this._getStyles("ol");
- }
- /**
- * Returns the overline of the cells in the range.
- */
- getOverline() {
- return this.getOverlines()[0][0];
- }
- /**
- * Returns the strikeThrough of the cells in the range.
- */
- getStrikeThrough() {
- var n, r;
- const { p: e } = (n = this.getValue()) != null ? n : {};
- return e && Array.isArray((r = e.body) == null ? void 0 : r.textRuns) && e.body.textRuns.length > 0 ? Rr("st", e.body) === we.TRUE ? {
- s: we.TRUE
- } : {
- s: we.FALSE
- } : this.getStrikeThroughs()[0][0];
- }
- /**
- * Returns the strikeThroughs of the cells in the range.
- */
- getStrikeThroughs() {
- return this._getStyles("st");
- }
- /**
- * Returns the font size in point size of the cell in the top-left corner of the range.
- */
- getFontSize() {
- var n, r;
- const e = ((n = this.getValue()) == null ? void 0 : n.p) || {};
- return Array.isArray((r = e.body) == null ? void 0 : r.textRuns) && e.body.textRuns.length > 0 ? e.body.textRuns.some((s) => {
- var i;
- return ((i = s == null ? void 0 : s.ts) == null ? void 0 : i.fs) != null;
- }) ? Math.max(...e.body.textRuns.map((s) => {
- var i;
- return ((i = s == null ? void 0 : s.ts) == null ? void 0 : i.fs) || 0;
- })) : this.getFontSizes()[0][0] : this.getFontSizes()[0][0];
- }
- /**
- * Returns the font sizes of the cells in the range.
- */
- getFontSizes() {
- return this._getStyles("fs");
- }
- /**
- * Returns the border info of the cells in the range.
- */
- getBorder() {
- return this.getBorders()[0][0];
- }
- getBorders() {
- return this._getStyles("bd");
- }
- /**
- * Returns the font style ('italic' or 'normal') of the cell in the top-left corner of the range.
- */
- getFontStyle() {
- var n, r;
- const { p: e } = (n = this.getValue()) != null ? n : {};
- 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];
- }
- /**
- * Returns the font styles of the cells in the range.
- */
- _getFontStyles() {
- return this._getStyles("it");
- }
- /**
- * Returns the font weight (normal/bold) of the cell in the top-left corner of the range.
- * If the cell has rich text, the return value according to the textRuns of the rich text,
- * when all styles of textRuns are bold, it will return FontWeight.BOLD,
- * otherwise return FontWeight.NORMAL.
- */
- getFontWeight() {
- var n, r;
- const { p: e } = (n = this.getValue()) != null ? n : {};
- 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];
- }
- /**
- * Returns the font weights of the cells in the range.
- */
- _getFontWeights() {
- return this._getStyles("bl");
- }
- /**
- * Returns the grid ID of the range's parent sheet.
- */
- getGridId() {
- return this._worksheet.getSheetId();
- }
- /**
- * Returns the height of the range.
- */
- getHeight() {
- const { _range: e, _worksheet: n } = this, { startRow: r, endRow: s } = e;
- let i = 0;
- for (let o = 0; o <= s - r; o++) {
- const a = n.getRowHeight(o);
- i += a;
- }
- return i;
- }
- /**
- * Returns the horizontal alignment of the text (left/center/right) of the cell in the top-left corner of the range.
- */
- getHorizontalAlignment() {
- return this.getHorizontalAlignments()[0][0];
- }
- /**
- *Returns the horizontal alignments of the cells in the range.
- */
- getHorizontalAlignments() {
- return this._getStyles("ht");
- }
- /**
- * Returns the end column position.
- */
- getLastColumn() {
- return this._range.endColumn;
- }
- /**
- * Returns the end row position.
- */
- getLastRow() {
- return this._range.endRow;
- }
- /**
- * Returns the number of columns in this range.
- */
- getNumColumns() {
- const { startColumn: e, endColumn: n } = this._range;
- return n - e + 1;
- }
- /**
- * Returns the number of rows in this range.
- */
- getNumRows() {
- const { startRow: e, endRow: n } = this._range;
- return n - e + 1;
- }
- /**
- * Returns the Rich Text value for the top left cell of the range, or null if the cell value is not text.
- */
- getRichTextValue() {
- return this.getRichTextValues()[0][0];
- }
- /**
- * Returns the Rich Text values for the cells in the range.
- */
- getRichTextValues() {
- return this.getValues().map((e) => e.map((n) => (n == null ? void 0 : n.p) || ""));
- }
- /**
- * Returns the row position for this range.
- */
- getRowIndex() {
- return this._range.startRow;
- }
- /**
- * Returns the sheet this range belongs to.
- */
- getSheet() {
- return this._worksheet;
- }
- /**
- * Returns the text direction for the top left cell of the range.
- */
- getTextDirection() {
- return this.getTextDirections()[0][0];
- }
- /**
- * Returns the text directions for the cells in the range.
- */
- getTextDirections() {
- return this._getStyles("td");
- }
- /**
- * Returns the text rotation settings for the top left cell of the range.
- */
- // getTextRotation(): number {
- getTextRotation() {
- return this.getTextRotations()[0][0];
- }
- /**
- * Returns the text rotation settings for the cells in the range.
- */
- // getTextRotations(): number[][] {
- getTextRotations() {
- return this._getStyles("tr");
- }
- /**
- * Returns the text style for the top left cell of the range.
- */
- getTextStyle() {
- return this.getTextStyles()[0][0];
- }
- /**
- * Returns the text styles for the cells in the range.
- */
- getTextStyles() {
- const e = this._deps.getStyles();
- return this.getValues().map((n) => n.map((r) => e.getStyleByCell(r)));
- }
- /**
- * Returns the vertical alignment (top/middle/bottom) of the cell in the top-left corner of the range.
- */
- getVerticalAlignment() {
- return this.getVerticalAlignments()[0][0];
- }
- /**
- * Returns the vertical alignments of the cells in the range.
- */
- getVerticalAlignments() {
- return this._getStyles("vt");
- }
- /**
- * Returns the width of the range in columns.
- */
- getWidth() {
- const { _range: e, _worksheet: n } = this, { startColumn: r, endColumn: s } = e;
- let i = 0;
- for (let o = 0; o <= s - r; o++)
- i += n.getColumnWidth(o);
- return i;
- }
- /**
- * Returns whether the text in the cell wraps.
- */
- getWrap() {
- return this.getWrapStrategy() === xn.WRAP ? we.TRUE : we.FALSE;
- }
- /**
- * Returns the text wrapping strategies for the cells in the range.
- */
- getWrapStrategies() {
- return this._getStyles("tb");
- }
- /**
- * Returns the text wrapping strategy for the top left cell of the range.
- */
- getWrapStrategy() {
- return this.getWrapStrategies()[0][0];
- }
- forEach(e) {
- Qn2.foreach(this._range, e);
- }
- /**
- *
- * @param arg Shorthand for the style that gets
- * @returns style value
- */
- _getStyles(e) {
- const n = this._deps.getStyles();
- return this.getValues().map(
- (r) => r.map((s) => {
- const i = n && n.getStyleByCell(s);
- return i && i[e] || gt[e];
- })
- );
- }
- };
- C(Qn, "transformRange", (e, n) => {
- const r = n.getMaxColumns() - 1, s = n.getMaxRows() - 1;
- return e.rangeType === De.ALL ? {
- startColumn: 0,
- startRow: 0,
- endColumn: r,
- endRow: s
- } : e.rangeType === De.COLUMN ? {
- startRow: 0,
- endRow: s,
- startColumn: e.startColumn,
- endColumn: e.endColumn
- } : e.rangeType === De.ROW ? {
- startColumn: 0,
- endColumn: r,
- startRow: e.startRow,
- endRow: e.endRow
- } : {
- startColumn: e.startColumn,
- endColumn: Math.min(e.endColumn, r),
- startRow: e.startRow,
- endRow: Math.min(e.endRow, s)
- };
- });
- var tr = Qn;
- function jC(t, e, n, r = false) {
- if (e === 0 && n === 0)
- return t;
- let s = { ...t };
- const i = s.startAbsoluteRefType || tt.NONE, o = s.endAbsoluteRefType || tt.NONE, a = s.rangeType || De.NORMAL;
- if (!r && i === tt.ALL && o === tt.ALL)
- return s;
- const u = Xo(s.startRow, n, s.startColumn, e, a), c = Xo(s.endRow, n, s.endColumn, e, a);
- return r || i === tt.NONE && o === tt.NONE ? s = {
- ...s,
- startRow: u.row,
- startColumn: u.column,
- endRow: c.row,
- endColumn: c.column
- } : (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);
- }
- function Xo(t, e, n, r, s) {
- 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 };
- }
- function Uu(t) {
- const e = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
- for (const o of t)
- e.add(o.startColumn), e.add(o.endColumn + 1), n.add(o.startRow), n.add(o.endRow + 1);
- const r = Array.from(e).sort((o, a) => o - a), s = Array.from(n).sort((o, a) => o - a);
- t.sort((o, a) => o.startRow - a.startRow || o.startColumn - a.startColumn);
- const i = [];
- for (let o = 0; o < s.length - 1; o++)
- for (let a = 0; a < r.length - 1; a++) {
- const u = r[a], c = r[a + 1] - 1, l = s[o], h = s[o + 1] - 1;
- for (const d of t) {
- if (d.startRow > h)
- break;
- if (d.startRow <= l && d.endRow >= h && d.startColumn <= u && d.endColumn >= c) {
- i.push({
- startColumn: u,
- endColumn: c,
- startRow: l,
- endRow: h
- });
- break;
- }
- }
- }
- return i;
- }
- function Tp(t) {
- t.sort((r, s) => r.startRow - s.startRow || r.startColumn - s.startColumn);
- const e = {};
- for (const r of t)
- e[r.startRow] || (e[r.startRow] = []), e[r.startRow].push(r);
- const n = [];
- for (const r in e) {
- const s = e[+r];
- s.sort((o, a) => o.startColumn - a.startColumn);
- let i = s[0];
- for (let o = 1; o < s.length; o++) {
- const a = s[o];
- 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);
- }
- n.push(i);
- }
- return n;
- }
- function Mp(t) {
- t.sort((r, s) => r.startColumn - s.startColumn || r.startRow - s.startRow);
- const e = {};
- for (const r of t)
- e[r.startColumn] || (e[r.startColumn] = []), e[r.startColumn].push(r);
- const n = [];
- for (const r in e) {
- const s = e[+r];
- s.sort((o, a) => o.startRow - a.startRow);
- let i = s[0];
- for (let o = 1; o < s.length; o++) {
- const a = s[o];
- 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);
- }
- n.push(i);
- }
- return n;
- }
- function Dp(t) {
- const e = Uu(t), n = Tp(e);
- return Mp(n);
- }
- function xp(t, e) {
- const n = [];
- return t.forEach((r) => {
- n.push(...en.subtract(r, e));
- }), en.mergeRanges(n);
- }
- function HC(t, e) {
- const n = Jo(
- t.startRow,
- t.endRow,
- e.startRow,
- e.endRow
- ), r = Jo(
- t.startColumn,
- t.endColumn,
- e.startColumn,
- e.endColumn
- );
- if (!n || !r)
- return null;
- const [s, i] = n, [o, a] = r, u = Lp(
- t.rangeType,
- e.rangeType,
- s,
- i,
- o,
- a
- );
- return {
- startRow: s,
- endRow: i,
- startColumn: o,
- endColumn: a,
- rangeType: u
- };
- }
- function Jo(t, e, n, r) {
- 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);
- if (u <= c) {
- const l = u === -1 / 0 ? Number.NaN : u, h = c === 1 / 0 ? Number.NaN : c;
- return [l, h];
- } else
- return null;
- }
- function Lp(t, e, n, r, s, i) {
- const o = t !== void 0 ? t : Zo(n, r, s, i), a = e !== void 0 ? e : Zo(n, r, s, i);
- 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);
- }
- function Zo(t, e, n, r) {
- const s = !isNaN(t) && !isNaN(e), i = !isNaN(n) && !isNaN(r);
- return s && i ? De.NORMAL : s ? De.ROW : i ? De.COLUMN : De.ALL;
- }
- var Ut = class Ut2 {
- /**
- * Creates a deep copy of an IRange object
- * @param src
- * @example
- * ```typescript
- * const original = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
- * const copy = Rectangle.clone(original);
- * // copy = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 }
- * ```
- */
- static clone(e) {
- return e.rangeType !== void 0 ? {
- startRow: e.startRow,
- startColumn: e.startColumn,
- endRow: e.endRow,
- endColumn: e.endColumn,
- rangeType: e.rangeType
- } : {
- startRow: e.startRow,
- startColumn: e.startColumn,
- endRow: e.endRow,
- endColumn: e.endColumn
- };
- }
- /**
- * Checks if two ranges are equal by comparing their properties
- * @param src
- * @param target
- * @example
- * ```typescript
- * const range1 = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
- * const range2 = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
- * const areEqual = Rectangle.equals(range1, range2); // true
- * ```
- */
- static equals(e, n) {
- 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);
- }
- /**
- * Quickly checks if two normal ranges intersect. For specialized range types,
- * use the intersects() method instead.
- * @param rangeA
- * @param rangeB
- * @example
- * ```typescript
- * const range1 = { startRow: 0, startColumn: 0, endRow: 2, endColumn: 2 };
- * const range2 = { startRow: 1, startColumn: 1, endRow: 3, endColumn: 3 };
- * const doIntersect = Rectangle.simpleRangesIntersect(range1, range2); // true
- * ```
- */
- static simpleRangesIntersect(e, n) {
- 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;
- return h && d;
- }
- /**
- * Checks if two ranges intersect, handling special range types (ROW, COLUMN)
- * @param src
- * @param target
- * @example
- * ```typescript
- * const rowRange = {
- * startRow: 0, endRow: 2,
- * startColumn: NaN, endColumn: NaN,
- * rangeType: RANGE_TYPE.ROW
- * };
- * const colRange = {
- * startRow: NaN, endRow: NaN,
- * startColumn: 0, endColumn: 2,
- * rangeType: RANGE_TYPE.COLUMN
- * };
- * const doIntersect = Rectangle.intersects(rowRange, colRange); // true
- * ```
- */
- static intersects(e, n) {
- if (e.rangeType === De.ROW && n.rangeType === De.COLUMN || e.rangeType === De.COLUMN && n.rangeType === De.ROW)
- return true;
- if (e.rangeType === De.ROW && n.rangeType === De.ROW)
- return e.startRow <= n.endRow && e.endRow >= n.startRow;
- if (e.rangeType === De.COLUMN && n.rangeType === De.COLUMN)
- return e.startColumn <= n.endColumn && e.endColumn >= n.startColumn;
- 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);
- return d <= f && E <= R;
- }
- /**
- * Gets the intersection range between two ranges
- * @param src
- * @param target
- * @deprecated use `getIntersectRange` instead
- * @example
- * ```typescript
- * const range1 = { startRow: 0, startColumn: 0, endRow: 2, endColumn: 2 };
- * const range2 = { startRow: 1, startColumn: 1, endRow: 3, endColumn: 3 };
- * const intersection = Rectangle.getIntersects(range1, range2);
- * // intersection = { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
- * ```
- */
- static getIntersects(e, n) {
- 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;
- let h, d, f, E;
- if (a <= s)
- a >= r ? d = a : d = r;
- else
- return null;
- if (u >= r)
- u >= s ? E = s : E = u;
- else
- return null;
- if (c <= o)
- c > i ? h = c : h = i;
- else
- return null;
- if (l >= i)
- l >= o ? f = o : f = l;
- else
- return null;
- return {
- startRow: d,
- endRow: E,
- startColumn: h,
- endColumn: f,
- rangeType: De.NORMAL
- // TODO: this may not be accurate
- };
- }
- /**
- * Checks if one range completely contains another range
- * @param src
- * @param target
- * @example
- * ```typescript
- * const outer = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
- * const inner = { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 };
- * const contains = Rectangle.contains(outer, inner); // true
- * ```
- */
- static contains(e, n) {
- return e.startRow <= n.startRow && e.endRow >= n.endRow && e.startColumn <= n.startColumn && e.endColumn >= n.endColumn;
- }
- /**
- * Checks if one range strictly contains another range (not equal)
- * @param src
- * @param target
- * @example
- * ```typescript
- * const outer = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
- * const same = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
- * const realContains = Rectangle.realContain(outer, same); // false
- * ```
- */
- static realContain(e, n) {
- return Ut2.contains(e, n) && (e.startRow < n.startRow || e.endRow > n.endRow || e.startColumn < n.startColumn || e.endColumn > n.endColumn);
- }
- /**
- * Creates a union range that encompasses all input ranges
- * @param {...any} ranges
- * @example
- * ```typescript
- * const range1 = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
- * const range2 = { startRow: 2, startColumn: 2, endRow: 3, endColumn: 3 };
- * const union = Rectangle.union(range1, range2);
- * // union = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 }
- * ```
- */
- static union(...e) {
- return e.reduce(
- (n, r) => ({
- startRow: Math.min(n.startRow, r.startRow),
- startColumn: Math.min(n.startColumn, r.startColumn),
- endRow: Math.max(n.endRow, r.endRow),
- endColumn: Math.max(n.endColumn, r.endColumn),
- rangeType: De.NORMAL
- }),
- e[0]
- );
- }
- /**
- * Creates a union range considering special range types (ROW, COLUMN)
- * @param {...any} ranges
- * @example
- * ```typescript
- * const rowRange = {
- * startRow: 0, endRow: 2,
- * rangeType: RANGE_TYPE.ROW
- * };
- * const normalRange = {
- * startRow: 1, startColumn: 1,
- * endRow: 3, endColumn: 3
- * };
- * const union = Rectangle.realUnion(rowRange, normalRange);
- * // Result will have NaN for columns due to ROW type
- * ```
- */
- static realUnion(...e) {
- const n = e.some((i) => i.rangeType === De.COLUMN), r = e.some((i) => i.rangeType === De.ROW), s = Ut2.union(...e);
- return {
- startColumn: r ? Number.NaN : s.startColumn,
- endColumn: r ? Number.NaN : s.endColumn,
- startRow: n ? Number.NaN : s.startRow,
- endRow: n ? Number.NaN : s.endRow,
- rangeType: r ? De.ROW : n ? De.COLUMN : De.NORMAL
- };
- }
- /**
- * Subtracts one range from another, returning the remaining areas as separate ranges
- * @param range1
- * @param range2
- * @example
- * ```typescript
- * const range1 = { startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 };
- * const range2 = { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 };
- * const result = Rectangle.subtract(range1, range2);
- * // Results in up to 4 ranges representing the non-overlapping areas
- * ```
- */
- static subtract(e, n) {
- if (n.startRow > e.endRow || n.endRow < e.startRow || n.startColumn > e.endColumn || n.endColumn < e.startColumn)
- return [e];
- const r = [];
- n.startRow >= e.startRow && r.push({
- startRow: e.startRow,
- startColumn: e.startColumn,
- endRow: n.startRow - 1,
- endColumn: e.endColumn
- }), n.endRow <= e.endRow && r.push({
- startRow: n.endRow + 1,
- startColumn: e.startColumn,
- endRow: e.endRow,
- endColumn: e.endColumn
- });
- const s = Math.max(e.startRow, n.startRow), i = Math.min(e.endRow, n.endRow);
- return n.startColumn >= e.startColumn && r.push({
- startRow: s,
- startColumn: e.startColumn,
- endRow: i,
- endColumn: n.startColumn - 1
- }), n.endColumn <= e.endColumn && r.push({
- startRow: s,
- startColumn: n.endColumn + 1,
- endRow: i,
- endColumn: e.endColumn
- }), r.filter((a) => a.startRow <= a.endRow && a.startColumn <= a.endColumn);
- }
- /**
- * Merges overlapping or adjacent ranges into larger ranges
- * @param ranges
- * @example
- * ```typescript
- * const ranges = [
- * { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 },
- * { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 }
- * ];
- * const merged = Rectangle.mergeRanges(ranges);
- * // Combines overlapping ranges into larger ones
- * ```
- */
- static mergeRanges(e) {
- return Dp(e);
- }
- /**
- * Splits overlapping ranges into a grid of non-overlapping ranges
- * @param ranges
- * @example
- * ```typescript
- * const ranges = [
- * { startRow: 0, startColumn: 0, endRow: 2, endColumn: 2 },
- * { startRow: 1, startColumn: 1, endRow: 3, endColumn: 3 }
- * ];
- * const grid = Rectangle.splitIntoGrid(ranges);
- * // Splits into non-overlapping grid sections
- * ```
- */
- static splitIntoGrid(e) {
- return Uu(e);
- }
- /**
- * Subtracts multiple ranges from multiple ranges
- * @param ranges1
- * @param ranges2
- * @example
- * ```typescript
- * const ranges1 = [{ startRow: 0, startColumn: 0, endRow: 3, endColumn: 3 }];
- * const ranges2 = [
- * { startRow: 1, startColumn: 1, endRow: 2, endColumn: 2 },
- * { startRow: 2, startColumn: 2, endRow: 3, endColumn: 3 }
- * ];
- * const result = Rectangle.subtractMulti(ranges1, ranges2);
- * // Returns remaining non-overlapping areas
- * ```
- */
- static subtractMulti(e, n) {
- if (!n.length)
- return e;
- let r = e;
- return n.forEach((s) => {
- r = xp(r, s);
- }), r;
- }
- /**
- * Checks if two rectangles defined by left, top, right, bottom coordinates intersect
- * @param rect1
- * @param rect2
- * @example
- * ```typescript
- * const rect1 = { left: 0, top: 0, right: 10, bottom: 10 };
- * const rect2 = { left: 5, top: 5, right: 15, bottom: 15 };
- * const intersects = Rectangle.hasIntersectionBetweenTwoRect(rect1, rect2); // true
- * ```
- */
- static hasIntersectionBetweenTwoRect(e, n) {
- return !(e.left > n.right || // rect1 在 rect2 右侧
- e.right < n.left || // rect1 在 rect2 左侧
- e.top > n.bottom || // rect1 在 rect2 下方
- e.bottom < n.top);
- }
- /**
- * Gets the intersection area between two rectangles defined by LTRB coordinates
- * @param rect1
- * @param rect2
- * @example
- * ```typescript
- * const rect1 = { left: 0, top: 0, right: 10, bottom: 10 };
- * const rect2 = { left: 5, top: 5, right: 15, bottom: 15 };
- * const intersection = Rectangle.getIntersectionBetweenTwoRect(rect1, rect2);
- * // Returns { left: 5, top: 5, right: 10, bottom: 10, width: 5, height: 5 }
- * ```
- */
- static getIntersectionBetweenTwoRect(e, n) {
- 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);
- return s <= r || o <= i ? null : {
- left: r,
- right: s,
- top: i,
- bottom: o,
- width: s - r,
- height: o - i
- };
- }
- /**
- * Sorts an array of ranges by startRow, then by startColumn
- * @param ranges
- * @example
- * ```typescript
- * const ranges = [
- * { startRow: 1, startColumn: 0, endRow: 2, endColumn: 1 },
- * { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 }
- * ];
- * const sorted = Rectangle.sort(ranges);
- * // Ranges will be sorted by startRow first, then startColumn
- * ```
- */
- static sort(e) {
- return e.sort((n, r) => n.startRow - r.startRow || n.startColumn - r.startColumn);
- }
- };
- C(Ut, "getRelativeRange", (e, n) => ({
- startRow: e.startRow - n.startRow,
- endRow: e.endRow - e.startRow,
- startColumn: e.startColumn - n.startColumn,
- endColumn: e.endColumn - e.startColumn
- })), /**
- * Converts a relative range back to an absolute range based on origin
- * @param relativeRange
- * @param originRange
- * @param absoluteRange
- * @example
- * ```typescript
- * const relative = { startRow: 2, startColumn: 2, endRow: 2, endColumn: 2 };
- * const origin = { startRow: 3, startColumn: 3, endRow: 8, endColumn: 8 };
- * const absolute = Rectangle.getPositionRange(relative, origin);
- * // absolute = { startRow: 5, startColumn: 5, endRow: 7, endColumn: 7 }
- * ```
- */
- C(Ut, "getPositionRange", (e, n, r) => ({
- ...r || {},
- startRow: r && [tt.ROW, tt.ALL].includes(r.startAbsoluteRefType || 0) ? r.startRow : e.startRow + n.startRow,
- endRow: r && [tt.ROW, tt.ALL].includes(r.endAbsoluteRefType || 0) ? r.endRow : e.endRow + e.startRow + n.startRow,
- startColumn: r && [tt.COLUMN, tt.ALL].includes(r.startAbsoluteRefType || 0) ? r.startColumn : e.startColumn + n.startColumn,
- endColumn: r && [tt.COLUMN, tt.ALL].includes(r.endAbsoluteRefType || 0) ? r.endColumn : e.endColumn + e.startColumn + n.startColumn
- })), /**
- * Moves a range horizontally by a specified step and optionally extends it
- * @param range
- * @param step
- * @param length
- * @example
- * ```typescript
- * const range = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
- * const moved = Rectangle.moveHorizontal(range, 2, 1);
- * // moved = { startRow: 0, startColumn: 2, endRow: 1, endColumn: 4 }
- * ```
- */
- C(Ut, "moveHorizontal", (e, n = 0, r = 0) => ({
- ...e,
- startColumn: e.startColumn + n,
- endColumn: e.endColumn + n + r
- })), /**
- * Moves a range vertically by a specified step and optionally extends it
- * @param range
- * @param step
- * @param length
- * @example
- * ```typescript
- * const range = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
- * const moved = Rectangle.moveVertical(range, 2, 1);
- * // moved = { startRow: 2, startColumn: 0, endRow: 4, endColumn: 1 }
- * ```
- */
- C(Ut, "moveVertical", (e, n = 0, r = 0) => ({
- ...e,
- startRow: e.startRow + n,
- endRow: e.endRow + n + r
- })), /**
- * Moves a range by specified offsets in both directions
- * @param range
- * @param offsetX
- * @param offsetY
- * @example
- * ```typescript
- * const range = { startRow: 0, startColumn: 0, endRow: 1, endColumn: 1 };
- * const moved = Rectangle.moveOffset(range, 2, 3);
- * // moved = { startRow: 3, startColumn: 2, endRow: 4, endColumn: 3 }
- * ```
- */
- C(Ut, "moveOffset", (e, n, r) => ({
- ...e,
- startRow: e.startRow + r,
- endRow: e.endRow + r,
- startColumn: e.startColumn + n,
- endColumn: e.endColumn + n
- }));
- var en = Ut;
- function Up(t, e) {
- if (t.length === 0 || t[0].length === 0)
- return null;
- const n = new Array(t[0].length).fill(0);
- let r = 0, s = null;
- for (let i = 0; i < t.length; i++) {
- for (let a = 0; a < t[0].length; a++)
- n[a] = e(t[i][a]) ? n[a] + 1 : 0;
- const o = Pp(n);
- o.area > r && (r = o.area, s = {
- startColumn: o.start,
- startRow: i - o.height + 1,
- endColumn: o.end,
- endRow: i
- });
- }
- return s;
- }
- function Pp(t) {
- const e = [];
- let n = 0, r = { area: 0, height: 0, start: 0, end: 0 }, s = 0;
- for (; s < t.length; )
- if (e.length === 0 || t[s] >= t[e[e.length - 1]])
- e.push(s++);
- else {
- const i = t[e.pop()], o = e.length === 0 ? s : s - e[e.length - 1] - 1;
- i * o > n && (n = i * o, r = { area: n, height: i, start: e.length === 0 ? 0 : e[e.length - 1] + 1, end: s - 1 });
- }
- for (; e.length > 0; ) {
- const i = t[e.pop()], o = e.length === 0 ? s : s - e[e.length - 1] - 1;
- i * o > n && (n = i * o, r = { area: n, height: i, start: e.length === 0 ? 0 : e[e.length - 1] + 1, end: s - 1 });
- }
- return r;
- }
- function kp(t, e) {
- tr.foreach(e, (n, r) => {
- t[n][r] = void 0;
- });
- }
- function WC(t, e) {
- const n = t.toFullArray(), r = [];
- for (; ; ) {
- const s = Up(n, e);
- if (!s)
- break;
- r.push(s), kp(n, s);
- }
- return r;
- }
- var zC = class {
- constructor(e, n) {
- C(this, "_values", []);
- C(this, "_keys", []);
- C(this, "_keyMaps", /* @__PURE__ */ new Map());
- this._values = e, this._keys = n, e.forEach((r) => {
- this._initKeyMap(r);
- });
- }
- _initKeyMap(e) {
- this._keys.forEach((n) => {
- const r = e[n], s = this._keyMaps.get(n) || /* @__PURE__ */ new Map();
- s.set(r, e), this._keyMaps.set(n, s);
- });
- }
- /**
- * If a key group is specified, the order of values is determined by the key group, otherwise it depends on the keys at initialization
- * @param {string} key
- * @param {K[]} [keyGroup]
- * @return {*}
- * @memberof RefAlias
- */
- getValue(e, n) {
- const r = n || this._keys;
- for (let s = 0; s < r.length; s++) {
- const i = this._keyMaps.get(r[s]);
- if (i != null && i.has(e))
- return i.get(e);
- }
- return null;
- }
- hasValue(e) {
- for (let n = 0; n < this._keys.length; n++) {
- const r = this._keyMaps.get(this._keys[n]);
- if (r != null && r.has(e))
- return true;
- }
- return false;
- }
- addValue(e) {
- this._values.push(e), this._initKeyMap(e);
- }
- setValue(e, n, r) {
- const s = this.getValue(e);
- s && Object.keys(s).includes(n) && (s[n] = r);
- }
- deleteValue(e, n) {
- const r = this.getValue(e, n);
- if (r) {
- this._keys.forEach((i) => {
- const o = this._keyMaps.get(i), a = r[i];
- o == null || o.delete(a);
- });
- const s = this._values.findIndex((i) => i === r);
- this._values.splice(s, 1);
- }
- }
- getValues() {
- return this._values;
- }
- getKeyMap(e) {
- var n;
- return [...((n = this._keyMaps.get(e)) == null ? void 0 : n.keys()) || []];
- }
- clear() {
- this._values = [], this._keys = [], this._keyMaps.clear();
- }
- };
- function Qo(t, e, n, r) {
- return {
- forEach(s) {
- for (let i = t; i <= e; i++)
- for (let o = n; o <= r; o++)
- s(i, o);
- }
- };
- }
- function YC(t) {
- if (t == null || t.length === 0)
- return Number.NaN;
- const e = t.toLowerCase().split(""), n = e.length, r = (o) => o.charCodeAt(0) - 96;
- let s = 0, i = 0;
- for (let o = 0; o < n; o++)
- i = r(e[o]), s += i * 26 ** (n - o - 1);
- return s === 0 ? Number.NaN : s - 1;
- }
- var qr = 65;
- var Pu = 90;
- var Fp = 97;
- function VC(t) {
- const e = Pu - qr + 1;
- let n = "";
- for (; t >= 0; )
- n = String.fromCharCode(t % e + qr) + n, t = Math.floor(t / e) - 1;
- return n;
- }
- function $p(t, e) {
- let n = "";
- for (; e > 0; )
- n += t, e--;
- return n;
- }
- function GC(t, e = false) {
- const n = Pu - qr + 1;
- let r = Fp;
- e && (r = qr);
- const s = String.fromCharCode(t % n + r), i = Math.floor(t / n) + 1;
- return $p(s, i);
- }
- function KC(t, e) {
- return t.zIndex > e.zIndex ? 1 : t.zIndex === e.zIndex ? 0 : -1;
- }
- function XC(t, e) {
- return t.zIndex > e.zIndex ? -1 : t.zIndex === e.zIndex ? 0 : 1;
- }
- function ps(t = "index", e = 1) {
- return (n, r) => n[t] > r[t] ? e : n[t] === r[t] ? 0 : -e;
- }
- 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 || {});
- var jp = ((t) => (t[t.TAB = 0] = "TAB", t[t.SPACE = 1] = "SPACE", t[t.NOTHING = 2] = "NOTHING", t))(jp || {});
- 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 || {});
- 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 || {});
- 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 || {});
- var An = ((t) => (t[t.COMMENT = 0] = "COMMENT", t[t.DELETED = 9999] = "DELETED", t))(An || {});
- var Hp = ((t) => (t[t.DRAWING = 0] = "DRAWING", t[t.CUSTOM = 1] = "CUSTOM", t))(Hp || {});
- var ku = ((t) => (t[t.UNSPECIFIED = 0] = "UNSPECIFIED", t[t.TRADITIONAL = 1] = "TRADITIONAL", t[t.MODERN = 2] = "MODERN", t))(ku || {});
- 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 || {});
- 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 || {});
- 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 || {});
- var Vp = ((t) => (t[t.NORMAL = 0] = "NORMAL", t[t.TBRL = 1] = "TBRL", t[t.LRTBV = 2] = "LRTBV", t))(Vp || {});
- 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 || {});
- 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 || {});
- 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 || {});
- 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 || {});
- var Zp = ((t) => (t[t.AUTO = 0] = "AUTO", t[t.AT_LEAST = 1] = "AT_LEAST", t[t.EXACT = 2] = "EXACT", t))(Zp || {});
- 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 || {});
- 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 || {});
- var em = ((t) => (t[t.UNSPECIFIED = 0] = "UNSPECIFIED", t[t.SPECIFIED = 1] = "SPECIFIED", t))(em || {});
- var tm = ((t) => (t[t.START = 0] = "START", t[t.CENTER = 1] = "CENTER", t[t.END = 2] = "END", t))(tm || {});
- var nm = ((t) => (t[t.AUTO_FIT = 0] = "AUTO_FIT", t[t.FIXED = 1] = "FIXED", t))(nm || {});
- var rm = ((t) => (t[t.NONE = 0] = "NONE", t[t.WRAP = 1] = "WRAP", t))(rm || {});
- var sm = ((t) => (t[t.AUTO = 0] = "AUTO", t[t.AT_LEAST = 1] = "AT_LEAST", t[t.EXACT = 2] = "EXACT", t))(sm || {});
- 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 || {});
- var Yn = ((t) => (t.NORMAL = "normal", t.BOLD = "bold", t.ITALIC = "italic", t))(Yn || {});
- 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 || {});
- 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 || {});
- 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 || {});
- 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 || {});
- 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 || {});
- var hm = ((t) => (t[t.compressPunctuation = 0] = "compressPunctuation", t[t.compressPunctuationAndJapaneseKana = 1] = "compressPunctuationAndJapaneseKana", t[t.doNotCompress = 2] = "doNotCompress", t))(hm || {});
- var dm = ((t) => (t[t.PORTRAIT = 0] = "PORTRAIT", t[t.LANDSCAPE = 1] = "LANDSCAPE", t))(dm || {});
- 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 || {});
- 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 || {});
- 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 || {});
- 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 || {});
- 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 || {});
- 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 || {});
- 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 || {});
- 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 || {});
- var Ui = class extends nt {
- };
- function _m(t = re.generateRandomId(6), e = ur.EN_US, n = "") {
- return {
- id: t,
- locale: e,
- title: n,
- // title should get from request.
- tableSource: {},
- drawings: {},
- drawingsOrder: [],
- headers: {},
- footers: {},
- body: {
- dataStream: `\r
- `,
- textRuns: [],
- customBlocks: [],
- tables: [],
- paragraphs: [
- {
- startIndex: 0,
- paragraphStyle: {
- spaceAbove: { v: 5 },
- lineSpacing: 1,
- spaceBelow: { v: 0 }
- }
- }
- ],
- sectionBreaks: [
- {
- startIndex: 1
- }
- ]
- },
- documentStyle: {
- pageSize: {
- width: 793.3333333333334,
- height: 1122.6666666666667
- },
- documentFlavor: ku.TRADITIONAL,
- marginTop: 50,
- marginBottom: 50,
- marginRight: 50,
- marginLeft: 50,
- renderConfig: {
- zeroWidthParagraphBreak: we.FALSE,
- vertexAngle: 0,
- centerAngle: 0,
- background: {
- rgb: "#ccc"
- }
- },
- autoHyphenation: we.TRUE,
- doNotHyphenateCaps: we.FALSE,
- consecutiveHyphenLimit: 2,
- defaultHeaderId: "",
- defaultFooterId: "",
- evenPageHeaderId: "",
- evenPageFooterId: "",
- firstPageHeaderId: "",
- firstPageFooterId: "",
- evenAndOddHeaders: we.FALSE,
- useFirstPageHeaderFooter: we.FALSE,
- marginHeader: 30,
- marginFooter: 30
- },
- settings: {}
- };
- }
- var $n = {};
- var Ir = {};
- var vr = {};
- var qo;
- function Em() {
- if (qo)
- return vr;
- qo = 1, Object.defineProperty(vr, "__esModule", { value: true });
- function t(r, s) {
- if (Array.isArray(s))
- return false;
- for (let i in r)
- if (!n(r[i], s[i]))
- return false;
- for (let i in s)
- if (r[i] === void 0)
- return false;
- return true;
- }
- function e(r, s) {
- if (!Array.isArray(s) || r.length !== s.length)
- return false;
- for (let i = 0; i < r.length; i++)
- if (!n(r[i], s[i]))
- return false;
- return true;
- }
- function n(r, s) {
- return r === s ? true : r === null || s === null || typeof r != "object" || typeof s != "object" ? false : Array.isArray(r) ? e(r, s) : t(r, s);
- }
- return vr.default = n, vr;
- }
- var yr = {};
- var ea;
- function Cm() {
- if (ea)
- return yr;
- ea = 1, Object.defineProperty(yr, "__esModule", { value: true });
- function t(e) {
- if (e === null)
- return null;
- if (Array.isArray(e))
- return e.map(t);
- if (typeof e == "object") {
- const n = {};
- for (let r in e)
- n[r] = t(e[r]);
- return n;
- } else
- return e;
- }
- return yr.default = t, yr;
- }
- var Ns = {};
- var ta;
- function $u() {
- return ta || (ta = 1, function(t) {
- Object.defineProperty(t, "__esModule", { value: true }), t.eachChildOf = t.advancer = t.readCursor = t.writeCursor = t.WriteCursor = t.ReadCursor = t.isValidPathItem = void 0;
- function e(l, h) {
- if (!l)
- throw new Error(h);
- }
- const n = (l) => l != null && typeof l == "object" && !Array.isArray(l), r = (l, h) => (
- // All the numbers, then all the letters. Just as the gods of ascii intended.
- typeof l == typeof h ? l > h : typeof l == "string" && typeof h == "number"
- );
- function s(l, h) {
- for (let d in l) {
- const f = d;
- h.write(f, l[f]);
- }
- }
- t.isValidPathItem = (l) => typeof l == "number" || typeof l == "string" && l !== "__proto__";
- class i {
- constructor(h = null) {
- this.parents = [], this.indexes = [], this.lcIdx = -1, this.idx = -1, this.container = h;
- }
- ascend() {
- 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--);
- }
- getPath() {
- const h = [];
- let d = this.container, f = this.parents.length - 1, E = this.idx;
- for (; E >= 0; )
- h.unshift(d[E]), E === 0 ? (E = this.indexes[f * 2], d = this.parents[f--]) : E -= n(d[E - 1]) ? 2 : 1;
- return h;
- }
- }
- class o extends i {
- get() {
- return this.container ? this.container.slice(this.idx + 1) : null;
- }
- // Its only valid to call this after descending into a child.
- getKey() {
- return e(this.container != null, "Invalid call to getKey before cursor descended"), this.container[this.idx];
- }
- getComponent() {
- let h;
- return this.container && this.container.length > this.idx + 1 && n(h = this.container[this.idx + 1]) ? h : null;
- }
- descendFirst() {
- let h = this.idx + 1;
- if (!this.container || h >= this.container.length || n(this.container[h]) && h + 1 >= this.container.length)
- return false;
- n(this.container[h]) && h++;
- const d = this.container[h];
- 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;
- }
- nextSibling() {
- if (e(this.parents.length === this.indexes.length / 2), this.idx > 0 || this.parents.length === 0)
- return false;
- const h = this.indexes[this.indexes.length - 1] + 1, d = this.parents[this.parents.length - 1];
- return h >= d.length ? false : (e(!isNaN(h)), this.indexes[this.indexes.length - 1] = h, this.container = d[h], true);
- }
- _init(h, d, f, E) {
- this.container = h, this.idx = d, this.parents = f.slice(), this.indexes = E.slice();
- }
- clone() {
- const h = new o();
- return h._init(this.container, this.idx, this.parents, this.indexes), h;
- }
- *[Symbol.iterator]() {
- if (this.descendFirst()) {
- do
- yield this.getKey();
- while (this.nextSibling());
- this.ascend();
- }
- }
- // TODO(cleanup): Consider moving these functions out of cursor, since
- // they're really just helper methods.
- // It'd be really nice to do this using generators.
- traverse(h, d) {
- const f = this.getComponent();
- f && d(f, h);
- for (const E of this)
- h && h.descend(E), this.traverse(h, d), h && h.ascend();
- }
- eachPick(h, d) {
- this.traverse(h, (f, E) => {
- f.p != null && d(f.p, E);
- });
- }
- eachDrop(h, d) {
- this.traverse(h, (f, E) => {
- f.d != null && d(f.d, E);
- });
- }
- }
- t.ReadCursor = o;
- class a extends i {
- constructor(h = null) {
- super(h), this.pendingDescent = [], this._op = h;
- }
- flushDescent() {
- e(this.parents.length === this.indexes.length / 2), this.container === null && (this._op = this.container = []);
- for (let h = 0; h < this.pendingDescent.length; h++) {
- const d = this.pendingDescent[h];
- let f = this.idx + 1;
- if (f < this.container.length && n(this.container[f]) && f++, e(f === this.container.length || !n(this.container[f])), f === this.container.length)
- this.container.push(d), this.idx = f;
- else if (this.container[f] === d)
- this.idx = f;
- else {
- if (!Array.isArray(this.container[f])) {
- const E = this.container.splice(f, this.container.length - f);
- this.container.push(E), this.lcIdx > -1 && (this.lcIdx = f);
- }
- 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]); )
- f++;
- if (this.indexes.push(f), this.idx = 0, f < this.container.length && this.container[f][0] === d)
- this.container = this.container[f];
- else {
- const E = [d];
- this.container.splice(f, 0, E), this.container = E;
- }
- }
- }
- this.pendingDescent.length = 0;
- }
- reset() {
- this.lcIdx = -1;
- }
- // Creates and returns a component, creating one if need be. You should
- // probably write to it immediately - ops are not valid with empty
- // components.
- getComponent() {
- this.flushDescent();
- const h = this.idx + 1;
- if (h < this.container.length && n(this.container[h]))
- return this.container[h];
- {
- const d = {};
- return this.container.splice(h, 0, d), d;
- }
- }
- write(h, d) {
- const f = this.getComponent();
- e(f[h] == null || f[h] === d, "Internal consistency error: Overwritten component. File a bug"), f[h] = d;
- }
- get() {
- return this._op;
- }
- descend(h) {
- if (!t.isValidPathItem(h))
- throw Error("Invalid JSON key");
- this.pendingDescent.push(h);
- }
- descendPath(h) {
- return this.pendingDescent.push(...h), this;
- }
- ascend() {
- this.pendingDescent.length ? this.pendingDescent.pop() : super.ascend();
- }
- mergeTree(h, d = s) {
- if (h === null)
- return;
- if (e(Array.isArray(h)), h === this._op)
- throw Error("Cannot merge into my own tree");
- const f = this.lcIdx, E = this.parents.length;
- let R = 0;
- for (let O = 0; O < h.length; O++) {
- const U = h[O];
- typeof U == "string" || typeof U == "number" ? (R++, this.descend(U)) : Array.isArray(U) ? this.mergeTree(U, d) : typeof U == "object" && d(U, this);
- }
- for (; R--; )
- this.ascend();
- this.lcIdx = this.parents.length === E ? f : -1;
- }
- at(h, d) {
- this.descendPath(h), d(this);
- for (let f = 0; f < h.length; f++)
- this.ascend();
- return this;
- }
- // This is used by helpers, so the strict ordering guarantees are
- // relaxed.
- writeAtPath(h, d, f) {
- return this.at(h, () => this.write(d, f)), this.reset(), this;
- }
- writeMove(h, d, f = 0) {
- return this.writeAtPath(h, "p", f).writeAtPath(d, "d", f);
- }
- getPath() {
- const h = super.getPath();
- return h.push(...this.pendingDescent), h;
- }
- }
- t.WriteCursor = a, t.writeCursor = () => new a(), t.readCursor = (l) => new o(l);
- function u(l, h, d) {
- let f, E;
- E = f = l ? l.descendFirst() : false;
- function R(O) {
- let U;
- for (; E; ) {
- const ne = U = l.getKey();
- if (O != null) {
- let X = false;
- if (h && typeof ne == "number" && (U = h(ne, l.getComponent()), U < 0 && (U = ~U, X = true)), r(U, O))
- return null;
- if (U === O && !X)
- return l;
- }
- d && typeof U == "number" && d(U, l.getComponent()), E = l.nextSibling();
- }
- return null;
- }
- return R.end = () => {
- f && l.ascend();
- }, R;
- }
- t.advancer = u;
- function c(l, h, d) {
- let f, E, R, O;
- for (f = E = l && l.descendFirst(), R = O = h && h.descendFirst(); f || R; ) {
- let U = f ? l.getKey() : null, ne = R ? h.getKey() : null;
- 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());
- }
- E && l.ascend(), O && h.ascend();
- }
- t.eachChildOf = c;
- }(Ns)), Ns;
- }
- var Ts = {};
- var na;
- function Bu() {
- return na || (na = 1, function(t) {
- Object.defineProperty(t, "__esModule", { value: true }), t.ConflictType = void 0, function(e) {
- e[e.RM_UNEXPECTED_CONTENT = 1] = "RM_UNEXPECTED_CONTENT", e[e.DROP_COLLISION = 2] = "DROP_COLLISION", e[e.BLACKHOLE = 3] = "BLACKHOLE";
- }(t.ConflictType || (t.ConflictType = {}));
- }(Ts)), Ts;
- }
- var an = {};
- var un = {};
- var ra;
- function Pi() {
- return ra || (ra = 1, Object.defineProperty(un, "__esModule", { value: true }), un.uniToStrPos = un.strPosToUni = void 0, un.strPosToUni = (t, e = t.length) => {
- let n = 0, r = 0;
- for (; r < e; r++) {
- const s = t.charCodeAt(r);
- s >= 55296 && s <= 57343 && (n++, r++);
- }
- if (r !== e)
- throw Error("Invalid offset - splits unicode bytes");
- return r - n;
- }, un.uniToStrPos = (t, e) => {
- let n = 0;
- for (; e > 0; e--) {
- const r = t.charCodeAt(n);
- n += r >= 55296 && r <= 57343 ? 2 : 1;
- }
- return n;
- }), un;
- }
- var Ms = {};
- var sa;
- function Zs() {
- return sa || (sa = 1, function(t) {
- Object.defineProperty(t, "__esModule", { value: true }), t.uniSlice = t.dlen = t.eachOp = void 0;
- const e = Pi(), n = (T) => {
- if (!Array.isArray(T))
- throw Error("Op must be an array of components");
- let A = null;
- for (let H = 0; H < T.length; H++) {
- const Z = T[H];
- switch (typeof Z) {
- case "object":
- if (typeof Z.d != "number" && typeof Z.d != "string")
- throw Error("Delete must be number or string");
- if (t.dlen(Z.d) <= 0)
- throw Error("Deletes must not be empty");
- break;
- case "string":
- if (!(Z.length > 0))
- throw Error("Inserts cannot be empty");
- break;
- case "number":
- if (!(Z > 0))
- throw Error("Skip components must be >0");
- if (typeof A == "number")
- throw Error("Adjacent skip components should be combined");
- break;
- }
- A = Z;
- }
- if (typeof A == "number")
- throw Error("Op has a trailing skip");
- };
- function r(T, A) {
- let H = 0, Z = 0;
- for (let fe = 0; fe < T.length; fe++) {
- const ae = T[fe];
- switch (A(ae, H, Z), typeof ae) {
- case "object":
- H += t.dlen(ae.d);
- break;
- case "string":
- Z += e.strPosToUni(ae);
- break;
- case "number":
- H += ae, Z += ae;
- break;
- }
- }
- }
- t.eachOp = r;
- function s(T, A) {
- const H = [], Z = a(H);
- return r(T, (fe, ae, m) => {
- Z(A(fe, ae, m));
- }), h(H);
- }
- const i = (T) => T, o = (T) => s(T, i);
- t.dlen = (T) => typeof T == "number" ? T : e.strPosToUni(T);
- const a = (T) => (A) => {
- if (!(!A || A.d === 0 || A.d === ""))
- if (T.length === 0)
- T.push(A);
- else if (typeof A == typeof T[T.length - 1])
- if (typeof A == "object") {
- const H = T[T.length - 1];
- H.d = typeof H.d == "string" && typeof A.d == "string" ? H.d + A.d : t.dlen(H.d) + t.dlen(A.d);
- } else
- T[T.length - 1] += A;
- else
- T.push(A);
- }, u = (T) => typeof T == "number" ? T : typeof T == "string" ? e.strPosToUni(T) : typeof T.d == "number" ? T.d : e.strPosToUni(T.d);
- t.uniSlice = (T, A, H) => {
- const Z = e.uniToStrPos(T, A), fe = H == null ? 1 / 0 : e.uniToStrPos(T, H);
- return T.slice(Z, fe);
- };
- const c = (T, A, H) => typeof T == "number" ? H == null ? T - A : Math.min(T, H) - A : t.uniSlice(T, A, H), l = (T) => {
- let A = 0, H = 0;
- return { take: (ae, m) => {
- if (A === T.length)
- return ae === -1 ? null : ae;
- const j = T[A];
- let y;
- if (typeof j == "number")
- return ae === -1 || j - H <= ae ? (y = j - H, ++A, H = 0, y) : (H += ae, ae);
- if (typeof j == "string") {
- if (ae === -1 || m === "i" || e.strPosToUni(j.slice(H)) <= ae)
- return y = j.slice(H), ++A, H = 0, y;
- {
- const M = H + e.uniToStrPos(j.slice(H), ae);
- return y = j.slice(H, M), H = M, y;
- }
- } else {
- if (ae === -1 || m === "d" || t.dlen(j.d) - H <= ae)
- return y = { d: c(j.d, H) }, ++A, H = 0, y;
- {
- let M = c(j.d, H, H + ae);
- return H += ae, { d: M };
- }
- }
- }, peek: () => T[A] };
- }, h = (T) => (T.length > 0 && typeof T[T.length - 1] == "number" && T.pop(), T);
- function d(T, A, H) {
- if (H !== "left" && H !== "right")
- throw Error("side (" + H + ") must be 'left' or 'right'");
- n(T), n(A);
- const Z = [], fe = a(Z), { take: ae, peek: m } = l(T);
- for (let y = 0; y < A.length; y++) {
- const M = A[y];
- let b, w;
- switch (typeof M) {
- case "number":
- for (b = M; b > 0; )
- w = ae(b, "i"), fe(w), typeof w != "string" && (b -= u(w));
- break;
- case "string":
- H === "left" && typeof m() == "string" && fe(ae(-1)), fe(e.strPosToUni(M));
- break;
- case "object":
- for (b = t.dlen(M.d); b > 0; )
- switch (w = ae(b, "i"), typeof w) {
- case "number":
- b -= w;
- break;
- case "string":
- fe(w);
- break;
- case "object":
- b -= t.dlen(w.d);
- }
- break;
- }
- }
- let j;
- for (; j = ae(-1); )
- fe(j);
- return h(Z);
- }
- function f(T, A) {
- n(T), n(A);
- const H = [], Z = a(H), { take: fe } = l(T);
- for (let m = 0; m < A.length; m++) {
- const j = A[m];
- let y, M;
- switch (typeof j) {
- case "number":
- for (y = j; y > 0; )
- M = fe(y, "d"), Z(M), typeof M != "object" && (y -= u(M));
- break;
- case "string":
- Z(j);
- break;
- case "object":
- y = t.dlen(j.d);
- let b = 0;
- for (; b < y; )
- switch (M = fe(y - b, "d"), typeof M) {
- case "number":
- Z({ d: c(j.d, b, b + M) }), b += M;
- break;
- case "string":
- b += e.strPosToUni(M);
- break;
- case "object":
- Z(M);
- }
- break;
- }
- }
- let ae;
- for (; ae = fe(-1); )
- Z(ae);
- return h(H);
- }
- const E = (T, A) => {
- let H = 0;
- for (let Z = 0; Z < A.length && T > H; Z++) {
- const fe = A[Z];
- switch (typeof fe) {
- case "number": {
- H += fe;
- break;
- }
- case "string":
- const ae = e.strPosToUni(fe);
- H += ae, T += ae;
- break;
- case "object":
- T -= Math.min(t.dlen(fe.d), T - H);
- break;
- }
- }
- return T;
- }, R = (T, A) => typeof T == "number" ? E(T, A) : T.map((H) => E(H, A));
- function O(T, A, H) {
- return s(T, (Z, fe) => typeof Z == "object" && typeof Z.d == "number" ? { d: H.slice(A, fe, fe + Z.d) } : Z);
- }
- function U(T) {
- return s(T, (A) => {
- switch (typeof A) {
- case "object":
- if (typeof A.d == "number")
- throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");
- return A.d;
- case "string":
- return { d: A };
- case "number":
- return A;
- }
- });
- }
- function ne(T) {
- return s(T, (A) => typeof A == "object" && typeof A.d == "string" ? { d: e.strPosToUni(A.d) } : A);
- }
- function X(T) {
- let A = true;
- return r(T, (H) => {
- typeof H == "object" && typeof H.d == "number" && (A = false);
- }), A;
- }
- function de(T) {
- return {
- name: "text-unicode",
- uri: "http://sharejs.org/types/text-unicode",
- trim: h,
- normalize: o,
- checkOp: n,
- /** Create a new text snapshot.
- *
- * @param {string} initial - initial snapshot data. Optional. Defaults to ''.
- * @returns {Snap} Initial document snapshot object
- */
- create(A = "") {
- if (typeof A != "string")
- throw Error("Initial data must be a string");
- return T.create(A);
- },
- /** Apply an operation to a document snapshot
- */
- apply(A, H) {
- n(H);
- const Z = T.builder(A);
- for (let fe = 0; fe < H.length; fe++) {
- const ae = H[fe];
- switch (typeof ae) {
- case "number":
- Z.skip(ae);
- break;
- case "string":
- Z.append(ae);
- break;
- case "object":
- Z.del(t.dlen(ae.d));
- break;
- }
- }
- return Z.build();
- },
- transform: d,
- compose: f,
- transformPosition: E,
- transformSelection: R,
- isInvertible: X,
- makeInvertible(A, H) {
- return O(A, H, T);
- },
- stripInvertible: ne,
- invert: U,
- invertWithDoc(A, H) {
- return U(O(A, H, T));
- },
- isNoop: (A) => A.length === 0
- };
- }
- t.default = de;
- }(Ms)), Ms;
- }
- var wr = {};
- var ia;
- function Rm() {
- if (ia)
- return wr;
- ia = 1, Object.defineProperty(wr, "__esModule", { value: true });
- const t = Zs(), e = Pi();
- function n(r, s) {
- return {
- // Returns the text content of the document
- get: r,
- // Returns the number of characters in the string
- getLength() {
- return r().length;
- },
- // Insert the specified text at the given position in the document
- insert(i, o, a) {
- const u = e.strPosToUni(r(), i);
- return s([u, o], a);
- },
- remove(i, o, a) {
- const u = e.strPosToUni(r(), i);
- return s([u, { d: o }], a);
- },
- // When you use this API, you should implement these two methods
- // in your editing context.
- //onInsert: function(pos, text) {},
- //onRemove: function(pos, removedLength) {},
- _onOp(i) {
- t.eachOp(i, (o, a, u) => {
- switch (typeof o) {
- case "string":
- this.onInsert && this.onInsert(u, o);
- break;
- case "object":
- const c = t.dlen(o.d);
- this.onRemove && this.onRemove(u, c);
- }
- });
- },
- onInsert: null,
- onRemove: null
- };
- }
- return wr.default = n, n.provides = { text: true }, wr;
- }
- var oa;
- function Im() {
- return oa || (oa = 1, function(t) {
- var e = an.__createBinding || (Object.create ? function(d, f, E, R) {
- R === void 0 && (R = E), Object.defineProperty(d, R, { enumerable: true, get: function() {
- return f[E];
- } });
- } : function(d, f, E, R) {
- R === void 0 && (R = E), d[R] = f[E];
- }), n = an.__setModuleDefault || (Object.create ? function(d, f) {
- Object.defineProperty(d, "default", { enumerable: true, value: f });
- } : function(d, f) {
- d.default = f;
- }), r = an.__importStar || function(d) {
- if (d && d.__esModule)
- return d;
- var f = {};
- if (d != null)
- for (var E in d)
- Object.hasOwnProperty.call(d, E) && e(f, d, E);
- return n(f, d), f;
- }, s = an.__importDefault || function(d) {
- return d && d.__esModule ? d : { default: d };
- };
- Object.defineProperty(t, "__esModule", { value: true }), t.type = t.remove = t.insert = void 0;
- const i = Pi(), o = r(Zs()), a = s(Rm()), u = {
- create(d) {
- return d;
- },
- toString(d) {
- return d;
- },
- builder(d) {
- if (typeof d != "string")
- throw Error("Invalid document snapshot: " + d);
- const f = [];
- return {
- skip(E) {
- let R = i.uniToStrPos(d, E);
- if (R > d.length)
- throw Error("The op is too long for this document");
- f.push(d.slice(0, R)), d = d.slice(R);
- },
- append(E) {
- f.push(E);
- },
- del(E) {
- d = d.slice(i.uniToStrPos(d, E));
- },
- build() {
- return f.join("") + d;
- }
- };
- },
- slice: o.uniSlice
- }, c = o.default(u), l = Object.assign(Object.assign({}, c), { api: a.default });
- 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 }];
- var h = Zs();
- Object.defineProperty(t, "makeType", { enumerable: true, get: function() {
- return h.default;
- } });
- }(an)), an;
- }
- var aa;
- function vm() {
- return aa || (aa = 1, function(t) {
- var e = Ir.__importDefault || function(v) {
- return v && v.__esModule ? v : {
- default: v
- };
- };
- Object.defineProperty(t, "__esModule", {
- value: true
- }), t.editOp = t.replaceOp = t.insertOp = t.moveOp = t.removeOp = t.type = void 0;
- const n = e(Em()), r = e(Cm()), s = $u(), i = Bu();
- function o(v, F) {
- if (!v)
- throw new Error(F);
- }
- t.type = {
- name: "json1",
- uri: "http://sharejs.org/types/JSONv1",
- readCursor: s.readCursor,
- writeCursor: s.writeCursor,
- create: (v) => v,
- isNoop: (v) => v == null,
- setDebug(v) {
- },
- registerSubtype: U,
- checkValidOp: fe,
- normalize: ae,
- apply: m,
- transformPosition: j,
- compose: y,
- tryTransform: Y,
- transform: he,
- makeInvertible: w,
- invert: M,
- invertWithDoc: k,
- RM_UNEXPECTED_CONTENT: i.ConflictType.RM_UNEXPECTED_CONTENT,
- DROP_COLLISION: i.ConflictType.DROP_COLLISION,
- BLACKHOLE: i.ConflictType.BLACKHOLE,
- transformNoConflict: (v, F, V) => be(() => true, v, F, V),
- typeAllowingConflictsPred: (v) => Object.assign(Object.assign({}, t.type), {
- transform: (F, V, K) => be(v, F, V, K)
- })
- };
- const a = (v) => v ? v.getComponent() : null;
- function u(v) {
- return v && typeof v == "object" && !Array.isArray(v);
- }
- 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);
- function d(v, F) {
- 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;
- }
- function f(v, F, V) {
- 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;
- }
- 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) => {
- K.write("r", F), K.write("i", V);
- }).get(), t.editOp = (v, F, V, K = false) => s.writeCursor().at(v, (z) => A(z, F, V, K)).get();
- 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 = {};
- function U(v) {
- let F = v.type ? v.type : v;
- F.name && (O[F.name] = F), F.uri && (O[F.uri] = F);
- }
- const ne = (v) => {
- const F = O[v];
- if (F)
- return F;
- throw Error("Missing type: " + v);
- };
- U(Im());
- const X = (v, F) => v + F;
- U({
- name: "number",
- apply: X,
- compose: X,
- invert: (v) => -v,
- transform: (v) => v
- });
- 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) => {
- const [z, W] = typeof F == "string" ? [ne(F), F] : [F, F.name];
- !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)));
- };
- function H(v) {
- o(typeof v == "number"), o(v >= 0), o(v === (0 | v));
- }
- function Z(v) {
- typeof v == "number" ? H(v) : o(typeof v == "string");
- }
- function fe(v) {
- if (v === null)
- return;
- const F = /* @__PURE__ */ new Set(), V = /* @__PURE__ */ new Set(), K = (W) => {
- let ue = true, oe = false;
- for (let B in W) {
- const ee = W[B];
- 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")
- H(ee), o(!F.has(ee)), F.add(ee), o(W.r === void 0);
- else if (B === "d")
- H(ee), o(!V.has(ee)), V.add(ee), o(W.i === void 0);
- else if (B === "e" || B === "es" || B === "ena") {
- o(!oe), oe = true;
- const ie = de(W);
- o(ie, "Missing type in edit"), ie.checkValidOp && ie.checkValidOp(T(W));
- }
- }
- o(!ue);
- }, z = (W, ue, oe) => {
- if (!Array.isArray(W))
- throw Error("Op must be null or a list");
- if (W.length === 0)
- throw Error("Empty descent");
- ue || Z(W[0]);
- let B = 1, ee = 0, ie = 0;
- for (let pe = 0; pe < W.length; pe++) {
- const Oe = W[pe];
- if (o(Oe != null), Array.isArray(Oe)) {
- const Me = z(Oe, false);
- if (ee) {
- const G = typeof ie, Re = typeof Me;
- G === Re ? o(ie < Me, "descent keys are not in order") : o(G === "number" && Re === "string");
- }
- ie = Me, ee++, B = 3;
- } else
- 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);
- }
- return o(ee !== 1, "Operation makes multiple descents. Remove some []"), o(B === 2 || B === 3), W[0];
- };
- z(v, true), o(F.size === V.size, "Mismatched picks and drops in op");
- for (let W = 0; W < F.size; W++)
- o(F.has(W)), o(V.has(W));
- }
- function ae(v) {
- let F = 0, V = [];
- const K = s.writeCursor();
- return K.mergeTree(v, (z, W) => {
- const ue = de(z);
- if (ue) {
- const B = T(z);
- A(W, ue, ue.normalize ? ue.normalize(B) : B);
- }
- for (const B of ["r", "p", "i", "d"])
- if (z[B] !== void 0) {
- const ee = B === "p" || B === "d" ? (oe = z[B], V[oe] == null && (V[oe] = F++), V[oe]) : z[B];
- W.write(B, ee);
- }
- var oe;
- }), K.get();
- }
- function m(v, F) {
- if (fe(F), F === null)
- return v;
- const V = [];
- return function K(z, W) {
- let ue = z, oe = 0, B = {
- root: z
- }, ee = 0, ie = B, pe = "root";
- function Oe() {
- for (; ee < oe; ee++) {
- let Me = W[ee];
- typeof Me != "object" && (o(E(ie, pe)), ie = ie[pe] = c(ie[pe]), pe = Me);
- }
- }
- for (; oe < W.length; oe++) {
- const Me = W[oe];
- if (Array.isArray(Me)) {
- const G = K(ue, Me);
- G !== ue && G !== void 0 && (Oe(), ue = ie[pe] = G);
- } else if (typeof Me == "object") {
- Me.d != null ? (Oe(), ue = f(ie, pe, V[Me.d])) : Me.i !== void 0 && (Oe(), ue = f(ie, pe, Me.i));
- const G = de(Me);
- if (G)
- Oe(), ue = ie[pe] = G.apply(ue, T(Me));
- else if (Me.e !== void 0)
- throw Error("Subtype " + Me.et + " undefined");
- } else
- ue = R(ue, Me);
- }
- return B.root;
- }(v = function K(z, W) {
- const ue = [];
- let oe = 0;
- for (; oe < W.length; oe++) {
- const pe = W[oe];
- if (Array.isArray(pe))
- break;
- typeof pe != "object" && (ue.push(z), z = R(z, pe));
- }
- for (let pe = W.length - 1; pe >= oe; pe--)
- z = K(z, W[pe]);
- for (--oe; oe >= 0; oe--) {
- const pe = W[oe];
- if (typeof pe != "object") {
- const Oe = ue.pop();
- z = z === R(Oe, pe) ? Oe : z === void 0 ? d(Oe, pe) : (ee = pe, ie = z, (B = c(B = Oe))[ee] = ie, B);
- } else
- l(pe) && (o(z !== void 0, "Cannot pick up or remove undefined"), pe.p != null && (V[pe.p] = z), z = void 0);
- }
- var B, ee, ie;
- return z;
- }(v, F), F);
- }
- function j(v, F) {
- v = v.slice(), fe(F);
- const V = s.readCursor(F);
- let K, z, W = false;
- const ue = [];
- for (let B = 0; ; B++) {
- const ee = v[B], ie = V.getComponent();
- if (ie && (ie.r !== void 0 ? W = true : ie.p != null && (W = false, K = ie.p, z = B)), B >= v.length)
- break;
- let pe = 0;
- const Oe = s.advancer(V, void 0, (G, Re) => {
- l(Re) && pe++;
- });
- ue.unshift(Oe);
- const Me = Oe(ee);
- if (typeof ee == "number" && (v[B] -= pe), !Me)
- break;
- }
- if (ue.forEach((B) => B.end()), W)
- return null;
- const oe = () => {
- let B = 0;
- if (K != null) {
- const ee = V.getPath();
- B = ee.length, v = ee.concat(v.slice(z));
- }
- for (; B < v.length; B++) {
- const ee = v[B], ie = a(V), pe = de(ie);
- if (pe) {
- const G = T(ie);
- pe.transformPosition && (v[B] = pe.transformPosition(v[B], G));
- break;
- }
- let Oe = 0;
- const Me = s.advancer(V, (G, Re) => h(Re) ? ~(G - Oe) : G - Oe, (G, Re) => {
- h(Re) && Oe++;
- })(ee);
- if (typeof ee == "number" && (v[B] += Oe), !Me)
- break;
- }
- };
- return K != null ? V.eachDrop(null, (B) => {
- B === K && oe();
- }) : oe(), v;
- }
- function y(v, F) {
- if (fe(v), fe(F), v == null)
- return F;
- if (F == null)
- return v;
- let V = 0;
- const K = s.readCursor(v), z = s.readCursor(F), W = s.writeCursor(), ue = [], oe = [], B = [], ee = [], ie = [], pe = [], Oe = /* @__PURE__ */ new Set();
- K.traverse(null, (G) => {
- G.p != null && (B[G.p] = K.clone());
- }), z.traverse(null, (G) => {
- G.d != null && (ee[G.d] = z.clone());
- });
- const Me = s.writeCursor();
- return function G(Re, He, Be, xe, Je, Rt, We, et) {
- o(He || Be);
- 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;
- if (ht != null)
- xe = ee[ht], We = oe[ht] = new s.WriteCursor();
- else if (ct && ct.r !== void 0)
- xe = null;
- else {
- const D = a(xe);
- D && D.d != null && (xe = null);
- }
- const g = a(xe);
- if (ke != null)
- if (Re = B[ke], et = ue[ke] = new s.WriteCursor(), _)
- Rt && !it && et.write("r", true);
- else {
- const D = ie[ke] = V++;
- We.write("d", D);
- }
- else if (ze && ze.i !== void 0)
- Re = null;
- else {
- const D = a(Re);
- D && D.p != null && (Re = null);
- }
- let p;
- xt ? (o(Je === void 0), p = ze.i) : p = Je;
- const S = (ht == null ? !xt || Rt || it : p === void 0) ? null : We.getComponent();
- if (ht != null) {
- if (!(Je !== void 0 || xt)) {
- const D = ke != null ? ie[ke] : V++;
- pe[ht] = D, et.write("p", D);
- }
- } else
- it && (xt || Je !== void 0 || (ct.r, et.write("r", ct.r)));
- const N = _ ? null : de(ze), L = de(g);
- if ((N || L) && (N && N.name, L && L.name), N && L) {
- o(N === L);
- const D = T(ze), q = T(g), Ce = N.compose(D, q);
- A(We, N, Ce), Oe.add(g);
- } else
- N ? A(We, N, T(ze)) : L && (A(We, L, T(g)), Oe.add(g));
- const x = typeof p == "object" && p != null;
- let P = false, I = 0, Q = 0, _e = 0, J = 0, me = 0;
- const ye = s.advancer(xe, (D, q) => h(q) ? J - D - 1 : D - J, (D, q) => {
- h(q) && J++;
- }), le = s.advancer(Re, (D, q) => l(q) ? I - D - 1 : D - I, (D, q) => {
- l(q) && I++;
- });
- if (s.eachChildOf(He, Be, (D, q, Ce) => {
- let Se, Le, Ue = D, je = D, dt = D;
- if (typeof D == "number") {
- let Ne = D + _e;
- Le = ye(Ne), je = Ne + J;
- let te = D + Q;
- 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");
- const ut = h(a(q)), $e = l(a(Ce));
- (ut || $e && !_) && me--, ut && Q--, $e && _e--;
- } else
- Se = le(D), Le = ye(D);
- et.descend(Ue), We.descend(je);
- const pt = x && !h(a(q)) ? p[dt] : void 0, Ee = G(Se, q, Ce, Le, pt, _, We, et);
- var qe, ve, Ie;
- 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();
- }), le.end(), ye.end(), S != null)
- S.i = p;
- else if (!Rt && !it && ht == null)
- return p;
- }(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) => {
- const He = G.p;
- if (He != null) {
- const Be = ie[He];
- Be != null && Re.write("p", Be);
- const xe = ue[He];
- xe && xe.get(), xe && Re.mergeTree(xe.get());
- } else
- G.r !== void 0 && Re.write("r", G.r);
- }), W.reset(), W.get(), z.traverse(W, (G, Re) => {
- const He = G.d;
- if (He != null) {
- const xe = pe[He];
- xe != null && Re.write("d", xe);
- const Je = oe[He];
- Je && Re.mergeTree(Je.get());
- } else
- G.i !== void 0 && Re.write("i", G.i);
- const Be = de(G);
- Be && !Oe.has(G) && A(Re, Be, T(G));
- }), W.get();
- }
- function M(v) {
- if (v == null)
- return null;
- const F = new s.ReadCursor(v), V = new s.WriteCursor();
- let K;
- const z = [], W = [];
- return function ue(oe, B, ee) {
- const ie = oe.getComponent();
- let pe, Oe = false;
- if (ie) {
- 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);
- const G = de(ie);
- G && (ee === void 0 ? (K || (K = /* @__PURE__ */ new Set()), K.add(ie)) : (T(ie), ee = G.apply(ee, T(ie)), Oe = true));
- }
- let Me = 0;
- for (const G of oe) {
- B.descend(G);
- const Re = typeof G == "number" ? G - Me : G, He = R(ee, Re);
- h(oe.getComponent()) && Me++;
- const Be = ue(oe, B, He);
- if (ee !== void 0 && Be !== void 0) {
- if (Oe || (Oe = true, ee = c(ee)), !E(ee, Re))
- throw Error("Cannot modify child - invalid operation");
- ee[Re] = Be;
- }
- B.ascend();
- }
- if (pe === void 0)
- return Oe ? ee : void 0;
- B.write("r", ee);
- }(F, V, void 0), K && (V.reset(), function ue(oe, B, ee) {
- const ie = B.getComponent();
- if (ie) {
- const G = ie.d;
- if (G != null && (oe = z[G], ee = W[G] = s.writeCursor()), K.has(ie)) {
- const Re = de(ie);
- if (!Re.invert)
- throw Error(`Cannot invert subtype ${Re.name}`);
- A(ee, Re, Re.invert(T(ie)));
- }
- }
- let pe = 0, Oe = 0;
- const Me = s.advancer(oe, (G, Re) => l(Re) ? pe - G - 1 : G - pe, (G, Re) => {
- l(Re) && pe++;
- });
- for (const G of B)
- if (typeof G == "number") {
- const Re = G - Oe, He = Me(Re), Be = Re + pe;
- ee.descend(Be), ue(He, B, ee), h(B.getComponent()) && Oe++, ee.ascend();
- } else
- ee.descend(G), ue(Me(G), B, ee), ee.ascend();
- Me.end();
- }(F.clone(), F, V), W.length && (V.reset(), F.traverse(V, (ue, oe) => {
- const B = ue.p;
- if (B != null) {
- const ee = W[B];
- ee && ee.get(), ee && oe.mergeTree(ee.get());
- }
- }))), V.get();
- }
- const b = (v, F) => v.some((V) => typeof V == "object" && (Array.isArray(V) ? b(V, F) : F(V)));
- function w(v, F) {
- if (v == null || !b(v, (B) => {
- var ee;
- return B.r !== void 0 || ((ee = de(B)) === null || ee === void 0 ? void 0 : ee.makeInvertible) != null;
- }))
- return v;
- const V = new s.ReadCursor(v), K = new s.WriteCursor();
- let z = false;
- const W = [], ue = [], oe = (B, ee, ie) => {
- const pe = B.getComponent();
- let Oe = false;
- if (pe) {
- pe.d != null && ee.write("d", pe.d), pe.i !== void 0 && ee.write("i", pe.i);
- const G = pe.p;
- 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)
- throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");
- const Re = de(pe);
- Re && (Re.makeInvertible ? z = true : A(ee, Re, T(pe), true));
- }
- let Me = 0;
- for (const G of B) {
- ee.descend(G);
- const Re = typeof G == "number" ? G - Me : G, He = R(ie, Re), Be = oe(B, ee, He);
- He !== Be && (Oe || (Oe = true, ie = c(ie)), Be === void 0 ? (ie = d(ie, Re), typeof G == "number" && Me++) : ie[Re] = Be), ee.ascend();
- }
- return pe && (pe.r !== void 0 ? (ee.write("r", r.default(ie)), ie = void 0) : pe.p != null && (ie = void 0)), ie;
- };
- return oe(V, K, F), K.get(), z && (K.reset(), function B(ee, ie, pe, Oe, Me) {
- const G = ie.getComponent();
- if (G) {
- G.i !== void 0 ? (Oe = G.i, Me = true) : G.d != null && (Oe = ue[G.d], ee = W[G.d], Me = false, G.d);
- let xe = de(G);
- if (xe && xe.makeInvertible) {
- const Je = T(G);
- A(pe, xe, xe.makeInvertible(Je, Oe), true);
- }
- }
- let Re = 0, He = 0;
- const Be = s.advancer(ee, (xe, Je) => l(Je) ? Re - xe - 1 : xe - Re, (xe, Je) => {
- l(Je) && Re++;
- });
- for (const xe of ie)
- if (typeof xe == "number") {
- const Je = xe - He, Rt = Be(Je), We = Je + Re, et = R(Oe, Me ? Je : We);
- pe.descend(xe), B(Rt, ie, pe, et, Me), h(ie.getComponent()) && He++, pe.ascend();
- } else {
- const Je = R(Oe, xe);
- pe.descend(xe), B(Be(xe), ie, pe, Je, Me), pe.ascend();
- }
- Be.end();
- }(V.clone(), V, K, F, false)), K.get();
- }
- function k(v, F) {
- return M(w(v, F));
- }
- const $ = (v) => {
- if (v == null)
- return null;
- const F = v.slice();
- for (let V = 0; V < v.length; V++) {
- const K = F[V];
- Array.isArray(K) && (F[V] = $(K));
- }
- return F;
- };
- function Y(v, F, V) {
- o(V === "left" || V === "right", "Direction must be left or right");
- const K = V === "left" ? 0 : 1;
- if (F == null)
- return {
- ok: true,
- result: v
- };
- fe(v), fe(F);
- let z = null;
- const W = [], ue = [], oe = [], B = [], ee = [], ie = [], pe = [], Oe = [], Me = [], G = [], Re = [], He = [], Be = [], xe = [], Je = [];
- let Rt = 0;
- const We = s.readCursor(v), et = s.readCursor(F), ze = s.writeCursor();
- if (function g(p, S = null, N) {
- const L = a(S);
- L && (L.r !== void 0 ? N = S.clone() : L.p != null && (N = null, ie[L.p] = p.clone()));
- const x = p.getComponent();
- let P;
- 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));
- const I = s.advancer(S);
- for (const Q of p)
- g(p, I(Q), N);
- I.end();
- }(et, We, null), function g(p, S, N, L, x) {
- const P = N.getComponent();
- let I, Q = false;
- 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 = {
- type: i.ConflictType.RM_UNEXPECTED_CONTENT,
- op1: t.removeOp(x.getPath()),
- op2: t.moveOp(S.getPath(), N.getPath())
- }), Q = true) : P.i !== void 0 && (p = S = null, Q = true, x && z == null && (z = {
- type: i.ConflictType.RM_UNEXPECTED_CONTENT,
- op1: t.removeOp(x.getPath()),
- op2: t.insertOp(N.getPath(), P.i)
- })));
- const _e = a(p);
- _e && (_e.r !== void 0 ? x = p.clone() : _e.p != null && (_e.p, L = _e.p, x = null));
- const J = de(P);
- J && x && z == null && (z = {
- type: i.ConflictType.RM_UNEXPECTED_CONTENT,
- op1: t.removeOp(x.getPath()),
- op2: t.editOp(N.getPath(), J, T(P), true)
- });
- let me = 0, ye = 0;
- const le = s.advancer(S, (q, Ce) => l(Ce) ? me - q - 1 : q - me, (q, Ce) => {
- l(Ce) && me++;
- }), D = s.advancer(p);
- for (const q of N)
- if (typeof q == "number") {
- const Ce = q - ye, Se = le(Ce);
- ye += +g(D(Ce + me), Se, N, L, x);
- } else {
- const Ce = le(q);
- g(D(q), Ce, N, L, x);
- }
- return le.end(), D.end(), Q;
- }(We, et, et.clone(), null, null), B.map((g) => g && g.get()), z)
- return {
- ok: false,
- conflict: z
- };
- Re.map((g) => !!g);
- const ct = [];
- let it = null;
- (function g(p, S, N, L, x) {
- let P = false;
- const I = a(S);
- if (l(I)) {
- const le = I.p;
- le != null ? (N = B[le], L = He[le] = s.writeCursor(), P = true, x = null) : (N = null, x = S.clone());
- } else
- h(a(N)) && (N = null);
- const Q = p.getComponent();
- if (Q) {
- const le = Q.p;
- 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)));
- }
- let _e = 0, J = 0;
- const me = s.advancer(S, void 0, (le, D) => {
- l(D) && _e++;
- }), ye = s.advancer(N, (le, D) => h(D) ? ~(le - J) : le - J, (le, D) => {
- h(D) && J++;
- });
- if (p)
- for (const le of p)
- if (typeof le == "string") {
- const D = me(le), q = ye(le);
- L.descend(le), g(p, D, q, L, x), L.ascend();
- } else {
- const D = me(le), q = le - _e, Ce = l(a(D)) ? null : ye(q), Se = q + J;
- o(Se >= 0), L.descend(Se), g(p, D, Ce, L, x), L.ascend();
- }
- me.end(), ye.end();
- })(We, et, et.clone(), ze, null), ze.reset();
- let xt = [];
- if (function g(p, S, N, L, x, P) {
- o(S);
- const I = S.getComponent();
- let Q = a(L), _e = false;
- const J = (ve, Ie, Ne) => ve ? t.moveOp(ve.getPath(), Ie.getPath()) : t.insertOp(Ie.getPath(), Ne.i);
- if (h(I)) {
- const ve = I.d;
- ve != null && (ue[ve] = S.clone());
- const Ie = ve != null ? ct[ve] : null;
- let Ne = false;
- if (I.i !== void 0 || ve != null && Ie) {
- let te;
- 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 = {
- type: i.ConflictType.DROP_COLLISION,
- op1: J(ve != null ? W[ve] : null, S, I),
- op2: J(te != null ? oe[te] : null, L, Q)
- })), Ne || (P ? z == null && (z = {
- type: i.ConflictType.RM_UNEXPECTED_CONTENT,
- op1: J(ve != null ? W[ve] : null, S, I),
- op2: t.removeOp(P.getPath())
- }) : (ve != null ? (xt[Rt] = ve, x.write("d", Ie.p = Rt++)) : x.write("i", r.default(I.i)), _e = true));
- } else if (ve != null && !Ie) {
- const te = Oe[ve];
- te && (P = te.clone());
- }
- ve != null ? (p = W[ve], N = ie[ve], L = pe[ve]) : I.i !== void 0 && (p = N = null, Ne || (L = null));
- } else
- l(a(p)) && (p = N = L = null);
- const me = a(p), ye = a(N);
- if (l(ye)) {
- const ve = ye.p;
- 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));
- } else
- !h(I) && h(Q) && (L = null);
- Q = L != null ? L.getComponent() : null;
- const le = de(I);
- if (le) {
- const ve = T(I);
- if (P)
- z == null && (z = {
- type: i.ConflictType.RM_UNEXPECTED_CONTENT,
- op1: t.editOp(S.getPath(), le, ve, true),
- op2: t.removeOp(P.getPath())
- });
- else {
- const Ie = de(Q);
- let Ne;
- if (Ie) {
- if (le !== Ie)
- throw Error("Transforming incompatible types");
- const te = T(Q);
- Ne = le.transform(ve, te, V);
- } else
- Ne = r.default(ve);
- A(x, le, Ne);
- }
- }
- let D = 0, q = 0, Ce = 0, Se = 0, Le = 0, Ue = 0, je = p != null && p.descendFirst(), dt = je;
- const pt = s.advancer(N, void 0, (ve, Ie) => {
- l(Ie) && Ce++;
- });
- let Ee = L != null && L.descendFirst(), qe = Ee;
- for (const ve of S)
- if (typeof ve == "number") {
- let Ie;
- const Ne = h(S.getComponent()), te = ve - q;
- {
- let zt;
- for (; je && typeof (zt = p.getKey()) == "number"; ) {
- zt += D;
- const bt = p.getComponent(), Cn = l(bt);
- if (zt > te || zt === te && (!Cn || K === 0 && Ne))
- break;
- if (Cn) {
- D--;
- const sn = bt.p;
- 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--;
- }
- je = p.nextSibling();
- }
- Ie = je && zt === te ? p : null;
- }
- const ut = te - D;
- let $e = pt(ut);
- const At = ut - Ce;
- let dr = null;
- {
- let zt, bt;
- for (; Ee && typeof (zt = L.getKey()) == "number"; ) {
- bt = zt - Se;
- const Cn = L.getComponent(), sn = h(Cn);
- if (bt > At)
- break;
- if (bt === At) {
- if (!sn) {
- dr = L;
- break;
- }
- {
- if (K === 0 && Ne) {
- dr = L;
- break;
- }
- const Yt = $e && l($e.getComponent());
- if (K === 0 && Yt)
- break;
- }
- }
- if (sn) {
- const Yt = Cn.d;
- 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++;
- }
- Ee = L.nextSibling();
- }
- }
- const Hi = At + Se + Le + Ue;
- 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();
- } else {
- let Ie;
- for (; je && (Ie = p.getKey(), typeof Ie != "string" || !(Ie > ve || Ie === ve)); )
- je = p.nextSibling();
- const Ne = je && Ie === ve ? p : null, te = pt(ve);
- let ut;
- for (; Ee && (ut = L.getKey(), typeof ut != "string" || !(ut > ve || ut === ve)); )
- Ee = L.nextSibling();
- const $e = Ee && ut === ve ? L : null;
- x.descend(ve), g(Ne, S, te, $e, x, P), x.ascend();
- }
- return pt.end(), dt && p.ascend(), qe && L.ascend(), _e;
- }(We, We.clone(), et, et.clone(), ze, null), z)
- return {
- ok: false,
- conflict: z
- };
- ze.reset();
- const ke = (g, p, S) => g.traverse(p, (N, L) => {
- N.d != null && S(N.d, g, L);
- });
- (G.length || He.length) && (ke(et, ze, (g, p, S) => {
- G[g] && !Re[g] && S.write("r", true), He[g] && S.mergeTree(He[g].get());
- }), ze.reset());
- const ht = [], _ = [];
- if ((Be.length || G.length) && !z) {
- const g = s.readCursor($(ze.get()));
- if (ke(g, null, (p, S) => {
- ht[p] = S.clone();
- }), Be.forEach((p) => {
- p && ke(s.readCursor(p.get()), null, (S, N) => {
- ht[S] = N.clone();
- });
- }), function p(S, N, L, x, P, I) {
- const Q = a(N);
- if (Q && l(Q))
- if (Q.p != null) {
- const D = Q.p;
- ht[D].getPath(), L = ht[D], x = _[D] = s.writeCursor();
- } else
- Q.r !== void 0 && (L = null);
- else
- h(a(L)) && (L = null);
- const _e = S.getComponent();
- if (_e) {
- let D;
- if ((D = _e.d) != null) {
- const q = Be[D];
- q && (q.get(), x.mergeTree(q.get()), L = s.readCursor(q.get()));
- }
- }
- let J = 0, me = 0;
- const ye = s.advancer(N, void 0, (D, q) => {
- l(q) && J--;
- }), le = s.advancer(L, (D, q) => h(q) ? -(D - me) - 1 : D - me, (D, q) => {
- h(q) && me++;
- });
- for (const D of S)
- if (typeof D == "number") {
- const q = ye(D), Ce = D + J, Se = le(Ce), Le = Ce + me;
- x.descend(Le), p(S, q, Se, x), x.ascend();
- } else
- x.descend(D), p(S, ye(D), le(D), x), x.ascend();
- ye.end(), le.end();
- }(et, g, g.clone(), ze), ze.reset(), z)
- return {
- ok: false,
- conflict: z
- };
- if (ze.get(), _.length) {
- const p = _.map((N) => N ? N.get() : null), S = s.readCursor($(ze.get()));
- if (ke(S, ze, (N, L, x) => {
- const P = p[N];
- P && (x.mergeTree(P), p[N] = null);
- }), p.find((N) => N)) {
- const N = s.writeCursor(), L = s.writeCursor();
- let x = 0, P = 0;
- p.forEach((I) => {
- I != null && ke(s.readCursor(I), null, (Q) => {
- const _e = xt[Q];
- N.writeMove(W[_e].getPath(), ue[_e].getPath(), x++);
- const J = Je[_e];
- J && J.forEach((me) => {
- G[me] || K !== 1 && xe[me] != null || L.writeMove(oe[me].getPath(), B[me].getPath(), P++);
- });
- });
- }), z = {
- type: i.ConflictType.BLACKHOLE,
- op1: N.get(),
- op2: L.get()
- };
- }
- }
- }
- return z ? {
- ok: false,
- conflict: z
- } : {
- ok: true,
- result: ze.get()
- };
- }
- const se = (v) => {
- const F = new Error("Transform detected write conflict");
- throw F.conflict = v, F.type = F.name = "writeConflict", F;
- };
- function he(v, F, V) {
- const K = Y(v, F, V);
- if (K.ok)
- return K.result;
- se(K.conflict);
- }
- const ge = (v) => {
- const F = s.writeCursor();
- return s.readCursor(v).traverse(F, (V, K) => {
- (h(V) || de(V)) && K.write("r", true);
- }), F.get();
- }, Ae = (v, F) => {
- const { type: V, op1: K, op2: z } = v;
- switch (V) {
- case i.ConflictType.DROP_COLLISION:
- return F === "left" ? [null, ge(z)] : [ge(K), null];
- case i.ConflictType.RM_UNEXPECTED_CONTENT:
- let W = false;
- return s.readCursor(K).traverse(null, (ue) => {
- ue.r !== void 0 && (W = true);
- }), W ? [null, ge(z)] : [ge(K), null];
- case i.ConflictType.BLACKHOLE:
- return [ge(K), ge(z)];
- default:
- throw Error("Unrecognised conflict: " + V);
- }
- };
- function be(v, F, V, K) {
- let z = null;
- for (; ; ) {
- const W = Y(F, V, K);
- if (W.ok)
- return y(z, W.result);
- {
- const { conflict: ue } = W;
- v(ue) || se(ue);
- const [oe, B] = Ae(ue, K);
- F = y(ae(F), oe), V = y(ae(V), B), z = y(z, B);
- }
- }
- }
- }(Ir)), Ir;
- }
- var ua;
- function ym() {
- return ua || (ua = 1, function(t) {
- var e = $n.__createBinding || (Object.create ? function(i, o, a, u) {
- u === void 0 && (u = a), Object.defineProperty(i, u, { enumerable: true, get: function() {
- return o[a];
- } });
- } : function(i, o, a, u) {
- u === void 0 && (u = a), i[u] = o[a];
- }), n = $n.__exportStar || function(i, o) {
- for (var a in i)
- a !== "default" && !o.hasOwnProperty(a) && e(o, i, a);
- };
- Object.defineProperty(t, "__esModule", { value: true }), n(vm(), t);
- var r = $u();
- Object.defineProperty(t, "ReadCursor", { enumerable: true, get: function() {
- return r.ReadCursor;
- } }), Object.defineProperty(t, "WriteCursor", { enumerable: true, get: function() {
- return r.WriteCursor;
- } });
- var s = Bu();
- Object.defineProperty(t, "ConflictType", { enumerable: true, get: function() {
- return s.ConflictType;
- } });
- }($n)), $n;
- }
- var mt = ym();
- var wm = wt(mt);
- var JC = jl({
- __proto__: null,
- default: wm
- }, [mt]);
- var ce = ((t) => (t.RETAIN = "r", t.INSERT = "i", t.DELETE = "d", t))(ce || {});
- function _s(t, e = false) {
- const n = [];
- for (const r of t) {
- const { st: s, ed: i, ts: o } = r;
- if (r.sId === void 0 && delete r.sId, s === i || !e && re.isEmptyObject(o) && r.sId == null)
- continue;
- if (n.length === 0) {
- n.push(r);
- continue;
- }
- const a = n.pop();
- Mg(r, a) && re.hasIntersectionBetweenTwoRanges(a.st, a.ed, r.st, r.ed) ? n.push({
- ...r,
- st: a.st,
- ed: i
- }) : n.push(a, r);
- }
- return n;
- }
- function ju(t, e, n, r) {
- var c;
- const { textRuns: s } = t;
- if (s == null)
- return;
- const i = [], o = s.length;
- let a = false;
- const u = (c = e.textRuns) != null ? c : [];
- if (u.length)
- for (const l of u)
- l.st += r, l.ed += r;
- for (let l = 0; l < o; l++) {
- const h = s[l], { st: d, ed: f } = h;
- if (f <= r)
- i.push(h);
- else if (r > d && r < f) {
- a = true;
- const E = {
- ...h,
- ed: r
- };
- i.push(E), u.length && i.push(...u);
- const R = {
- ...h,
- st: r + n,
- ed: f + n
- };
- i.push(R);
- } else
- h.st += n, h.ed += n, a || (a = true, i.push(...u)), i.push(h);
- }
- a || (a = true, i.push(...u)), t.textRuns = _s(i);
- }
- function Hu(t, e, n, r) {
- const { paragraphs: s } = t;
- if (s == null)
- return;
- const { paragraphs: i } = e, o = [];
- for (let u = 0, c = s.length; u < c; u++) {
- const l = s[u], { startIndex: h } = l;
- h >= r && (l.startIndex += n), o.push(l.startIndex);
- }
- let a = -1;
- if (i) {
- for (let u = 0, c = i.length; u < c; u++) {
- const l = i[u];
- l.startIndex += r;
- const h = l.startIndex;
- a = o.indexOf(h);
- }
- a !== -1 && s.splice(a, 1), s.push(...i), s.sort(ps("startIndex"));
- }
- }
- function Wu(t, e, n, r) {
- const { sectionBreaks: s } = t;
- if (s == null)
- return;
- for (let o = 0, a = s.length; o < a; o++) {
- const u = s[o], { startIndex: c } = u;
- c >= r && (u.startIndex += n);
- }
- const i = e.sectionBreaks;
- if (i) {
- for (let o = 0, a = i.length; o < a; o++) {
- const u = i[o];
- u.startIndex += r;
- }
- s.push(...i), s.sort(ps("startIndex"));
- }
- }
- function zu(t, e, n, r) {
- const { customBlocks: s = [] } = t;
- for (let o = 0, a = s.length; o < a; o++) {
- const u = s[o], { startIndex: c } = u;
- c >= r && (u.startIndex += n);
- }
- const i = e.customBlocks;
- if (i) {
- for (let o = 0, a = i.length; o < a; o++) {
- const u = i[o];
- u.startIndex += r;
- }
- s.push(...i), s.sort(ps("startIndex"));
- }
- s.length && !t.customBlocks && (t.customBlocks = s);
- }
- function Yu(t, e, n, r) {
- const { tables: s } = t;
- if (s == null)
- return;
- for (let o = 0, a = s.length; o < a; o++) {
- const u = s[o], { startIndex: c, endIndex: l } = u;
- c > r ? (u.startIndex += n, u.endIndex += n) : l > r && (u.endIndex += n);
- }
- const i = e.tables;
- if (i) {
- for (let o = 0, a = i.length; o < a; o++) {
- const u = i[o];
- u.startIndex += r, u.endIndex += r;
- }
- s.push(...i), s.sort(ps("startIndex"));
- }
- }
- var Vu = "$";
- var la = (t) => t.split(Vu)[0];
- function ki(t) {
- if (t.length <= 1)
- return t;
- t.sort((s, i) => s.startIndex - i.startIndex);
- const e = [];
- let n = { ...t[0] };
- n.rangeId = la(n.rangeId);
- for (let s = 1; s < t.length; s++) {
- const i = t[s];
- 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 });
- }
- e.push(n);
- const r = /* @__PURE__ */ Object.create(null);
- for (let s = 0, i = e.length; s < i; s++) {
- const o = e[s], a = o.rangeId;
- r[a] ? (o.rangeId = `${a}${Vu}${r[a]}`, r[a] = r[a] + 1) : r[a] = 1;
- }
- return e;
- }
- function Qs(t, e) {
- const n = t.findIndex((s) => s.startIndex < e && s.endIndex >= e), r = t[n];
- r && t.splice(
- n,
- 1,
- {
- rangeId: r.rangeId,
- rangeType: r.rangeType,
- startIndex: r.startIndex,
- endIndex: e - 1,
- properties: { ...r.properties }
- },
- {
- rangeId: r.rangeId,
- rangeType: r.rangeType,
- startIndex: e,
- endIndex: r.endIndex,
- properties: { ...r.properties }
- }
- );
- }
- function Gu(t) {
- if (t.length <= 1)
- return t;
- t.sort((r, s) => r.startIndex - s.startIndex);
- const e = [];
- let n = { ...t[0] };
- for (let r = 1; r < t.length; r++) {
- const s = t[r];
- s.id === n.id && n.endIndex + 1 >= s.startIndex ? n.endIndex = s.endIndex : (e.push(n), n = { ...s });
- }
- return e.push(n), e;
- }
- function qs(t, e) {
- t.filter((r) => r.startIndex < e && r.endIndex >= e).forEach((r) => {
- const s = t.indexOf(r);
- t.splice(
- s,
- 1,
- {
- id: r.id,
- type: r.type,
- startIndex: r.startIndex,
- endIndex: e - 1
- },
- {
- id: r.id,
- type: r.type,
- startIndex: e,
- endIndex: r.endIndex
- }
- );
- });
- }
- function Om(t, e, n, r) {
- t.customRanges || (t.customRanges = []);
- const { customRanges: s } = t;
- Qs(s, r);
- for (let o = 0, a = s.length; o < a; o++) {
- const u = s[o], { startIndex: c } = u;
- c >= r && (u.startIndex += n, u.endIndex += n);
- }
- const i = [];
- if (e.customRanges) {
- for (let o = 0, a = e.customRanges.length; o < a; o++) {
- const u = e.customRanges[o];
- u.startIndex += r, u.endIndex += r, i.push(u);
- }
- s.push(...i);
- }
- t.customRanges = ki(s);
- }
- function bm(t, e, n, r) {
- t.customDecorations || (t.customDecorations = []);
- const { customDecorations: s } = t;
- qs(s, r);
- for (let o = 0, a = s.length; o < a; o++) {
- const u = s[o], { startIndex: c } = u;
- c >= r && (u.startIndex += n, u.endIndex += n);
- }
- const i = [];
- if (e.customDecorations) {
- for (let o = 0, a = e.customDecorations.length; o < a; o++) {
- const u = e.customDecorations[o];
- u.startIndex += r, u.endIndex += r, i.push(u);
- }
- s.push(...i);
- }
- t.customDecorations = Gu(s);
- }
- function Ku(t, e, n) {
- const { textRuns: r } = t, s = n, i = n + e, o = [];
- if (r) {
- const a = [];
- for (let u = 0, c = r.length; u < c; u++) {
- const l = r[u], { st: h, ed: d } = l;
- if (s <= h && i >= d) {
- o.push({
- ...l,
- st: h - s,
- ed: d - s
- });
- continue;
- } else
- h <= s && d >= i ? (o.push({
- ...l,
- st: s - s,
- ed: i - s
- }), l.ed -= e) : s >= h && s < d ? (o.push({
- ...l,
- st: s - s,
- ed: d - s
- }), l.ed = s) : i > h && i <= d ? (o.push({
- ...l,
- st: h - s,
- ed: i - s
- }), l.st = i - e, l.ed -= e) : h >= i && (l.st -= e, l.ed -= e);
- a.push(l);
- }
- t.textRuns = a;
- }
- return o.length === 0 && o.push({
- st: 0,
- ed: e,
- ts: {}
- }), o;
- }
- function Xu(t, e, n) {
- const { paragraphs: r } = t, s = n, i = n + e, o = [];
- if (r) {
- const a = [];
- for (let u = 0, c = r.length; u < c; u++) {
- const l = r[u], { startIndex: h } = l;
- if (h >= s && h < i) {
- o.push({
- ...l,
- startIndex: h - n
- });
- continue;
- } else
- h >= i && (l.startIndex -= e);
- a.push(l);
- }
- t.paragraphs = a;
- }
- return o;
- }
- function Ju(t, e, n) {
- const { sectionBreaks: r } = t, s = n, i = n + e - 1, o = [];
- if (r) {
- const a = [];
- for (let u = 0, c = r.length; u < c; u++) {
- const l = r[u], { startIndex: h } = l;
- if (h >= s && h <= i) {
- o.push({
- ...l,
- startIndex: h - n
- });
- continue;
- } else
- h > i && (l.startIndex -= e);
- a.push(l);
- }
- t.sectionBreaks = a;
- }
- return o;
- }
- function Zu(t, e, n) {
- const { customBlocks: r = [] } = t, s = n, i = n + e - 1, o = [];
- if (r) {
- const a = [];
- for (let u = 0, c = r.length; u < c; u++) {
- const l = r[u], { startIndex: h } = l;
- if (h >= s && h <= i) {
- o.push({
- ...l,
- startIndex: h - n
- });
- continue;
- } else
- h > i && (l.startIndex -= e);
- a.push(l);
- }
- t.customBlocks = a;
- }
- return r.length && !t.customBlocks && (t.customBlocks = r), o;
- }
- function Qu(t, e, n) {
- const { tables: r } = t, s = n, i = n + e - 1, o = [];
- if (r) {
- const a = [];
- for (let u = 0, c = r.length; u < c; u++) {
- const l = r[u], { startIndex: h, endIndex: d } = l;
- if (s <= h && i >= d) {
- o.push({
- ...l,
- startIndex: h - n,
- endIndex: d - n
- });
- continue;
- } else if (h <= s && d >= i) {
- const f = Li(h, d, s, i);
- if (f.length === 0 || (l.startIndex = f[0], l.endIndex = f[1], l.startIndex === l.endIndex))
- continue;
- } else
- i < h && (l.startIndex -= e, l.endIndex -= e);
- a.push(l);
- }
- t.tables = a;
- }
- return o;
- }
- function Sm(t, e, n) {
- const { customRanges: r } = t, s = n, i = n + e - 1, o = [];
- if (r) {
- const a = [];
- for (let u = 0, c = r.length; u < c; u++) {
- const l = r[u], { startIndex: h, endIndex: d } = l;
- if (h >= s && d <= i) {
- o.push(l);
- continue;
- } else if (Math.max(s, h) <= Math.min(i, d)) {
- const f = Li(h, d, s, i);
- if (f.length === 0)
- continue;
- l.startIndex = f[0], l.endIndex = f[1];
- } else
- i < h && (l.startIndex -= e, l.endIndex -= e);
- a.push(l);
- }
- t.customRanges = ki(a);
- }
- return o;
- }
- function Am(t, e, n, r = true) {
- const { customDecorations: s } = t, i = n, o = n + e - 1, a = [];
- if (s) {
- const u = [];
- for (let c = 0, l = s.length; c < l; c++) {
- const h = s[c], { startIndex: d, endIndex: f } = h;
- if (d >= i && f <= o) {
- a.push(h);
- continue;
- } else if (Math.max(i, d) <= Math.min(o, f)) {
- const E = Li(d, f, i, o);
- if (E.length === 0)
- continue;
- h.startIndex = E[0], h.endIndex = E[1];
- } else
- o < d && r && (h.startIndex -= e, h.endIndex -= e);
- u.push(h);
- }
- t.customDecorations = u;
- }
- return a;
- }
- 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 || {});
- 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 || {});
- var Or = {
- "a)": { glyphFormat: "%1)", glyphType: Te.DECIMAL },
- "1.": { glyphFormat: "%1.", glyphType: Te.DECIMAL },
- "a.": { glyphFormat: "%1.", glyphType: Te.LOWER_LETTER },
- "A.": { glyphFormat: "%1.", glyphType: Te.UPPER_LETTER },
- "i.": { glyphFormat: "%1.", glyphType: Te.LOWER_ROMAN },
- "I.": { glyphFormat: "%1.", glyphType: Te.UPPER_LETTER }
- };
- var Rn = (t) => [
- ...t,
- ...t,
- ...t
- ].map((e, n) => ({
- glyphFormat: ` %${n + 1}`,
- glyphSymbol: e,
- bulletAlignment: ms.START,
- textStyle: {
- fs: 12
- },
- startNumber: 0,
- paragraphProperties: {
- hanging: { v: 21 },
- indentStart: { v: 21 * n }
- }
- }));
- var In = (t) => t.map((e, n) => ({
- ...e,
- bulletAlignment: ms.START,
- textStyle: {
- fs: 12
- },
- startNumber: 0,
- paragraphProperties: {
- hanging: { v: 21 },
- indentStart: { v: 21 * n }
- }
- }));
- var ca = (t, e) => new Array(9).fill(0).map((n, r) => ({
- glyphFormat: ` %${r + 1}`,
- glyphSymbol: t,
- bulletAlignment: ms.START,
- textStyle: {
- fs: 16
- },
- startNumber: 0,
- paragraphProperties: {
- hanging: { v: 21 },
- indentStart: { v: 21 * r },
- textStyle: e
- }
- }));
- var Es = {
- BULLET_LIST: {
- listType: "BULLET_LIST",
- nestingLevel: Rn(["●", "○", "■"])
- },
- BULLET_LIST_1: {
- listType: "BULLET_LIST",
- nestingLevel: Rn(["❖", "➢", "■"])
- },
- BULLET_LIST_2: {
- listType: "BULLET_LIST",
- nestingLevel: Rn(["✔", "●", "◆"])
- },
- BULLET_LIST_3: {
- listType: "BULLET_LIST",
- nestingLevel: Rn(["■", "◆", "○"])
- },
- BULLET_LIST_4: {
- listType: "BULLET_LIST",
- nestingLevel: Rn(["✧", "○", "■"])
- },
- BULLET_LIST_5: {
- listType: "BULLET_LIST",
- nestingLevel: Rn(["➢", "○", "◆"])
- },
- ORDER_LIST: {
- listType: "ORDER_LIST",
- nestingLevel: In([
- { glyphFormat: "%1.", glyphType: Te.DECIMAL },
- { glyphFormat: "%2.", glyphType: Te.LOWER_LETTER },
- { glyphFormat: "%3.", glyphType: Te.LOWER_ROMAN },
- { glyphFormat: "%4.", glyphType: Te.DECIMAL },
- { glyphFormat: "%5.", glyphType: Te.LOWER_LETTER },
- { glyphFormat: "%6.", glyphType: Te.LOWER_ROMAN },
- { glyphFormat: "%7.", glyphType: Te.DECIMAL },
- { glyphFormat: "%8.", glyphType: Te.LOWER_LETTER },
- { glyphFormat: "%9.", glyphType: Te.LOWER_ROMAN }
- ])
- },
- ORDER_LIST_1: {
- listType: "ORDER_LIST",
- nestingLevel: In([
- { glyphFormat: "%1)", glyphType: Te.DECIMAL },
- { glyphFormat: "%2)", glyphType: Te.LOWER_LETTER },
- { glyphFormat: "%3)", glyphType: Te.LOWER_ROMAN },
- { glyphFormat: "%4)", glyphType: Te.DECIMAL },
- { glyphFormat: "%5)", glyphType: Te.LOWER_LETTER },
- { glyphFormat: "%6)", glyphType: Te.LOWER_ROMAN },
- { glyphFormat: "%7)", glyphType: Te.DECIMAL },
- { glyphFormat: "%8)", glyphType: Te.LOWER_LETTER },
- { glyphFormat: "%9)", glyphType: Te.LOWER_ROMAN }
- ])
- },
- ORDER_LIST_2: {
- listType: "ORDER_LIST",
- nestingLevel: In([
- "%1.",
- "%1.%2.",
- "%1.%2.%3.",
- "%1.%2.%3.%4.",
- "%1.%2.%3.%4.%5.",
- "%1.%2.%3.%4.%5.%6.",
- "%1.%2.%3.%4.%5.%6.%7."
- ].map((t) => ({ glyphFormat: t, glyphType: Te.DECIMAL })))
- },
- ORDER_LIST_3: {
- listType: "ORDER_LIST",
- nestingLevel: In([
- { glyphFormat: "%1.", glyphType: Te.UPPER_LETTER },
- { glyphFormat: "%2.", glyphType: Te.LOWER_LETTER },
- { glyphFormat: "%3.", glyphType: Te.LOWER_ROMAN },
- { glyphFormat: "%4.", glyphType: Te.UPPER_LETTER },
- { glyphFormat: "%5.", glyphType: Te.LOWER_LETTER },
- { glyphFormat: "%6.", glyphType: Te.LOWER_ROMAN },
- { glyphFormat: "%7.", glyphType: Te.UPPER_LETTER },
- { glyphFormat: "%8.", glyphType: Te.LOWER_LETTER },
- { glyphFormat: "%9.", glyphType: Te.LOWER_ROMAN }
- ])
- },
- ORDER_LIST_4: {
- listType: "ORDER_LIST",
- nestingLevel: In([
- { glyphFormat: "%1.", glyphType: Te.UPPER_LETTER },
- { glyphFormat: "%2.", glyphType: Te.DECIMAL },
- { glyphFormat: "%3.", glyphType: Te.LOWER_ROMAN },
- { glyphFormat: "%4.", glyphType: Te.UPPER_LETTER },
- { glyphFormat: "%5.", glyphType: Te.DECIMAL },
- { glyphFormat: "%6.", glyphType: Te.LOWER_ROMAN },
- { glyphFormat: "%7.", glyphType: Te.UPPER_LETTER },
- { glyphFormat: "%8.", glyphType: Te.DECIMAL },
- { glyphFormat: "%9.", glyphType: Te.LOWER_ROMAN }
- ])
- },
- ORDER_LIST_5: {
- listType: "ORDER_LIST",
- nestingLevel: In([
- { glyphFormat: "%1.", glyphType: Te.DECIMAL_ZERO },
- { glyphFormat: "%2.", glyphType: Te.LOWER_LETTER },
- { glyphFormat: "%3.", glyphType: Te.LOWER_ROMAN },
- { glyphFormat: "%4.", glyphType: Te.DECIMAL_ZERO },
- { glyphFormat: "%5.", glyphType: Te.LOWER_LETTER },
- { glyphFormat: "%6.", glyphType: Te.LOWER_ROMAN },
- { glyphFormat: "%7.", glyphType: Te.DECIMAL_ZERO },
- { glyphFormat: "%8.", glyphType: Te.LOWER_LETTER },
- { glyphFormat: "%9.", glyphType: Te.LOWER_ROMAN }
- ])
- },
- CHECK_LIST: {
- listType: "CHECK_LIST",
- nestingLevel: ca("☐")
- },
- CHECK_LIST_CHECKED: {
- listType: "CHECK_LIST_CHECKED",
- nestingLevel: ca(
- "☑",
- {
- st: {
- s: we.TRUE
- }
- }
- )
- }
- };
- var br = (t) => {
- const { glyphFormat: e, glyphType: n } = t, r = re.deepClone(Es.ORDER_LIST);
- return r.nestingLevel[0].glyphFormat = e, r.nestingLevel[0].glyphType = n, r;
- };
- var Tm = {
- ORDER_LIST_QUICK_2: br(Or[
- "a)"
- /* ORDER_LIST_QUICK_2 */
- ]),
- ORDER_LIST_QUICK_3: br(Or[
- "a."
- /* ORDER_LIST_QUICK_3 */
- ]),
- ORDER_LIST_QUICK_4: br(Or[
- "i."
- /* ORDER_LIST_QUICK_4 */
- ]),
- ORDER_LIST_QUICK_6: br(Or[
- "I."
- /* ORDER_LIST_QUICK_6 */
- ])
- };
- Object.assign(Es, Tm);
- var ZC = {
- "1.": "ORDER_LIST",
- "a)": "ORDER_LIST_QUICK_2",
- "a.": "ORDER_LIST_QUICK_3",
- "i.": "ORDER_LIST_QUICK_4",
- "A.": "ORDER_LIST_3",
- "I.": "ORDER_LIST_QUICK_6",
- "01.": "ORDER_LIST_5"
- /* ORDER_LIST_5 */
- };
- function Mm(t, e, n, r, s) {
- 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);
- return {
- dataStream: "",
- textRuns: i,
- paragraphs: o,
- sectionBreaks: a,
- customBlocks: u,
- tables: c,
- customRanges: l,
- customDecorations: h
- };
- }
- function Dm(t, e, n, r, s) {
- const { textRuns: i } = t, { textRuns: o } = e;
- if (i == null || o == null)
- return;
- const a = Ku(t, n, r);
- if (s !== Pe.REPLACE) {
- const u = qu(o, a, s);
- e.textRuns = u;
- }
- return ju(t, e, n, r), a;
- }
- function qu(t, e, n) {
- if (e.length === 0)
- return t;
- t = re.deepClone(t), e = re.deepClone(e);
- const r = [], s = t.length, i = e.length;
- let o = 0, a = 0, u = null;
- function c() {
- return u ? (r.push(u), u = null, true) : false;
- }
- for (; o < s && a < i; ) {
- const { st: f, ed: E, ts: R } = t[o], { st: O, ed: U, ts: ne, sId: X } = e[a];
- let de;
- if (n === Pe.COVER ? de = { ...ne, ...R } : de = { ...R }, E < O)
- c() || r.push(t[o]), o++;
- else if (U < f)
- c() || r.push(e[a]), a++;
- else {
- const T = {
- st: Math.min(f, O),
- ed: Math.max(f, O),
- ts: f < O ? { ...R } : { ...ne },
- sId: f < O ? void 0 : X
- };
- T.ed > T.st && r.push(T), r.push({
- st: Math.max(f, O),
- ed: Math.min(E, U),
- ts: de,
- sId: X
- }), 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++);
- const A = {
- st: Math.min(E, U),
- ed: Math.max(E, U),
- ts: E < U ? { ...ne } : { ...R },
- sId: E < U ? X : void 0
- };
- u = A.ed > A.st ? A : null;
- }
- }
- c();
- const l = r[r.length - 1], h = t[s - 1], d = e[i - 1];
- return l && l.ed !== Math.max(h.ed, d.ed) && (h.ed > d.ed ? r.push(h) : r.push(d)), _s(r);
- }
- function xm(t, e, n, r, s) {
- const { paragraphs: i } = t, { paragraphs: o } = e;
- if (i == null || o == null)
- return;
- const a = Xu(t, n, r);
- if (s !== Pe.REPLACE) {
- const u = [];
- for (const c of o) {
- const {
- startIndex: l,
- paragraphStyle: h,
- bullet: d
- } = c;
- let f = [];
- for (const E of a) {
- const {
- startIndex: R,
- paragraphStyle: O,
- bullet: U
- } = E;
- let ne, X;
- if (s === Pe.COVER ? (ne = { ...O, ...h }, X = {
- listId: "",
- listType: Ft.BULLET_LIST,
- nestingLevel: 0,
- textStyle: {},
- ...U,
- ...d
- }) : (ne = { ...h, ...O }, X = {
- listId: "",
- listType: Ft.BULLET_LIST,
- nestingLevel: 0,
- textStyle: {},
- ...d,
- ...U
- }), l === R) {
- f.push({
- startIndex: l,
- paragraphStyle: ne,
- bullet: X
- });
- break;
- }
- }
- u.push(...f), f = [];
- }
- e.paragraphs = u;
- }
- return Hu(t, e, n, r), a;
- }
- function Lm(t, e, n, r, s) {
- const { sectionBreaks: i } = t, { sectionBreaks: o } = e;
- if (i == null || o == null)
- return;
- const a = Ju(t, n, r);
- if (s !== Pe.REPLACE) {
- const u = [];
- for (const c of o) {
- const { startIndex: l } = c;
- let h = [];
- for (const d of a) {
- const { startIndex: f } = d;
- if (l === f) {
- s === Pe.COVER ? h.push({
- ...d,
- ...c
- }) : h.push({
- ...c,
- ...d
- });
- break;
- }
- }
- u.push(...h), h = [];
- }
- e.sectionBreaks = u;
- }
- return Wu(t, e, n, r), a;
- }
- function Um(t, e, n, r, s) {
- const { customBlocks: i = [] } = t, { customBlocks: o } = e;
- if (i == null || o == null)
- return;
- const a = Zu(t, n, r);
- if (s !== Pe.REPLACE) {
- const u = [];
- for (const c of o) {
- const { startIndex: l } = c;
- let h = [];
- for (const d of a) {
- const { startIndex: f } = d;
- if (l === f) {
- s === Pe.COVER ? h.push({
- ...d,
- ...c
- }) : h.push({
- ...c,
- ...d
- });
- break;
- }
- }
- u.push(...h), h = [];
- }
- e.customBlocks = u;
- }
- return zu(t, e, n, r), i.length && !t.customBlocks && (t.customBlocks = i), a;
- }
- function Pm(t, e, n, r, s) {
- const { tables: i } = t, { tables: o } = e;
- if (i == null || o == null)
- return;
- const a = Qu(t, n, r);
- if (s !== Pe.REPLACE) {
- const u = [];
- for (const c of o) {
- const { startIndex: l, endIndex: h } = c;
- let d = [];
- for (const f of a) {
- const { startIndex: E, endIndex: R } = f;
- if (E >= l && R <= h) {
- s === Pe.COVER ? d.push({
- ...f,
- ...c
- }) : d.push({
- ...c,
- ...f
- });
- break;
- }
- }
- u.push(...d), d = [];
- }
- e.tables = u;
- }
- return Yu(t, e, n, r), a;
- }
- function km(t, e, n, r, s) {
- t.customRanges || (t.customRanges = []), Qs(t.customRanges, r), Qs(t.customRanges, r + n);
- const i = r, o = r + n - 1, { customRanges: a } = e, u = [], c = /* @__PURE__ */ new Map();
- t.customRanges.forEach((h) => {
- const { startIndex: d, endIndex: f } = h;
- d >= i && f <= o ? c.set(h.rangeId, h) : u.push(h);
- });
- const l = [];
- return a ? (a.forEach((h) => {
- const { startIndex: d, endIndex: f } = h;
- u.push({
- ...h,
- startIndex: d + r,
- endIndex: f + r
- });
- }), t.customRanges = ki(u), l) : [];
- }
- function Fm(t, e, n, r, s) {
- t.customDecorations || (t.customDecorations = []), qs(t.customDecorations, r), qs(t.customDecorations, r + n);
- const i = [], { customDecorations: o } = t, { customDecorations: a = [] } = e;
- if (s === Pe.REPLACE) {
- for (let u = 0; u < o.length; u++) {
- const c = o[u], { startIndex: l, endIndex: h } = c;
- l >= r && h <= r + n - 1 && i.push(c);
- }
- a.forEach((u) => {
- const { startIndex: c, endIndex: l } = u;
- o.push({
- ...u,
- startIndex: c + r,
- endIndex: l + r
- });
- });
- } else
- for (const u of a) {
- const { id: c } = u;
- if (u.type === An.DELETED) {
- const l = o.filter((h) => h.id === c);
- l.length && i.push(...l);
- } else
- o.push({
- ...u,
- startIndex: u.startIndex + r,
- endIndex: u.endIndex + r
- });
- }
- for (const u of i) {
- const { id: c } = u, l = o.findIndex((h) => h.id === c);
- l !== -1 && o.splice(l, 1);
- }
- return t.customDecorations = Gu(o), i;
- }
- var el = ((t) => (t[t.copy = 0] = "copy", t[t.cut = 1] = "cut", t))(el || {});
- function ei(t, e, n, r = true) {
- const { textRuns: s } = t;
- if (s) {
- const i = [];
- for (const o of s) {
- const a = re.deepClone(o), { st: u, ed: c } = a;
- re.hasIntersectionBetweenTwoRanges(u, c, e, n) && (e >= u && e <= c ? i.push({
- ...a,
- st: e,
- ed: Math.min(n, c)
- }) : n >= u && n <= c ? i.push({
- ...a,
- st: Math.max(e, u),
- ed: n
- }) : i.push(a));
- }
- return _s(
- i.map((o) => {
- const { st: a, ed: u } = o;
- return {
- ...o,
- st: a - e,
- ed: u - e
- };
- })
- );
- } else if (r)
- return [{
- st: 0,
- ed: n - e,
- ts: {}
- }];
- }
- function $m(t, e, n) {
- const { tables: r = [] } = t, s = [];
- for (const i of r) {
- const o = re.deepClone(i), { startIndex: a, endIndex: u } = o;
- a >= e && u <= n && s.push({
- ...o,
- startIndex: a - e,
- endIndex: u - e
- });
- }
- return s;
- }
- function Bm(t, e, n) {
- const { paragraphs: r = [] } = t, s = [];
- for (const i of r) {
- const { startIndex: o } = i;
- o >= e && o < n && s.push(re.deepClone(i));
- }
- if (s.length)
- return s.map((i) => ({
- ...i,
- startIndex: i.startIndex - e
- }));
- }
- function QC(t, e, n) {
- const { sectionBreaks: r = [] } = t, s = [];
- for (const i of r) {
- const { startIndex: o } = i;
- o >= e && o <= n && s.push(re.deepClone(i));
- }
- if (s.length)
- return s.map((i) => ({
- ...i,
- startIndex: i.startIndex - e
- }));
- }
- function jm(t, e, n) {
- const { customBlocks: r = [] } = t, s = [];
- for (const i of r) {
- const { startIndex: o } = i;
- o >= e && o <= n && s.push(re.deepClone(i));
- }
- if (s.length)
- return s.map((i) => ({
- ...i,
- startIndex: i.startIndex - e
- }));
- }
- function Dt(t, e, n, r = true, s = 1) {
- const { dataStream: i } = t, o = {
- dataStream: i.slice(e, n)
- };
- o.textRuns = ei(t, e, n, r);
- const a = $m(t, e, n);
- if (a.length && (o.tables = a), o.paragraphs = Bm(t, e, n), s === 1) {
- const c = Wm(t, e, n);
- c ? o.customDecorations = c : r && (o.customDecorations = []);
- }
- const { customRanges: u } = Hm(t, e, n);
- return u ? o.customRanges = u : r && (o.customRanges = []), o.customBlocks = jm(t, e, n), o;
- }
- function qC(t) {
- const { dataStream: e, textRuns: n, paragraphs: r, customRanges: s, customDecorations: i, tables: o } = t;
- let a = 0, u = 0;
- s == null || s.forEach((l) => {
- l.startIndex < 0 && (a = Math.max(a, -l.startIndex)), l.endIndex > e.length - 1 && (u = Math.max(u, l.endIndex - e.length + 1));
- });
- const c = `${e}`;
- 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) => {
- l.st += a, l.ed += a;
- }), r == null || r.forEach((l) => {
- l.startIndex += a;
- }), s == null || s.forEach((l) => {
- l.startIndex += a, l.endIndex += a;
- }), i == null || i.forEach((l) => {
- l.startIndex += a, l.endIndex += u;
- }), o == null || o.forEach((l) => {
- l.startIndex += a, l.endIndex += u;
- }), {
- ...t,
- dataStream: c,
- textRuns: n,
- paragraphs: r,
- customRanges: s,
- customDecorations: i,
- tables: o
- };
- }
- function Hm(t, e, n) {
- if (t.customRanges == null)
- return {};
- const { customRanges: r } = t;
- return {
- customRanges: r.filter((a) => Math.max(a.startIndex, e) <= Math.min(a.endIndex, n - 1)).map((a) => ({
- ...a,
- startIndex: Math.max(a.startIndex, e),
- endIndex: Math.min(a.endIndex, n - 1)
- })).map((a) => ({
- ...a,
- startIndex: a.startIndex - e,
- endIndex: a.endIndex - e
- })),
- leftOffset: 0,
- rightOffset: 0
- };
- }
- function Wm(t, e, n) {
- if (t.customDecorations == null)
- return;
- const { customDecorations: r = [] } = t, s = [];
- return r.forEach((i) => {
- if (Math.max(i.startIndex, e) <= Math.min(i.endIndex, n - 1)) {
- const o = re.deepClone(i);
- s.push({
- ...o,
- startIndex: Math.max(o.startIndex - e, 0),
- endIndex: Math.min(o.endIndex, n - 1) - e
- });
- }
- }), s;
- }
- function zm(t, e, n) {
- return t == null || e == null ? t != null ? t : e : qu(t, e, n);
- }
- function Ym(t, e, n) {
- if (t == null || e == null)
- return t != null ? t : e;
- if (e.length === 0 || t.length === 0)
- return t;
- if (e.length > 1 || t.length > 1)
- throw new Error("Cannot cover multiple customRanges");
- return n === Pe.REPLACE ? [{
- ...t[0]
- }] : [{
- ...e[0],
- ...t[0]
- }];
- }
- function Vm(t, e, n) {
- return e.length === 0 || t.length === 0 || n === Pe.REPLACE ? t : [
- ...t,
- ...e.filter((r) => !t.some((s) => r.id === s.id))
- ];
- }
- function ha(t, e, n = Pe.COVER) {
- if (e.dataStream !== "")
- throw new Error("Cannot compose other body with non-empty dataStream");
- const r = {
- dataStream: t.dataStream
- }, {
- textRuns: s,
- paragraphs: i = [],
- customRanges: o,
- customDecorations: a = []
- } = t, {
- textRuns: u,
- paragraphs: c = [],
- customRanges: l,
- customDecorations: h = []
- } = e;
- r.textRuns = zm(u, s, n), r.customRanges = Ym(l, o, n);
- const d = Vm(h, a, n);
- d.length && (r.customDecorations = d);
- const f = [];
- let E = 0, R = 0;
- for (; E < i.length && R < c.length; ) {
- const O = i[E], U = c[R], { startIndex: ne } = O, { startIndex: X } = U;
- ne === X ? (f.push(re.deepMerge(O, U)), E++, R++) : ne < X ? (f.push(re.deepClone(O)), E++) : (f.push(re.deepClone(U)), R++);
- }
- return E < i.length && f.push(...i.slice(E)), R < c.length && f.push(...c.slice(R)), f.length && (r.paragraphs = f), r;
- }
- function Gm(t) {
- const { body: e } = t;
- if (e == null)
- return true;
- const { textRuns: n, paragraphs: r, customRanges: s, customBlocks: i, customDecorations: o, tables: a } = e;
- return n == null && r == null && s == null && i == null && o == null && a == null;
- }
- var Bn = class {
- constructor(e) {
- C(this, "_index", 0);
- C(this, "_offset", 0);
- this._actions = e;
- }
- hasNext() {
- return this.peekLength() < Number.POSITIVE_INFINITY;
- }
- next(e) {
- e || (e = Number.POSITIVE_INFINITY);
- const n = this._actions[this._index];
- if (n) {
- const r = this._offset, s = n.len;
- 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({
- ...n,
- len: e
- }) : re.deepClone({
- ...n,
- len: e,
- body: Dt(n.body, r, r + e, false)
- });
- } else
- return {
- t: ce.RETAIN,
- len: Number.POSITIVE_INFINITY
- };
- }
- peek() {
- return this._actions[this._index];
- }
- peekLength() {
- return this._actions[this._index] ? this._actions[this._index].len - this._offset : Number.POSITIVE_INFINITY;
- }
- peekType() {
- const e = this._actions[this._index];
- return e ? e.t : ce.RETAIN;
- }
- rest() {
- if (this.hasNext()) {
- if (this._offset === 0)
- return this._actions.slice(this._index);
- {
- const e = this._offset, n = this._index, r = this.next(), s = this._actions.slice(this._index);
- return this._offset = e, this._index = n, [r].concat(s);
- }
- } else
- return [];
- }
- };
- var lr = class {
- constructor() {
- C(this, "cursor", 0);
- }
- reset() {
- return this.cursor = 0, this;
- }
- moveCursor(e) {
- this.cursor += e;
- }
- moveCursorTo(e) {
- this.cursor = e;
- }
- };
- function Km(t, e, n) {
- 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);
- let f = "";
- return r && (t.dataStream = pp(r, s, i), f = r.slice(s, i)), {
- dataStream: f,
- textRuns: o,
- paragraphs: a,
- sectionBreaks: u,
- customBlocks: c,
- tables: l,
- customRanges: h,
- customDecorations: d
- };
- }
- function Xm(t, e, n, r) {
- 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);
- }
- function Jm(t, e, n, r, s = Pe.COVER) {
- return Mm(t, e, n, r, s);
- }
- function Zm(t, e, n) {
- return e <= 0 ? { dataStream: "" } : Km(t, e, n);
- }
- function Qm(t, e, n, r) {
- n !== 0 && Xm(t, e, n, r);
- }
- function qm(t, e) {
- const n = new lr();
- return n.reset(), e.forEach((r) => {
- const s = re.deepClone(r);
- switch (s.t) {
- case ce.RETAIN: {
- const { coverType: i, body: o, len: a } = s;
- o != null && Jm(t, o, a, n.cursor, i), n.moveCursor(a);
- break;
- }
- case ce.INSERT: {
- const { body: i, len: o } = s;
- Qm(t, i, o, n.cursor), n.moveCursor(o);
- break;
- }
- case ce.DELETE: {
- const { len: i } = s;
- Zm(t, i, n.cursor);
- break;
- }
- default:
- throw new Error(`Unknown action type for action: ${s}.`);
- }
- }), t;
- }
- function e_(t, e, n, r, s) {
- if (t == null || e == null)
- return e;
- if (t.length === 0 || e.length === 0)
- return [];
- e = re.deepClone(e), t = re.deepClone(t);
- const i = [], o = e.length, a = t.length;
- let u = 0, c = 0, l = null;
- function h() {
- return l ? (i.push(l), l = null, true) : false;
- }
- for (; u < o && c < a; ) {
- const { st: R, ed: O, ts: U } = e[u], { st: ne, ed: X, ts: de, sId: T } = t[c];
- let A = {};
- if (s === 0)
- A = { ...U }, n === Pe.COVER && r === Pe.REPLACE && de && (A = Object.assign({}, de, A));
- else if (A = { ...U }, n === Pe.REPLACE) {
- if (r === Pe.REPLACE)
- A = { ...de };
- else if (U && de) {
- const H = Object.keys(U);
- for (const Z of H)
- de[Z] && delete A[Z];
- }
- } else if (r === Pe.REPLACE) {
- if (de) {
- const H = Object.keys(de);
- for (const Z of H)
- de[Z] !== void 0 && (A[Z] = de[Z]);
- }
- } else if (de) {
- const H = Object.keys(de);
- for (const Z of H)
- A[Z] !== void 0 && delete A[Z];
- }
- if (O < ne)
- h() || i.push(e[u]), u++;
- else if (X < R)
- h() || i.push(t[c]), c++;
- else {
- const H = {
- st: Math.min(R, ne),
- ed: Math.max(R, ne),
- ts: R < ne ? { ...U } : { ...de },
- sId: R < ne ? void 0 : T
- };
- H.ed > H.st && i.push(), i.push({
- st: Math.max(R, ne),
- ed: Math.min(O, X),
- ts: A,
- sId: T
- }), 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++);
- const Z = {
- st: Math.min(O, X),
- ed: Math.max(O, X),
- ts: O < X ? { ...de } : { ...U },
- sId: O < X ? T : void 0
- };
- l = Z.ed > Z.st ? Z : null;
- }
- }
- h();
- const d = i[i.length - 1], f = e[o - 1], E = t[a - 1];
- return d.ed !== Math.max(f.ed, E.ed) && (f.ed > E.ed ? i.push(f) : i.push(E)), _s(i, true);
- }
- function t_(t, e, n, r, s) {
- if (t == null || e == null)
- return e;
- if (t.length === 0 || e.length === 0)
- return [];
- if (t.length > 1 || e.length > 1)
- throw new Error("CustomRanges is only supported transform for length one now.");
- const i = t[0], o = e[0];
- if (n === Pe.REPLACE)
- return s === 1 ? [re.deepClone(i)] : [re.deepClone(o)];
- if (r === Pe.REPLACE) {
- const a = re.deepClone(o);
- return s === 1 && Object.assign(a, re.deepClone(i)), [a];
- } else {
- const a = re.deepClone(o);
- return s === 1 && Object.assign(a, re.deepClone(i)), [a];
- }
- }
- function da(t, e, n, r, s) {
- const i = {
- startIndex: e.startIndex
- };
- if (e.paragraphStyle && (i.paragraphStyle = re.deepClone(e.paragraphStyle), t.paragraphStyle)) {
- if (n === Pe.REPLACE)
- if (r === Pe.REPLACE)
- s === 1 && (i.paragraphStyle = {
- ...t.paragraphStyle
- });
- else if (s === 1) {
- const o = Object.keys(t.paragraphStyle);
- for (const a of o)
- t.paragraphStyle[a] !== void 0 && (i.paragraphStyle[a] = t.paragraphStyle[a]);
- } else {
- const o = Object.keys(t.paragraphStyle);
- for (const a of o)
- i.paragraphStyle[a] === void 0 && (i.paragraphStyle[a] = t.paragraphStyle[a]);
- }
- else if (r === Pe.REPLACE)
- if (s === 1) {
- const o = Object.keys(t.paragraphStyle);
- for (const a of o)
- t.paragraphStyle[a] !== void 0 && (i.paragraphStyle[a] = t.paragraphStyle[a]);
- } else {
- const o = Object.keys(t.paragraphStyle);
- for (const a of o)
- i.paragraphStyle[a] === void 0 && (i.paragraphStyle[a] = t.paragraphStyle[a]);
- }
- else if (s === 1) {
- const o = Object.keys(t.paragraphStyle);
- for (const a of o)
- i.paragraphStyle[a] && delete i.paragraphStyle[a];
- }
- }
- 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;
- }
- function n_(t, e) {
- if (t == null || e == null)
- return e;
- if (t.length === 0 || e.length === 0)
- return re.deepClone(e);
- const n = [];
- for (const r of e) {
- const { id: s, type: i } = r;
- let o = false;
- for (const a of t)
- if (a.id === s) {
- (a.type === An.DELETED || i === An.DELETED) && (o = true, n.push({
- ...r,
- type: An.DELETED
- }));
- break;
- }
- o || n.push(r);
- }
- return n;
- }
- function r_(t, e, n = false) {
- const { body: r, coverType: s = Pe.COVER } = t, { body: i, coverType: o = Pe.COVER } = e;
- if (r == null || r.dataStream !== "" || i == null || i.dataStream !== "")
- throw new Error("Data stream is not supported in retain transform.");
- const a = {
- dataStream: ""
- }, u = o, {
- textRuns: c,
- paragraphs: l = [],
- customRanges: h,
- customDecorations: d
- } = r, {
- textRuns: f,
- paragraphs: E = [],
- customRanges: R,
- customDecorations: O
- } = i, U = e_(
- c,
- f,
- s,
- o,
- n ? 1 : 0
- /* COVER */
- );
- U && (a.textRuns = U);
- const ne = t_(
- h,
- R,
- s,
- o,
- n ? 1 : 0
- /* COVER */
- );
- ne && (a.customRanges = ne);
- const X = n_(
- d,
- O
- );
- X && (a.customDecorations = X);
- const de = [];
- let T = 0, A = 0;
- for (; T < l.length && A < E.length; ) {
- const H = l[T], Z = E[A], { startIndex: fe } = H, { startIndex: ae } = Z;
- if (fe === ae) {
- let m = {
- startIndex: fe
- };
- n ? m = da(
- H,
- Z,
- s,
- o,
- 1
- /* COVER_ONLY_NOT_EXISTED */
- ) : m = da(
- H,
- Z,
- s,
- o,
- 0
- /* COVER */
- ), de.push(m), T++, A++;
- } else
- fe < ae ? T++ : (de.push(re.deepClone(Z)), A++);
- }
- return A < E.length && de.push(...E.slice(A)), de.length && (a.paragraphs = de), {
- coverType: u,
- body: a
- };
- }
- function fa(t) {
- return Object.keys(t).length === 1;
- }
- var wn = class wn2 {
- constructor() {
- C(this, "_actions", []);
- }
- static apply(e, n) {
- return qm(e, n);
- }
- // eslint-disable-next-line complexity
- static compose(e, n) {
- const r = new Bn(e), s = new Bn(n), i = new wn2();
- for (; r.hasNext() || s.hasNext(); )
- if (s.peekType() === ce.INSERT)
- i.push(s.next());
- else if (r.peekType() === ce.DELETE)
- i.push(r.next());
- else {
- const o = Math.min(r.peekLength(), s.peekLength()), a = r.next(o), u = s.next(o);
- if (a.t === ce.INSERT && u.t === ce.RETAIN)
- u.body == null ? i.push(a) : i.push({
- ...a,
- body: ha(a.body, u.body, u.coverType)
- });
- else if (a.t === ce.RETAIN && u.t === ce.RETAIN)
- if (a.body == null && u.body == null)
- i.push(a.len !== Number.POSITIVE_INFINITY ? a : u);
- else if (a.body && u.body) {
- const c = a.coverType === Pe.REPLACE || u.coverType === Pe.REPLACE ? Pe.REPLACE : Pe.COVER;
- i.push({
- ...a,
- t: ce.RETAIN,
- coverType: c,
- body: ha(a.body, u.body, u.coverType)
- });
- } else
- i.push(a.body ? a : u);
- else
- a.t === ce.RETAIN && u.t === ce.DELETE ? i.push(u) : a.t === ce.INSERT && (u.t, ce.DELETE);
- }
- return i.trimEndUselessRetainAction(), i.serialize();
- }
- /**
- * |(this↓ \| other→) | **insert** | **retain** | **delete** |
- * | ---------------- | ---------- | ---------- | ---------- |
- * | **insert** | Case 1 | Case 2 | Case 2 |
- * | **retain** | Case 1 | Case 5 | Case 4 |
- * | **delete** | Case 1 | Case 3 | Case 3 |
- *
- * Case 1: When the other action type is an insert operation,
- * the insert operation is retained regardless of the type of action this action
- * Case 2: When this action type is an insert operation and the other action type is a
- * non-insert operation, you need to retain the length of this action insert
- * Case 3: When this action is a delete operation, there are two scenarios:
- * 1) When other is a delete operation, since it is a delete operation, this has
- * already been deleted, so the target does not need to be in delete, and it can
- * be continued directly
- * 2) When other is the retain operation, although this action delete occurs first,
- * the delete priority is higher, so the delete operation is retained, and the origin
- * delete has been applied, so it is directly continued
- * Case 4: other is the delete operation, this is the retain operation, and the target delete operation
- * is kept
- * Case 5: When both other and this are retain operations
- * 1) If the other body attribute does not exist, directly retain length
- * 2) If the other body property exists, then execute the TransformBody logic to override it
- */
- // priority - if true, this actions takes priority over other, that is, this actions are considered to happen "first".
- // thisActions is the target action.
- static transform(e, n, r = "right") {
- return this._transform(n, e, r === "left" ? "right" : "left");
- }
- // otherActions is the actions to be transformed.
- static _transform(e, n, r = "right") {
- const s = new Bn(e), i = new Bn(n), o = new wn2();
- for (; s.hasNext() || i.hasNext(); )
- if (s.peekType() === ce.INSERT && (r === "left" || i.peekType() !== ce.INSERT)) {
- const a = s.next();
- o.retain(a.len);
- } else if (i.peekType() === ce.INSERT)
- o.push(i.next());
- else {
- const a = Math.min(s.peekLength(), i.peekLength()), u = s.next(a), c = i.next(a);
- if (u.t === ce.DELETE)
- continue;
- if (c.t === ce.DELETE) {
- o.push(c);
- continue;
- }
- if (u.body == null || c.body == null)
- o.push(c);
- else {
- const { coverType: l, body: h } = r_(u, c, r === "left");
- o.push({
- ...c,
- t: ce.RETAIN,
- coverType: l,
- body: h
- });
- }
- }
- return o.trimEndUselessRetainAction(), o.serialize();
- }
- /**
- * Used to transform selection. Why not named transformSelection?
- * Because Univer Doc supports multiple Selections in one document, user need to encapsulate transformSelections at the application layer.
- */
- static transformPosition(e, n, r = false) {
- const s = new Bn(e);
- let i = 0;
- for (; s.hasNext() && i <= n; ) {
- const o = s.peekLength(), a = s.peekType();
- if (s.next(), a === ce.DELETE) {
- n -= Math.min(o, n - i);
- continue;
- } else
- a === ce.INSERT && (i < n || !r) && (n += o);
- i += o;
- }
- return n;
- }
- static isNoop(e) {
- return e.length === 0;
- }
- static invert(e) {
- const n = [];
- for (const r of e)
- if (r.t === ce.INSERT)
- n.push({
- t: ce.DELETE,
- len: r.len,
- body: r.body
- });
- else if (r.t === ce.DELETE) {
- if (r.body == null)
- throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");
- n.push({
- t: ce.INSERT,
- body: r.body,
- len: r.len
- });
- } else if (r.body != null) {
- if (r.oldBody == null)
- throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");
- n.push({
- t: ce.RETAIN,
- body: r.oldBody,
- oldBody: r.body,
- len: r.len,
- coverType: Pe.REPLACE
- });
- } else
- n.push(r);
- return n;
- }
- static makeInvertible(e, n) {
- const r = [];
- let s = 0;
- for (const i of e) {
- if (i.t === ce.DELETE && (i.body == null || i.body && i.body.dataStream.length !== i.len)) {
- const o = Dt(n, s, s + i.len, false);
- i.len = o.dataStream.length, i.body = o;
- }
- if (i.t === ce.RETAIN && i.body != null) {
- const o = Dt(n, s, s + i.len, true);
- i.oldBody = {
- ...o,
- dataStream: ""
- }, i.len = o.dataStream.length;
- }
- r.push(i), i.t !== ce.INSERT && (s += i.len);
- }
- return r;
- }
- insert(e, n) {
- const r = {
- t: ce.INSERT,
- body: n,
- len: e
- };
- return this.push(r), this;
- }
- retain(e, n, r) {
- const s = {
- t: ce.RETAIN,
- len: e
- };
- return n != null && (s.body = n), r != null && (s.coverType = r), this.push(s), this;
- }
- delete(e) {
- const n = {
- t: ce.DELETE,
- len: e
- };
- return this.push(n), this;
- }
- empty() {
- return this._actions = [], this;
- }
- serialize() {
- return this._actions;
- }
- // eslint-disable-next-line complexity
- push(...e) {
- if (e.length > 1) {
- for (const i of e)
- this.push(i);
- return this;
- }
- let n = this._actions.length, r = this._actions[n - 1];
- const s = re.deepClone(e[0]);
- if (s.t === ce.RETAIN && s.len === 0 && s.body == null)
- return this;
- if (typeof r == "object") {
- if (r.t === ce.DELETE && s.t === ce.DELETE)
- return r.len += s.len, this;
- if (r.t === ce.DELETE && s.t === ce.INSERT && (n -= 1, r = this._actions[n - 1], r == null))
- return this._actions.unshift(s), this;
- if (r.t === ce.RETAIN && s.t === ce.RETAIN && r.body == null && s.body == null)
- return r.len += s.len, this;
- if (r.t === ce.INSERT && fa(r.body) && s.t === ce.INSERT && fa(s.body))
- return r.len += s.len, r.body.dataStream += s.body.dataStream, this;
- }
- return n === this._actions.length ? this._actions.push(s) : this._actions.splice(n, 0, s), this;
- }
- trimEndUselessRetainAction() {
- let e = this._actions[this._actions.length - 1];
- for (; e && e.t === ce.RETAIN && Gm(e); )
- this._actions.pop(), e = this._actions[this._actions.length - 1];
- return this;
- }
- };
- C(wn, "id", "text-x"), C(wn, "uri", "https://github.com/dream-num/univer#text-x");
- var Ke = wn;
- Object.defineProperty(Ke, "name", {
- value: "text-x"
- });
- var On = class On2 {
- static registerSubtype(e) {
- var n;
- 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));
- }
- static apply(e, n) {
- if (!mt.type.isNoop(n))
- return mt.type.apply(e, n);
- }
- static compose(e, n) {
- return mt.type.compose(e, n);
- }
- static transform(e, n, r) {
- return mt.type.transform(e, n, r);
- }
- // Use to transform cursor position, just call TextXPro.transformPosition.
- static transformPosition(e, n, r = "right") {
- return e && e.length === 2 && e[0] === "body" && e[1].et === Ke.name ? Ke.transformPosition(e[1].e, n, r === "left") : n;
- }
- static invertWithDoc(e, n) {
- return mt.type.invertWithDoc(e, n);
- }
- static isNoop(e) {
- return mt.type.isNoop(e);
- }
- static getInstance() {
- return this._instance == null && (this._instance = new On2()), this._instance;
- }
- // eslint-disable-next-line ts/no-explicit-any
- removeOp(e, n) {
- return mt.removeOp(e, n);
- }
- moveOp(e, n) {
- return mt.moveOp(e, n);
- }
- // eslint-disable-next-line ts/no-explicit-any
- insertOp(e, n) {
- return mt.insertOp(e, n);
- }
- // eslint-disable-next-line ts/no-explicit-any
- replaceOp(e, n, r) {
- return mt.replaceOp(e, n, r);
- }
- editOp(e, n = ["body"]) {
- return mt.editOp(n, Ke.name, e);
- }
- };
- C(On, "uri", "https://github.com/dream-num/univer#json-x"), C(On, "_subTypes", /* @__PURE__ */ new Map()), C(On, "_instance", null);
- var tn = On;
- tn.registerSubtype(Ke);
- var tl = {
- id: "default_doc",
- documentStyle: {}
- };
- var s_ = class extends Ui {
- constructor(n) {
- var r;
- super();
- C(this, "type", Fe.UNIVER_DOC);
- C(this, "_name$", new BehaviorSubject(""));
- C(this, "name$", this._name$.asObservable());
- C(this, "snapshot");
- this.snapshot = { ...tl, ...n }, this._name$.next((r = this.snapshot.title) != null ? r : "No Title");
- }
- getUnitId() {
- throw new Error("Method not implemented.");
- }
- getRev() {
- var n;
- return (n = this.snapshot.rev) != null ? n : 1;
- }
- incrementRev() {
- this.snapshot.rev = this.getRev() + 1;
- }
- setRev(n) {
- this.snapshot.rev = n;
- }
- setName(n) {
- this.snapshot.title = n, this._name$.next(n);
- }
- get drawings() {
- return this.snapshot.drawings;
- }
- get documentStyle() {
- return this.snapshot.documentStyle;
- }
- get lists() {
- return this.snapshot.lists;
- }
- get zoomRatio() {
- var n;
- return ((n = this.snapshot.settings) == null ? void 0 : n.zoomRatio) || 1;
- }
- resetDrawing(n, r) {
- this.snapshot.drawings = n, this.snapshot.drawingsOrder = r;
- }
- getBody() {
- return this.snapshot.body;
- }
- getSnapshot() {
- return this.snapshot;
- }
- getBulletPresetList() {
- var s;
- const n = (s = this.snapshot.lists) != null ? s : {};
- return {
- ...Es,
- ...n
- };
- }
- updateDocumentId(n) {
- this.snapshot.id = n;
- }
- updateDocumentRenderConfig(n) {
- const { documentStyle: r } = this.snapshot;
- r.renderConfig == null ? r.renderConfig = n : r.renderConfig = {
- ...r.renderConfig,
- ...n
- };
- }
- updateDocumentStyle(n) {
- this.snapshot.documentStyle == null ? this.snapshot.documentStyle = n : this.snapshot.documentStyle = {
- ...this.snapshot.documentStyle,
- ...n
- };
- }
- updateDocumentDataMargin(n) {
- const { t: r, l: s, b: i, r: o } = n, { documentStyle: a } = this.snapshot;
- r != null && (a.marginTop = r), s != null && (a.marginLeft = s), i != null && (a.marginBottom = i), o != null && (a.marginRight = o);
- }
- updateDocumentDataPageSize(n, r) {
- const { documentStyle: s } = this.snapshot;
- if (!s.pageSize) {
- n = n != null ? n : Number.POSITIVE_INFINITY, r = r != null ? r : Number.POSITIVE_INFINITY, s.pageSize = {
- width: n,
- height: r
- };
- return;
- }
- n !== void 0 && (s.pageSize.width = n), r !== void 0 && (s.pageSize.height = r);
- }
- updateDrawing(n, r) {
- const { drawings: s } = this, { width: i, height: o, left: a, top: u } = r, c = s == null ? void 0 : s[n];
- if (!c)
- return;
- const l = c.docTransform;
- l.size.width = i, l.size.height = o, l.positionH.posOffset = a, l.positionV.posOffset = u;
- }
- setZoomRatio(n = 1) {
- this.snapshot.settings == null ? this.snapshot.settings = {
- zoomRatio: n
- } : this.snapshot.settings.zoomRatio = 1;
- }
- };
- var jt = class _jt extends s_ {
- constructor(n) {
- var s, i;
- super(re.isEmptyObject(n) ? _m() : n);
- C(this, "_unitId");
- C(this, "headerModelMap", /* @__PURE__ */ new Map());
- C(this, "footerModelMap", /* @__PURE__ */ new Map());
- C(this, "change$", new BehaviorSubject(0));
- const r = 6;
- this._unitId = (s = this.snapshot.id) != null ? s : re.generateRandomId(r), this._initializeHeaderFooterModel(), this._name$.next((i = this.snapshot.title) != null ? i : "");
- }
- dispose() {
- super.dispose(), this.headerModelMap.forEach((n) => {
- n.dispose();
- }), this.footerModelMap.forEach((n) => {
- n.dispose();
- }), this._name$.complete();
- }
- getDrawings() {
- return this.snapshot.drawings;
- }
- getDrawingsOrder() {
- return this.snapshot.drawingsOrder;
- }
- getCustomRanges() {
- var n;
- return (n = this.snapshot.body) == null ? void 0 : n.customRanges;
- }
- getCustomDecorations() {
- var n;
- return (n = this.snapshot.body) == null ? void 0 : n.customDecorations;
- }
- getSettings() {
- return this.snapshot.settings;
- }
- // TODO: @JOCS do not use reset, please use apply to modify the snapshot.
- reset(n) {
- if (n.id && n.id !== this._unitId)
- throw new Error("Cannot reset a document model with a different unit id!");
- this.snapshot = { ...tl, ...n }, this._initializeHeaderFooterModel(), this.change$.next(this.change$.value + 1);
- }
- getSelfOrHeaderFooterModel(n) {
- if (n != null) {
- if (this.headerModelMap.has(n))
- return this.headerModelMap.get(n);
- if (this.footerModelMap.has(n))
- return this.footerModelMap.get(n);
- }
- return this;
- }
- getUnitId() {
- return this._unitId;
- }
- apply(n) {
- if (!tn.isNoop(n))
- 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;
- }
- sliceBody(n, r, s = el.copy) {
- const i = this.getBody();
- if (i != null)
- return Dt(i, n, r, false, s);
- }
- _initializeHeaderFooterModel() {
- const { headers: n, footers: r } = this.getSnapshot();
- if (n)
- for (const s in n) {
- const i = n[s];
- this.headerModelMap.set(s, new _jt(i)), this.headerModelMap.get(s).updateDocumentId(this.getUnitId());
- }
- if (r)
- for (const s in r) {
- const i = r[s];
- this.footerModelMap.set(s, new _jt(i)), this.footerModelMap.get(s).updateDocumentId(this.getUnitId());
- }
- }
- updateDocumentId(n) {
- super.updateDocumentId(n), this._unitId = n;
- }
- };
- function i_(t) {
- const { ranges: e, id: n, type: r } = t, s = new Ke();
- let i = 0;
- for (let o = 0; o < e.length; o++) {
- const a = e[o], { startOffset: u, endOffset: c } = a;
- u > 0 && s.push({
- t: ce.RETAIN,
- len: u - i
- }), s.push({
- t: ce.RETAIN,
- body: {
- dataStream: "",
- customDecorations: [{
- id: n,
- type: r,
- startIndex: 0,
- endIndex: c - u - 1
- }]
- },
- len: c - u
- }), i = c;
- }
- return s;
- }
- function o_(t) {
- var l, h, d;
- const { id: e, segmentId: n, documentDataModel: r } = t, s = r == null ? void 0 : r.getBody();
- if (!r || !s)
- return false;
- 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);
- if (!i)
- return false;
- const o = new Ke(), { startIndex: a, endIndex: u } = i, c = u - a + 1;
- return o.push({
- t: ce.RETAIN,
- len: a
- }), o.push({
- t: ce.RETAIN,
- len: c,
- body: {
- dataStream: "",
- customDecorations: [
- {
- startIndex: 0,
- endIndex: c - 1,
- id: e,
- type: An.DELETED
- }
- ]
- }
- }), o;
- }
- function nl(t, e, n, r) {
- return t <= n && e >= n || t >= n && t <= r;
- }
- function a_(t, e) {
- const n = [];
- for (let r = 0, s = e.length; r < s; r++) {
- const i = e[r];
- 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);
- }
- return n;
- }
- function u_(t) {
- return {
- ...re.deepClone(t),
- rangeId: qt()
- };
- }
- function l_(t, e) {
- const n = [];
- let r = t[0];
- for (const s of e)
- s < t[0] || s > t[1] || (r < s && n.push([r, s - 1]), r = s + 1);
- return r <= t[1] && n.push([r, t[1]]), n;
- }
- function rl(t, e, n, r) {
- const s = [];
- for (let i = 0, o = n.length; i < o; i++) {
- const a = n[i];
- if ((r === void 0 || a.rangeType === r) && Math.max(a.startIndex, t) <= Math.min(a.endIndex, e) && s.push({ ...a }), a.startIndex > e)
- break;
- }
- return s;
- }
- function c_(t, e) {
- var i, o, a, u, c;
- 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);
- return {
- startOffset: r,
- endOffset: s,
- collapsed: r === s
- };
- }
- function h_(t) {
- var h, d, f;
- 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);
- if (!i)
- return false;
- const { startIndex: o, endIndex: a } = i, u = new Ke(), c = a - o + 1;
- u.push({
- t: ce.RETAIN,
- len: o
- }), u.push({
- t: ce.RETAIN,
- len: c,
- body: {
- dataStream: "",
- customRanges: []
- }
- }), s && u.push({
- t: ce.INSERT,
- body: s,
- len: s.dataStream.length
- });
- const l = a + 1 + ((f = s == null ? void 0 : s.dataStream.length) != null ? f : 0);
- return u.selections = [{
- startOffset: l,
- endOffset: l,
- collapsed: true
- }], u;
- }
- function d_(t) {
- const { ranges: e, rangeId: n, rangeType: r, wholeEntity: s, properties: i, body: o } = t;
- let a = 0;
- const u = new Ke();
- let c = false;
- return e.forEach((l) => {
- var X, de, T;
- const h = c_(l, o);
- if (!h || !o)
- return false;
- const { startOffset: d, endOffset: f } = h, E = (X = o.customRanges) != null ? X : [], R = (A, H, Z) => {
- var y, M, b, w;
- 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 = {
- rangeId: Z ? `${n}$${Z}` : n,
- rangeType: r,
- startIndex: 0,
- endIndex: m - ae,
- wholeEntity: s,
- properties: {
- ...i
- }
- };
- u.push({
- t: ce.RETAIN,
- len: ae - a
- }), u.push({
- t: ce.RETAIN,
- len: m - ae + 1,
- body: {
- dataStream: "",
- customRanges: [j]
- },
- coverType: Pe.COVER
- }), a = m + 1;
- }, 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);
- 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 = [{
- startOffset: h.endOffset,
- endOffset: h.endOffset,
- collapsed: true
- }];
- }), c ? u : false;
- }
- function sl(t, e, n = 0, r = null, s = true) {
- t.sort((c, l) => c.startOffset - l.startOffset);
- const i = [], { paragraphs: o = [] } = e, a = o == null ? void 0 : o.find(
- (c) => c.startIndex >= t[0].startOffset && c.startIndex < t[0].endOffset
- );
- let u = n;
- if (t.forEach((c) => {
- const { startOffset: l, endOffset: h } = c;
- l > u && (i.push({
- t: ce.RETAIN,
- len: l - u
- }), u = l), u < h && (i.push({
- t: ce.DELETE,
- len: h - u
- }), u = h);
- }), r && i.push({
- t: ce.INSERT,
- body: r,
- len: r.dataStream.length
- }), a && s) {
- const c = o.find((l) => l.startIndex - n >= t[t.length - 1].endOffset - 1);
- c && (c.startIndex > u && (i.push({
- t: ce.RETAIN,
- len: c.startIndex - u
- }), u = c.startIndex), i.push({
- t: ce.RETAIN,
- len: 1,
- body: {
- dataStream: "",
- paragraphs: [
- {
- ...c,
- startIndex: 0,
- bullet: a == null ? void 0 : a.bullet
- }
- ]
- },
- coverType: Pe.REPLACE
- }));
- }
- return i;
- }
- function f_(t, e, n = 0) {
- const r = [];
- let s = n;
- return t.forEach((i) => {
- const { startOffset: o, endOffset: a } = i;
- o > s && (r.push({
- t: ce.RETAIN,
- len: o - s
- }), s = o), a > s && (r.push({
- t: ce.RETAIN,
- len: a - s,
- body: {
- ...re.deepClone(e),
- dataStream: ""
- }
- }), s = a);
- }), r;
- }
- var g_ = (t) => {
- var h;
- const { selection: e, body: n, doc: r } = t, s = e.segmentId, i = (h = r.getSelfOrHeaderFooterModel(s)) == null ? void 0 : h.getBody();
- if (!i)
- return false;
- const o = e.collapsed ? null : Dt(i, e.startOffset, e.endOffset), a = ru(o ? o.dataStream : "", n.dataStream);
- let u = 0;
- const c = a.map(([d, f]) => {
- switch (d) {
- case 0: {
- const E = {
- t: ce.RETAIN,
- body: {
- ...Dt(n, u, u + f.length, false),
- dataStream: ""
- },
- len: f.length
- };
- return u += f.length, E;
- }
- case 1: {
- const E = {
- t: ce.INSERT,
- body: Dt(n, u, u + f.length),
- len: f.length
- };
- return u += f.length, E;
- }
- default:
- return {
- t: ce.DELETE,
- len: f.length
- };
- }
- }), l = new Ke();
- return l.push({
- t: ce.RETAIN,
- len: e.startOffset
- }), l.push(...c), l;
- };
- function p_(t, e) {
- 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]))));
- }
- var m_ = (t) => {
- var h;
- const { selection: e, body: n, doc: r } = t, s = e.segmentId, i = (h = r.getSelfOrHeaderFooterModel(s)) == null ? void 0 : h.getBody();
- if (!i)
- return false;
- const o = e.collapsed ? null : Dt(i, e.startOffset, e.endOffset), a = ru(o ? o.dataStream : "", n.dataStream);
- let u = 0;
- const c = a.map(([d, f]) => {
- switch (d) {
- case 0: {
- const E = ei(n, u, u + f.length, false), R = ei(o, u, u + f.length, false), O = {
- t: ce.RETAIN,
- body: p_(E, R) ? void 0 : {
- textRuns: E,
- dataStream: ""
- },
- len: f.length
- };
- return u += f.length, O;
- }
- case 1: {
- const E = {
- t: ce.INSERT,
- body: Dt(n, u, u + f.length),
- len: f.length
- };
- return u += f.length, E;
- }
- default:
- return {
- t: ce.DELETE,
- len: f.length
- };
- }
- });
- if (c.every((d) => d.t === ce.RETAIN && !d.body))
- return false;
- const l = new Ke();
- return l.push({
- t: ce.RETAIN,
- len: e.startOffset
- }), l.push(...c), l;
- };
- function __(t, e) {
- const n = [], { customBlocks: r = [] } = t;
- for (const s of e) {
- const { startOffset: i, endOffset: o } = s;
- if (!(i == null || o == null))
- for (const a of r) {
- const { startIndex: u } = a;
- u >= i && u < o && n.push(a.blockId);
- }
- }
- return n;
- }
- function E_(t, e = "") {
- if (!e)
- return ["body"];
- const { headers: n, footers: r } = t.getSnapshot();
- if (n == null && r == null)
- throw new Error("Document data model must have headers or footers when update by segment id");
- if ((n == null ? void 0 : n[e]) != null)
- return ["headers", e, "body"];
- if ((r == null ? void 0 : r[e]) != null)
- return ["footers", e, "body"];
- throw new Error("Segment id not found in headers or footers");
- }
- var C_ = (t) => {
- var R, O, U, ne;
- 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();
- if (!l)
- return false;
- const h = (O = (R = n.getSnapshot().drawingsOrder) == null ? void 0 : R.length) != null ? O : 0;
- let d = 0;
- if (s)
- i > 0 && a.push({
- t: ce.RETAIN,
- len: i
- });
- else {
- const X = sl([e], l, 0, null, false);
- a.push(...X);
- 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);
- if (H.length > 0)
- for (const Z of H) {
- const fe = T[Z], ae = A.indexOf(Z);
- if (fe == null || ae < 0)
- continue;
- const m = u.removeOp(["drawings", Z], fe), j = u.removeOp(["drawingsOrder", ae], Z);
- c.push(m), c.push(j), d++;
- }
- }
- a.push({
- t: ce.INSERT,
- body: {
- dataStream: "\b".repeat(r.length),
- customBlocks: r.map((X, de) => ({
- startIndex: de,
- blockId: X.drawingId
- }))
- },
- len: r.length
- });
- const f = E_(n, o), E = u.editOp(a.serialize(), f);
- c.push(E);
- for (const X of r) {
- const { drawingId: de } = X, T = u.insertOp(["drawings", de], X), A = u.insertOp(["drawingsOrder", h - d], de);
- c.push(T), c.push(A);
- }
- return c.reduce((X, de) => tn.compose(X, de), null);
- };
- var R_ = (t) => {
- var h, d, f;
- const { paragraphs: e, segmentId: n, document: r } = t;
- let s = t.listType;
- const i = (d = (h = r.getSelfOrHeaderFooterModel(n).getBody()) == null ? void 0 : h.paragraphs) != null ? d : [], o = e.every((E) => {
- var R;
- return ((R = E.bullet) == null ? void 0 : R.listType.indexOf(s)) === 0;
- });
- let u = re.generateRandomId(6);
- if (e.length === 1) {
- const E = i.indexOf(e[0]), R = i[E - 1], O = i[E + 1];
- 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));
- }
- const c = new lr();
- c.reset();
- const l = new Ke();
- for (const E of e) {
- const { startIndex: R, paragraphStyle: O = {}, bullet: U } = E;
- l.push({
- t: ce.RETAIN,
- len: R - c.cursor
- }), l.push({
- t: ce.RETAIN,
- len: 1,
- body: {
- dataStream: "",
- paragraphs: [
- o ? {
- paragraphStyle: O,
- startIndex: 0
- } : {
- startIndex: 0,
- paragraphStyle: {
- ...O
- },
- bullet: {
- nestingLevel: (f = U == null ? void 0 : U.nestingLevel) != null ? f : 0,
- textStyle: {
- fs: 20
- },
- listType: s,
- listId: u
- }
- }
- ]
- },
- coverType: Pe.REPLACE
- }), c.moveCursorTo(R + 1);
- }
- return l;
- };
- var I_ = (t) => {
- var h;
- const { paragraphIndex: e, segmentId: n, document: r } = t, s = (h = r.getSelfOrHeaderFooterModel(n).getBody()) == null ? void 0 : h.paragraphs;
- if (s == null)
- return false;
- const i = s.find((d) => d.startIndex === e);
- if (!(i != null && i.bullet) || i.bullet.listType.indexOf(Ft.CHECK_LIST) === -1)
- return false;
- const o = new lr();
- o.reset();
- const a = new Ke(), { startIndex: u, paragraphStyle: c = {} } = i, l = i.bullet.listType === Ft.CHECK_LIST ? Ft.CHECK_LIST_CHECKED : Ft.CHECK_LIST;
- return a.push({
- t: ce.RETAIN,
- len: u - o.cursor
- }), a.push({
- t: ce.RETAIN,
- len: 1,
- body: {
- dataStream: "",
- paragraphs: [
- {
- ...i,
- paragraphStyle: c,
- startIndex: 0,
- bullet: {
- ...i.bullet,
- listType: l
- }
- }
- ]
- },
- coverType: Pe.REPLACE
- }), o.moveCursorTo(u + 1), a;
- };
- var v_ = (t) => {
- var l, h;
- const { paragraphs: e, listType: n, segmentId: r, document: s } = t;
- if (((l = s.getSelfOrHeaderFooterModel(r).getBody()) == null ? void 0 : l.paragraphs) == null)
- return false;
- const a = re.generateRandomId(6), u = new lr();
- u.reset();
- const c = new Ke();
- for (const d of e) {
- const { startIndex: f, paragraphStyle: E = {}, bullet: R } = d;
- c.push({
- t: ce.RETAIN,
- len: f - u.cursor
- }), c.push({
- t: ce.RETAIN,
- len: 1,
- body: {
- dataStream: "",
- paragraphs: [
- {
- startIndex: 0,
- paragraphStyle: E,
- bullet: {
- nestingLevel: (h = R == null ? void 0 : R.nestingLevel) != null ? h : 0,
- textStyle: (R == null ? void 0 : R.listType) === n ? R.textStyle : {
- fs: 20
- },
- listType: n,
- listId: a
- }
- }
- ]
- },
- coverType: Pe.REPLACE
- }), u.moveCursorTo(f + 1);
- }
- return c;
- };
- function y_(t, e) {
- return e.some((n) => t.startIndex > n.startIndex && t.startIndex < n.endIndex);
- }
- var w_ = (t) => {
- var l, h, d;
- const { paragraphs: e, segmentId: n, document: r, type: s } = t, i = new lr();
- i.reset();
- const o = new Ke(), a = (l = r.getSnapshot().lists) != null ? l : {}, u = (d = (h = r.getBody()) == null ? void 0 : h.tables) != null ? d : [], c = {
- ...Es,
- ...a
- };
- for (const f of e) {
- const { startIndex: E, paragraphStyle: R = {}, bullet: O } = f, U = y_(f, u);
- if (o.push({
- t: ce.RETAIN,
- len: E - i.cursor
- }), O) {
- const ne = O.listType;
- let X = c[ne].nestingLevel.length - 1;
- U && (X = Math.min(X, 2)), o.push({
- t: ce.RETAIN,
- len: 1,
- body: {
- dataStream: "",
- paragraphs: [
- {
- startIndex: 0,
- paragraphStyle: {
- ...R
- },
- bullet: {
- ...O,
- nestingLevel: Math.max(Math.min(O.nestingLevel + s, X), 0)
- }
- }
- ]
- },
- coverType: Pe.REPLACE
- });
- } else
- o.push({
- t: ce.RETAIN,
- len: 1
- });
- i.moveCursorTo(E + 1);
- }
- return o;
- };
- 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_ || {});
- var ln = ((t) => (t.PARAGRAPH = "\r", t.SECTION_BREAK = `
- `, 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 || {});
- function eR(t) {
- return `${t}`;
- }
- var b_ = [
- // DataStreamTreeTokenType.PARAGRAPH, // 段落
- // DataStreamTreeTokenType.SECTION_BREAK, // 章节
- ln.TABLE_START,
- // 表格开始
- ln.TABLE_ROW_START,
- // 表格开始
- ln.TABLE_CELL_START,
- // 表格开始
- ln.TABLE_CELL_END,
- // 表格开始
- ln.TABLE_ROW_END,
- // 表格开始
- ln.TABLE_END
- // 表格结束
- // DataStreamTreeTokenType.COLUMN_BREAK, // 换列
- // DataStreamTreeTokenType.PAGE_BREAK, // 换页
- // DataStreamTreeTokenType.DOCS_END, // 文档结尾
- // DataStreamTreeTokenType.TAB, // 制表符
- // DataStreamTreeTokenType.CUSTOM_BLOCK, // 图片 mention 等不参与文档流的场景
- ];
- var il = (t) => {
- const e = t.endsWith(`\r
- `) ? t.slice(0, -2) : t;
- return b_.reduce((n, r) => n.replaceAll(r, ""), e);
- };
- var S_ = (t) => t ? il(t).replaceAll("\r", "") === "" : true;
- var A_ = (t) => {
- const e = t.replace(/\n/g, "\r"), n = [], r = [];
- let s = 0, i = "";
- const o = (u, c = true) => {
- const l = e.slice(s, u);
- if (re.isLegalUrl(l)) {
- const h = qt(), d = `${l}`, f = {
- startIndex: s,
- endIndex: s + d.length - 1,
- rangeId: h,
- rangeType: mn.HYPERLINK,
- properties: {
- url: t
- }
- };
- r.push(f), i += d, s = u + 1, c && (i += "\r", n.push({ startIndex: u }));
- } else
- i += e.slice(s, u + 1), s = u + 1, c && n.push({ startIndex: u });
- };
- let a = 0;
- for (let u = 0; u < e.length; u++)
- e[u] === "\r" && (o(u), a = u);
- return (a !== e.length - 1 || e.length === 1) && o(e.length, false), {
- dataStream: i,
- paragraphs: n,
- customRanges: r
- };
- };
- function N_(t, e) {
- if (typeof e > "u")
- return { startOffset: t, endOffset: t, collapsed: true };
- if (e < t)
- throw new Error(`Cannot make a doc selection when endOffset ${e} is less than startOffset ${t}.`);
- return { startOffset: t, endOffset: e, collapsed: t === e };
- }
- function T_(t) {
- const { startOffset: e, endOffset: n, collapsed: r } = t, s = Math.min(e, n), i = Math.max(e, n);
- return {
- startOffset: s,
- endOffset: i,
- collapsed: r
- };
- }
- function M_(t, e, n, r) {
- return Math.max(t, n) <= Math.min(e, r);
- }
- var st = class {
- };
- C(st, "customRange", {
- add: d_,
- delete: h_,
- copyCustomRange: u_,
- getCustomRangesInterestsWithSelection: a_,
- isIntersecting: nl
- }), C(st, "customDecoration", {
- add: i_,
- delete: o_
- }), C(st, "selection", {
- replace: g_,
- makeSelection: N_,
- normalizeSelection: T_,
- delete: sl,
- replaceTextRuns: m_,
- retain: f_
- }), C(st, "range", {
- isIntersects: M_
- }), C(st, "transform", {
- getPlainText: il,
- fromPlainText: A_,
- isEmptyDocument: S_
- }), C(st, "paragraph", {
- bullet: {
- set: v_,
- switch: R_,
- toggleChecklist: I_,
- changeNestLevel: w_
- }
- }), C(st, "drawing", {
- add: C_
- });
- function D_(t) {
- if (t.customRanges || (t.customRanges = []), !t.paragraphs) {
- t.paragraphs = [];
- for (let e = 0; e < t.dataStream.length; e++)
- t.dataStream[e] === "\r" && t.paragraphs.push({ startIndex: e });
- }
- return t.customBlocks || (t.customBlocks = []), t.textRuns || (t.textRuns = []), t.customDecorations || (t.customDecorations = []), t.sectionBreaks || (t.sectionBreaks = []), t.tables || (t.tables = []), t;
- }
- function ol(t) {
- var e;
- return t.body = D_((e = t.body) != null ? e : { dataStream: "" }), t.drawingsOrder || (t.drawingsOrder = []), t.drawings || (t.drawings = {}), t.documentStyle || (t.documentStyle = {}), t;
- }
- var cr = class _cr {
- /**
- * Creates a new TextStyleValue instance
- * @param {ITextStyle} style The initial style object
- * @example
- * ```ts
- * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style);
- * ```
- */
- constructor(e = {}) {
- C(this, "_style");
- this._style = e;
- }
- /**
- * Creates an instance of TextStyleValue.
- * @param {ITextStyle} style style object
- * @returns {TextStyleValue} font style instance
- * @example
- * ```ts
- * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style);
- * ```
- */
- static create(e = {}) {
- return new _cr(e);
- }
- /**
- * Gets the font family
- * @returns {Nullable<string>} The font family name or undefined
- * @example
- * ```ts
- * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style.fontFamily);
- * ```
- */
- get fontFamily() {
- return this._style.ff;
- }
- /**
- * Gets the font size in points
- * @returns {number | undefined} The font size or undefined
- * @example
- * ```ts
- * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style.fontSize);
- * ```
- */
- get fontSize() {
- return this._style.fs;
- }
- /**
- * Gets whether the text is italic
- * @returns {boolean} True if italic, false otherwise
- * @example
- * ```ts
- * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style.italic);
- * ```
- */
- get italic() {
- return this._style.it === we.TRUE;
- }
- /**
- * Gets whether the text is bold
- * @returns {boolean} True if bold, false otherwise
- * @example
- * ```ts
- * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style.bold);
- * ```
- */
- get bold() {
- return this._style.bl === we.TRUE;
- }
- /**
- * Gets the underline decoration
- * @returns {TextDecorationBuilder | undefined} The underline decoration or undefined
- * @example
- * ```ts
- * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style.underline);
- * ```
- */
- get underline() {
- return this._style.ul && Jt.create(this._style.ul);
- }
- /**
- * Gets the bottom border line decoration
- * @returns {TextDecorationBuilder | undefined} The bottom border line decoration or undefined
- * @example
- * ```ts
- * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style.bottomBorderLine);
- * ```
- */
- get bottomBorderLine() {
- return this._style.bbl && Jt.create(this._style.bbl);
- }
- /**
- * Gets the strikethrough decoration
- * @returns {TextDecorationBuilder | undefined} The strikethrough decoration or undefined
- * @example
- * ```ts
- * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style.strikethrough);
- * ```
- */
- get strikethrough() {
- return this._style.st && Jt.create(this._style.st);
- }
- /**
- * Gets the overline decoration
- * @returns {TextDecorationBuilder | undefined} The overline decoration or undefined
- * @example
- * ```ts
- * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style.overline);
- * ```
- */
- get overline() {
- return this._style.ol && Jt.create(this._style.ol);
- }
- /**
- * Gets the background color
- * @returns {Nullable<IColorStyle>} The background color or null/undefined
- * @example
- * ```ts
- * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style.background);
- * ```
- */
- get background() {
- return this._style.bg;
- }
- /**
- * Gets the border settings
- * @returns {Nullable<IBorderData>} The border settings or null/undefined
- * @example
- * ```ts
- * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style.border);
- * ```
- */
- get border() {
- return this._style.bd;
- }
- /**
- * Gets the text color
- * @returns {Nullable<IColorStyle>} The text color or null/undefined
- * @example
- * ```ts
- * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style.color);
- * ```
- */
- get color() {
- return this._style.cl;
- }
- /**
- * Gets the vertical alignment (subscript/superscript)
- * @returns {Nullable<BaselineOffset>} The vertical alignment or null/undefined
- * @example
- * ```ts
- * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style.verticalAlign);
- * ```
- */
- get verticalAlign() {
- return this._style.va;
- }
- /**
- * Gets the number format pattern
- * @returns {Nullable<{ pattern: string }>} The number format pattern or null/undefined
- * @example
- * ```ts
- * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style.numberFormat);
- * ```
- */
- get numberFormat() {
- return this._style.n;
- }
- /**
- * Creates a copy of this font style as a builder
- * @returns {TextStyleBuilder} A new TextStyleBuilder instance with the same style
- * @example
- * ```ts
- * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * const copy = style.copy();
- * console.log(copy);
- * ```
- */
- copy() {
- return Qt.create(re.deepClone(this._style));
- }
- /**
- * Gets the raw style object
- * @returns {ITextStyle} The underlying style object
- * @example
- * ```ts
- * const style = TextStyleValue.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style.getValue());
- * ```
- */
- getValue() {
- return { ...this._style };
- }
- };
- var Qt = class _Qt extends cr {
- /**
- * Creates a new TextStyleBuilder instance
- * @param {ITextStyle} style Initial style object
- * @returns {TextStyleBuilder} A new TextStyleBuilder instance
- * @example
- * ```ts
- * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style);
- * ```
- */
- static create(e = {}) {
- return new _Qt(e);
- }
- /**
- * Creates a new TextStyleBuilder instance
- * @param {ITextStyle} style The initial style object
- * @example
- * ```ts
- * const style = new TextStyleBuilder({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * console.log(style);
- * ```
- */
- constructor(e = {}) {
- super(e);
- }
- /**
- * Sets the font family
- * @param {string} family The font family name
- * @returns {TextStyleBuilder} The builder instance for chaining
- * @example
- * ```ts
- * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * style.setFontFamily('Times New Roman');
- * console.log(style.fontFamily);
- * ```
- */
- setFontFamily(e) {
- return this._style.ff = e, this;
- }
- /**
- * Sets the font size in points
- * @param {number} size The font size
- * @returns {TextStyleBuilder} The builder instance for chaining
- * @example
- * ```ts
- * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * style.setFontSize(14);
- * console.log(style.fontSize);
- * ```
- */
- setFontSize(e) {
- return this._style.fs = e, this;
- }
- /**
- * Sets the italic style
- * @param {boolean} value True to make italic, false otherwise
- * @returns {TextStyleBuilder} The builder instance for chaining
- * @example
- * ```ts
- * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * style.setItalic(true);
- * console.log(style.italic);
- * ```
- */
- setItalic(e) {
- return this._style.it = e ? 1 : 0, this;
- }
- /**
- * Sets the bold style
- * @param {boolean} value True to make bold, false otherwise
- * @returns {TextStyleBuilder} The builder instance for chaining
- * @example
- * ```ts
- * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * style.setBold(true);
- * console.log(style.bold);
- * ```
- */
- setBold(e) {
- return this._style.bl = e ? 1 : 0, this;
- }
- /**
- * Sets the underline decoration
- * @param {TextDecorationBuilder} decoration The underline decoration settings
- * @returns {TextStyleBuilder} The builder instance for chaining
- * @example
- * ```ts
- * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * style.setUnderline({ type: 'single', color: '#FF0000' });
- * console.log(style.underline);
- * ```
- */
- setUnderline(e) {
- return this._style.ul = e.build(), this;
- }
- /**
- * Sets the bottom border line decoration
- * @param {TextDecorationBuilder} decoration The bottom border line decoration settings
- * @returns {TextStyleBuilder} The builder instance for chaining
- * @example
- * ```ts
- * const style = TextStyleBuilder.create({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * style.setBottomBorderLine({ type: 'single', color: '#FF0000' });
- * console.log(style.bottomBorderLine);
- * ```
- */
- setBottomBorderLine(e) {
- return this._style.bbl = e.build(), this;
- }
- /**
- * Sets the strikethrough decoration
- * @param {TextDecorationBuilder} decoration The strikethrough decoration settings
- * @returns {TextStyleBuilder} The builder instance for chaining
- */
- setStrikethrough(e) {
- return this._style.st = e.build(), this;
- }
- /**
- * Sets the overline decoration
- * @param {TextDecorationBuilder} decoration The overline decoration settings
- * @returns {TextStyleBuilder} The builder instance for chaining
- */
- setOverline(e) {
- return this._style.ol = e.build(), this;
- }
- /**
- * Sets the background color
- * @param {IColorStyle | null} color The background color or null to remove
- * @returns {TextStyleBuilder} The builder instance for chaining
- */
- setBackground(e) {
- return this._style.bg = e, this;
- }
- /**
- * Sets the border settings
- * @param {IBorderData | null} border The border settings or null to remove
- * @returns {TextStyleBuilder} The builder instance for chaining
- */
- setBorder(e) {
- return this._style.bd = e, this;
- }
- /**
- * Sets the text color
- * @param {IColorStyle | null} color The text color or null to remove
- * @returns {TextStyleBuilder} The builder instance for chaining
- */
- setColor(e) {
- return this._style.cl = e, this;
- }
- /**
- * Sets the vertical alignment (subscript/superscript)
- * @param {BaselineOffset | null} offset The vertical alignment or null to remove
- * @returns {TextStyleBuilder} The builder instance for chaining
- */
- setVerticalAlign(e) {
- return this._style.va = e, this;
- }
- /**
- * Creates a copy of this font style builder
- * @returns {TextStyleBuilder} A new TextStyleBuilder instance with the same style
- */
- copy() {
- return _Qt.create(re.deepClone(this._style));
- }
- /**
- * Builds and returns the final style object
- * @returns {ITextStyle} The complete style object
- */
- build() {
- return this.getValue();
- }
- };
- var Jt = class _Jt {
- /**
- * Creates a new TextDecorationBuilder instance
- * @param {ITextDecoration} decoration The initial decoration object
- * @example
- * ```ts
- * const decoration = new TextDecorationBuilder({ s: 1, t: TextDecoration.SINGLE });
- * ```
- */
- constructor(e = { s: 1 }) {
- C(this, "_decoration");
- this._decoration = e;
- }
- /**
- * Creates an instance of TextDecorationBuilder.
- * @param {ITextDecoration} decoration Initial decoration object
- * @returns {TextDecorationBuilder} text decoration builder instance
- * @example
- * ```ts
- * const decoration = TextDecorationBuilder.create({ s: 1, t: TextDecoration.SINGLE });
- * console.log(decoration);
- * ```
- */
- static create(e = { s: 1 }) {
- return new _Jt(e);
- }
- /**
- * Gets whether the decoration is shown
- * @returns {boolean} True if the decoration is shown
- */
- get show() {
- return this._decoration.s === we.TRUE;
- }
- /**
- * Gets whether the decoration color follows the font color
- * @returns {boolean} True if the decoration color follows the font color
- */
- get followFontColor() {
- return this._decoration.c === we.TRUE;
- }
- /**
- * Gets the decoration color
- * @returns {Nullable<IColorStyle>} The decoration color
- */
- get color() {
- return this._decoration.cl;
- }
- /**
- * Gets the decoration line type
- * @returns {Nullable<TextDecoration>} The decoration line type
- */
- get type() {
- return this._decoration.t;
- }
- /**
- * Sets whether the decoration is shown
- * @param {boolean} value True to show the decoration
- * @returns {TextDecorationBuilder} The builder instance for chaining
- * @example
- * ```ts
- * decoration.setShow(true);
- * ```
- */
- setShow(e) {
- return this._decoration.s = e ? 1 : 0, this;
- }
- /**
- * Sets whether the decoration color follows the font color
- * @param {boolean} value True to follow font color
- * @returns {TextDecorationBuilder} The builder instance for chaining
- * @example
- * ```ts
- * decoration.setFollowFontColor(false);
- * ```
- */
- setFollowFontColor(e) {
- return this._decoration.c = e ? 1 : 0, this;
- }
- /**
- * Sets the decoration color
- * @param {IColorStyle} color The color style
- * @returns {TextDecorationBuilder} The builder instance for chaining
- * @example
- * ```ts
- * decoration.setColor({ rgb: '#FF0000' });
- * ```
- */
- setColor(e) {
- return this._decoration.cl = e, this;
- }
- /**
- * Sets the decoration line type
- * @param {TextDecoration} type The line type
- * @returns {TextDecorationBuilder} The builder instance for chaining
- * @example
- * ```ts
- * decoration.setLineType(TextDecoration.SINGLE);
- * ```
- */
- setLineType(e) {
- return this._decoration.t = e, this;
- }
- /**
- * Creates a copy of this text decoration builder
- * @returns {TextDecorationBuilder} A new TextDecorationBuilder instance with the same decoration
- * @example
- * ```ts
- * const copy = decoration.copy();
- * ```
- */
- copy() {
- return _Jt.create(re.deepClone(this._decoration));
- }
- /**
- * Builds and returns the final decoration object
- * @returns {ITextDecoration} The complete text decoration object
- * @example
- * ```ts
- * const style = decoration.build();
- * ```
- */
- build() {
- return { ...this._decoration };
- }
- };
- var hr = class _hr {
- constructor(e = {}) {
- C(this, "_style");
- this._style = e;
- }
- /**
- * Creates a new ParagraphStyleValue instance
- * @param {IParagraphStyle} style The initial style object
- * @returns A new ParagraphStyleValue instance
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * ```
- */
- static create(e = {}) {
- return new _hr(e);
- }
- /**
- * Gets the first line indent
- * @returns {Nullable<INumberUnit>} The first line indent
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.indentFirstLine);
- * ```
- */
- get indentFirstLine() {
- return this._style.indentFirstLine;
- }
- /**
- * Gets the hanging indent
- * @returns {Nullable<INumberUnit>} The hanging indent
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.hanging);
- * ```
- */
- get hanging() {
- return this._style.hanging;
- }
- /**
- * Gets the indent start
- * @returns {Nullable<INumberUnit>} The indent start
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.indentStart);
- * ```
- */
- get indentStart() {
- return this._style.indentStart;
- }
- /**
- * Gets the indent end
- * @returns {Nullable<INumberUnit>} The indent end
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.indentEnd);
- * ```
- */
- get tabStops() {
- return this._style.tabStops;
- }
- /**
- * Gets the indent end
- * @returns {Nullable<INumberUnit>} The indent end
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.indentEnd);
- * ```
- */
- get indentEnd() {
- return this._style.indentEnd;
- }
- /**
- * Gets the text style
- * @returns {Nullable<ITextStyle>} The text style
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.textStyle);
- * ```
- */
- get textStyle() {
- return this._style.textStyle;
- }
- /**
- * Gets the heading id
- * @returns {Nullable<string>} The heading id
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.headingId);
- * ```
- */
- get headingId() {
- return this._style.headingId;
- }
- /**
- * Gets the named style type
- * @returns {Nullable<NamedStyleType>} The named style type
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.namedStyleType);
- * ```
- */
- get namedStyleType() {
- return this._style.namedStyleType;
- }
- /**
- * Gets the horizontal align
- * @returns {Nullable<HorizontalAlign>} The horizontal align
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.horizontalAlign);
- * ```
- */
- get horizontalAlign() {
- return this._style.horizontalAlign;
- }
- /**
- * Gets the line spacing
- * @returns {Nullable<number>} The line spacing
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.lineSpacing);
- * ```
- */
- get lineSpacing() {
- return this._style.lineSpacing;
- }
- /**
- * Gets the text direction
- * @returns {Nullable<TextDirection>} The text direction
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.direction);
- * ```
- */
- get direction() {
- return this._style.direction;
- }
- /**
- * Gets the spacing rule
- * @returns {Nullable<SpacingRule>} The spacing rule
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.spacingRule);
- * ```
- */
- get spacingRule() {
- return this._style.spacingRule;
- }
- /**
- * Gets the snap to grid
- * @returns {Nullable<BooleanNumber>} The snap to grid
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.snapToGrid);
- * ```
- */
- get snapToGrid() {
- return this._style.snapToGrid;
- }
- /**
- * Gets the space above
- * @returns {Nullable<INumberUnit>} The space above
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.spaceAbove);
- * ```
- */
- get spaceAbove() {
- return this._style.spaceAbove;
- }
- /**
- * Gets the space below
- * @returns {Nullable<INumberUnit>} The space below
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.spaceBelow);
- * ```
- */
- get spaceBelow() {
- return this._style.spaceBelow;
- }
- /**
- * Gets the border between
- * @returns {Nullable<IParagraphBorder>} The border between
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.borderBetween);
- * ```
- */
- get borderBetween() {
- return this._style.borderBetween;
- }
- /**
- * Gets the border top
- * @returns {Nullable<IParagraphBorder>} The border top
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.borderTop);
- * ```
- */
- get borderTop() {
- return this._style.borderTop;
- }
- /**
- * Gets the border bottom
- * @returns {Nullable<IParagraphBorder>} The border bottom
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.borderBottom);
- * ```
- */
- get borderBottom() {
- return this._style.borderBottom;
- }
- /**
- * Gets the border left
- * @returns {Nullable<IParagraphBorder>} The border left
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.borderLeft);
- * ```
- */
- get borderLeft() {
- return this._style.borderLeft;
- }
- /**
- * Gets the border right
- * @returns {Nullable<IParagraphBorder>} The border right
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.borderRight);
- * ```
- */
- get borderRight() {
- return this._style.borderRight;
- }
- /**
- * Gets the keep lines
- * @returns {boolean} The keep lines
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.keepLines);
- * ```
- */
- get keepLines() {
- return this._style.keepLines === we.TRUE;
- }
- /**
- * Gets the keep next
- * @returns {boolean} The keep next
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.keepNext);
- * ```
- */
- get keepNext() {
- return this._style.keepNext === we.TRUE;
- }
- /**
- * Gets the word wrap
- * @returns {boolean} The word wrap
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.wordWrap);
- * ```
- */
- get wordWrap() {
- return this._style.wordWrap === we.TRUE;
- }
- /**
- * Gets the widow control
- * @returns {boolean} The widow control
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.widowControl);
- * ```
- */
- get widowControl() {
- return this._style.widowControl === we.TRUE;
- }
- /**
- * Gets the shading
- * @returns {Nullable<IShading>} The shading
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.shading);
- * ```
- */
- get shading() {
- return this._style.shading;
- }
- /**
- * Gets the suppress hyphenation
- * @returns {boolean} The suppress hyphenation
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.suppressHyphenation);
- * ```
- */
- get suppressHyphenation() {
- return this._style.suppressHyphenation === we.TRUE;
- }
- /**
- * Creates a copy of the paragraph style
- * @returns {ParagraphStyleBuilder} The copy
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * ```
- */
- copy() {
- return nr.create(re.deepClone(this._style));
- }
- /**
- * Gets the value
- * @returns {IParagraphStyle} The value
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * console.log(style.getValue());
- * ```
- */
- getValue() {
- return this._style;
- }
- };
- var nr = class _nr extends hr {
- /**
- * Creates a new paragraph style builder
- * @param style The paragraph style
- * @returns A new paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * ```
- */
- static create(e = {}) {
- return new _nr(e);
- }
- constructor(e = {}) {
- super(e);
- }
- /**
- * Sets the indent first line
- * @param value The indent first line
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setIndentFirstLine(10);
- * ```
- */
- setIndentFirstLine(e) {
- return this._style.indentFirstLine = e, this;
- }
- /**
- * Sets the hanging
- * @param value The hanging
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setHanging(10);
- * ```
- */
- setHanging(e) {
- return this._style.hanging = e, this;
- }
- /**
- * Sets the indent start
- * @param value The indent start
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setIndentStart(10);
- * ```
- */
- setIndentStart(e) {
- return this._style.indentStart = e, this;
- }
- /**
- * Sets the tab stops
- * @param value The tab stops
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setTabStops([{ value: 10 }]);
- * ```
- */
- setTabStops(e) {
- return this._style.tabStops = e, this;
- }
- /**
- * Sets the indent end
- * @param value The indent end
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setIndentEnd(10);
- * ```
- */
- setIndentEnd(e) {
- return this._style.indentEnd = e, this;
- }
- /**
- * Sets the text style
- * @param value The text style
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setTextStyle({ ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE });
- * ```
- */
- setTextStyle(e) {
- return this._style.textStyle = e, this;
- }
- /**
- * Sets the heading id
- * @param value The heading id
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setHeadingId('test');
- * ```
- */
- setHeadingId(e) {
- return this._style.headingId = e, this;
- }
- /**
- * Sets the named style type
- * @param value The named style type
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setNamedStyleType(NamedStyleType.CHAPTER);
- * ```
- */
- setNamedStyleType(e) {
- return this._style.namedStyleType = e, this;
- }
- /**
- * Sets the vertical align
- * @param value The vertical align
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setVerticalAlign(VerticalAlign.CENTER);
- * ```
- */
- setHorizontalAlign(e) {
- return this._style.horizontalAlign = e, this;
- }
- /**
- * Sets the line spacing
- * @param value The line spacing
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setLineSpacing(10);
- * ```
- */
- setLineSpacing(e) {
- return this._style.lineSpacing = e, this;
- }
- /**
- * Sets the text direction
- * @param value The text direction
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setTextDirection(TextDirection.RIGHT_TO_LEFT);
- * ```
- */
- setDirection(e) {
- return this._style.direction = e, this;
- }
- /**
- * Sets the spacing rule
- * @param value The spacing rule
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setSpacingRule(SpacingRule.AUTO);
- * ```
- */
- setSpacingRule(e) {
- return this._style.spacingRule = e, this;
- }
- /**
- * Sets the snap to grid
- * @param value The snap to grid
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setSnapToGrid(true);
- * ```
- */
- setSnapToGrid(e) {
- return this._style.snapToGrid = e ? 1 : 0, this;
- }
- /**
- * Sets the space above
- * @param value The space above
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setSpaceAbove(10);
- * ```
- */
- setSpaceAbove(e) {
- return this._style.spaceAbove = e, this;
- }
- /**
- * Sets the space below
- * @param value The space below
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setSpaceBelow(10);
- * ```
- */
- setSpaceBelow(e) {
- return this._style.spaceBelow = e, this;
- }
- /**
- * Sets the border between
- * @param {IParagraphBorder} value The border between
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setBorderBetween({ color: 'red', width: 1 });
- * ```
- */
- setBorderBetween(e) {
- return this._style.borderBetween = e, this;
- }
- /**
- * Sets the border top
- * @param {IParagraphBorder} value The border top
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setBorderTop({ color: 'red', width: 1 });
- * ```
- */
- setBorderTop(e) {
- return this._style.borderTop = e, this;
- }
- /**
- * Sets the border bottom
- * @param {IParagraphBorder} value The border bottom
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setBorderBottom({ color: 'red', width: 1 });
- * ```
- */
- setBorderBottom(e) {
- return this._style.borderBottom = e, this;
- }
- /**
- * Sets the border left
- * @param {IParagraphBorder} value The border left
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setBorderLeft({ color: 'red', width: 1 });
- * ```
- */
- setBorderLeft(e) {
- return this._style.borderLeft = e, this;
- }
- /**
- * Sets the border right
- * @param {IParagraphBorder} value The border right
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setBorderRight({ color: 'red', width: 1 });
- * ```
- */
- setBorderRight(e) {
- return this._style.borderRight = e, this;
- }
- /**
- * Sets the keep lines
- * @param value The keep lines
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setKeepLines(true);
- * ```
- */
- setKeepLines(e) {
- return this._style.keepLines = e ? 1 : 0, this;
- }
- /**
- * Sets the keep next
- * @param value The keep next
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setKeepNext(true);
- * ```
- */
- setKeepNext(e) {
- return this._style.keepNext = e ? 1 : 0, this;
- }
- /**
- * Sets the word wrap
- * @param value The word wrap
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setWordWrap(true);
- * ```
- */
- setWordWrap(e) {
- return this._style.wordWrap = e ? 1 : 0, this;
- }
- /**
- * Sets the widow control
- * @param {boolean} value The widow control value
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setWidowControl(true);
- * ```
- */
- setWidowControl(e) {
- return this._style.widowControl = e ? 1 : 0, this;
- }
- /**
- * Sets the shading style
- * @param {IShading} value The shading configuration
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setShading({ backgroundColor: '#f0f0f0' });
- * ```
- */
- setShading(e) {
- return this._style.shading = e, this;
- }
- /**
- * Sets whether to suppress hyphenation
- * @param {boolean} value The suppress hyphenation value
- * @returns {ParagraphStyleBuilder} The paragraph style builder
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * copy.setSuppressHyphenation(true);
- * ```
- */
- setSuppressHyphenation(e) {
- return this._style.suppressHyphenation = e ? 1 : 0, this;
- }
- /**
- * Creates a copy of the current paragraph style builder
- * @returns {ParagraphStyleBuilder} A new instance of ParagraphStyleBuilder with the same settings
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const copy = style.copy();
- * ```
- */
- copy() {
- return _nr.create(re.deepClone(this._style));
- }
- /**
- * Builds and returns the final paragraph style configuration
- * @returns {IParagraphStyle} The constructed paragraph style object
- * @example
- * ```ts
- * const style = ParagraphStyleValue.create({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
- * const finalStyle = style.build();
- * ```
- */
- build() {
- return this.getValue();
- }
- };
- var Zt = class _Zt {
- constructor(e) {
- C(this, "_data");
- if (!e.body)
- throw new Error("Invalid document data, body is required");
- this._data = ol(e);
- }
- /**
- * Creates a new RichTextValue instance
- * @param {IDocumentData} data The initial data for the rich text value
- * @returns {RichTextValue} A new RichTextValue instance
- * @example
- * ```ts
- * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
- * ```
- */
- static create(e) {
- return new _Zt(e);
- }
- /**
- * Creates a new RichTextValue instance
- * @param {IDocumentBody} data The initial data for the rich text value
- * @returns {RichTextValue} A new RichTextValue instance
- * @example
- * ```ts
- * const richText = RichTextValue.createByBody({ dataStream: 'Hello World\r\n' });
- * ```
- */
- static createByBody(e) {
- return new _Zt({ body: e, id: "d", documentStyle: {} });
- }
- /**
- * Creates a copy of the current RichTextValue instance
- * @returns {RichTextValue} A new instance of RichTextValue with the same data
- * @example
- * ```ts
- * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
- * const copy = richText.copy();
- * ```
- */
- copy() {
- return gn.create(re.deepClone(this._data));
- }
- /**
- * Slices the current RichTextValue instance
- * @param {number} start The start index
- * @param {number} end The end index
- * @returns {RichTextBuilder} A new instance of RichTextBuilder with the sliced data
- * @example
- * ```ts
- * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
- * const sliced = richText.slice(0, 5);
- * ```
- */
- slice(e, n) {
- const { body: r, ...s } = this._data;
- return gn.create({
- ...re.deepClone(s),
- body: Dt(r, e, n)
- });
- }
- /**
- * Converts the current RichTextValue instance to plain text
- * @returns {string} The plain text representation of the current RichTextValue instance
- * @example
- * ```ts
- * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
- * const plainText = richText.toPlainText();
- * ```
- */
- toPlainText() {
- var e, n;
- return st.transform.getPlainText((n = (e = this._data.body) == null ? void 0 : e.dataStream) != null ? n : "").replaceAll("\r", `
- `);
- }
- /**
- * Gets the paragraph style of the current RichTextValue instance
- * @returns {ParagraphStyleValue} The paragraph style of the current RichTextValue instance
- * @example
- * ```ts
- * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
- * const style = richText.getParagraphStyle();
- * ```
- */
- getParagraphStyle() {
- var e, n;
- return hr.create((n = (e = this._data.body) == null ? void 0 : e.paragraphs) == null ? void 0 : n[0].paragraphStyle);
- }
- /**
- * Gets the paragraph bullet of the current RichTextValue instance
- * @returns {ParagraphBulletValue} The paragraph bullet of the current RichTextValue instance
- * @example
- * ```ts
- * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
- * const bullet = richText.getParagraphBullet();
- * ```
- */
- getParagraphBullet() {
- var e, n;
- return (n = (e = this._data.body) == null ? void 0 : e.paragraphs) == null ? void 0 : n[0].bullet;
- }
- /**
- * Gets the paragraphs of the current RichTextValue instance
- * @returns {RichTextValue[]} The paragraphs of the current RichTextValue instance
- * @example
- * ```ts
- * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
- * const paragraphs = richText.getParagraphs();
- * ```
- */
- getParagraphs() {
- var r, s;
- const e = (s = (r = this._data.body) == null ? void 0 : r.paragraphs) != null ? s : [];
- let n = 0;
- return e.map((i) => {
- const o = this.slice(n, i.startIndex);
- return n = i.startIndex, o;
- });
- }
- /**
- * Gets the text runs of the current RichTextValue instance
- * @returns {TextRunValue[]} The text runs of the current RichTextValue instance
- * @example
- * ```ts
- * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
- * const textRuns = richText.getTextRuns();
- * ```
- */
- getTextRuns() {
- var e, n;
- return ((n = (e = this._data.body) == null ? void 0 : e.textRuns) != null ? n : []).map((r) => ({
- ...r,
- ts: r.ts ? cr.create(r.ts) : null
- }));
- }
- /**
- * Gets the links of the current RichTextValue instance
- * @returns {ICustomRange[]} The links of the current RichTextValue instance
- * @example
- * ```ts
- * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
- * const links = richText.getLinks();
- * ```
- */
- getLinks() {
- var e, n, r;
- return (r = (n = (e = this._data.body) == null ? void 0 : e.customRanges) == null ? void 0 : n.filter((s) => s.rangeType === mn.HYPERLINK)) != null ? r : [];
- }
- /**
- * Gets the data of the current RichTextValue instance
- * @returns {IDocumentData} The data of the current RichTextValue instance
- * @example
- * ```ts
- * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
- * const data = richText.getData();
- * ```
- */
- getData() {
- return this._data;
- }
- };
- var gn = class _gn extends Zt {
- constructor(n) {
- super(n);
- C(this, "_doc");
- this._doc = new jt(n);
- }
- static newEmptyData() {
- return ol({
- id: "d",
- documentStyle: {},
- drawings: {},
- drawingsOrder: [],
- body: {
- dataStream: `\r
- `,
- customBlocks: [],
- customRanges: [],
- paragraphs: [{ startIndex: 0 }],
- textRuns: [],
- tables: [],
- sectionBreaks: []
- }
- });
- }
- /**
- * Creates a new RichTextBuilder instance
- * @param {IDocumentData} data The initial data for the rich text builder
- * @returns {RichTextBuilder} A new RichTextBuilder instance
- */
- static create(n) {
- return new _gn(n != null ? n : _gn.newEmptyData());
- }
- insertText(n, r, s) {
- var l, h;
- let i = ((h = (l = this._data.body) == null ? void 0 : l.dataStream.length) != null ? h : 2) - 2, o, a;
- 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)
- return this;
- const u = {
- dataStream: o,
- textRuns: a ? [
- {
- ts: a,
- st: i,
- ed: i + o.length
- }
- ] : []
- }, c = st.selection.replace({
- doc: this._doc,
- selection: { startOffset: i, endOffset: i, collapsed: true },
- body: u
- });
- if (!c)
- throw new Error("Insert text failed, please check.");
- return Ke.apply(this._doc.getBody(), c.serialize()), this;
- }
- insertRichText(n, r) {
- var a, u;
- let s = ((u = (a = this._data.body) == null ? void 0 : a.dataStream.length) != null ? u : 2) - 2, i;
- typeof n == "object" ? i = n instanceof Zt ? n.getData() : n : (s = Math.min(n, s), i = r instanceof Zt ? r.getData() : r);
- const o = st.selection.replace({
- doc: this._doc,
- selection: { startOffset: s, endOffset: s, collapsed: true },
- body: i.body
- });
- if (!o)
- throw new Error("Insert text failed, please check.");
- return Ke.apply(this._doc.getBody(), o.serialize()), this;
- }
- delete(n, r) {
- if (r !== void 0) {
- if (!r)
- return this;
- const s = st.selection.delete([{ startOffset: n, endOffset: n + r, collapsed: true }], this._data.body);
- Ke.apply(this._doc.getBody(), s);
- }
- return this;
- }
- /**
- * Sets the style of the text at the specified start and end positions
- * @param {number} start The start position of the text to set the style
- * @param {number} end The end position of the text to set the style
- * @param {TextStyleBuilder | ITextStyle} style The style to set
- * @returns {RichTextBuilder} The current RichTextBuilder instance
- * @example
- * ```ts
- * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
- * const newRichText = richText.setStyle(5, 10, { ff: 'Arial', fs: 12 });
- * ```
- */
- setStyle(n, r, s) {
- const i = {
- dataStream: "",
- textRuns: [{
- ts: s instanceof Qt ? s.build() : s,
- st: 0,
- ed: r - n
- }]
- }, o = st.selection.retain([{ startOffset: n, endOffset: r, collapsed: true }], i);
- return Ke.apply(this._doc.getBody(), o), this;
- }
- /**
- * Sets the link of the text at the specified start and end positions
- * @param {number} start The start position of the text to set the link
- * @param {number} end The end position of the text to set the link
- * @param {string} link The link to set
- * @returns {RichTextBuilder} The current RichTextBuilder instance
- * @example
- * ```ts
- * const richText = RichTextValue.create({ body: { dataStream: 'Hello World\r\n' } });
- * const newRichText = richText.setLink(5, 10, 'https://www.example.com');
- * ```
- */
- setLink(n, r, s) {
- const i = st.customRange.add({
- rangeType: mn.HYPERLINK,
- rangeId: qt(),
- properties: {
- url: s
- },
- ranges: [{ startOffset: n, endOffset: r, collapsed: false }],
- body: this._data.body
- });
- if (!i)
- throw new Error("Insert text failed, please check.");
- return Ke.apply(this._doc.getBody(), i.serialize()), this;
- }
- cancelLink(n, r) {
- if (typeof n == "string") {
- const s = st.customRange.delete({
- rangeId: n,
- documentDataModel: this._doc
- });
- if (!s)
- throw new Error("Insert text failed, please check.");
- Ke.apply(this._doc.getBody(), s.serialize());
- } else
- this.slice(n, r).getLinks().forEach((i) => {
- const o = st.customRange.delete({
- rangeId: i.rangeId,
- documentDataModel: this._doc
- });
- if (!o)
- throw new Error("Insert text failed, please check.");
- Ke.apply(this._doc.getBody(), o.serialize());
- });
- return this;
- }
- updateLink(n, r) {
- var i, o;
- const s = (o = (i = this._data.body) == null ? void 0 : i.customRanges) == null ? void 0 : o.find((a) => a.rangeId === n);
- if (!s)
- throw new Error("Link not found");
- return s.properties.url = r, this;
- }
- insertParagraph(n, r) {
- var o, a;
- let s, i;
- return typeof n == "object" ? (s = {
- dataStream: "\r",
- paragraphs: [{
- startIndex: 0,
- paragraphStyle: n.build()
- }]
- }, i = ((a = (o = this._data.body) == null ? void 0 : o.dataStream.length) != null ? a : 2) - 2) : (i = n, s = {
- dataStream: "\r",
- paragraphs: [{
- startIndex: 0,
- paragraphStyle: r == null ? void 0 : r.build()
- }]
- }), this.insertRichText(i, Zt.create({ body: s, id: "d", documentStyle: {} })), this;
- }
- insertLink(n, r, s) {
- let i = "", o = "";
- typeof n == "string" ? (i = n, o = r) : (i = r, o = s);
- const a = _gn.createByBody({
- dataStream: i,
- customRanges: [{
- rangeType: mn.HYPERLINK,
- rangeId: qt(),
- properties: {
- url: o
- },
- startIndex: 0,
- endIndex: i.length - 1
- }]
- });
- return typeof n == "number" ? this.insertRichText(n, a) : this.insertRichText(a);
- }
- };
- function tR(t, e = 16) {
- let n = 0, r = null;
- return function(...i) {
- const o = Date.now();
- o - n < e ? (r && clearTimeout(r), r = setTimeout(() => {
- n = o, t.apply(this, i);
- }, e)) : (n = o, t.apply(this, i));
- };
- }
- var Vn = ((t) => (t[t.Style = 1] = "Style", t[t.Value = 2] = "Value", t))(Vn || {});
- function nR(t) {
- return `sheet_interceptor_${t}`;
- }
- var x_ = (t) => function(e, n) {
- let r = -1, s = e;
- for (let i = 0; i <= t.length; i++) {
- if (i <= r)
- throw new Error("[SheetInterceptorService]: next() called multiple times!");
- if (r = i, i === t.length)
- return s;
- const o = t[i];
- let a = false;
- if (s = o.handler(s, n, (u) => (a = true, u)), !a)
- break;
- }
- return s;
- };
- var rR = class {
- constructor(e) {
- C(this, "_interceptorsByName", /* @__PURE__ */ new Map());
- C(this, "_interceptorPoints");
- this._interceptorPoints = e;
- }
- /**
- * Get the interceptors.
- * @param name Name of the intercepted point.
- * @param filter A callback function to filter the interceptors.
- * @returns It will return a composed interceptor function. If you will perform the interceptor repeatedly,
- * you should cache the result instead of calling this function multiple times.
- */
- fetchThroughInterceptors(e, n) {
- const r = e;
- let s = this._interceptorsByName.get(r);
- return n && (s = s.filter(n)), x_(s || []);
- }
- intercept(e, n) {
- const r = e;
- this._interceptorsByName.has(r) || this._interceptorsByName.set(r, []);
- const s = this._interceptorsByName.get(r);
- return s.push(n), this._interceptorsByName.set(
- r,
- s.sort((i, o) => {
- var a, u;
- return ((a = o.priority) != null ? a : 0) - ((u = i.priority) != null ? u : 0);
- })
- // from large to small
- ), () => cs(this._interceptorsByName.get(r), n);
- }
- getInterceptPoints() {
- return this._interceptorPoints;
- }
- dispose() {
- this._interceptorsByName.clear();
- }
- };
- function sR(t) {
- return `sheet_async_interceptor_${t}`;
- }
- var L_ = (t) => async function(e, n) {
- let r = -1, s = e;
- for (let i = 0; i <= t.length; i++) {
- if (i <= r)
- throw new Error("[SheetInterceptorService]: next() called multiple times!");
- if (r = i, i === t.length)
- return s;
- const o = t[i];
- let a = false;
- if (s = await o.handler(s, n, async (u) => (a = true, u)), !a)
- break;
- }
- return s;
- };
- var iR = class {
- constructor(e) {
- C(this, "_asyncInterceptorsByName", /* @__PURE__ */ new Map());
- C(this, "_asyncInterceptorPoints");
- this._asyncInterceptorPoints = e;
- }
- /**
- * Get the interceptors.
- * @param name Name of the intercepted point.
- * @param filter A callback function to filter the interceptors.
- * @returns It will return a composed interceptor function. If you will perform the interceptor repeatedly,
- * you should cache the result instead of calling this function multiple times.
- */
- fetchThroughAsyncInterceptors(e, n) {
- const r = e;
- let s = this._asyncInterceptorsByName.get(r);
- return n && (s = s.filter(n)), L_(s || []);
- }
- async interceptAsync(e, n) {
- const r = e;
- this._asyncInterceptorsByName.has(r) || this._asyncInterceptorsByName.set(r, []);
- const s = this._asyncInterceptorsByName.get(r);
- return s.push(n), this._asyncInterceptorsByName.set(
- r,
- s.sort((i, o) => {
- var a, u;
- return ((a = o.priority) != null ? a : 0) - ((u = i.priority) != null ? u : 0);
- })
- // from large to small
- ), () => cs(this._asyncInterceptorsByName.get(r), n);
- }
- getInterceptPoints() {
- return this._asyncInterceptorPoints;
- }
- dispose() {
- this._asyncInterceptorsByName.clear();
- }
- };
- function oR(t, e) {
- for (const n in e)
- e.hasOwnProperty(n) && (t[n] = e[n]);
- }
- var Fi = class extends nt {
- static extend(e) {
- Object.getOwnPropertyNames(e.prototype).forEach((n) => {
- n !== "constructor" && (this.prototype[n] = e.prototype[n]);
- }), Object.getOwnPropertyNames(e).forEach((n) => {
- n !== "prototype" && n !== "name" && n !== "length" && (this[n] = e[n]);
- });
- }
- };
- var Ds = Symbol("initializers");
- var al = class extends nt {
- constructor(e) {
- super(), this._injector = e;
- const n = this, r = Object.getPrototypeOf(this)[Ds];
- r && r.forEach(function(s) {
- s.apply(n, [e]);
- });
- }
- _initialize(e) {
- }
- static extend(e) {
- Object.getOwnPropertyNames(e.prototype).forEach((n) => {
- if (n === "_initialize") {
- let r = this.prototype[Ds];
- r || (r = [], this.prototype[Ds] = r), r.push(e.prototype._initialize);
- } else
- n !== "constructor" && (this.prototype[n] = e.prototype[n]);
- }), Object.getOwnPropertyNames(e).forEach((n) => {
- n !== "prototype" && n !== "name" && n !== "length" && (this[n] = e[n]);
- });
- }
- };
- var $i = class _$i {
- constructor() {
- C(this, "_data", []);
- }
- static create() {
- return new _$i();
- }
- add(e) {
- this._data.indexOf(e) > -1 || this._data.push(e);
- }
- delete(e) {
- const n = this._data.indexOf(e);
- this._data.splice(n, 1);
- }
- getData() {
- return this._data;
- }
- };
- var ul = class _ul {
- constructor() {
- C(this, "_data", /* @__PURE__ */ new Map());
- }
- static create() {
- return new _ul();
- }
- add(e, n) {
- this._data.has(e) || this._data.set(e, n);
- }
- delete(e) {
- this._data.delete(e);
- }
- getData() {
- return this._data;
- }
- };
- var U_ = "0.5.5";
- function P_(t = "", e = ur.ZH_CN, n = "") {
- return {
- id: t,
- sheetOrder: [],
- name: n,
- appVersion: U_,
- locale: e,
- styles: {},
- sheets: {},
- resources: []
- };
- }
- var k_ = class {
- constructor(e = {}) {
- C(this, "_styles");
- C(this, "_cacheMap", new Qr(1e5));
- this._styles = e, this._generateCacheMap();
- }
- each(e) {
- return Object.entries(this._styles).forEach(e), this;
- }
- search(e, n) {
- if (this._cacheMap.has(n))
- return this._cacheMap.get(n);
- const r = this._getExistingStyleId(e);
- return r || "-1";
- }
- get(e) {
- return typeof e != "string" ? e : (e = String(e), this._styles[e]);
- }
- add(e, n) {
- const r = re.generateRandomId(6);
- return this._styles[r] = e, this._cacheMap.set(n, r), r;
- }
- setValue(e) {
- if (e == null)
- return;
- const n = JSON.stringify(e), r = this.search(e, n);
- return r !== "-1" ? r : this.add(e, n);
- }
- toJSON() {
- return this._styles;
- }
- getStyleByCell(e) {
- let n;
- e && re.isObject(e.s) ? n = e.s : n = (e == null ? void 0 : e.s) && this.get(e.s);
- const r = e == null ? void 0 : e.interceptorStyle;
- return r ? {
- ...n,
- ...r
- } : n;
- }
- _generateCacheMap() {
- const { _styles: e, _cacheMap: n } = this;
- for (const r in e) {
- const s = JSON.stringify(e[r]);
- n.set(s, r);
- }
- }
- _getExistingStyleId(e) {
- const { _styles: n } = this;
- for (const r in n)
- if (re.diffValue(n[r], e))
- return r;
- return null;
- }
- };
- var aR = (t, e) => e.length === t.length && !t.some((n) => e.some((r) => !en.equals(r, n)));
- var uR = (t, e) => e.length === t.length && t.every((n, r) => {
- const s = e[r];
- return s.unitId === n.unitId && s.sheetId === n.sheetId && en.equals(n.range, s.range);
- });
- var ti = {
- t: 0,
- b: 2,
- // must over 1, see https://github.com/dream-num/univer/issues/2727
- l: 2,
- r: 2
- };
- var F_ = (t) => ({
- sbr: 0.6,
- sbo: t,
- spr: 0.6,
- spo: t
- });
- var ga = 90;
- function Sr(t, e, n = {}) {
- const r = t.length, {
- textRotation: s,
- paddingData: i,
- horizontalAlign: o = Xt.UNSPECIFIED,
- verticalAlign: a = hn.UNSPECIFIED,
- wrapStrategy: u = xn.UNSPECIFIED,
- cellValueType: c
- } = n, { t: l, r: h, b: d, l: f } = i || ti, { vertexAngle: E, centerAngle: R } = ll(s), O = {
- id: "d",
- body: {
- dataStream: `${t}${Wd}`,
- textRuns: [
- {
- ts: e,
- st: 0,
- ed: r
- }
- ],
- paragraphs: [
- {
- startIndex: r,
- paragraphStyle: {
- horizontalAlign: o
- }
- }
- ],
- sectionBreaks: [{
- startIndex: r + 1
- }]
- },
- documentStyle: {
- pageSize: {
- width: Number.POSITIVE_INFINITY,
- height: Number.POSITIVE_INFINITY
- },
- marginTop: l,
- marginBottom: d,
- marginRight: h,
- marginLeft: f,
- renderConfig: {
- horizontalAlign: o,
- verticalAlign: a,
- centerAngle: R,
- vertexAngle: E,
- wrapStrategy: u,
- cellValueType: c,
- zeroWidthParagraphBreak: 1
- }
- },
- drawings: {},
- drawingsOrder: []
- };
- return new jt(O);
- }
- function $_(t) {
- if (!t)
- return {};
- const {
- tr: e,
- td: n,
- ht: r,
- vt: s,
- tb: i,
- pd: o
- } = t;
- return {
- textRotation: e,
- textDirection: n,
- horizontalAlign: r,
- verticalAlign: s,
- wrapStrategy: i,
- paddingData: o
- };
- }
- function pa(t) {
- if (!t)
- return {};
- const { ff: e, fs: n, it: r, bl: s, ul: i, st: o, ol: a, cl: u } = t, c = {};
- 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;
- }
- function B_(t, e, n) {
- var i;
- const r = t.getBody();
- if ((i = r.customRanges) != null && i.some((o) => o.rangeType === mn.HYPERLINK))
- return;
- const s = st.customRange.add({
- ranges: [
- {
- startOffset: 0,
- endOffset: r.dataStream.length - 1,
- collapsed: false
- }
- ],
- rangeId: n,
- rangeType: mn.HYPERLINK,
- body: r,
- properties: {
- url: e,
- refId: n
- }
- });
- s && Ke.apply(r, s.serialize());
- }
- function j_(t) {
- return t != null;
- }
- var H_ = '"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';
- function ma(t) {
- const e = gt.ff, n = gt.fs;
- if (!t) {
- const h = `${n}pt ${e}`;
- return {
- fontCache: h,
- fontString: h,
- fontSize: n,
- originFontSize: n,
- fontFamily: e
- };
- }
- let r = Yn.ITALIC;
- (t.it === 0 || t.it === void 0) && (r = Yn.NORMAL);
- let s = Yn.BOLD;
- (t.bl === 0 || t.bl === void 0) && (s = Yn.NORMAL);
- let i = n;
- t.fs && (i = Math.ceil(t.fs));
- let o = e;
- if (t.ff) {
- let h = t.ff;
- h = h.replace(/"/g, "").replace(/'/g, ""), h.indexOf(" ") > -1 && (h = `"${h}"`), h == null && (h = e), o = h;
- }
- const { va: a } = t;
- let u = i;
- if (a === Bt.SUBSCRIPT || a === Bt.SUPERSCRIPT) {
- const h = W_(o, u), { sbr: d, spr: f } = h;
- u *= a === Bt.SUBSCRIPT ? d : f;
- }
- const c = `${r} ${s} ${u}pt ${o}`, l = `${c}, ${H_} `;
- return {
- fontCache: c,
- fontString: l,
- fontSize: u,
- originFontSize: i,
- fontFamily: o
- };
- }
- function W_(t, e) {
- return F_(e);
- }
- function ll(t) {
- const { a: e = 0, v: n = we.FALSE } = t || { a: 0, v: we.FALSE };
- let r = 0, s = e;
- return n === we.TRUE && (r = ga, s = ga), { centerAngle: r, vertexAngle: s };
- }
- var z_ = class {
- constructor(e, n) {
- C(this, "_columnData", {});
- this._config = e, this._columnData = n;
- }
- /**
- * Get width and hidden status of columns in the sheet
- * @returns
- */
- getColumnData() {
- return this._columnData;
- }
- getColVisible(e) {
- const { _columnData: n } = this, r = n[e];
- return r ? r.hd !== we.TRUE : true;
- }
- /**
- * Get the column style
- * @param {number} col Column index
- * @returns {string | Nullable<IStyleData>} Style data, may be undefined
- */
- getColumnStyle(e) {
- var n;
- return (n = this._columnData[e]) == null ? void 0 : n.s;
- }
- /**
- * Set the set column default style
- * @param {number} col Column index
- * @param {string | Nullable<IStyleData>} style Style data
- */
- setColumnStyle(e, n) {
- const r = this.getColumnOrCreate(e);
- r.s = n;
- }
- /**
- * Get all hidden columns
- * @param start Start index
- * @param end End index
- * @returns Hidden columns range list
- */
- getHiddenCols(e = 0, n = this.getSize() - 1) {
- const r = [];
- let s = false, i = -1;
- for (let o = e; o <= n; o++) {
- const a = this.getColVisible(o);
- s && a ? (s = false, r.push({
- rangeType: De.COLUMN,
- startColumn: i,
- endColumn: o - 1,
- startRow: 0,
- endRow: 0
- })) : !s && !a && (s = true, i = o);
- }
- return s && r.push({
- startRow: 0,
- endRow: 0,
- startColumn: i,
- endColumn: n,
- rangeType: De.COLUMN
- }), r;
- }
- /**
- * Get all visible columns
- * @param start Start index
- * @param end End index
- * @returns Visible columns range list
- */
- getVisibleCols(e = 0, n = this.getSize() - 1) {
- const r = [];
- let s = false, i = -1;
- for (let o = e; o <= n; o++) {
- const a = this.getColVisible(o);
- s && !a ? (s = false, r.push({
- rangeType: De.COLUMN,
- startColumn: i,
- endColumn: o - 1,
- startRow: 0,
- endRow: 0
- })) : !s && a && (s = true, i = o);
- }
- return s && r.push({
- startRow: 0,
- endRow: 0,
- startColumn: i,
- endColumn: n,
- rangeType: De.COLUMN
- }), r;
- }
- getColumnDatas(e, n) {
- const r = {};
- let s = 0;
- for (let i = e; i < e + n; i++) {
- const o = this.getColumnOrCreate(i);
- r[s] = o, s++;
- }
- return r;
- }
- /**
- * Get count of column in the sheet
- * @returns
- */
- getSize() {
- return fn(this._columnData);
- }
- /**
- * Get the width of column
- * @param columnPos column index
- * @returns
- */
- getColumnWidth(e) {
- const { _columnData: n } = this, r = this._config;
- let s = 0;
- return s = (n[e] || {
- hd: we.FALSE,
- w: r.defaultColumnWidth
- }).w || r.defaultColumnWidth, s;
- }
- /**
- * get given column data
- * @param columnPos column index
- */
- getColumn(e) {
- const n = this._columnData[e];
- if (n)
- return n;
- }
- /**
- * Remove column data of given column
- * @param columnPos
- */
- removeColumn(e) {
- delete this._columnData[e];
- }
- /**
- * get given column data or create a column data when it's null
- * @param columnPos column index
- * @returns {Partial<IColumnData>} columnData
- */
- getColumnOrCreate(e) {
- const { _columnData: n } = this, r = n[e];
- if (r)
- return r;
- const s = {};
- return this._columnData[e] = s, s;
- }
- setCustomMetadata(e, n) {
- const r = this.getColumn(e);
- r && (r.custom = n);
- }
- getCustomMetadata(e) {
- var n;
- return (n = this.getColumn(e)) == null ? void 0 : n.custom;
- }
- };
- var Y_ = class {
- constructor(e, n, r) {
- C(this, "_rowData");
- this._config = e, this._viewModel = n, this._rowData = r;
- }
- /**
- * Get height and hidden status of columns in the sheet
- * @returns
- */
- getRowData() {
- return this._rowData;
- }
- /**
- * Get the row style
- * @param {number} row Row index
- * @returns {string | Nullable<IStyleData>} Style data, may be undefined
- */
- getRowStyle(e) {
- var n;
- return (n = this._rowData[e]) == null ? void 0 : n.s;
- }
- /**
- * Set row default style
- * @param {number} row The row index
- * @param {string | Nullable<IStyleData>} style The style data
- */
- setRowStyle(e, n) {
- const r = this.getRowOrCreate(e);
- r.s = n;
- }
- getRowDatas(e, n) {
- const r = {};
- let s = 0;
- for (let i = e; i < e + n; i++) {
- const o = this.getRowOrCreate(i);
- r[s] = o, s++;
- }
- return r;
- }
- getRowHeight(e, n = 1) {
- const { _rowData: r } = this, s = this._config;
- let i = 0;
- for (let o = 0; o < n; o++) {
- const a = r[o + e] || {
- hd: we.FALSE,
- h: s.defaultRowHeight
- }, { ia: u, ah: c, h: l = s.defaultRowHeight } = a;
- i += (u == null || u === we.TRUE) && typeof c == "number" ? c : l;
- }
- return i;
- }
- /**
- * Get row data of given row
- * @param rowPos row index
- * @returns {Nullable<Partial<IRowData>>} rowData
- */
- getRow(e) {
- return this._rowData[e];
- }
- /**
- * Remove row data of given row
- * @param rowPos
- */
- removeRow(e) {
- delete this._rowData[e];
- }
- /**
- * Get given row data or create a row data when it's null
- * @param rowPos row index
- * @returns {Partial<IRowData>} rowData
- */
- getRowOrCreate(e) {
- const { _rowData: n } = this, r = n[e];
- if (r)
- return r;
- const s = {};
- return n[e] = s, s;
- }
- /**
- * Get all hidden rows
- * @param start Start index
- * @param end End index
- * @returns Hidden rows range list
- */
- getHiddenRows(e = 0, n = this.getSize() - 1) {
- const r = [];
- let s = false, i = -1;
- for (let o = e; o <= n; o++) {
- const a = this.getRowRawVisible(o);
- s && a ? (s = false, r.push({
- startRow: i,
- endRow: o - 1,
- startColumn: 0,
- endColumn: 0,
- rangeType: De.ROW
- })) : !s && !a && (s = true, i = o);
- }
- return s && r.push({ startRow: i, endRow: n, startColumn: 0, endColumn: 0, rangeType: De.ROW }), r;
- }
- /**
- * Get all visible rows
- * @param start Start index
- * @param end End index
- * @returns Visible rows range list
- */
- getVisibleRows(e = 0, n = this.getSize() - 1) {
- const r = [];
- let s = false, i = -1;
- for (let o = e; o <= n; o++) {
- const a = this.getRowRawVisible(o);
- s && !a ? (s = false, r.push({
- startRow: i,
- endRow: o - 1,
- startColumn: 0,
- endColumn: 0,
- rangeType: De.ROW
- })) : !s && a && (s = true, i = o);
- }
- return s && r.push({ startRow: i, endRow: n, startColumn: 0, endColumn: 0, rangeType: De.ROW }), r;
- }
- getRowRawVisible(e) {
- const n = this.getRow(e);
- return n ? n.hd !== we.TRUE : true;
- }
- /**
- * Get count of row in the sheet
- * @returns {number} row count
- */
- getSize() {
- return fn(this._rowData);
- }
- setCustomMetadata(e, n) {
- const r = this.getRow(e);
- r && (r.custom = n);
- }
- getCustomMetadata(e) {
- var n;
- return (n = this.getRow(e)) == null ? void 0 : n.custom;
- }
- };
- var lR = "DEFAULT_WORKSHEET_ROW_COUNT";
- var V_ = 1e3;
- var cR = "DEFAULT_WORKSHEET_COLUMN_COUNT";
- var G_ = 20;
- var hR = "DEFAULT_WORKSHEET_ROW_HEIGHT";
- var K_ = 24;
- var dR = "DEFAULT_WORKSHEET_COLUMN_WIDTH";
- var X_ = 88;
- var fR = "DEFAULT_WORKSHEET_ROW_TITLE_WIDTH";
- var J_ = 46;
- var gR = "DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT";
- var Z_ = 20;
- function Q_(t) {
- const e = {
- name: "Sheet1",
- // TODO: name should have i18n
- id: "sheet-01",
- tabColor: "",
- hidden: we.FALSE,
- rowCount: V_,
- columnCount: G_,
- zoomRatio: 1,
- freeze: {
- xSplit: 0,
- ySplit: 0,
- startRow: -1,
- startColumn: -1
- },
- scrollTop: 0,
- scrollLeft: 0,
- defaultColumnWidth: X_,
- defaultRowHeight: K_,
- mergeData: [],
- cellData: {},
- rowData: {},
- columnData: {},
- showGridlines: we.TRUE,
- rowHeader: {
- width: J_,
- hidden: we.FALSE
- },
- columnHeader: {
- height: Z_,
- hidden: we.FALSE
- },
- rightToLeft: we.FALSE
- };
- return Object.keys(e).forEach((n) => {
- const r = n;
- typeof t[r] > "u" && (t[r] = e[r]);
- }), t;
- }
- var q_ = class extends nt {
- constructor(n) {
- super();
- C(this, "_cellCache", /* @__PURE__ */ new Map());
- C(this, "_rowCache", /* @__PURE__ */ new Map());
- C(this, "_columnCache", /* @__PURE__ */ new Map());
- C(this, "_hasRow", false);
- C(this, "_hasColumn", false);
- C(this, "_hasAll", false);
- C(this, "_allIndex", -1);
- C(this, "_mergeData");
- C(this, "_rangeMap", new Qr(5e4));
- C(this, "_skeletonCache", new Qr(5e4));
- this._init(n.concat());
- }
- _init(n) {
- this._mergeData = n, this._createCache(n);
- }
- _clearCache() {
- 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;
- }
- _createCache(n) {
- let r = 0;
- for (const s of n) {
- const { rangeType: i } = s;
- 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++;
- }
- }
- /**
- * Rebuild the merge data cache when the merge data is changed.
- * @param {IRange[]} mergeData
- */
- rebuild(n) {
- this._clearCache(), this._init(n.concat());
- }
- _createRowCache(n, r) {
- const { startRow: s, endRow: i } = n;
- for (let o = s; o <= i; o++)
- this._rowCache.set(o, r), this._hasRow = true;
- }
- _createColumnCache(n, r) {
- const { startColumn: s, endColumn: i } = n;
- for (let o = s; o <= i; o++)
- this._columnCache.set(o, r), this._hasColumn = true;
- }
- _createCellAllCache(n) {
- this._hasAll = true, this._allIndex = n;
- }
- _createCellCache(n, r) {
- for (let s = n.startRow; s <= n.endRow; s++) {
- let i = this._cellCache.get(s);
- i == null && (i = /* @__PURE__ */ new Map(), this._cellCache.set(s, i));
- for (let o = n.startColumn; o <= n.endColumn; o++)
- i.set(o, r);
- }
- }
- add(n) {
- this._mergeData.push(n), this._clearCache(), this._createCache(this._mergeData);
- }
- remove(n, r) {
- const s = this._getMergeDataIndex(n, r);
- s !== -1 && (this._mergeData.splice(s, 1), this._clearCache(), this._createCache(this._mergeData));
- }
- getMergedCell(n, r) {
- const s = this._getMergeDataIndex(n, r);
- return s !== -1 ? this._mergeData[s] : null;
- }
- /**
- * Return index of merge data if (row,col) is in merge range. -1 means not in merge range.
- * @param row
- * @param column
- * @returns {number} index of merge range.
- */
- getMergeDataIndex(n, r) {
- return this._getMergeDataIndex(n, r);
- }
- isRowContainsMergedCell(n) {
- return this._hasAll || !re.isEmptyObject(this._columnCache) ? true : this._mergeData.some((r) => r.startRow <= n && n <= r.endRow);
- }
- isColumnContainsMergedCell(n) {
- return this._hasAll || !re.isEmptyObject(this._rowCache) ? true : this._mergeData.some((r) => r.startColumn <= n && n <= r.endColumn);
- }
- getMergedCellRange(n, r, s, i) {
- const o = [], a = `${n}-${r}-${s}-${i}`;
- if (this._rangeMap.has(a))
- return this._getRangeFromCache(a);
- let u = 0;
- const c = [];
- for (const l of this._mergeData || [])
- en.intersects(l, {
- startRow: n,
- endRow: s,
- startColumn: r,
- endColumn: i
- }) && (o.push({
- ...l
- }), c.push(u)), u++;
- return this._rangeMap.set(a, c), o;
- }
- /**
- * @deprecated sigificant performance impact, use _getCellMergeInfo instead.
- * @param startRow
- * @param startColumn
- * @param endRow
- * @param endColumn
- */
- getMergedCellRangeForSkeleton(n, r, s, i) {
- const o = [], a = this._mergeData, u = `${n}-${r}-${s}-${i}`;
- if (this._skeletonCache.has(u))
- return this._getSkeletonRangeFromCache(u);
- const c = [];
- for (let l = 0; l < a.length; l++) {
- const {
- startRow: h,
- endRow: d,
- startColumn: f,
- endColumn: E
- } = a[l];
- for (let R = n; R <= s; R++) {
- let O = false;
- for (let U = r; U <= i; U++)
- if (R >= h && R <= d && U >= f && U <= E) {
- o.push({
- startRow: h,
- endRow: d,
- startColumn: f,
- endColumn: E
- }), c.push(l), O = true;
- break;
- }
- if (O)
- break;
- }
- }
- return this._skeletonCache.set(u, c), o;
- }
- _getRangeFromCache(n) {
- const r = this._rangeMap.get(n) || [], s = [];
- for (const i of r)
- s.push({
- ...this._mergeData[i]
- });
- return s;
- }
- _getSkeletonRangeFromCache(n) {
- const r = this._skeletonCache.get(n) || [], s = [];
- for (const i of r)
- s.push({
- ...this._mergeData[i]
- });
- return s;
- }
- _getMergeDataIndex(n, r) {
- var i;
- if (this._hasAll)
- return this._allIndex;
- if (this._hasRow) {
- const o = this._rowCache.get(n);
- if (o !== void 0)
- return o;
- }
- if (this._hasColumn) {
- const o = this._columnCache.get(r);
- if (o !== void 0)
- return o;
- }
- const s = (i = this._cellCache.get(n)) == null ? void 0 : i.get(r);
- return s !== void 0 ? s : -1;
- }
- getMergeDataSnapshot() {
- return this._mergeData;
- }
- dispose() {
- this._clearCache(), this._mergeData = [];
- }
- };
- var eE = class extends nt {
- constructor(n) {
- super();
- C(this, "_cellContentInterceptor", null);
- C(this, "_rowFilteredInterceptor", null);
- this.getRawCell = n;
- }
- dispose() {
- super.dispose(), this._cellContentInterceptor = null, this._rowFilteredInterceptor = null;
- }
- getCell(n, r, s, i) {
- return this._cellContentInterceptor ? this._cellContentInterceptor.getCell(n, r, Vn.Value | Vn.Style, s, i) : this.getRawCell(n, r);
- }
- getCellValueOnly(n, r) {
- return this._cellContentInterceptor ? this._cellContentInterceptor.getCell(n, r, Vn.Value) : this.getRawCell(n, r);
- }
- getCellStyleOnly(n, r) {
- return this._cellContentInterceptor ? this._cellContentInterceptor.getCell(n, r, Vn.Style) : this.getRawCell(n, r);
- }
- getRowFiltered(n) {
- var r, s;
- return (s = (r = this._rowFilteredInterceptor) == null ? void 0 : r.getRowFiltered(n)) != null ? s : false;
- }
- registerCellContentInterceptor(n) {
- if (this._cellContentInterceptor)
- throw new Error("[SheetViewModel]: Interceptor already registered.");
- return this._cellContentInterceptor = n, Ze(() => this._cellContentInterceptor = null);
- }
- registerRowFilteredInterceptor(n) {
- if (this._rowFilteredInterceptor)
- throw new Error("[SheetViewModel]: Interceptor already registered.");
- return this._rowFilteredInterceptor = n, Ze(() => this._rowFilteredInterceptor = null);
- }
- };
- var _a = {
- isDeepClone: false,
- displayRawFormula: false,
- ignoreTextRotation: false
- };
- var es = class _es {
- constructor(e, n, r) {
- C(this, "_sheetId");
- C(this, "_snapshot");
- C(this, "_cellData");
- C(this, "_rowManager");
- C(this, "_columnManager");
- C(this, "_viewModel");
- C(this, "_spanModel");
- var a;
- this.unitId = e, this._styles = r, this._snapshot = Q_(n);
- const { columnData: s, rowData: i, cellData: o } = this._snapshot;
- 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);
- }
- /**
- * @internal
- * @param callback
- */
- __interceptViewModel(e) {
- e(this._viewModel);
- }
- getSnapshot() {
- return this._snapshot;
- }
- /**
- * Set the merge data of the sheet, all the merged cells will be rebuilt.
- * @param mergeData
- */
- setMergeData(e) {
- this._snapshot.mergeData = e, this.getSpanModel().rebuild(e);
- }
- getSpanModel() {
- return this._spanModel;
- }
- getStyleDataByHash(e) {
- return { ...this._styles.get(e) };
- }
- setStyleData(e) {
- return this._styles.setValue(e);
- }
- /**
- * Get the style of the column.
- * @param {number} column The column index
- * @param {boolean} [keepRaw] If true, return the raw style data, otherwise return the style data object
- * @returns {Nullable<IStyleData>|string} The style of the column
- */
- getColumnStyle(e, n = false) {
- return n ? this._columnManager.getColumnStyle(e) : this._styles.get(this._columnManager.getColumnStyle(e));
- }
- /**
- * Set the style of the column.
- * @param {number} column The column index
- * @param {string|Nullable<IStyleData>} style The style to be set
- */
- setColumnStyle(e, n) {
- this._columnManager.setColumnStyle(e, n);
- }
- /**
- * Get the style of the row.
- * @param {number} row The row index
- * @param {boolean} [keepRaw] If true, return the raw style data, otherwise return the style data object
- * @returns {Nullable<IStyleData>} The style of the row
- */
- getRowStyle(e, n = false) {
- return n ? this._rowManager.getRowStyle(e) : this._styles.get(this._rowManager.getRowStyle(e));
- }
- /**
- * Set the style of the row.
- * @param {number} row
- * @param {string|Nullable<IStyleData>} style The style to be set
- */
- setRowStyle(e, n) {
- this._rowManager.setRowStyle(e, n);
- }
- /**
- * this function is used to mixin default style to cell raw{number}
- * @param {number} row The row index
- * @param {number} col The column index
- * @param cellRaw The cell raw data
- * @param {boolean} isRowStylePrecedeColumnStyle The priority of row style and column style
- */
- mixinDefaultStyleToCellRaw(e, n, r, s) {
- const i = this.getColumnStyle(n), o = this.getRowStyle(e), a = this.getDefaultCellStyleInternal();
- if (a || i || o) {
- let u = r == null ? void 0 : r.s;
- typeof u == "string" && (u = this._styles.get(u));
- const c = s ? Mo(a, i, o, u) : Mo(a, o, i, u);
- r || (r = {}), r.s = c;
- }
- }
- /**
- * Get the default style of the worksheet.
- * @returns {Nullable<IStyleData>} Default Style
- */
- getDefaultCellStyle() {
- return this._snapshot.defaultStyle;
- }
- getDefaultCellStyleInternal() {
- const e = this._snapshot.defaultStyle;
- return this._styles.get(e);
- }
- /**
- * Set Default Style, if the style has been set, all cells style will be base on this style.
- * @param {Nullable<IStyleData>} style The style to be set as default style
- */
- setDefaultCellStyle(e) {
- this._snapshot.defaultStyle = e;
- }
- /**
- * Returns WorkSheet Cell Data Matrix
- * @returns WorkSheet Cell Data Matrix
- */
- getCellMatrix() {
- return this._cellData;
- }
- /**
- * Get worksheet printable cell range.
- * @returns
- */
- // eslint-disable-next-line max-lines-per-function
- getCellMatrixPrintRange() {
- const e = this.getCellMatrix(), n = this.getMergeData();
- let r = -1, s = -1, i = -1, o = -1, a = false, u = false;
- return e.forEach((c, l) => {
- Object.keys(l).forEach((h) => {
- 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);
- (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));
- });
- }), n.forEach((c) => {
- 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);
- }), !a || !u ? null : {
- startColumn: i,
- startRow: r,
- endColumn: o,
- endRow: s
- };
- }
- /**
- * Returns Row Manager
- * @returns Row Manager
- */
- getRowManager() {
- return this._rowManager;
- }
- /**
- * Returns the ID of its parent unit.
- */
- getUnitId() {
- return this.unitId;
- }
- /**
- * Returns the ID of the sheet represented by this object.
- * @returns ID of the sheet
- */
- getSheetId() {
- return this._sheetId;
- }
- /**
- * Returns Column Manager
- * @returns Column Manager
- */
- getColumnManager() {
- return this._columnManager;
- }
- /**
- * Returns the name of the sheet.
- * @returns name of the sheet
- */
- getName() {
- return this._snapshot.name;
- }
- /**
- * Returns WorkSheet Clone Object
- * @returns WorkSheet Clone Object
- * @deprecated
- */
- clone() {
- const { _snapshot: e } = this, n = re.deepClone(e);
- return new _es(this.unitId, n, this._styles);
- }
- /**
- * Get the merged cell list of the sheet.
- * @returns {IRange[]} merged cell list
- */
- getMergeData() {
- return this._spanModel.getMergeDataSnapshot();
- }
- /**
- * Get the merged cell Range of the sheet cell.
- * If (row, col) is not in a merged cell, return null
- *
- * @param {number} row The row index of test cell
- * @param {number} col The column index of test cell
- * @returns {Nullable<IRange>} The merged cell range of the cell, if the cell is not in a merged cell, return null
- */
- getMergedCell(e, n) {
- return this._spanModel.getMergedCell(e, n);
- }
- /**
- * Get the merged cell info list which has intersection with the given range.
- * @param {number} startRow The start row index of the range
- * @param {number} startColumn The start column index of the range
- * @param {number} endRow The end row index of the range
- * @param {number} endColumn The end column index of the range
- * @returns {IRange} The merged cell info list which has intersection with the given range or empty array if no merged cell in the range
- */
- getMergedCellRange(e, n, r, s) {
- return this._spanModel.getMergedCellRange(e, n, r, s);
- }
- /**
- * Get if the row contains merged cell
- * @param {number} row The row index
- * @returns {boolean} Is merge cell across row
- */
- isRowContainsMergedCell(e) {
- return this._spanModel.isRowContainsMergedCell(e);
- }
- /**
- * Get if the column contains merged cell
- * @param {number} column The column index
- * @returns {boolean} Is merge cell across column
- */
- isColumnContainsMergedCell(e) {
- return this._spanModel.isColumnContainsMergedCell(e);
- }
- /**
- * Get cell info with merge data
- * @param {number} row - The row index of the cell.
- * @param {number} column - The column index of the cell.
- * @type {selectionCell}
- * @property {number} actualRow - The actual row index of the cell
- * @property {number} actualColumn - The actual column index of the cell
- * @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
- * @property {boolean} isMerged - Whether the cell is in a merged cell, the upper left cell in the merged cell returns false here
- * @property {number} endRow - The end row index of the merged cell
- * @property {number} endColumn - The end column index of the merged cell
- * @property {number} startRow - The start row index of the merged cell
- * @property {number} startColumn - The start column index of the merged cell
- * @returns {selectionCell} - The cell info with merge data
- */
- getCellInfoInMergeData(e, n) {
- const r = this.getMergedCell(e, n);
- let s = false, i = false, o = e, a = n, u = e, c = n;
- if (r) {
- const {
- startRow: l,
- endRow: h,
- startColumn: d,
- endColumn: f
- } = r;
- 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);
- }
- return {
- actualRow: e,
- actualColumn: n,
- isMergedMainCell: i,
- isMerged: s,
- endRow: o,
- endColumn: a,
- startRow: u,
- startColumn: c
- };
- }
- /**
- * Get cellData, includes cellData, customRender, markers, dataValidate, etc.
- *
- * WARNING: All sheet CELL_CONTENT interceptors will be called in this method, cause performance issue.
- * example: this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT);
- *
- * @param row
- * @param col
- * @returns ICellDataForSheetInterceptor
- */
- getCell(e, n) {
- return e < 0 || n < 0 ? null : this._viewModel.getCell(e, n);
- }
- /**
- * Get cellData only use effect on value interceptor
- * @param {number} number row The row index of the cell.
- * @param {number} number col The column index of the cell.
- * @returns {Nullable<ICellDataForSheetInterceptor>} The cell data only use effect on value interceptor
- */
- getCellValueOnly(e, n) {
- return e < 0 || n < 0 ? null : this._viewModel.getCellValueOnly(e, n);
- }
- /**
- * Get cellData only use effect on style interceptor
- * @param {number} row The row index of the cell.
- * @param {number} col The column index of the cell.
- * @returns {Nullable<ICellDataForSheetInterceptor>} The cell data only use effect on style interceptor
- */
- getCellStyleOnly(e, n) {
- return e < 0 || n < 0 ? null : this._viewModel.getCellStyleOnly(e, n);
- }
- getCellRaw(e, n) {
- return this.getCellMatrix().getValue(e, n);
- }
- // eslint-disable-next-line ts/no-explicit-any
- getCellWithFilteredInterceptors(e, n, r, s) {
- return this._viewModel.getCell(e, n, r, s);
- }
- getRowFiltered(e) {
- return this._viewModel.getRowFiltered(e);
- }
- getMatrixWithMergedCells(e, n, r, s, i = zn.Raw) {
- const o = this.getCellMatrix(), a = this._spanModel.getMergedCellRange(e, n, r, s), u = new kt();
- return Qo(e, r, n, s).forEach((c, l) => {
- var d;
- let h;
- if (i === zn.Raw)
- h = this.getCellRaw(c, l);
- else if (i === zn.Intercepted)
- h = this.getCell(c, l);
- else if (i === zn.Both) {
- const f = this.getCellRaw(c, l);
- if (f) {
- h = { ...f };
- const E = (d = this.getCell(c, l)) == null ? void 0 : d.v;
- j_(E) && h && (h.displayV = String(E));
- }
- }
- h && u.setValue(c, l, h);
- }), a.forEach((c) => {
- const { startColumn: l, startRow: h, endColumn: d, endRow: f } = c;
- Qo(h, f, l, d).forEach((E, R) => {
- E === h && R === l && u.setValue(E, R, {
- ...o.getValue(E, R),
- rowSpan: f - h + 1,
- colSpan: d - l + 1
- }), (E !== h || R !== l) && u.realDeleteValue(E, R);
- });
- }), u;
- }
- getRange(e, n, r, s) {
- return typeof e == "object" ? new tr(this, e, {
- getStyles: () => this._styles
- }) : new tr(
- this,
- {
- startRow: e,
- startColumn: n,
- endColumn: s || n,
- endRow: r || e
- },
- {
- getStyles: () => this._styles
- }
- );
- }
- getScrollLeftTopFromSnapshot() {
- return {
- scrollLeft: this._snapshot.scrollLeft,
- scrollTop: this._snapshot.scrollTop
- };
- }
- /**
- * Return WorkSheetZoomRatio
- * @return zoomRatio
- */
- getZoomRatio() {
- return this._snapshot.zoomRatio || 1;
- }
- /**
- * Returns WorkSheet Configures
- * @returns WorkSheet Configures
- */
- getConfig() {
- return this._snapshot;
- }
- /**
- * Returns frozen.
- * @returns frozen
- */
- getFreeze() {
- return this._snapshot.freeze;
- }
- /**
- * Returns the current number of columns in the sheet, regardless of content.
- * @returns the current number of columns in the sheet, regardless of content
- */
- getMaxColumns() {
- const { _snapshot: e } = this, { columnCount: n } = e;
- return n;
- }
- /**
- * Returns the current number of rows in the sheet, regardless of content.
- * @returns the current number of rows in the sheet, regardless of content
- */
- getMaxRows() {
- const { _snapshot: e } = this, { rowCount: n } = e;
- return n;
- }
- getRowCount() {
- return this._snapshot.rowCount;
- }
- setRowCount(e) {
- this._snapshot.rowCount = e;
- }
- getColumnCount() {
- return this._snapshot.columnCount;
- }
- setColumnCount(e) {
- this._snapshot.columnCount = e;
- }
- /**
- * isSheetHidden
- * @returns hidden status of sheet
- */
- isSheetHidden() {
- return this._snapshot.hidden;
- }
- /**
- * Returns true if the sheet's gridlines are hidden; otherwise returns false. Gridlines are visible by default.
- * @returns {boolean} Gridlines Hidden Status.
- */
- hasHiddenGridlines() {
- const { _snapshot: e } = this, { showGridlines: n } = e;
- return n === 0;
- }
- /**
- * Returns the color of the gridlines, or undefined if the gridlines are not colored.
- * @returns {string | undefined} returns the color of the gridlines, or undefined if the gridlines are default.
- */
- getGridlinesColor() {
- return this.getConfig().gridlinesColor;
- }
- /**
- * Gets the sheet tab color, or null if the sheet tab has no color.
- * @returns the sheet tab color or null
- */
- getTabColor() {
- const { _snapshot: e } = this, { tabColor: n } = e;
- return n;
- }
- /**
- * Gets the width in pixels of the given column.
- * @param columnPosition column index
- * @returns Gets the width in pixels of the given column.
- */
- getColumnWidth(e) {
- return this.getColumnManager().getColumnWidth(e);
- }
- /**
- * Gets the height in pixels of the given row.
- * @param row row index
- * @returns Gets the height in pixels of the given row.
- */
- getRowHeight(e) {
- return this._viewModel.getRowFiltered(e) ? 0 : this.getRowManager().getRowHeight(e);
- }
- /**
- * Row is filtered out, that means this row is invisible.
- * @param row
- * @returns {boolean} is row hidden by filter
- */
- isRowFiltered(e) {
- return this._viewModel.getRowFiltered(e);
- }
- /**
- * Get if the row is visible. It may be affected by features like filter and view.
- * @param row the row index
- * @returns {boolean} if the row in visible to the user
- */
- getRowVisible(e) {
- return !this.isRowFiltered(e) && this.getRowRawVisible(e);
- }
- /**
- * Get if the row does not have `hidden` property. This value won't affected by features like filter and view.
- * @param row the row index
- * @returns if the row does not have `hidden` property
- */
- getRowRawVisible(e) {
- return this.getRowManager().getRowRawVisible(e);
- }
- getHiddenRows(e, n) {
- const r = this.getMaxColumns() - 1, s = this._rowManager.getHiddenRows(e, n);
- return s.forEach((i) => i.endColumn = r), s;
- }
- getColVisible(e) {
- return this._columnManager.getColVisible(e);
- }
- getHiddenCols(e, n) {
- const r = this.getMaxRows() - 1, s = this._columnManager.getHiddenCols(e, n);
- return s.forEach((i) => i.endRow = r), s;
- }
- /**
- * Get all visible rows in the sheet.(not include filter & view, like getRawVisibleRows)
- * @returns Visible rows range list
- */
- getVisibleRows() {
- const e = this.getRowCount();
- return this._rowManager.getVisibleRows(0, e - 1);
- }
- /**
- * Get all visible columns in the sheet.(not include filter & view)
- * @returns Visible columns range list
- */
- getVisibleCols() {
- const e = this.getColumnCount();
- return this._columnManager.getVisibleCols(0, e - 1);
- }
- /**
- * Returns true if this sheet layout is right-to-left. Returns false if the sheet uses the default left-to-right layout.
- * @returns true if this sheet layout is right-to-left. Returns false if the sheet uses the default left-to-right layout.
- */
- isRightToLeft() {
- const { _snapshot: e } = this, { rightToLeft: n } = e;
- return n;
- }
- /**
- * Returns the position of the last row that has content.
- * @returns the position of the last row that has content.
- */
- getLastRowWithContent() {
- return this._cellData.getLength() - 1;
- }
- /**
- * Returns the position of the last column that has content.
- * @returns the position of the last column that has content.
- */
- getLastColumnWithContent() {
- return this._cellData.getRange().endColumn;
- }
- getDataRangeScope() {
- return this._cellData.getStartEndScope();
- }
- cellHasValue(e) {
- return e && (e.v !== void 0 || e.f !== void 0 || e.p !== void 0);
- }
- // #region iterators
- // NOTE: performance intensive. Should keep an eye on methods in this region.
- /**
- * Iterate a range row by row.
- *
- * Performance intensive.
- *
- * @param range the iterate range
- * @param skipEmpty whether to skip empty cells, default to be `true`
- */
- iterateByRow(e, n = true) {
- const { startRow: r, startColumn: s, endRow: i, endColumn: o } = e, a = this;
- return {
- [Symbol.iterator]: () => {
- let u = r, c = s;
- return {
- next() {
- for (; ; ) {
- if (c > o && (u += 1, c = s), u > i)
- return { done: true, value: void 0 };
- const l = a.getCell(u, c), h = !l, d = a.getMergedCell(u, c);
- if (d) {
- if (u !== d.startRow || c !== d.startColumn) {
- c = d.endColumn + 1;
- continue;
- }
- if (h && n) {
- c = d.endColumn + 1;
- continue;
- }
- const E = { row: u, col: c, value: l };
- return E.colSpan = d.endColumn - d.startColumn + 1, E.rowSpan = d.endRow - d.startRow + 1, c = d.endColumn + 1, { done: false, value: E };
- }
- if (h && n)
- c += 1;
- else {
- const f = { row: u, col: c, value: l };
- return c += 1, { done: false, value: f };
- }
- }
- }
- };
- }
- };
- }
- /**
- * Iterate a range column by column. This is pretty similar to `iterateByRow` but with different order.
- *
- * Performance intensive.
- *
- * @param range The iterate range.
- * @param skipEmpty Whether to skip empty cells, default to be `true`.
- * @param skipNonTopLeft Whether to skip non-top-left cells of merged cells, default to be `true`. If the
- * parameter is set to `false`, the iterator will return cells in the top row.
- */
- iterateByColumn(e, n = true, r = true) {
- const { startRow: s, startColumn: i, endRow: o, endColumn: a } = e, u = this;
- return {
- [Symbol.iterator]: () => {
- let c = s, l = i;
- return {
- next() {
- for (; ; ) {
- if (c > o && (l += 1, c = s), l > a)
- return { done: true, value: void 0 };
- const h = u.getMergedCell(c, l);
- if (h) {
- const E = c !== h.startRow, R = E || l !== h.startColumn;
- if (r && R || !r && E) {
- c = h.endRow + 1;
- continue;
- }
- const O = u.getCell(h.startRow, h.startColumn);
- if (!O && n) {
- c = h.endRow + 1;
- continue;
- }
- const ne = { row: c, col: h.startColumn, value: O };
- return ne.colSpan = h.endColumn - h.startColumn + 1, ne.rowSpan = h.endRow - h.startRow + 1, c = h.endRow + 1, { done: false, value: ne };
- }
- const d = u.getCell(c, l);
- if (!d && n)
- c += 1;
- else {
- const E = { row: c, col: l, value: d };
- return c += 1, { done: false, value: E };
- }
- }
- }
- };
- }
- };
- }
- /**
- * This method generates a document model based on the cell's properties and handles the associated styles and configurations.
- * If the cell does not exist, it will return null.
- * PS: This method has significant impact on performance.
- * @param cell
- * @param options
- */
- // eslint-disable-next-line complexity, max-lines-per-function
- _getCellDocumentModel(e, n = _a) {
- var R;
- const { isDeepClone: r, displayRawFormula: s, ignoreTextRotation: i } = {
- ..._a,
- ...n
- }, o = this._styles.getStyleByCell(e);
- if (!e)
- return;
- let a, u = "document";
- const c = $_(o), l = i ? gt.tr : c.textRotation || gt.tr;
- let h = c.horizontalAlign || gt.ht;
- const d = c.verticalAlign || gt.vt, f = c.wrapStrategy || gt.tb, E = c.paddingData || ti;
- if (e.f && s)
- a = Sr(e.f.toString(), {}, { verticalAlign: d }), h = gt.ht;
- else if (e.p) {
- const { centerAngle: O, vertexAngle: U } = ll(l);
- a = this._updateConfigAndGetDocumentModel(
- r ? re.deepClone(e.p) : e.p,
- h,
- E,
- {
- horizontalAlign: h,
- verticalAlign: d,
- centerAngle: O,
- vertexAngle: U,
- wrapStrategy: f,
- zeroWidthParagraphBreak: 1
- }
- );
- } else if (e.v != null) {
- const O = pa(o);
- u = ma(O).fontCache;
- let U = tE(e);
- e.t === dn.FORCE_STRING && s && (U = `'${U}`), a = Sr(U, O, {
- ...c,
- textRotation: l,
- cellValueType: e.t
- });
- }
- return a && e.linkUrl && e.linkId && B_(a, e.linkUrl, e.linkId), {
- documentModel: a,
- fontString: u,
- textRotation: l,
- wrapStrategy: f,
- verticalAlign: d,
- horizontalAlign: h,
- paddingData: E,
- fill: (R = o == null ? void 0 : o.bg) == null ? void 0 : R.rgb
- };
- }
- _updateConfigAndGetDocumentModel(e, n, r, s) {
- var o, a, u, c, l;
- if (!s || !((o = e.body) != null && o.dataStream))
- return;
- 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 = {
- width: Number.POSITIVE_INFINITY,
- height: Number.POSITIVE_INFINITY
- }, e.documentStyle.renderConfig = {
- ...e.documentStyle.renderConfig,
- ...s
- };
- const i = e.body.paragraphs || [];
- for (const h of i)
- h.paragraphStyle || (h.paragraphStyle = {}), h.paragraphStyle.horizontalAlign = n;
- return new jt(e);
- }
- /**
- * Only used for cell edit, and no need to rotate text when edit cell content!
- */
- getBlankCellDocumentModel(e) {
- const n = this._getCellDocumentModel(e, { ignoreTextRotation: true }), r = this._styles.getStyleByCell(e), s = pa(r);
- if (n != null)
- return n.documentModel == null && (n.documentModel = Sr("", s)), n;
- const i = "";
- let o = "document";
- const a = gt.tr, u = gt.ht, c = gt.vt, l = gt.tb, h = ti;
- return o = ma({}).fontCache, {
- documentModel: Sr(i, s),
- fontString: o,
- textRotation: a,
- wrapStrategy: l,
- verticalAlign: c,
- horizontalAlign: u,
- paddingData: h
- };
- }
- // Only used for cell edit, and no need to rotate text when edit cell content!
- getCellDocumentModelWithFormula(e) {
- return this._getCellDocumentModel(e, {
- isDeepClone: true,
- displayRawFormula: true,
- ignoreTextRotation: true
- });
- }
- /**
- * Get custom metadata of worksheet
- * @returns {CustomData | undefined} custom metadata
- */
- getCustomMetadata() {
- return this._snapshot.custom;
- }
- /**
- * Set custom metadata of workbook
- * @param {CustomData | undefined} custom custom metadata
- */
- setCustomMetadata(e) {
- this._snapshot.custom = e;
- }
- };
- function tE(t) {
- var r, s;
- if (!t)
- return "";
- const e = (s = (r = t.p) == null ? void 0 : r.body) == null ? void 0 : s.dataStream;
- if (e)
- return st.transform.getPlainText(e);
- const n = t.v;
- 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" : "";
- }
- function pR(t) {
- if (t === null)
- return "";
- if (t != null && t.p) {
- const e = t == null ? void 0 : t.p.body;
- if (e == null)
- return "";
- const n = e.dataStream;
- return st.transform.getPlainText(n);
- }
- return t == null ? void 0 : t.v;
- }
- var nE = Object.defineProperty;
- var rE = Object.getOwnPropertyDescriptor;
- var sE = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? rE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && nE(e, n, s), s;
- };
- var iE = (t, e) => (n, r) => e(n, r, t);
- function mR(t, e) {
- return `${t.getUnitId()}|${e.getSheetId()}`;
- }
- var ts = class extends Ui {
- constructor(e = {}, n) {
- super();
- C(this, "type", Fe.UNIVER_SHEET);
- C(this, "_sheetCreated$", new Subject());
- C(this, "sheetCreated$", this._sheetCreated$.asObservable());
- C(this, "_sheetDisposed$", new Subject());
- C(this, "sheetDisposed$", this._sheetDisposed$.asObservable());
- C(this, "_activeSheet$", new BehaviorSubject(null));
- C(this, "activeSheet$", this._activeSheet$.asObservable());
- C(this, "_worksheets");
- C(this, "_styles");
- C(this, "_snapshot");
- C(this, "_unitId");
- C(this, "_count");
- C(this, "_name$");
- C(this, "name$");
- this._logService = n;
- const r = P_();
- re.isEmptyObject(e) ? this._snapshot = r : this._snapshot = re.commonExtend(r, e);
- const { styles: s } = this._snapshot;
- (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();
- }
- get _activeSheet() {
- return this._activeSheet$.getValue();
- }
- get name() {
- return this._name$.getValue();
- }
- static isIRangeType(e) {
- return typeof e == "string" || "startRow" in e || "row" in e;
- }
- dispose() {
- super.dispose(), this._sheetCreated$.complete(), this._sheetDisposed$.complete(), this._activeSheet$.complete(), this._name$.complete();
- }
- /**
- * Create a clone of the current snapshot.
- * Call resourceLoaderService.saveWorkbook to save the data associated with the current plugin if needed.
- * @memberof Workbook
- */
- save() {
- return re.deepClone(this._snapshot);
- }
- /**
- * Get current snapshot reference.
- * Call resourceLoaderService.saveWorkbook to save the data associated with the current plugin if needed.
- * @return {*} {IWorkbookData}
- * @memberof Workbook
- */
- getSnapshot() {
- return this._snapshot;
- }
- /** @deprecated use use name property instead */
- getName() {
- return this._snapshot.name;
- }
- setName(e) {
- this._name$.next(e), this._snapshot.name = e;
- }
- getUnitId() {
- return this._unitId;
- }
- getRev() {
- var e;
- return (e = this._snapshot.rev) != null ? e : 1;
- }
- incrementRev() {
- this._snapshot.rev = this.getRev() + 1;
- }
- setRev(e) {
- this._snapshot.rev = e;
- }
- /**
- * Add a Worksheet into Workbook.
- */
- addWorksheet(e, n, r) {
- const { sheets: s, sheetOrder: i } = this._snapshot;
- if (s[e])
- return false;
- s[e] = r, i.splice(n, 0, e);
- const o = new es(this._unitId, r, this._styles);
- return this._worksheets.set(e, o), this._sheetCreated$.next(o), true;
- }
- getSheetOrders() {
- return this._snapshot.sheetOrder;
- }
- getWorksheets() {
- return this._worksheets;
- }
- getActiveSpreadsheet() {
- return this;
- }
- getStyles() {
- return this._styles;
- }
- getConfig() {
- return this._snapshot;
- }
- getIndexBySheetId(e) {
- const { sheetOrder: n } = this._snapshot;
- return n.findIndex((r) => r === e);
- }
- getActiveSheet(e) {
- if (!this._activeSheet && typeof e > "u")
- throw new Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);
- return this._activeSheet;
- }
- /**
- * If there is no active sheet, the first sheet would
- * be set active.
- * @returns
- */
- ensureActiveSheet() {
- const e = this._activeSheet;
- if (e)
- return e;
- const n = this._snapshot.sheetOrder;
- for (let s = 0, i = n.length; s < i; s++) {
- const o = this._worksheets.get(n[s]);
- if (o && o.isSheetHidden() !== we.TRUE)
- return this.setActiveSheet(o), o;
- }
- const r = this._worksheets.get(n[0]);
- return this.setActiveSheet(r), r;
- }
- /**
- * ActiveSheet should not be null!
- * There is at least one sheet in a workbook. You can not delete all sheets in a workbook.
- * @param worksheet
- */
- setActiveSheet(e) {
- this._activeSheet$.next(e);
- }
- removeSheet(e) {
- const n = this._worksheets.get(e);
- 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;
- }
- getActiveSheetIndex() {
- const { sheetOrder: e } = this._snapshot;
- return e.findIndex((n) => this._worksheets.get(n) === this._activeSheet);
- }
- getSheetSize() {
- return this._snapshot.sheetOrder.length;
- }
- getSheets() {
- const { sheetOrder: e } = this._snapshot;
- return e.map((n) => this._worksheets.get(n));
- }
- getSheetsName() {
- const { sheetOrder: e } = this._snapshot, n = [];
- return e.forEach((r) => {
- const s = this._worksheets.get(r);
- s && n.push(s.getName());
- }), n;
- }
- getSheetIndex(e) {
- const { sheetOrder: n } = this._snapshot;
- return n.findIndex((r) => e.getSheetId() === r);
- }
- getSheetBySheetName(e) {
- const { sheetOrder: n } = this._snapshot, r = n.find((s) => this._worksheets.get(s).getName() === e);
- return this._worksheets.get(r);
- }
- getSheetBySheetId(e) {
- return this._worksheets.get(e);
- }
- getSheetByIndex(e) {
- const { sheetOrder: n } = this._snapshot;
- return this._worksheets.get(n[e]);
- }
- getHiddenWorksheets() {
- return this.getSheets().filter((e) => e.getConfig().hidden === we.TRUE).map((e) => e.getConfig().id);
- }
- getUnhiddenWorksheets() {
- return this.getSheets().filter((e) => e.getConfig().hidden !== we.TRUE).map((e) => e.getConfig().id);
- }
- load(e) {
- this._snapshot = e;
- }
- /**
- * Check if sheet name is unique
- * @param name sheet name
- * @returns True if sheet name is unique
- */
- checkSheetName(e) {
- return this.getSheetsName().includes(e);
- }
- /**
- * Check whether the sheet name is unique and generate a new unique sheet name
- * @param name sheet name
- * @returns Unique sheet name
- */
- uniqueSheetName(e = "Sheet1") {
- let n = e;
- for (; this.checkSheetName(n); )
- n = e + this._count, this._count++;
- return n;
- }
- /**
- * Automatically generate new sheet name
- * @param name sheet name
- * @returns New sheet name
- */
- generateNewSheetName(e) {
- let n = e + this._count;
- for (; this.checkSheetName(n); )
- n = e + this._count, this._count++;
- return n;
- }
- // FIXME: now we always create worksheet from DEFAULT_WORKSHEET?
- /**
- * Get Default Sheet
- */
- _parseWorksheetSnapshots() {
- const { _snapshot: e, _worksheets: n } = this, { sheets: r, sheetOrder: s } = e;
- if (re.isEmptyObject(r)) {
- const i = re.generateRandomId();
- r[i] = { id: i };
- }
- for (const i in r) {
- const o = r[i], { name: a } = o;
- 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.`);
- const u = new es(this._unitId, o, this._styles);
- n.set(i, u), s.includes(i) || s.push(i);
- }
- this.ensureActiveSheet();
- }
- /**
- * Get custom metadata of workbook
- * @returns {CustomData | undefined} custom metadata
- */
- getCustomMetadata() {
- return this._snapshot.custom;
- }
- /**
- * Set custom metadata of workbook
- * @param {CustomData | undefined} custom custom metadata
- */
- setCustomMetadata(e) {
- this._snapshot.custom = e;
- }
- };
- ts = sE([
- iE(1, Mt)
- ], ts);
- var cl = class extends Ui {
- constructor(n) {
- var r;
- super();
- C(this, "type", Fe.UNIVER_SLIDE);
- C(this, "_activePage$", new BehaviorSubject(null));
- C(this, "activePage$", this._activePage$.asObservable());
- C(this, "_name$");
- C(this, "name$");
- C(this, "_snapshot");
- C(this, "_unitId");
- 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();
- }
- get _activePage() {
- var r, s;
- const n = this._activePage$.getValue();
- if (!n) {
- const i = (r = this.getPageOrder()) == null ? void 0 : r[0];
- return i ? (s = this.getPages()) == null ? void 0 : s[i] : null;
- }
- return n;
- }
- setName(n) {
- var r;
- this._snapshot.title = n, this._name$.next(n), this._unitId = (r = this._snapshot.id) != null ? r : qt(6);
- }
- getRev() {
- return 0;
- }
- incrementRev() {
- }
- setRev(n) {
- }
- getSnapshot() {
- return this._snapshot;
- }
- getUnitId() {
- return this._unitId;
- }
- getPages() {
- var n;
- return (n = this._snapshot.body) == null ? void 0 : n.pages;
- }
- getPageOrder() {
- var n;
- return (n = this._snapshot.body) == null ? void 0 : n.pageOrder;
- }
- getPage(n) {
- const r = this.getPages();
- return r == null ? void 0 : r[n];
- }
- getElementsByPage(n) {
- var r;
- return (r = this.getPage(n)) == null ? void 0 : r.pageElements;
- }
- getElement(n, r) {
- var s;
- return (s = this.getElementsByPage(n)) == null ? void 0 : s[r];
- }
- getPageSize() {
- return this._snapshot.pageSize;
- }
- getBlankPage() {
- const n = qt(6);
- return {
- id: n,
- pageType: Fu.SLIDE,
- zIndex: 10,
- title: n,
- description: "",
- pageBackgroundFill: {
- rgb: "rgb(255,255,255)"
- },
- pageElements: {}
- };
- }
- setActivePage(n) {
- this._activePage$.next(n);
- }
- getActivePage() {
- return this._activePage;
- }
- updatePage(n, r) {
- this._snapshot.body && (this._snapshot.body.pages[n] = r);
- }
- appendPage(n) {
- var i;
- if (!this._snapshot.body)
- return;
- this._snapshot.body.pages[n.id] = n;
- const r = this._activePage, s = this._snapshot.body.pageOrder.indexOf((i = r == null ? void 0 : r.id) != null ? i : "");
- this._snapshot.body.pageOrder.splice(s + 1, 0, n.id);
- }
- };
- var Ar = "FOCUSING_UNIT";
- var Gn = "FOCUSING_SHEET";
- var Nr = "FOCUSING_DOC";
- var Tr = "FOCUSING_SLIDE";
- var _R = "FOCUSING_EDITOR_BUT_HIDDEN";
- var oE = "EDITOR_ACTIVATED";
- var ER = "FOCUSING_EDITOR_INPUT_FORMULA";
- var aE = "FOCUSING_FX_BAR_EDITOR";
- var CR = "FOCUSING_UNIVER_EDITOR";
- var RR = "FOCUSING_EDITOR_INPUT_FORMULA";
- var IR = "FOCUSING_PANEL_EDITOR";
- var vR = "FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE";
- var yR = "FOCUSING_COMMON_DRAWINGS";
- var wR = "FORMULA_EDITOR_ACTIVATED";
- var uE = Object.defineProperty;
- var lE = Object.getOwnPropertyDescriptor;
- var cE = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? lE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && uE(e, n, s), s;
- };
- var Ea = (t, e) => (n, r) => e(n, r, t);
- var _n = Ct("univer.current");
- var ni = class extends nt {
- constructor(e, n) {
- super();
- C(this, "_unitsByType", /* @__PURE__ */ new Map());
- C(this, "_createHandler");
- C(this, "_ctorByType", /* @__PURE__ */ new Map());
- C(this, "_currentUnits", /* @__PURE__ */ new Map());
- C(this, "_currentUnits$", new BehaviorSubject(this._currentUnits));
- C(this, "currentUnits$", this._currentUnits$.asObservable());
- C(this, "_unitAdded$", new Subject());
- C(this, "unitAdded$", this._unitAdded$.asObservable());
- C(this, "_unitDisposed$", new Subject());
- C(this, "unitDisposed$", this._unitDisposed$.asObservable());
- C(this, "_focused$", new BehaviorSubject(null));
- C(this, "focused$", this._focused$.asObservable());
- this._injector = e, this._contextService = n;
- }
- dispose() {
- super.dispose(), this._focused$.complete();
- }
- __setCreateHandler(e) {
- this._createHandler = e;
- }
- createUnit(e, n, r) {
- return this._createHandler(e, n, this._ctorByType.get(e), r);
- }
- registerCtorForType(e, n) {
- return this._ctorByType.set(e, n), {
- dispose: () => {
- this._ctorByType.delete(e);
- }
- };
- }
- getCurrentTypeOfUnit$(e) {
- return this.currentUnits$.pipe(map((n) => {
- var r;
- return (r = n.get(e)) != null ? r : null;
- }), distinctUntilChanged());
- }
- getCurrentUnitForType(e) {
- return this._currentUnits.get(e);
- }
- setCurrentUnitForType(e) {
- const n = this._getUnitById(e);
- if (!n)
- throw new Error(`[UniverInstanceService]: no document with unitId ${e}!`);
- this._currentUnits.set(n[1], n[0]), this._currentUnits$.next(this._currentUnits);
- }
- getTypeOfUnitAdded$(e) {
- return this._unitAdded$.pipe(filter((n) => n.type === e));
- }
- /**
- * Add a unit into Univer.
- *
- * @ignore
- *
- * @param unit The unit to be added.
- */
- __addUnit(e, n) {
- var o;
- const r = e.type;
- this._unitsByType.has(r) || this._unitsByType.set(r, []);
- const s = this._unitsByType.get(r), i = e.getUnitId();
- if (s.findIndex((a) => a.getUnitId() === i) !== -1)
- throw new Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${i}.`);
- s.push(e), this._unitAdded$.next(e), ((o = n == null ? void 0 : n.makeCurrent) == null || o) && this.setCurrentUnitForType(e.getUnitId());
- }
- getTypeOfUnitDisposed$(e) {
- return this.unitDisposed$.pipe(filter((n) => n.type === e));
- }
- getUnit(e, n) {
- var s;
- const r = (s = this._getUnitById(e)) == null ? void 0 : s[0];
- return n && (r == null ? void 0 : r.type) !== n ? null : r;
- }
- getCurrentUniverDocInstance() {
- return this.getCurrentUnitForType(Fe.UNIVER_DOC);
- }
- getUniverDocInstance(e) {
- return this.getUnit(e, Fe.UNIVER_DOC);
- }
- getUniverSheetInstance(e) {
- return this.getUnit(e, Fe.UNIVER_SHEET);
- }
- getAllUnitsForType(e) {
- var n;
- return (n = this._unitsByType.get(e)) != null ? n : [];
- }
- changeDoc(e, n) {
- const r = this.getAllUnitsForType(Fe.UNIVER_DOC), s = r.find((i) => i.getUnitId() === e);
- if (s != null) {
- const i = r.indexOf(s);
- r.splice(i, 1);
- }
- this.__addUnit(n);
- }
- get focused() {
- var n;
- const e = this._focused$.getValue();
- return e ? (n = this._getUnitById(e)) == null ? void 0 : n[0] : null;
- }
- focusUnit(e) {
- 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));
- }
- getFocusedUnit() {
- return this.focused;
- }
- getUnitType(e) {
- const n = this._getUnitById(e);
- return n ? n[1] : Fe.UNRECOGNIZED;
- }
- disposeUnit(e) {
- const n = this._getUnitById(e);
- if (!n)
- return false;
- const [r, s] = n, i = this._unitsByType.get(s), o = i.indexOf(r);
- return i.splice(o, 1), this._tryRemoveCurrentUnitForType(e, s), this._tryBlurUnitOnRemoval(e), this._unitDisposed$.next(r), true;
- }
- _tryRemoveCurrentUnitForType(e, n) {
- const r = this.getCurrentUnitForType(n);
- (r == null ? void 0 : r.getUnitId()) === e && (this._currentUnits.set(n, null), this._currentUnits$.next(this._currentUnits));
- }
- _tryBlurUnitOnRemoval(e) {
- var n;
- ((n = this.focused) == null ? void 0 : n.getUnitId()) === e && this._focused$.next(null);
- }
- _getUnitById(e) {
- for (const [n, r] of this._unitsByType) {
- const s = r.find((i) => i.getUnitId() === e);
- if (s)
- return [s, n];
- }
- }
- };
- ni = cE([
- Ea(0, ot(Ot)),
- Ea(1, fs)
- ], ni);
- 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 || {});
- var hE = {
- 0: "Starting",
- 1: "Ready",
- 2: "Rendered",
- 3: "Steady"
- };
- var dE = Object.defineProperty;
- var fE = Object.getOwnPropertyDescriptor;
- var gE = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? fE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && dE(e, n, s), s;
- };
- var pE = (t, e) => (n, r) => e(n, r, t);
- var Ht = class extends nt {
- constructor(e) {
- super();
- C(this, "_lifecycle$", new BehaviorSubject(Ve.Starting));
- C(this, "lifecycle$", this._lifecycle$.asObservable());
- C(this, "_lock", false);
- this._logService = e, this._reportProgress(Ve.Starting);
- }
- get stage() {
- return this._lifecycle$.getValue();
- }
- set stage(e) {
- if (this._lock)
- throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");
- if (e < this.stage)
- throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");
- e !== this.stage && (this._lock = true, this._reportProgress(e), this._lifecycle$.next(e), this._lock = false);
- }
- dispose() {
- this._lifecycle$.complete(), super.dispose();
- }
- /**
- * Subscribe to lifecycle changes and all previous stages and the current
- * stage will be emitted immediately.
- * @returns
- */
- subscribeWithPrevious() {
- return merge(hl(this.stage), this._lifecycle$.pipe(skip(1))).pipe(Kf((e) => e === Ve.Steady));
- }
- _reportProgress(e) {
- this._logService.debug("[LifecycleService]", `lifecycle progressed to "${hE[e]}".`);
- }
- };
- Ht = gE([
- pE(0, Mt)
- ], Ht);
- function hl(t) {
- switch (t) {
- case Ve.Starting:
- return of(Ve.Starting);
- case Ve.Ready:
- return of(Ve.Starting, Ve.Ready);
- case Ve.Rendered:
- return of(Ve.Starting, Ve.Ready, Ve.Rendered);
- default:
- return of(
- Ve.Starting,
- Ve.Ready,
- Ve.Rendered,
- Ve.Steady
- );
- }
- }
- var mE = Object.defineProperty;
- var _E = Object.getOwnPropertyDescriptor;
- var EE = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? _E(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && mE(e, n, s), s;
- };
- var xs = (t, e) => (n, r) => e(n, r, t);
- var cn = Ct("univer.undo-redo.service");
- var CE = 20;
- var dl = class {
- dispose() {
- }
- async dispatchToHandlers() {
- return false;
- }
- };
- var RE = "univer.command.redo";
- var IE = "univer.command.undo";
- var Nn = new class extends dl {
- constructor() {
- super(...arguments);
- C(this, "type", ar.COMMAND);
- C(this, "id", IE);
- }
- handler(e) {
- const n = e.get(cn), r = n.pitchTopUndoElement();
- if (!r)
- return false;
- const s = e.get(Pt);
- return mu(r.undoMutations, s) ? (n.popUndoToRedo(), true) : false;
- }
- }();
- var Tn = new class extends dl {
- constructor() {
- super(...arguments);
- C(this, "type", ar.COMMAND);
- C(this, "id", RE);
- }
- handler(e) {
- const n = e.get(cn), r = n.pitchTopRedoElement();
- if (!r)
- return false;
- const s = e.get(Pt);
- return mu(r.redoMutations, s) ? (n.popRedoToUndo(), true) : false;
- }
- }();
- var ri = class extends nt {
- constructor(e, n, r) {
- super();
- C(this, "undoRedoStatus$");
- C(this, "_undoRedoStatus$", new BehaviorSubject({ undos: 0, redos: 0 }));
- C(this, "_undoStacks", /* @__PURE__ */ new Map());
- C(this, "_redoStacks", /* @__PURE__ */ new Map());
- C(this, "_batchingStatus", /* @__PURE__ */ new Map());
- 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())));
- }
- pushUndoRedo(e) {
- const { unitID: n } = e, r = this._getRedoStack(n, true), s = this._getUndoStack(n, true);
- if (r.length = 0, this._batchingStatus.has(e.unitID)) {
- const o = this._batchingStatus.get(e.unitID), a = this._pitchUndoElement(e.unitID);
- o === 0 || !a ? (i(e), this._batchingStatus.set(
- e.unitID,
- 1
- /* CREATED */
- )) : this._tryBatchingElements(a, e);
- } else
- i(e);
- function i(o) {
- s.push(o), s.length > CE && s.splice(0, 1);
- }
- this._updateStatus();
- }
- clearUndoRedo(e) {
- const n = this._getRedoStack(e);
- n && (n.length = 0);
- const r = this._getUndoStack(e);
- r && (r.length = 0), this._updateStatus();
- }
- pitchTopUndoElement() {
- const e = this._getFocusedUnitId();
- return this._pitchUndoElement(e);
- }
- pitchTopRedoElement() {
- const e = this._getFocusedUnitId();
- return this._pitchRedoElement(e);
- }
- _pitchUndoElement(e) {
- const n = this._getUndoStack(e);
- return n != null && n.length ? n[n.length - 1] : null;
- }
- _pitchRedoElement(e) {
- const n = this._getRedoStack(e);
- return n != null && n.length ? n[n.length - 1] : null;
- }
- popUndoToRedo() {
- const n = this._getUndoStackForFocused().pop();
- n && (this._getRedoStackForFocused().push(n), this._updateStatus());
- }
- popRedoToUndo() {
- const n = this._getRedoStackForFocused().pop();
- n && (this._getUndoStackForFocused().push(n), this._updateStatus());
- }
- __tempBatchingUndoRedo(e) {
- if (this._batchingStatus.has(e))
- throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");
- return this._batchingStatus.set(
- e,
- 0
- /* WAITING */
- ), Ze(() => this._batchingStatus.delete(e));
- }
- _updateStatus() {
- var s, i;
- 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;
- this._undoRedoStatus$.next({
- undos: n,
- redos: r
- });
- }
- _getUndoStack(e, n = false) {
- let r = this._undoStacks.get(e);
- return !r && n && (r = [], this._undoStacks.set(e, r)), r || null;
- }
- _getRedoStack(e, n = false) {
- let r = this._redoStacks.get(e);
- return !r && n && (r = [], this._redoStacks.set(e, r)), r || null;
- }
- _getUndoStackForFocused() {
- const e = this._getFocusedUnitId();
- if (!e)
- throw new Error("No focused univer instance!");
- return this._getUndoStack(e, true);
- }
- _getRedoStackForFocused() {
- const e = this._getFocusedUnitId();
- if (!e)
- throw new Error("No focused univer instance!");
- return this._getRedoStack(e, true);
- }
- _tryBatchingElements(e, n) {
- e.redoMutations.push(...n.redoMutations), e.undoMutations.push(...n.undoMutations);
- }
- _getFocusedUnitId() {
- var i, o, a, u;
- let e = "";
- const n = this._contextService.getContextValue(Gn), r = this._contextService.getContextValue(aE), s = this._contextService.getContextValue(oE);
- 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;
- }
- };
- ri = EE([
- xs(0, _n),
- xs(1, Pt),
- xs(2, fs)
- ], ri);
- var Bi = Ct("core.resource-manager.service");
- var si = {
- [Tt.Editor]: "Editor",
- [Tt.Owner]: "Owner",
- [Tt.Reader]: "Reader",
- [Tt.UNRECOGNIZED]: "UNRECOGNIZED"
- };
- var ii = (t) => t ? {
- userID: `${si[t]}_${re.generateRandomId(8)}`,
- name: si[t],
- avatar: ""
- } : {
- userID: "",
- name: "",
- avatar: "",
- anonymous: true,
- canBindAnonymous: false
- };
- var vE = (t, e) => t.startsWith(si[e]);
- var rr = class {
- constructor() {
- C(this, "_model", /* @__PURE__ */ new Map());
- C(this, "_userChange$", new Subject());
- C(this, "userChange$", this._userChange$.asObservable());
- C(this, "_currentUser$", new BehaviorSubject(ii()));
- C(this, "currentUser$", this._currentUser$.asObservable());
- }
- getCurrentUser() {
- return this._currentUser$.getValue();
- }
- setCurrentUser(e) {
- this.addUser(e), this._currentUser$.next(e);
- }
- addUser(e) {
- this._model.set(e.userID, e), this._userChange$.next({ type: "add", user: e });
- }
- getUser(e, n) {
- const r = this._model.get(e);
- if (r)
- return r;
- n && n();
- }
- delete(e) {
- const n = this.getUser(e);
- this._model.delete(e), n && this._userChange$.next({ type: "delete", user: n });
- }
- clear() {
- this._model.clear(), this._userChange$.next({ type: "clear" });
- }
- list() {
- return Array.from(this._model.values());
- }
- };
- var yE = Object.defineProperty;
- var wE = Object.getOwnPropertyDescriptor;
- var OE = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? wE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && yE(e, n, s), s;
- };
- var Ca = (t, e) => (n, r) => e(n, r, t);
- var oi = class {
- // private _sheetPermissionPointMap: Map<string, { action: UnitAction; allowed: boolean }[]> = new Map();
- constructor(t, e) {
- C(this, "_permissionMap", /* @__PURE__ */ new Map([]));
- this._resourceManagerService = t, this._userManagerService = e, this._initSnapshot(), this._initDefaultUser();
- }
- _initDefaultUser() {
- const t = this._userManagerService.getCurrentUser();
- t && t.userID || this._userManagerService.setCurrentUser(ii(Tt.Owner));
- }
- _getRole(t) {
- const e = this._userManagerService.getCurrentUser();
- return e ? vE(e.userID, t) : false;
- }
- _initSnapshot() {
- this._resourceManagerService.registerPluginResource({
- toJson: (t) => {
- const e = [...this._permissionMap.keys()].reduce((n, r) => {
- const s = this._permissionMap.get(r);
- return n[r] = s, n;
- }, {});
- return JSON.stringify(e);
- },
- parseJson: (t) => JSON.parse(t),
- pluginName: "SHEET_AuthzIoMockService_PLUGIN",
- businesses: [Fe.UNIVER_SHEET, Fe.UNIVER_DOC, Fe.UNIVER_SLIDE],
- onLoad: (t, e) => {
- for (const n in e)
- this._permissionMap.set(n, e[n]);
- },
- onUnLoad: () => {
- this._permissionMap.clear();
- }
- });
- }
- async create(t) {
- return qt(8);
- }
- async allowed(t) {
- return Promise.resolve([]);
- }
- async batchAllowed(t) {
- return Promise.resolve([]);
- }
- // eslint-disable-next-line max-lines-per-function
- async list(t) {
- const e = [];
- return t.objectIDs.forEach((n) => {
- const r = this._permissionMap.get(n);
- if (r) {
- const s = {
- objectID: n,
- unitID: t.unitID,
- objectType: r.objectType,
- name: r.name,
- shareOn: false,
- shareRole: Tt.Owner,
- shareScope: -1,
- scope: {
- read: Js.AllCollaborator,
- edit: Js.AllCollaborator
- },
- creator: ii(Tt.Owner),
- strategies: [
- {
- action: 6,
- role: 1
- },
- {
- action: 16,
- role: 1
- },
- {
- action: 17,
- role: 1
- },
- {
- action: 18,
- role: 1
- },
- {
- action: 19,
- role: 1
- },
- {
- action: 33,
- role: 1
- },
- {
- action: 34,
- role: 1
- },
- {
- action: 35,
- role: 1
- },
- {
- action: 36,
- role: 1
- },
- {
- action: 37,
- role: 1
- },
- {
- action: 38,
- role: 1
- },
- {
- action: 39,
- role: 1
- },
- {
- action: 40,
- role: 1
- }
- ],
- actions: t.actions.map((i) => ({ action: i, allowed: this._getRole(Tt.Owner) || this._getRole(Tt.Editor) }))
- };
- e.push(s);
- }
- }), e;
- }
- async listCollaborators() {
- return [];
- }
- async listRoles() {
- return {
- roles: [],
- actions: []
- };
- }
- async deleteCollaborator() {
- }
- async update(t) {
- }
- async updateCollaborator() {
- }
- async createCollaborator() {
- }
- async putCollaborators(t) {
- }
- };
- oi = OE([
- Ca(0, Bi),
- Ca(1, ot(rr))
- ], oi);
- var bE = Ct("IAuthzIoIoService");
- var SE = Ct("univer.config-service");
- var AE = class {
- constructor() {
- C(this, "_configChanged$", new Subject());
- C(this, "configChanged$", this._configChanged$.asObservable());
- C(this, "_config", /* @__PURE__ */ new Map());
- }
- dispose() {
- this._configChanged$.complete();
- }
- getConfig(e) {
- return this._config.get(e);
- }
- setConfig(e, n, r) {
- var o;
- const { merge: s = false } = r || {};
- let i = (o = this._config.get(e)) != null ? o : {};
- s ? i = nu(i, n) : i = n, this._config.set(e, i), this._configChanged$.next({ [e]: i });
- }
- deleteConfig(e) {
- return this._config.delete(e);
- }
- subscribeConfigValue$(e) {
- return new Observable((n) => {
- Object.prototype.hasOwnProperty.call(this._config, e) && n.next(this._config.get(e));
- const r = this.configChanged$.pipe(filter((s) => Object.prototype.hasOwnProperty.call(s, e))).subscribe((s) => n.next(s[e]));
- return () => r.unsubscribe();
- });
- }
- };
- var NE = class extends nt {
- constructor() {
- super(...arguments);
- C(this, "_error$", new Subject());
- C(this, "error$", this._error$.asObservable());
- }
- dispose() {
- this._error$.complete();
- }
- emit(n) {
- this._error$.next({ errorKey: n });
- }
- };
- var Vr = class extends nt {
- constructor() {
- super();
- C(this, "_currentLocale$", new BehaviorSubject(ur.ZH_CN));
- C(this, "currentLocale$", this._currentLocale$.asObservable());
- C(this, "_locales", null);
- C(this, "localeChanged$", new Subject());
- C(this, "t", (n, ...r) => {
- if (!this._locales)
- throw new Error("[LocaleService]: Locale not initialized");
- const s = n.split("."), i = this.resolveKeyPath(this._locales[this._currentLocale], s);
- if (typeof i == "string") {
- let o = i;
- return r.forEach((a, u) => {
- o = o.replace(`{${u}}`, a);
- }), o;
- } else
- return n;
- });
- this.disposeWithMe(Ze(() => this.localeChanged$.complete()));
- }
- get _currentLocale() {
- return this._currentLocale$.value;
- }
- /**
- * Load more locales after init.
- *
- * @param locales - Locale object
- */
- load(n) {
- var r;
- this._locales = nu((r = this._locales) != null ? r : {}, n);
- }
- setLocale(n) {
- this._currentLocale$.next(n), this.localeChanged$.next();
- }
- getLocales() {
- var n;
- return (n = this._locales) == null ? void 0 : n[this._currentLocale];
- }
- getCurrentLocale() {
- return this._currentLocale;
- }
- resolveKeyPath(n, r) {
- const s = r.shift();
- if (s && n && s in n) {
- const i = n[s];
- return r.length > 0 && (typeof i == "object" || Array.isArray(i)) ? this.resolveKeyPath(i, r) : i;
- }
- return null;
- }
- };
- var TE = Object.defineProperty;
- var ME = Object.getOwnPropertyDescriptor;
- var DE = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? ME(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && TE(e, n, s), s;
- };
- var xE = (t, e) => (n, r) => e(n, r, t);
- var ai = class {
- constructor(t) {
- this._userManagerService = t;
- }
- async list(t) {
- return {
- list: [{
- type: Zr.PERSON,
- mentions: [
- {
- objectType: Zr.PERSON,
- objectId: this._userManagerService.getCurrentUser().userID,
- label: this._userManagerService.getCurrentUser().name,
- metadata: {
- icon: this._userManagerService.getCurrentUser().avatar
- }
- }
- ],
- metadata: {},
- title: "PEOPLE"
- }],
- page: t.page,
- size: t.size,
- total: 1
- };
- }
- };
- ai = DE([
- xE(0, ot(rr))
- ], ai);
- var LE = Ct("univer.service.mention-io");
- var fl = ((t) => (t.INIT = "init", t.FETCHING = "fetching", t.DONE = "done", t))(fl || {});
- var UE = Ct("univer.permission-service");
- var PE = class extends nt {
- constructor() {
- super(...arguments);
- C(this, "_permissionPointMap", /* @__PURE__ */ new Map());
- C(this, "_permissionPointUpdate$", new Subject());
- C(this, "permissionPointUpdate$", this._permissionPointUpdate$.asObservable());
- C(this, "_showComponents", true);
- }
- setShowComponents(n) {
- this._showComponents = n;
- }
- getShowComponents() {
- return this._showComponents;
- }
- deletePermissionPoint(n) {
- const r = this._permissionPointMap.get(n);
- r && (r.complete(), this._permissionPointMap.delete(n));
- }
- addPermissionPoint(n) {
- const r = n instanceof BehaviorSubject, s = r ? n.getValue() : n;
- if (!s.id)
- return false;
- if (this._permissionPointMap.get(s.id))
- throw new Error(`${s.id} PermissionPoint already exists`);
- return this._permissionPointMap.set(s.id, r ? n : new BehaviorSubject(s)), this._permissionPointUpdate$.next(s), true;
- }
- updatePermissionPoint(n, r) {
- const s = this._permissionPointMap.get(n);
- if (!s)
- return;
- const i = s.getValue();
- i.value = r, i.status = fl.DONE, s.next(i), this._permissionPointUpdate$.next(i);
- }
- clearPermissionMap() {
- this._permissionPointMap.clear();
- }
- getPermissionPoint(n) {
- const r = this._permissionPointMap.get(n);
- if (r)
- return r.getValue();
- }
- getPermissionPoint$(n) {
- const r = this._permissionPointMap.get(n);
- if (r)
- return r;
- }
- composePermission$(n) {
- const r = n.map((s) => {
- var o;
- const i = (o = this._permissionPointMap) == null ? void 0 : o.get(s);
- if (!i)
- throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);
- return i.asObservable();
- });
- return combineLatest(r).pipe(
- // Check that all permissions exist
- map((s) => s)
- );
- }
- composePermission(n) {
- return n.map((s) => {
- var o;
- const i = (o = this._permissionPointMap) == null ? void 0 : o.get(s);
- if (!i)
- throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);
- return i.getValue();
- });
- }
- getAllPermissionPoint() {
- const n = /* @__PURE__ */ new Map();
- return this._permissionPointMap.forEach((r, s) => {
- n.set(s, r);
- }), n;
- }
- };
- function kE(t, e) {
- if (!e)
- return t;
- const n = [];
- for (const r of t) {
- const s = e.find(([i]) => i === r[0]);
- if (s) {
- if (s[1] === null)
- continue;
- n.push([r[0], s[1]]);
- } else
- n.push(r);
- }
- return n;
- }
- var gl = Symbol("DependentOn");
- var Ra = class extends nt {
- onStarting() {
- }
- onReady() {
- }
- onRendered() {
- }
- onSteady() {
- }
- getUniverInstanceType() {
- return this.constructor.type;
- }
- getPluginName() {
- return this.constructor.pluginName;
- }
- };
- C(Ra, "pluginName"), C(Ra, "type", Fe.UNIVER_UNKNOWN);
- var FE = class {
- constructor() {
- C(this, "_plugins", []);
- }
- addPlugin(e) {
- this._plugins.push(e);
- }
- removePlugins() {
- const e = this._plugins.slice();
- return this._plugins.length = 0, e;
- }
- forEachPlugin(e) {
- this._plugins.forEach(e);
- }
- };
- var $E = class {
- constructor() {
- C(this, "_pluginsRegistered", []);
- }
- // eslint-disable-next-line ts/no-explicit-any
- registerPlugin(e, n) {
- this._pluginsRegistered.push({ plugin: e, options: n });
- }
- getRegisterPlugins() {
- return this._pluginsRegistered.slice();
- }
- removePlugins() {
- this._pluginsRegistered = [];
- }
- };
- var BE = Object.defineProperty;
- var jE = Object.getOwnPropertyDescriptor;
- var pl = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? jE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && BE(e, n, s), s;
- };
- var Gr = (t, e) => (n, r) => e(n, r, t);
- var HE = 4;
- function OR(...t) {
- return function(e) {
- e[gl] = t;
- };
- }
- var ns = class {
- constructor(t) {
- C(this, "_pluginHolderForUniver");
- C(this, "_pluginHoldersForTypes", /* @__PURE__ */ new Map());
- C(this, "_seenPlugins", /* @__PURE__ */ new Set());
- C(this, "_flushTimer");
- this._injector = t, this._pluginHolderForUniver = this._injector.createInstance(
- rs,
- this._checkPluginSeen.bind(this),
- this._immediateInitPlugin.bind(this)
- ), this._pluginHoldersForTypes.set(Fe.UNIVER_UNKNOWN, this._pluginHolderForUniver), this._pluginHolderForUniver.start();
- }
- dispose() {
- this._clearFlushTimer();
- for (const t of this._pluginHoldersForTypes.values())
- t.dispose();
- this._pluginHolderForUniver.dispose();
- }
- /** Register a plugin into univer. */
- registerPlugin(t, e) {
- this._assertPluginValid(t), this._scheduleInitPlugin();
- const { type: n } = t;
- n === Fe.UNIVER_UNKNOWN ? (this._pluginHolderForUniver.register(t, e), this._pluginHolderForUniver.flush()) : this._ensurePluginHolderForType(n).register(t, e);
- }
- startPluginForType(t) {
- this._ensurePluginHolderForType(t).start();
- }
- _ensurePluginHolderForType(t) {
- if (!this._pluginHoldersForTypes.has(t)) {
- const e = this._injector.createInstance(
- rs,
- this._checkPluginSeen.bind(this),
- this._immediateInitPlugin.bind(this)
- );
- return this._pluginHoldersForTypes.set(t, e), e;
- }
- return this._pluginHoldersForTypes.get(t);
- }
- _immediateInitPlugin(t) {
- this._seenPlugins.add(t.pluginName), this._ensurePluginHolderForType(t.type).immediateInitPlugin(t);
- }
- _checkPluginSeen(t) {
- return this._seenPlugins.has(t.pluginName);
- }
- _assertPluginValid(t) {
- const { type: e, pluginName: n } = t;
- if (e === Fe.UNRECOGNIZED)
- throw new Error(`[PluginService]: invalid plugin type for ${t.name}. Please assign a "type" to your plugin.`);
- if (!n)
- throw new Error(`[PluginService]: no plugin name for ${t.name}. Please assign a "pluginName" to your plugin.`);
- if (this._seenPlugins.has(n))
- 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.`);
- this._seenPlugins.add(t.pluginName);
- }
- _scheduleInitPlugin() {
- this._flushTimer === void 0 && (this._flushTimer = setTimeout(
- () => {
- this._pluginHolderForUniver.started || this._pluginHolderForUniver.start(), this._flushPlugins(), this._clearFlushTimer();
- },
- HE
- ));
- }
- _clearFlushTimer() {
- this._flushTimer && (clearTimeout(this._flushTimer), this._flushTimer = void 0);
- }
- _flushPlugins() {
- this._pluginHolderForUniver.flush();
- for (const [t, e] of this._pluginHoldersForTypes)
- e.started && e.flush();
- }
- };
- ns = pl([
- Gr(0, ot(Ot))
- ], ns);
- var rs = class extends nt {
- constructor(e, n, r, s, i) {
- super();
- C(this, "_started", false);
- C(this, "_warnedAboutOnStartingDeprecation", false);
- C(this, "_pluginRegistry", new $E());
- C(this, "_pluginStore", new FE());
- C(this, "_pluginsInBatches", []);
- 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) => {
- this._pluginsInBatches.forEach((a) => this._runStage(a, o));
- }));
- }
- get started() {
- return this._started;
- }
- dispose() {
- super.dispose(), this._pluginStore.forEachPlugin((e) => e.dispose()), this._pluginStore.removePlugins(), this._pluginRegistry.removePlugins(), this._pluginsInBatches.length = 0;
- }
- register(e, n) {
- this._pluginRegistry.registerPlugin(e, n);
- }
- immediateInitPlugin(e) {
- const n = this._initPlugin(e, void 0);
- this._pluginsRunLifecycle([n]);
- }
- start() {
- this._started || (this._started = true, this.flush());
- }
- flush() {
- if (!this._started)
- return;
- const e = this._pluginRegistry.getRegisterPlugins().map(({ plugin: n, options: r }) => this._initPlugin(n, r));
- e.length && (this._pluginsRunLifecycle(e), this._pluginRegistry.removePlugins());
- }
- // eslint-disable-next-line ts/no-explicit-any
- _initPlugin(e, n) {
- const r = e[gl];
- if (r) {
- const i = () => {
- const o = r.find((a) => !this._checkPluginRegistered(a));
- return o ? (this._logService.debug(
- "[PluginService]",
- `Plugin "${e.pluginName}" depends on "${o.pluginName}" which is not registered. Univer will automatically register it with default configuration.`
- ), this._registerPlugin(o, void 0), true) : false;
- };
- for (; i(); )
- ;
- }
- const s = this._injector.createInstance(e, n);
- return this._pluginStore.addPlugin(s), this._logService.debug("[PluginService]", `Plugin "${s.getPluginName()}" registered.`), s;
- }
- // Here we should be careful with the sequence of which plugin should run first. We should manually add a queue here.
- // Because lately registered plugins may get executed first.
- _pluginsRunLifecycle(e) {
- hl(this._lifecycleService.stage).subscribe((n) => this._runStage(e, n)), this._pluginsInBatches.push(e);
- }
- _runStage(e, n) {
- e.forEach((r) => {
- switch (n) {
- case Ve.Starting:
- r.onStarting();
- break;
- case Ve.Ready:
- r.onReady();
- break;
- case Ve.Rendered:
- r.onRendered();
- break;
- case Ve.Steady:
- r.onSteady();
- break;
- }
- });
- }
- };
- rs = pl([
- Gr(2, Mt),
- Gr(3, ot(Ot)),
- Gr(4, ot(Ht))
- ], rs);
- var WE = Object.defineProperty;
- var zE = Object.getOwnPropertyDescriptor;
- var YE = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? zE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && WE(e, n, s), s;
- };
- var Ia = (t, e) => (n, r) => e(n, r, t);
- var ui = class extends nt {
- constructor(t, e) {
- super(), this._resourceManagerService = t, this._univerInstanceService = e, this._init();
- }
- _init() {
- const t = (n) => {
- n.businesses.forEach((r) => {
- switch (r) {
- case Fe.UNRECOGNIZED:
- case Fe.UNIVER_UNKNOWN:
- case Fe.UNIVER_SLIDE:
- case Fe.UNIVER_DOC: {
- this._univerInstanceService.getAllUnitsForType(Fe.UNIVER_DOC).forEach((s) => {
- const o = (s.getSnapshot().resources || []).find((a) => a.name === n.pluginName);
- if (o)
- try {
- const a = n.parseJson(o.data);
- n.onLoad(s.getUnitId(), a);
- } catch {
- console.error(`Load Document{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`);
- }
- });
- break;
- }
- case Fe.UNIVER_SHEET:
- this._univerInstanceService.getAllUnitsForType(Fe.UNIVER_SHEET).forEach((s) => {
- const o = (s.getSnapshot().resources || []).find((a) => a.name === n.pluginName);
- if (o)
- try {
- const a = n.parseJson(o.data);
- n.onLoad(s.getUnitId(), a);
- } catch {
- console.error(`Load Workbook{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`);
- }
- });
- }
- });
- };
- this._resourceManagerService.getAllResourceHooks().forEach((n) => t(n)), this.disposeWithMe(this._resourceManagerService.register$.subscribe((n) => t(n))), this.disposeWithMe(
- this._univerInstanceService.getTypeOfUnitAdded$(Fe.UNIVER_SHEET).subscribe((n) => {
- this._resourceManagerService.loadResources(n.getUnitId(), n.getSnapshot().resources);
- })
- ), this.disposeWithMe(
- this._univerInstanceService.getTypeOfUnitAdded$(Fe.UNIVER_DOC).subscribe((n) => {
- const r = n.getUnitId();
- zd(r) || this._resourceManagerService.loadResources(n.getUnitId(), n.getSnapshot().resources);
- })
- ), this.disposeWithMe(
- this._univerInstanceService.getTypeOfUnitDisposed$(Fe.UNIVER_SHEET).subscribe((n) => {
- this._resourceManagerService.unloadResources(n.getUnitId());
- })
- ), this.disposeWithMe(
- this._univerInstanceService.getTypeOfUnitDisposed$(Fe.UNIVER_DOC).subscribe((n) => {
- this._resourceManagerService.unloadResources(n.getUnitId());
- })
- );
- }
- saveUnit(t) {
- const e = this._univerInstanceService.getUnit(t);
- if (!e)
- return null;
- const n = this._resourceManagerService.getResources(t, e.type), r = re.deepClone(e.getSnapshot());
- return r.resources = n, r;
- }
- };
- ui = YE([
- Ia(0, ot(Bi)),
- Ia(1, ot(_n))
- ], ui);
- var va = Ct("resource-loader-service");
- var VE = class extends nt {
- constructor() {
- super(...arguments);
- C(this, "_resourceMap", /* @__PURE__ */ new Map());
- C(this, "_register$", new Subject());
- C(this, "register$", this._register$.asObservable());
- }
- getAllResourceHooks() {
- return [...this._resourceMap.values()];
- }
- getResources(n, r) {
- return r ? this.getResourcesByType(n, r) : this.getAllResourceHooks().map((o) => {
- const a = o.toJson(n);
- return {
- name: o.pluginName,
- data: a
- };
- });
- }
- getResourcesByType(n, r) {
- return this.getAllResourceHooks().filter((o) => o.businesses.includes(r)).map((o) => {
- const a = o.toJson(n);
- return {
- name: o.pluginName,
- data: a
- };
- });
- }
- registerPluginResource(n) {
- const r = n.pluginName;
- if (this._resourceMap.has(r))
- throw new Error(`the pluginName is registered {${r}}`);
- return this._resourceMap.set(r, n), this._register$.next(n), Ze(() => this._resourceMap.delete(r));
- }
- disposePluginResource(n) {
- this._resourceMap.delete(n);
- }
- loadResources(n, r) {
- this.getAllResourceHooks().forEach((s) => {
- var o;
- const i = (o = r == null ? void 0 : r.find((a) => a.name === s.pluginName)) == null ? void 0 : o.data;
- if (i)
- try {
- const a = s.parseJson(i);
- s.onLoad(n, a);
- } catch {
- console.error("LoadResources Error!");
- }
- });
- }
- unloadResources(n) {
- this.getAllResourceHooks().forEach((r) => {
- r.onUnLoad(n);
- });
- }
- dispose() {
- this._register$.complete(), this._resourceMap.clear();
- }
- };
- var ml = class extends nt {
- constructor() {
- super();
- C(this, "_currentTheme");
- C(this, "_currentTheme$", new BehaviorSubject({}));
- C(this, "currentTheme$", this._currentTheme$.asObservable());
- this.disposeWithMe(Ze(() => this._currentTheme$.complete()));
- }
- getCurrentTheme() {
- if (!this._currentTheme)
- throw new Error("[ThemeService]: current theme is not set!");
- return this._currentTheme;
- }
- setTheme(n) {
- this._currentTheme = n, this._currentTheme$.next(n);
- }
- };
- var GE = class {
- /**
- * Create a Univer instance.
- * @param config Configuration data for Univer
- * @param parentInjector An optional parent injector of the Univer injector. For more information, see https://redi.wendell.fun/docs/hierarchy.
- */
- constructor(e = {}, n) {
- C(this, "_startedTypes", /* @__PURE__ */ new Set());
- C(this, "_injector");
- C(this, "_disposingCallbacks", new Mi());
- const r = this._injector = KE(n, e == null ? void 0 : e.override), { theme: s, locale: i, locales: o, logLevel: a } = e;
- 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);
- }
- get _univerInstanceService() {
- return this._injector.get(_n);
- }
- get _pluginService() {
- return this._injector.get(ns);
- }
- __getInjector() {
- return this._injector;
- }
- /**
- * Register a callback function which will be called when this Univer instance is disposing.
- *
- * @ignore
- *
- * @param callback The callback function.
- * @returns To remove this callback function from this Univer instance's on disposing list.
- */
- onDispose(e) {
- const n = this._disposingCallbacks.add(Ze(e));
- return Ze(() => n.dispose(true));
- }
- dispose() {
- this._disposingCallbacks.dispose(), this._injector.dispose();
- }
- setLocale(e) {
- this._injector.get(Vr).setLocale(e);
- }
- createUnit(e, n) {
- return this._univerInstanceService.createUnit(e, n);
- }
- /**
- * Create a univer sheet instance with internal dependency injection.
- *
- * @deprecated use `createUnit` instead
- */
- createUniverSheet(e) {
- return this._injector.get(Mt).warn("[Univer]: Univer.createUniverSheet is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(Fe.UNIVER_SHEET, e);
- }
- /**
- * @deprecated use `createUnit` instead
- */
- createUniverDoc(e) {
- return this._injector.get(Mt).warn("[Univer]: Univer.createUniverDoc is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(Fe.UNIVER_DOC, e);
- }
- /**
- * @deprecated use `createUnit` instead
- */
- createUniverSlide(e) {
- return this._injector.get(Mt).warn("[Univer]: Univer.createUniverSlide is deprecated, use createUnit instead"), this._univerInstanceService.createUnit(Fe.UNIVER_SLIDE, e);
- }
- _init(e) {
- this._univerInstanceService.registerCtorForType(Fe.UNIVER_SHEET, ts), this._univerInstanceService.registerCtorForType(Fe.UNIVER_DOC, jt), this._univerInstanceService.registerCtorForType(Fe.UNIVER_SLIDE, cl);
- const n = e.get(_n);
- n.__setCreateHandler(
- (r, s, i, o) => {
- if (!this._startedTypes.has(r)) {
- this._pluginService.startPluginForType(r), this._startedTypes.add(r);
- const u = e.createInstance(i, s);
- return n.__addUnit(u, o), this._tryProgressToReady(), u;
- }
- const a = e.createInstance(i, s);
- return n.__addUnit(a, o), a;
- }
- );
- }
- _tryProgressToReady() {
- this._injector.get(Ht).stage < Ve.Ready && (this._injector.get(Ht).stage = Ve.Ready);
- }
- /** Register a plugin into univer. */
- registerPlugin(e, n) {
- this._pluginService.registerPlugin(e, n);
- }
- };
- function KE(t, e) {
- const n = kE([
- [NE],
- [Vr],
- [ml],
- [Ht],
- [ns],
- [rr],
- // abstract services
- [_n, { useClass: ni }],
- [UE, { useClass: PE }],
- [Mt, { useClass: Bf, lazy: true }],
- [Pt, { useClass: Ys }],
- [cn, { useClass: ri, lazy: true }],
- [SE, { useClass: AE }],
- [fs, { useClass: Ff }],
- [Bi, { useClass: VE, lazy: true }],
- [va, { useClass: ui, lazy: true }],
- [bE, { useClass: oi, lazy: true }],
- [LE, { useClass: ai, lazy: true }]
- ], e), r = t ? t.createChild(n) : new Ot(n);
- return Mf(r, [
- [rr],
- [va]
- ]), r;
- }
- var XE = Object.defineProperty;
- var JE = Object.getOwnPropertyDescriptor;
- var ZE = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? JE(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && XE(e, n, s), s;
- };
- var QE = (t, e) => (n, r) => e(n, r, t);
- var ss = class extends Fi {
- constructor(t, e) {
- super(), this._blob = t, this._injector = e;
- }
- /**
- * Returns a copy of this blob.
- * @returns a new blob by copying the current blob
- * @example
- * ```ts
- * const blob = univerAPI.newBlob(blob);
- * const newBlob = blob.copyBlob();
- * console.log(newBlob);
- * ```
- */
- copyBlob() {
- return this._injector.createInstance(ss, this._blob);
- }
- /**
- * Return the data inside this object as a blob converted to the specified content type.
- * @param contentType the content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types
- * @returns a new blob by converting the current blob to the specified content type
- * @example
- * ```ts
- * const blob = univerAPI.newBlob(blob);
- * const newBlob = blob.getBlob();
- * ```
- */
- getAs(t) {
- const e = this.copyBlob();
- return e.setContentType(t), e;
- }
- getDataAsString(t) {
- return this._blob === null ? Promise.resolve("") : t === void 0 ? this._blob.text() : new Promise((e, n) => {
- this._blob.arrayBuffer().then((r) => {
- const s = new TextDecoder(t).decode(r);
- e(s);
- }).catch((r) => {
- n(new Error(`Failed to read Blob as ArrayBuffer: ${r.message}`));
- });
- });
- }
- /**
- * Gets the data stored in this blob.
- * @returns the blob content as a byte array
- * @example
- * ```ts
- * const blob = univerAPI.newBlob(blob);
- * const newBlob = blob.getBytes();
- * console.log(newBlob);
- * ```
- */
- getBytes() {
- return this._blob ? this._blob.arrayBuffer().then((t) => new Uint8Array(t)) : Promise.reject(new Error("Blob is undefined or null."));
- }
- /**
- * Sets the data stored in this blob.
- * @param bytes a byte array
- * @returns the blob object
- * @example
- * ```ts
- * const blob = univerAPI.newBlob();
- * const bytes = new Uint8Array(10);
- * blob.setBytes(bytes);
- * ```
- */
- setBytes(t) {
- return this._blob = new Blob([t]), this;
- }
- setDataFromString(t, e) {
- const n = e != null ? e : "text/plain", r = new Blob([t], { type: n });
- return this._blob = r, this;
- }
- /**
- * Gets the content type of the data stored in this blob.
- * @returns the content type
- * @example
- * ```ts
- * const blob = univerAPI.newBlob(blob);
- * const newBlob = blob.getContentType();
- * console.log(newBlob);
- * ```
- */
- getContentType() {
- var t;
- return (t = this._blob) == null ? void 0 : t.type;
- }
- /**
- * Sets the content type of the data stored in this blob.
- * @param contentType the content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types
- * @returns the blob object
- * @example
- * ```ts
- * const blob = univerAPI.newBlob(blob);
- * const newBlob = blob.setContentType('text/plain');
- * console.log(newBlob);
- * ```
- */
- setContentType(t) {
- var e;
- return this._blob = (e = this._blob) == null ? void 0 : e.slice(0, this._blob.size, t), this;
- }
- };
- ss = ZE([
- QE(1, ot(Ot))
- ], ss);
- var qE = Object.defineProperty;
- var e0 = Object.getOwnPropertyDescriptor;
- var t0 = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? e0(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && qE(e, n, s), s;
- };
- var n0 = (t, e) => (n, r) => e(n, r, t);
- var li = class extends al {
- constructor(t, e) {
- super(e), this.doc = t;
- }
- };
- li = t0([
- n0(1, ot(Ot))
- ], li);
- var _l = ((t) => (t[t.INFO = 0] = "INFO", t[t.STOP = 1] = "STOP", t[t.WARNING = 2] = "WARNING", t))(_l || {});
- 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 || {});
- var Cl = ((t) => (t[t.TEXT = 0] = "TEXT", t[t.ARROW = 1] = "ARROW", t[t.CUSTOM = 2] = "CUSTOM", t))(Cl || {});
- var Rl = ((t) => (t.VALID = "valid", t.INVALID = "invalid", t.VALIDATING = "validating", t))(Rl || {});
- 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 || {});
- var bn = class bn2 {
- static get() {
- if (this._instance)
- return this._instance;
- const e = new bn2();
- return this._instance = e, e;
- }
- static extend(e) {
- Object.getOwnPropertyNames(e.prototype).forEach((n) => {
- n !== "constructor" && (this.prototype[n] = e.prototype[n]);
- }), Object.getOwnPropertyNames(e).forEach((n) => {
- n !== "prototype" && n !== "name" && n !== "length" && (this[n] = e[n]);
- });
- }
- constructor() {
- for (const e in bn2.prototype)
- this[e] = bn2.prototype[e];
- }
- /**
- * Defines different types of Univer instances
- */
- get UniverInstanceType() {
- return Fe;
- }
- /**
- * Represents different stages in the lifecycle
- */
- get LifecycleStages() {
- return Ve;
- }
- /**
- * Different types of data validation
- */
- get DataValidationType() {
- return Il;
- }
- /**
- * Different error display styles
- */
- get DataValidationErrorStyle() {
- return _l;
- }
- /**
- * Different validation rendering modes
- */
- get DataValidationRenderMode() {
- return Cl;
- }
- /**
- * Different validation operators
- */
- get DataValidationOperator() {
- return El;
- }
- /**
- * Different validation states
- */
- get DataValidationStatus() {
- return Rl;
- }
- /**
- * Different types of commands
- */
- get CommandType() {
- return ar;
- }
- /**
- * Different baseline offsets for text baseline positioning
- */
- get BaselineOffset() {
- return Bt;
- }
- /**
- * Boolean number representations
- */
- get BooleanNumber() {
- return we;
- }
- /**
- * Different horizontal text alignment options
- */
- get HorizontalAlign() {
- return Xt;
- }
- /**
- * Different text decoration styles
- */
- get TextDecoration() {
- return Nu;
- }
- /**
- * Different text direction options
- */
- get TextDirection() {
- return er;
- }
- /**
- * Different vertical text alignment options
- */
- get VerticalAlign() {
- return hn;
- }
- /**
- * Different border types
- */
- get BorderType() {
- return Eu;
- }
- /**
- * Different border style types
- */
- get BorderStyleTypes() {
- return Xe;
- }
- /**
- * Auto fill series types
- */
- get AutoFillSeries() {
- return _u;
- }
- /**
- * Color types
- */
- get ColorType() {
- return vt;
- }
- /**
- * Common hide types
- */
- get CommonHideTypes() {
- return Cu;
- }
- /**
- * Copy paste types
- */
- get CopyPasteType() {
- return Ru;
- }
- /**
- * Delete direction types
- */
- get DeleteDirection() {
- return Iu;
- }
- /**
- * Developer metadata visibility types
- */
- get DeveloperMetadataVisibility() {
- return vu;
- }
- /**
- * Dimension types
- */
- get Dimension() {
- return yu;
- }
- /**
- * Direction types
- */
- get Direction() {
- return wu;
- }
- /**
- * Interpolation point types
- */
- get InterpolationPointType() {
- return Ou;
- }
- /**
- * Locale types
- */
- get LocaleType() {
- return ur;
- }
- /**
- * Mention types
- */
- get MentionType() {
- return Zr;
- }
- /**
- * Protection types
- */
- get ProtectionType() {
- return bu;
- }
- /**
- * Relative date types
- */
- get RelativeDate() {
- return Su;
- }
- /**
- * Sheet types
- */
- get SheetTypes() {
- return Au;
- }
- /**
- * Theme color types
- */
- get ThemeColorType() {
- return ft;
- }
- };
- C(bn, "_instance");
- var ci = bn;
- var Sn = class Sn2 {
- static get() {
- if (this._instance)
- return this._instance;
- const e = new Sn2();
- return this._instance = e, e;
- }
- static extend(e) {
- Object.getOwnPropertyNames(e.prototype).forEach((n) => {
- n !== "constructor" && (this.prototype[n] = e.prototype[n]);
- }), Object.getOwnPropertyNames(e).forEach((n) => {
- n !== "prototype" && n !== "name" && n !== "length" && (this[n] = e[n]);
- });
- }
- constructor() {
- for (const e in Sn2.prototype)
- this[e] = Sn2.prototype[e];
- }
- /**
- * Event fired when a document is created
- * @see {@link IDocCreatedParam}
- * @example
- * ```ts
- * univerAPI.addEvent(univerAPI.event.DocCreated, (params) => {
- * const { unitId, type, doc, unit } = params;
- * console.log('doc created', params);
- * });
- * ```
- */
- get DocCreated() {
- return "DocCreated";
- }
- /**
- * Event fired when a document is disposed
- * @see {@link IDocDisposedEvent}
- * @example
- * ```ts
- * univerAPI.addEvent(univerAPI.event.DocDisposed, (params) => {
- * const { unitId, unitType, snapshot } = params;
- * console.log('doc disposed', params);
- * });
- * ```
- */
- get DocDisposed() {
- return "DocDisposed";
- }
- /**
- * Event fired when life cycle is changed
- * @see {@link ILifeCycleChangedEvent}
- * @example
- * ```ts
- * univerAPI.addEvent(univerAPI.event.LifeCycleChanged, (params) => {
- * const { stage } = params;
- * console.log('life cycle changed', params);
- * });
- * ```
- */
- get LifeCycleChanged() {
- return "LifeCycleChanged";
- }
- /**
- * Event fired when a redo command is executed
- * @see {@link ICommandEvent}
- * @example
- * ```ts
- * univerAPI.addEvent(univerAPI.event.Redo, (event) => {
- * const { params, id, type } = event;
- * console.log('command executed', event);
- * });
- * ```
- */
- get Redo() {
- return "Redo";
- }
- /**
- * Event fired when an undo command is executed
- * @see {@link ICommandEvent}
- * @example
- * ```ts
- * univerAPI.addEvent(univerAPI.event.Undo, (event) => {
- * const { params, id, type } = event;
- * console.log('command executed', event);
- * });
- * ```
- */
- get Undo() {
- return "Undo";
- }
- /**
- * Event fired before a redo command is executed
- * @see {@link ICommandEvent}
- * @example
- * ```ts
- * univerAPI.addEvent(univerAPI.event.BeforeRedo, (event) => {
- * const { params, id, type } = event;
- * console.log('command executed', event);
- * });
- * ```
- */
- get BeforeRedo() {
- return "BeforeRedo";
- }
- /**
- * Event fired before an undo command is executed
- * @see {@link ICommandEvent}
- * @example
- * ```ts
- * univerAPI.addEvent(univerAPI.event.BeforeUndo, (event) => {
- * const { params, id, type } = event;
- * console.log('command executed', event);
- * });
- * ```
- */
- get BeforeUndo() {
- return "BeforeUndo";
- }
- /**
- * Event fired when a command is executed
- * @see {@link ICommandEvent}
- * @example
- * ```ts
- * univerAPI.addEvent(univerAPI.event.CommandExecuted, (event) => {
- * const { params, id, type } = event;
- * console.log('command executed', event);
- * });
- * ```
- */
- get CommandExecuted() {
- return "CommandExecuted";
- }
- /**
- * Event fired before a command is executed
- * @see {@link ICommandEvent}
- * @example
- * ```ts
- * univerAPI.addEvent(univerAPI.event.BeforeCommandExecute, (event) => {
- * const { params, id, type } = event;
- * console.log('command executed', event);
- * });
- * ```
- */
- get BeforeCommandExecute() {
- return "BeforeCommandExecute";
- }
- };
- C(Sn, "_instance");
- var hi = Sn;
- var r0 = Object.defineProperty;
- var s0 = Object.getOwnPropertyDescriptor;
- var i0 = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? s0(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && r0(e, n, s), s;
- };
- var ya = (t, e) => (n, r) => e(n, r, t);
- var di = class extends Fi {
- constructor(t, e) {
- super(), this._injector = t, this._lifecycleService = e;
- }
- /**
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifecycleChanged)` as instead
- */
- onStarting(t) {
- return Ze(this._lifecycleService.lifecycle$.pipe(filter((e) => e === Ve.Starting)).subscribe(t));
- }
- /**
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifecycleChanged)` as instead
- */
- onReady(t) {
- return Ze(this._lifecycleService.lifecycle$.pipe(filter((e) => e === Ve.Ready)).subscribe(t));
- }
- /**
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifecycleChanged, () => {})` as instead
- */
- onRendered(t) {
- return Ze(this._lifecycleService.lifecycle$.pipe(filter((e) => e === Ve.Rendered)).subscribe(t));
- }
- /**
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.LifecycleChanged, () => {})` as instead
- */
- onSteady(t) {
- return Ze(this._lifecycleService.lifecycle$.pipe(filter((e) => e === Ve.Steady)).subscribe(t));
- }
- /**
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeUndo, () => {})` as instead
- */
- onBeforeUndo(t) {
- return this._injector.get(Pt).beforeCommandExecuted((n) => {
- if (n.id === Nn.id) {
- const s = this._injector.get(cn).pitchTopUndoElement();
- s && t(s);
- }
- });
- }
- /**
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.Undo, () => {})` as instead
- */
- onUndo(t) {
- return this._injector.get(Pt).onCommandExecuted((n) => {
- if (n.id === Nn.id) {
- const s = this._injector.get(cn).pitchTopUndoElement();
- s && t(s);
- }
- });
- }
- /**
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeRedo, () => {})` as instead
- */
- onBeforeRedo(t) {
- return this._injector.get(Pt).beforeCommandExecuted((n) => {
- if (n.id === Tn.id) {
- const s = this._injector.get(cn).pitchTopRedoElement();
- s && t(s);
- }
- });
- }
- /**
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.Redo, () => {})` as instead
- */
- onRedo(t) {
- return this._injector.get(Pt).onCommandExecuted((n) => {
- if (n.id === Tn.id) {
- const s = this._injector.get(cn).pitchTopRedoElement();
- s && t(s);
- }
- });
- }
- };
- di = i0([
- ya(0, ot(Ot)),
- ya(1, ot(Ht))
- ], di);
- var o0 = Object.defineProperty;
- var a0 = Object.getOwnPropertyDescriptor;
- var u0 = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? a0(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && o0(e, n, s), s;
- };
- var wa = (t, e) => (n, r) => e(n, r, t);
- var fi = class extends Fi {
- constructor(t, e) {
- super(), this._injector = t, this._userManagerService = e;
- }
- /**
- * Get current user info.
- * @returns {IUser} Current user info.
- * @example
- * ```typescript
- * univerAPI.getUserManager().getCurrentUser();
- * ```
- */
- getCurrentUser() {
- return this._userManagerService.getCurrentUser();
- }
- };
- fi = u0([
- wa(0, ot(Ot)),
- wa(1, ot(rr))
- ], fi);
- var is = class is2 {
- static get() {
- if (this._instance)
- return this._instance;
- const e = new is2();
- return this._instance = e, e;
- }
- static extend(e) {
- Object.getOwnPropertyNames(e.prototype).forEach((n) => {
- n !== "constructor" && (this.prototype[n] = e.prototype[n]);
- }), Object.getOwnPropertyNames(e).forEach((n) => {
- n !== "prototype" && n !== "name" && n !== "length" && (this[n] = e[n]);
- });
- }
- /**
- * Rectangle utils, including range operations likes merge, subtract, split
- */
- get rectangle() {
- return en;
- }
- /**
- * Number format utils, including parse and strigify about date, price, etc
- */
- get numfmt() {
- return Op;
- }
- /**
- * common tools
- */
- get tools() {
- return re;
- }
- };
- C(is, "_instance");
- var gi = is;
- var l0 = Object.defineProperty;
- var c0 = Object.getOwnPropertyDescriptor;
- var h0 = (t, e, n, r) => {
- for (var s = r > 1 ? void 0 : r ? c0(e, n) : e, i = t.length - 1, o; i >= 0; i--)
- (o = t[i]) && (s = (r ? o(e, n, s) : o(s)) || s);
- return r && s && l0(e, n, s), s;
- };
- var Mr = (t, e) => (n, r) => e(n, r, t);
- var pi = class extends al {
- constructor(e, n, r, s) {
- super(e);
- C(this, "_eventRegistry", /* @__PURE__ */ new Map());
- this._injector = e, this._commandService = n, this._univerInstanceService = r, this._lifecycleService = s, this.disposeWithMe(
- this._lifecycleService.lifecycle$.subscribe((i) => {
- this.fireEvent(this.Event.LifeCycleChanged, { stage: i });
- })
- ), this.disposeWithMe(
- this._commandService.beforeCommandExecuted((i) => {
- if (!this._eventRegistry.get(this.Event.BeforeRedo) && !this._eventRegistry.get(this.Event.BeforeUndo) && !this._eventRegistry.get(this.Event.BeforeCommandExecute))
- return;
- const { id: o, type: a, params: u } = i, l = { id: o, type: a, params: u };
- switch (i.id) {
- case Tn.id:
- this.fireEvent(this.Event.BeforeRedo, l);
- break;
- case Nn.id:
- this.fireEvent(this.Event.BeforeUndo, l);
- break;
- default:
- this.fireEvent(this.Event.BeforeCommandExecute, l);
- break;
- }
- if (l.cancel)
- throw new xf();
- })
- ), this.disposeWithMe(
- this._commandService.onCommandExecuted((i) => {
- if (!this._eventRegistry.get(this.Event.Redo) && !this._eventRegistry.get(this.Event.Undo) && !this._eventRegistry.get(this.Event.CommandExecuted))
- return;
- const { id: o, type: a, params: u } = i, l = { id: o, type: a, params: u };
- switch (i.id) {
- case Tn.id:
- this.fireEvent(this.Event.Redo, l);
- break;
- case Nn.id:
- this.fireEvent(this.Event.Undo, l);
- break;
- default:
- this.fireEvent(this.Event.CommandExecuted, l);
- break;
- }
- })
- ), this._initUnitEvent(this._injector), this._injector.onDispose(() => {
- this.dispose();
- });
- }
- /**
- * Create an FUniver instance, if the injector is not provided, it will create a new Univer instance.
- * @static
- * @param {Univer | Injector} wrapped - The Univer instance or injector instance.
- * @returns {FUniver} - The FUniver instance.
- */
- static newAPI(e) {
- return (e instanceof GE ? e.__getInjector() : e).createInstance(pi);
- }
- _ensureEventRegistry(e) {
- return this._eventRegistry.has(e) || this._eventRegistry.set(e, new $i()), this._eventRegistry.get(e);
- }
- _initUnitEvent(e) {
- const n = e.get(_n);
- this.disposeWithMe(
- n.unitDisposed$.subscribe((r) => {
- this._eventRegistry.get(this.Event.DocDisposed) && r.type === Fe.UNIVER_DOC && this.fireEvent(
- this.Event.DocDisposed,
- {
- unitId: r.getUnitId(),
- unitType: r.type,
- snapshot: r.getSnapshot()
- }
- );
- })
- ), this.disposeWithMe(
- n.unitAdded$.subscribe((r) => {
- if (this._eventRegistry.get(this.Event.DocCreated) && r.type === Fe.UNIVER_DOC) {
- const s = r, i = e.createInstance(li, s);
- this.fireEvent(
- this.Event.DocCreated,
- {
- unitId: r.getUnitId(),
- type: r.type,
- doc: i,
- unit: i
- }
- );
- }
- })
- );
- }
- _eventListend(e) {
- return this._eventRegistry.get(e);
- }
- /**
- * Dispose the UniverSheet by the `unitId`. The UniverSheet would be unload from the application.
- * @param unitId The unit id of the UniverSheet.
- * @returns Whether the Univer instance is disposed successfully.
- */
- disposeUnit(e) {
- return this._univerInstanceService.disposeUnit(e);
- }
- /**
- * Get the current lifecycle stage.
- * @returns {LifecycleStages} - The current lifecycle stage.
- */
- getCurrentLifecycleStage() {
- return this._injector.get(Ht).stage;
- }
- /**
- * Undo an editing on the currently focused document.
- * @returns {Promise<boolean>} undo result
- */
- undo() {
- return this._commandService.executeCommand(Nn.id);
- }
- /**
- * Redo an editing on the currently focused document.
- * @returns {Promise<boolean>} redo result
- */
- redo() {
- return this._commandService.executeCommand(Tn.id);
- }
- /**
- * Register a callback that will be triggered before invoking a command.
- * @deprecated use `addEvent(univerAPI.event.BeforeCommandExecute, () => {})` instead.
- * @param {CommandListener} callback The callback.
- * @returns {IDisposable} The disposable instance.
- */
- onBeforeCommandExecute(e) {
- return this._commandService.beforeCommandExecuted((n, r) => {
- e(n, r);
- });
- }
- /**
- * Register a callback that will be triggered when a command is invoked.
- * @deprecated use `addEvent(univerAPI.event.CommandExecuted, () => {})` instead.
- * @param {CommandListener} callback The callback.
- * @returns {IDisposable} The disposable instance.
- */
- onCommandExecuted(e) {
- return this._commandService.onCommandExecuted((n, r) => {
- e(n, r);
- });
- }
- /**
- * Execute a command with the given id and parameters.
- * @param id Identifier of the command.
- * @param params Parameters of this execution.
- * @param options Options of this execution.
- * @returns The result of the execution. It is a boolean value by default which indicates the command is executed.
- */
- executeCommand(e, n, r) {
- return this._commandService.executeCommand(e, n, r);
- }
- /**
- * Execute a command with the given id and parameters synchronously.
- * @param id Identifier of the command.
- * @param params Parameters of this execution.
- * @param options Options of this execution.
- * @returns The result of the execution. It is a boolean value by default which indicates the command is executed.
- */
- syncExecuteCommand(e, n, r) {
- return this._commandService.syncExecuteCommand(e, n, r);
- }
- /**
- * Get hooks.
- * @deprecated use `addEvent` instead.
- * @returns {FHooks} FHooks instance
- */
- getHooks() {
- return this._injector.createInstance(di);
- }
- get Enum() {
- return ci.get();
- }
- get Event() {
- return hi.get();
- }
- get Util() {
- return gi.get();
- }
- /**
- * Add an event listener
- * @param event key of event
- * @param callback callback when event triggered
- * @returns {Disposable} The Disposable instance, for remove the listener
- * @example
- * ```ts
- * univerAPI.addEvent(univerAPI.event.UnitCreated, (params) => {
- * console.log('unit created', params);
- * });
- * ```
- */
- addEvent(e, n) {
- return this._ensureEventRegistry(e).add(n), Ze(() => this._ensureEventRegistry(e).delete(n));
- }
- /**
- * Fire an event, used in internal only.
- * @param event {string} key of event
- * @param params {any} params of event
- * @returns {boolean} should cancel
- * @example
- * ```ts
- * this.fireEvent(univerAPI.event.UnitCreated, params);
- * ```
- */
- fireEvent(e, n) {
- var r;
- return (r = this._eventRegistry.get(e)) == null || r.getData().forEach((s) => {
- s(n);
- }), n.cancel;
- }
- /**
- * Get the callback map corresponding to the event
- * @param event
- * @returns {number} The number of callbacks
- */
- hasEventCallback(e) {
- var r, s;
- return ((s = (r = this._eventRegistry.get(e)) == null ? void 0 : r.getData().length) != null ? s : 0) > 0;
- }
- getUserManager() {
- return this._injector.createInstance(fi);
- }
- /**
- * Create a new blob.
- * @returns {FBlob} The new blob instance
- * @example
- * ```ts
- * const blob = univerApi.newBlob();
- * ```
- */
- newBlob() {
- return this._injector.createInstance(ss);
- }
- /**
- * Create a new color.
- * @returns {ColorBuilder} The new color instance
- * @example
- * ```ts
- * const color = univerApi.newColor();
- * ```
- */
- newColor() {
- return new gs();
- }
- /**
- * Create a new rich text.
- * @param data
- * @returns {RichTextBuilder} The new rich text instance
- * @example
- * ```ts
- * const richText = univerApi.newRichText();
- * ```
- */
- newRichText(e) {
- return gn.create(e);
- }
- /**
- * Create a new rich text value.
- * @param data - The rich text data
- * @returns {RichTextValue} The new rich text value instance
- * @example
- * ```ts
- * const richTextValue = univerApi.newRichTextValue();
- * ```
- */
- newRichTextValue(e) {
- return Zt.create(e);
- }
- /**
- * Create a new paragraph style.
- * @param style - The paragraph style
- * @returns {ParagraphStyleBuilder} The new paragraph style instance
- * @example
- * ```ts
- * const paragraphStyle = univerApi.newParagraphStyle();
- * ```
- */
- newParagraphStyle(e) {
- return nr.create(e);
- }
- /**
- * Create a new paragraph style value.
- * @param style - The paragraph style
- * @returns {ParagraphStyleValue} The new paragraph style value instance
- * @example
- * ```ts
- * const paragraphStyleValue = univerApi.newParagraphStyleValue();
- * ```
- */
- newParagraphStyleValue(e) {
- return hr.create(e);
- }
- /**
- * Create a new text style.
- * @param style - The text style
- * @returns {TextStyleBuilder} The new text style instance
- * @example
- * ```ts
- * const textStyle = univerApi.newTextStyle();
- * ```
- */
- newTextStyle(e) {
- return Qt.create(e);
- }
- /**
- * Create a new text style value.
- * @param style - The text style
- * @returns {TextStyleValue} The new text style value instance
- * @example
- * ```ts
- * const textStyleValue = univerApi.newTextStyleValue();
- * ```
- */
- newTextStyleValue(e) {
- return cr.create(e);
- }
- newTextDecoration(e) {
- return new Jt(e);
- }
- };
- pi = h0([
- Mr(0, ot(Ot)),
- Mr(1, Pt),
- Mr(2, _n),
- Mr(3, ot(Ht))
- ], pi);
- function d0(t) {
- return /^-?\d+(\.\d+)?$/.test(t);
- }
- function bR(t) {
- return d0(t) ? Number(t) <= Number.MAX_SAFE_INTEGER : false;
- }
- function SR(t) {
- const e = new MessageChannel();
- let n = false;
- const r = () => {
- n || t();
- };
- return e.port1.onmessage = r, e.port2.postMessage(null), () => {
- n = true, e.port1.close(), e.port2.close();
- };
- }
- function AR(t, e) {
- return e.forEach((n) => t.add(n)), t;
- }
- function NR(t, e, n, r) {
- var c;
- if (e === "")
- return t;
- const s = {
- id: "mock-id",
- body: t,
- documentStyle: {}
- }, i = new jt(s), o = e.length;
- let a;
- for (; (a = (r ? i.getBody().dataStream : i.getBody().dataStream.toLowerCase()).indexOf(e)) >= 0; ) {
- const l = new Ke(), h = tn.getInstance();
- if (a > 0 && l.retain(a), n.length > 0) {
- const d = i.sliceBody(a, a + o), f = {
- dataStream: n
- };
- if (Array.isArray(d == null ? void 0 : d.textRuns) && d.textRuns.length && (f.textRuns = [{
- ...d.textRuns[0],
- st: 0,
- ed: n.length
- }]), (c = d == null ? void 0 : d.customRanges) != null && c.length) {
- const E = d.customRanges[0];
- f.customRanges = [{
- ...E,
- startIndex: 0,
- endIndex: n.length - 1
- }];
- }
- l.insert(n.length, f);
- }
- l.delete(o), i.apply(h.editOp(l.serialize()));
- }
- const u = i.getBody();
- return i.dispose(), u;
- }
- var TR = "__default_document_sub_component_id20231101__";
- var f0 = class {
- constructor() {
- C(this, "skipNextObservers", false);
- C(this, "lastReturnValue");
- C(this, "isStopPropagation", false);
- }
- stopPropagation() {
- this.isStopPropagation = true;
- }
- };
- var MR = class extends Subject {
- constructor() {
- super(...arguments);
- C(this, "_sortedObservers", []);
- }
- /** @deprecated Use `subscribeEvent` instead. */
- subscribe() {
- throw new Error("[EventSubject]: please use `subscribeEvent` instead of `subscribe` method for `EventSubject`.");
- }
- /** @deprecated Use `emitEvent` instead. */
- next() {
- throw new Error("[EventSubject]: please use `emitEvent` instead of `next` method for `EventSubject`.");
- }
- unsubscribe() {
- super.unsubscribe(), this._sortedObservers.length = 0;
- }
- complete() {
- super.complete(), this._sortedObservers.length = 0;
- }
- subscribeEvent(n) {
- let r;
- typeof n == "function" ? r = { next: ([i, o]) => n(i, o) } : r = n;
- const s = super.subscribe(r);
- return this._sortedObservers.push(r), this._sortedObservers.sort((i, o) => {
- var a, u;
- return ((a = i.priority) != null ? a : 0) - ((u = o.priority) != null ? u : 0);
- }), s.add(() => this._sortedObservers = this._sortedObservers.filter((i) => i !== r)), s;
- }
- clearObservers() {
- this._sortedObservers.forEach((n) => {
- var r;
- return (r = n.complete) == null ? void 0 : r.call(n);
- }), this._sortedObservers.length = 0;
- }
- emitEvent(n) {
- var r;
- if (!this.closed) {
- const s = new f0();
- s.lastReturnValue = n;
- for (const i of this._sortedObservers) {
- const o = (r = i.next) == null ? void 0 : r.call(i, [n, s]);
- if (s.lastReturnValue = o, s.skipNextObservers)
- return {
- handled: true,
- lastReturnValue: s.lastReturnValue,
- stopPropagation: s.isStopPropagation
- };
- }
- return {
- handled: this._sortedObservers.length > 0,
- lastReturnValue: s.lastReturnValue,
- stopPropagation: s.isStopPropagation
- };
- }
- throw new Error("[EventSubject]: cannot emit event on a closed subject.");
- }
- };
- function DR(t) {
- return new Observable((e) => {
- const n = t.subscribeEvent((r) => {
- e.next(r);
- });
- return () => n.unsubscribe();
- });
- }
- var xR = Ct("ILocalStorageService");
- function LR(t) {
- return !(t.length === 0 || t.length > 31 || t.startsWith("'") || t.endsWith("'") || /[:\\\/\?\*\[\]]/.test(t));
- }
- function UR(t) {
- return new Promise((e) => setTimeout(e, t));
- }
- function PR(t = 1) {
- return new Promise((e) => {
- let n = 0;
- const r = () => {
- n++, n >= t ? e() : requestAnimationFrame(r);
- };
- requestAnimationFrame(r);
- });
- }
- var vl = ((t) => (t.URL = "URL", t.UUID = "UUID", t.BASE64 = "BASE64", t))(vl || {});
- 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 || {});
- var Oa = Ct("core.image-io.service");
- var kR = class {
- constructor(e, n = 100) {
- C(this, "_imageCacheMap");
- this._injector = e, this._imageCacheMap = new Qr(n);
- }
- _getImageCacheKey(e, n) {
- return `${e}-${n}`;
- }
- getImage(e, n, r, s) {
- const i = this._getImageCacheKey(e, n);
- let o = this._imageCacheMap.get(i);
- return o || ((async () => {
- o = new Image();
- const a = this._injector.has(Oa) ? this._injector.get(Oa) : null;
- if (e === vl.UUID)
- try {
- o.src = await (a == null ? void 0 : a.getImage(n)) || "";
- } catch (u) {
- console.error(u);
- }
- else
- o.src = n;
- o.onload = () => {
- r == null || r();
- }, o.onerror = () => {
- s == null || s();
- }, this._imageCacheMap.set(i, o);
- })(), null);
- }
- };
- var FR = ["script", "style", "meta", "comment", "link"];
- 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 || {});
- var ba = [
- Int8Array,
- Uint8Array,
- Uint8ClampedArray,
- Int16Array,
- Uint16Array,
- Int32Array,
- Uint32Array,
- Float32Array,
- Float64Array
- ];
- var Ls = 1;
- var jn = 8;
- var ji = class _ji {
- /**
- * Creates an index from raw `ArrayBuffer` data.
- * @param {ArrayBuffer} data
- */
- static from(e) {
- if (!(e instanceof ArrayBuffer))
- throw new Error("Data must be an instance of ArrayBuffer.");
- const [n, r] = new Uint8Array(e, 0, 2);
- if (n !== 219)
- throw new Error("Data does not appear to be in a KDBush format.");
- const s = r >> 4;
- if (s !== Ls)
- throw new Error(`Got v${s} data when expected v${Ls}.`);
- const i = ba[r & 15];
- if (!i)
- throw new Error("Unrecognized array type.");
- const [o] = new Uint16Array(e, 2, 1), [a] = new Uint32Array(e, 4, 1);
- return new _ji(a, o, i, e);
- }
- /**
- * Creates an index that will hold a given number of items.
- * @param {number} numItems
- * @param {number} [nodeSize=64] Size of the KD-tree node (64 by default).
- * @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).
- * @param {ArrayBuffer} [data] (For internal use only)
- */
- constructor(e, n = 64, r = Float64Array, s) {
- if (isNaN(e) || e < 0)
- throw new Error(`Unpexpected numItems value: ${e}.`);
- this.numItems = +e, this.nodeSize = Math.min(Math.max(+n, 2), 65535), this.ArrayType = r, this.IndexArrayType = e < 65536 ? Uint16Array : Uint32Array;
- 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;
- if (i < 0)
- throw new Error(`Unexpected typed array class: ${r}.`);
- 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);
- }
- /**
- * Add a point to the index.
- * @param {number} x
- * @param {number} y
- * @returns {number} An incremental index associated with the added item (starting from `0`).
- */
- add(e, n) {
- const r = this._pos >> 1;
- return this.ids[r] = r, this.coords[this._pos++] = e, this.coords[this._pos++] = n, r;
- }
- /**
- * Perform indexing of the added points.
- */
- finish() {
- const e = this._pos >> 1;
- if (e !== this.numItems)
- throw new Error(`Added ${e} items when expected ${this.numItems}.`);
- return mi(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = true, this;
- }
- /**
- * Search the index for items within a given bounding box.
- * @param {number} minX
- * @param {number} minY
- * @param {number} maxX
- * @param {number} maxY
- * @returns {number[]} An array of indices correponding to the found items.
- */
- range(e, n, r, s) {
- if (!this._finished)
- throw new Error("Data not yet indexed - call index.finish().");
- const { ids: i, coords: o, nodeSize: a } = this, u = [0, i.length - 1, 0], c = [];
- for (; u.length; ) {
- const l = u.pop() || 0, h = u.pop() || 0, d = u.pop() || 0;
- if (h - d <= a) {
- for (let O = d; O <= h; O++) {
- const U = o[2 * O], ne = o[2 * O + 1];
- U >= e && U <= r && ne >= n && ne <= s && c.push(i[O]);
- }
- continue;
- }
- const f = d + h >> 1, E = o[2 * f], R = o[2 * f + 1];
- 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));
- }
- return c;
- }
- /**
- * Search the index for items within a given radius.
- * @param {number} qx
- * @param {number} qy
- * @param {number} r Query radius.
- * @returns {number[]} An array of indices correponding to the found items.
- */
- within(e, n, r) {
- if (!this._finished)
- throw new Error("Data not yet indexed - call index.finish().");
- const { ids: s, coords: i, nodeSize: o } = this, a = [0, s.length - 1, 0], u = [], c = r * r;
- for (; a.length; ) {
- const l = a.pop() || 0, h = a.pop() || 0, d = a.pop() || 0;
- if (h - d <= o) {
- for (let O = d; O <= h; O++)
- Sa(i[2 * O], i[2 * O + 1], e, n) <= c && u.push(s[O]);
- continue;
- }
- const f = d + h >> 1, E = i[2 * f], R = i[2 * f + 1];
- 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));
- }
- return u;
- }
- };
- function mi(t, e, n, r, s, i) {
- if (s - r <= n)
- return;
- const o = r + s >> 1;
- 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);
- }
- function yl(t, e, n, r, s, i) {
- for (; s > r; ) {
- if (s - r > 600) {
- 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));
- yl(t, e, n, E, R, i);
- }
- const o = e[2 * n + i];
- let a = r, u = s;
- for (Hn(t, e, r, n), e[2 * s + i] > o && Hn(t, e, r, s); a < u; ) {
- for (Hn(t, e, a, u), a++, u--; e[2 * a + i] < o; )
- a++;
- for (; e[2 * u + i] > o; )
- u--;
- }
- 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);
- }
- }
- function Hn(t, e, n, r) {
- Us(t, n, r), Us(e, 2 * n, 2 * r), Us(e, 2 * n + 1, 2 * r + 1);
- }
- function Us(t, e, n) {
- const r = t[e];
- t[e] = t[n], t[n] = r;
- }
- function Sa(t, e, n, r) {
- const s = t - n, i = e - r;
- return s * s + i * i;
- }
- function wl(t, e, n = 0, r = t.length - 1, s = m0) {
- for (; r > n; ) {
- if (r - n > 600) {
- 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));
- wl(t, e, f, E, s);
- }
- const i = t[e];
- let o = n, a = r;
- for (Wn(t, n, e), s(t[r], i) > 0 && Wn(t, n, r); o < a; ) {
- for (Wn(t, o, a), o++, a--; s(t[o], i) < 0; )
- o++;
- for (; s(t[a], i) > 0; )
- a--;
- }
- s(t[n], i) === 0 ? Wn(t, n, a) : (a++, Wn(t, a, r)), a <= e && (n = a + 1), e <= a && (r = a - 1);
- }
- }
- function Wn(t, e, n) {
- const r = t[e];
- t[e] = t[n], t[n] = r;
- }
- function m0(t, e) {
- return t < e ? -1 : t > e ? 1 : 0;
- }
- var Aa = class {
- constructor(e = 9) {
- this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
- }
- all() {
- return this._all(this.data, []);
- }
- search(e) {
- let n = this.data;
- const r = [];
- if (!xr(e, n))
- return r;
- const s = this.toBBox, i = [];
- for (; n; ) {
- for (let o = 0; o < n.children.length; o++) {
- const a = n.children[o], u = n.leaf ? s(a) : a;
- xr(e, u) && (n.leaf ? r.push(a) : ks(e, u) ? this._all(a, r) : i.push(a));
- }
- n = i.pop();
- }
- return r;
- }
- collides(e) {
- let n = this.data;
- if (!xr(e, n))
- return false;
- const r = [];
- for (; n; ) {
- for (let s = 0; s < n.children.length; s++) {
- const i = n.children[s], o = n.leaf ? this.toBBox(i) : i;
- if (xr(e, o)) {
- if (n.leaf || ks(e, o))
- return true;
- r.push(i);
- }
- }
- n = r.pop();
- }
- return false;
- }
- load(e) {
- if (!(e && e.length))
- return this;
- if (e.length < this._minEntries) {
- for (let r = 0; r < e.length; r++)
- this.insert(e[r]);
- return this;
- }
- let n = this._build(e.slice(), 0, e.length - 1, 0);
- if (!this.data.children.length)
- this.data = n;
- else if (this.data.height === n.height)
- this._splitRoot(this.data, n);
- else {
- if (this.data.height < n.height) {
- const r = this.data;
- this.data = n, n = r;
- }
- this._insert(n, this.data.height - n.height - 1, true);
- }
- return this;
- }
- insert(e) {
- return e && this._insert(e, this.data.height - 1), this;
- }
- clear() {
- return this.data = yn([]), this;
- }
- remove(e, n) {
- if (!e)
- return this;
- let r = this.data;
- const s = this.toBBox(e), i = [], o = [];
- let a, u, c;
- for (; r || i.length; ) {
- if (r || (r = i.pop(), u = i[i.length - 1], a = o.pop(), c = true), r.leaf) {
- const l = _0(e, r.children, n);
- if (l !== -1)
- return r.children.splice(l, 1), i.push(r), this._condense(i), this;
- }
- !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;
- }
- return this;
- }
- toBBox(e) {
- return e;
- }
- compareMinX(e, n) {
- return e.minX - n.minX;
- }
- compareMinY(e, n) {
- return e.minY - n.minY;
- }
- toJSON() {
- return this.data;
- }
- fromJSON(e) {
- return this.data = e, this;
- }
- _all(e, n) {
- const r = [];
- for (; e; )
- e.leaf ? n.push(...e.children) : r.push(...e.children), e = r.pop();
- return n;
- }
- _build(e, n, r, s) {
- const i = r - n + 1;
- let o = this._maxEntries, a;
- if (i <= o)
- return a = yn(e.slice(n, r + 1)), vn(a, this.toBBox), a;
- 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;
- const u = Math.ceil(i / o), c = u * Math.ceil(Math.sqrt(o));
- Na(e, n, r, c, this.compareMinX);
- for (let l = n; l <= r; l += c) {
- const h = Math.min(l + c - 1, r);
- Na(e, l, h, u, this.compareMinY);
- for (let d = l; d <= h; d += u) {
- const f = Math.min(d + u - 1, h);
- a.children.push(this._build(e, d, f, s - 1));
- }
- }
- return vn(a, this.toBBox), a;
- }
- _chooseSubtree(e, n, r, s) {
- for (; s.push(n), !(n.leaf || s.length - 1 === r); ) {
- let i = 1 / 0, o = 1 / 0, a;
- for (let u = 0; u < n.children.length; u++) {
- const c = n.children[u], l = Ps(c), h = R0(e, c) - l;
- h < o ? (o = h, i = l < i ? l : i, a = c) : h === o && l < i && (i = l, a = c);
- }
- n = a || n.children[0];
- }
- return n;
- }
- _insert(e, n, r) {
- const s = r ? e : this.toBBox(e), i = [], o = this._chooseSubtree(s, this.data, n, i);
- for (o.children.push(e), Xn(o, s); n >= 0 && i[n].children.length > this._maxEntries; )
- this._split(i, n), n--;
- this._adjustParentBBoxes(s, i, n);
- }
- // split overflowed node into two
- _split(e, n) {
- const r = e[n], s = r.children.length, i = this._minEntries;
- this._chooseSplitAxis(r, i, s);
- const o = this._chooseSplitIndex(r, i, s), a = yn(r.children.splice(o, r.children.length - o));
- 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);
- }
- _splitRoot(e, n) {
- this.data = yn([e, n]), this.data.height = e.height + 1, this.data.leaf = false, vn(this.data, this.toBBox);
- }
- _chooseSplitIndex(e, n, r) {
- let s, i = 1 / 0, o = 1 / 0;
- for (let a = n; a <= r - n; a++) {
- const u = Kn(e, 0, a, this.toBBox), c = Kn(e, a, r, this.toBBox), l = I0(u, c), h = Ps(u) + Ps(c);
- l < i ? (i = l, s = a, o = h < o ? h : o) : l === i && h < o && (o = h, s = a);
- }
- return s || r - n;
- }
- // sorts node children by the best axis for split
- _chooseSplitAxis(e, n, r) {
- 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);
- o < a && e.children.sort(s);
- }
- // total margin of all possible split distributions where each node is at least m full
- _allDistMargin(e, n, r, s) {
- e.children.sort(s);
- const i = this.toBBox, o = Kn(e, 0, n, i), a = Kn(e, r - n, r, i);
- let u = Dr(o) + Dr(a);
- for (let c = n; c < r - n; c++) {
- const l = e.children[c];
- Xn(o, e.leaf ? i(l) : l), u += Dr(o);
- }
- for (let c = r - n - 1; c >= n; c--) {
- const l = e.children[c];
- Xn(a, e.leaf ? i(l) : l), u += Dr(a);
- }
- return u;
- }
- _adjustParentBBoxes(e, n, r) {
- for (let s = r; s >= 0; s--)
- Xn(n[s], e);
- }
- _condense(e) {
- for (let n = e.length - 1, r; n >= 0; n--)
- 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);
- }
- };
- function _0(t, e, n) {
- if (!n)
- return e.indexOf(t);
- for (let r = 0; r < e.length; r++)
- if (n(t, e[r]))
- return r;
- return -1;
- }
- function vn(t, e) {
- Kn(t, 0, t.children.length, e, t);
- }
- function Kn(t, e, n, r, s) {
- s || (s = yn(null)), s.minX = 1 / 0, s.minY = 1 / 0, s.maxX = -1 / 0, s.maxY = -1 / 0;
- for (let i = e; i < n; i++) {
- const o = t.children[i];
- Xn(s, t.leaf ? r(o) : o);
- }
- return s;
- }
- function Xn(t, e) {
- 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;
- }
- function E0(t, e) {
- return t.minX - e.minX;
- }
- function C0(t, e) {
- return t.minY - e.minY;
- }
- function Ps(t) {
- return (t.maxX - t.minX) * (t.maxY - t.minY);
- }
- function Dr(t) {
- return t.maxX - t.minX + (t.maxY - t.minY);
- }
- function R0(t, e) {
- 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));
- }
- function I0(t, e) {
- 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);
- return Math.max(0, s - n) * Math.max(0, i - r);
- }
- function ks(t, e) {
- return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;
- }
- function xr(t, e) {
- return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY;
- }
- function yn(t) {
- return {
- children: t,
- height: 1,
- leaf: true,
- minX: 1 / 0,
- minY: 1 / 0,
- maxX: -1 / 0,
- maxY: -1 / 0
- };
- }
- function Na(t, e, n, r, s) {
- const i = [e, n];
- for (; i.length; ) {
- if (n = i.pop(), e = i.pop(), n - e <= r)
- continue;
- const o = e + Math.ceil((n - e) / r / 2) * r;
- wl(t, o, e, n, s), i.push(e, o, o, n);
- }
- }
- var $R = class {
- constructor(e = false) {
- C(this, "_tree", /* @__PURE__ */ new Map());
- C(this, "_oneCellCache", /* @__PURE__ */ new Map());
- C(this, "_kdTree", /* @__PURE__ */ new Map());
- this._enableOneCellCache = e;
- }
- dispose() {
- this.clear();
- }
- getTree(e, n) {
- 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);
- }
- _getOneCellCache(e, n, r, s) {
- 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);
- }
- _removeOneCellCache(e, n, r, s, i) {
- const o = this._oneCellCache.get(e);
- if (!o)
- return;
- const a = o.get(n);
- if (!a)
- return;
- const u = a.get(r);
- if (!u)
- return;
- const c = u.get(s);
- c && c.delete(i);
- }
- _removeCellCacheByRange(e) {
- const { unitId: n, sheetId: r, range: s, id: i } = e, o = this._oneCellCache.get(n);
- if (!o)
- return;
- const a = o.get(r);
- if (!a)
- return;
- const { startRow: u, startColumn: c, endRow: l, endColumn: h } = s;
- for (let d = u; d <= l; d++) {
- const f = a.get(d);
- if (f)
- for (let E = c; E <= h; E++) {
- const R = f.get(E);
- R && R.delete(i);
- }
- }
- }
- _insertOneCellCache(e, n, r, s, i) {
- this._getOneCellCache(e, n, r, s).add(i);
- }
- _getRdTreeItems(e) {
- const n = [];
- for (const [r, s] of e)
- for (const [i, o] of s)
- n.push({
- x: i,
- y: r,
- ids: o
- });
- return n;
- }
- _searchByOneCellCache(e) {
- var E;
- 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);
- if (!c)
- return [];
- const { tree: l, items: h } = c, d = l.range(o, i, u, a), f = [];
- for (const R of d) {
- const O = h[R];
- f.push(...Array.from(O.ids));
- }
- return f;
- }
- /**
- * Open the kd-tree search state.
- * The kd-tree is used to search for data in a single cell.
- */
- openKdTree() {
- var e;
- for (const [n, r] of this._oneCellCache) {
- this._kdTree.has(n) || this._kdTree.set(n, /* @__PURE__ */ new Map());
- for (const [s, i] of r) {
- const o = this._getRdTreeItems(i), a = new ji(o.length);
- (e = this._kdTree.get(n)) == null || e.set(s, {
- tree: a,
- items: o
- });
- for (const u of o)
- a.add(u.x, u.y);
- a.finish();
- }
- }
- }
- closeKdTree() {
- var e;
- for (const [n, r] of this._oneCellCache)
- for (const [s, i] of r)
- (e = this._kdTree.get(n)) == null || e.set(s, void 0);
- }
- insert(e) {
- const { unitId: n, sheetId: r, range: s, id: i } = e;
- if (!n || n.length === 0)
- return;
- let { startRow: o, endRow: a, startColumn: u, endColumn: c } = s;
- if (this._enableOneCellCache && o === a && u === c) {
- this._insertOneCellCache(n, r, o, u, i);
- return;
- }
- const l = this.getTree(n, r);
- 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({
- minX: u,
- minY: o,
- maxX: c,
- maxY: a,
- id: i
- });
- }
- bulkInsert(e) {
- for (const n of e)
- this.insert(n);
- }
- *searchGenerator(e) {
- var a;
- const { unitId: n, sheetId: r, range: s } = e;
- if (this._enableOneCellCache) {
- const u = this._searchByOneCellCache(e);
- for (const c of u)
- yield c;
- }
- const i = (a = this._tree.get(n)) == null ? void 0 : a.get(r);
- if (!i)
- return;
- const o = i.search({
- minX: s.startColumn,
- minY: s.startRow,
- maxX: s.endColumn,
- maxY: s.endRow
- });
- for (const u of o)
- yield u.id;
- }
- bulkSearch(e, n) {
- const r = /* @__PURE__ */ new Set();
- for (const s of e)
- for (const i of this.searchGenerator(s))
- (n == null ? void 0 : n.has(i)) !== true && r.add(i);
- return r;
- }
- removeById(e, n) {
- var r, s;
- 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));
- }
- _removeRTreeItem(e) {
- const { unitId: n, sheetId: r, range: s, id: i } = e, o = this.getTree(n, r), a = o.search({
- minX: s.startColumn,
- minY: s.startRow,
- maxX: s.endColumn,
- maxY: s.endRow
- });
- for (let u = 0; u < a.length; u++)
- a[u].id === i && o.remove(a[u]);
- }
- remove(e) {
- const { unitId: n, sheetId: r, range: s, id: i } = e, { startRow: o, startColumn: a, endRow: u, endColumn: c } = s;
- this._enableOneCellCache ? o === u && a === c ? this._removeOneCellCache(n, r, s.startRow, s.startColumn, i) : (this._removeCellCacheByRange(e), this._removeRTreeItem(e)) : this._removeRTreeItem(e);
- }
- bulkRemove(e) {
- for (const n of e)
- this.remove(n);
- }
- clear() {
- this._tree.clear(), this._oneCellCache.clear();
- }
- toJSON() {
- const e = {};
- return this._tree.forEach((n, r) => {
- e[r] = {}, n.forEach((s, i) => {
- e[r][i] = s.toJSON();
- });
- }), e;
- }
- fromJSON(e) {
- this._tree.clear();
- for (const n in e) {
- this._tree.set(n, /* @__PURE__ */ new Map());
- for (const r in e[n]) {
- const s = new Aa();
- s.fromJSON(e[n][r]), this._tree.get(n).set(r, s);
- }
- }
- }
- };
- Hl();
- export {
- Subscription,
- noop,
- Observable,
- Subject,
- BehaviorSubject,
- ReplaySubject,
- animationFrameScheduler,
- EMPTY,
- of,
- isObservable,
- firstValueFrom,
- map,
- combineLatest,
- fromEvent,
- merge,
- filter,
- bufferTime,
- bufferWhen,
- combineLatestWith,
- debounceTime,
- take,
- distinctUntilChanged,
- first,
- shareReplay,
- skip,
- startWith,
- switchMap,
- takeUntil,
- tap,
- throttleTime,
- withLatestFrom,
- b0,
- S0,
- A0,
- nu,
- N0,
- ru,
- cs,
- T0,
- M0,
- D0,
- x0,
- L0,
- su,
- iu,
- Hd,
- Wd,
- U0,
- P0,
- k0,
- zd,
- ou,
- ao,
- uo,
- lo,
- co,
- ys,
- at,
- Ge,
- $t,
- Ct,
- Jd,
- Zd,
- tf,
- nf,
- ot,
- of2,
- F0,
- $0,
- go,
- Ot,
- ds,
- gu,
- vf,
- B0,
- j0,
- H0,
- Af,
- W0,
- Tf,
- z0,
- Y0,
- V0,
- G0,
- K0,
- Mf,
- Df,
- wo,
- xf,
- Lf,
- Uf,
- Ze,
- X0,
- Mi,
- nt,
- J0,
- Z0,
- fs,
- Ff,
- $f,
- Mt,
- Bf,
- ar,
- Pt,
- Yf,
- Ys,
- mu,
- Q0,
- Gf,
- Kf,
- q0,
- eC,
- tC,
- Xf,
- nC,
- Jf,
- rC,
- sC,
- mr,
- Zf,
- iC,
- _u,
- Xe,
- Eu,
- vt,
- Cu,
- Ru,
- Iu,
- vu,
- yu,
- wu,
- oC,
- Ou,
- ur,
- Zr,
- bu,
- Qf,
- qf,
- eg,
- tg,
- Su,
- Au,
- er,
- Nu,
- Xt,
- hn,
- xn,
- Vs,
- Gs,
- Bt,
- we,
- dn,
- ft,
- Di,
- re,
- qt,
- Mo,
- aC,
- Os,
- uC,
- Do,
- gg,
- gs,
- Ln,
- pg,
- Ks,
- Xs,
- lC,
- cC,
- xo,
- Nt,
- hC,
- dC,
- Pe,
- fC,
- gC,
- pC,
- mC,
- De,
- tt,
- _C,
- Sg,
- Ag,
- EC,
- zn,
- Ng,
- CC,
- RC,
- Tg,
- IC,
- Lt,
- vC,
- yC,
- wC,
- OC,
- bC,
- SC,
- AC,
- Lu,
- Mg,
- NC,
- rn,
- Li,
- TC,
- MC,
- fp,
- gp,
- pp,
- DC,
- xC,
- Qr,
- Cr,
- Op,
- fn,
- Vo,
- Go,
- LC,
- UC,
- Ko,
- kt,
- PC,
- kC,
- FC,
- $C,
- gt,
- Ap,
- BC,
- Np,
- tr,
- jC,
- Uu,
- HC,
- en,
- WC,
- zC,
- Qo,
- YC,
- VC,
- $p,
- GC,
- KC,
- XC,
- ps,
- Bp,
- jp,
- Te,
- ms,
- mn,
- An,
- Hp,
- ku,
- Wp,
- zp,
- Yp,
- Vp,
- Gp,
- Kp,
- Xp,
- Jp,
- Zp,
- Qp,
- qp,
- em,
- tm,
- nm,
- rm,
- sm,
- im,
- Yn,
- om,
- am,
- um,
- lm,
- cm,
- hm,
- dm,
- fm,
- gm,
- Fu,
- pm,
- mm,
- Fe,
- Ui,
- JC,
- ce,
- _s,
- Nm,
- Ft,
- Es,
- ZC,
- el,
- ei,
- $m,
- Bm,
- QC,
- jm,
- Dt,
- qC,
- Hm,
- Wm,
- ha,
- Bn,
- lr,
- Km,
- Xm,
- Ke,
- tn,
- tl,
- jt,
- O_,
- ln,
- eR,
- st,
- cr,
- Qt,
- Jt,
- hr,
- nr,
- Zt,
- gn,
- tR,
- Vn,
- nR,
- x_,
- rR,
- sR,
- iR,
- oR,
- Fi,
- al,
- $i,
- ul,
- k_,
- aR,
- uR,
- Sr,
- B_,
- j_,
- lR,
- V_,
- cR,
- G_,
- hR,
- K_,
- dR,
- X_,
- fR,
- J_,
- gR,
- Z_,
- Q_,
- eE,
- es,
- tE,
- pR,
- mR,
- ts,
- cl,
- Ar,
- Gn,
- Nr,
- Tr,
- _R,
- oE,
- ER,
- aE,
- CR,
- RR,
- IR,
- vR,
- yR,
- wR,
- _n,
- ni,
- Ve,
- Ht,
- cn,
- RE,
- IE,
- Nn,
- Tn,
- ri,
- Bi,
- ii,
- rr,
- oi,
- bE,
- SE,
- AE,
- NE,
- Vr,
- ai,
- LE,
- fl,
- UE,
- PE,
- kE,
- Ra,
- OR,
- ns,
- va,
- VE,
- ml,
- GE,
- ss,
- _l,
- El,
- Cl,
- Rl,
- Il,
- ci,
- hi,
- di,
- gi,
- pi,
- d0,
- bR,
- SR,
- AR,
- NR,
- TR,
- f0,
- MR,
- DR,
- xR,
- LR,
- UR,
- PR,
- vl,
- g0,
- Oa,
- kR,
- FR,
- p0,
- Aa,
- $R
- };
- //# sourceMappingURL=chunk-23V3HWTR.js.map
|